Commit a62bdf36 authored by Robert Schmidt's avatar Robert Schmidt

Merge branch 'integration_2023_w41' into 'develop'

integration_2023_w41

See merge request oai/openairinterface5g!2394

* !2389 Remove global variable rx_spatial_power
* !2364 NR UE PUCCH2 sanitize errors
* !2352 Break DCI processing function into smaller pieces
* !2391 Remove calloc from L1 at CSIRS_PDU conversion function
* !2393 Fix UE assertion due to PUCCH resource lookup all BWPs
* !2307 Improve documentation for L2sim Readme
* !2310 doc(websvr): how to install properly the dependencies
parents bba14188 5231b977
......@@ -12,18 +12,81 @@
</tr>
</table>
This page is only valid for an `Ubuntu18` host.
This page is valid for an `Ubuntu18` host.
It is also valid for `Ubuntu 20.04`.
This tutorial is only valid once this file is merged into the `develop` branch.
# 1. Adapt the `docker-compose` to your environment #
The yaml file is in the following directory: `ci-scripts/yaml_files/5g_l2sim_tdd`
# 1. Retrieving the images on Docker-Hub #
In the `SMF` section, provide your own DNS IP address:
```yaml
DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100
```
gNB section:
All the parameter values will be taken from the mounted config file:
```yaml
oai-gnb:
[...]
volumes:
- ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf
```
You need to provide your docker-host primary IP address and interface name: in our case `172.21.16.128` and `eno1`.
The following refers to the contents of the previously mentioned .conf file
```yaml
GNB_NGA_IF_NAME: eno1
GNB_NGA_IP_ADDRESS: 172.21.16.128
GNB_NGU_IF_NAME: eno1
GNB_NGU_IP_ADDRESS: 172.21.16.128
```
For the UE, all the parameter values will be taken from the mounted config
file, in the section `oai-nr-ue0`:
```yaml
oai-nr-ue0:
[...]
volumes:
- ../../conf_files/nrue.band78.106prb.l2sim.conf:/opt/oai-nr-ue/etc/nr-ue.conf
- ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results
```
In this section, you need to set the proper values for `local_n_if_name` and `remote_n_address`
where the UE configuration (mounted to `/opt/oai-nr-ue/etc/nr-ue.conf`) reads:
```libconfig
MACRLCs = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "eno1";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
...
```
This tutorial is a first draft. This nFAPI feature and the proxy are still under development.
At time of writing, we were able to run in `host-mode`, 1 `NR-UE` and just ping traffic.
# 2. Retrieving the images on Docker-Hub #
Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`.
Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`.
```bash
$ docker login
docker login
```
```bash
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username:
Password:
......@@ -32,33 +95,33 @@ Password:
Now pull images.
```bash
$ docker pull mysql:8.0
$ docker pull oaisoftwarealliance/oai-amf:v1.5.0
$ docker pull oaisoftwarealliance/oai-nrf:v1.5.0
$ docker pull oaisoftwarealliance/oai-smf:v1.5.0
$ docker pull oaisoftwarealliance/oai-spgwu-tiny:v1.5.0
$ docker pull oaisoftwarealliance/trf-gen-cn5g:focal
$ docker pull oaisoftwarealliance/oai-gnb:develop
$ docker pull oaisoftwarealliance/oai-nr-ue:develop
$ docker pull oaisoftwarealliance/proxy:develop
docker pull mysql:8.0
docker pull oaisoftwarealliance/oai-amf:v1.5.0
docker pull oaisoftwarealliance/oai-nrf:v1.5.0
docker pull oaisoftwarealliance/oai-smf:v1.5.0
docker pull oaisoftwarealliance/oai-spgwu-tiny:v1.5.0
docker pull oaisoftwarealliance/trf-gen-cn5g:focal
docker pull oaisoftwarealliance/oai-gnb:develop
docker pull oaisoftwarealliance/oai-nr-ue:develop
docker pull oaisoftwarealliance/proxy:develop
```
And **re-tag** them for tutorials' docker-compose file to work.
```bash
$ docker image tag oaisoftwarealliance/proxy:develop oai-lte-multi-ue-proxy:latest
docker image tag oaisoftwarealliance/proxy:develop oai-lte-multi-ue-proxy:latest
```
```bash
$ docker logout
docker logout
```
Note that the proxy image is based on the source available at [https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy](https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy).
At time of writing, the `latest` tag corresponded to `56cfdc046a5f96d5e67d42a2fc2bf6ba2fe58b41` commit.
# 2. Deploy containers #
# 3. Deploy containers #
**CAUTION: this SHALL be done in multiple steps.**
......@@ -72,11 +135,13 @@ The `gNB`, `proxy` and `NR-UE` containers will be deployed in `host`-mode. It wi
sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
```
## 2.1. Deploy OAI 5G Core Network ##
## 3.1. Deploy OAI 5G Core Network ##
```bash
$ cd ci-scripts/yaml_files/5g_l2sim_tdd
$ docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn
cd ci-scripts/yaml_files/5g_l2sim_tdd
docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn
```
```bash
Creating network "l2sim-oai-public-net" with driver "bridge"
Creating network "l2sim-oai-traffic_net-net" with driver "bridge"
Creating l2sim-oai-nrf ... done
......@@ -90,7 +155,9 @@ Creating l2sim-oai-ext-dn ... done
Wait for a bit.
```bash
$ docker-compose ps -a
docker-compose ps -a
```
```bash
Name Command State Ports
-------------------------------------------------------------------------------------------------
l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
......@@ -104,7 +171,9 @@ l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 880
At this point, you can prepare a capture on the newly-created public docker bridges:
```bash
$ ifconfig
ifconfig
```
```bash
...
l2sim-public: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.71.129 netmask 255.255.255.192 broadcast 192.168.71.191
......@@ -124,16 +193,19 @@ l2sim-traffic: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
TX packets 3999 bytes 23367972 (23.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
...
$ sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 and not arp and not port 53 and not port 2152 and not port 2153)" -i l2sim-public -i l2sim-traffic -w /tmp/capture_5g_l2sim_tdd.pcap > /tmp/tshark.log 2>&1 &
```
```bash
sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 and not arp and not port 53 and not port 2152 and not port 2153)" -i l2sim-public -i l2sim-traffic -w /tmp/capture_5g_l2sim_tdd.pcap > /tmp/tshark.log 2>&1 &
```
## 2.2. Deploy OAI gNB in Standalone Mode as a VNF ##
## 3.2. Deploy OAI gNB in Standalone Mode as a VNF ##
**CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).**
```bash
$ docker-compose up -d oai-gnb
docker-compose up -d oai-gnb
```
```bash
l2sim-oai-nrf is up-to-date
l2sim-oai-spgwu is up-to-date
l2sim-oai-ext-dn is up-to-date
......@@ -144,6 +216,8 @@ Wait for a bit.
```bash
$ docker-compose ps -a
```
```bash
Name Command State Ports
-------------------------------------------------------------------------------------------------
l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
......@@ -157,8 +231,10 @@ l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 880
You can verify that the `gNB` is connected with the `AMF`:
```bagh
$ docker logs rfsim5g-oai-amf
```bash
docker logs l2sim-oai-amf
```
```bash
...
[AMF] [amf_app] [info ] |----------------------------------------------------gNBs' information-------------------------------------------|
[AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN |
......@@ -167,10 +243,12 @@ $ docker logs rfsim5g-oai-amf
...
```
## 2.3. Deploy OAI NR-UE and proxy
## 3.3. Deploy OAI NR-UE and proxy
```bash
$ docker-compose up -d proxy oai-nr-ue0
docker-compose up -d proxy oai-nr-ue
```
```bash
l2sim-mysql is up-to-date
l2sim-oai-nrf is up-to-date
l2sim-oai-amf is up-to-date
......@@ -185,7 +263,9 @@ Creating l2sim-proxy ... done
Wait for a bit.
```bash
$ docker-compose ps -a
docker-compose ps -a
```
```bash
Name Command State Ports
-------------------------------------------------------------------------------------------------
l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
......@@ -197,8 +277,11 @@ l2sim-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/
l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp
l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp
l2sim-proxy /oai-lte-multi-ue-proxy/bi ... Up (healthy)
$ docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-nrf l2sim-oai-smf l2sim-oai-spgwu l2sim-proxy
```
```bash
docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-nrf l2sim-oai-smf l2sim-oai-spgwu l2sim-proxy
```
```bash
CONTAINER CPU % MEM USAGE / LIMIT MEM %
l2sim-mysql 0.03% 206.7MiB / 62.54GiB 0.32%
l2sim-oai-amf 4.05% 29.49MiB / 62.54GiB 0.05%
......@@ -216,7 +299,9 @@ l2sim-proxy 6.97% 290.4MiB / 62.54GiB 0.45%
But the CPU speed matters; I am running on a fast server:
```bash
$ lscpu
lscpu
```
```bash
Architecture: x86_64
CPU(s): 16
...
......@@ -239,7 +324,9 @@ We will work on this issue.
Making sure the OAI UE is connected:
```bash
$ docker exec -it l2sim-oai-nr-ue /bin/bash
docker exec -it l2sim-oai-nr-ue0 /bin/bash
```
```bash
root@bb4d400a832d:/opt/oai-nr-ue# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.71.137 netmask 255.255.255.192 broadcast 192.168.71.191
......@@ -266,14 +353,19 @@ oaitun_ue1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```
# 3. Check traffic #
# 4. Check traffic #
## 3.1. Check your Internet connectivity ##
## 4.1. Check your Internet connectivity ##
You can also check with the `ext-dn` container (IP address is `192.168.72.135` in docker-compose)
```bash
$ docker exec -it l2sim-oai-nr-ue /bin/bash
docker exec -it l2sim-oai-nr-ue0 /bin/bash
```
```bash
ping -I oaitun_ue1 -c 20 192.168.72.135
```
```bash
root@bb4d400a832d# ping -I oaitun_ue1 -c 20 192.168.72.135
PING 192.168.72.135 (192.168.72.135) from 12.1.1.2 oaitun_ue1: 56(84) bytes of data.
64 bytes from 192.168.72.135: icmp_seq=1 ttl=63 time=65.1 ms
......@@ -287,10 +379,12 @@ PING 192.168.72.135 (192.168.72.135) from 12.1.1.2 oaitun_ue1: 56(84) bytes of d
rtt min/avg/max/mdev = 16.413/120.639/209.673/57.159 ms
```
# 4. Un-deployment #
# 5. Un-deployment #
```bash
$ docker-compose down
docker-compose down
```
```bash
Stopping l2sim-oai-nr-ue2 ... done
Stopping l2sim-oai-nr-ue ... done
Stopping l2sim-oai-gnb ... done
......@@ -313,68 +407,3 @@ Removing network l2sim-oai-public-net
Removing network l2sim-oai-traffic-net
```
# 5. Adapt the `docker-compose` to your environment #
In the `SMF` section, provide your own DNS IP address:
```yaml
DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100
```
gNB section:
All the parameter values will be taken from the mounted config file
```yaml
oai-gnb:
[...]
volumes:
- ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf
```
with the configuration file having something like:
```libconfig
NETWORK_INTERFACES :
{
GNB_INTERFACE_NAME_FOR_NG_AMF = "eno1";
GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.128";
GNB_INTERFACE_NAME_FOR_NGU = "eno1";
GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.128";
GNB_PORT_FOR_NGU = 2152; # Spec 2152
};
```
For the UE, all the parameter values will be taken from the mounted config
file. Example:
```yaml
oai-nr-ue0:
[...]
volumes:
- ../../conf_files/nrue.band78.106prb.l2sim.conf:/opt/oai-nr-ue/etc/nr-ue.conf
- ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results
```
where the UE configuration (mounted to `/opt/oai-nr-ue/etc/nr-ue.conf`) reads
```libconfig
MACRLCs = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "eno1";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
...
```
This tutorial is a first draft. This nFAPI feature and the proxy are still under development.
At time of writing, we were able to run in `host-mode`, 1 `NR-UE` and just ping traffic.
Later development will include:
- deploying `gNB-VNF`, `proxy` and `UE` in isolated containers (with their own IP address)
- more UEs
- more traffic (`UDP` and `TCP`)
## building the webserver
[[_TOC_]]
# Building the webserver
back-end (the http server) and front-end (the html and javascript code for the browsers) are both built when the build of the `websrv` optional library is requested.
You can include the web server interface components in your build using the build_oai script with the `--build-lib "telnetsrv websrv"` option.
You can include the web server interface components in your build using the `build_oai` script with the `--build-lib "telnetsrv websrv"` option.
The related cmake cache entry in `ran_build/build/CMakeCache.txt` for building the web server
is `ENABLE_WEBSRV:BOOL=ON`
When cmake configuration has been completed, with websrv enabled and all dependencies met,font-end and back-end
When cmake configuration has been completed, with websrv enabled and all dependencies met, font-end and back-end
can be built separately, using respectively `make websrvfront` or `make websrv` from the build repository (replace make by ninja if you
build using ninja).
## Additional dependencies for the backend
To build the webserver frontend, you need additionally
###### build example when back-end dependency is not installed
1. the [ulfius library](https://github.com/babelouest/ulfius)
2. the [jansson library](https://github.com/akheron/jansson-debian)
```
./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
Will compile gNB
Will compile NR UE
Enabling build of optional shared library telnetsrv
Enabling build of optional shared library websrv
Enabling build of optional shared library nrscope
OPENAIR_DIR = /usr/local/oai/develop_unmodified/openairinterface5g
Running "cmake -DOAI_USRP=ON -DENABLE_TELNETSRV=ON -DENABLE_WEBSRV=ON -DENABLE_NRSCOPE=ON ../../.."
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Ccache not found. Consider installing it for faster compilation. Command: sudo apt/dnf install ccache
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Check if /opt/asn1c/bin/asn1c supports -gen-APER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-UPER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-JER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-BER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-OER
-- CMAKE_BUILD_TYPE is RelWithDebInfo
-- CPUARCH x86_64
-- AVX512 intrinsics are OFF
-- AVX2 intrinsics are ON
-- Found Git: /usr/bin/git (found version "2.34.1")
-- Checking for module 'libconfig'
-- Found libconfig, version 1.5
-- Checking for module 'openssl'
-- Found openssl, version 3.0.2
-- Checking for module 'blas'
-- Found blas, version 3.10.3
-- Checking for module 'lapacke'
-- Found lapacke, version 3.10.0
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Add enb specific telnet functions in libtelnetsrv_enb.so
-- No specific telnet functions for gnb
-- No specific telnet functions for 4Gue
-- Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so
-- Add CI specific telnet functions in libtelnetsrv_ci.so
CMake Error at common/utils/websrv/CMakeLists.txt:31 (find_library):
Could not find ULFIUS using the following names: libulfius.so
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
You can fix this first dependency problem, the backend dependency, by installing the libulfius library:
These libraries are not handled by `build_oai -I`
On ubuntu: `sudo apt-get install libulfius-dev`, for fedora: `dnf install libulfius`. Some distribution don't have
libulfius package, instruction to install it can be found [here](https://github.com/babelouest/ulfius/blob/master/INSTALL.md)
### Ubuntu
###### build example when front-end dependency is not installed
```bash
$ sudo apt-get update
$ sudo apt-get install -y libulfius-dev libjansson-dev npm curl wget
```
./build_oai --build-lib "websrv telnetsrv nrscope"
./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
Will compile gNB
Will compile NR UE
Enabling build of optional shared library telnetsrv
Enabling build of optional shared library websrv
Enabling build of optional shared library nrscope
OPENAIR_DIR = /usr/local/oai/develop_unmodified/openairinterface5g
Running "cmake -DOAI_USRP=ON -DENABLE_TELNETSRV=ON -DENABLE_WEBSRV=ON -DENABLE_NRSCOPE=ON ../../.."
-- Ccache not found. Consider installing it for faster compilation. Command: sudo apt/dnf install ccache
-- Check if /opt/asn1c/bin/asn1c supports -gen-APER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-UPER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-JER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-BER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-OER
-- CMAKE_BUILD_TYPE is RelWithDebInfo
-- CPUARCH x86_64
-- AVX512 intrinsics are OFF
-- AVX2 intrinsics are ON
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Add enb specific telnet functions in libtelnetsrv_enb.so
-- No specific telnet functions for gnb
-- No specific telnet functions for 4Gue
-- Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so
-- Add CI specific telnet functions in libtelnetsrv_ci.so
-- found libulfius for websrv
-- found libjansson for websrv
CMake Error at common/utils/websrv/CMakeLists.txt:45 (find_program):
Could not find NPM using the following names: npm
### Fedora(-based OS)
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```bash
$ sudo dnf update -y
$ sudo dnf install -y jansson-devel npm curl wget
```
Currently the web server frontend can run with nodejs 18, you can check the version (if any) installed on your system entering the `node -v` command.
To prevent difficult situations with nodejs or npm versions it is better to specifically install the required nodejs version (after removing existing versions of npm and nodejs), as explained
[here](https://www.stewright.me/2023/04/install-nodejs-18-on-ubuntu-22-04/) for ubuntu. Similar instructions can be found for other distributions.
It is also possible to make several nodejs versions co-habiting on your system, this is beyond this doc.
ulfius has to be installed as explained [here](https://github.com/babelouest/ulfius/blob/master/INSTALL.md#pre-compiled-packages).
## Additional dependencies for the frontend
###### example: installing nodejs 18 on ubuntu
```
Currently the web server frontend can run with nodejs 18, you can check the
version (if any) installed on your system entering the `node -v` command.
curl -s https://deb.nodesource.com/setup_18.x | sudo bash
To prevent difficult situations with nodejs or npm versions it is better to
specifically install the required nodejs version (after removing existing
versions of npm and nodejs), as explained
[here](https://www.stewright.me/2023/04/install-nodejs-18-on-ubuntu-22-04/) for
ubuntu. Similar instructions can be found for other distributions. It is also
possible to make several nodejs versions co-habiting on your system, this is
beyond this doc.
## Installing the NodeSource Node.js 18.x repo...
For example, to install a specific nodeJS version, you can run the below
command, with the typical output printed below for your convenience:
```bash
$ curl -s https://deb.nodesource.com/setup_18.x | sudo bash
## Populating apt-get cache...
+ apt-get update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [305 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [678 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [42.8 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [11.2 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [553 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:10 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [770 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [39.8 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [471 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [892 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [214 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [100 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [714 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [114 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [968 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [648 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [211 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [288 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:23 http://us.archive.ubuntu.com/ubuntu jammy-backports/main amd64 DEP-11 Metadata [4,924 B]
Get:24 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [15.6 kB]
Fetched 7,379 kB in 4s (2,095 kB/s)
Reading package lists... Done
apt-get update
## Confirming "jammy" is supported...
......@@ -176,15 +77,6 @@ Reading package lists... Done
## Running `apt-get update` for you...
+ apt-get update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:2 https://deb.nodesource.com/node_18.x jammy InRelease [4,563 B]
Get:3 https://deb.nodesource.com/node_18.x jammy/main amd64 Packages [776 B]
Hit:4 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 5,339 B in 1s (7,666 B/s)
Reading package lists... Done
## Run `sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
......@@ -214,88 +106,46 @@ Preparing to unpack .../nodejs_18.17.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (18.17.1-deb-1nodesource1) ...
Setting up nodejs (18.17.1-deb-1nodesource1) ...
Processing triggers for man-db (2.10.2-1) ...
```
If you want to put a more recent version, refer to the steps below, which is
common for any OS:
```bash
$ sudo npm -g install @angular/cli@latest npm@latest
$ sudo npm install n -g
# Install the LTS version
$ n lts
# Or install the latest version
$ n latest
$ node --version
```
###### build example when dependencies are met
``` bash
./build_oai --ninja -c -C --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
Will compile gNB
Will compile NR UE
Enabling build of optional shared library telnetsrv
Enabling build of optional shared library websrv
Enabling build of optional shared library nrscope
OPENAIR_DIR = /usr/local/oai/develop_unmodified/openairinterface5g
Erased all previously producted files
Running "cmake -GNinja -DOAI_USRP=ON -DENABLE_TELNETSRV=ON -DENABLE_WEBSRV=ON -DENABLE_NRSCOPE=ON ../../.."
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Ccache not found. Consider installing it for faster compilation. Command: sudo apt/dnf install ccache
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Check if /opt/asn1c/bin/asn1c supports -gen-APER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-UPER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-JER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-BER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-OER
-- CMAKE_BUILD_TYPE is RelWithDebInfo
-- CPUARCH x86_64
-- AVX512 intrinsics are OFF
-- AVX2 intrinsics are ON
-- Found Git: /usr/bin/git (found version "2.34.1")
-- Checking for module 'libconfig'
-- Found libconfig, version 1.5
-- Checking for module 'openssl'
-- Found openssl, version 3.0.2
-- Checking for module 'blas'
-- Found blas, version 3.10.3
-- Checking for module 'lapacke'
-- Found lapacke, version 3.10.0
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Add enb specific telnet functions in libtelnetsrv_enb.so
-- No specific telnet functions for gnb
-- No specific telnet functions for 4Gue
-- Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so
-- Add CI specific telnet functions in libtelnetsrv_ci.so
-- found libulfius for websrv
-- found libjansson for websrv
-- found npm for websrv
-- Configuring webserver backend
-- Configuring webserver frontend
-- No Doxygen documentation requested
-- libforms library, required for scopes, found at /usr/lib/libforms.so
-- Found UHD: /usr/lib/x86_64-linux-gnu/libuhd.so
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
cd /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
Running "cmake --build . --target nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts -- -j8"
Log file for compilation is being written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/log/all.txt
nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts compiled
BUILD SHOULD BE SUCCESSFUL
## Building the webserver
```
### Backend
###### building and installing the front-end after cmake has been successfully configured
The websrv targets won't be available till cmake has been successfully configured with the websrv option enabled
```bash
$ cd <oai repository>/openairinterface5g/cmake_targets
$ ./build_oai --build-lib websrv
```
or, without the help of the `build_oai` script:
```bash
$ cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
$ make websrv
```
cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
make websrvfront
This will create the `libwebsrv.so` file in the `cmake_targets/ran_build/build` directory.
### Frontend
The frontend targets needs to be triggered explicitly:
```bash
$ cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
$ make websrvfront
up to date, audited 1099 packages in 3s
142 packages are looking for funding
......@@ -332,27 +182,59 @@ Built target websrvfront
```
###### building and installing the back-end after cmake has been successfully configured
## Examples
**build example when back-end dependency is not installed**
```bash
cd <oai repository>/openairinterface5g
source oaienv
cd cmake_targets
./build_oai --build-lib websrv
$ ./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
[...]
CMake Error at common/utils/websrv/CMakeLists.txt:31 (find_library):
Could not find ULFIUS using the following names: libulfius.so
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
or, without the help of the `build_oai` script:
**build example when front-end dependency is not installed**
```bash
cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
make websrv
$ ./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
[...]
-- found libulfius for websrv
-- found libjansson for websrv
CMake Error at common/utils/websrv/CMakeLists.txt:45 (find_program):
Could not find NPM using the following names: npm
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
This will create the `libwebsrv.so` file in the `targets/bin` and `cmake_targets/ran_build/build` sub directories of the oai repository.
**build example when dependencies are met**
```bash
$ ./build_oai --ninja -c -C --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
[...]
-- found libulfius for websrv
-- found libjansson for websrv
-- found npm for websrv
-- Configuring webserver backend
-- Configuring webserver frontend
[...]
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
cd /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
Running "cmake --build . --target nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts -- -j8"
Log file for compilation is being written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/log/all.txt
nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts compiled
BUILD SHOULD BE SUCCESSFUL
```
When starting the softmodem, you must specify the **_\-\-websrv_** option to load and start the web server. The web server is loaded via the [oai shared library loader](loader).
# Testing the web server interface
# Running the web server interface
When starting the softmodem, you must specify the `--websrv` option to load and start the web server. The web server is loaded via the [oai shared library loader](loader).
## web server parameters
The web server back-end is using the [oai configuration module](Config/Rtusage). web server parameters must be specified in the websrv section.
......@@ -367,7 +249,7 @@ The web server back-end is using the [oai configuration module](Config/Rtusage).
| | | | |
## running the back-end
To trigger the back-end use the `--websrv` option, possibly modifying the parameters as explained in the previous chapter. The two following commands allow starting the oai gNB and the oai 5G UE on the same computer, starting the telnet server and the web interface on both executables.
To trigger the back-end use the `--websrv` option, possibly modifying the parameters as explained in the [previous section](./websrvuse.md#web-server-parameters). The two following commands allow starting the oai gNB and the oai 5G UE on the same computer, starting the telnet server and the web interface on both executables.
`./nr-softmodem -O /usr/local/oai/conf/gnb.band78.sa.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.serveraddr server --telnetsrv --telnetsrv.listenstdin --websrv --rfsimulator.options chanmod`
......@@ -392,6 +274,7 @@ The interface should be intuitive enough, keeping in mind the following restrict
Some front-end objects, which usage are less intuitive provide a tooltip to help interface usage.
## some webserver screenshots
- [main page](main.png)
- [Configuring logs](logscfg.png)
- [scope interface](scope.png)
......
......@@ -239,19 +239,6 @@ typedef struct {
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_config_request_t;
typedef enum {
NFAPI_NR_DL_DCI_FORMAT_1_0 = 0,
NFAPI_NR_DL_DCI_FORMAT_1_1,
NFAPI_NR_DL_DCI_FORMAT_2_0,
NFAPI_NR_DL_DCI_FORMAT_2_1,
NFAPI_NR_DL_DCI_FORMAT_2_2,
NFAPI_NR_DL_DCI_FORMAT_2_3,
NFAPI_NR_UL_DCI_FORMAT_0_0,
NFAPI_NR_UL_DCI_FORMAT_0_1
} nfapi_nr_dci_format_e;
typedef enum {
NFAPI_NR_RNTI_new = 0,
NFAPI_NR_RNTI_C,
......
......@@ -216,8 +216,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements;
int rx_power[fp->nb_antennas_rx];
allocCast2D(rx_spatial_power, int, ulsch_measurements->rx_spatial_power, nrOfLayers, fp->nb_antennas_rx, true);
allocCast2D(rx_spatial_power_dB, unsigned short, ulsch_measurements->rx_spatial_power_dB, nrOfLayers, fp->nb_antennas_rx, true);
int rx_spatial_power[nrOfLayers][fp->nb_antennas_rx];
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){
rx_power[aarx] = 0;
......@@ -230,7 +229,6 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
rx_spatial_power[aatx][aarx] = 0;
}
rx_spatial_power_dB[aatx][aarx] = (unsigned short)dB_fixed(rx_spatial_power[aatx][aarx]);
rx_power[aarx] += rx_spatial_power[aatx][aarx];
}
LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]);
......
......@@ -25,10 +25,6 @@
#include "PHY/defs_gNB.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
nfapi_nr_rnti_type_e rnti_type,
uint16_t N_RB);
void nr_generate_dci_top(processingData_L1tx_t *msgTx,
int slot,
int32_t *txdataF,
......
......@@ -834,23 +834,23 @@ int nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
return 0;
}
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *convert_csirs_pdu(fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu)
static nfapi_nr_dl_tti_csi_rs_pdu_rel15_t convert_csirs_pdu(const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu)
{
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *dl_tti_csi_rs_pdu = calloc(1, sizeof(nfapi_nr_dl_tti_csi_rs_pdu_rel15_t));
dl_tti_csi_rs_pdu->subcarrier_spacing = csirs_config_pdu->subcarrier_spacing;
dl_tti_csi_rs_pdu->cyclic_prefix = csirs_config_pdu->cyclic_prefix;
dl_tti_csi_rs_pdu->start_rb = csirs_config_pdu->start_rb;
dl_tti_csi_rs_pdu->nr_of_rbs = csirs_config_pdu->nr_of_rbs;
dl_tti_csi_rs_pdu->csi_type = csirs_config_pdu->csi_type;
dl_tti_csi_rs_pdu->row = csirs_config_pdu->row;
dl_tti_csi_rs_pdu->freq_domain = csirs_config_pdu->freq_domain;
dl_tti_csi_rs_pdu->symb_l0 = csirs_config_pdu->symb_l0;
dl_tti_csi_rs_pdu->symb_l1 = csirs_config_pdu->symb_l1;
dl_tti_csi_rs_pdu->cdm_type = csirs_config_pdu->cdm_type;
dl_tti_csi_rs_pdu->freq_density = csirs_config_pdu->freq_density;
dl_tti_csi_rs_pdu->scramb_id = csirs_config_pdu->scramb_id;
dl_tti_csi_rs_pdu->power_control_offset = csirs_config_pdu->power_control_offset;
dl_tti_csi_rs_pdu->power_control_offset_ss = csirs_config_pdu->power_control_offset_ss;
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t dl_tti_csi_rs_pdu;
dl_tti_csi_rs_pdu.subcarrier_spacing = csirs_config_pdu->subcarrier_spacing;
dl_tti_csi_rs_pdu.cyclic_prefix = csirs_config_pdu->cyclic_prefix;
dl_tti_csi_rs_pdu.start_rb = csirs_config_pdu->start_rb;
dl_tti_csi_rs_pdu.nr_of_rbs = csirs_config_pdu->nr_of_rbs;
dl_tti_csi_rs_pdu.csi_type = csirs_config_pdu->csi_type;
dl_tti_csi_rs_pdu.row = csirs_config_pdu->row;
dl_tti_csi_rs_pdu.freq_domain = csirs_config_pdu->freq_domain;
dl_tti_csi_rs_pdu.symb_l0 = csirs_config_pdu->symb_l0;
dl_tti_csi_rs_pdu.symb_l1 = csirs_config_pdu->symb_l1;
dl_tti_csi_rs_pdu.cdm_type = csirs_config_pdu->cdm_type;
dl_tti_csi_rs_pdu.freq_density = csirs_config_pdu->freq_density;
dl_tti_csi_rs_pdu.scramb_id = csirs_config_pdu->scramb_id;
dl_tti_csi_rs_pdu.power_control_offset = csirs_config_pdu->power_control_offset;
dl_tti_csi_rs_pdu.power_control_offset_ss = csirs_config_pdu->power_control_offset_ss;
return dl_tti_csi_rs_pdu;
}
......@@ -862,7 +862,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t
return;
}
const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu = (fapi_nr_dl_config_csirs_pdu_rel15_t*)&ue->csirs_vars[gNB_id]->csirs_config_pdu;
const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu = &ue->csirs_vars[gNB_id]->csirs_config_pdu;
#ifdef NR_CSIRS_DEBUG
LOG_I(NR_PHY, "csirs_config_pdu->subcarrier_spacing = %i\n", csirs_config_pdu->subcarrier_spacing);
......@@ -906,12 +906,12 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t
uint8_t cqi = 0;
uint8_t i1[3];
uint8_t i2[1];
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params = convert_csirs_pdu(csirs_config_pdu);
nr_generate_csi_rs(frame_parms,
ue->nr_csi_info->csi_rs_generated_signal,
AMP,
ue->nr_csi_info,
convert_csirs_pdu((fapi_nr_dl_config_csirs_pdu_rel15_t*)&ue->csirs_vars[gNB_id]->csirs_config_pdu),
&csi_params,
proc->nr_slot_rx,
&N_cdm_groups,
&CDM_group_size,
......
......@@ -759,7 +759,10 @@ void nr_generate_pucch2(const PHY_VARS_NR_UE *ue,
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
// c_init calculation according to TS38.211 subclause
x2 = (((1<<17)*((14*nr_slot_tx) + (l+startingSymbolIndex) + 1)*((2*pucch_pdu->dmrs_scrambling_id) + 1)) + (2*pucch_pdu->dmrs_scrambling_id))%(1U<<31);
uint64_t temp_x2 = 1ll << 17;
temp_x2 *= 14UL * nr_slot_tx + l + startingSymbolIndex + 1;
temp_x2 *= 2UL * pucch_pdu->dmrs_scrambling_id + 1;
x2 = (temp_x2 + 2UL * pucch_pdu->dmrs_scrambling_id) % (1UL << 31);
int reset = 1;
for (int ii=0; ii<=(startingPRB>>2); ii++) {
......
......@@ -237,10 +237,6 @@ static inline int crcType(int nbSeg, int len)
}
typedef struct {
//! estimated received spatial signal power (linear)
fourDimArray_t * rx_spatial_power;
//! estimated received spatial signal power (dB)
fourDimArray_t * rx_spatial_power_dB;
//! estimated rssi (dBm)
int rx_rssi_dBm;
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
......
......@@ -447,7 +447,8 @@ typedef enum {
NR_DL_DCI_FORMAT_2_2,
NR_DL_DCI_FORMAT_2_3,
NR_UL_DCI_FORMAT_0_0,
NR_UL_DCI_FORMAT_0_1
NR_UL_DCI_FORMAT_0_1,
NR_DCI_NONE
} nr_dci_format_t;
typedef enum {
......
......@@ -161,12 +161,17 @@ int nr_get_sf_periodicBSRTimer(uint8_t bucketSize);
*/
int nr_get_sf_retxBSRTimer(uint8_t retxBSR_Timer);
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, fapi_nr_dci_indication_pdu_t *dci_ind);
int8_t nr_ue_process_dci(module_id_t module_id,
int cc_id,
frame_t frame,
int slot,
dci_pdu_rel15_t *dci,
fapi_nr_dci_indication_pdu_t *dci_ind);
int nr_ue_process_dci_indication_pdu(module_id_t module_id, int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
int8_t nr_ue_process_csirs_measurements(module_id_t module_id, frame_t frame, int slot, fapi_nr_csirs_measurements_t *csirs_measurements);
uint32_t get_ssb_frame(uint32_t test);
int8_t nr_ue_process_csirs_measurements(module_id_t module_id,
frame_t frame,
int slot,
fapi_nr_csirs_measurements_t *csirs_measurements);
void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger, int frame, int slot);
bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac,
......@@ -415,6 +420,6 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
dci_pdu_rel15_t *dci,
RAR_grant_t *rar_grant,
uint16_t rnti,
const nr_dci_format_t *dci_format);
const nr_dci_format_t dci_format);
#endif
/** @}*/
......@@ -312,11 +312,6 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
return 0;
}
// TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms
uint32_t get_ssb_frame(uint32_t test){
return test;
}
/*
* This code contains all the functions needed to process all dci fields.
* These tables and functions are going to be called by function nr_ue_process_dci
......@@ -398,33 +393,16 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in
dci->dci_format = (dci->dci_format == NR_UL_DCI_FORMAT_0_0) ? NR_DL_DCI_FORMAT_1_0 : NR_UL_DCI_FORMAT_0_0;
def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][dci->dci_format];
}
return nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci);
return nr_ue_process_dci(module_id, cc_id, frame, slot, def_dci_pdu_rel15, dci);
}
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, fapi_nr_dci_indication_pdu_t *dci_ind) {
uint16_t rnti = dci_ind->rnti;
int coreset_type = dci_ind->coreset_type == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; // 0 for coreset0, 1 otherwise
nr_dci_format_t dci_format = dci_ind->dci_format;
int ret = 0;
int pucch_res_set_cnt = 0, valid = 0;
frame_t frame_tx = 0;
int slot_tx = 0;
bool valid_ptrs_setup = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
RA_config_t *ra = &mac->ra;
fapi_nr_dl_config_request_t *dl_config = get_dl_config_request(mac, slot);
uint8_t is_Msg3 = 0;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
int mux_pattern = 1;
LOG_D(MAC, "In %s: Processing received DCI format %s\n", __FUNCTION__, dci_formats[dci_format]);
NR_tda_info_t tda_info = {0};
NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config;
switch(dci_format){
case NR_UL_DCI_FORMAT_0_0: {
static int nr_ue_process_dci_ul_00(module_id_t module_id,
int cc_id,
frame_t frame,
int slot,
dci_pdu_rel15_t *dci,
fapi_nr_dci_indication_pdu_t *dci_ind)
{
/*
* with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI
* 0 IDENTIFIER_DCI_FORMATS:
......@@ -444,38 +422,54 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
// in which ULSCH should be scheduled. K2 is configured in RRC configuration.
// todo:
// - SUL_IND_0_0
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
// Schedule PUSCH
tda_info = get_ul_tda_info(current_UL_BWP, coreset_type, dci_ind->ss_type, get_rnti_type(mac, rnti), dci->time_domain_assignment.val);
const int coreset_type = dci_ind->coreset_type == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; // 0 for coreset0, 1 otherwise;
NR_tda_info_t tda_info = get_ul_tda_info(&mac->current_UL_BWP,
coreset_type,
dci_ind->ss_type,
get_rnti_type(mac, dci_ind->rnti),
dci->time_domain_assignment.val);
frame_t frame_tx;
int slot_tx;
if (tda_info.nrOfSymbols == 0)
ret = -1;
else
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2);
return -1;
if (ret != -1){
if (-1 == nr_ue_pusch_scheduler(mac, 0, frame, slot, &frame_tx, &slot_tx, tda_info.k2)) {
LOG_E(MAC, "Cannot schedule PUSCH\n");
return -1;
}
// Get UL config request corresponding slot_tx
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx, tda_info.k2);
if (!ul_config) {
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
LOG_W(MAC, "ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", frame, slot);
return -1;
}
pthread_mutex_lock(&ul_config->mutex_ul_config);
AssertFatal(ul_config->number_pdus<FAPI_NR_UL_CONFIG_LIST_NUM, "ul_config->number_pdus %d out of bounds\n",ul_config->number_pdus);
AssertFatal(ul_config->number_pdus < FAPI_NR_UL_CONFIG_LIST_NUM,
"ul_config->number_pdus %d out of bounds\n",
ul_config->number_pdus);
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
pthread_mutex_unlock(&ul_config->mutex_ul_config);
// Config PUSCH PDU
ret = nr_config_pusch_pdu(mac, &tda_info, pusch_config_pdu, dci, NULL, rnti, &dci_format);
} else
LOG_E(MAC, "Cannot schedule PUSCH\n");
break;
}
return nr_config_pusch_pdu(mac, &tda_info, pusch_config_pdu, dci, NULL, dci_ind->rnti, NR_UL_DCI_FORMAT_0_0);
}
case NR_UL_DCI_FORMAT_0_1: {
static int nr_ue_process_dci_ul_01(module_id_t module_id,
int cc_id,
frame_t frame,
int slot,
dci_pdu_rel15_t *dci,
fapi_nr_dci_indication_pdu_t *dci_ind)
{
/*
* with CRC scrambled by C-RNTI or CS-RNTI or SP-CSI-RNTI or new-RNTI
* 0 IDENTIFIER_DCI_FORMATS:
......@@ -508,45 +502,60 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
// - FIRST_DAI
// - SECOND_DAI
// - SRS_RESOURCE_IND
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
/* SRS_REQUEST */
AssertFatal(dci->srs_request.nbits == 2, "If SUL is supported in the cell, there is an additional bit in SRS request field\n");
if(dci->srs_request.val > 0)
if (dci->srs_request.val > 0)
nr_ue_aperiodic_srs_scheduling(mac, dci->srs_request.val, frame, slot);
// Schedule PUSCH
tda_info = get_ul_tda_info(current_UL_BWP, coreset_type, dci_ind->ss_type, get_rnti_type(mac, rnti), dci->time_domain_assignment.val);
frame_t frame_tx;
int slot_tx;
const int coreset_type = dci_ind->coreset_type == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; // 0 for coreset0, 1 otherwise;
NR_tda_info_t tda_info = get_ul_tda_info(&mac->current_UL_BWP,
coreset_type,
dci_ind->ss_type,
get_rnti_type(mac, dci_ind->rnti),
dci->time_domain_assignment.val);
if (tda_info.nrOfSymbols == 0)
ret = -1;
else
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2);
return -1;
if (ret != -1){
if (-1 == nr_ue_pusch_scheduler(mac, 0, frame, slot, &frame_tx, &slot_tx, tda_info.k2)) {
LOG_E(MAC, "Cannot schedule PUSCH\n");
return -1;
}
// Get UL config request corresponding slot_tx
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slot_tx, tda_info.k2);
if (!ul_config) {
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
LOG_W(MAC, "ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", frame, slot);
return -1;
}
ul_config->number_pdus = 0;
pthread_mutex_lock(&ul_config->mutex_ul_config);
AssertFatal(ul_config->number_pdus<FAPI_NR_UL_CONFIG_LIST_NUM, "ul_config->number_pdus %d out of bounds\n",ul_config->number_pdus);
AssertFatal(ul_config->number_pdus < FAPI_NR_UL_CONFIG_LIST_NUM,
"ul_config->number_pdus %d out of bounds\n",
ul_config->number_pdus);
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
pthread_mutex_unlock(&ul_config->mutex_ul_config);
// Config PUSCH PDU
ret = nr_config_pusch_pdu(mac, &tda_info, pusch_config_pdu, dci, NULL, rnti, &dci_format);
} else
LOG_E(MAC, "Cannot schedule PUSCH\n");
break;
}
return nr_config_pusch_pdu(mac, &tda_info, pusch_config_pdu, dci, NULL, dci_ind->rnti, NR_UL_DCI_FORMAT_0_1);
}
case NR_DL_DCI_FORMAT_1_0: {
static int nr_ue_process_dci_dl_10(module_id_t module_id,
int cc_id,
frame_t frame,
int slot,
dci_pdu_rel15_t *dci,
fapi_nr_dci_indication_pdu_t *dci_ind)
{
/*
* with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI
* 0 IDENTIFIER_DCI_FORMATS:
......@@ -597,165 +606,190 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
* 28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
* 33 TPC_PUCCH:
*/
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
fapi_nr_dl_config_request_t *dl_config = get_dl_config_request(mac, slot);
fapi_nr_dl_config_request_pdu_t *dl_conf_req = &dl_config->dl_config_list[dl_config->number_pdus];
dl_conf_req->dlsch_config_pdu.rnti = dci_ind->rnti;
dlsch_config_pdu_1_0->pduBitmap = 0;
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu = &dl_conf_req->dlsch_config_pdu.dlsch_config_rel15;
dlsch_pdu->pduBitmap = 0;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_PDSCH_Config_t *pdsch_config = (current_DL_BWP || !mac->get_sib1) ? current_DL_BWP->pdsch_Config : NULL;
if (dci_ind->ss_type == NR_SearchSpace__searchSpaceType_PR_common) {
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->initial_BWPSize;
dlsch_config_pdu_1_0->BWPStart = dci_ind->cset_start;
}
else {
dlsch_config_pdu_1_0->BWPSize = current_DL_BWP->BWPSize;
dlsch_config_pdu_1_0->BWPStart = current_DL_BWP->BWPStart;
dlsch_pdu->BWPSize =
mac->type0_PDCCH_CSS_config.num_rbs ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->initial_BWPSize;
dlsch_pdu->BWPStart = dci_ind->cset_start;
} else {
dlsch_pdu->BWPSize = current_DL_BWP->BWPSize;
dlsch_pdu->BWPStart = current_DL_BWP->BWPStart;
}
if(rnti == SI_RNTI) {
int mux_pattern = 1;
if (dci_ind->rnti == SI_RNTI) {
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = mac->type0_PDCCH_CSS_config;
mux_pattern = type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
// in MIB SCS is signaled as 15or60 and 30or120
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
if(mac->frequency_range == FR2)
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
dlsch_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
if (mac->frequency_range == FR2)
dlsch_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
} else {
dlsch_config_pdu_1_0->SubcarrierSpacing = current_DL_BWP->scs;
if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
dlsch_pdu->SubcarrierSpacing = current_DL_BWP->scs;
if (mac->ra.RA_window_cnt >= 0 && dci_ind->rnti == mac->ra.ra_rnti) {
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
} else {
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
}
}
/* IDENTIFIER_DCI_FORMATS */
/* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */
if (nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,dlsch_config_pdu_1_0->BWPSize,dci->frequency_domain_assignment.val) < 0) {
if (nr_ue_process_dci_freq_dom_resource_assignment(NULL, dlsch_pdu, 0, dlsch_pdu->BWPSize, dci->frequency_domain_assignment.val)
< 0) {
LOG_W(MAC, "[%d.%d] Invalid frequency_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
return -1;
}
dlsch_config_pdu_1_0->rb_offset = dlsch_config_pdu_1_0->start_rb + dlsch_config_pdu_1_0->BWPStart;
dlsch_pdu->rb_offset = dlsch_pdu->start_rb + dlsch_pdu->BWPStart;
if (mac->get_sib1)
dlsch_config_pdu_1_0->rb_offset -= dlsch_config_pdu_1_0->BWPStart;
dlsch_pdu->rb_offset -= dlsch_pdu->BWPStart;
/* TIME_DOM_RESOURCE_ASSIGNMENT */
int dmrs_typeA_pos = mac->dmrs_TypeA_Position;
NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val,
dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, mac->get_sib1);
const int coreset_type = dci_ind->coreset_type == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; // 0 for coreset0, 1 otherwise;
dlsch_config_pdu_1_0->number_symbols = tda_info.nrOfSymbols;
dlsch_config_pdu_1_0->start_symbol = tda_info.startSymbolIndex;
NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP,
dci_ind->ss_type,
dci->time_domain_assignment.val,
dmrs_typeA_pos,
mux_pattern,
get_rnti_type(mac, dci_ind->rnti),
coreset_type,
mac->get_sib1);
dlsch_pdu->number_symbols = tda_info.nrOfSymbols;
dlsch_pdu->start_symbol = tda_info.startSymbolIndex;
struct NR_DMRS_DownlinkConfig *dl_dmrs_config = NULL;
if (pdsch_config)
dl_dmrs_config = (tda_info.mapping_type == typeA) ?
pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup :
pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup;
dl_dmrs_config = (tda_info.mapping_type == typeA) ? pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup
: pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup;
dlsch_config_pdu_1_0->nscid = 0;
if(dl_dmrs_config && dl_dmrs_config->scramblingID0)
dlsch_config_pdu_1_0->dlDmrsScramblingId = *dl_dmrs_config->scramblingID0;
dlsch_pdu->nscid = 0;
if (dl_dmrs_config && dl_dmrs_config->scramblingID0)
dlsch_pdu->dlDmrsScramblingId = *dl_dmrs_config->scramblingID0;
else
dlsch_config_pdu_1_0->dlDmrsScramblingId = mac->physCellId;
dlsch_pdu->dlDmrsScramblingId = mac->physCellId;
/* dmrs symbol positions*/
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
dlsch_pdu->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
NR_DL_DCI_FORMAT_1_0,
mac->dmrs_TypeA_Position,
dlsch_config_pdu_1_0->number_symbols,
dlsch_config_pdu_1_0->start_symbol,
dlsch_pdu->number_symbols,
dlsch_pdu->start_symbol,
tda_info.mapping_type,
1);
dlsch_config_pdu_1_0->dmrsConfigType = (dl_dmrs_config != NULL) ?
(dl_dmrs_config->dmrs_Type == NULL ? 0 : 1) : 0;
dlsch_pdu->dmrsConfigType = (dl_dmrs_config != NULL) ? (dl_dmrs_config->dmrs_Type == NULL ? 0 : 1) : 0;
/* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */
if (dlsch_config_pdu_1_0->number_symbols == 2)
dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1;
if (dlsch_pdu->number_symbols == 2)
dlsch_pdu->n_dmrs_cdm_groups = 1;
else
dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2;
dlsch_config_pdu_1_0->dmrs_ports = 1; // only port 0 in case of DCI 1_0
dlsch_pdu->n_dmrs_cdm_groups = 2;
dlsch_pdu->dmrs_ports = 1; // only port 0 in case of DCI 1_0
/* VRB_TO_PRB_MAPPING */
dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
dlsch_pdu->vrb_to_prb_mapping =
(dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved : vrb_to_prb_mapping_interleaved;
/* MCS TABLE INDEX */
dlsch_config_pdu_1_0->mcs_table = (pdsch_config) ? ((pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0) : 0;
dlsch_pdu->mcs_table = (pdsch_config) ? ((pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0) : 0;
/* MCS */
dlsch_config_pdu_1_0->mcs = dci->mcs;
dlsch_pdu->mcs = dci->mcs;
dlsch_config_pdu_1_0->qamModOrder = nr_get_Qm_dl(dlsch_config_pdu_1_0->mcs, dlsch_config_pdu_1_0->mcs_table);
int R = nr_get_code_rate_dl(dlsch_config_pdu_1_0->mcs, dlsch_config_pdu_1_0->mcs_table);
dlsch_config_pdu_1_0->targetCodeRate = R;
if (dlsch_config_pdu_1_0->qamModOrder == 0) {
dlsch_pdu->qamModOrder = nr_get_Qm_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
if (dlsch_pdu->qamModOrder == 0) {
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
return -1;
}
int R = nr_get_code_rate_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
dlsch_pdu->targetCodeRate = R;
int nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
int nb_re_dmrs = ((dlsch_config_pdu_1_0->dmrsConfigType == NFAPI_NR_DMRS_TYPE1) ? 6:4)*dlsch_config_pdu_1_0->n_dmrs_cdm_groups;
int nb_re_dmrs = ((dlsch_pdu->dmrsConfigType == NFAPI_NR_DMRS_TYPE1) ? 6 : 4) * dlsch_pdu->n_dmrs_cdm_groups;
if (R > 0)
dlsch_config_pdu_1_0->TBS = nr_compute_tbs(dlsch_config_pdu_1_0->qamModOrder,
dlsch_pdu->TBS = nr_compute_tbs(dlsch_pdu->qamModOrder,
R,
dlsch_config_pdu_1_0->number_rbs,
dlsch_config_pdu_1_0->number_symbols,
nb_re_dmrs*get_num_dmrs(dlsch_config_pdu_1_0->dlDmrsSymbPos),
nb_rb_oh, 0, 1);
dlsch_pdu->number_rbs,
dlsch_pdu->number_symbols,
nb_re_dmrs * get_num_dmrs(dlsch_pdu->dlDmrsSymbPos),
nb_rb_oh,
0,
1);
int bw_tbslbrm;
if (current_DL_BWP->initial_BWPSize > 0)
bw_tbslbrm = get_dlbw_tbslbrm(current_DL_BWP->initial_BWPSize, mac->cg);
else
bw_tbslbrm = dlsch_config_pdu_1_0->BWPSize;
dlsch_config_pdu_1_0->tbslbrm = nr_compute_tbslbrm(dlsch_config_pdu_1_0->mcs_table,
bw_tbslbrm,
1);
bw_tbslbrm = dlsch_pdu->BWPSize;
dlsch_pdu->tbslbrm = nr_compute_tbslbrm(dlsch_pdu->mcs_table, bw_tbslbrm, 1);
/* NDI (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
dlsch_config_pdu_1_0->ndi = dci->ndi;
dlsch_pdu->ndi = dci->ndi;
/* RV (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
dlsch_config_pdu_1_0->rv = dci->rv;
dlsch_pdu->rv = dci->rv;
/* HARQ_PROCESS_NUMBER (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
dlsch_config_pdu_1_0->harq_process_nbr = dci->harq_pid;
dlsch_pdu->harq_process_nbr = dci->harq_pid;
/* TB_SCALING (only if CRC scrambled by P-RNTI or RA-RNTI) */
// according to TS 38.214 Table 5.1.3.2-3
if (dci->tb_scaling == 0) dlsch_config_pdu_1_0->scaling_factor_S = 1;
if (dci->tb_scaling == 1) dlsch_config_pdu_1_0->scaling_factor_S = 0.5;
if (dci->tb_scaling == 2) dlsch_config_pdu_1_0->scaling_factor_S = 0.25;
if (dci->tb_scaling == 3) dlsch_config_pdu_1_0->scaling_factor_S = 0; // value not defined in table
if (dci->tb_scaling > 3) {
LOG_E(MAC, "invalid tb_scaling %d\n", dci->tb_scaling);
return -1;
}
const float factor[] = {1, 0.5, 0.25, 0};
dlsch_pdu->scaling_factor_S = factor[dci->tb_scaling];
/* TPC_PUCCH (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
// according to TS 38.213 Table 7.2.1-1
if (dci->tpc == 0) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = -1;
if (dci->tpc == 1) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = 0;
if (dci->tpc == 2) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = 1;
if (dci->tpc == 3) dlsch_config_pdu_1_0->accumulated_delta_PUCCH = 3;
if (dci->tpc > 3) {
LOG_E(MAC, "invalid tpc %d\n", dci->tpc);
return -1;
}
const int tcp[] = {-1, 0, 1, 3};
dlsch_pdu->accumulated_delta_PUCCH = tcp[dci->tpc];
// Sanity check for pucch_resource_indicator value received to check for false DCI.
valid = 0;
bool valid = false;
NR_PUCCH_Config_t *pucch_Config = mac->current_UL_BWP.pucch_Config;
if (pucch_Config && pucch_Config->resourceSetToAddModList) {
pucch_res_set_cnt = pucch_Config->resourceSetToAddModList->list.count;
int pucch_res_set_cnt = pucch_Config->resourceSetToAddModList->list.count;
for (int id = 0; id < pucch_res_set_cnt; id++) {
if (dci->pucch_resource_indicator < pucch_Config->resourceSetToAddModList->list.array[id]->resourceList.list.count) {
valid = 1;
valid = true;
break;
}
}
} else
valid = 1;
valid = true;
if (!valid) {
LOG_W(MAC, "[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dci->pucch_resource_indicator);
LOG_W(MAC,
"[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n",
frame,
slot,
dci->pucch_resource_indicator);
return -1;
}
if(rnti != ra->ra_rnti && rnti != SI_RNTI)
if (dci_ind->rnti != mac->ra.ra_rnti && dci_ind->rnti != SI_RNTI)
AssertFatal(1 + dci->pdsch_to_harq_feedback_timing_indicator.val > DURATION_RX_TO_TX,
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d).\n",
1 + dci->pdsch_to_harq_feedback_timing_indicator.val, DURATION_RX_TO_TX);
1 + dci->pdsch_to_harq_feedback_timing_indicator.val,
DURATION_RX_TO_TX);
// set the harq status at MAC for feedback
set_harq_status(mac,
dci->pucch_resource_indicator,
dci->harq_pid,
dlsch_config_pdu_1_0->accumulated_delta_PUCCH,
dlsch_pdu->accumulated_delta_PUCCH,
1 + dci->pdsch_to_harq_feedback_timing_indicator.val,
dci->dai[0].val,
dci_ind->n_CCE,
......@@ -765,42 +799,56 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
LOG_D(MAC,
"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n",
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti,
dl_conf_req->dlsch_config_pdu.rnti,
dl_config->number_pdus);
LOG_D(MAC,
"(nr_ue_procedures.c) frequency_domain_resource_assignment=%d \t number_rbs=%d \t start_rb=%d\n",
dci->frequency_domain_assignment.val,
dlsch_config_pdu_1_0->number_rbs,
dlsch_config_pdu_1_0->start_rb);
dlsch_pdu->number_rbs,
dlsch_pdu->start_rb);
LOG_D(MAC,
"(nr_ue_procedures.c) time_domain_resource_assignment=%d \t number_symbols=%d \t start_symbol=%d\n",
dci->time_domain_assignment.val,
dlsch_config_pdu_1_0->number_symbols,
dlsch_config_pdu_1_0->start_symbol);
dlsch_pdu->number_symbols,
dlsch_pdu->start_symbol);
LOG_D(MAC,
"(nr_ue_procedures.c) vrb_to_prb_mapping=%d \n>>> mcs=%d\n>>> ndi=%d\n>>> rv=%d\n>>> harq_process_nbr=%d\n>>> dai=%d\n>>> "
"scaling_factor_S=%f\n>>> tpc_pucch=%d\n>>> pucch_res_ind=%d\n>>> pdsch_to_harq_feedback_time_ind=%d\n",
dlsch_config_pdu_1_0->vrb_to_prb_mapping,
dlsch_config_pdu_1_0->mcs,
dlsch_config_pdu_1_0->ndi,
dlsch_config_pdu_1_0->rv,
dlsch_config_pdu_1_0->harq_process_nbr,
dlsch_pdu->vrb_to_prb_mapping,
dlsch_pdu->mcs,
dlsch_pdu->ndi,
dlsch_pdu->rv,
dlsch_pdu->harq_process_nbr,
dci->dai[0].val,
dlsch_config_pdu_1_0->scaling_factor_S,
dlsch_config_pdu_1_0->accumulated_delta_PUCCH,
dlsch_pdu->scaling_factor_S,
dlsch_pdu->accumulated_delta_PUCCH,
dci->pucch_resource_indicator,
1 + dci->pdsch_to_harq_feedback_timing_indicator.val);
dlsch_config_pdu_1_0->k1_feedback = 1 + dci->pdsch_to_harq_feedback_timing_indicator.val;
dlsch_pdu->k1_feedback = 1 + dci->pdsch_to_harq_feedback_timing_indicator.val;
LOG_D(MAC, "(nr_ue_procedures.c) pdu_type=%d\n\n", dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
LOG_D(MAC, "(nr_ue_procedures.c) pdu_type=%d\n\n", dl_conf_req->pdu_type);
dl_config->number_pdus = dl_config->number_pdus + 1;
// the prepared dci is valid, we add it in the list
dl_config->number_pdus++;
return 0;
}
break;
}
static inline uint16_t packBits(const uint8_t *toPack, const int nb)
{
int res = 0;
for (int i = 0; i < nb; i++)
res += (*toPack++) << i;
return res;
}
case NR_DL_DCI_FORMAT_1_1: {
static int nr_ue_process_dci_dl_11(module_id_t module_id,
int cc_id,
frame_t frame,
int slot,
dci_pdu_rel15_t *dci,
fapi_nr_dci_indication_pdu_t *dci_ind)
{
/*
* with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI
* 0 IDENTIFIER_DCI_FORMATS:
......@@ -830,109 +878,139 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
* 44 CBGFI:
* 47 DMRS_SEQ_INI:
*/
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
if (dci->bwp_indicator.val > NR_MAX_NUM_BWP) {
LOG_W(NR_MAC,"[%d.%d] bwp_indicator %d > NR_MAX_NUM_BWP Possibly due to false DCI. Ignoring DCI!\n", frame, slot,dci->bwp_indicator.val);
LOG_W(NR_MAC,
"[%d.%d] bwp_indicator %d > NR_MAX_NUM_BWP Possibly due to false DCI. Ignoring DCI!\n",
frame,
slot,
dci->bwp_indicator.val);
return -1;
}
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_PDSCH_Config_t *pdsch_Config = current_DL_BWP->pdsch_Config;
fapi_nr_dl_config_request_t *dl_config = get_dl_config_request(mac, slot);
fapi_nr_dl_config_request_pdu_t *dl_conf_req = &dl_config->dl_config_list[dl_config->number_pdus];
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti;
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
dl_conf_req->dlsch_config_pdu.rnti = dci_ind->rnti;
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_1 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15;
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu = &dl_conf_req->dlsch_config_pdu.dlsch_config_rel15;
dlsch_config_pdu_1_1->BWPSize = current_DL_BWP->BWPSize;
dlsch_config_pdu_1_1->BWPStart = current_DL_BWP->BWPStart;
dlsch_config_pdu_1_1->SubcarrierSpacing = current_DL_BWP->scs;
dlsch_pdu->BWPSize = current_DL_BWP->BWPSize;
dlsch_pdu->BWPStart = current_DL_BWP->BWPStart;
dlsch_pdu->SubcarrierSpacing = current_DL_BWP->scs;
/* IDENTIFIER_DCI_FORMATS */
/* CARRIER_IND */
/* BANDWIDTH_PART_IND */
// dlsch_config_pdu_1_1->bandwidth_part_ind = dci->bandwidth_part_ind;
// dlsch_pdu->bandwidth_part_ind = dci->bandwidth_part_ind;
/* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */
if (nr_ue_process_dci_freq_dom_resource_assignment(NULL, dlsch_config_pdu_1_1, 0, current_DL_BWP->BWPSize, dci->frequency_domain_assignment.val) < 0) {
if (nr_ue_process_dci_freq_dom_resource_assignment(NULL,
dlsch_pdu,
0,
current_DL_BWP->BWPSize,
dci->frequency_domain_assignment.val)
< 0) {
LOG_W(MAC, "[%d.%d] Invalid frequency_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
return -1;
}
dlsch_config_pdu_1_1->rb_offset = dlsch_config_pdu_1_1->start_rb + dlsch_config_pdu_1_1->BWPStart;
dlsch_pdu->rb_offset = dlsch_pdu->start_rb + dlsch_pdu->BWPStart;
/* TIME_DOM_RESOURCE_ASSIGNMENT */
int dmrs_typeA_pos = mac->dmrs_TypeA_Position;
NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val,
dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, false);
int mux_pattern = 1;
const int coreset_type = dci_ind->coreset_type == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; // 0 for coreset0, 1 otherwise;
NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP,
dci_ind->ss_type,
dci->time_domain_assignment.val,
dmrs_typeA_pos,
mux_pattern,
get_rnti_type(mac, dci_ind->rnti),
coreset_type,
false);
dlsch_config_pdu_1_1->number_symbols = tda_info.nrOfSymbols;
dlsch_config_pdu_1_1->start_symbol = tda_info.startSymbolIndex;
dlsch_pdu->number_symbols = tda_info.nrOfSymbols;
dlsch_pdu->start_symbol = tda_info.startSymbolIndex;
struct NR_DMRS_DownlinkConfig *dl_dmrs_config = (tda_info.mapping_type == typeA) ?
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup :
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup;
struct NR_DMRS_DownlinkConfig *dl_dmrs_config = (tda_info.mapping_type == typeA)
? pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup
: pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup;
switch (dci->dmrs_sequence_initialization.val) {
case 0:
dlsch_config_pdu_1_1->nscid = 0;
if(dl_dmrs_config->scramblingID0)
dlsch_config_pdu_1_1->dlDmrsScramblingId = *dl_dmrs_config->scramblingID0;
dlsch_pdu->nscid = 0;
if (dl_dmrs_config->scramblingID0)
dlsch_pdu->dlDmrsScramblingId = *dl_dmrs_config->scramblingID0;
else
dlsch_config_pdu_1_1->dlDmrsScramblingId = mac->physCellId;
dlsch_pdu->dlDmrsScramblingId = mac->physCellId;
break;
case 1:
dlsch_config_pdu_1_1->nscid = 1;
if(dl_dmrs_config->scramblingID1)
dlsch_config_pdu_1_1->dlDmrsScramblingId = *dl_dmrs_config->scramblingID1;
dlsch_pdu->nscid = 1;
if (dl_dmrs_config->scramblingID1)
dlsch_pdu->dlDmrsScramblingId = *dl_dmrs_config->scramblingID1;
else
dlsch_config_pdu_1_1->dlDmrsScramblingId = mac->physCellId;
dlsch_pdu->dlDmrsScramblingId = mac->physCellId;
break;
default:
AssertFatal(1==0,"Invalid dmrs sequence initialization value\n");
LOG_E(MAC, "Invalid dmrs sequence initialization value %d\n", dci->dmrs_sequence_initialization.val);
return -1;
}
dlsch_config_pdu_1_1->dmrsConfigType = dl_dmrs_config->dmrs_Type == NULL ? NFAPI_NR_DMRS_TYPE1 : NFAPI_NR_DMRS_TYPE2;
dlsch_pdu->dmrsConfigType = dl_dmrs_config->dmrs_Type == NULL ? NFAPI_NR_DMRS_TYPE1 : NFAPI_NR_DMRS_TYPE2;
/* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214,
using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = 1;
dlsch_pdu->n_dmrs_cdm_groups = 1;
/* VRB_TO_PRB_MAPPING */
if ((pdsch_Config->resourceAllocation == 1) && (pdsch_Config->vrb_ToPRB_Interleaver != NULL))
dlsch_config_pdu_1_1->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved;
dlsch_pdu->vrb_to_prb_mapping =
(dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved : vrb_to_prb_mapping_interleaved;
/* PRB_BUNDLING_SIZE_IND */
dlsch_config_pdu_1_1->prb_bundling_size_ind = dci->prb_bundling_size_indicator.val;
dlsch_pdu->prb_bundling_size_ind = dci->prb_bundling_size_indicator.val;
/* RATE_MATCHING_IND */
dlsch_config_pdu_1_1->rate_matching_ind = dci->rate_matching_indicator.val;
dlsch_pdu->rate_matching_ind = dci->rate_matching_indicator.val;
/* ZP_CSI_RS_TRIGGER */
dlsch_config_pdu_1_1->zp_csi_rs_trigger = dci->zp_csi_rs_trigger.val;
dlsch_pdu->zp_csi_rs_trigger = dci->zp_csi_rs_trigger.val;
/* MCS (for transport block 1)*/
dlsch_config_pdu_1_1->mcs = dci->mcs;
dlsch_pdu->mcs = dci->mcs;
/* NDI (for transport block 1)*/
dlsch_config_pdu_1_1->ndi = dci->ndi;
dlsch_pdu->ndi = dci->ndi;
/* RV (for transport block 1)*/
dlsch_config_pdu_1_1->rv = dci->rv;
dlsch_pdu->rv = dci->rv;
/* MCS (for transport block 2)*/
dlsch_config_pdu_1_1->tb2_mcs = dci->mcs2.val;
dlsch_pdu->tb2_mcs = dci->mcs2.val;
/* NDI (for transport block 2)*/
dlsch_config_pdu_1_1->tb2_ndi = dci->ndi2.val;
dlsch_pdu->tb2_ndi = dci->ndi2.val;
/* RV (for transport block 2)*/
dlsch_config_pdu_1_1->tb2_rv = dci->rv2.val;
dlsch_pdu->tb2_rv = dci->rv2.val;
/* HARQ_PROCESS_NUMBER */
dlsch_config_pdu_1_1->harq_process_nbr = dci->harq_pid;
dlsch_pdu->harq_process_nbr = dci->harq_pid;
/* TPC_PUCCH */
// according to TS 38.213 Table 7.2.1-1
if (dci->tpc == 0) dlsch_config_pdu_1_1->accumulated_delta_PUCCH = -1;
if (dci->tpc == 1) dlsch_config_pdu_1_1->accumulated_delta_PUCCH = 0;
if (dci->tpc == 2) dlsch_config_pdu_1_1->accumulated_delta_PUCCH = 1;
if (dci->tpc == 3) dlsch_config_pdu_1_1->accumulated_delta_PUCCH = 3;
if (dci->tpc > 3) {
LOG_E(MAC, "invalid tpc %d\n", dci->tpc);
return -1;
}
const int tcp[] = {-1, 0, 1, 3};
dlsch_pdu->accumulated_delta_PUCCH = tcp[dci->tpc];
// Sanity check for pucch_resource_indicator value received to check for false DCI.
valid = 0;
pucch_res_set_cnt = pucch_Config->resourceSetToAddModList->list.count;
bool valid = false;
NR_PUCCH_Config_t *pucch_Config = mac->current_UL_BWP.pucch_Config;
int pucch_res_set_cnt = pucch_Config->resourceSetToAddModList->list.count;
for (int id = 0; id < pucch_res_set_cnt; id++) {
if (dci->pucch_resource_indicator < pucch_Config->resourceSetToAddModList->list.array[id]->resourceList.list.count) {
valid = 1;
valid = true;
break;
}
}
if (!valid) {
LOG_W(MAC, "[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n", frame, slot, dci->pucch_resource_indicator);
LOG_W(MAC,
"[%d.%d] pucch_resource_indicator value %d is out of bounds. Possibly due to false DCI. Ignoring DCI!\n",
frame,
slot,
dci->pucch_resource_indicator);
return -1;
}
......@@ -941,139 +1019,95 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
long *max_length = dl_dmrs_config->maxLength;
long *dmrs_type = dl_dmrs_config->dmrs_Type;
dlsch_config_pdu_1_1->n_front_load_symb = 1; // default value
dlsch_pdu->n_front_load_symb = 1; // default value
const int ant = dci->antenna_ports.val;
if ((dmrs_type == NULL) && (max_length == NULL)){
if (dmrs_type == NULL) {
if (max_length == NULL) {
// Table 7.3.1.2.2-1: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=1
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_1[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_1[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_1[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_1[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_1[dci->antenna_ports.val][4]<<3));
}
if ((dmrs_type == NULL) && (max_length != NULL)){
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_1[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_1[ant][1], 4);
} else {
// Table 7.3.1.2.2-2: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=2
if (n_codewords == 1) {
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][4]<<3) +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][5]<<4) +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][6]<<5) +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][7]<<6) +
(table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][8]<<7));
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][9];
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_2_oneCodeword[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_2_oneCodeword[ant][1], 8);
dlsch_pdu->n_front_load_symb = table_7_3_2_3_3_2_oneCodeword[ant][9];
}
if (n_codewords == 2) {
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][4]<<3) +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][5]<<4) +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][6]<<5) +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][7]<<6) +
(table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][8]<<7));
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][9];
}
}
if ((dmrs_type != NULL) && (max_length == NULL)){
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_2_twoCodeword[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_2_twoCodeword[ant][1], 8);
dlsch_pdu->n_front_load_symb = table_7_3_2_3_3_2_twoCodeword[ant][9];
}
}
} else {
if (max_length == NULL) {
// Table 7.3.1.2.2-3: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=1
if (n_codewords == 1) {
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][4]<<3) +
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][5]<<4) +
(table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][6]<<5));
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_3_oneCodeword[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_3_oneCodeword[ant][1], 6);
}
if (n_codewords == 2) {
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][4]<<3) +
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][5]<<4) +
(table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][6]<<5));
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_3_twoCodeword[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_3_twoCodeword[ant][1], 6);
}
}
if ((dmrs_type != NULL) && (max_length != NULL)){
} else {
// Table 7.3.1.2.2-4: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=2
if (n_codewords == 1) {
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][4]<<3) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][5]<<4) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][6]<<5) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][7]<<6) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][8]<<7) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][9]<<8) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][10]<<9) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][11]<<10) +
(table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][12]<<11));
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][13];
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_4_oneCodeword[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_4_oneCodeword[ant][1], 12);
dlsch_pdu->n_front_load_symb = table_7_3_2_3_3_4_oneCodeword[ant][13];
}
if (n_codewords == 2) {
dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][0];
dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][1] +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][2]<<1) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][3]<<2) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][4]<<3) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][5]<<4) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][6]<<5) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][7]<<6) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][8]<<7) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][9]<<8) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][10]<<9) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][11]<<10) +
(table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][12]<<11));
dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][9];
dlsch_pdu->n_dmrs_cdm_groups = table_7_3_2_3_3_4_twoCodeword[ant][0];
dlsch_pdu->dmrs_ports = packBits(&table_7_3_2_3_3_4_twoCodeword[ant][1], 12);
dlsch_pdu->n_front_load_symb = table_7_3_2_3_3_4_twoCodeword[ant][13];
}
}
}
/* dmrs symbol positions*/
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config,
dlsch_pdu->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config,
NR_DL_DCI_FORMAT_1_1,
mac->dmrs_TypeA_Position,
dlsch_config_pdu_1_1->number_symbols,
dlsch_config_pdu_1_1->start_symbol,
dlsch_pdu->number_symbols,
dlsch_pdu->start_symbol,
tda_info.mapping_type,
dlsch_config_pdu_1_1->n_front_load_symb);
dlsch_pdu->n_front_load_symb);
/* TCI */
if (dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.coreset.tci_present_in_dci == 1){
if (dl_conf_req->dci_config_pdu.dci_config_rel15.coreset.tci_present_in_dci == 1) {
// 0 bit if higher layer parameter tci-PresentInDCI is not enabled
// otherwise 3 bits as defined in Subclause 5.1.5 of [6, TS38.214]
dlsch_config_pdu_1_1->tci_state = dci->transmission_configuration_indication.val;
dlsch_pdu->tci_state = dci->transmission_configuration_indication.val;
}
/* SRS_REQUEST */
AssertFatal(dci->srs_request.nbits == 2, "If SUL is supported in the cell, there is an additional bit in SRS request field\n");
if(dci->srs_request.val > 0 )
if (dci->srs_request.val > 0)
nr_ue_aperiodic_srs_scheduling(mac, dci->srs_request.val, frame, slot);
/* CBGTI */
dlsch_config_pdu_1_1->cbgti = dci->cbgti.val;
dlsch_pdu->cbgti = dci->cbgti.val;
/* CBGFI */
dlsch_config_pdu_1_1->codeBlockGroupFlushIndicator = dci->cbgfi.val;
dlsch_pdu->codeBlockGroupFlushIndicator = dci->cbgfi.val;
/* DMRS_SEQ_INI */
//FIXME!!!
// FIXME!!!
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */
// according to TS 38.213 Table 9.2.3-1
uint8_t feedback_ti = pucch_Config->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0];
AssertFatal(feedback_ti > DURATION_RX_TO_TX,
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d). Min feedback time set in config file (min_rxtxtime).\n",
feedback_ti, DURATION_RX_TO_TX);
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d). Min feedback time set in config "
"file (min_rxtxtime).\n",
feedback_ti,
DURATION_RX_TO_TX);
// set the harq status at MAC for feedback
set_harq_status(mac,
dci->pucch_resource_indicator,
dci->harq_pid,
dlsch_config_pdu_1_1->accumulated_delta_PUCCH,
dlsch_pdu->accumulated_delta_PUCCH,
feedback_ti,
dci->dai[0].val,
dci_ind->n_CCE,
......@@ -1081,79 +1115,117 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
frame,
slot);
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type);
dl_conf_req->pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH;
LOG_D(MAC, "(nr_ue_procedures.c) pdu_type=%d\n\n", dl_conf_req->pdu_type);
dl_config->number_pdus = dl_config->number_pdus + 1;
dl_config->number_pdus++; // The DCI configuration is valid, we add it in the list
// send the ack/nack slot number to phy to indicate tx thread to wait for DLSCH decoding
dlsch_config_pdu_1_1->k1_feedback = feedback_ti;
dlsch_pdu->k1_feedback = feedback_ti;
/* TODO same calculation for MCS table as done in UL */
dlsch_config_pdu_1_1->mcs_table = (pdsch_Config->mcs_Table) ? (*pdsch_Config->mcs_Table + 1) : 0;
dlsch_config_pdu_1_1->qamModOrder = nr_get_Qm_dl(dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table);
int R = nr_get_code_rate_dl(dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table);
dlsch_config_pdu_1_1->targetCodeRate = R;
if (dlsch_config_pdu_1_1->qamModOrder == 0) {
dlsch_pdu->mcs_table = (pdsch_Config->mcs_Table) ? (*pdsch_Config->mcs_Table + 1) : 0;
dlsch_pdu->qamModOrder = nr_get_Qm_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
int R = nr_get_code_rate_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
dlsch_pdu->targetCodeRate = R;
if (dlsch_pdu->qamModOrder == 0) {
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
return -1;
}
uint8_t Nl = 0;
for (int i = 0; i < 12; i++) { // max 12 ports
if ((dlsch_config_pdu_1_1->dmrs_ports>>i)&0x01) Nl += 1;
if ((dlsch_pdu->dmrs_ports >> i) & 0x01)
Nl += 1;
}
int nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
int nb_re_dmrs = ((dmrs_type == NULL) ? 6:4)*dlsch_config_pdu_1_1->n_dmrs_cdm_groups;
int nb_re_dmrs = ((dmrs_type == NULL) ? 6 : 4) * dlsch_pdu->n_dmrs_cdm_groups;
if (R > 0)
dlsch_config_pdu_1_1->TBS = nr_compute_tbs(dlsch_config_pdu_1_1->qamModOrder,
dlsch_pdu->TBS = nr_compute_tbs(dlsch_pdu->qamModOrder,
R,
dlsch_config_pdu_1_1->number_rbs,
dlsch_config_pdu_1_1->number_symbols,
nb_re_dmrs*get_num_dmrs(dlsch_config_pdu_1_1->dlDmrsSymbPos),
nb_rb_oh, 0, Nl);
dlsch_pdu->number_rbs,
dlsch_pdu->number_symbols,
nb_re_dmrs * get_num_dmrs(dlsch_pdu->dlDmrsSymbPos),
nb_rb_oh,
0,
Nl);
// TBS_LBRM according to section 5.4.2.1 of 38.212
long *maxMIMO_Layers = current_DL_BWP->pdsch_servingcellconfig->ext1->maxMIMO_Layers;
AssertFatal (maxMIMO_Layers != NULL,"Option with max MIMO layers not configured is not supported\n");
AssertFatal(maxMIMO_Layers != NULL, "Option with max MIMO layers not configured is not supported\n");
int nl_tbslbrm = *maxMIMO_Layers < 4 ? *maxMIMO_Layers : 4;
int bw_tbslbrm = get_dlbw_tbslbrm(current_DL_BWP->initial_BWPSize, mac->cg);
dlsch_config_pdu_1_1->tbslbrm = nr_compute_tbslbrm(dlsch_config_pdu_1_1->mcs_table,
bw_tbslbrm,
nl_tbslbrm);
dlsch_pdu->tbslbrm = nr_compute_tbslbrm(dlsch_pdu->mcs_table, bw_tbslbrm, nl_tbslbrm);
/*PTRS configuration */
dlsch_config_pdu_1_1->pduBitmap = 0;
if(pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL) {
valid_ptrs_setup = set_dl_ptrs_values(pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup,
dlsch_config_pdu_1_1->number_rbs, dlsch_config_pdu_1_1->mcs, dlsch_config_pdu_1_1->mcs_table,
&dlsch_config_pdu_1_1->PTRSFreqDensity,&dlsch_config_pdu_1_1->PTRSTimeDensity,
&dlsch_config_pdu_1_1->PTRSPortIndex,&dlsch_config_pdu_1_1->nEpreRatioOfPDSCHToPTRS,
&dlsch_config_pdu_1_1->PTRSReOffset, dlsch_config_pdu_1_1->number_symbols);
if(valid_ptrs_setup==true) {
dlsch_config_pdu_1_1->pduBitmap |= 0x1;
LOG_D(MAC, "DL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", dlsch_config_pdu_1_1->PTRSTimeDensity, dlsch_config_pdu_1_1->PTRSFreqDensity);
}
}
dlsch_pdu->pduBitmap = 0;
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS != NULL) {
bool valid_ptrs_setup =
set_dl_ptrs_values(pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup,
dlsch_pdu->number_rbs,
dlsch_pdu->mcs,
dlsch_pdu->mcs_table,
&dlsch_pdu->PTRSFreqDensity,
&dlsch_pdu->PTRSTimeDensity,
&dlsch_pdu->PTRSPortIndex,
&dlsch_pdu->nEpreRatioOfPDSCHToPTRS,
&dlsch_pdu->PTRSReOffset,
dlsch_pdu->number_symbols);
if (valid_ptrs_setup == true) {
dlsch_pdu->pduBitmap |= 0x1;
LOG_D(MAC, "DL PTRS values: PTRS time den: %d, PTRS freq den: %d\n", dlsch_pdu->PTRSTimeDensity, dlsch_pdu->PTRSFreqDensity);
}
}
// the prepared dci is valid, we add it in the list
dl_config->number_pdus++;
return 0;
}
int8_t nr_ue_process_dci(module_id_t module_id,
int cc_id,
frame_t frame,
int slot,
dci_pdu_rel15_t *dci,
fapi_nr_dci_indication_pdu_t *dci_ind)
{
LOG_D(MAC, "Processing received DCI format %s\n", dci_formats[dci_ind->dci_format]);
switch (dci_ind->dci_format) {
case NR_UL_DCI_FORMAT_0_0:
return nr_ue_process_dci_ul_00(module_id, cc_id, frame, slot, dci, dci_ind);
break;
case NR_UL_DCI_FORMAT_0_1:
return nr_ue_process_dci_ul_01(module_id, cc_id, frame, slot, dci, dci_ind);
break;
case NR_DL_DCI_FORMAT_1_0:
return nr_ue_process_dci_dl_10(module_id, cc_id, frame, slot, dci, dci_ind);
break;
case NR_DL_DCI_FORMAT_1_1:
return nr_ue_process_dci_dl_11(module_id, cc_id, frame, slot, dci, dci_ind);
break;
}
case NR_DL_DCI_FORMAT_2_0:
AssertFatal(false, "DCI Format 2-0 handling not implemented\n");
break;
case NR_DL_DCI_FORMAT_2_1:
AssertFatal(false, "DCI Format 2-1 handling not implemented\n");
break;
case NR_DL_DCI_FORMAT_2_2:
AssertFatal(false, "DCI Format 2-2 handling not implemented\n");
break;
case NR_DL_DCI_FORMAT_2_3:
AssertFatal(false, "DCI Format 2-3 handling not implemented\n");
break;
default:
break;
}
return ret;
return -1;
}
int8_t nr_ue_process_csirs_measurements(module_id_t module_id,
......@@ -1560,7 +1632,7 @@ int get_deltatf(uint16_t nb_of_prbs,
{
int DELTA_TF;
int O_CRC = compute_pucch_crc_size(O_UCI);
int N_symb = nb_symbols_excluding_dmrs[N_symb_PUCCH-4][add_dmrs_flag][freq_hop_flag];
int N_symb = N_symb_PUCCH < 4 ? N_symb_PUCCH : nb_symbols_excluding_dmrs[N_symb_PUCCH - 4][add_dmrs_flag][freq_hop_flag];
float N_RE = nb_of_prbs * N_sc_ctrl_RB * N_symb;
float K1 = 6;
if (O_UCI + O_CRC < 12)
......@@ -2435,7 +2507,10 @@ int nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCC
break;
}
}
AssertFatal(csi_res_id > -1, "Couldn't find PUCCH resource ID associated with current BWP\n");
if (csi_res_id < 0) {
// This CSI Report ID is not associated with current active BWP
continue;
}
NR_PUCCH_Resource_t *csi_pucch = find_pucch_resource_from_list(pucch_Config->resourceToAddModList, csi_res_id);
AssertFatal(csi_pucch != NULL, "Couldn't find PUCCH Resource ID for SR in PUCCH resource list\n");
LOG_D(NR_MAC, "Preparing CSI report in frame %d slot %d CSI report ID %d\n", frame, slot, csi_report_id);
......@@ -4086,7 +4161,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
pthread_mutex_unlock(&ul_config->mutex_ul_config);
// Config Msg3 PDU
nr_config_pusch_pdu(mac, &tda_info, pusch_config_pdu, NULL, &rar_grant, rnti, NULL);
nr_config_pusch_pdu(mac, &tda_info, pusch_config_pdu, NULL, &rar_grant, rnti, NR_DCI_NONE);
}
} else {
......
......@@ -422,7 +422,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
dci_pdu_rel15_t *dci,
RAR_grant_t *rar_grant,
uint16_t rnti,
const nr_dci_format_t *dci_format)
const nr_dci_format_t dci_format)
{
int f_alloc;
......@@ -534,23 +534,23 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->bwp_size = current_UL_BWP->BWPSize;
/* Transform precoding */
pusch_config_pdu->transform_precoding = get_transformPrecoding(current_UL_BWP, *dci_format, 0);
pusch_config_pdu->transform_precoding = get_transformPrecoding(current_UL_BWP, dci_format, 0);
/*DCI format-related configuration*/
int target_ss;
if (*dci_format == NR_UL_DCI_FORMAT_0_0) {
if (dci_format == NR_UL_DCI_FORMAT_0_0) {
target_ss = NR_SearchSpace__searchSpaceType_PR_common;
if ((pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) &&
pusch_config_pdu->nr_of_symbols < 3)
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
else
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
} else if (*dci_format == NR_UL_DCI_FORMAT_0_1) {
} else if (dci_format == NR_UL_DCI_FORMAT_0_1) {
target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
ul_layers_config(mac, pusch_config_pdu, dci, *dci_format);
ul_ports_config(mac, &dmrslength, pusch_config_pdu, dci, *dci_format);
ul_layers_config(mac, pusch_config_pdu, dci, dci_format);
ul_ports_config(mac, &dmrslength, pusch_config_pdu, dci, dci_format);
} else {
LOG_E(NR_MAC, "In %s: UL grant from DCI format %d is not handled...\n", __FUNCTION__, *dci_format);
LOG_E(NR_MAC, "In %s: UL grant from DCI format %d is not handled...\n", __FUNCTION__, dci_format);
return -1;
}
......@@ -564,7 +564,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->scid = 0;
pusch_config_pdu->ul_dmrs_scrambling_id = mac->physCellId;
if(*dci_format == NR_UL_DCI_FORMAT_0_1)
if (dci_format == NR_UL_DCI_FORMAT_0_1)
pusch_config_pdu->scid = dci->dmrs_sequence_initialization.val;
/* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/
......@@ -620,9 +620,15 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
/* MCS TABLE */
if (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) {
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_Table : NULL, 0, *dci_format, rnti_type, target_ss, false);
pusch_config_pdu->mcs_table =
get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_Table : NULL, 0, dci_format, rnti_type, target_ss, false);
} else {
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL, 1, *dci_format, rnti_type, target_ss, false);
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL,
1,
dci_format,
rnti_type,
target_ss,
false);
}
/* NDI */
......
......@@ -87,7 +87,6 @@ int eth_socket_init_raw(openair0_device *device) {
}
/* initialize destination address */
bzero((void *)&(eth->local_addrc_ll), sizeof(struct sockaddr_ll));
bzero((void *)&(eth->local_addrd_ll), sizeof(struct sockaddr_ll));
bzero((void *)&(eth->if_index), sizeof(struct ifreq));
......@@ -99,16 +98,11 @@ int eth_socket_init_raw(openair0_device *device) {
if (ioctl(eth->sockfdd[i], SIOCGIFINDEX, &(eth->if_index)) < 0)
perror("SIOCGIFINDEX");
eth->local_addrc_ll.sll_family = AF_PACKET;
eth->local_addrc_ll.sll_ifindex = eth->if_index.ifr_ifindex;
eth->local_addrd_ll.sll_family = AF_PACKET;
eth->local_addrd_ll.sll_ifindex = eth->if_index.ifr_ifindex;
/* hear traffic from specific protocol*/
eth->local_addrc_ll.sll_protocol = htons((short)device->eth_params->my_portc);
eth->local_addrd_ll.sll_protocol = htons((short)device->eth_params->my_portd);
eth->local_addrc_ll.sll_halen = ETH_ALEN;
eth->local_addrc_ll.sll_pkttype = PACKET_OTHERHOST;
eth->local_addrd_ll.sll_halen = ETH_ALEN;
eth->local_addrd_ll.sll_pkttype = PACKET_OTHERHOST;
eth->addr_len = sizeof(struct sockaddr_ll);
......
......@@ -80,14 +80,6 @@ typedef struct {
struct sockaddr_in local_addrd;
/*!\brief address length for both UDP and RAW socket*/
int addr_len;
/*!\brief destination address (control) for RAW socket*/
struct sockaddr_ll dest_addrc_ll;
/*!\brief local address (control) for RAW socket*/
struct sockaddr_ll local_addrc_ll;
/*!\brief destination address (user) for RAW socket*/
struct sockaddr_ll dest_addrd_ll;
/*!\brief local address (user) for RAW socket*/
struct sockaddr_ll local_addrd_ll;
/*!\brief inteface index for RAW socket*/
struct ifreq if_index;
/*!\brief timeout ms */
......@@ -147,6 +139,8 @@ typedef struct {
struct ether_header ehc;
/*!\brief precomputed ethernet header (data) */
struct ether_header ehd;
/*!\brief local address (user) for RAW socket*/
struct sockaddr_ll local_addrd_ll;
} eth_state_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment