Commit ff9c1614 authored by luispereira87's avatar luispereira87

Merge remote-tracking branch 'origin/develop-NR_SA_F1AP_5GRECORDS' into...

Merge remote-tracking branch 'origin/develop-NR_SA_F1AP_5GRECORDS' into develop-NR_SA_F1AP_5GRECORDS-lts

# Conflicts:
#	openair2/F1AP/f1ap_du_rrc_message_transfer.c
#	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
#	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
#	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
parents 06a04449 a675de4c
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Required Python Version
# Python 3.x
#
#---------------------------------------------------------------------
#USAGE:
# log=Log_Mgt(IPAddress,Password,Path)
# log.LogRotation()
import re
import subprocess
import logging
import math
class Log_Mgt:
def __init__(self,IPAddress,Password,Path):
self.IPAddress=IPAddress
self.Password=Password
self.path=Path
#-----------------$
#PRIVATE# Methods$
#-----------------$
def __CheckAvailSpace(self):
HOST=self.IPAddress
COMMAND="df "+ self.path
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
s=result[1].decode('utf-8').rstrip()#result[1] is the second line with the results we are looking for
tmp=s.split()
return tmp[3] #return avail space from the line
def __GetOldestFile(self):
HOST=self.IPAddress
COMMAND="ls -rtl "+ self.path #-rtl will bring oldest file on top
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
s=result[1].decode('utf-8').rstrip()
tmp=s.split()
return tmp[8]#return filename from the line
def __AvgSize(self):
HOST=self.IPAddress
COMMAND="ls -rtl "+ self.path
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
total_size=0
for i in range(1,len(result)):
s=result[i].decode('utf-8').rstrip()
tmp=s.split()
total_size+=int(tmp[4]) #get filesize
return math.floor(total_size/(len(result)-1)) #compute average file/artifact size
#-----------------$
#PUBLIC Methods$
#-----------------$
def LogRotation(self):
avail_space =int(self.__CheckAvailSpace())*1000 #avail space in target folder, initially displayed in Gb
avg_size=self.__AvgSize() #average size of artifacts in the target folder
logging.debug("Avail Space : " + str(avail_space) + " / Artifact Avg Size : " + str(avg_size))
if avail_space < 2*avg_size: #reserved space is 2x artifact file ; oldest file will be deleted
oldestfile=self.__GetOldestFile()
HOST=self.IPAddress
COMMAND="echo " + self.Password + " | sudo -S rm "+ self.path + "/" + oldestfile
logging.debug(COMMAND)
ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
else:
logging.debug("Still some space left for artifacts storage")
...@@ -39,6 +39,9 @@ import subprocess ...@@ -39,6 +39,9 @@ import subprocess
from datetime import datetime from datetime import datetime
#for log rotation mgt
import cls_log_mgt
class Module_UE: class Module_UE:
def __init__(self,Module): def __init__(self,Module):
...@@ -131,7 +134,7 @@ class Module_UE: ...@@ -131,7 +134,7 @@ class Module_UE:
mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
#delete old artifacts #delete old artifacts
mySSH.command('echo ' + self.HostPassword + ' | sudo -S rm -rf ci_qlog','\$',5) mySSH.command('echo ' + self.HostPassword + ' | sudo -S rm -rf ci_qlog','\$',5)
#start Trace #start Trace, artifact is created in home dir
mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg &','\$', 5) mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg &','\$', 5)
mySSH.close() mySSH.close()
...@@ -152,11 +155,16 @@ class Module_UE: ...@@ -152,11 +155,16 @@ class Module_UE:
def LogCollect(self): def LogCollect(self):
mySSH = sshconnection.SSHConnection() mySSH = sshconnection.SSHConnection()
mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
#archive qlog to /opt/ci_qlogs with datetime suffix #archive qlog to USB stick in /media/usb-drive/ci_qlogs with datetime suffix
now=datetime.now() now=datetime.now()
now_string = now.strftime("%Y%m%d-%H%M") now_string = now.strftime("%Y%m%d-%H%M")
source='ci_qlog' source='ci_qlog'
destination='/opt/ci_qlogs/ci_qlog_'+now_string+'.zip' destination='/media/usb-drive/ci_qlogs/ci_qlog_'+now_string+'.zip'
#qlog artifact is zipped into the target folder
mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' &','\$', 10) mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' &','\$', 10)
mySSH.close() mySSH.close()
#post action : log cleaning to make sure enough space is reserved for the next run
Log_Mgt=cls_log_mgt.Log_Mgt(self.HostIPAddress, self.HostPassword, "/media/usb-drive/ci_qlogs")
Log_Mgt.LogRotation()
return destination return destination
...@@ -2234,7 +2234,7 @@ class OaiCiTest(): ...@@ -2234,7 +2234,7 @@ class OaiCiTest():
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
cmd = 'rm iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' cmd = 'rm iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',5) SSH.command(cmd,'\$',5)
cmd = 'echo $USER; nohup iperf -s -i 1 -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' cmd = 'echo $USER; nohup iperf -s -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log'
SSH.command(cmd,'\$',5) SSH.command(cmd,'\$',5)
#client side UE #client side UE
...@@ -2252,6 +2252,13 @@ class OaiCiTest(): ...@@ -2252,6 +2252,13 @@ class OaiCiTest():
else : else :
logging.debug("Incorrect or missing IPERF direction in XML") logging.debug("Incorrect or missing IPERF direction in XML")
SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword)
cmd = 'killall --signal=SIGKILL iperf'
SSH.command(cmd,'\$',5)
SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password)
cmd = 'killall --signal=SIGKILL iperf'
SSH.command(cmd,'\$',5)
SSH.close() SSH.close()
return return
......
...@@ -260,11 +260,11 @@ RUs = ( ...@@ -260,11 +260,11 @@ RUs = (
local_rf = "yes" local_rf = "yes"
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 0 att_tx = 3
att_rx = 0; att_rx = 0;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 118; max_rxgain = 115;
eNB_instances = [0]; eNB_instances = [0];
# clock_src = "external"; # clock_src = "external";
} }
......
...@@ -244,11 +244,11 @@ RUs = ( ...@@ -244,11 +244,11 @@ RUs = (
local_rf = "yes" local_rf = "yes"
nb_tx = 1 nb_tx = 1
nb_rx = 1 nb_rx = 1
att_tx = 0 att_tx = 3
att_rx = 0; att_rx = 0;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 114; max_rxgain = 111;
eNB_instances = [0]; eNB_instances = [0];
# clock_src = "external"; # clock_src = "external";
} }
......
...@@ -1004,6 +1004,12 @@ function start_l2_sim_ue { ...@@ -1004,6 +1004,12 @@ function start_l2_sim_ue {
echo "ifconfig" > $1 echo "ifconfig" > $1
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1 ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
rm $1 rm $1
else
echo "Setting Routes for all UEs"
echo "cd /home/ubuntu/tmp/cmake_targets/tools" > $1
echo "./setup_routes.sh $LOC_NB_UES" >> $1
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
rm $1
fi fi
} }
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
<testCase id="070000"> <testCase id="070000">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)</desc> <desc>iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)</desc>
<iperf_args>-u -b 20M -t 60 -i 1</iperf_args> <iperf_args>-u -b 20M -t 60</iperf_args>
<direction>DL</direction> <direction>DL</direction>
<id>idefix</id> <id>idefix</id>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>50</iperf_packetloss_threshold>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<testCase id="070001"> <testCase id="070001">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)</desc> <desc>iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)</desc>
<iperf_args>-u -b 3M -t 60 -i 1</iperf_args> <iperf_args>-u -b 3M -t 60</iperf_args>
<direction>UL</direction> <direction>UL</direction>
<id>idefix</id> <id>idefix</id>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>50</iperf_packetloss_threshold>
......
#!/bin/bash
for i in $(seq 1 $1);
do
let table=1000+$i
echo "sudo ip route add 10.0.1.0/24 dev oaitun_ue$i table $table"
sudo ip route add 10.0.1.0/24 dev oaitun_ue$i table $table
echo "sudo ip route add default via 10.0.1.1 dev oaitun_ue$i table $table"
sudo ip route add default via 10.0.1.1 dev oaitun_ue$i table $table
let octet=$i+1
echo "sudo ip rule add from 10.0.1.$octet table $table"
sudo ip rule add from 10.0.1.$octet table $table
done
...@@ -96,14 +96,14 @@ static void read_pipe(int p, char *b, int size) { ...@@ -96,14 +96,14 @@ static void read_pipe(int p, char *b, int size) {
} }
} }
static int baseRunTimeCommand(char* cmd) { static int baseRunTimeCommand(char* cmd, size_t cmdSize) {
FILE *fp; FILE *fp;
size_t retSize = 0; size_t retSize = 0;
fp = popen(cmd, "r"); fp = popen(cmd, "r");
if(fp) { if(fp) {
memset(cmd, 1, sizeof(*cmd)); memset(cmd, 0, cmdSize);
retSize = fread(cmd, 1, sizeof(*cmd), fp); retSize = fread(cmd, 1, cmdSize, fp);
fclose(fp); fclose(fp);
} else { } else {
LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd); LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd);
...@@ -118,26 +118,26 @@ static int baseRunTimeCommand(char* cmd) { ...@@ -118,26 +118,26 @@ static int baseRunTimeCommand(char* cmd) {
int checkIfFedoraDistribution(void) { int checkIfFedoraDistribution(void) {
char cmd[200]; char cmd[200];
memset(cmd, 1, 200); memset(cmd, 0, 200);
sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora || true"); sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora || true");
return baseRunTimeCommand(cmd); return baseRunTimeCommand(cmd, 200);
} }
int checkIfGenericKernelOnFedora(void) { int checkIfGenericKernelOnFedora(void) {
char cmd[200]; char cmd[200];
memset(cmd, 1, 200); memset(cmd, 0, 200);
sprintf(cmd, "uname -a | grep -c rt || true"); sprintf(cmd, "uname -a | grep -c rt || true");
return (1 - baseRunTimeCommand(cmd)); return (1 - baseRunTimeCommand(cmd, 200));
} }
int checkIfInsideContainer(void) { int checkIfInsideContainer(void) {
char cmd[200]; char cmd[200];
int res = 0; int res = 0;
memset(cmd, 1, 200); memset(cmd, 0, 200);
sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods' || true"); sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods' || true");
res = baseRunTimeCommand(cmd); res = baseRunTimeCommand(cmd, 200);
if (res > 0) if (res > 0)
return 1; return 1;
else else
......
...@@ -24,7 +24,7 @@ At the moment of writing this document interoperability with the following COTS ...@@ -24,7 +24,7 @@ At the moment of writing this document interoperability with the following COTS
## 1.1 gNB build and configuration ## 1.1 gNB build and configuration
At the moment of writing this document most of the code to support the SA setup is not merged into develop branch yet, but it is accessible through the following branches: At the moment of writing this document, most of the code to support the SA setup is not merged into develop branch yet, but it is accessible through the following branches:
- NR_SA_F1AP_5GRECORDS - NR_SA_F1AP_5GRECORDS
- develop-NR_SA_F1AP_5GRECORDS (up-to-date with latest develop branch) - develop-NR_SA_F1AP_5GRECORDS (up-to-date with latest develop branch)
...@@ -32,7 +32,7 @@ At the moment of writing this document most of the code to support the SA setup ...@@ -32,7 +32,7 @@ At the moment of writing this document most of the code to support the SA setup
To build the gNB executable: To build the gNB executable:
```bash ```bash
cd cmake_targets cd cmake_targets
./build_oai -I -w USRP #For first time installation only to install software dependencies ./build_oai -I -w USRP #For OAI first time installation only to install software dependencies
./build_oai --gNB -w USRP ./build_oai --gNB -w USRP
``` ```
...@@ -87,8 +87,7 @@ For the configuration of the gNB in CU and DU blocks the following sample config ...@@ -87,8 +87,7 @@ For the configuration of the gNB in CU and DU blocks the following sample config
At the point of writing this document the control-plane exchanges between the CU and the DU over *F1-C* interface have been validated. The integration of *F1-U* over gtp-u for the support of data plane traffic is ongoing. At the point of writing this document the control-plane exchanges between the CU and the DU over *F1-C* interface have been validated. The integration of *F1-U* over gtp-u for the support of data plane traffic is ongoing.
## 1.2 OAI 5G Core Network installation and configuration ## 1.2 OAI 5G Core Network installation and configuration
The instructions for the installation of OAI CN components (AMF, SMF, NRF, UPF) using docker compose can be found [here](https://gitlab.eurecom.fr/oai/cn5g). Below are some complementary instructions which can be useful for the deployment... The instructions for the installation of OAI CN components (AMF, SMF, NRF, UPF) using docker compose can be found [here](https://gitlab.eurecom.fr/oai/cn5g). Below are some complementary instructions which can be useful for the deployment.
## 1.3 Execution of SA scenario ## 1.3 Execution of SA scenario
...@@ -98,11 +97,66 @@ After having configured the gNB, we can start the individual components in the f ...@@ -98,11 +97,66 @@ After having configured the gNB, we can start the individual components in the f
- Launch gNB - Launch gNB
- Launch COTS UE (disable airplane mode) - Launch COTS UE (disable airplane mode)
The execution command to start the gNB is the following: The execution command to start the gNB (in monolithic mode) is the following:
```bash ```bash
cd cmake_targets/ran_build/cuild cd cmake_targets/ran_build/build
sudo ./nr-softmodem -E --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf sudo ./nr-softmodem -E --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf
``` ```
# 2. SA Setup with OAI UE # 2. SA Setup with OAI UE
For the setup with the OAI UE The SA setup with OAI UE has been validated with RFSIMULATOR for the moment. The control plane for the successful UE registration and PDU Session establishment has been verified with OAI and Nokia SA Box CNs. User-plane traffic validation after the establishment of the 5G connection is still pending for this setup.
In the following, we provide the instructions on how to build, configure and execute this SA setup.
## 2.1 Build and configuration
To build the gNB and OAI UE executables:
```bash
cd cmake_targets
./build_oai -I #For OAI first time installation only to install software dependencies
./build_oai --gNB --nrUE -w SIMU
```
The gNB configuration can be performed according to what is described in section 1.1, using the same reference configuration file as with the RF scenario.
### NAS configuration for the OAI UE
At the moment, the NAS configuration parameters of the OAI UE are hardcoded in ***openair3/NAS/NR_UE/nr_nas_msg_sim.c***. More specifically:
- The SUCI (*Subscription Concealed Identifier*) corresponding to default IMSI 2089900007487 is hardcoded in functions *generateRegistrationRequest()* and *generateIdentityResponse()* through the following lines:
```bash
mm_msg->registration_request.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit1 = 9;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 9;
mm_msg->registration_request.fgsmobileidentity.suci.mncdigit3 = 0xf;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0;
mm_msg->registration_request.fgsmobileidentity.suci.mccdigit3 = 8;
mm_msg->registration_request.fgsmobileidentity.suci.schemeoutput = 0x4778;
```
- USIM_API_K and OPc keys are hardcoded at the beginning of the file:
```bash
// USIM_API_K: fe c8 6b a6 eb 70 7e d0 89 05 75 7b 1b b4 4b 8f
uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f};
// OPC: c4 24 49 36 3b ba d0 2b 66 d1 6b c9 75 d7 7c c1
const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1};
```
- The NSSAI (*Network Slice Assistance Information*) and DNN (*Data Network Name*) are hardcoded in function *generatePduSessionEstablishRequest()*
```bash
uint8_t nssai[]={1,0,0,1}; //Corresponding to SST:1, SD:1
uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai"
```
For interoperability with OAI or other CNs, it should be ensured that the configuration of the aforementioned parameters match the configuration of the corresponding subscribed user at the core network.
Hardcoding of the USIM information will soon be substituted with parsing those parameters from a configuration file.
## 2.2 Execution of SA scenario
The order of starting the different components should be the same as the one described in section 1.3.
- To launch the gNB:
```bash
sudo RFSIMULATOR=server ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa
```
- To launch the OAI UE:
```bash
sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --nokrnmod
```
The IP address at the execution command of the OAI UE corresponds to the target IP of the gNB host that the RFSIMULATOR at the UE will connect to. In the above example, we assume that the gNB and UE are running on the same host so the specified address (127.0.0.1) is the one of the loopback interface.
...@@ -44,6 +44,7 @@ Our code might not work with all 5G phones yet, but we are constantly improving ...@@ -44,6 +44,7 @@ Our code might not work with all 5G phones yet, but we are constantly improving
* Oppo Reno 5G * Oppo Reno 5G
* Samsung A90 5G * Samsung A90 5G
* Samsung A42 5G
* Google Pixel 5G (note1) * Google Pixel 5G (note1)
* Simcom SIMCOM8200EA * Simcom SIMCOM8200EA
* Quectel RM500Q-GL * Quectel RM500Q-GL
......
...@@ -489,10 +489,12 @@ int main( int argc, char **argv ) { ...@@ -489,10 +489,12 @@ int main( int argc, char **argv ) {
nrUE_config->carrier_config.ul_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; nrUE_config->carrier_config.ul_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL;
nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000;
nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000;
nrUE_config->cell_config.frame_duplex_type = TDD;
nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1; nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1;
// Initialize values, will be updated upon SIB1 reception
nrUE_config->cell_config.frame_duplex_type = TDD;
nrUE_config->ssb_table.ssb_mask_list[0].ssb_mask = 0xFFFFFFFF;
nrUE_config->ssb_table.ssb_period = 1;
} }
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config,
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include <syscall.h> #include <syscall.h>
#include <openair2/UTIL/OPT/opt.h>
//#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1 //#define DEBUG_DLSCH_FREE 1
......
...@@ -355,7 +355,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -355,7 +355,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
} }
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) { void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag) {
pthread_mutex_lock(&gNB->UL_INFO_mutex); pthread_mutex_lock(&gNB->UL_INFO_mutex);
......
...@@ -172,6 +172,10 @@ gtpv1u_update_ngu_tunnel( ...@@ -172,6 +172,10 @@ gtpv1u_update_ngu_tunnel(
return 0; return 0;
} }
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return 0;
}
int int
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
......
...@@ -133,6 +133,10 @@ gtpv1u_update_ngu_tunnel( ...@@ -133,6 +133,10 @@ gtpv1u_update_ngu_tunnel(
return 0; return 0;
} }
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return 0;
}
int int
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
......
...@@ -136,6 +136,10 @@ gtpv1u_create_s1u_tunnel( ...@@ -136,6 +136,10 @@ gtpv1u_create_s1u_tunnel(
return 0; return 0;
} }
int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return 0;
}
int int
rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
const protocol_ctxt_t *const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
......
...@@ -299,7 +299,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { ...@@ -299,7 +299,7 @@ typedef struct f1ap_initial_ul_rrc_message_s {
uint16_t crnti; uint16_t crnti;
uint8_t *rrc_container; uint8_t *rrc_container;
int rrc_container_length; int rrc_container_length;
uint8_t *du2cu_rrc_container; int8_t *du2cu_rrc_container;
int du2cu_rrc_container_length; int du2cu_rrc_container_length;
} f1ap_initial_ul_rrc_message_t; } f1ap_initial_ul_rrc_message_t;
......
...@@ -806,7 +806,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -806,7 +806,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
rnti_t rntiP, rnti_t rntiP,
const uint8_t *sduP, const uint8_t *sduP,
sdu_size_t sdu_lenP, sdu_size_t sdu_lenP,
const uint8_t *sdu2P, const int8_t *sdu2P,
sdu_size_t sdu2_lenP) { sdu_size_t sdu2_lenP) {
F1AP_F1AP_PDU_t pdu; F1AP_F1AP_PDU_t pdu;
...@@ -1169,6 +1169,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, ...@@ -1169,6 +1169,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance,
apply_macrlc_config(rrc,ue_context_p,&ctxt); apply_macrlc_config(rrc,ue_context_p,&ctxt);
// This should be somewhere in the f1ap_cudu_ue_inst_t
/*int macrlc_instance = 0;
rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id);
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[macrlc_instance],rnti);
*/
gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n");
......
...@@ -50,7 +50,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ...@@ -50,7 +50,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
rnti_t rntiP, rnti_t rntiP,
const uint8_t *sduP, const uint8_t *sduP,
sdu_size_t sdu_lenP, sdu_size_t sdu_lenP,
const uint8_t *sdu2P, const int8_t *sdu2P,
sdu_size_t sdu2_lenP); sdu_size_t sdu2_lenP);
#endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */
...@@ -195,7 +195,7 @@ void *F1AP_DU_task(void *arg) { ...@@ -195,7 +195,7 @@ void *F1AP_DU_task(void *arg) {
DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti,
msg->rrc_container, msg->rrc_container,
msg->rrc_container_length, msg->rrc_container_length,
msg->du2cu_rrc_container, (const int8_t*)msg->du2cu_rrc_container,
msg->du2cu_rrc_container_length); msg->du2cu_rrc_container_length);
break; break;
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
//#define DEBUG_MIB
//#define ENABLE_MAC_PAYLOAD_DEBUG 1 //#define ENABLE_MAC_PAYLOAD_DEBUG 1
//#define DEBUG_EXTRACT_DCI //#define DEBUG_EXTRACT_DCI
//#define DEBUG_RAR //#define DEBUG_RAR
...@@ -115,9 +116,10 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -115,9 +116,10 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
//if(mac->mib != NULL){ //if(mac->mib != NULL){
uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused); uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused);
uint16_t frame_number_4lsb = 0; uint16_t frame_number_4lsb = 0;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i);
uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4]
uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5]
uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset; uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset;
...@@ -134,15 +136,20 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -134,15 +136,20 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
} }
} }
LOG_D(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); #ifdef DEBUG_MIB
LOG_D(MAC,"system frame number(with LSB): %d\n", (int)frame); uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4]
LOG_D(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]);
LOG_D(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame);
LOG_D(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon);
LOG_D(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset);
LOG_D(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position);
LOG_D(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); LOG_I(MAC,"controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero);
LOG_D(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); LOG_I(MAC,"searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero);
LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred);
LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection);
LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit);
LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index);
#endif
//storing ssb index in the mac structure //storing ssb index in the mac structure
mac->mib_ssb = ssb_index; mac->mib_ssb = ssb_index;
......
...@@ -1055,8 +1055,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -1055,8 +1055,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
//and block this traffic from being forwarded to the upper layers at the gNB //and block this traffic from being forwarded to the upper layers at the gNB
LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes); LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes);
// Make the first byte padding so that gNB ignores the PHY random //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2)
// data in the TB for the PHY at the MAC layer //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should
//have a valid LCID (nr_process_mac_pdu function)
ulsch_input_buffer[0] = UL_SCH_LCID_PADDING; ulsch_input_buffer[0] = UL_SCH_LCID_PADDING;
for (int i = 1; i < TBS_bytes; i++) { for (int i = 1; i < TBS_bytes; i++) {
...@@ -1964,6 +1965,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1964,6 +1965,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
} // if is_nr_UL_slot } // if is_nr_UL_slot
} }
#define MAX_LCID 8 //Fixme: also defined in LCID table
uint8_t uint8_t
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
sub_frame_t subframe, uint8_t eNB_index, sub_frame_t subframe, uint8_t eNB_index,
...@@ -1971,16 +1973,15 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -1971,16 +1973,15 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t total_rlc_pdu_header_len = 0; uint8_t total_rlc_pdu_header_len = 0;
int16_t buflen_remain = 0; int16_t buflen_remain = 0;
uint8_t lcid = 0; uint8_t lcid = 0;
uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; uint16_t sdu_lengths[MAX_LCID] = { 0 };
uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t sdu_lcids[MAX_LCID] = { 0 };
uint16_t payload_offset = 0, num_sdus = 0; uint16_t payload_offset = 0, num_sdus = 0;
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES]; uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
uint16_t sdu_length_total = 0; uint16_t sdu_length_total = 0;
//unsigned short post_padding = 0; //unsigned short post_padding = 0;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
rlc_buffer_occupancy_t lcid_buffer_occupancy_old = rlc_buffer_occupancy_t lcid_buffer_occupancy_new = 0;
0, lcid_buffer_occupancy_new = 0;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n", "[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
module_idP, frameP, subframe, buflen); module_idP, frameP, subframe, buflen);
...@@ -1990,16 +1991,13 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -1990,16 +1991,13 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
// Check for DCCH first // Check for DCCH first
// TO DO: Multiplex in the order defined by the logical channel prioritization // TO DO: Multiplex in the order defined by the logical channel prioritization
for (lcid = UL_SCH_LCID_SRB1; for (lcid = UL_SCH_LCID_SRB1;
lcid < NR_MAX_NUM_LCID; lcid++) { lcid < MAX_LCID; lcid++) {
lcid_buffer_occupancy_old = mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid); if( mac_rlc_get_buffer_occupancy_ind(module_idP, mac->crnti, eNB_index, frameP, subframe, ENB_FLAG_NO, lcid) ) {
lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
if(lcid_buffer_occupancy_new){
buflen_remain = buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
LOG_I(NR_MAC, LOG_D(NR_MAC,
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to " "[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d "send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
module_idP, frameP, lcid, lcid_buffer_occupancy_new, module_idP, frameP, lcid, lcid_buffer_occupancy_new,
...@@ -2033,14 +2031,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, ...@@ -2033,14 +2031,6 @@ nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
num_sdus++; num_sdus++;
} }
/* Get updated BO after multiplexing this PDU */
lcid_buffer_occupancy_new = mac_rlc_get_buffer_occupancy_ind(module_idP,
mac->crnti,
eNB_index,
frameP,
subframe,
ENB_FLAG_NO,
lcid);
buflen_remain = buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE); buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
} }
......
...@@ -422,7 +422,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -422,7 +422,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
int add_ue, int add_ue,
uint32_t rnti, uint32_t rnti,
NR_CellGroupConfig_t *CellGroup){ NR_CellGroupConfig_t *CellGroup) {
if (scc != NULL ) { if (scc != NULL ) {
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present); AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
......
...@@ -97,15 +97,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB) ...@@ -97,15 +97,12 @@ void dump_mac_stats(gNB_MAC_INST *gNB)
stats->num_rsrp_meas = 0; stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0 ; stats->cumul_rsrp = 0 ;
LOG_I(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); LOG_I(NR_MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes);
const NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_DTX %d, ulsch_errors %d\n",
LOG_I(NR_MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d, PUSCH SNR %2.1f dB, PUCCH SNR %2.1f dB, noise rssi %2.1f dB\n",
UE_id, UE_id,
stats->ulsch_rounds[0], stats->ulsch_rounds[1], stats->ulsch_rounds[0], stats->ulsch_rounds[1],
stats->ulsch_rounds[2], stats->ulsch_rounds[3], stats->ulsch_rounds[2], stats->ulsch_rounds[3],
stats->ulsch_errors, stats->ulsch_DTX,
(float) sched_ctrl->pusch_snrx10 / 10, stats->ulsch_errors);
(float) sched_ctrl->pucch_snrx10 / 10,
(float) (sched_ctrl->raw_rssi - 1280) / 10);
LOG_I(NR_MAC, LOG_I(NR_MAC,
"UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n",
UE_id, UE_id,
......
...@@ -390,11 +390,11 @@ void nr_store_dlsch_buffer(module_id_t module_id, ...@@ -390,11 +390,11 @@ void nr_store_dlsch_buffer(module_id_t module_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
sched_ctrl->num_total_bytes = 0; sched_ctrl->num_total_bytes = 0;
if (loop_dcch_dtch == DL_SCH_LCID_DCCH1) if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH1)
loop_dcch_dtch = DL_SCH_LCID_DTCH; loop_dcch_dtch = DL_SCH_LCID_DTCH;
else if (loop_dcch_dtch == DL_SCH_LCID_DTCH) else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DTCH)
loop_dcch_dtch = DL_SCH_LCID_DCCH; loop_dcch_dtch = DL_SCH_LCID_DCCH;
else if (loop_dcch_dtch == DL_SCH_LCID_DCCH) else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH)
loop_dcch_dtch = DL_SCH_LCID_DCCH1; loop_dcch_dtch = DL_SCH_LCID_DCCH1;
const int lcid = loop_dcch_dtch; const int lcid = loop_dcch_dtch;
...@@ -573,7 +573,7 @@ void pf_dl(module_id_t module_id, ...@@ -573,7 +573,7 @@ void pf_dl(module_id_t module_id,
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
if (UE_info->Msg4_ACKed[UE_id] != true) continue; if (UE_info->Msg4_ACKed[UE_id] != true) continue;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->ul_failure==1) continue; if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */ /* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
...@@ -656,7 +656,7 @@ void pf_dl(module_id_t module_id, ...@@ -656,7 +656,7 @@ void pf_dl(module_id_t module_id,
* allocation after CCE alloc fail would be more complex) */ * allocation after CCE alloc fail would be more complex) */
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1); const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1);
if (alloc<0) { if (alloc<0) {
LOG_D(MAC, LOG_D(NR_MAC,
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
__func__, __func__,
UE_id, UE_id,
...@@ -802,7 +802,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -802,7 +802,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
NR_list_t *UE_list = &UE_info->list; NR_list_t *UE_list = &UE_info->list;
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->ul_failure==1) continue; if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
UE_info->mac_stats[UE_id].dlsch_current_bytes = 0; UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
* \company Eurecom * \company Eurecom
*/ */
#include <softmodem-common.h>
#include "LAYER2/MAC/mac.h" #include "LAYER2/MAC/mac.h"
#include "NR_MAC_gNB/nr_mac_gNB.h" #include "NR_MAC_gNB/nr_mac_gNB.h"
#include "NR_MAC_COMMON/nr_mac_extern.h" #include "NR_MAC_COMMON/nr_mac_extern.h"
...@@ -131,7 +132,7 @@ void nr_schedule_pucch(int Mod_idP, ...@@ -131,7 +132,7 @@ void nr_schedule_pucch(int Mod_idP,
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->ul_failure==1) continue; if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch); const int n = sizeof(sched_ctrl->sched_pucch) / sizeof(*sched_ctrl->sched_pucch);
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i]; NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[i];
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include <openair2/UTIL/OPT/opt.h>
//38.321 Table 6.1.3.1-1 //38.321 Table 6.1.3.1-1
const uint32_t NR_SHORT_BSR_TABLE[32] = { const uint32_t NR_SHORT_BSR_TABLE[32] = {
...@@ -371,7 +373,7 @@ void nr_process_mac_pdu(module_id_t module_idP, ...@@ -371,7 +373,7 @@ void nr_process_mac_pdu(module_id_t module_idP,
} }
LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: %d \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, *UE_info->rnti); LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: %d \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, *UE_info->rnti);
mac_rlc_data_ind(module_idP, mac_rlc_data_ind(module_idP,
*UE_info->rnti, UE_info->rnti[UE_id],
module_idP, module_idP,
frameP, frameP,
ENB_FLAG_YES, ENB_FLAG_YES,
...@@ -1310,7 +1312,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) ...@@ -1310,7 +1312,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
const NR_list_t *UE_list = &UE_info->list; const NR_list_t *UE_list = &UE_info->list;
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
if (sched_ctrl->ul_failure == 1) continue; if (sched_ctrl->ul_failure == 1 && get_softmodem_params()->phy_test==0) continue;
UE_info->mac_stats[UE_id].ulsch_current_bytes = 0; UE_info->mac_stats[UE_id].ulsch_current_bytes = 0;
/* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in
......
...@@ -1081,6 +1081,12 @@ pdcp_data_ind( ...@@ -1081,6 +1081,12 @@ pdcp_data_ind(
pdcpHead->inst = 1; pdcpHead->inst = 1;
} }
} // nfapi_mode } // nfapi_mode
} else {
if (UE_NAS_USE_TUN) {
pdcpHead->inst = ctxt_pP->module_id;
} else if (ENB_NAS_USE_TUN) {
pdcpHead->inst = 0;
}
} }
} else { } else {
pdcpHead->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB); pdcpHead->rb_id = rb_id + (ctxt_pP->module_id * LTE_maxDRB);
......
...@@ -43,6 +43,7 @@ extern int otg_enabled; ...@@ -43,6 +43,7 @@ extern int otg_enabled;
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <netinet/ip.h>
#define rtf_put write #define rtf_put write
#define rtf_get read #define rtf_get read
...@@ -222,7 +223,11 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ...@@ -222,7 +223,11 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
} else { // => ENB_NAS_USE_TUN } else { // => ENB_NAS_USE_TUN
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0]; /* Get the IP from a packet */
struct ip *ip_pack = (struct ip *) nl_rx_buf;
/* Use last octet of destination IP to get index of UE */
int ue_indx = ((ip_pack->ip_dst.s_addr >> 24) - 2) % MAX_MOBILES_PER_ENB;
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[ue_indx];
ctxt.enb_flag=ENB_FLAG_YES; ctxt.enb_flag=ENB_FLAG_YES;
ctxt.module_id=0; ctxt.module_id=0;
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
......
...@@ -346,7 +346,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, ...@@ -346,7 +346,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP,
rntiP, rntiP,
sduP, sduP,
sdu_lenP, sdu_lenP,
sdu2, (const int8_t*)sdu2,
sdu2_len sdu2_len
); );
return(0); return(0);
......
...@@ -3285,11 +3285,7 @@ void *rrc_gnb_task(void *args_p) { ...@@ -3285,11 +3285,7 @@ void *rrc_gnb_task(void *args_p) {
///Nothing to do. Apparently everything is done in S1AP processing ///Nothing to do. Apparently everything is done in S1AP processing
//LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n",
//instance, msg_name_p); //instance, msg_name_p);
if (rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) AssertFatal(false, "Removed double mechanism for same feature: now delete_tunnel() function should be called\n");
&& rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) {
rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc =
rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc;
}
break; break;
#endif #endif
......
...@@ -402,7 +402,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ...@@ -402,7 +402,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
rrc_gNB_ue_context_t *ue_context; rrc_gNB_ue_context_t *ue_context;
MessageDef *msg_delete_tunnels_p;
int e_rab; int e_rab;
LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti); LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti);
...@@ -419,25 +418,18 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { ...@@ -419,25 +418,18 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
rrc_rlc_remove_ue(&ctxt); rrc_rlc_remove_ue(&ctxt);
mac_remove_nr_ue(rrc->module_id, rnti); mac_remove_nr_ue(rrc->module_id, rnti);
gtpv1u_enb_delete_tunnel_req_t tmp={0};
/* delete gtp tunnel */ tmp.rnti=rnti;
msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); tmp.from_gnb=1;
memset(&GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d will be deleted for rnti %d\n", ue_context->ue_context.nb_of_e_rabs, rnti);
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = rnti;
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 1;
LOG_D(RRC, "ue_context->ue_context.nb_of_e_rabs %d\n", ue_context->ue_context.nb_of_e_rabs);
for (e_rab = 0; e_rab < ue_context->ue_context.nb_of_e_rabs; e_rab++) { for (e_rab = 0; e_rab < ue_context->ue_context.nb_of_e_rabs; e_rab++) {
GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = tmp.eps_bearer_id[tmp.num_erab++]= ue_context->ue_context.gnb_gtp_ebi[e_rab];
ue_context->ue_context.gnb_gtp_ebi[e_rab];
// erase data // erase data
ue_context->ue_context.gnb_gtp_teid[e_rab] = 0; ue_context->ue_context.gnb_gtp_teid[e_rab] = 0;
memset(&ue_context->ue_context.gnb_gtp_addrs[e_rab], 0, sizeof(ue_context->ue_context.gnb_gtp_addrs[e_rab])); memset(&ue_context->ue_context.gnb_gtp_addrs[e_rab], 0, sizeof(ue_context->ue_context.gnb_gtp_addrs[e_rab]));
ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0; ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0;
} }
gtpv1u_delete_s1u_tunnel(rrc->module_id, &tmp);
itti_send_msg_to_task(TASK_VARIABLE, rrc->module_id, msg_delete_tunnels_p);
/* remove context */ /* remove context */
rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context); rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context);
} }
...@@ -439,11 +439,16 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer ...@@ -439,11 +439,16 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer
tmp->outgoing_port=port; tmp->outgoing_port=port;
tmp->teid_outgoing= outgoing_teid; tmp->teid_outgoing= outgoing_teid;
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
LOG_D(GTPU, "Created tunnel for RNTI %x, bearer: %d/%d teid for DL: %x, teid for UL %x\n", char ip4[INET_ADDRSTRLEN];
char ip6[INET6_ADDRSTRLEN];
LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d to remote IPv4: %s, IPv6 %s\n",
rnti, rnti,
outgoing_bearer_id, incoming_bearer_id,
tmp->teid_incoming, tmp->teid_incoming,
tmp->teid_outgoing); tmp->teid_outgoing,
inet_ntop(AF_INET,(void*)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ),
inet_ntop(AF_INET6,(void*)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN));
return incoming_teid; return incoming_teid;
} }
......
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