diff --git a/charts/physims/charts/dlsim/values.yaml b/charts/physims/charts/dlsim/values.yaml
index c0142b50ae..d78fbb7409 100644
--- a/charts/physims/charts/dlsim/values.yaml
+++ b/charts/physims/charts/dlsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/ldpctest/values.yaml b/charts/physims/charts/ldpctest/values.yaml
index 91eab91af5..e2e6467923 100644
--- a/charts/physims/charts/ldpctest/values.yaml
+++ b/charts/physims/charts/ldpctest/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-dlschsim/values.yaml b/charts/physims/charts/nr-dlschsim/values.yaml
index e96541102c..8944e7e724 100644
--- a/charts/physims/charts/nr-dlschsim/values.yaml
+++ b/charts/physims/charts/nr-dlschsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-dlsim/values.yaml b/charts/physims/charts/nr-dlsim/values.yaml
index c86fc96cff..573e8630de 100644
--- a/charts/physims/charts/nr-dlsim/values.yaml
+++ b/charts/physims/charts/nr-dlsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-pbchsim/values.yaml b/charts/physims/charts/nr-pbchsim/values.yaml
index 62d89f9632..28c4678334 100644
--- a/charts/physims/charts/nr-pbchsim/values.yaml
+++ b/charts/physims/charts/nr-pbchsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-prachsim/values.yaml b/charts/physims/charts/nr-prachsim/values.yaml
index 3ea9787f7a..9e3c68b54d 100644
--- a/charts/physims/charts/nr-prachsim/values.yaml
+++ b/charts/physims/charts/nr-prachsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-pucchsim/values.yaml b/charts/physims/charts/nr-pucchsim/values.yaml
index cf50c0bd3c..449670f713 100644
--- a/charts/physims/charts/nr-pucchsim/values.yaml
+++ b/charts/physims/charts/nr-pucchsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-ulschsim/values.yaml b/charts/physims/charts/nr-ulschsim/values.yaml
index 420b154596..a3afc090e8 100644
--- a/charts/physims/charts/nr-ulschsim/values.yaml
+++ b/charts/physims/charts/nr-ulschsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/nr-ulsim/values.yaml b/charts/physims/charts/nr-ulsim/values.yaml
index 7eb8e33fcb..2bf96498e8 100644
--- a/charts/physims/charts/nr-ulsim/values.yaml
+++ b/charts/physims/charts/nr-ulsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/polartest/values.yaml b/charts/physims/charts/polartest/values.yaml
index 496dc8afba..e0a532fdd8 100644
--- a/charts/physims/charts/polartest/values.yaml
+++ b/charts/physims/charts/polartest/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/smallblocktest/values.yaml b/charts/physims/charts/smallblocktest/values.yaml
index 9dd791265f..f2f113d9b6 100644
--- a/charts/physims/charts/smallblocktest/values.yaml
+++ b/charts/physims/charts/smallblocktest/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/charts/physims/charts/ulsim/values.yaml b/charts/physims/charts/ulsim/values.yaml
index f5110989d8..35dc14d596 100644
--- a/charts/physims/charts/ulsim/values.yaml
+++ b/charts/physims/charts/ulsim/values.yaml
@@ -33,7 +33,9 @@ podSecurityContext:
securityContext:
privileged: true
- # capabilities:
+ capabilities:
+ add:
+ - SYS_CAP_PTRACE
# drop:
# - ALL
# readOnlyRootFilesystem: true
diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py
index 2b19a80984..fdc2bc1597 100644
--- a/ci-scripts/cls_containerize.py
+++ b/ci-scripts/cls_containerize.py
@@ -106,6 +106,9 @@ class Containerize():
self.registrySvrId = ''
self.testSvrId = ''
+ #checkers from xml
+ self.ran_checkers={}
+
#-----------------------------------------------------------
# Container management functions
#-----------------------------------------------------------
@@ -624,7 +627,7 @@ class Containerize():
else:
if containerToKill:
logging.debug('\u001B[1m Analyzing ' + nodeB_prefix + 'NB logfile \u001B[0m ' + self.eNB_logFile[self.eNB_instance])
- logStatus = RAN.AnalyzeLogFile_eNB(self.eNB_logFile[self.eNB_instance], HTML)
+ logStatus = RAN.AnalyzeLogFile_eNB(self.eNB_logFile[self.eNB_instance], HTML, self.ran_checkers)
else:
logStatus = 0
if (logStatus < 0):
@@ -788,9 +791,10 @@ class Containerize():
continue
logging.debug('\u001B[1m Analyzing xNB logfile ' + filename + ' \u001B[0m')
- logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML)
+ logStatus = RAN.AnalyzeLogFile_eNB(filename, HTML, self.ran_checkers)
if (logStatus < 0):
fullStatus = False
+ self.exitStatus = 1
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'KO', logStatus)
else:
HTML.CreateHtmlTestRow(RAN.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py
index cf7b91d3c0..905a105512 100644
--- a/ci-scripts/cls_log_mgt.py
+++ b/ci-scripts/cls_log_mgt.py
@@ -30,11 +30,15 @@
-
+import logging
import re
import subprocess
-import logging
-import math
+import sshconnection
+
+logging.basicConfig(
+ level=logging.DEBUG,
+ format="[%(asctime)s] %(name)s:%(levelname)s: %(message)s"
+)
class Log_Mgt:
@@ -49,40 +53,25 @@ class Log_Mgt:
#-----------------$
- def __CheckAvailSpace(self):
+ def __CheckUsedSpace(self):
HOST=self.Username+'@'+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
+ used=s.split()[4] #get 4th field ex: 70%
+ m = re.match('^(\d+)\%',used)
+ if m is not None:
+ return int(m.group(1))
- def __GetOldestFile(self):
- HOST=self.Username+'@'+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 __RemoveOldest(self):
+ mySSH = sshconnection.SSHConnection()
+ mySSH.open(self.IPAddress, self.Username, self.Password)
+ COMMAND='echo ' + self.Password + ' | sudo -S find ' + self.path + ' -type f -mtime +14 -delete'
+ mySSH.command(COMMAND,'\$',20)
+ mySSH.close()
- def __AvgSize(self):
- HOST=self.Username+'@'+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()
- if len(result)>1: #at least 1 file present
- 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
- else:#empty,no files
- return 0
-
#-----------------$
#PUBLIC Methods$
@@ -90,17 +79,15 @@ class Log_Mgt:
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 < 50*avg_size: #reserved space is 50x artifact file ; oldest file will be deleted
- oldestfile=self.__GetOldestFile()
- HOST=self.Username+'@'+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)
+ used_space = self.__CheckUsedSpace() #avail space in target folder
+ if used_space > 80 :
+ logging.debug('\u001B[1;37;41m Used Disk > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m')
+ logging.debug('\u001B[1;37;41m Removing Artifacts older than 14 days \u001B[0m')
+ self.__RemoveOldest()
else:
- logging.debug("Still some space left for artifacts storage")
+ logging.debug('Used Disk < 80%, on ' + self.Username+'@'+self.IPAddress +', no cleaning required')
+
+
diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py
index b7a730e91c..83fb74b7cb 100644
--- a/ci-scripts/cls_physim1.py
+++ b/ci-scripts/cls_physim1.py
@@ -246,7 +246,7 @@ class PhySim:
isFinished = False
# doing a deep copy!
tmpPodNames = podNames.copy()
- while(count < 32 and isFinished == False):
+ while(count < 50 and isFinished == False):
time.sleep(60)
for podName in tmpPodNames:
mySSH.command2(f'oc logs --tail=1 {podName} 2>&1', 6, silent=True)
diff --git a/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf
new file mode 100644
index 0000000000..bd3076a014
--- /dev/null
+++ b/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf
@@ -0,0 +1,301 @@
+Active_gNBs = ( "gNB-OAI");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+ ////////// Identification parameters:
+ gNB_ID = 0xe00;
+ gNB_name = "gNB-OAI";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ({
+ mcc = 208;
+ mnc = 99;
+ mnc_length = 2;
+ snssaiList = (
+ {
+ sst = 1;
+ sd = 0x1; // 0 false, else true
+ },
+ {
+ sst = 1;
+ sd = 0x112233; // 0 false, else true
+ }
+ );
+
+ });
+
+ nr_cellid = 12345678L;
+
+ ////////// Physical parameters:
+
+ ssb_SubcarrierOffset = 0;
+ pdsch_AntennaPorts = 1;
+ pusch_AntennaPorts = 1;
+ sib1_tda = 15;
+ min_rxtxtime = 6;
+
+ pdcch_ConfigSIB1 = (
+ {
+ controlResourceSetZero = 2;
+ searchSpaceZero = 0;
+ }
+ );
+
+ servingCellConfigCommon = (
+ {
+ #spCellConfigCommon
+
+ physCellId = 0;
+
+# downlinkConfigCommon
+ #frequencyInfoDL
+ # this is 3600 MHz + 12 PRBs@30kHz SCS (same as initial BWP)
+ absoluteFrequencySSB = 640288;
+ dl_frequencyBand = 78;
+ # this is 3600 MHz
+ dl_absoluteFrequencyPointA = 640000;
+ #scs-SpecificCarrierList
+ dl_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ dl_subcarrierSpacing = 1;
+ dl_carrierBandwidth = 24;
+ #initialDownlinkBWP
+ #genericParameters
+ # this is RBstart=27,L=48 (275*(L-1))+RBstart
+ initialDLBWPlocationAndBandwidth = 6325;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialDLBWPsubcarrierSpacing = 1;
+ #pdcch-ConfigCommon
+ initialDLBWPcontrolResourceSetZero = 2;
+ initialDLBWPsearchSpaceZero = 0;
+
+ #uplinkConfigCommon
+ #frequencyInfoUL
+ ul_frequencyBand = 78;
+ #scs-SpecificCarrierList
+ ul_offstToCarrier = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ ul_subcarrierSpacing = 1;
+ ul_carrierBandwidth = 24;
+ pMax = 20;
+ #initialUplinkBWP
+ #genericParameters
+ initialULBWPlocationAndBandwidth = 6325;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ initialULBWPsubcarrierSpacing = 1;
+ #rach-ConfigCommon
+ #rach-ConfigGeneric
+ prach_ConfigurationIndex = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+ prach_msg1_FDM = 0;
+ prach_msg1_FrequencyStart = 0;
+ zeroCorrelationZoneConfig = 13;
+ preambleReceivedTargetPower = -96;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+ preambleTransMax = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+ powerRampingStep = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+ ra_ResponseWindow = 4;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+ ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+ ra_ContentionResolutionTimer = 7;
+ rsrp_ThresholdSSB = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+ prach_RootSequenceIndex_PR = 2;
+ prach_RootSequenceIndex = 1;
+ # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+ #
+ msg1_SubcarrierSpacing = 1,
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+ restrictedSetConfig = 0,
+
+ msg3_DeltaPreamble = 1;
+ p0_NominalWithGrant =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+ pucchGroupHopping = 0;
+ hoppingId = 40;
+ p0_nominal = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+ ssb_PositionsInBurst_PR = 2;
+ ssb_PositionsInBurst_Bitmap = 1;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
+ ssb_periodicityServingCell = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+ dmrs_TypeA_Position = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ subcarrierSpacing = 1;
+
+
+ #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
+ referenceSubcarrierSpacing = 1;
+ # pattern1
+ # dl_UL_TransmissionPeriodicity
+ # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+ dl_UL_TransmissionPeriodicity = 6;
+ nrofDownlinkSlots = 7;
+ nrofDownlinkSymbols = 6;
+ nrofUplinkSlots = 2;
+ nrofUplinkSymbols = 4;
+
+ ssPBCH_BlockPower = -25;
+ }
+
+ );
+
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// AMF parameters:
+ amf_ip_address = ( { ipv4 = "192.168.70.132";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+
+ NETWORK_INTERFACES :
+ {
+ GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai";
+ GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24";
+ GNB_INTERFACE_NAME_FOR_NGU = "demo-oai";
+ GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ };
+
+ }
+);
+
+MACRLCs = (
+{
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ pusch_TargetSNRx10 = 150;
+ pucch_TargetSNRx10 = 200;
+ ulsch_max_frame_inactivity = 1;
+}
+);
+
+L1s = (
+{
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ pusch_proc_threads = 8;
+ prach_dtx_threshold = 120;
+ pucch0_dtx_threshold = 150;
+ ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0
+}
+);
+
+RUs = (
+{
+ local_rf = "yes"
+ nb_tx = 1
+ nb_rx = 1
+ att_tx = 0
+ att_rx = 0;
+ bands = [78];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 114;
+ sf_extension = 0;
+ eNB_instances = [0];
+ #beamforming 1x4 matrix:
+ bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
+ clock_src = "internal";
+}
+);
+
+THREAD_STRUCT = (
+{
+ #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+ parallel_config = "PARALLEL_SINGLE_THREAD";
+ #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+ worker_config = "WORKER_ENABLE";
+}
+);
+
+rfsimulator :
+{
+ serveraddr = "server";
+ serverport = "4043";
+ options = (); #("saviq"); or/and "chanmod"
+ modelname = "AWGN";
+ IQfile = "/tmp/rfsimulator.iqs";
+};
+
+security = {
+ # preferred ciphering algorithms
+ # the first one of the list that an UE supports in chosen
+ # valid values: nea0, nea1, nea2, nea3
+ ciphering_algorithms = ( "nea0" );
+
+ # preferred integrity algorithms
+ # the first one of the list that an UE supports in chosen
+ # valid values: nia0, nia1, nia2, nia3
+ integrity_algorithms = ( "nia2", "nia0" );
+
+ # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
+ # what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
+ drb_ciphering = "yes";
+ drb_integrity = "no";
+};
+
+log_config :
+{
+ global_log_level ="info";
+ global_log_verbosity ="medium";
+ hw_log_level ="info";
+ hw_log_verbosity ="medium";
+ phy_log_level ="info";
+ phy_log_verbosity ="medium";
+ mac_log_level ="info";
+ mac_log_verbosity ="high";
+ rlc_log_level ="info";
+ rlc_log_verbosity ="medium";
+ pdcp_log_level ="info";
+ pdcp_log_verbosity ="medium";
+ rrc_log_level ="info";
+ rrc_log_verbosity ="medium";
+ ngap_log_level ="debug";
+ ngap_log_verbosity ="medium";
+};
+
diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py
index 3c05675928..4f82811ac1 100644
--- a/ci-scripts/constants.py
+++ b/ci-scripts/constants.py
@@ -45,6 +45,7 @@ ENB_PROCESS_REALTIME_ISSUE = -13
ENB_PROCESS_NOLOGFILE_TO_ANALYZE = -14
ENB_PROCESS_SLAVE_RRU_NOT_SYNCED = -15
ENB_REAL_TIME_PROCESSING_ISSUE = -16
+ENB_RETX_ISSUE = -17
HSS_PROCESS_FAILED = -2
HSS_PROCESS_OK = +2
MME_PROCESS_FAILED = -3
diff --git a/ci-scripts/cppcheck_suppressions.list b/ci-scripts/cppcheck_suppressions.list
index f8438a4276..ff4cac20b3 100644
--- a/ci-scripts/cppcheck_suppressions.list
+++ b/ci-scripts/cppcheck_suppressions.list
@@ -50,10 +50,6 @@ memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
//
//-----------------------------------------------------------------------------
-// oaisim deprecated, remove?
-doubleFree:openair3/TEST/oaisim_mme_list_benchmark.c
-//
-//-----------------------------------------------------------------------------
// is itti analyzer deprecated
nullPointer:common/utils/itti_analyzer/itti_analyzer.c
nullPointerRedundantCheck:common/utils/itti_analyzer/libbuffers/buffers.c
diff --git a/ci-scripts/datalog_rt_stats.2x2.yaml b/ci-scripts/datalog_rt_stats.2x2.yaml
index 9e2b66862d..a93ef6aa8c 100644
--- a/ci-scripts/datalog_rt_stats.2x2.yaml
+++ b/ci-scripts/datalog_rt_stats.2x2.yaml
@@ -4,16 +4,14 @@
Title : Processing Time (us)
ColNames :
- Metric
- - Average
- - Max
- - Average vs Reference Deviation (Reference Value ; Acceptability Threshold)
+ - Average; Max; Count
+ - Average vs Reference Deviation (Reference Value; Acceptability Threshold)
Ref :
feprx : 120.0
feptx_prec : 8.0
feptx_ofdm : 50.0
feptx_total : 75.0
- L1 Tx processing thread 0 : 300.0
- L1 Tx processing thread 1 : 300.0
+ L1 Tx processing : 300.0
DLSCH encoding : 230.0
L1 Rx processing : 175.0
PUSCH inner-receiver : 100.0
@@ -25,8 +23,7 @@ Threshold :
feptx_prec : 1.25
feptx_ofdm : 1.25
feptx_total : 1.25
- L1 Tx processing thread 0 : 1.25
- L1 Tx processing thread 1 : 1.25
+ L1 Tx processing : 1.25
DLSCH encoding : 1.25
L1 Rx processing : 1.25
PUSCH inner-receiver : 1.25
diff --git a/ci-scripts/datalog_rt_stats.default.yaml b/ci-scripts/datalog_rt_stats.default.yaml
index a2d4768752..02a90c86f4 100644
--- a/ci-scripts/datalog_rt_stats.default.yaml
+++ b/ci-scripts/datalog_rt_stats.default.yaml
@@ -4,16 +4,14 @@
Title : Processing Time (us)
ColNames :
- Metric
- - Average
- - Max
- - Average vs Reference Deviation (Reference Value ; Acceptability Threshold)
+ - Average; Max; Count
+ - Average vs Reference Deviation (Reference Value; Acceptability Threshold)
Ref :
feprx : 60.0
feptx_prec : 8.0
feptx_ofdm : 50.0
feptx_total : 75.0
- L1 Tx processing thread 0 : 300.0
- L1 Tx processing thread 1 : 300.0
+ L1 Tx processing : 300.0
DLSCH encoding : 230.0
L1 Rx processing : 175.0
PUSCH inner-receiver : 100.0
@@ -25,8 +23,7 @@ Threshold :
feptx_prec : 1.25
feptx_ofdm : 1.25
feptx_total : 1.25
- L1 Tx processing thread 0 : 1.25
- L1 Tx processing thread 1 : 1.25
+ L1 Tx processing : 1.25
DLSCH encoding : 1.25
L1 Rx processing : 1.25
PUSCH inner-receiver : 1.25
diff --git a/ci-scripts/html.py b/ci-scripts/html.py
index b172ffb711..13a1ab8691 100644
--- a/ci-scripts/html.py
+++ b/ci-scripts/html.py
@@ -478,21 +478,19 @@ class HTMLManagement():
self.htmlFile.write(' \n')
self.htmlFile.write('
\n')
self.htmlFile.write(' | '+ DataLog['ColNames'][0] +' | \n')
- self.htmlFile.write(' ' + DataLog['ColNames'][1] + ' | \n')
- self.htmlFile.write(' ' + DataLog['ColNames'][2] + ' | \n')
- self.htmlFile.write(' '+ DataLog['ColNames'][3] +' | \n')
+ self.htmlFile.write(' ' + DataLog['ColNames'][1] + ' | \n')
+ self.htmlFile.write(' '+ DataLog['ColNames'][2] +' | \n')
self.htmlFile.write('
\n')
for k in DataLog['Data']:
# TestRow
self.htmlFile.write(' \n')
self.htmlFile.write(' | ' + k + ' | \n')
- self.htmlFile.write(' ' + DataLog['Data'][k][0] + ' | \n')
- self.htmlFile.write(' ' + DataLog['Data'][k][1] + ' | \n')
- if float(DataLog['Data'][k][2])> DataLog['Threshold'][k]:
- self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' | \n')
+ self.htmlFile.write(' ' + DataLog['Data'][k][0] + '; ' + DataLog['Data'][k][1] + '; ' + DataLog['Data'][k][2] + ' | \n')
+ if float(DataLog['Data'][k][3])> DataLog['Threshold'][k]:
+ self.htmlFile.write(' ' + DataLog['Data'][k][3] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' | \n')
else:
- self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' | \n')
+ self.htmlFile.write(' ' + DataLog['Data'][k][3] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' | \n')
self.htmlFile.write('
\n')
self.htmlFile.close()
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 5357a90a3d..aa7d512b3d 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -401,6 +401,12 @@ def GetParametersFromXML(action):
string_field=test.findtext('nb_healthy')
if (string_field is not None):
CONTAINERS.nb_healthy[0] = int(string_field)
+ string_field=test.findtext('d_retx_th')
+ if (string_field is not None):
+ CONTAINERS.ran_checkers['d_retx_th']= string_field
+ string_field=test.findtext('u_retx_th')
+ if (string_field is not None):
+ CONTAINERS.ran_checkers['u_retx_th']= string_field
elif action == 'PingFromContainer':
string_field = test.findtext('container_name')
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index ad360d2179..e5d0f10ee4 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -39,6 +39,7 @@ import time
from multiprocessing import Process, Lock, SimpleQueue
import yaml
+
#-----------------------------------------------------------
# OAI Testing modules
#-----------------------------------------------------------
@@ -758,7 +759,7 @@ class RANManagement():
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log *monitor.pickle *monitor*.png ping*.log.png log/*/*.log log/*/*.pcap', '\$', 15)
mySSH.close()
- def AnalyzeLogFile_eNB(self, eNBlogFile, HTML):
+ def AnalyzeLogFile_eNB(self, eNBlogFile, HTML, checkers={}):
if (not os.path.isfile('./' + eNBlogFile)):
return -1
enb_log_file = open('./' + eNBlogFile, 'r')
@@ -815,10 +816,12 @@ class RANManagement():
removing_ue = 0
#count"X2AP-PDU"
x2ap_pdu = 0
- #NSA specific log markers
- nsa_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': []}
+ #gnb specific log markers
+ gnb_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': [], 'Detected UL Failure on PUSCH':[]}
nodeB_prefix_found = False
RealTimeProcessingIssue = False
+ DLRetxIssue = False
+ ULRetxIssue = False
line_cnt=0 #log file line counter
for line in enb_log_file.readlines():
@@ -1008,11 +1011,11 @@ class RANManagement():
result = re.search('X2AP-PDU', str(line))
if result is not None:
x2ap_pdu += 1
- #nsa markers logging
- for k in nsa_markers:
+ #gnb markers logging
+ for k in gnb_markers:
result = re.search(k, line)
if result is not None:
- nsa_markers[k].append(line_cnt)
+ gnb_markers[k].append(line_cnt)
enb_log_file.close()
@@ -1096,46 +1099,94 @@ class RANManagement():
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- #nsa markers
+ #gnb markers
statMsg = 'logfile line count = ' + str(line_cnt)
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- if len(nsa_markers['SgNBReleaseRequestAcknowledge'])!=0:
- statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequestAcknowledge'][0])
+ if len(gnb_markers['SgNBReleaseRequestAcknowledge'])!=0:
+ statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(gnb_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences , starting line ' + str(gnb_markers['SgNBReleaseRequestAcknowledge'][0])
else:
- statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences'
+ statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(gnb_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences'
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- statMsg = 'FAILURE = ' + str(len(nsa_markers['FAILURE'])) + ' occurences'
+ statMsg = 'FAILURE = ' + str(len(gnb_markers['FAILURE'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ statMsg = 'Detected UL Failure on PUSCH = ' + str(len(gnb_markers['Detected UL Failure on PUSCH'])) + ' occurences'
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- #ulsch and dlsch statistics
+ #ulsch and dlsch statistics and checkers
+ #print statistics into html
if len(dlsch_ulsch_stats)!=0: #check if dictionary is not empty
+ #for each dictionary key, generate the msg for html as information
statMsg=''
- for key in dlsch_ulsch_stats: #for each dictionary key
+ for key in dlsch_ulsch_stats:
statMsg += dlsch_ulsch_stats[key] + '\n'
logging.debug(dlsch_ulsch_stats[key])
htmleNBFailureMsg += statMsg
+ #checker
+ if (len(dlsch_ulsch_stats)!=0) and (len(checkers)!=0):
+ if 'd_retx_th' in checkers:
+ checkers['d_retx_th'] = [float(x) for x in checkers['d_retx_th'].split(',')]
+ dlsch_checker_status = list(0 for i in checkers['d_retx_th'])#status 0 / -1
+ d_perc_retx = list(0 for i in checkers['d_retx_th'])#results in %
+
+ if 'u_retx_th' in checkers:
+ checkers['u_retx_th'] = [float(x) for x in checkers['u_retx_th'].split(',')]
+ ulsch_checker_status = list(0 for i in checkers['u_retx_th'])
+ u_perc_retx = list(0 for i in checkers['u_retx_th'])
+
+ #ul and dl retransmissions checkers
+ #NOTICE: DL and UL regex are different
+
+ if ('dlsch_rounds' in dlsch_ulsch_stats) and ('d_retx_th' in checkers):
+ tmp=re.match(r'^.*dlsch_rounds\s+(\d+)\/(\d+)\/(\d+)\/(\d+),\s+dlsch_errors\s+(\d+)',dlsch_ulsch_stats['dlsch_rounds'])
+ if tmp is not None :
+ #captures the different groups from the regex
+ retx_data=[float(x) for x in tmp.groups()]
+ for i in range(0,len(d_perc_retx)):
+ #case where numerator > denumerator with denum ==0 is disregarded, cannot hapen in principle, will lead to 0%
+ d_perc_retx[i] = 0 if (retx_data[i] == 0) else 100*retx_data[i+1]/retx_data[i]
+ #treating % > 100 , % > requirement
+ if (d_perc_retx[i] > 100) or (d_perc_retx[i] > checkers['d_retx_th'][i]): dlsch_checker_status[i] = -1
+ if -1 in dlsch_checker_status:
+ DLRetxIssue = True
+
+ if ('ulsch_rounds' in dlsch_ulsch_stats) and ('u_retx_th' in checkers):
+ tmp=re.match(r'^.*ulsch_rounds\s+(\d+)\/(\d+)\/(\d+)\/(\d+),\s+.*,\s+ulsch_errors\s+(\d+)',dlsch_ulsch_stats['ulsch_rounds'])
+ if tmp is not None :
+ retx_data=[float(x) for x in tmp.groups()]
+ for i in range(0,len(d_perc_retx)):
+ u_perc_retx[i] = 0 if (retx_data[i] == 0) else 100*retx_data[i+1]/retx_data[i]
+ if (u_perc_retx[i] > 100) or (u_perc_retx[i] > checkers['u_retx_th'][i]): ulsch_checker_status[i] = -1
+ if -1 in ulsch_checker_status:
+ ULRetxIssue = True
+
+
+
#real time statistics
datalog_rt_stats['Data']={}
if len(real_time_stats)!=0: #check if dictionary is not empty
for k in real_time_stats:
- tmp=re.match(r'^(?P.*):\s+(?P\d+\.\d+) us;\s+\d+;\s+(?P\d+\.\d+) us;',real_time_stats[k])
+ tmp=re.match(r'^(?P.*):\s+(?P\d+\.\d+) us;\s+(?P\d+);\s+(?P\d+\.\d+) us;',real_time_stats[k])
if tmp is not None:
metric=tmp.group('metric')
avg=float(tmp.group('avg'))
max=float(tmp.group('max'))
- datalog_rt_stats['Data'][metric]=["{:.0f}".format(avg),"{:.0f}".format(max),"{:.2f}".format(avg/datalog_rt_stats['Ref'][metric])]
+ count=int(tmp.group('count'))
+ datalog_rt_stats['Data'][metric]=["{:.0f}".format(avg),"{:.0f}".format(max),"{:d}".format(count),"{:.2f}".format(avg/datalog_rt_stats['Ref'][metric])]
#once all metrics are collected, store the data as a class attribute to build a dedicated HTML table afterward
self.datalog_rt_stats=datalog_rt_stats
#check if there is a fail => will render the test as failed
for k in datalog_rt_stats['Data']:
- if float(datalog_rt_stats['Data'][k][2])> datalog_rt_stats['Threshold'][k]: #condition for fail : avg/ref is greater than the fixed threshold
+ if float(datalog_rt_stats['Data'][k][3])> datalog_rt_stats['Threshold'][k]: #condition for fail : avg/ref is greater than the fixed threshold
+ logging.debug('\u001B[1;30;43m datalog_rt_stats metric ' + k + '=' + datalog_rt_stats['Data'][k][3] + ' > threshold ' + str(datalog_rt_stats['Threshold'][k]) + ' \u001B[0m')
RealTimeProcessingIssue = True
else:
statMsg = 'No real time stats found in the log file\n'
@@ -1158,18 +1209,34 @@ class RANManagement():
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- if len(nsa_markers['SgNBReleaseRequest'])!=0:
- statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequest'][0])
+ if len(gnb_markers['SgNBReleaseRequest'])!=0:
+ statMsg = 'SgNBReleaseRequest = ' + str(len(gnb_markers['SgNBReleaseRequest'])) + ' occurences , starting line ' + str(gnb_markers['SgNBReleaseRequest'][0])
else:
- statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences'
+ statMsg = 'SgNBReleaseRequest = ' + str(len(gnb_markers['SgNBReleaseRequest'])) + ' occurences'
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- statMsg = 'scgFailureInformationNR-r15 = ' + str(len(nsa_markers['scgFailureInformationNR-r15'])) + ' occurences'
+ statMsg = 'scgFailureInformationNR-r15 = ' + str(len(gnb_markers['scgFailureInformationNR-r15'])) + ' occurences'
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
+ if DLRetxIssue:
+ retx_checker_status_str = ''
+ for status in dlsch_checker_status : retx_checker_status_str+=str(status)+ ' '
+ logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with too many retransmissions / errors issue in DL ! \u001B[0m')
+ logging.debug('\u001B[1;37;41m Status : ' + retx_checker_status_str + ' \u001B[0m')
+ htmleNBFailureMsg += 'Fail due to retransmissions / errors issue in DL, status : ' + retx_checker_status_str + '\n'
+ global_status = CONST.ENB_RETX_ISSUE
+
+ if ULRetxIssue:
+ retx_checker_status_str = ''
+ for status in ulsch_checker_status : retx_checker_status_str+=str(status)+ ' '
+ logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with too many retransmissions / errors issue in UL ! \u001B[0m')
+ logging.debug('\u001B[1;37;41m Status : ' + retx_checker_status_str + ' \u001B[0m')
+ htmleNBFailureMsg += 'Fail due to retransmissions / errors issue in UL, status : ' + retx_checker_status_str + '\n'
+ global_status = CONST.ENB_RETX_ISSUE
+
if RealTimeProcessingIssue:
logging.debug('\u001B[1;37;41m ' + nodeB_prefix + 'NB ended with real time processing issue! \u001B[0m')
htmleNBFailureMsg += 'Fail due to real time processing issue\n'
diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh
index 6ef6b2e254..d22bfe177a 100755
--- a/ci-scripts/reportTestLocally.sh
+++ b/ci-scripts/reportTestLocally.sh
@@ -756,7 +756,7 @@ function report_test {
EPC_CONFIGS=("noS1")
TRANS_MODES=("tdd")
FR_MODE=("SA")
- BW_CASES=(106)
+ BW_CASES=(106 24)
for CN_CONFIG in ${EPC_CONFIGS[@]}
do
for TMODE in ${TRANS_MODES[@]}
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index 8be4a47bfa..b5abb5ff45 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -1401,8 +1401,11 @@ function start_rf_sim_nr_ue {
elif [ $LOC_RA_SA_TEST -eq 1 ] #RA test => use --do-ra option
then
echo "echo \"./nr-uesoftmodem --rfsim --do-ra --log_config.global_log_options level,nocolor,time --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/\" > ./my-nr-softmodem-run.sh " >> $1
- else #SA test => use --sa option
+ elif [ $LOC_RA_SA_TEST -eq 2 ] #SA test 106PRB => use --sa option
+ then
echo "echo \"./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --log_config.global_log_options level,nocolor,time\" > ./my-nr-softmodem-run.sh " >> $1
+ else # -eq 3 SA test 24PRB
+ echo "echo \"./nr-uesoftmodem -r 24 -s 24 --numerology 1 --band 78 -C 3604320000 --rfsim --sa --log_config.global_log_options level,nocolor,time\" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
@@ -2270,7 +2273,7 @@ function run_test_on_vm {
mkdir --parents $ARCHIVES_LOC
echo "############################################################"
- echo "SA TEST"
+ echo "SA TEST 106PRB"
echo "############################################################"
#SA test, attention : has a different config file from the rest of the test
CN_CONFIG="noS1"
@@ -2305,7 +2308,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : Starting the NR-UE"
echo "############################################################"
CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_sa_test.log
- #last argument = 2 is to enable --sa for SA test
+ #last argument = 2 is to enable --sa for SA test for 106PRB
start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 2
if [ $NR_UE_SYNC -eq 0 ]
then
@@ -2340,9 +2343,11 @@ function run_test_on_vm {
echo "SA test NOT OK"
echo "try_cnt = " $try_cnt
try_cnt=$((try_cnt+1))
+ SA_106PRB_STATUS = -1
else
echo "SA test OK"
try_cnt=$((try_cnt+10))
+ SA_106PRB_STATUS = 0
fi
done
########### end SA test
@@ -2350,6 +2355,92 @@ function run_test_on_vm {
sleep 30
+ echo "############################################################"
+ echo "SA TEST 24PRB"
+ echo "############################################################"
+ #SA test, attention : has a different config file from the rest of the test
+ CN_CONFIG="noS1"
+ CONF_FILE=gnb.sa.band78.fr1.24PRB.usrpb210.conf
+ S1_NOS1_CFG=0
+ PRB=24
+ FREQUENCY=3600
+
+ if [ ! -d $ARCHIVES_LOC ]
+ then
+ mkdir --parents $ARCHIVES_LOC
+ fi
+
+ local try_cnt=0
+
+ ######### start of SA TEST loop
+ while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
+ do
+
+ SYNC_STATUS=0
+ SA_STATUS=0
+ rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*sa_test.log
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the gNB"
+ echo "############################################################"
+ CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_sa_test.log
+ #last argument = 2 is to enable --sa for SA test
+ start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 2
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the NR-UE"
+ echo "############################################################"
+ CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_sa_test.log
+ #last argument = 3 is to enable --sa for SA test for 24PRB
+ start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 3
+ if [ $NR_UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ gNB and NR-UE not syncing"
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+ SYNC_STATUS=-1
+ try_cnt=$((try_cnt+1))
+ continue
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators"
+ echo "############################################################"
+ sleep 20
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+
+ #check SA markers in gNB and NR UE log files
+ echo "############################################################"
+ echo "${CN_CONFIG} : Checking SA on gNB / NR-UE"
+ echo "############################################################"
+
+ # Proper check to be done when SA test is working!
+ check_sa_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
+ if [ $SA_STATUS -ne 0 ]
+ then
+ echo "SA test NOT OK"
+ echo "try_cnt = " $try_cnt
+ try_cnt=$((try_cnt+1))
+ SA_24PRB_STATUS = -1
+ else
+ echo "SA test OK"
+ try_cnt=$((try_cnt+10))
+ SA_24PRB_STATUS = 0
+ fi
+ done
+ ########### end SA test
+
+ sleep 30
+
+
+
+
+
echo "############################################################"
echo "RA TEST FR2"
@@ -2661,7 +2752,8 @@ function run_test_on_vm {
echo "Checking run status"
echo "############################################################"
- if [ $SA_STATUS -ne 0 ]; then NR_STATUS=-1; fi
+ if [ $SA_106PRB_STATUS -ne 0 ]; then NR_STATUS=-1; fi
+ if [ $SA_24PRB_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $RA_FR2_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $RA_FR1_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi
diff --git a/ci-scripts/stats_monitor_conf.yaml b/ci-scripts/stats_monitor_conf.yaml
index 8760c067fc..9a2ececd18 100644
--- a/ci-scripts/stats_monitor_conf.yaml
+++ b/ci-scripts/stats_monitor_conf.yaml
@@ -20,8 +20,7 @@ gnb :
feptx_prec:
feptx_ofdm:
feptx_total:
- L1 Tx processing thread 0:
- L1 Tx processing thread 1:
+ L1 Tx processing:
DLSCH encoding:
L1 Rx processing:
PUSCH inner-receiver:
@@ -40,12 +39,11 @@ gnb :
rt.feptx_ofdm:
rt.feptx_total:
page3:
- rt.L1 Tx processing thread 0:
- rt.L1 Tx processing thread 1:
+ rt.L1 Tx processing:
rt.DLSCH encoding:
rt.L1 Rx processing:
page4:
rt.PUSCH inner-receiver:
rt.PUSCH decoding:
rt.DL & UL scheduling timing stats:
- rt.UL Indication:
\ No newline at end of file
+ rt.UL Indication:
diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml
index fc24a3d67c..05b20afed3 100644
--- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml
+++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml
@@ -116,6 +116,8 @@
UndeployGenObject
Undeploy all OAI 5G stack
yaml_files/5g_f1_rfsimulator
+ 5,0,0,0
+ 5,0,0,0
diff --git a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml
index 28269b2d03..61a2af9e54 100644
--- a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml
+++ b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml
@@ -111,6 +111,8 @@
UndeployGenObject
Undeploy all OAI 5G stack
yaml_files/5g_fdd_rfsimulator
+ 5,0,0,0
+ 5,0,0,0
diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml
index 7485b1f8ba..bab7f9637a 100644
--- a/ci-scripts/xml_files/container_5g_rfsim.xml
+++ b/ci-scripts/xml_files/container_5g_rfsim.xml
@@ -109,6 +109,8 @@
UndeployGenObject
Undeploy all OAI 5G stack
yaml_files/5g_rfsimulator
+ 5,0,0,0
+ 5,0,0,0
diff --git a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml
index 23cc6d25b8..f756083ea6 100644
--- a/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml
+++ b/ci-scripts/xml_files/fr1_sa_quectel_162prb.xml
@@ -96,8 +96,8 @@
Iperf
- iperf (DL/140Mbps/UDP)(60 sec)(single-ue profile)
- -u -b 140M -t 60
+ iperf (DL/200Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 200M -t 60
DL
nrmodule2_quectel
50
diff --git a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml
index 3e497ede13..0ab8bf6b08 100644
--- a/ci-scripts/xml_files/fr1_sa_quectel_stages.xml
+++ b/ci-scripts/xml_files/fr1_sa_quectel_stages.xml
@@ -42,6 +42,8 @@
000001
071004
000001
+ 071005
+ 000001
011002
081000
@@ -148,7 +150,16 @@
90
single-ue
-
+
+ Iperf
+ iperf (DL/130Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 130M -t 30
+ DL
+ nrmodule2_quectel
+ 50
+ 50
+ single-ue
+
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 82022da78f..ffc2e26dc5 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -21,8 +21,10 @@
# Author: laurent THOMAS, Lionel GAUTHIER
-cmake_minimum_required (VERSION 3.0)
+cmake_minimum_required (VERSION 2.8)
+project (OpenAirInterface LANGUAGES C CXX)
+include("macros.cmake")
# System packages that are required
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
@@ -48,6 +50,7 @@ include_directories(${CRYPTO_INCLUDE_DIRS})
#uhd 4.0 and iris installs by default in /usr/local
include_directories("/usr/local/include/")
#use native cmake method as this package is not in pkg-config
+add_list2_option(RF_BOARD "None" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU" "EXMIMO")
if (${RF_BOARD} STREQUAL "OAI_USRP")
find_package(Boost REQUIRED)
include_directories(${LIBBOOST_INCLUDE_DIR})
@@ -184,106 +187,6 @@ else (CUDA_FOUND)
message ("No CUDA tool installed")
endif ()
-
-###########################################
-# macros to define options as there is numerous options in oai
-################################################
-macro(add_option name val helpstr)
- if(DEFINED ${name})
- set(value ${${name}})
- else(DEFINED ${name})
- set(value ${val})
- endif()
- set(${name} ${value} CACHE STRING "${helpstr}")
- add_definitions("-D${name}=${value}")
-endmacro(add_option)
-
-macro(add_boolean_option name val helpstr)
- if(DEFINED ${name})
- set(value ${${name}})
- else(DEFINED ${name})
- set(value ${val})
- endif()
- set(${name} ${value} CACHE STRING "${helpstr}")
- set_property(CACHE ${name} PROPERTY TYPE BOOL)
- if (${value})
- add_definitions("-D${name}")
- endif (${value})
-endmacro(add_boolean_option)
-
-macro(add_integer_option name val helpstr)
- if(DEFINED ${name})
- set(value ${${name}})
- else(DEFINED ${name})
- set(value ${val})
- endif()
- set(${name} ${value} CACHE STRING "${helpstr}")
- add_definitions("-D${name}=${value}")
-endmacro(add_integer_option)
-
-macro(add_list1_option name val helpstr)
- if(DEFINED ${name})
- set(value ${${name}})
- else(DEFINED ${name})
- set(value ${val})
- endif()
- set(${name} ${value} CACHE STRING "${helpstr}")
- set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
- if(NOT "${value}" STREQUAL "False")
- add_definitions("-D${name}=${value}")
- endif()
-endmacro(add_list1_option)
-
-macro(add_list2_option name val helpstr)
- if(DEFINED ${name})
- set(value ${${name}})
- else(DEFINED ${name})
- set(value ${val})
- endif()
- set(${name} ${value} CACHE STRING "${helpstr}")
- set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
- if(NOT "${value}" STREQUAL "False")
- add_definitions("-D${value}=1")
- endif()
-endmacro(add_list2_option)
-
-macro(add_list_string_option name val helpstr)
- if(DEFINED ${name})
- set(value ${${name}})
- else(DEFINED ${name})
- set(value ${val})
- endif()
- set(${name} ${value} CACHE STRING "${helpstr}")
- set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
- if(NOT "${value}" STREQUAL "False")
- add_definitions("-D${name}=\"${value}\"")
- endif()
-endmacro(add_list_string_option)
-
-# this function should produce the same value as the macro MAKE_VERSION defined in the C code (file types.h)
-function(make_version VERSION_VALUE)
- math(EXPR RESULT "0")
- foreach (ARG ${ARGN})
- math(EXPR RESULT "${RESULT} * 16 + ${ARG}")
- endforeach()
- set(${VERSION_VALUE} "${RESULT}" PARENT_SCOPE)
-endfunction()
-
-macro(compile_asn1 asn1Source asn1cCmd ResultFlag)
- # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
- execute_process(COMMAND ${asn1cCmd} ${asn1Source} RESULT_VARIABLE ret)
-
- if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
- endif (NOT ${ret} STREQUAL 0)
-
- add_custom_target (
- ${ResultFlag} ALL
- ${asn1cCmd} ${asn1Source}
- DEPENDS ${asn1Source}
- )
-endmacro(compile_asn1)
-
####################################################
# compilation flags
#############################################
@@ -341,10 +244,10 @@ set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11")
-
+add_boolean_option(SANITIZE_ADDRESS False "enable the address sanitizer (ASan)")
if (SANITIZE_ADDRESS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fno-common")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libasan -fno-common")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
endif ()
add_definitions("-DASN_DISABLE_OER_SUPPORT")
@@ -786,23 +689,14 @@ add_library(F1AP ${F1AP_C_FILES} )
add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
-add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU")
-
-add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
#NOKIA config enhancement
-set (CONFIG_ROOTDIR
- ${OPENAIR_DIR}/common/config
- )
-set (CONFIG_SOURCES
+set (CONFIG_ROOTDIR ${OPENAIR_DIR}/common/config)
+add_library(CONFIG_LIB
${CONFIG_ROOTDIR}/config_load_configmodule.c
${CONFIG_ROOTDIR}/config_userapi.c
${CONFIG_ROOTDIR}/config_cmdline.c
- )
-set (CONFIG_LIBCONFIG_SOURCES
- ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c
- )
-add_library(CONFIG_LIB ${CONFIG_SOURCES})
-add_library(params_libconfig MODULE ${CONFIG_LIBCONFIG_SOURCES} )
+)
+add_library(params_libconfig MODULE ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c)
target_link_libraries(params_libconfig config)
# shared library loader
set (SHLIB_LOADER_SOURCES
@@ -1261,15 +1155,6 @@ set(FSPT_MSG_LIB FSPT_MSG)
message("fspt c dir is : ${FSPT_C_DIR}")
include_directories (${FSPT_C_DIR})
-# add_library(ASYNC_IF
-# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
-# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
-# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
-# ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
-# )
-# set(ASYNC_IF_LIB ASYNC_IF)
-# include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
-
set(PROTOBUF_LIB "protobuf-c")
#set(PROTOBUF_LIB "protobuf") #for Cpp
@@ -1280,55 +1165,19 @@ add_library(HASHTABLE
)
include_directories(${OPENAIR_DIR}/common/utils/hashtable)
-set(UTIL_SRC
- # ${OPENAIR2_DIR}/UTIL/CLI/cli.c
- # ${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c
- # ${OPENAIR2_DIR}/UTIL/CLI/cli_server.c
- ${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
+add_library(UTIL
${OPENAIR2_DIR}/UTIL/LISTS/list.c
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
${OPENAIR_DIR}/common/utils/LOG/log.c
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.c
${OPENAIR2_DIR}/UTIL/MATH/oml.c
- # ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c
- # ${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c
- # ${OPENAIR2_DIR}/UTIL/OMG/common.c
- # ${OPENAIR2_DIR}/UTIL/OMG/grid.c
- # ${OPENAIR2_DIR}/UTIL/OMG/job.c
- # ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c
- # ${OPENAIR2_DIR}/UTIL/OMG/omg.c
- # ${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c
- # ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c
- # ${OPENAIR2_DIR}/UTIL/OMG/rwp.c
- # ${OPENAIR2_DIR}/UTIL/OMG/static.c
- # ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c
- # ${OPENAIR2_DIR}/UTIL/OMG/trace.c
- # ${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c
${OPENAIR2_DIR}/UTIL/OPT/probe.c
- # ${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c
- # ${OPENAIR2_DIR}/UTIL/OTG/otg.c
- # ${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c
- # ${OPENAIR2_DIR}/UTIL/OTG/otg_models.c
- # ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c
- # ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c
- )
-add_library(UTIL ${UTIL_SRC})
-add_dependencies(UTIL rrc_flag)
-
-#set(OMG_SUMO_SRC
-# ${OPENAIR2_DIR}/UTIL/OMG/client_traci_OMG.c
-# ${OPENAIR2_DIR}/UTIL/OMG/id_manager.c
-# ${OPENAIR2_DIR}/UTIL/OMG/sumo.c
-# ${OPENAIR2_DIR}/UTIL/OMG/socket_traci_OMG.c
-# ${OPENAIR2_DIR}/UTIL/OMG/storage_traci_OMG.c
-# )
-#add_library(OMG_SUMO ${OMG_SUMO_SRC})
+ ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
+ ${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/backtrace.c
+ ${OPENAIR_DIR}/common/utils/time_meas.c
+)
set(SECU_OSA_SRC
${OPENAIR2_DIR}/UTIL/OSA/osa_key_deriver.c
@@ -1591,7 +1440,6 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c
- ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
${OPENAIR1_DIR}/PHY/TOOLS/lut.c
)
@@ -1728,7 +1576,6 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c
- ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
${OPENAIR1_DIR}/PHY/TOOLS/lut.c
${PHY_POLARSRC}
${PHY_SMALLBLOCKSRC}
@@ -1782,7 +1629,6 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c
- ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
${OPENAIR1_DIR}/PHY/TOOLS/lut.c
${OPENAIR1_DIR}/PHY/INIT/nr_init_ue.c
# ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c
@@ -2010,6 +1856,7 @@ set(NR_L2_SRC_UE
${NR_SDAP_SRC}
${NR_UE_RRC_DIR}/L2_interface_ue.c
${NR_UE_RRC_DIR}/main_ue.c
+ ${NR_RRC_DIR}/nr_rrc_config.c
${NR_UE_RRC_DIR}/rrc_UE.c
${NR_UE_RRC_DIR}/rrc_nsa.c
)
@@ -2701,7 +2548,7 @@ add_library(minimal_lib
${OPENAIR_DIR}/common/utils/minimal_stub.c
${T_SOURCE}
)
-target_link_libraries(minimal_lib pthread dl ${T_LIB} ${CONFIG_LIB})
+target_link_libraries(minimal_lib pthread dl ${T_LIB} CONFIG_LIB)
add_executable(nfapi_test
${OPENAIR_DIR}/openair2/NR_PHY_INTERFACE/nfapi_5g_test.c
@@ -2730,7 +2577,6 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/ru_control.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
@@ -2745,14 +2591,11 @@ add_executable(lte-softmodem
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${PHY_INTERFACE_DIR}/queue_t.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
@@ -2765,14 +2608,13 @@ target_link_libraries (lte-softmodem
-Wl,--end-group z dl)
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
-target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
+target_link_libraries (lte-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem ${T_LIB})
add_executable(ocp-enb
${OPENAIR_DIR}/executables/main-ocp.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/executables/main-fs6.c
${OPENAIR_DIR}/executables/transport_split.c
@@ -2788,14 +2630,11 @@ add_executable(ocp-enb
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${PHY_INTERFACE_DIR}/queue_t.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_libconfig rfsimulator)
@@ -2807,7 +2646,7 @@ target_link_libraries (ocp-enb
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB}
-Wl,--end-group z dl)
-target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
+target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
add_executable(oairu
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
@@ -2816,23 +2655,18 @@ add_executable(oairu
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/main_ru.c
${T_SOURCE}
- ${OPENAIR_DIR}/common/utils/LOG/log.c
- ${CONFIG_SOURCES}
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${SHLIB_LOADER_SOURCES}
)
target_link_libraries (oairu
-Wl,--start-group
SCHED_RU_LIB
- PHY_COMMON PHY_RU
+ PHY_COMMON PHY_RU UTIL
-Wl,--end-group z dl)
-target_link_libraries (oairu pthread m ${CONFIG_LIB} rt ${CMAKE_DL_LIBS} ${T_LIB})
+target_link_libraries (oairu pthread m CONFIG_LIB rt ${CMAKE_DL_LIBS} ${T_LIB})
# lte-uesoftmodem is UE implementation
@@ -2851,13 +2685,10 @@ add_executable(lte-uesoftmodem
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
@@ -2875,7 +2706,7 @@ target_link_libraries (lte-uesoftmodem
-Wl,--end-group z dl)
target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES})
-target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
+target_link_libraries (lte-uesoftmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-uesoftmodem ${T_LIB})
@@ -2888,7 +2719,6 @@ add_executable(nr-softmodem
${s1ap_h}
# ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_DIR}/executables/nr-gnb.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/nr-ru.c
${OPENAIR_DIR}/executables/nr-softmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c
@@ -2898,15 +2728,12 @@ add_executable(nr-softmodem
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue_t.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
)
@@ -2920,52 +2747,12 @@ target_link_libraries (nr-softmodem
-Wl,--end-group z dl)
target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES})
-target_link_libraries (nr-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
+target_link_libraries (nr-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (nr-softmodem ${T_LIB})
add_dependencies( nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
-add_executable(ocp-gnb
- ${rrc_h}
- ${nr_rrc_h}
- ${s1ap_h}
-# ${OPENAIR_BIN_DIR}/messages_xml.h
- ${OPENAIR_DIR}/executables/ocp-gnb.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
- ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
- ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
- ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
- ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
- ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
- ${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
- ${PHY_INTERFACE_DIR}/queue_t.c
- ${XFORMS_SOURCE_NR}
- ${T_SOURCE}
- ${CONFIG_SOURCES}
- ${SHLIB_LOADER_SOURCES}
- ${XFORMSINTERFACE_SOURCE}
- )
-
-target_link_libraries (ocp-gnb
- -Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
- ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
- NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
- X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
- -Wl,--end-group z dl)
-
-target_link_libraries (ocp-gnb ${LIBXML2_LIBRARIES} )
-target_link_libraries (ocp-gnb pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
-target_link_libraries (ocp-gnb ${LIB_LMS_LIBRARIES})
-target_link_libraries (ocp-gnb ${T_LIB})
-add_dependencies(ocp-gnb ldpc_orig ldpc_optim ldpc_optim8seg ldpc params_libconfig rfsimulator oai_usrpdevif rfsimulator nrscope)
-
-
# nr-uesoftmodem is UE implementation
#######################################
@@ -2973,7 +2760,6 @@ add_executable(nr-uesoftmodem
${rrc_h}
${s1ap_h}
# ${OPENAIR_BIN_DIR}/messages_xml.h
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/nr-uesoftmodem.c
${OPENAIR_DIR}/executables/nr-ue.c
${OPENAIR_DIR}/executables/softmodem-common.c
@@ -2985,13 +2771,9 @@ add_executable(nr-uesoftmodem
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
- ${UTIL_SRC}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
@@ -3006,7 +2788,7 @@ target_link_libraries (nr-uesoftmodem
-Wl,--end-group z dl)
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
-target_link_libraries (nr-uesoftmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
+target_link_libraries (nr-uesoftmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (nr-uesoftmodem ${T_LIB})
@@ -3014,7 +2796,6 @@ add_dependencies( nr-uesoftmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
if (CUDA_FOUND)
add_dependencies( nr-uesoftmodem ldpc_cuda)
add_dependencies( nr-softmodem ldpc_cuda)
- add_dependencies( ocp-gnb ldpc_cuda)
endif (CUDA_FOUND)
###################################"
# Addexecutables for tests
@@ -3028,30 +2809,25 @@ endif (CUDA_FOUND)
add_executable(dlsim_tm4
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c
- ${OPENAIR_DIR}/common/utils/system.c
${T_SOURCE}
)
target_link_libraries (dlsim_tm4
-Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB PHY LFDS ITTI -Wl,--end-group
- pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB}
+ pthread m rt CONFIG_LIB ${ATLAS_LIBRARIES} ${T_LIB}
)
add_executable(rftest
${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_test.c
${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_scope.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
-target_link_libraries(rftest minimal_lib PHY_NR_COMMON pthread dl m forms ${T_LIB} )
+target_link_libraries(rftest minimal_lib CONFIG_LIB PHY_NR_COMMON UTIL pthread dl m forms ${T_LIB} )
add_executable(polartest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c
- ${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/system.c
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3062,9 +2838,7 @@ target_link_libraries(polartest
add_executable(smallblocktest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/smallblocktest.c
- ${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/system.c
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3094,11 +2868,7 @@ target_link_libraries(ldpctest
add_executable(nr_dlschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3109,11 +2879,7 @@ target_link_libraries(nr_dlschsim
add_executable(nr_pbchsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3125,12 +2891,7 @@ target_link_libraries(nr_pbchsim
#PUCCH ---> Prashanth
add_executable(nr_pucchsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c
- ${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/system.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3141,17 +2902,13 @@ target_link_libraries(nr_pucchsim
add_executable(nr_dlsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${PHY_INTERFACE_DIR}/queue_t.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3163,17 +2920,13 @@ target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
add_executable(nr_prachsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${PHY_INTERFACE_DIR}/queue_t.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES})
target_link_libraries(nr_prachsim
@@ -3182,12 +2935,8 @@ target_link_libraries(nr_prachsim
add_executable(nr_ulschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue_t.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3198,9 +2947,6 @@ target_link_libraries(nr_ulschsim
add_executable(nr_ulsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
@@ -3208,7 +2954,6 @@ add_executable(nr_ulsim
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${PHY_INTERFACE_DIR}/queue_t.c
- ${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
@@ -3222,58 +2967,21 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
add_executable(${myExe}
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${OPENAIR_DIR}/common/utils/backtrace.c
- ${OPENAIR_DIR}/common/utils/system.c
- ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${XFORMS_SOURCE}
${T_SOURCE}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
${NFAPI_USER_DIR}/nfapi.c
)
target_link_libraries (${myExe}
-Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ITTI LFDS7 -Wl,--end-group
- pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
+ pthread m rt CONFIG_LIB ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
endforeach(myExe)
-add_executable(test_epc_generate_scenario
- ${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.h
- ${OPENAIR2_DIR}/ENB_APP/enb_config.h
- ${OPENAIR2_DIR}/COMMON/commonDef.h
- ${OPENAIR2_DIR}/COMMON/messages_def.h
- ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
- )
-target_link_libraries (test_epc_generate_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB PHY LFDS ITTI L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
- )
-
-add_executable(test_epc_play_scenario
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_decode.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_display.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_fsm.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_parse.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_sctp.c
- ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
- ${OPENAIR2_DIR}/COMMON/commonDef.h
- ${OPENAIR2_DIR}/COMMON/messages_def.h
- )
-target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
-target_link_libraries (test_epc_play_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
- )
-
-
#unitary tests for Core NEtwork pieces
#################################
foreach(myExe s1ap
@@ -3290,7 +2998,7 @@ foreach(myExe s1ap
${OPENAIR3_DIR}/TEST/test_${myExe}.c
)
target_link_libraries (test_${myExe}
- -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
+ -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} CONFIG_LIB
)
endforeach(myExe)
@@ -3409,16 +3117,12 @@ add_executable(nr-ittisim
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
- ${OPENAIR_DIR}/common/utils/utils.c
- ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
- ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
- ${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
@@ -3432,7 +3136,7 @@ target_link_libraries (nr-ittisim
-Wl,--end-group z dl)
target_link_libraries (nr-ittisim ${LIBXML2_LIBRARIES})
-target_link_libraries (nr-ittisim pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
+target_link_libraries (nr-ittisim pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES})
target_link_libraries (nr-ittisim ${LIB_LMS_LIBRARIES})
target_link_libraries (nr-ittisim ${T_LIB})
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index 6450b64298..7497fb419c 100755
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1093,17 +1093,18 @@
(Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset),
(Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27),
(Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16),
- (Test11: HARQ test 25% TP (4 rounds),
- (Test12: HARQ test 33% TP (3 rounds),
- (Test13: HARQ test 50% TP (2 rounds),
- (Test14: 3 PTRS, 8 Interpolated Symbols),
- (Test15: 6 PTRS, 5 Interpolated Symbols),
- (Test16: 11 PTRS, 0 Interpolated Symbols),
- (Test17: Mapping type A, 2 DMRS Symbols),
- (Test18: Mapping type A, 3 DMRS Symbols),
- (Test19: Mapping type B, 4 DMRS Symbols),
- (Test20: 4x4 MIMO, 1 Layer),
- (Test21: 4x4 MIMO, 2 Layers)
+ (Test11: 106 MCS-TABLE 256 QAM MCS Index 26),
+ (Test12: HARQ test 25% TP (4 rounds),
+ (Test13: HARQ test 33% TP (3 rounds),
+ (Test14: HARQ test 50% TP (2 rounds),
+ (Test15: 3 PTRS, 8 Interpolated Symbols),
+ (Test16: 6 PTRS, 5 Interpolated Symbols),
+ (Test17: 11 PTRS, 0 Interpolated Symbols),
+ (Test18: Mapping type A, 2 DMRS Symbols),
+ (Test19: Mapping type A, 3 DMRS Symbols),
+ (Test20: Mapping type B, 4 DMRS Symbols),
+ (Test21: 4x4 MIMO, 1 Layer),
+ (Test22: 4x4 MIMO, 2 Layers)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1118,8 +1119,9 @@
-n100 -R217 -b100 -s5
-n100 -R217 -a80 -s5
-n100 -R217 -a110 -s5 -b100
- -n100 -e27 -s30
- -n100 -e16 -s10
+ -n100 -e27 -s30
+ -n100 -e16 -s10
+ -n100 -q1 -e27 -s30
-n100 -s1 -t25
-n100 -s1 -t33
-n100 -s1 -t50
@@ -1131,7 +1133,7 @@
-n100 -s2 -U 2 1 3
-n10 -s20 -U 3 0 0 2 -gR -x1 -y4 -z4
-n10 -s20 -U 3 0 0 2 -gR -x2 -y4 -z4
- nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19 nr_dlsim.test20 nr_dlsim.test21
+ nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19 nr_dlsim.test20 nr_dlsim.test21 nr_dlsim.test22
PDSCH test OK
segmentation fault|assertion|exiting|fatal
3
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index c2b6305831..930f2a7f77 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -39,34 +39,24 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
XFORMS="True"
SKIP_SHARED_LIB_FLAG="False"
-UE_EXPANSION="False"
PRINT_STATS="False"
-VCD_TIMING="False"
DEADLINE_SCHEDULER_FLAG_USER=""
-CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False
REL="Rel15"
HW="None"
TP="Ethernet"
EPC=0
VERBOSE_CI=0
VERBOSE_COMPILE=0
-CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
TEST_CASE_GROUP=""
+BUILD_DIR=ran_build
BUILD_DOXYGEN=0
BUILD_COVERITY_SCAN=0
-T_TRACER="True"
DISABLE_HARDWARE_DEPENDENCY="False"
CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_CMD="$CMAKE"
-UE_AUTOTEST_TRACE="False"
-UE_DEBUG_TRACE="False"
-UE_TIMING_TRACE="False"
-USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
NR="False"
-ITTI_SIM="False"
-SANITIZE_ADDRESS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope"
RU=0
trap handle_ctrl_c INT
@@ -82,6 +72,8 @@ Options
Erase all files made by previous compilations, installations
--clean-kernel
Erase previously installed features in kernel: iptables, drivers, ...
+-d | --build-dir
+ Sets build directory (will be /cmake_targets//build)
-I | --install-external-packages
Installs required packages such as LibXML, asn1.1 compiler, freediameter, ...
This option will require root password
@@ -201,6 +193,9 @@ function main() {
clean_kernel
echo_info "Erased iptables config and removed modules from kernel"
shift;;
+ -d | --build-dir)
+ BUILD_DIR=$2
+ shift;;
-I | --install-external-packages)
INSTALL_EXTERNAL=1
echo_info "Will install external packages"
@@ -275,7 +270,7 @@ function main() {
echo_info "Will compile NR UE"
shift;;
--mu)
- UE_EXPANSION="True"
+ CMAKE_CMD="$CMAKE_CMD -DUE_EXPANSION=True -DPRE_SCD_THREAD=True"
echo_info "Will compile with UE_EXPANSION"
shift;;
--UE-conf-nvram)
@@ -299,7 +294,9 @@ function main() {
*)
echo_fatal "Unknown HW type $HW: exit..."
esac
- echo_info "Setting hardware to: $HW"
+ echo_info "Setting hardware to: $HW"
+ #CMAKE_CMD="$CMAKE_CMD -DRF_BOARD=\"${HW}\""
+ CMAKE_CMD="$CMAKE_CMD -DRF_BOARD=${HW}"
shift 2;;
-t | --transport)
TP=$2
@@ -323,7 +320,7 @@ function main() {
shift 2;;
-V | --vcd)
echo_info "Setting gtk-wave output"
- VCD_TIMING=1
+ CMAKE_CMD="$CMAKE_CMD -DENABLE_VCD_FIFO=True"
EXE_ARGUMENTS="$EXE_ARGUMENTS -V"
shift;;
-x | --xforms)
@@ -348,8 +345,8 @@ function main() {
echo_info "Will compile with verbose instructions"
shift;;
--cflags_processor)
- CFLAGS_PROCESSOR_USER=$2
- echo_info "Setting CPU FLAGS from USER to: $CFLAGS_PROCESSOR_USER"
+ CMAKE_CMD="$CMAKE_CMD -DCFLAGS_PROCESSOR_USER=\"$2\""
+ echo_info "Setting CPU FLAGS from USER to: $2"
shift 2;;
--build-doxygen)
BUILD_DOXYGEN=1
@@ -361,22 +358,26 @@ function main() {
shift;;
--disable-deadline)
DEADLINE_SCHEDULER_FLAG_USER="False"
+ CMAKE_CMD="$CMAKE_CMD -DDEADLINE_SCHEDULER=False"
echo_info "Disabling the usage of deadline scheduler"
shift 1;;
--enable-deadline)
DEADLINE_SCHEDULER_FLAG_USER="True"
+ CMAKE_CMD="$CMAKE_CMD -DDEADLINE_SCHEDULER=True"
echo_info "Enabling the usage of deadline scheduler"
shift 1;;
--enable-cpu-affinity)
CPU_AFFINITY_FLAG_USER="True"
+ CMAKE_CMD="$CMAKE_CMD -DCPU_AFFINITY=True"
echo_info "Enabling CPU Affinity (only valid when not using deadline scheduler)"
shift 1;;
--disable-cpu-affinity)
CPU_AFFINITY_FLAG_USER="False"
+ CMAKE_CMD="$CMAKE_CMD -DCPU_AFFINITY=False"
echo_info "Disabling CPU Affinity (only valid when not using deadline scheduler)"
shift 1;;
--disable-T-Tracer)
- T_TRACER="False"
+ CMAKE_CMD="$CMAKE_CMD -DT_TRACER=False"
echo_info "Disabling the T tracer"
shift 1;;
--disable-hardware-dependency)
@@ -384,15 +385,15 @@ function main() {
DISABLE_HARDWARE_DEPENDENCY="True"
shift 1;;
--ue-autotest-trace)
- UE_AUTOTEST_TRACE="True"
+ CMAKE_CMD="$CMAKE_CMD -DUE_AUTOTEST_TRACE=True"
echo_info "Enabling autotest specific trace for UE"
shift 1;;
--ue-trace)
- UE_DEBUG_TRACE="True"
+ CMAKE_CMD="$CMAKE_CMD -DUE_DEBUG_TRACE=False"
echo_info "Enabling UE trace for debug"
shift 1;;
--ue-timing)
- UE_TIMING_TRACE="True"
+ CMAKE_CMD="$CMAKE_CMD -DUE_TIMING_TRACE=True"
echo_info "Enabling UE timing trace"
shift 1;;
--uhd-images-dir)
@@ -423,24 +424,20 @@ function main() {
fi
fi
shift 2;;
- --usrp-recplay)
- USRP_REC_PLAY="True"
- echo_info "Enabling USRP record playback mode"
- shift 1;;
-k | --skip-shared-libraries)
SKIP_SHARED_LIB_FLAG="True"
echo_info "Skipping build of shared libraries, rfsimulator and transport protocol libraries"
shift;;
- --ninja)
- CMAKE_CMD="$CMAKE_CMD -GNinja"
- MAKE_CMD=ninja
- shift;;
- --sanitize-address | -fsanitize=address)
- SANITIZE_ADDRESS=True
- shift;;
- --ittiSIM)
+ --ninja)
+ CMAKE_CMD="$CMAKE_CMD -GNinja"
+ MAKE_CMD=ninja
+ shift;;
+ --sanitize-address | -fsanitize=address)
+ CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True"
+ shift;;
+ --ittiSIM)
ittiSIM=1
- ITTI_SIM="True"
+ CMAKE_CMD="$CMAKE_CMD -DITTI_SIM=True"
echo_info "Will compile itti simulator"
shift;;
-h | --help)
@@ -466,9 +463,6 @@ function main() {
fi
fi
- CMAKE_CMD="$CMAKE_CMD .."
- echo_info "CMAKE_CMD=$CMAKE_CMD"
-
########################################################
# Check validity of HW and TP parameters for eNB / gNB #
########################################################
@@ -508,6 +502,7 @@ function main() {
#Disable CPU Affinity for deadline scheduler
if [ "$DEADLINE_SCHEDULER_FLAG_USER" = "True" ] ; then
CPU_AFFINITY_FLAG_USER="False"
+ CMAKE_CMD="$CMAKE_CMD -DCPU_AFFINITY=False"
fi
echo_info "Flags for Deadline scheduler: $DEADLINE_SCHEDULER_FLAG_USER"
@@ -585,46 +580,13 @@ function main() {
echo_info "3. building the compilation directives ..."
DIR=$OPENAIR_DIR/cmake_targets
- if [ "$T_TRACER" = "False" ] ; then
- build_dir=ran_build_noLOG
- else
- build_dir=ran_build
- fi
- [ "$CLEAN" = "1" ] && rm -rf $DIR/$build_dir/build
- mkdir -p $DIR/$build_dir/build
+ [ "$CLEAN" = "1" ] && rm -rf $DIR/$BUILD_DIR/build
+ mkdir -p $DIR/$BUILD_DIR/build
-# configuration module libraries, one currently available, using libconfig
- config_libconfig_shlib=params_libconfig
-
- # first generate the CMakefile in the right directory
- # softmodem compilation
-
- cmake_file=$DIR/$build_dir/CMakeLists.txt
- echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file
- echo "project (OpenAirInterface)" >> $cmake_file
- echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
- echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
- echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
- # echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
- echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
- echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
- echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
- echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file
- echo "set ( PACKAGE_NAME \"${exec}\")" >> $cmake_file
- echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >> $cmake_file
- echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >> $cmake_file
- echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
- echo "set ( UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE )" >> $cmake_file
- echo "set ( UE_DEBUG_TRACE $UE_DEBUG_TRACE )" >> $cmake_file
- echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file
- echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
- echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
- echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
- echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
- echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
- cd $DIR/$build_dir/build
- eval $CMAKE_CMD
+ cd $DIR/$BUILD_DIR/build
+ echo_info "running $CMAKE_CMD"
+ eval $CMAKE_CMD ../..
execlist=""
if [ "$eNB" = "1" ] ; then
@@ -653,7 +615,7 @@ function main() {
for f in $execlist ; do
echo_info "Compiling $f..."
compilations \
- $build_dir $f \
+ $BUILD_DIR $f \
$f $dbin/$f.$REL
done
@@ -662,13 +624,16 @@ function main() {
if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
echo_info "Building shared libraries common to UE and gNB"
+
+ # configuration module libraries, one currently available, using libconfig
+ config_libconfig_shlib=params_libconfig
compilations \
- $build_dir $config_libconfig_shlib \
+ $BUILD_DIR $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
compilations \
- $build_dir coding \
+ $BUILD_DIR coding \
libcoding.so $dbin/libcoding.so
fi
@@ -681,7 +646,7 @@ function main() {
then
echo_info "Building ue_ip module"
compilations \
- $build_dir ue_ip \
+ $BUILD_DIR ue_ip \
CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko
else
echo_info "Bypassing ue_ip build"
@@ -698,7 +663,7 @@ function main() {
mkdir -p $DIR/nas_sim_tools/build
cd $DIR/nas_sim_tools/build
- eval $CMAKE_CMD
+ eval $CMAKE_CMD ..
compilations \
nas_sim_tools usim \
usim $dbin/usim
@@ -712,16 +677,16 @@ function main() {
# generate USIM data
if [ -f $dbin/conf2uedata ]; then
install_nas_tools $conf_nvram_path $gen_nvram_path "$dlog/conf2uedata.txt"
- echo_info "Copying UE specific part to $DIR/$build_dir/build"
- cp -Rvf $dbin/.ue_emm.nvram0 $DIR/$build_dir/build
- cp -Rvf $dbin/.ue.nvram0 $DIR/$build_dir/build
- cp -Rvf $dbin/.usim.nvram0 $DIR/$build_dir/build
+ echo_info "Copying UE specific part to $DIR/$BUILD_DIR/build"
+ cp -Rvf $dbin/.ue_emm.nvram0 $DIR/$BUILD_DIR/build
+ cp -Rvf $dbin/.ue.nvram0 $DIR/$BUILD_DIR/build
+ cp -Rvf $dbin/.usim.nvram0 $DIR/$BUILD_DIR/build
else
echo_warning "not generated UE NAS files: binaries not found"
fi
fi
- cd $DIR/$build_dir/build
+ cd $DIR/$BUILD_DIR/build
##################
# PHY simulators #
@@ -739,9 +704,6 @@ function main() {
compilations \
ran_build coding \
libcoding.so $dbin/libcoding.so
-# compilations \
-# lte-simulators $config_libconfig_shlib \
-# lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
fi
###################
@@ -763,14 +725,14 @@ function main() {
if [ "$HW" = "EXMIMO" ] ; then
echo_info "Compiling Express MIMO 2 board drivers"
compilations \
- $build_dir openair_rf \
+ $BUILD_DIR openair_rf \
CMakeFiles/openair_rf/openair_rf.ko $dbin/openair_rf.ko
compilations \
- $build_dir updatefw \
+ $BUILD_DIR updatefw \
updatefw $dbin/updatefw
echo_info "Compiling oarf tools. The logfile for compilation is here: $dlog/oarf.txt"
- make -C $OPENAIR_DIR/cmake_targets/$build_dir/build oarf > $dlog/oarf.txt 2>&1
- cp $OPENAIR_DIR/cmake_targets/$build_dir/build/*.oct $dbin
+ make -C $OPENAIR_DIR/cmake_targets/$BUILD_DIR/build oarf > $dlog/oarf.txt 2>&1
+ cp $OPENAIR_DIR/cmake_targets/$BUILD_DIR/build/*.oct $dbin
if [ -s $dbin/oarf_config_exmimo.oct ] ; then
echo_success "oarf tools compiled"
else
@@ -785,7 +747,7 @@ function main() {
if [ ! -z "$BUILD_OPTLIB" ] ; then
for oklib in $BUILD_OPTLIB ; do
compilations \
- $build_dir $oklib \
+ $BUILD_DIR $oklib \
lib${oklib}.so $dbin/lib${oklib}.so
done
fi
@@ -859,7 +821,7 @@ function main() {
# link liboai_device.so with the selected RF device library
if [ "$HW" == "EXMIMO" ] ; then
compilations \
- $build_dir oai_exmimodevif \
+ $BUILD_DIR oai_exmimodevif \
liboai_exmimodevif.so $dbin/liboai_exmimodevif.so.$REL
ln -sf liboai_exmimodevif.so liboai_device.so
@@ -867,7 +829,7 @@ function main() {
echo_info "liboai_device.so is linked to EXMIMO device library"
elif [ "$HW" == "OAI_USRP" ] ; then
compilations \
- $build_dir oai_usrpdevif \
+ $BUILD_DIR oai_usrpdevif \
liboai_usrpdevif.so $dbin/liboai_usrpdevif.so.$REL
ln -sf liboai_usrpdevif.so liboai_device.so
@@ -876,7 +838,7 @@ function main() {
elif [ "$HW" == "OAI_BLADERF" ] ; then
if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
- $build_dir oai_bladerfdevif \
+ $BUILD_DIR oai_bladerfdevif \
liboai_bladerfdevif.so $dbin/liboai_bladerfdevif.so.$REL
fi
@@ -886,7 +848,7 @@ function main() {
elif [ "$HW" == "OAI_LMSSDR" ] ; then
# if [ -f "/usr/include/libbladeRF.h" ] ; then
compilations \
- $build_dir oai_lmssdrdevif \
+ $BUILD_DIR oai_lmssdrdevif \
liboai_lmssdrdevif.so $dbin/liboai_lmssdrdevif.so.$REL
# fi
@@ -895,7 +857,7 @@ function main() {
echo_info "liboai_device.so is linked to LMSSDR device library"
elif [ "$HW" == "OAI_IRIS" ] ; then
compilations \
- $build_dir oai_irisdevif \
+ $BUILD_DIR oai_irisdevif \
liboai_irisdevif.so $dbin/liboai_irisdevif.so.$REL
ln -s liboai_irisdevif.so liboai_device.so
@@ -915,7 +877,7 @@ function main() {
echo_info "liboai_device.so is linked to ADRV9371_ZC706 device library for Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN"
elif [ "$HW" == "OAI_AW2SORI" ] ; then
compilations \
- $build_dir aw2sori_transpro \
+ $BUILD_DIR aw2sori_transpro \
libaw2sori_transpro.so $dbin/libaw2sori_transpro.so.$REL
ln -sf libaw2sori_transpro.so libthirdparty_transpro.so
@@ -930,12 +892,12 @@ function main() {
if [ "$SKIP_SHARED_LIB_FLAG" = "False" ]; then
echo_info "Compiling rfsimulator"
compilations \
- $build_dir rfsimulator \
+ $BUILD_DIR rfsimulator \
librfsimulator.so $dbin/librfsimulator.so.$REL
echo_info "Compiling tcp_bridge_oai"
compilations \
- $build_dir tcp_bridge_oai \
+ $BUILD_DIR tcp_bridge_oai \
libtcp_bridge_oai.so $dbin/libtcp_bridge_oai.so.$REL
fi
@@ -946,7 +908,7 @@ function main() {
rm -f $dbin/liboai_transpro.so
if [ "$TP" == "Ethernet" ]; then
compilations \
- $build_dir oai_eth_transpro \
+ $BUILD_DIR oai_eth_transpro \
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
ln -sf liboai_eth_transpro.so liboai_transpro.so
ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
@@ -954,7 +916,7 @@ function main() {
fi
if [ "$TP" == "benetel4g" ]; then
compilations \
- $build_dir benetel_4g \
+ $BUILD_DIR benetel_4g \
libbenetel_4g.so $dbin/libbenetel_4g.$REL
ln -sf libbenetel_4g.so liboai_transpro.so
ln -sf $dbin/libbenetel_4g.so.$REL $dbin/liboai_transpro.so
@@ -962,7 +924,7 @@ function main() {
fi
if [ "$TP" == "benetel5g" ]; then
compilations \
- $build_dir benetel_5g \
+ $BUILD_DIR benetel_5g \
libbenetel_5g.so $dbin/libbenetel_5g.$REL
ln -sf libbenetel_5g.so liboai_transpro.so
ln -sf $dbin/libbenetel_5g.so.$REL $dbin/liboai_transpro.so
@@ -983,7 +945,7 @@ function main() {
[ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/doxygen/build
mkdir -p $OPENAIR_DIR/cmake_targets/doxygen/build
cd $OPENAIR_DIR/cmake_targets/doxygen/build
- eval $CMAKE_CMD
+ eval $CMAKE_CMD ..
make doc
) >& $doxygen_log
fi
diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20
index 1f10ca53c7..a2f6a9709c 100755
--- a/cmake_targets/install_external_packages.ubuntu20
+++ b/cmake_targets/install_external_packages.ubuntu20
@@ -86,6 +86,7 @@ check_supported_distribution() {
"ubuntu20.04") return 0 ;;
"ubuntu20.10") return 0 ;;
"ubuntu21.04") return 0 ;;
+ "ubuntu21.10") return 0 ;;
esac
return 1
}
diff --git a/cmake_targets/macros.cmake b/cmake_targets/macros.cmake
new file mode 100644
index 0000000000..0417420af4
--- /dev/null
+++ b/cmake_targets/macros.cmake
@@ -0,0 +1,98 @@
+###########################################
+# macros to define options as there is numerous options in oai
+################################################
+macro(add_option name val helpstr)
+ if(DEFINED ${name})
+ set(value ${${name}})
+ else(DEFINED ${name})
+ set(value ${val})
+ endif()
+ set(${name} ${value} CACHE STRING "${helpstr}")
+ add_definitions("-D${name}=${value}")
+endmacro(add_option)
+
+macro(add_boolean_option name val helpstr)
+ if(DEFINED ${name})
+ set(value ${${name}})
+ else(DEFINED ${name})
+ set(value ${val})
+ endif()
+ set(${name} ${value} CACHE STRING "${helpstr}")
+ set_property(CACHE ${name} PROPERTY TYPE BOOL)
+ if (${value})
+ add_definitions("-D${name}")
+ endif (${value})
+endmacro(add_boolean_option)
+
+macro(add_integer_option name val helpstr)
+ if(DEFINED ${name})
+ set(value ${${name}})
+ else(DEFINED ${name})
+ set(value ${val})
+ endif()
+ set(${name} ${value} CACHE STRING "${helpstr}")
+ add_definitions("-D${name}=${value}")
+endmacro(add_integer_option)
+
+macro(add_list1_option name val helpstr)
+ if(DEFINED ${name})
+ set(value ${${name}})
+ else(DEFINED ${name})
+ set(value ${val})
+ endif()
+ set(${name} ${value} CACHE STRING "${helpstr}")
+ set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
+ if(NOT "${value}" STREQUAL "False")
+ add_definitions("-D${name}=${value}")
+ endif()
+endmacro(add_list1_option)
+
+macro(add_list2_option name val helpstr)
+ if(DEFINED ${name})
+ set(value ${${name}})
+ else(DEFINED ${name})
+ set(value ${val})
+ endif()
+ set(${name} ${value} CACHE STRING "${helpstr}")
+ set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
+ if(NOT "${value}" STREQUAL "False")
+ add_definitions("-D${value}=1")
+ endif()
+endmacro(add_list2_option)
+
+macro(add_list_string_option name val helpstr)
+ if(DEFINED ${name})
+ set(value ${${name}})
+ else(DEFINED ${name})
+ set(value ${val})
+ endif()
+ set(${name} ${value} CACHE STRING "${helpstr}")
+ set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
+ if(NOT "${value}" STREQUAL "False")
+ add_definitions("-D${name}=\"${value}\"")
+ endif()
+endmacro(add_list_string_option)
+
+# this function should produce the same value as the macro MAKE_VERSION defined in the C code (file types.h)
+function(make_version VERSION_VALUE)
+ math(EXPR RESULT "0")
+ foreach (ARG ${ARGN})
+ math(EXPR RESULT "${RESULT} * 16 + ${ARG}")
+ endforeach()
+ set(${VERSION_VALUE} "${RESULT}" PARENT_SCOPE)
+endfunction()
+
+macro(compile_asn1 asn1Source asn1cCmd ResultFlag)
+ # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
+ execute_process(COMMAND ${asn1cCmd} ${asn1Source} RESULT_VARIABLE ret)
+
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+
+ add_custom_target (
+ ${ResultFlag} ALL
+ ${asn1cCmd} ${asn1Source}
+ DEPENDS ${asn1Source}
+ )
+endmacro(compile_asn1)
diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c
index a65a9732e7..5b047c082d 100644
--- a/common/utils/LOG/log.c
+++ b/common/utils/LOG/log.c
@@ -411,6 +411,16 @@ int register_log_component(char *name,
return computed_compidx;
}
+static void unregister_all_log_components(void)
+{
+ log_component_t* lc = &g_log->log_component[0];
+ while (lc->name) {
+ free((char *)lc->name); // defined as const, but assigned through strdup()
+ free(lc->filelog_name);
+ lc++;
+ }
+}
+
int isLogInitDone (void)
{
if (g_log == NULL)
@@ -502,6 +512,12 @@ int logInit (void)
return 0;
}
+void logTerm(void)
+{
+ unregister_all_log_components();
+ free_and_zero(g_log);
+}
+
#include
static inline int log_header(log_component_t *c,
char *log_buffer,
diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h
index 8299c48fbb..1f19d55878 100644
--- a/common/utils/LOG/log.h
+++ b/common/utils/LOG/log.h
@@ -302,6 +302,7 @@ extern "C" {
# include "log_if.h"
/*----------------------------------------------------------------------------*/
int logInit (void);
+void logTerm (void);
int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
@@ -472,130 +473,6 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* @}*/
-static __inline__ uint64_t rdtsc(void) {
- uint32_t a, d;
- __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
- return (((uint64_t)d)<<32) | ((uint64_t)a);
-}
-
-#define DEBUG_REALTIME 1
-#if DEBUG_REALTIME
-
-extern double cpuf;
-
-static inline uint64_t checkTCPU(int timeout,
- char *file,
- int line)
-{
- static uint64_t __thread lastCPUTime=0;
- static uint64_t __thread last=0;
- uint64_t cur=rdtsc();
- struct timespec CPUt;
- clock_gettime(CLOCK_THREAD_CPUTIME_ID, &CPUt);
- uint64_t CPUTime=CPUt.tv_sec*1000*1000+CPUt.tv_nsec/1000;
- double microCycles=(double)(cpuf*1000);
- int duration=(int)((cur-last)/microCycles);
-
- if ( last!=0 && duration > timeout ) {
- //struct timespec ts;
- //clock_gettime(CLOCK_MONOTONIC, &ts);
- printf("%s:%d lte-ue delay %d (exceed %d), CPU for this period: %lld\n", file, line,
- duration, timeout, (long long)CPUTime-lastCPUTime );
- }
-
- last=cur;
- lastCPUTime=CPUTime;
- return cur;
-}
-
-static inline unsigned long long checkT(int timeout,
- char *file,
- int line)
-{
- static unsigned long long __thread last=0;
- unsigned long long cur=rdtsc();
- int microCycles=(int)(cpuf*1000);
- int duration=(int)((cur-last)/microCycles);
-
- if ( last!=0 && duration > timeout )
- printf("%s:%d lte-ue delay %d (exceed %d)\n", file, line,
- duration, timeout);
-
- last=cur;
- return cur;
-}
-
-typedef struct m {
- uint64_t iterations;
- uint64_t sum;
- uint64_t maxArray[11];
-} Meas;
-
-static inline void printMeas(char *txt,
- Meas *M,
- int period)
-{
- if (M->iterations%period == 0 ) {
- char txt2[512];
- sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%"
- PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n",
- txt,
- M->sum/M->iterations,
- M->iterations,
- M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5],
- M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
-#if T_TRACER
- LOG_W(PHY,"%s",txt2);
-#else
- printf("%s",txt2);
-#endif
- }
-}
-
-static inline int cmpint(const void *a,
- const void *b)
-{
- uint64_t *aa=(uint64_t *)a;
- uint64_t *bb=(uint64_t *)b;
- return (int)(*aa-*bb);
-}
-
-static inline void updateTimes(uint64_t start,
- Meas *M,
- int period,
- char *txt)
-{
- if (start!=0) {
- uint64_t end=rdtsc();
- long long diff=(end-start)/(cpuf*1000);
- M->maxArray[0]=diff;
- M->sum+=diff;
- M->iterations++;
- qsort(M->maxArray, 11, sizeof(uint64_t), cmpint);
- printMeas(txt,M,period);
- }
-}
-
-#define check(a) do { checkT(a,__FILE__,__LINE__); } while (0)
-#define checkcpu(a) do { checkTCPU(a,__FILE__,__LINE__); } while (0)
-#define initRefTimes(a) static __thread Meas a= {0}
-#define pickTime(a) uint64_t a=rdtsc()
-#define readTime(a) a
-#define initStaticTime(a) static __thread uint64_t a={0}
-#define pickStaticTime(a) do { a=rdtsc(); } while (0)
-
-#else
-#define check(a) do {} while (0)
-#define checkcpu(a) do {} while (0)
-#define initRefTimes(a) do {} while (0)
-#define initStaticTime(a) do {} while (0)
-#define pickTime(a) do {} while (0)
-#define readTime(a) 0
-#define pickStaticTime(a) do {} while (0)
-#define updateTimes(a,b,c,d) do {} while (0)
-#define printMeas(a,b,c) do {} while (0)
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/common/utils/load_module_shlib.c b/common/utils/load_module_shlib.c
index 2b0d339358..1c9aa8cab9 100644
--- a/common/utils/load_module_shlib.c
+++ b/common/utils/load_module_shlib.c
@@ -69,7 +69,6 @@ char *loader_format_shlibpath(char *modname, char *version)
char *tmpstr;
char *shlibpath =NULL;
char *shlibversion=NULL;
-char *cfgprefix;
paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0, NULL},
{"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0, NULL}};
@@ -81,16 +80,11 @@ int ret;
/* looks for specific path for this module in the config file */
/* specific value for a module path and version is located in a modname subsection of the loader section */
/* shared lib name is formatted as lib.so */
- cfgprefix = malloc(sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16);
- if (cfgprefix == NULL) {
- fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
- exit_fun("[LOADER] unrecoverable error");
- } else {
- sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
- int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
- if (ret <0) {
- fprintf(stderr,"[LOADER] %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
- }
+ char cfgprefix[sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16];
+ sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
+ ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
+ if (ret <0) {
+ fprintf(stderr,"[LOADER] %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
}
/* no specific path, use loader default shared lib path */
if (shlibpath == NULL) {
@@ -142,6 +136,7 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
}
shlib_path = loader_format_shlibpath(modname, version);
+ printf("shlib_path %s\n", shlib_path);
for (int i = 0; i < loader_data.numshlibs; i++) {
if (strcmp(loader_data.shlibs[i].name, modname) == 0) {
@@ -198,15 +193,17 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
}
if (farray) {
- if (!loader_data.shlibs[lib_idx].funcarray) {
- loader_data.shlibs[lib_idx].funcarray = malloc(numf*sizeof(loader_shlibfunc_t));
- if (!loader_data.shlibs[lib_idx].funcarray) {
+ loader_shlibdesc_t *shlib = &loader_data.shlibs[lib_idx];
+ if (!shlib->funcarray) {
+ shlib->funcarray = calloc(numf, sizeof(loader_shlibfunc_t));
+ if (!shlib->funcarray) {
fprintf(stderr, "[LOADER] load_module_shlib(): unable to allocate memory\n");
ret = -1;
goto load_module_shlib_exit;
}
+ shlib->len_funcarray = numf;
+ shlib->numfunc = 0;
}
- loader_data.shlibs[lib_idx].numfunc = 0;
for (int i = 0; i < numf; i++) {
farray[i].fptr = dlsym(lib_handle,farray[i].fname);
if (!farray[i].fptr) {
@@ -215,9 +212,32 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
ret = -1;
goto load_module_shlib_exit;
}
- loader_data.shlibs[lib_idx].funcarray[i].fname=strdup(farray[i].fname);
- loader_data.shlibs[lib_idx].funcarray[i].fptr = farray[i].fptr;
- loader_data.shlibs[lib_idx].numfunc++;
+ /* check whether this function has been loaded before */
+ int j = 0;
+ for (; j < shlib->numfunc; ++j) {
+ if (shlib->funcarray[j].fptr == farray[i].fptr) {
+ int rc = strcmp(shlib->funcarray[i].fname, farray[i].fname);
+ AssertFatal(rc == 0,
+ "reloading the same fptr with different fnames (%s, %s)\n",
+ shlib->funcarray[i].fname, farray[i].fname);
+ break;
+ }
+ }
+ if (j == shlib->numfunc) {
+ if (shlib->numfunc == shlib->len_funcarray) {
+ loader_shlibfunc_t *n = realloc(shlib->funcarray, shlib->numfunc * 2 * sizeof(loader_shlibfunc_t));
+ if (!n) {
+ fprintf(stderr, "[LOADER] %s(): unable to allocate memory\n", __func__);
+ ret = -1;
+ goto load_module_shlib_exit;
+ }
+ shlib->funcarray = n;
+ shlib->len_funcarray = shlib->numfunc * 2;
+ }
+ shlib->funcarray[j].fname = strdup(farray[i].fname);
+ shlib->funcarray[j].fptr = farray[i].fptr;
+ shlib->numfunc++;
+ }
} /* for int i... */
} else { /* farray ! NULL */
sprintf(afname,"%s_getfarray",modname);
@@ -248,3 +268,18 @@ void * get_shlibmodule_fptr(char *modname, char *fname)
} /* for i loop on modules */
return NULL;
}
+
+void loader_reset()
+{
+ for (int i = 0; i < loader_data.numshlibs && loader_data.shlibs[i].name != NULL; i++) {
+ loader_shlibdesc_t *shlib = &loader_data.shlibs[i];
+ free(shlib->name);
+ free(shlib->thisshlib_path);
+ for (int j = 0; j < shlib->numfunc; ++j)
+ free(shlib->funcarray[j].fname);
+ free(shlib->funcarray);
+ shlib->numfunc = 0;
+ shlib->len_funcarray = 0;
+ }
+ free(loader_data.shlibs);
+}
diff --git a/common/utils/load_module_shlib.h b/common/utils/load_module_shlib.h
index 0e80a5353c..8139c21909 100644
--- a/common/utils/load_module_shlib.h
+++ b/common/utils/load_module_shlib.h
@@ -47,6 +47,7 @@ typedef struct {
char *thisshlib_path;
uint32_t numfunc;
loader_shlibfunc_t *funcarray;
+ uint32_t len_funcarray;
}loader_shlibdesc_t;
typedef struct {
@@ -90,5 +91,6 @@ extern void * get_shlibmodule_fptr(char *modname, char *fname);
extern loader_data_t loader_data;
#endif /* LOAD_MODULE_SHLIB_MAIN */
#define load_module_shlib(M, F, N, I) load_module_version_shlib(M, NULL, F, N, I)
+void loader_reset();
#endif
diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c
index b0a6266d34..febfe7db7d 100644
--- a/common/utils/nr/nr_common.c
+++ b/common/utils/nr/nr_common.c
@@ -36,6 +36,27 @@
const char *duplex_mode[]={"FDD","TDD"};
+int tables_5_3_2[5][11] = {
+ {25, 52, 79, 106, 133, 160, 216, 270, -1, -1, -1}, // 15 FR1
+ {11, 24, 38, 51, 65, 78, 106, 133, 162, 217, 273}, // 30 FR1
+ {-1, 11, 18, 24, 31, 38, 51, 65, 79, 107, 135}, // 60 FR1
+ {66, 132, 264, -1 , -1, -1, -1, -1, -1, -1, -1}, // 60 FR2
+ {32, 66, 132, 264, -1, -1, -1, -1, -1, -1, -1} // 120FR2
+};
+
+int get_supported_band_index(int scs, int band, int n_rbs){
+
+ int scs_index = scs;
+ if (band>256)
+ scs_index++;
+ for (int i=0; i<11; i++) {
+ if(n_rbs == tables_5_3_2[scs][i])
+ return i;
+ }
+ return (-1); // not found
+}
+
+
// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101)
// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101)
// Notes:
diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h
index 882f99338c..0150cf59f8 100644
--- a/common/utils/nr/nr_common.h
+++ b/common/utils/nr/nr_common.h
@@ -80,6 +80,7 @@ void SLIV2SL(int SLIV,int *S,int *L);
int get_dmrs_port(int nl, uint16_t dmrs_ports);
uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols);
int get_nb_periods_per_frame(uint8_t tdd_period);
+int get_supported_band_index(int scs, int band, int n_rbs);
long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS);
#define CEILIDIV(a,b) ((a+b-1)/b)
diff --git a/common/utils/telnetsrv/telnetsrv_measurements.c b/common/utils/telnetsrv/telnetsrv_measurements.c
index 786cbd094c..2af76753b8 100644
--- a/common/utils/telnetsrv/telnetsrv_measurements.c
+++ b/common/utils/telnetsrv/telnetsrv_measurements.c
@@ -51,6 +51,7 @@
static char *grouptypes[] = {"ltestats","cpustats"};
static double cpufreq;
+extern notifiedFIFO_t measur_fifo;
#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
#define HDR "---------------------------------"
diff --git a/common/utils/threadPool/measurement_display.c b/common/utils/threadPool/measurement_display.c
index 0f5a3e0f69..cf2febaf33 100644
--- a/common/utils/threadPool/measurement_display.c
+++ b/common/utils/threadPool/measurement_display.c
@@ -43,9 +43,9 @@ int main(int argc, char *argv[]) {
exit(1);
}
- uint64_t deb=rdtsc();
+ uint64_t deb=rdtsc_oai();
usleep(100000);
- cpuCyclesMicroSec=(rdtsc()-deb)/100000;
+ cpuCyclesMicroSec=(rdtsc_oai()-deb)/100000;
printf("Cycles per µs: %lu\n",cpuCyclesMicroSec);
printf("Key" SEP "delay to process" SEP "processing time" SEP "delay to be read answer\n");
notifiedFIFO_elt_t doneRequest;
diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c
index fff09528a8..de9091de79 100644
--- a/common/utils/threadPool/thread-pool.c
+++ b/common/utils/threadPool/thread-pool.c
@@ -72,11 +72,11 @@ void *one_thread(void *arg) {
do {
notifiedFIFO_elt_t *elt=pullNotifiedFifoRemember(&tp->incomingFifo, myThread);
- if (tp->measurePerf) elt->startProcessingTime=rdtsc();
+ if (tp->measurePerf) elt->startProcessingTime=rdtsc_oai();
elt->processingFunc(NotifiedFifoData(elt));
- if (tp->measurePerf) elt->endProcessingTime=rdtsc();
+ if (tp->measurePerf) elt->endProcessingTime=rdtsc_oai();
if (elt->reponseFifo) {
// Check if the job is still alive, else it has been aborted
@@ -97,7 +97,7 @@ void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name
char *measr=getenv("threadPoolMeasurements");
pool->measurePerf=performanceMeas;
// force measurement if the output is defined
- pool->measurePerf=measr!=NULL;
+ pool->measurePerf |= measr!=NULL;
if (measr) {
mkfifo(measr,0666);
diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h
index a8f8572cfe..d06f2195ee 100644
--- a/common/utils/threadPool/thread-pool.h
+++ b/common/utils/threadPool/thread-pool.h
@@ -27,11 +27,11 @@
#include
#include
#include
+#include
#include
-#include
-#include
-#include
-//#include
+#include "assertions.h"
+#include "common/utils/time_meas.h"
+#include "common/utils/system.h"
#ifdef DEBUG
#define THREADINIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
@@ -60,10 +60,10 @@ typedef struct notifiedFIFO_elt_s {
struct notifiedFIFO_s *reponseFifo;
void (*processingFunc)(void *);
bool malloced;
- uint64_t creationTime;
- uint64_t startProcessingTime;
- uint64_t endProcessingTime;
- uint64_t returnTime;
+ oai_cputime_t creationTime;
+ oai_cputime_t startProcessingTime;
+ oai_cputime_t endProcessingTime;
+ oai_cputime_t returnTime;
void *msgData;
} notifiedFIFO_elt_t;
@@ -97,12 +97,11 @@ static inline void *NotifiedFifoData(notifiedFIFO_elt_t *elt) {
static inline void delNotifiedFIFO_elt(notifiedFIFO_elt_t *elt) {
if (elt->malloced) {
- elt->malloced=false;
+ elt->malloced = false;
free(elt);
- } else
- printf("delNotifiedFIFO on something not allocated by newNotifiedFIFO\n");
-
- //LOG_W(UTIL,"delNotifiedFIFO on something not allocated by newNotifiedFIFO\n");
+ }
+ /* it is allowed to call delNotifiedFIFO_elt when the memory is managed by
+ * the caller */
}
static inline void initNotifiedFIFO_nothreadSafe(notifiedFIFO_t *nf) {
@@ -141,8 +140,7 @@ static inline notifiedFIFO_elt_t *pullNotifiedFIFO_nothreadSafe(notifiedFIFO_t
notifiedFIFO_elt_t *ret=nf->outF;
- if (nf->outF==nf->outF->next)
- LOG_E(UTIL,"Circular list in thread pool: push several times the same buffer is forbidden\n");
+ AssertFatal(nf->outF != nf->outF->next,"Circular list in thread pool: push several times the same buffer is forbidden\n");
nf->outF=nf->outF->next;
@@ -174,6 +172,20 @@ static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
return ret;
}
+static inline time_stats_t exec_time_stats_NotifiedFIFO(const notifiedFIFO_elt_t* elt)
+{
+ time_stats_t ts = {0};
+ if (elt->startProcessingTime == 0 && elt->endProcessingTime == 0)
+ return ts; /* no measurements done */
+ ts.in = elt->startProcessingTime;
+ ts.diff = elt->endProcessingTime - ts.in;
+ ts.p_time = ts.diff;
+ ts.diff_square = ts.diff * ts.diff;
+ ts.max = ts.diff;
+ ts.trials = 1;
+ return ts;
+}
+
// This function aborts all messages matching the key
// If the queue is used in thread pools, it doesn't cancels already running processing
// because the message has already been picked
@@ -224,18 +236,18 @@ typedef struct thread_pool {
} tpool_t;
static inline void pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) {
- if (t->measurePerf) msg->creationTime=rdtsc();
+ if (t->measurePerf) msg->creationTime=rdtsc_oai();
if ( t->activated)
pushNotifiedFIFO(&t->incomingFifo, msg);
else {
if (t->measurePerf)
- msg->startProcessingTime=rdtsc();
+ msg->startProcessingTime=rdtsc_oai();
msg->processingFunc(NotifiedFifoData(msg));
if (t->measurePerf)
- msg->endProcessingTime=rdtsc();
+ msg->endProcessingTime=rdtsc_oai();
if (msg->reponseFifo)
pushNotifiedFIFO(msg->reponseFifo, msg);
@@ -246,7 +258,7 @@ static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_
notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo);
AssertFatal(t->traceFd, "Thread pool used while not initialized");
if (t->measurePerf)
- msg->returnTime=rdtsc();
+ msg->returnTime=rdtsc_oai();
if (t->traceFd > 0)
if(write(t->traceFd, msg, sizeof(*msg)));
@@ -261,7 +273,7 @@ static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpo
return NULL;
if (t->measurePerf)
- msg->returnTime=rdtsc();
+ msg->returnTime=rdtsc_oai();
if (t->traceFd)
if(write(t->traceFd, msg, sizeof(*msg)));
diff --git a/openair1/PHY/TOOLS/time_meas.c b/common/utils/time_meas.c
similarity index 97%
rename from openair1/PHY/TOOLS/time_meas.c
rename to common/utils/time_meas.c
index 353f170434..df2bfd64de 100644
--- a/openair1/PHY/TOOLS/time_meas.c
+++ b/common/utils/time_meas.c
@@ -267,6 +267,15 @@ void init_meas(void) {
AssertFatal(rt==0, "couldn't create cpu measurment thread: %s\n",strerror(errno));
}
+void send_meas(time_stats_t *ts, int msgid) {
+ if (MEASURE_ENABLED(ts) ) {
+ ts->tstatptr->timestat_id=ts->meas_index;
+ ts->tstatptr->msgid = msgid ;
+ ts->tstatptr->ts = rdtsc_oai();
+ pushNotifiedFIFO(&measur_fifo, ts->tpoolmsg);
+ }
+ }
+
void end_meas(void) {
notifiedFIFO_elt_t *nfe = newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
time_stats_msg_t *msg = (time_stats_msg_t *)NotifiedFifoData(nfe);
diff --git a/openair1/PHY/TOOLS/time_meas.h b/common/utils/time_meas.h
similarity index 83%
rename from openair1/PHY/TOOLS/time_meas.h
rename to common/utils/time_meas.h
index ed4e9a125f..382dd7455a 100644
--- a/openair1/PHY/TOOLS/time_meas.h
+++ b/common/utils/time_meas.h
@@ -31,15 +31,14 @@
#include
#include
#include
-#include "common/utils/threadPool/thread-pool.h"
// global var to enable openair performance profiler
extern int opp_enabled;
extern double cpu_freq_GHz __attribute__ ((aligned(32)));;
// structure to store data to compute cpu measurment
#if defined(__x86_64__) || defined(__i386__)
- #define OAI_CPUTIME_TYPE long long
+ typedef long long oai_cputime_t;
#elif defined(__arm__)
- #define OAI_CPUTIME_TYPE uint32_t
+ typedef uint32_t oai_cputime_t;
#else
#error "building on unsupported CPU architecture"
#endif
@@ -54,23 +53,23 @@ typedef void(*meas_printfunc_t)(const char* format, ...);
typedef struct {
int msgid; /*!< \brief message id, as defined by TIMESTAT_MSGID_X macros */
int timestat_id; /*!< \brief points to the time_stats_t entry in cpumeas table */
- OAI_CPUTIME_TYPE ts; /*!< \brief time stamp */
+ oai_cputime_t ts; /*!< \brief time stamp */
meas_printfunc_t displayFunc; /*!< \brief function to call when DISPLAY message is received*/
} time_stats_msg_t;
-
-typedef struct {
- OAI_CPUTIME_TYPE in; /*!< \brief time at measure starting point */
- OAI_CPUTIME_TYPE diff; /*!< \brief average difference between time at starting point and time at endpoint*/
- OAI_CPUTIME_TYPE p_time; /*!< \brief absolute process duration */
- OAI_CPUTIME_TYPE diff_square; /*!< \brief process duration square */
- OAI_CPUTIME_TYPE max; /*!< \brief maximum difference between time at starting point and time at endpoint*/
+struct notifiedFIFO_elt_s;
+typedef struct time_stats {
+ oai_cputime_t in; /*!< \brief time at measure starting point */
+ oai_cputime_t diff; /*!< \brief average difference between time at starting point and time at endpoint*/
+ oai_cputime_t p_time; /*!< \brief absolute process duration */
+ oai_cputime_t diff_square; /*!< \brief process duration square */
+ oai_cputime_t max; /*!< \brief maximum difference between time at starting point and time at endpoint*/
int trials; /*!< \brief number of start point - end point iterations */
int meas_flag; /*!< \brief 1: stop_meas not called (consecutive calls of start_meas) */
char *meas_name; /*!< \brief name to use when printing the measure (not used for PHY simulators)*/
int meas_index; /*!< \brief index of this measure in the measure array (not used for PHY simulators)*/
int meas_enabled; /*!< \brief per measure enablement flag. send_meas tests this flag, unused today in start_meas and stop_meas*/
- notifiedFIFO_elt_t *tpoolmsg; /*!< \brief message pushed to the cpu measurment queue to report a measure START or STOP */
+ struct notifiedFIFO_elt_s *tpoolmsg; /*!< \brief message pushed to the cpu measurment queue to report a measure START or STOP */
time_stats_msg_t *tstatptr; /*!< \brief pointer to the time_stats_msg_t data in the tpoolmsg, stored here for perf considerations*/
} time_stats_t;
#define MEASURE_ENABLED(X) (X->meas_enabled)
@@ -179,7 +178,7 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
}
}
-static inline void merge_meas(time_stats_t *dst_ts, time_stats_t *src_ts)
+static inline void merge_meas(time_stats_t *dst_ts, const time_stats_t *src_ts)
{
if (!opp_enabled)
return;
@@ -189,25 +188,17 @@ static inline void merge_meas(time_stats_t *dst_ts, time_stats_t *src_ts)
dst_ts->max = src_ts->max;
}
-extern notifiedFIFO_t measur_fifo;
#define CPUMEASUR_SECTION "cpumeasur"
#define CPUMEASUR_PARAMS_DESC { \
{"max_cpumeasur", "Max number of cpu measur entries", 0, uptr:&max_cpumeasur, defintval:100, TYPE_UINT, 0},\
}
- void init_meas(void);
- time_stats_t *register_meas(char *name);
- #define START_MEAS(X) send_meas(X, TIMESTAT_MSGID_START)
- #define STOP_MEAS(X) send_meas(X, TIMESTAT_MSGID_STOP)
- static inline void send_meas(time_stats_t *ts, int msgid) {
- if (MEASURE_ENABLED(ts) ) {
- ts->tstatptr->timestat_id=ts->meas_index;
- ts->tstatptr->msgid = msgid ;
- ts->tstatptr->ts = rdtsc_oai();
- pushNotifiedFIFO(&measur_fifo, ts->tpoolmsg);
- }
- }
- void end_meas(void);
+void init_meas(void);
+time_stats_t *register_meas(char *name);
+#define START_MEAS(X) send_meas(X, TIMESTAT_MSGID_START)
+#define STOP_MEAS(X) send_meas(X, TIMESTAT_MSGID_STOP)
+void send_meas(time_stats_t *ts, int msgid);
+void end_meas(void);
#endif
diff --git a/doc/5Gnas.md b/doc/5Gnas.md
index 3d33af426c..db0c19f07e 100644
--- a/doc/5Gnas.md
+++ b/doc/5Gnas.md
@@ -23,7 +23,6 @@ This tuto for 5G gNB NAS design
# source files
-executables/ocp-gnb.c: a main loop to create a debuggable gNB, see document SW_archi.md
openair2/RRC/NR/nr_ngap_gNB.c: skeleton for interface with NGAP
openair3/NAS/COMMON/milenage.h: a simple milenage implementation, depend only on crypto library
openair3/NAS/COMMON/NR_NAS_defs.h: messages defined for NAS implemented in C: C struct, C enums and automatic conversion to labels for debug messages
diff --git a/doc/SW_archi.md b/doc/SW_archi.md
index 7648fb2e16..0a53bf3793 100644
--- a/doc/SW_archi.md
+++ b/doc/SW_archi.md
@@ -85,10 +85,6 @@ end
This tuto for 5G gNB design, with Open Cells main
{: .text-center}
-# Top file: executables/ocp-gnb.c
-
-the function main() initializes the data from configuration file
-
# The main thread is in ru_thread()
The infinite loop:
## rx_rf()
diff --git a/doc/TESTING_5GSA_setup.md b/doc/TESTING_5GSA_setup.md
index 048d8c86ff..f8c85bf2ca 100644
--- a/doc/TESTING_5GSA_setup.md
+++ b/doc/TESTING_5GSA_setup.md
@@ -169,8 +169,7 @@ MACRLCs = (
At the point of writing this document the control-plane exchanges between the CU and the DU over *F1-C* interface, as well as some IP traffic tests over *F1-U* have been validated using the OAI gNB/nrUE in RFSIMULATOR mode.
-
-*These extensions are not yet fully integrated into develop branch, as they are under merge request. Until they get fully integrated, the CU/DU functionalities can be tested in [NR_F1C_F1U_extensions](https://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/NR_F1C_F1U_extensions) branch.*
+
## 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/oai-cn5g-fed/-/blob/master/README.md).
@@ -264,12 +263,12 @@ the gNB can be launched in 2 modes:
1. Launch the CU component:
```bash
sudo RFSIMULATOR=server ./nr-softmodem --rfsim --sa \
- -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf
+ -O ../../../ci-scripts/conf_files/gNB_SA_CU.conf
```
2. Launch the DU component:
```bash
sudo RFSIMULATOR=server ./nr-softmodem --rfsim --sa \
- -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf
+ -O ../../../ci-scripts/conf_files/gNB_SA_DU.conf
```
- To launch the OAI UE (valid in `monolithic` gNB and `CU/DU split` gNB):
diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2
index 9f4b27ec0e..2627a9eafd 100644
--- a/docker/Dockerfile.phySim.rhel8.2
+++ b/docker/Dockerfile.phySim.rhel8.2
@@ -31,11 +31,14 @@ RUN rm -Rf /oai-ran
WORKDIR /oai-ran
COPY . .
+#only install address sanitizer for this container, the others don't need it
+RUN yum install -y libasan
+
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
- ./build_oai --phy_simulators --ninja --verbose-ci
+ ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address
#start from scratch for target executable
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim
@@ -85,6 +88,7 @@ COPY --from=phy-sim-build \
/lib64/liblapack.so.3 \
/lib64/libexslt.so.0 \
/lib64/libxslt.so.1 \
+ /usr/lib64/libasan.so.5 \
/oai-ran/cmake_targets/ran_build/build/libdfts.so \
/oai-ran/cmake_targets/ran_build/build/libSIMU.so \
/oai-ran/cmake_targets/ran_build/build/libldpc.so \
diff --git a/executables/main-fs6.c b/executables/main-fs6.c
index 9e92f2e41a..fff4c51155 100644
--- a/executables/main-fs6.c
+++ b/executables/main-fs6.c
@@ -55,6 +55,59 @@ int sum(uint8_t *b, int s) {
return sum;
}
+
+extern double cpuf;
+
+typedef struct m {
+ uint64_t iterations;
+ uint64_t sum;
+ uint64_t maxArray[11];
+} Meas;
+
+int cmpint(const void *a, const void *b)
+{
+ uint64_t *aa=(uint64_t *)a;
+ uint64_t *bb=(uint64_t *)b;
+ return (int)(*aa-*bb);
+}
+
+static inline void printMeas(char *txt,
+ Meas *M,
+ int period)
+{
+ if (M->iterations%period == 0 ) {
+ char txt2[512];
+ sprintf(txt2,"%s avg=%" PRIu64 " iterations=%" PRIu64 " max=%"
+ PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 ":%" PRIu64 "\n",
+ txt,
+ M->sum/M->iterations,
+ M->iterations,
+ M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5],
+ M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
+#if T_TRACER
+ LOG_W(PHY,"%s",txt2);
+#else
+ printf("%s",txt2);
+#endif
+ }
+}
+
+void updateTimes(uint64_t start, Meas *M, int period, char *txt)
+{
+ if (start!=0) {
+ uint64_t end=rdtsc_oai();
+ long long diff=(end-start)/(cpuf*1000);
+ M->maxArray[0]=diff;
+ M->sum+=diff;
+ M->iterations++;
+ qsort(M->maxArray, 11, sizeof(uint64_t), cmpint);
+ printMeas(txt,M,period);
+ }
+}
+
+#define initStaticTime(a) static __thread uint64_t a={0}
+#define pickStaticTime(a) do { a=rdtsc_oai(); } while (0)
+#define initRefTimes(a) static __thread Meas a= {0}
static inline int cmpintRev(const void *a, const void *b) {
uint64_t *aa=(uint64_t *)a;
uint64_t *bb=(uint64_t *)b;
@@ -82,7 +135,7 @@ static inline void printMeas2(char *txt, Meas *M, int period, bool MaxMin) {
static inline void updateTimesReset(uint64_t start, Meas *M, int period, bool MaxMin, char *txt) {
if (start!=0) {
- uint64_t end=rdtsc();
+ uint64_t end=rdtsc_oai();
long long diff=(end-start)/(cpuf*1000);
M->maxArray[0]=diff;
M->sum+=diff;
@@ -107,7 +160,7 @@ static inline void updateTimesReset(uint64_t start, Meas *M, int period, bool Ma
static inline void measTransportTime(uint64_t DuSend, uint64_t CuMicroSec, Meas *M, int period, bool MaxMin, char *txt) {
if (DuSend!=0) {
- uint64_t end=rdtsc();
+ uint64_t end=rdtsc_oai();
long long diff=(end-DuSend)/(cpuf*1000)-CuMicroSec;
M->maxArray[0]=diff;
M->sum+=diff;
@@ -894,7 +947,7 @@ void phy_procedures_eNB_TX_fromsplit(uint8_t *bufferZone, int nbBlocks, PHY_VARS
memcpy(eNB->pbch_pdu,hDL(bufferZone)->pbch_pdu, 4);
// Remove all scheduled DL, we will populate from the CU sending
- for (int UE_id=0; UE_iddlsch[UE_id][0];
if ( dlsch0 && dlsch0->rnti>0 ) {
@@ -1463,7 +1516,7 @@ void DL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc, uint64_t DuClock, uint64_t start
}
hDL(bufferZone)->DuClock=DuClock;
- hDL(bufferZone)->CuSpentMicroSec=(rdtsc()-startCycle)/(cpuf*1000);
+ hDL(bufferZone)->CuSpentMicroSec=(rdtsc_oai()-startCycle)/(cpuf*1000);
updateTimesReset(startCycle, &CUprocessing, 1000, true,"CU entire processing from recv to send");
sendSubFrame(&sockFS6, bufferZone, sizeof(fs6_dl_t), CTsentCUv0 );
return;
@@ -1476,7 +1529,7 @@ void UL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc, uint64_t *TS, uint64_t *DuClock,
pickStaticTime(begingWait);
int nb_blocks=receiveSubFrame(&sockFS6, bufferZone, sizeof(bufferZone), CTsentDUv0 );
* DuClock=hUDP(bufferZone)->senderClock;
- * startProcessing=rdtsc();
+ * startProcessing=rdtsc_oai();
updateTimesReset(begingWait, &fullLoop, 1000, false, "CU wait DU");
if (nb_blocks ==0) {
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index 04315a4d57..c9388e179d 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -87,10 +87,10 @@ AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0};
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0};
void flexran_agent_slice_update(mid_t module_idP) {
}
-int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) {
+int proto_agent_start(mid_t mod_id, const cudu_params_t *p) {
return 0;
}
-void proto_agent_stop(mod_id_t mod_id) {
+void proto_agent_stop(mid_t mod_id) {
}
static void *ru_thread( void *param );
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 2b1c36407b..fa0c3a1f63 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -300,8 +300,7 @@ void rx_func(void *param) {
}
static void dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output) {
int stroff = 0;
- stroff += print_meas_log(gNB->phy_proc_tx[0], "L1 Tx processing thread 0", NULL, NULL, output);
- //stroff += print_meas_log(gNB->phy_proc_tx[1], "L1 Tx processing thread 1", NULL, NULL, output+stroff);
+ stroff += print_meas_log(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL, output);
stroff += print_meas_log(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL, output+stroff);
stroff += print_meas_log(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL, output+stroff);
stroff += print_meas_log(&gNB->ul_indication_stats, "UL Indication", NULL, NULL, output+stroff);
@@ -337,8 +336,7 @@ void *nrL1_stats_thread(void *param) {
fd=fopen("nrL1_stats.log","w");
AssertFatal(fd!=NULL,"Cannot open nrL1_stats.log\n");
- reset_meas(gNB->phy_proc_tx[0]);
- //reset_meas(gNB->phy_proc_tx[1]);
+ reset_meas(&gNB->phy_proc_tx);
reset_meas(&gNB->dlsch_encoding_stats);
reset_meas(&gNB->phy_proc_rx);
reset_meas(&gNB->ul_indication_stats);
@@ -425,7 +423,7 @@ void init_gNB_Tpool(int inst) {
s_offset += 3;
}
if (getenv("noThreads")) strcpy(pool, "n");
- initTpool(pool, gNB->threadPool, false);
+ initTpool(pool, gNB->threadPool, cpumeas(CPUMEAS_GETSTATE));
// ULSCH decoder result FIFO
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(gNB->respDecode);
@@ -450,8 +448,6 @@ void init_gNB_Tpool(int inst) {
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
init_DLSCH_struct(gNB, msgDataTx);
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
- reset_meas(&msgDataTx->phy_proc_tx);
- gNB->phy_proc_tx[i] = &msgDataTx->phy_proc_tx;
pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx); // to unblock the process in the beginning
}
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index 7410e303b1..ac5a1b0132 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -62,8 +62,6 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
-//#include "PHY/TOOLS/time_meas.h"
-
#include "intertask_interface.h"
#include "PHY/INIT/phy_init.h"
@@ -593,6 +591,7 @@ void init_pdcp(void) {
if (!get_softmodem_params()->nsa) {
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
+ pdcp_layer_init();
nr_pdcp_module_init(pdcp_initmask, 0);
}
} else {
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index d1b26601b4..543be7a8b5 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -167,10 +167,10 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
}
// initialize all signal buffers
- init_nr_ue_signal(ue, nb_connected_gNB, abstraction_flag);
+ init_nr_ue_signal(ue, nb_connected_gNB);
// intialize transport
- init_nr_ue_transport(ue, abstraction_flag);
+ init_nr_ue_transport(ue);
// init N_TA offset
init_N_TA_offset(ue);
@@ -766,9 +766,9 @@ void processSlotRX(void *arg) {
#ifdef UE_SLOT_PARALLELISATION
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL );
#else
- uint64_t a=rdtsc();
+ uint64_t a=rdtsc_oai();
phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &rxtxD->txFifo);
- LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500);
+ LOG_D(PHY, "In %s: slot %d, time %llu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc_oai()-a)/3500);
#endif
if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa){
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 7663e9ebd8..76c21bb422 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -61,7 +61,6 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "UTIL/OPT/opt.h"
#include "enb_config.h"
-//#include "PHY/TOOLS/time_meas.h"
#include "intertask_interface.h"
diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c
deleted file mode 100644
index 23fd3ae132..0000000000
--- a/executables/ocp-gnb.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/*
- * Author: Laurent Thomas, Open Cells Project
- * all rights reserved
- */
-
-#define _GNU_SOURCE
-#include
-#include "assertions.h"
-#include
-#include
-
-#include "PHY/types.h"
-
-#include "PHY/INIT/phy_init.h"
-
-#include "PHY/defs_gNB.h"
-#include "SCHED/sched_eNB.h"
-#include "SCHED_NR/sched_nr.h"
-#include "SCHED_NR/fapi_nr_l1.h"
-#include "PHY/LTE_TRANSPORT/transport_proto.h"
-#include "../../ARCH/COMMON/common_lib.h"
-
-#include "PHY/phy_extern.h"
-#include "LAYER2/MAC/mac.h"
-#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
-#include "LAYER2/MAC/mac_proto.h"
-#include "RRC/LTE/rrc_extern.h"
-#include "PHY_INTERFACE/phy_interface.h"
-#include "common/utils/LOG/log_extern.h"
-#include "UTIL/OTG/otg_tx.h"
-#include "UTIL/OTG/otg_externs.h"
-#include "UTIL/MATH/oml.h"
-#include "common/utils/LOG/vcd_signal_dumper.h"
-#include "UTIL/OPT/opt.h"
-#include "enb_config.h"
-#include "s1ap_eNB.h"
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// should be in a shared lib
-#include
-#include
-#include
-#include
-
-// Global vars
-#include
-#include
-#include
-#include
-volatile int oai_exit;
-int single_thread_flag=1;
-uint32_t do_forms=0;
-unsigned int mmapped_dma=0;
-int8_t threequarter_fs=0;
-
-int chain_offset=0;
-uint16_t sl_ahead=6;
-uint16_t sf_ahead=6;
-uint32_t timing_advance = 0;
-int transmission_mode=1;
-int emulate_rf = 0;
-int numerology = 0;
-
-
-int config_sync_var=-1;
-pthread_mutex_t nfapi_sync_mutex;
-pthread_cond_t nfapi_sync_cond;
-int nfapi_sync_var=-1;
-double cpuf;
-
-THREAD_STRUCT thread_struct;
-
-pthread_cond_t sync_cond;
-pthread_mutex_t sync_mutex;
-int sync_var=-1; //!< protected by mutex \ref sync_mutex.
-
-
-uint64_t downlink_frequency[MAX_NUM_CCs][4];
-int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
-time_stats_t softmodem_stats_mt; // main thread
-time_stats_t softmodem_stats_hw; // hw acquisition
-time_stats_t softmodem_stats_rxtx_sf; // total tx time
-time_stats_t nfapi_meas; // total tx time
-time_stats_t softmodem_stats_rx_sf; // total rx time
-// not used but needed for link
-openair0_config_t openair0_cfg[MAX_CARDS];
-uint16_t slot_ahead=6;
-AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
-AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
-int flexran_agent_start(mid_t mod_id) {
- memset (agent_rrc_xface, 0, sizeof(agent_rrc_xface));
- memset (agent_mac_xface, 0, sizeof(agent_mac_xface));
- return 0;
-}
-void flexran_agent_slice_update(mid_t module_idP) {
-}
-int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) {
- return 0;
-}
-void proto_agent_stop(mod_id_t mod_id) {
-}
-int split73=0;
-void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
- AssertFatal(false, "Must not be called in this context\n");
-}
-int stop_L1L2(module_id_t gnb_id) {
- AssertFatal(false, "Must not be called in this context\n");
-}
-int restart_L1L2(module_id_t gnb_id) {
- AssertFatal(false, "Must not be called in this context\n");
-}
-
-static int wait_for_sync = 0;
-static double snr_dB=20;
-static int DEFBANDS[] = {7};
-static int DEFENBS[] = {0};
-static int DEFBFW[] = {0x00007fff};
-
-extern double cpuf;
-
-short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,16384,16384,-16384,-16384,16384,16384,16384,-16384,-16384,16384,-16384,-16384,7327,7327,7327,21981,21981,7327,21981,21981,7327,-7327,7327,-21981,21981,-7327,21981,-21981,-7327,7327,-7327,21981,-21981,7327,-21981,21981,-7327,-7327,-7327,-21981,-21981,-7327,-21981,-21981,10726,10726,10726,3576,3576,10726,3576,3576,10726,17876,10726,25027,3576,17876,3576,25027,17876,10726,17876,3576,25027,10726,25027,3576,17876,17876,17876,25027,25027,17876,25027,25027,10726,-10726,10726,-3576,3576,-10726,3576,-3576,10726,-17876,10726,-25027,3576,-17876,3576,-25027,17876,-10726,17876,-3576,25027,-10726,25027,-3576,17876,-17876,17876,-25027,25027,-17876,25027,-25027,-10726,10726,-10726,3576,-3576,10726,-3576,3576,-10726,17876,-10726,25027,-3576,17876,-3576,25027,-17876,10726,-17876,3576,-25027,10726,-25027,3576,-17876,17876,-17876,25027,-25027,17876,-25027,25027,-10726,-10726,-10726,-3576,-3576,-10726,-3576,-3576,-10726,-17876,-10726,-25027,-3576,-17876,-3576,-25027,-17876,-10726,-17876,-3576,-25027,-10726,-25027,-3576,-17876,-17876,-17876,-25027,-25027,-17876,-25027,-25027,8886,8886,8886,12439,12439,8886,12439,12439,8886,5332,8886,1778,12439,5332,12439,1778,5332,8886,5332,12439,1778,8886,1778,12439,5332,5332,5332,1778,1778,5332,1778,1778,8886,19547,8886,15993,12439,19547,12439,15993,8886,23101,8886,26655,12439,23101,12439,26655,5332,19547,5332,15993,1778,19547,1778,15993,5332,23101,5332,26655,1778,23101,1778,26655,19547,8886,19547,12439,15993,8886,15993,12439,19547,5332,19547,1778,15993,5332,15993,1778,23101,8886,23101,12439,26655,8886,26655,12439,23101,5332,23101,1778,26655,5332,26655,1778,19547,19547,19547,15993,15993,19547,15993,15993,19547,23101,19547,26655,15993,23101,15993,26655,23101,19547,23101,15993,26655,19547,26655,15993,23101,23101,23101,26655,26655,23101,26655,26655,8886,-8886,8886,-12439,12439,-8886,12439,-12439,8886,-5332,8886,-1778,12439,-5332,12439,-1778,5332,-8886,5332,-12439,1778,-8886,1778,-12439,5332,-5332,5332,-1778,1778,-5332,1778,-1778,8886,-19547,8886,-15993,12439,-19547,12439,-15993,8886,-23101,8886,-26655,12439,-23101,12439,-26655,5332,-19547,5332,-15993,1778,-19547,1778,-15993,5332,-23101,5332,-26655,1778,-23101,1778,-26655,19547,-8886,19547,-12439,15993,-8886,15993,-12439,19547,-5332,19547,-1778,15993,-5332,15993,-1778,23101,-8886,23101,-12439,26655,-8886,26655,-12439,23101,-5332,23101,-1778,26655,-5332,26655,-1778,19547,-19547,19547,-15993,15993,-19547,15993,-15993,19547,-23101,19547,-26655,15993,-23101,15993,-26655,23101,-19547,23101,-15993,26655,-19547,26655,-15993,23101,-23101,23101,-26655,26655,-23101,26655,-26655,-8886,8886,-8886,12439,-12439,8886,-12439,12439,-8886,5332,-8886,1778,-12439,5332,-12439,1778,-5332,8886,-5332,12439,-1778,8886,-1778,12439,-5332,5332,-5332,1778,-1778,5332,-1778,1778,-8886,19547,-8886,15993,-12439,19547,-12439,15993,-8886,23101,-8886,26655,-12439,23101,-12439,26655,-5332,19547,-5332,15993,-1778,19547,-1778,15993,-5332,23101,-5332,26655,-1778,23101,-1778,26655,-19547,8886,-19547,12439,-15993,8886,-15993,12439,-19547,5332,-19547,1778,-15993,5332,-15993,1778,-23101,8886,-23101,12439,-26655,8886,-26655,12439,-23101,5332,-23101,1778,-26655,5332,-26655,1778,-19547,19547,-19547,15993,-15993,19547,-15993,15993,-19547,23101,-19547,26655,-15993,23101,-15993,26655,-23101,19547,-23101,15993,-26655,19547,-26655,15993,-23101,23101,-23101,26655,-26655,23101,-26655,26655,-8886,-8886,-8886,-12439,-12439,-8886,-12439,-12439,-8886,-5332,-8886,-1778,-12439,-5332,-12439,-1778,-5332,-8886,-5332,-12439,-1778,-8886,-1778,-12439,-5332,-5332,-5332,-1778,-1778,-5332,-1778,-1778,-8886,-19547,-8886,-15993,-12439,-19547,-12439,-15993,-8886,-23101,-8886,-26655,-12439,-23101,-12439,-26655,-5332,-19547,-5332,-15993,-1778,-19547,-1778,-15993,-5332,-23101,-5332,-26655,-1778,-23101,-1778,-26655,-19547,-8886,-19547,-12439,-15993,-8886,-15993,-12439,-19547,-5332,-19547,-1778,-15993,-5332,-15993,-1778,-23101,-8886,-23101,-12439,-26655,-8886,-26655,-12439,-23101,-5332,-23101,-1778,-26655,-5332,-26655,-1778,-19547,-19547,-19547,-15993,-15993,-19547,-15993,-15993,-19547,-23101,-19547,-26655,-15993,-23101,-15993,-26655,-23101,-19547,-23101,-15993,-26655,-19547,-26655,-15993,-23101,-23101,-23101,-26655,-26655,-23101,-26655,-26655};
-
-static inline int ocp_rxtx(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc) {
- nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
- start_meas(&softmodem_stats_rxtx_sf);
-
- // *******************************************************************
-
- if (nfapi_mode == NFAPI_MODE_PNF) {
- // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
- //add_subframe(&frame, &subframe, 4);
- //oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
- //LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
- start_meas(&nfapi_meas);
- oai_subframe_ind(proc->frame_rx, proc->slot_rx);
- stop_meas(&nfapi_meas);
- /*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
- gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs ||
- gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs ||
- gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles ||
- gNB->UL_INFO.cqi_ind.number_of_cqis
- ) {
- LOG_D(PHY, "UL_info[rx_ind:%05d:%d harqs:%05d:%d crcs:%05d:%d preambles:%05d:%d cqis:%d] RX:%04d%d TX:%04d%d \n",
- NFAPI_SFNSF2DEC(gNB->UL_INFO.rx_ind.sfn_sf), gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus,
- NFAPI_SFNSF2DEC(gNB->UL_INFO.harq_ind.sfn_sf), gNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs,
- NFAPI_SFNSF2DEC(gNB->UL_INFO.crc_ind.sfn_sf), gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs,
- NFAPI_SFNSF2DEC(gNB->UL_INFO.rach_ind.sfn_sf), gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles,
- gNB->UL_INFO.cqi_ind.number_of_cqis,
- frame_rx, slot_rx,
- frame_tx, slot_tx);
- }*/
- }
-
- /// NR disabling
- // ****************************************
- // Common RX procedures subframe n
- pthread_mutex_lock(&gNB->UL_INFO_mutex);
- gNB->UL_INFO.frame = proc->frame_rx;
- gNB->UL_INFO.slot = proc->slot_rx;
- gNB->UL_INFO.module_id = gNB->Mod_id;
- gNB->UL_INFO.CC_id = gNB->CC_id;
- gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
- pthread_mutex_unlock(&gNB->UL_INFO_mutex);
- // RX processing
- int tx_slot_type = nr_slot_select(cfg,proc->frame_tx,proc->slot_tx);
- int rx_slot_type = nr_slot_select(cfg,proc->frame_rx,proc->slot_rx);
-
- if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) {
- // Do PRACH RU processing
- L1_nr_prach_procedures(gNB,proc->frame_rx,proc->slot_rx);
- phy_procedures_gNB_uespec_RX(gNB, proc->frame_rx, proc->slot_rx);
- }
-
- if (oai_exit) return(-1);
-
- // *****************************************
- // TX processing for subframe n+sf_ahead
- // run PHY TX procedures the one after the other for all CCs to avoid race conditions
- // (may be relaxed in the future for performance reasons)
- // *****************************************
-
- if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) {
- phy_procedures_gNB_TX(gNB, proc->frame_tx,proc->slot_tx, 1);
- }
-
- stop_meas( &softmodem_stats_rxtx_sf );
- LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, proc->frame_rx, proc->slot_rx, proc->frame_tx, proc->slot_tx);
- return(0);
-}
-
-
-static void *process_stats_thread(void *param) {
- PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
- reset_meas(&gNB->dlsch_encoding_stats);
- reset_meas(&gNB->dlsch_scrambling_stats);
- reset_meas(&gNB->dlsch_modulation_stats);
-
- while(!oai_exit) {
- sleep(1);
- print_meas(&gNB->dlsch_encoding_stats, "pdsch_encoding", NULL, NULL);
- print_meas(&gNB->dlsch_scrambling_stats, "pdsch_scrambling", NULL, NULL);
- print_meas(&gNB->dlsch_modulation_stats, "pdsch_modulation", NULL, NULL);
- }
-
- return(NULL);
-}
-
-void init_gNB_proc(int inst) {
- PHY_VARS_gNB *gNB = RC.gNB[inst];
- gNB_L1_proc_t *proc = &gNB->proc;
- gNB_L1_rxtx_proc_t *L1_proc = &proc->L1_proc;
- gNB_L1_rxtx_proc_t *L1_proc_tx = &proc->L1_proc_tx;
- L1_proc->instance_cnt = -1;
- L1_proc_tx->instance_cnt = -1;
- L1_proc->instance_cnt_RUs = 0;
- L1_proc_tx->instance_cnt_RUs = 0;
- proc->instance_cnt_prach = -1;
- proc->instance_cnt_asynch_rxtx = -1;
- proc->CC_id = 0;
- proc->first_rx =1;
- proc->first_tx =1;
- proc->RU_mask =0;
- proc->RU_mask_tx = (1<num_RU)-1;
- proc->RU_mask_prach =0;
- pthread_mutex_init( &gNB->UL_INFO_mutex, NULL);
- gNB->threadPool = (tpool_t *)malloc(sizeof(tpool_t));
- gNB->respDecode = (notifiedFIFO_t *) malloc(sizeof(notifiedFIFO_t));
- char ul_pool[] = "-1,-1";
- initTpool(ul_pool, gNB->threadPool, false);
- initNotifiedFIFO(gNB->respDecode);
-}
-
-/// eNB kept in function name for nffapi calls, TO FIX
-void init_gNB_phase2(RU_t *ru) {
- int inst;
- LOG_I(PHY,"%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst);
-
- for (inst=0; instnum_RU:%d\n", gNB->num_RU);
- phy_init_nr_gNB(gNB,0,0);
- RC.gNB[inst]->num_RU=1;
- RC.gNB[inst]->RU_list[0]=ru;
- //init_precoding_weights(RC.gNB[inst][CC_id]);
- }
-}
-
-void init_gNB(int single_thread_flag,int wait_for_sync) {
- for (int inst=0; instRCconfig_NR_L1\n");
- PHY_VARS_gNB *gNB= RC.gNB[inst];
- gNB->abstraction_flag = false;
- gNB->single_thread_flag = true;
- /*nr_polar_init(&gNB->nrPolar_params,
- NR_POLAR_PBCH_MESSAGE_TYPE,
- NR_POLAR_PBCH_PAYLOAD_BITS,
- NR_POLAR_PBCH_AGGREGATION_LEVEL);*/
- LOG_I(PHY,"Registering with MAC interface module\n");
- AssertFatal((gNB->if_inst = NR_IF_Module_init(inst))!=NULL,"Cannot register interface");
- gNB->if_inst->NR_Schedule_response = nr_schedule_response;
- gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
- memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
- memset((void *)&gNB->UL_tti_req,0,sizeof(nfapi_nr_ul_tti_request_t));
- //memset((void *)&gNB->Sched_INFO,0,sizeof(gNB->Sched_INFO));
- LOG_I(PHY,"Setting indication lists\n");
- gNB->UL_INFO.rx_ind.pdu_list = gNB->rx_pdu_list;
- gNB->UL_INFO.crc_ind.crc_list = gNB->crc_pdu_list;
- /*gNB->UL_INFO.sr_ind.sr_indication_body.sr_pdu_list = gNB->sr_pdu_list;
- gNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = gNB->harq_pdu_list;
- gNB->UL_INFO.cqi_ind.cqi_pdu_list = gNB->cqi_pdu_list;
- gNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = gNB->cqi_raw_pdu_list;*/
- gNB->prach_energy_counter = 0;
- }
-
- LOG_I(PHY,"[nr-softmodem.c] gNB structure allocated\n");
-}
-
-
-void stop_gNB(int nb_inst) {
-}
-
-static void get_options(void) {
- paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ;
- config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
-
- if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
- memset((void *)&RC,0,sizeof(RC));
- /* Read RC configuration file */
- NRRCConfig();
- printf("Configuration: nb_rrc_inst %d, nb_nr_L1_inst %d, nb_ru %hhd\n", RC.nb_nr_inst,RC.nb_nr_L1_inst,RC.nb_RU);
- }
-
- AssertFatal(RC.nb_nr_L1_inst == 1 && RC.nb_RU == 1, "Only one gNB, one RU and one carrier is supported\n");
-}
-
-void set_default_frame_parms(nfapi_nr_config_request_t *config[MAX_NUM_CCs],
- NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
- for (int CC_id=0; CC_idsubframe_config.numerology_index_mu.value =1;
- config[CC_id]->subframe_config.duplex_mode.value = 1; //FDD
- config[CC_id]->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL
- config[CC_id]->rf_config.dl_carrier_bandwidth.value = 106;
- config[CC_id]->rf_config.ul_carrier_bandwidth.value = 106;
- config[CC_id]->sch_config.physical_cell_id.value = 0;
- }
-}
-
-static void init_pdcp(void) {
- //if (!NODE_IS_DU(RC.rrc[0]->node_type)) {
- pdcp_layer_init();
- uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
- (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
-
- if (IS_SOFTMODEM_NOS1) {
- printf("IS_SOFTMODEM_NOS1 option enabled \n");
- pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
- }
-
- nr_pdcp_module_init(pdcp_initmask, 0);
- pdcp_set_rlc_data_req_func(rlc_data_req);
- pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
-}
-
-void init_main_gNB(void) {
- RCconfig_NR_L1();
- RCconfig_nr_macrlc();
-
- if (RC.nb_nr_L1_inst>0)
- AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n");
-
- LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst);
- RC.nrrrc = (gNB_RRC_INST **)calloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *),1);
- LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc);
- int gnb_id=0; // only 1 gnb per process, index 0 for now
- RC.nrrrc[gnb_id] = (gNB_RRC_INST *)calloc(sizeof(gNB_RRC_INST),1);
- MessageDef *msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ);
- RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
- openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(ITTI_MSG_DESTINATION_INSTANCE(msg_p)), &NRRRC_CONFIGURATION_REQ(msg_p));
- //AssertFatal(itti_create_task(TASK_GNB_APP, gNB_app_task, NULL) >= 0, "");
- AssertFatal(itti_create_task(TASK_RRC_GNB, rrc_gnb_task, NULL) >= 0, "");
- //AssertFatal(itti_create_task(TASK_X2AP, x2ap_task, NULL) >= 0, "");
-}
-
-static void wait_nfapi_init(char *thread_name) {
- printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
- pthread_mutex_lock( &nfapi_sync_mutex );
-
- while (nfapi_sync_var<0)
- pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex );
-
- pthread_mutex_unlock(&nfapi_sync_mutex);
- printf( "NFAPI: got sync (%s)\n", thread_name);
-}
-
-void exit_function(const char *file, const char *function, const int line, const char *s) {
- if (s != NULL) {
- printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
- }
-
- oai_exit = 1;
- sleep(1); //allow lte-softmodem threads to exit first
- exit(1);
-}
-
-void stop_RU(int nb_ru) {
- return;
-}
-
-void OCPconfig_RU(RU_t *ru) {
- int i = 0, j = 0; // Ru and gNB cardinality
- paramdef_t RUParams[] = RUPARAMS_DESC;
- paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
- config_getlist( &RUParamList, RUParams, sizeof(RUParams)/sizeof(paramdef_t), NULL);
- AssertFatal( RUParamList.numelt == 1 && RC.nb_nr_L1_inst ==1,"" );
- ru->idx=0;
- ru->nr_frame_parms = (NR_DL_FRAME_PARMS *)calloc(sizeof(NR_DL_FRAME_PARMS),1);
- ru->frame_parms = (LTE_DL_FRAME_PARMS *)calloc(sizeof(LTE_DL_FRAME_PARMS),1);
- ru->if_timing = synch_to_ext_device;
- ru->num_gNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
- ru->gNB_list[i] = &RC.gNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];
-
- if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) {
- ru->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr));
- }
-
- if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) {
- if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) {
- ru->openair0_cfg.clock_source = internal;
- LOG_D(PHY, "RU clock source set as internal\n");
- } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) {
- ru->openair0_cfg.clock_source = external;
- LOG_D(PHY, "RU clock source set as external\n");
- } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) {
- ru->openair0_cfg.clock_source = gpsdo;
- LOG_D(PHY, "RU clock source set as gpsdo\n");
- } else {
- LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
- }
- } else {
- ru->openair0_cfg.clock_source = unset;
- }
-
- if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
- if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
- ru->if_south = REMOTE_IF5; //TBD: max value to avoid to call "ru" functions
- ru->function = gNodeB_3GPP;
- printf("Setting function for RU %d to gNodeB_3GPP\n",j);
- } else {
- }
-
- ru->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
- ru->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
- ru->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
-
- for (i=0; inum_bands; i++) ru->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
- } //strcmp(local_rf, "yes") == 0
- else {
- }
-
- ru->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
- ru->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
- ru->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
- ru->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
-
- if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) {
- ru->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt;
-
- for (i=0; inum_gNB; i++) {
- ru->bw_list[i] = (int32_t *)malloc16_clear((ru->nb_bfw)*sizeof(int32_t));
-
- for (int b=0; bnb_bfw; b++) ru->bw_list[i][b] = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].iptr[b];
- }
- }
-
- return;
-}
-
-// this is for RU with local RF unit
-void fill_rf_config(RU_t *ru, char *rf_config_file) {
- int i;
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- nfapi_nr_config_request_scf_t *gNB_config = &ru->gNB_list[0]->gNB_config; //tmp index
- openair0_config_t *cfg = &ru->openair0_cfg;
- int mu = gNB_config->ssb_config.scs_common.value;
- int N_RB = gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value;
- fp->threequarter_fs=threequarter_fs;
-
- if (mu == NR_MU_0) { //or if LTE
- if(N_RB == 100) {
- if (fp->threequarter_fs) {
- cfg->sample_rate=23.04e6;
- cfg->samples_per_frame = 230400;
- cfg->tx_bw = 10e6;
- cfg->rx_bw = 10e6;
- } else {
- cfg->sample_rate=30.72e6;
- cfg->samples_per_frame = 307200;
- cfg->tx_bw = 10e6;
- cfg->rx_bw = 10e6;
- }
- } else if(N_RB == 50) {
- cfg->sample_rate=15.36e6;
- cfg->samples_per_frame = 153600;
- cfg->tx_bw = 5e6;
- cfg->rx_bw = 5e6;
- } else if (N_RB == 25) {
- cfg->sample_rate=7.68e6;
- cfg->samples_per_frame = 76800;
- cfg->tx_bw = 2.5e6;
- cfg->rx_bw = 2.5e6;
- } else if (N_RB == 6) {
- cfg->sample_rate=1.92e6;
- cfg->samples_per_frame = 19200;
- cfg->tx_bw = 1.5e6;
- cfg->rx_bw = 1.5e6;
- } else AssertFatal(1==0,"Unknown N_RB %d\n",N_RB);
- } else if (mu == NR_MU_1) {
- if(N_RB == 273) {
- if (fp->threequarter_fs) {
- AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
- } else {
- cfg->sample_rate=122.88e6;
- cfg->samples_per_frame = 1228800;
- cfg->tx_bw = 100e6;
- cfg->rx_bw = 100e6;
- }
- } else if(N_RB == 217) {
- if (fp->threequarter_fs) {
- cfg->sample_rate=92.16e6;
- cfg->samples_per_frame = 921600;
- cfg->tx_bw = 80e6;
- cfg->rx_bw = 80e6;
- } else {
- cfg->sample_rate=122.88e6;
- cfg->samples_per_frame = 1228800;
- cfg->tx_bw = 80e6;
- cfg->rx_bw = 80e6;
- }
- } else if(N_RB == 106) {
- if (fp->threequarter_fs) {
- cfg->sample_rate=46.08e6;
- cfg->samples_per_frame = 460800;
- cfg->tx_bw = 40e6;
- cfg->rx_bw = 40e6;
- } else {
- cfg->sample_rate=61.44e6;
- cfg->samples_per_frame = 614400;
- cfg->tx_bw = 40e6;
- cfg->rx_bw = 40e6;
- }
- } else {
- AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu);
- }
- } else if (mu == NR_MU_3) {
- if (N_RB == 66) {
- cfg->sample_rate = 122.88e6;
- cfg->samples_per_frame = 1228800;
- cfg->tx_bw = 100e6;
- cfg->rx_bw = 100e6;
- } else if(N_RB == 32) {
- cfg->sample_rate=61.44e6;
- cfg->samples_per_frame = 614400;
- cfg->tx_bw = 50e6;
- cfg->rx_bw = 50e6;
- }
- } else {
- AssertFatal(0 == 1,"Numerology %d not supported for the moment\n",mu);
- }
-
- if (gNB_config->cell_config.frame_duplex_type.value==TDD)
- cfg->duplex_mode = duplex_mode_TDD;
- else //FDD
- cfg->duplex_mode = duplex_mode_FDD;
-
- cfg->Mod_id = 0;
- cfg->num_rb_dl=N_RB;
- cfg->tx_num_channels=ru->nb_tx;
- cfg->rx_num_channels=ru->nb_rx;
-
- for (i=0; inb_tx; i++) {
- if (ru->if_frequency == 0) {
- cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
- cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
- } else {
- cfg->tx_freq[i] = (double)ru->if_frequency;
- cfg->rx_freq[i] = (double)(ru->if_frequency+fp->ul_CarrierFreq-fp->dl_CarrierFreq);
- }
-
- cfg->tx_gain[i] = ru->att_tx;
- cfg->rx_gain[i] = ru->max_rxgain-ru->att_rx;
- cfg->configFilename = rf_config_file;
- printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n",
- i, cfg->tx_gain[i],
- cfg->rx_gain[i],
- cfg->tx_freq[i],
- cfg->rx_freq[i]);
- }
-}
-
-/* this function maps the RU tx and rx buffers to the available rf chains.
- Each rf chain is is addressed by the card number and the chain on the card. The
- rf_map specifies for each antenna port, on which rf chain the mapping should start. Multiple
- antennas are mapped to successive RF chains on the same card. */
-int setup_RU_buffers(RU_t *ru) {
- int i,j;
- int card,ant;
- //uint16_t N_TA_offset = 0;
- NR_DL_FRAME_PARMS *frame_parms;
- nfapi_nr_config_request_scf_t *config = &ru->config;
-
- if (ru) {
- frame_parms = ru->nr_frame_parms;
- printf("setup_RU_buffers: frame_parms = %p\n",frame_parms);
- } else {
- printf("ru pointer is NULL\n");
- return(-1);
- }
-
- int mu = config->ssb_config.scs_common.value;
- int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value;
-
- if (config->cell_config.frame_duplex_type.value == TDD) {
- int N_TA_offset = config->carrier_config.uplink_frequency.value < 6000000 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2
- double factor=1;
-
- switch (mu) {
- case 0: //15 kHz scs
- AssertFatal(N_TA_offset == 400,"scs_common 15kHz only for FR1\n");
-
- if (N_RB <= 25) factor = .25; // 7.68 Ms/s
- else if (N_RB <=50) factor = .5; // 15.36 Ms/s
- else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s
- else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s
- else AssertFatal(1==0,"Too many PRBS for mu=0\n");
-
- break;
-
- case 1: //30 kHz sc
- AssertFatal(N_TA_offset == 400,"scs_common 30kHz only for FR1\n");
-
- if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s
- else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s
-
- break;
-
- case 2: //60 kHz scs
- AssertFatal(1==0,"scs_common should not be 60 kHz\n");
- break;
-
- case 3: //120 kHz scs
- AssertFatal(N_TA_offset == 431,"scs_common 120kHz only for FR2\n");
- break;
-
- case 4: //240 kHz scs
- AssertFatal(1==0,"scs_common should not be 60 kHz\n");
-
- if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s
- else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s
- else AssertFatal(1==0,"N_RB %d is too big for curretn FR2 implementation\n",N_RB);
-
- break;
-
- if (N_RB == 100) ru->N_TA_offset = 624;
- else if (N_RB == 50) ru->N_TA_offset = 624/2;
- else if (N_RB == 25) ru->N_TA_offset = 624/4;
- }
-
- if (frame_parms->threequarter_fs == 1) factor = factor*.75;
-
- ru->N_TA_offset = (int)(N_TA_offset * factor);
- LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d)\n",ru->idx,ru->N_TA_offset,factor,
- config->carrier_config.uplink_frequency.value, N_RB);
- } else ru->N_TA_offset = 0;
-
- if (ru->openair0_cfg.mmapped_dma == 1) {
- // replace RX signal buffers with mmaped HW versions
- for (i=0; inb_rx; i++) {
- card = i/4;
- ant = i%4;
- printf("Mapping RU id %u, rx_ant %d, on card %d, chain %d\n",ru->idx,i,ru->rf_map.card+card, ru->rf_map.chain+ant);
- free(ru->common.rxdata[i]);
- ru->common.rxdata[i] = ru->openair0_cfg.rxbase[ru->rf_map.chain+ant];
- printf("rxdata[%d] @ %p\n",i,ru->common.rxdata[i]);
-
- for (j=0; j<16; j++) {
- printf("rxbuffer %d: %x\n",j,ru->common.rxdata[i][j]);
- ru->common.rxdata[i][j] = 16-j;
- }
- }
-
- for (i=0; inb_tx; i++) {
- card = i/4;
- ant = i%4;
- printf("Mapping RU id %u, tx_ant %d, on card %d, chain %d\n",ru->idx,i,ru->rf_map.card+card, ru->rf_map.chain+ant);
- free(ru->common.txdata[i]);
- ru->common.txdata[i] = ru->openair0_cfg.txbase[ru->rf_map.chain+ant];
- printf("txdata[%d] @ %p\n",i,ru->common.txdata[i]);
-
- for (j=0; j<16; j++) {
- printf("txbuffer %d: %x\n",j,ru->common.txdata[i][j]);
- ru->common.txdata[i][j] = 16-j;
- }
- }
- } else { // not memory-mapped DMA
- //nothing to do, everything already allocated in lte_init
- }
-
- return(0);
-}
-int rx_rf(int rxBufOffet, int nbSamples, int nb_rx, int32_t **rxdata, openair0_device *rfdevice, openair0_timestamp *HWtimeStamp) {
- void *rxp[nb_rx];
-
- for (int i=0; itrx_read_func(rfdevice,
- HWtimeStamp,
- rxp,
- nbSamples,
- nb_rx);
-
- if (rxs != nbSamples )
- LOG_E(PHY, "rx_rf: Asked for %d samples, got %d from USRP\n",nbSamples,rxs);
-
- return rxs;
-}
-
-void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
- RU_proc_t *proc = &ru->proc;
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
- int i,txsymb;
- int slot_type = nr_slot_select(cfg,frame,slot%fp->slots_per_frame);
- int prevslot_type = nr_slot_select(cfg,frame,(slot+(fp->slots_per_frame-1))%fp->slots_per_frame);
- int nextslot_type = nr_slot_select(cfg,frame,(slot+1)%fp->slots_per_frame);
- int sf_extension = 0; //sf_extension = ru->sf_extension;
- int siglen=fp->get_samples_per_slot(slot,fp);
- int flags=1;
-
- //nr_subframe_t SF_type = nr_slot_select(cfg,slot%fp->slots_per_frame);
- if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT || IS_SOFTMODEM_RFSIM) {
- if(slot_type == NR_MIXED_SLOT) {
- txsymb = 0;
-
- for(int symbol_count =0; symbol_counttdd_table.max_tdd_periodicity_list[slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0)
- txsymb++;
- }
-
- AssertFatal(txsymb>0,"illegal txsymb %d\n",txsymb);
-
- if(slot%(fp->slots_per_subframe/2))
- siglen = txsymb * (fp->ofdm_symbol_size + fp->nb_prefix_samples);
- else
- siglen = (fp->ofdm_symbol_size + fp->nb_prefix_samples0) + (txsymb - 1) * (fp->ofdm_symbol_size + fp->nb_prefix_samples);
-
- //+ ru->end_of_burst_delay;
- flags=3; // end of burst
- }
-
- if (cfg->cell_config.frame_duplex_type.value == TDD &&
- slot_type == NR_DOWNLINK_SLOT &&
- prevslot_type == NR_UPLINK_SLOT) {
- flags = 2; // start of burst
- }
-
- if (cfg->cell_config.frame_duplex_type.value == TDD &&
- slot_type == NR_DOWNLINK_SLOT &&
- nextslot_type == NR_UPLINK_SLOT) {
- flags = 3; // end of burst
- }
-
- if (fp->freq_range==nr_FR2) {
- // the beam index is written in bits 8-10 of the flags
- // bit 11 enables the gpio programming
- int beam=0;
-
- if (slot==0) beam = 11; //3 for boresight & 8 to enable
-
- /*
- if (slot==0 || slot==40) beam=0&8;
- if (slot==10 || slot==50) beam=1&8;
- if (slot==20 || slot==60) beam=2&8;
- if (slot==30 || slot==70) beam=3&8;
- */
- flags |= beam<<8;
- }
-
- void *txp[ru->nb_tx];
-
- for (i=0; inb_tx; i++)
- txp[i] = (void *)&ru->common.txdata[i][fp->get_samples_slot_timestamp(slot,fp,0)-sf_extension];
-
- // prepare tx buffer pointers
- unsigned int txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
- timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
- txp,
- siglen+sf_extension,
- ru->nb_tx,
- flags);
- LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, slot %d\n",ru->idx,
- (long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot);
- AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen);
- }
-}
-
-static void *ru_thread( void *param ) {
- RU_t *ru = (RU_t *)param;
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
- nr_dump_frame_parms(fp);
- AssertFatal(openair0_device_load(&ru->rfdevice,&ru->openair0_cfg)==0,"Cannot connect to local radio\n");
- AssertFatal(ru->rfdevice.trx_start_func(&ru->rfdevice) == 0,"Could not start the RF device\n");
- int64_t slot=-1;
- int64_t nextHWTSshouldBe=0, nextRxTSlogical=0;
- // weird globals, used in NR_IF_Module.c
- sf_ahead = (uint16_t) ceil((float)6/(0x01<numerology_index));
- sl_ahead = sf_ahead*fp->slots_per_subframe;
-
- // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
-
- while (!oai_exit) {
- int nextSlot=(slot+1)%fp->slots_per_frame;
- uint32_t samples_per_slot = fp->get_samples_per_slot(nextSlot,fp);
- int rxBuffOffset=fp->get_samples_slot_timestamp(nextSlot,fp,0);
- AssertFatal(rxBuffOffset + samples_per_slot <= fp->samples_per_frame, "Will read outside allocated buffer\n");
- int samples=fp->get_samples_per_slot(nextSlot,fp);
- openair0_timestamp HWtimeStamp=0; //for multi RU
- int rxs=rx_rf(rxBuffOffset,
- samples,
- ru->nb_rx,
- ru->common.rxdata,
- &ru->rfdevice,
- &HWtimeStamp);
- LOG_D(PHY,"Reading %d samples for slot %d\n",samples_per_slot,nextSlot);
-
- if ( HWtimeStamp != nextHWTSshouldBe)
- LOG_E(HW,"reading a stream must be continuous, %ld, %ld\n", HWtimeStamp, nextHWTSshouldBe);
-
- nextHWTSshouldBe=HWtimeStamp+rxs;
- ru->proc.timestamp_rx=nextRxTSlogical;
- nextRxTSlogical+=samples_per_slot;
- int64_t HW_to_logical_RxTSoffset=(int64_t)HWtimeStamp-(int64_t)ru->proc.timestamp_rx;
- ru->proc.frame_rx = (ru->proc.timestamp_rx / (fp->samples_per_subframe*10))&1023;
- uint32_t idx_sf = ru->proc.timestamp_rx / fp->samples_per_subframe;
- float offsetInSubframe=ru->proc.timestamp_rx % fp->samples_per_subframe;
- ru->proc.tti_rx = (idx_sf * fp->slots_per_subframe +
- lroundf(offsetInSubframe / fp->samples_per_slot0))%
- fp->slots_per_frame;
- LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, slot %d.%d / %d\n",
- ru->idx, 0,
- (unsigned long long int)ru->proc.timestamp_rx,
- (int)ru->ts_offset,ru->proc.frame_rx,ru->proc.tti_rx,ru->proc.tti_tx,fp->slots_per_frame);
- int slot_type = nr_slot_select(&ru->gNB_list[0]->gNB_config,ru->proc.frame_rx,ru->proc.tti_rx);
-
- if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
- nr_fep_full(ru,ru->proc.tti_rx);
-
- for (int aa=0; aanb_rx; aa++)
- memcpy((void *)RC.gNB[0]->common_vars.rxdataF[aa],
- (void *)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t));
-
- LOG_D(PHY, "rxdataF energy: %d\n", signal_energy(ru->common.rxdataF[0], fp->symbols_per_slot*fp->ofdm_symbol_size));
- }
-
- gNB_L1_proc_t *gNBproc=&RC.gNB[0][0].proc;
- gNB_L1_rxtx_proc_t *L1_proc = &gNBproc->L1_proc;
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- gNBproc->timestamp_rx = ru->proc.timestamp_rx;
- L1_proc->frame_rx = gNBproc->frame_rx = gNBproc->frame_prach = ru->proc.frame_rx =
- (ru->proc.timestamp_rx / (fp->samples_per_subframe*10))&1023;
- L1_proc->slot_rx = gNBproc->slot_rx = gNBproc->slot_prach =
- ru->proc.tti_rx; // computed before in caller function
- L1_proc->timestamp_tx = gNBproc->timestamp_tx = ru->proc.timestamp_tx =
- ru->proc.timestamp_rx +
- sf_ahead*fp->samples_per_subframe;
- L1_proc->frame_tx = gNBproc->frame_tx = ru->proc.frame_tx =
- (gNBproc->timestamp_tx / (fp->samples_per_subframe*10))&1023;
- L1_proc->slot_tx = ru->proc.tti_tx =
- (L1_proc->slot_rx + sl_ahead)%fp->slots_per_frame;
-
- if (ocp_rxtx(&RC.gNB[0][0],L1_proc) < 0)
- LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",RC.gNB[0][0].Mod_id,RC.gNB[0][0].CC_id);
-
- // do TX front-end processing if needed (precoding and/or IDFTs)
- //ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx);
- nr_feptx_prec(ru,ru->proc.frame_tx,ru->proc.tti_tx);
- // do OFDM with/without TX front-end processing if needed
- //ru->feptx_ofdm
- nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
-
- if (nr_slot_select(cfg,ru->proc.frame_tx, ru->proc.tti_tx ) != NR_UPLINK_SLOT) {
- int aa=0; // antenna 0 hardcoded
- NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
- nr_feptx0(ru,ru->proc.tti_tx,0,fp->symbols_per_slot,aa);
- int *txdata = &ru->common.txdata[aa][fp->get_samples_slot_timestamp(ru->proc.tti_tx,fp,0)];
- int slot_sizeF = (fp->ofdm_symbol_size)*
- ((NFAPI_CP_NORMAL == 1) ? 12 : 14);
- LOG_D(PHY,"feptx_ofdm (TXPATH): frame %d, slot %d: txp (time %ld) %d dB, txp (freq) %d dB\n",
- ru->proc.frame_tx,ru->proc.tti_tx,ru->proc.timestamp_tx,
- dB_fixed(signal_energy((int32_t *)txdata,fp->get_samples_per_slot(ru->proc.tti_tx,fp))),
- dB_fixed(signal_energy_nodc(ru->common.txdataF_BF[aa],2*slot_sizeF)));
- }
-
- // do outgoing fronthaul (south) if needed
- tx_rf(ru,ru->proc.frame_tx,ru->proc.tti_tx,ru->proc.timestamp_tx+HW_to_logical_RxTSoffset);
- slot++;
- }
-
- printf( "Exiting ru_thread \n");
- ru->rfdevice.trx_end_func(&ru->rfdevice);
- static int ru_thread_status = 0;
- return &ru_thread_status;
-}
-
-void launch_NR_RU(RU_t *ru, char *rf_config_file) {
- LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",
- RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs());
- LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
-
- for (int ru_id=0; ru_idrf_config_file = rf_config_file;
- ru->idx = ru_id;
- ru->ts_offset = 0;
- // use gNB_list[0] as a reference for RU frame parameters
- // NOTE: multiple CC_id are not handled here yet!
- LOG_D(PHY, "%s() RC.ru[%d].num_gNB:%d ru->gNB_list[0]:%p rf_config_file:%s\n",
- __FUNCTION__, ru_id, ru->num_gNB, ru->gNB_list[0], ru->rf_config_file);
- LOG_E(PHY,"ru->gNB_list ru->num_gNB hardcoded: one RU connected to carrier 0 of gNB 0\n");
- ru->gNB_list[0] = &RC.gNB[0][0];
- ru->num_gNB=1;
- LOG_I(PHY,"Copying frame parms from gNB in RC to ru %d and frame_parms in ru\n",ru->idx);
- RU_proc_t *proc = &ru->proc;
- threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "MainLoop", -1, OAI_PRIORITY_RT_MAX );
- }
-}
-
-void init_eNB_afterRU(void) {
- AssertFatal(false,"");
-}
-
-int main( int argc, char **argv ) {
- AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY),
- "[SOFTMODEM] Error, configuration module init failed\n");
- logInit();
-#ifndef PACKAGE_VERSION
-# define PACKAGE_VERSION "UNKNOWN"
-#endif
- LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
- set_latency_target();
- get_options ();
- get_common_options(SOFTMODEM_GNB_BIT );
- AssertFatal(!CONFIG_ISFLAGSET(CONFIG_ABORT),"Getting configuration failed\n");
- cpuf=get_cpu_freq_GHz();
- itti_init(TASK_MAX, tasks_info);
- set_taus_seed (0);
- init_opt();
- init_pdcp();
- init_main_gNB();
- init_gNB(true, wait_for_sync);
- /* Start the agent. If it is turned off in the configuration, it won't start */
- RCconfig_nr_flexran();
-
- for (int i = 0; i < RC.nb_nr_L1_inst; i++) {
- flexran_agent_start(i);
- }
-
- /*
- *nfapi stuff very buggy in 4G, not yet implemented in 5G
- */
- // init UE_PF_PO and mutex lock (paging from S1AP)
- pthread_mutex_init(&ue_pf_po_mutex, NULL);
- printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
- pthread_cond_init(&nfapi_sync_cond,NULL);
- pthread_mutex_init(&nfapi_sync_mutex, NULL);
- const char *nfapi_mode_str[] = {
- "MONOLITHIC", "PNF", "VNF",
- };
- AssertFatal(nfapi_mode < 3,"");
- printf("NFAPI MODE:%s\n", nfapi_mode_str[nfapi_mode]);
-
- if (nfapi_mode==NFAPI_MODE_VNF) // VNF
- wait_nfapi_init("main?");
-
- for (int i=0; iconfigured, "Remain threads to manage\n");
-
- printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
- config_sync_var=0;
-
- if (nfapi_mode==NFAPI_MODE_PNF) { // PNF
- wait_nfapi_init("main?");
- }
-
- printf("wait RUs\n");
- printf("ALL RUs READY!\n");
- printf("RC.nb_RU:%d\n", RC.nb_RU);
- // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
- printf("ALL RUs ready - init gNBs\n");
- LOG_E(PHY,"configuring RU from file, hardcoded one gNB for one RU, one carrier\n");
- RU_t ru= {0};
- OCPconfig_RU(&ru);
- ru.nr_frame_parms->threequarter_fs=threequarter_fs;
- fill_rf_config(&ru,ru.rf_config_file);
- init_gNB_phase2(&ru);
- memcpy((void *)ru.nr_frame_parms,&RC.gNB[0][0].frame_parms,sizeof(NR_DL_FRAME_PARMS));
- memcpy((void *)&ru.config,(void *)&RC.gNB[0]->gNB_config,sizeof(ru.config));
- AssertFatal(setup_RU_buffers(&ru)==0,"Inconsistent configuration");
- nr_phy_init_RU(&ru);
- init_gNB_proc(0); // only instance 0 (one gNB per process)
-
- if (RC.nb_RU >0) {
- printf("Initializing RU threads\n");
- launch_NR_RU(&ru, get_softmodem_params()->rf_config_file);
- }
-
- if (opp_enabled ==1) {
- pthread_t t;
- threadCreate(&t, process_stats_thread,
- (void *)NULL, "time_meas", -1, OAI_PRIORITY_RT_LOW);
- }
-
- if(IS_SOFTMODEM_DOSCOPE) {
- scopeParms_t tmp= {&argc, argv, &ru, RC.gNB[0]};
- load_softscope("nr",&tmp);
- }
-
- while(!oai_exit)
- sleep(1);
-
- logClean();
- printf("Bye.\n");
- return 0;
-}
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 16014c6024..1f73720e70 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -120,7 +120,6 @@ extern "C"
#define TIMING_SOURCE softmodem_params.timing_source
#define SEND_DMRSSYNC softmodem_params.send_dmrs_sync
#define USIM_TEST softmodem_params.usim_test
-#define USE_256QAM_TABLE softmodem_params.use_256qam_table
#define PRB_INTERPOLATION softmodem_params.prb_interpolation
#define NFAPI softmodem_params.nfapi
#define NSA softmodem_params.nsa
@@ -158,14 +157,13 @@ extern int usrp_tx_thread;
{"basicsim", CONFIG_HLP_RFSIM, PARAMFLAG_BOOL, uptr:&basicsim, defintval:0, TYPE_INT, 0}, \
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
- {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \
{"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
- {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \
+ {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0} \
}
#define CONFIG_HLP_NSA "Enable NSA mode \n"
@@ -250,7 +248,6 @@ typedef struct {
uint32_t timing_source;
int hw_timing_advance;
uint32_t send_dmrs_sync;
- int use_256qam_table;
int prb_interpolation;
uint8_t nfapi;
int nsa;
diff --git a/executables/transport_split.c b/executables/transport_split.c
index f380eb90e3..e7199637cc 100644
--- a/executables/transport_split.c
+++ b/executables/transport_split.c
@@ -156,7 +156,7 @@ int receiveSubFrame(UDPsock_t *sock, void *bufferZone, int bufferSize, uint16_t
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType) {
commonUDP_t *UDPheader=(commonUDP_t *)bufferZone ;
UDPheader->contentType=contentType;
- UDPheader->senderClock=rdtsc();
+ UDPheader->senderClock=rdtsc_oai();
int nbBlocks=UDPheader->nbBlocks;
int blockId=0;
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h
index 42b41ee11b..ba66daa9c0 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h
@@ -47,7 +47,9 @@
#define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03
#define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04
#define FAPI_NR_DL_CONFIG_TYPE_P_DLSCH 0x05
-#define FAPI_NR_DL_CONFIG_TYPES 0x05
+#define FAPI_NR_DL_CONFIG_TYPE_CSI_RS 0x06
+#define FAPI_NR_DL_CONFIG_TYPE_CSI_IM 0x07
+#define FAPI_NR_DL_CONFIG_TYPES 0x07
#define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
#define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
index dac75bd6ec..284ef22fc4 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
@@ -473,11 +473,53 @@ typedef struct {
fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_rel15;
} fapi_nr_dl_config_dlsch_pdu;
+
+typedef struct {
+ uint16_t bwp_size;//
+ uint16_t bwp_start;//
+ uint8_t subcarrier_spacing;//
+ uint8_t cyclic_prefix;//
+ uint16_t start_rb;
+ uint16_t nr_of_rbs;
+ uint8_t csi_type;//Value: 0:TRS 1:CSI-RS NZP 2:CSI-RS ZP
+ uint8_t row;//Row entry into the CSI Resource location table. [TS38.211, sec 7.4.1.5.3 and table 7.4.1.5.3-1] Value: 1-18
+ uint16_t freq_domain;//Value: Up to the 12 LSBs, actual size is determined by the Row parameter
+ uint8_t symb_l0;//The time domain location l0 and firstOFDMSymbolInTimeDomain Value: 0->13
+ uint8_t symb_l1;//
+ uint8_t cdm_type;
+ uint8_t freq_density;//The density field, p and comb offset (for dot5).0: dot5 (even RB), 1: dot5 (odd RB), 2: one, 3: three
+ uint16_t scramb_id;//ScramblingID of the CSI-RS [TS38.214, sec 5.2.2.3.1] Value: 0->1023
+} fapi_nr_dl_config_csirs_pdu_rel15_t;
+
+
+typedef struct {
+ uint16_t bwp_size;
+ uint16_t bwp_start;
+ uint8_t subcarrier_spacing;
+ uint16_t start_rb;
+ uint16_t nr_of_rbs;
+ uint8_t k_csiim[4];
+ uint8_t l_csiim[4];
+} fapi_nr_dl_config_csiim_pdu_rel15_t;
+
+
+typedef struct {
+ fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_rel15;
+} fapi_nr_dl_config_csirs_pdu;
+
+
+typedef struct {
+ fapi_nr_dl_config_csiim_pdu_rel15_t csiim_config_rel15;
+} fapi_nr_dl_config_csiim_pdu;
+
+
typedef struct {
uint8_t pdu_type;
union {
fapi_nr_dl_config_dci_pdu dci_config_pdu;
fapi_nr_dl_config_dlsch_pdu dlsch_config_pdu;
+ fapi_nr_dl_config_csirs_pdu csirs_config_pdu;
+ fapi_nr_dl_config_csiim_pdu csiim_config_pdu;
};
} fapi_nr_dl_config_request_pdu_t;
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index 371deba3f2..58d649d011 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -25,6 +25,7 @@
#include
#include "assertions.h"
#include "SIMULATION/TOOLS/sim.h"
+#include "common/utils/load_module_shlib.h"
#include "PHY/CODING/nrLDPC_extern.h"
//#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h"
@@ -118,15 +119,13 @@ int test_ldpc(short No_iteration,
//short test_input[block_length];
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
//short *c; //padded codeword
- unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS];
- unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS];
- unsigned char *test_input_bit;
+ unsigned char estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length];
+ memset(estimated_output, 0, sizeof(estimated_output));
unsigned char *channel_input[MAX_NUM_DLSCH_SEGMENTS];
- unsigned char *channel_output_uncoded[MAX_NUM_DLSCH_SEGMENTS];
unsigned char *channel_input_optim[MAX_NUM_DLSCH_SEGMENTS];
- double *channel_output;
- double *modulated_input[MAX_NUM_DLSCH_SEGMENTS];
- char *channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS];
+ //double channel_output[68 * 384];
+ double modulated_input[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
+ char channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
unsigned int i,j,trial=0;
short BG=0,nrows=0;//,ncols;
int no_punctured_columns,removed_bit;
@@ -155,24 +154,12 @@ int test_ldpc(short No_iteration,
// generate input block
for(j=0;j>(i&7);
- test_input_bit[i] = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments
- if (estimated_output_bit[j][i] != test_input_bit[i])
- {
+ unsigned char estoutputbit = (estimated_output[j][i/8]&(1<<(i&7)))>>(i&7);
+ unsigned char inputbit = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments
+ if (estoutputbit != inputbit)
*errors_bit = (*errors_bit) + 1;
- }
}
//if (*errors == 1000)
@@ -460,17 +441,8 @@ int test_ldpc(short No_iteration,
for(j=0;j0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", dci_est[0], dci_est[1], dci_est[2], dci_est[3]);
free(encoder_outputByte);
free(channel_output);
@@ -239,13 +245,13 @@ if (logFlag){
start_meas(&timeEncoder);
if (decoder_int16==1) {
- polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, currentPtr);
+ polar_encoder_fast((uint64_t *)testInput, encoderOutput, 0, 0, polarMessageType, testLength, aggregation_level);
//polar_encoder_fast((uint64_t*)testInput, (uint64_t*)encoderOutput,0,0,currentPtr);
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
if (polarMessageType == 0)
- polar_encoder(testInput, encoderOutput, currentPtr);
+ polar_encoder(testInput, encoderOutput, polarMessageType, testLength, aggregation_level);
else if (polarMessageType == 1)
- polar_encoder_dci(testInput, encoderOutput, currentPtr, rnti);
+ polar_encoder_dci(testInput, encoderOutput, rnti, polarMessageType, testLength, aggregation_level);
}
stop_meas(&timeEncoder);
@@ -276,19 +282,20 @@ if (logFlag){
start_meas(&timeDecoder);
if (decoder_int16==1) {
- decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, 0, currentPtr);
+ decoderState = polar_decoder_int16(channelOutput_int16, (uint64_t *)estimatedOutput, 0,
+ polarMessageType, testLength, aggregation_level);
} else { //0 --> PBCH, 1 --> DCI, -1 --> UCI
if (polarMessageType == 0) {
- decoderState = polar_decoder(channelOutput,
- estimatedOutput,
- currentPtr,
- decoderListSize);
+ decoderState = polar_decoder(channelOutput,
+ estimatedOutput,
+ decoderListSize,
+ polarMessageType, testLength, aggregation_level);
} else if (polarMessageType == 1) {
- decoderState = polar_decoder_dci(channelOutput,
- estimatedOutput,
- currentPtr,
- decoderListSize,
- rnti);
+ decoderState = polar_decoder_dci(channelOutput,
+ estimatedOutput,
+ decoderListSize,
+ rnti,
+ polarMessageType, testLength, aggregation_level);
}
}
stop_meas(&timeDecoder);
@@ -334,9 +341,9 @@ if (logFlag){
decoderState=0;
nBitError=0;
blockErrorState=0;
- memset(testInput,0,sizeof(uint32_t) * testArrayLength);
+ memset(testInput,0,sizeof(uint32_t) * realArrayLength);
memset(encoderOutput,0,sizeof(uint32_t) * coderArrayLength);
- memset(estimatedOutput,0,sizeof(uint32_t) * testArrayLength);
+ memset(estimatedOutput,0,sizeof(uint32_t) * realArrayLength);
}
//Calculate error statistics for the SNR.
diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h
index 99b6f75f93..b7b15b5d33 100644
--- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h
+++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h
@@ -31,7 +31,7 @@
#ifndef __NR_LDPC_TYPES__H__
#define __NR_LDPC_TYPES__H__
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "nrLDPCdecoder_defs.h"
// ==============================================================================
// TYPES
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c
index 69d2ac4972..d36398a13a 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c
@@ -33,7 +33,6 @@
#include
#include
#include
-#include
#include "assertions.h"
#include "common/utils/LOG/log.h"
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
index 76f92574ba..d5669fbbab 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
@@ -35,7 +35,6 @@
#include
#include
#include
-#include
#include "defs.h"
#include "assertions.h"
#include "openair1/PHY/CODING/nrLDPC_defs.h"
@@ -280,4 +279,4 @@ int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,int
int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp) {
return ldpc_encoder_orig(test_input[0],channel_input[0],Zc,Kb,block_length,BG,impp->gen_code);
-}
\ No newline at end of file
+}
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
index bef5b291dc..73c165a2c8 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
@@ -36,7 +36,7 @@
#include
#include "assertions.h"
#include "common/utils/LOG/log.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "defs.h"
#include "ldpc384_byte.c"
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
index 07062f6123..d05ced18c6 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
@@ -33,10 +33,9 @@
#include
#include
#include
-#include
#include "assertions.h"
#include "common/utils/LOG/log.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "openair1/PHY/CODING/nrLDPC_defs.h"
#include "ldpc_encode_parity_check.c"
#include "ldpc_generate_coefficient.c"
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
index 6fa9c5ff53..958ef5aca7 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
@@ -33,10 +33,9 @@
#include
#include
#include
-#include
#include "assertions.h"
#include "common/utils/LOG/log.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "openair1/PHY/CODING/nrLDPC_defs.h"
#include "ldpc_encode_parity_check.c"
#include "ldpc_generate_coefficient.c"
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
index 15d4481eb6..9ef8cbfe65 100644
--- a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
@@ -33,10 +33,9 @@
#include
#include
#include
-#include
#include "assertions.h"
#include "common/utils/LOG/log.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "openair1/PHY/CODING/nrLDPC_defs.h"
#include "ldpc_encode_parity_check.c"
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c b/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
index 461eb7d6f6..3a484ff991 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_crc_byte.c
@@ -29,12 +29,13 @@ uint8_t **crc24c_generator_matrix(uint16_t payloadSizeBits){
uint8_t crcPolynomialSize = 24;
uint8_t temp1[crcPolynomialSize], temp2[crcPolynomialSize];
- uint8_t **crc_generator_matrix = malloc(payloadSizeBits * sizeof(uint8_t *));
+ uint8_t **crc_generator_matrix = malloc(payloadSizeBits*sizeof(uint8_t *) + payloadSizeBits*crcPolynomialSize*sizeof(uint8_t));
if (crc_generator_matrix)
for (int i = 0; i < payloadSizeBits; i++)
- crc_generator_matrix[i] = malloc(crcPolynomialSize * sizeof(uint8_t));
+ crc_generator_matrix[i] = ((uint8_t*)&crc_generator_matrix[payloadSizeBits])+i*crcPolynomialSize;
- for (int i = 0; i < crcPolynomialSize; i++) crc_generator_matrix[payloadSizeBits-1][i]=crcPolynomialPattern[i+1];
+ for (int i = 0; i < crcPolynomialSize; i++)
+ crc_generator_matrix[payloadSizeBits-1][i]=crcPolynomialPattern[i+1];
for (int i = payloadSizeBits-2; i >= 0; i--){
for (int j = 0; j < crcPolynomialSize-1; j++) temp1[j]=crc_generator_matrix[i+1][j+1];
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
index 8fe115b23a..62ce034f59 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
@@ -39,19 +39,44 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "assertions.h"
+static inline void updateCrcChecksum2(int xlen,
+ int ylen,
+ uint8_t crcChecksum[xlen][ylen],
+ int gxlen,
+ int gylen,
+ uint8_t crcGen[gxlen][gylen],
+ uint8_t listSize,
+ uint32_t i2,
+ uint8_t len)
+{
+ for (uint8_t i = 0; i < listSize; i++) {
+ for (uint8_t j = 0; j < len; j++) {
+ crcChecksum[j][i+listSize] = ( (crcChecksum[j][i] + crcGen[i2][j]) % 2 );
+ }
+ }
+}
+
int8_t polar_decoder(double *input,
uint32_t *out,
- const t_nrPolar_params *polarParams,
- uint8_t listSize)
+ uint8_t listSize,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level
+ )
{
+ t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
//Assumes no a priori knowledge.
- uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
- uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
- uint8_t **llrUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
- double ***llr = nr_alloc_double_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
- uint8_t **crcChecksum = nr_alloc_uint8_2D_array(polarParams->crcParityBits, 2*listSize);
- double *pathMetric = malloc(sizeof(double)*(2*listSize));
- uint8_t *crcState = malloc(sizeof(uint8_t)*(2*listSize)); //0=False, 1=True
+ uint8_t bit[polarParams->N][polarParams->n+1][2*listSize];
+ memset(bit,0,sizeof bit);
+ uint8_t bitUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
+ memset(bitUpdated,0,sizeof bitUpdated);
+ uint8_t llrUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
+ memset(llrUpdated,0,sizeof llrUpdated);
+ double llr[polarParams->N][polarParams->n+1][2*listSize];
+ uint8_t crcChecksum[polarParams->crcParityBits][2*listSize];
+ memset(crcChecksum,0,sizeof crcChecksum);
+ double pathMetric[2*listSize];
+ uint8_t crcState[2*listSize]; //0=False, 1=True
for (int i=0; i<(2*listSize); i++) {
pathMetric[i] = 0;
@@ -63,13 +88,8 @@ int8_t polar_decoder(double *input,
bitUpdated[i][0]=((polarParams->information_bit_pattern[i]+1) % 2);
}
- uint8_t **extended_crc_generator_matrix = malloc(polarParams->K * sizeof(uint8_t *)); //G_P3
- uint8_t **tempECGM = malloc(polarParams->K * sizeof(uint8_t *)); //G_P2
-
- for (int i = 0; i < polarParams->K; i++) {
- extended_crc_generator_matrix[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
- tempECGM[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
- }
+ uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; //G_P3
+ uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; //G_P2
for (int i=0; ipayloadBits; i++) {
for (int j=0; jcrcParityBits; j++) {
@@ -102,7 +122,7 @@ int8_t polar_decoder(double *input,
}
}
- double *d_tilde = malloc(sizeof(double) * polarParams->N);
+ double d_tilde[polarParams->N];
nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
for (int j = 0; j < polarParams->N; j++) llr[j][polarParams->n][0]=d_tilde[j];
@@ -117,31 +137,33 @@ int8_t polar_decoder(double *input,
uint8_t listIndex[2*listSize], copyIndex;
for (uint16_t currentBit=0; currentBitN; currentBit++) {
- updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1));
+ updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n+1, 2*listSize, llr, llrUpdated, bit, bitUpdated);
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
- updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit);
+ updatePathMetric(pathMetric, currentListSize, 0, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr);
} else { //Information or CRC bit.
- updatePathMetric2(pathMetric, llr, currentListSize, currentBit);
+ updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr);
for (int i = 0; i < currentListSize; i++) {
- for (int j = 0; j < polarParams->N; j++) {
- for (int k = 0; k < (polarParams->n+1); k++) {
+ for (int j = 0; j < polarParams->N; j++) {
+ for (int k = 0; k < (polarParams->n+1); k++) {
bit[j][k][i+currentListSize]=bit[j][k][i];
llr[j][k][i+currentListSize]=llr[j][k][i];
}
- }
+ }
}
- for (int i = 0; i < currentListSize; i++) {
- bit[currentBit][0][i]=0;
- crcState[i+currentListSize]=crcState[i];
- }
+ for (int i = 0; i < currentListSize; i++) {
+ bit[currentBit][0][i]=0;
+ crcState[i+currentListSize]=crcState[i];
+ }
for (int i = currentListSize; i < 2*currentListSize; i++) bit[currentBit][0][i]=1;
bitUpdated[currentBit][0]=1;
- updateCrcChecksum2(crcChecksum, extended_crc_generator_matrix, currentListSize, nonFrozenBit, polarParams->crcParityBits);
+ updateCrcChecksum2(polarParams->crcParityBits, 2*listSize, crcChecksum,
+ polarParams->K, polarParams->crcParityBits, extended_crc_generator_matrix,
+ currentListSize, nonFrozenBit, polarParams->crcParityBits);
currentListSize*=2;
//Keep only the best "listSize" number of entries.
@@ -246,14 +268,7 @@ int8_t polar_decoder(double *input,
if (decoderIterationCheck==0) {
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
- free(d_tilde);
- free(pathMetric);
- free(crcState);
- nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
- nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
- nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
- free(tempECGM);
- return(-1);
+ polarReturn(-1);
}
nonFrozenBit++;
@@ -282,33 +297,34 @@ int8_t polar_decoder(double *input,
}
}
- free(d_tilde);
- free(pathMetric);
- free(crcState);
- nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
- nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
- nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
- nr_free_uint8_2D_array(extended_crc_generator_matrix, polarParams->K);
- nr_free_uint8_2D_array(tempECGM, polarParams->K);
/*
* Return bits.
*/
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
- return(0);
+
+ polarReturn 0;
}
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- const t_nrPolar_params *polarParams,
uint8_t listSize,
- uint16_t n_RNTI) {
- uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
- uint8_t **bitUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
- uint8_t **llrUpdated = nr_alloc_uint8_2D_array(polarParams->N, (polarParams->n+1)); //0=False, 1=True
- double ***llr = nr_alloc_double_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
- uint8_t **crcChecksum = nr_alloc_uint8_2D_array(polarParams->crcParityBits, 2*listSize);
- double *pathMetric = malloc(sizeof(double)*(2*listSize));
- uint8_t *crcState = malloc(sizeof(uint8_t)*(2*listSize)); //0=False, 1=True
+ uint16_t n_RNTI,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level ) {
+ t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
+
+ uint8_t bit[polarParams->N][polarParams->n+1][2*listSize];
+ memset(bit,0,sizeof bit);
+ uint8_t bitUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
+ memset(bitUpdated,0,sizeof bitUpdated);
+ uint8_t llrUpdated[polarParams->N][polarParams->n+1]; //0=False, 1=True
+ memset(llrUpdated,0,sizeof llrUpdated);
+ double llr[polarParams->N][polarParams->n+1][2*listSize];
+ uint8_t crcChecksum[polarParams->crcParityBits][2*listSize];
+ memset(crcChecksum,0,sizeof crcChecksum);
+ double pathMetric[2*listSize];
+ uint8_t crcState[2*listSize]; //0=False, 1=True
uint8_t extended_crc_scrambling_pattern[polarParams->crcParityBits];
for (int i=0; i<(2*listSize); i++) {
@@ -321,13 +337,8 @@ int8_t polar_decoder_dci(double *input,
bitUpdated[i][0]=((polarParams->information_bit_pattern[i]+1) % 2);
}
- uint8_t **extended_crc_generator_matrix = malloc(polarParams->K * sizeof(uint8_t *)); //G_P3: K-by-P
- uint8_t **tempECGM = malloc(polarParams->K * sizeof(uint8_t *)); //G_P2: K-by-P
-
- for (int i = 0; i < polarParams->K; i++) {
- extended_crc_generator_matrix[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
- tempECGM[i] = malloc(polarParams->crcParityBits * sizeof(uint8_t));
- }
+ uint8_t extended_crc_generator_matrix[polarParams->K][polarParams->crcParityBits]; //G_P3: K-by-P
+ uint8_t tempECGM[polarParams->K][polarParams->crcParityBits]; //G_P2: K-by-P
for (int i=0; ipayloadBits; i++) {
for (int j=0; jcrcParityBits; j++) {
@@ -366,17 +377,19 @@ int8_t polar_decoder_dci(double *input,
extended_crc_scrambling_pattern[i]=(n_RNTI>>(23-i))&1;
}
- double *d_tilde = malloc(sizeof(double) * polarParams->N);
+ double d_tilde[polarParams->N];
nr_polar_rate_matching(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
- for (int j = 0; j < polarParams->N; j++) llr[j][polarParams->n][0]=d_tilde[j];
+ for (int j = 0; j < polarParams->N; j++)
+ llr[j][polarParams->n][0]=d_tilde[j];
/*
* SCL polar decoder.
*/
for (int i=0; icrcParityBits; i++) {
- for (int j=0; jcrcParityBits; j++) crcChecksum[i][0]=crcChecksum[i][0]+polarParams->crc_generator_matrix[j][i];
+ for (int j=0; jcrcParityBits; j++)
+ crcChecksum[i][0]=crcChecksum[i][0]+polarParams->crc_generator_matrix[j][i];
crcChecksum[i][0]=(crcChecksum[i][0]%2);
}
@@ -388,12 +401,12 @@ int8_t polar_decoder_dci(double *input,
uint8_t listIndex[2*listSize], copyIndex;
for (uint16_t currentBit=0; currentBitN; currentBit++) {
- updateLLR(llr, llrUpdated, bit, bitUpdated, currentListSize, currentBit, 0, polarParams->N, (polarParams->n+1));
+ updateLLR(currentListSize, currentBit, 0, polarParams->N, polarParams->n+1, 2*listSize, llr, llrUpdated, bit, bitUpdated);
if (polarParams->information_bit_pattern[currentBit]==0) { //Frozen bit.
- updatePathMetric(pathMetric, llr, currentListSize, 0, currentBit);
+ updatePathMetric(pathMetric, currentListSize, 0, currentBit,polarParams->N, polarParams->n+1, 2*listSize, llr);
} else { //Information or CRC bit.
- updatePathMetric2(pathMetric, llr, currentListSize, currentBit);
+ updatePathMetric2(pathMetric, currentListSize, currentBit, polarParams->N, polarParams->n+1, 2*listSize, llr);
for (int i = 0; i < currentListSize; i++) {
for (int j = 0; j < polarParams->N; j++) {
@@ -412,7 +425,9 @@ int8_t polar_decoder_dci(double *input,
for (int i = currentListSize; i < 2*currentListSize; i++) bit[currentBit][0][i]=1;
bitUpdated[currentBit][0]=1;
- updateCrcChecksum2(crcChecksum, extended_crc_generator_matrix, currentListSize, nonFrozenBit, polarParams->crcParityBits);
+ updateCrcChecksum2(polarParams->crcParityBits, 2*listSize, crcChecksum,
+ polarParams->K, polarParams->crcParityBits, extended_crc_generator_matrix,
+ currentListSize, nonFrozenBit, polarParams->crcParityBits);
currentListSize*=2;
//Keep only the best "listSize" number of entries.
@@ -513,18 +528,12 @@ int8_t polar_decoder_dci(double *input,
}
}
- for (uint8_t i = 0; i < currentListSize; i++) decoderIterationCheck+=crcState[i];
+ for (uint8_t i = 0; i < currentListSize; i++)
+ decoderIterationCheck+=crcState[i];
if (decoderIterationCheck==0) {
//perror("[SCL polar decoder] All list entries have failed the CRC checks.");
- free(d_tilde);
- free(pathMetric);
- free(crcState);
- nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
- nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
- nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
- free(tempECGM);
- return(-1);
+ polarReturn -1;
}
nonFrozenBit++;
@@ -553,19 +562,12 @@ int8_t polar_decoder_dci(double *input,
}
}
- free(d_tilde);
- free(pathMetric);
- free(crcState);
- nr_free_uint8_3D_array(bit, polarParams->N, (polarParams->n+1));
- nr_free_double_3D_array(llr, polarParams->N, (polarParams->n+1));
- nr_free_uint8_2D_array(crcChecksum, polarParams->crcParityBits);
- nr_free_uint8_2D_array(extended_crc_generator_matrix, polarParams->K);
- nr_free_uint8_2D_array(tempECGM, polarParams->K);
/*
* Return bits.
*/
nr_byte2bit_uint8_32(polarParams->nr_polar_A, polarParams->payloadBits, out);
- return(0);
+
+ polarReturn 0;
}
void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
@@ -604,8 +606,11 @@ void init_polar_deinterleaver_table(t_nrPolar_params *polarParams) {
uint32_t polar_decoder_int16(int16_t *input,
uint64_t *out,
uint8_t ones_flag,
- const t_nrPolar_params *polarParams)
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level )
{
+ t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, true);
int16_t d_tilde[polarParams->N];// = malloc(sizeof(double) * polarParams->N);
nr_polar_rate_matching_int16(input, d_tilde, polarParams->rate_matching_pattern, polarParams->K, polarParams->N, polarParams->encoderLength);
@@ -702,5 +707,6 @@ uint32_t polar_decoder_int16(int16_t *input,
rxcrc,polarParams->payloadBits);
#endif
out[0]=Ar;
- return(crc^rxcrc);
+
+ polarReturn crc^rxcrc;
}
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
index 42d500ae86..b201db2ba6 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoding_tools.c
@@ -36,51 +36,25 @@
//#define DEBUG_NEW_IMPL 1
-void updateLLR(double ***llr,
- uint8_t **llrU,
- uint8_t ***bit,
- uint8_t **bitU,
- uint8_t listSize,
- uint16_t row,
- uint16_t col,
- uint16_t xlen,
- uint8_t ylen)
-{
- uint16_t offset = (xlen/(pow(2,(ylen-col-1))));
- for (uint8_t i=0; i= offset ) {
- if(bitU[row-offset][col]==0) updateBit(bit, bitU, listSize, (row-offset), col, xlen, ylen);
- if(llrU[row-offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row-offset), (col+1), xlen, ylen);
- if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen);
- llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i];
- } else {
- if(llrU[row][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, row, (col+1), xlen, ylen);
- if(llrU[row+offset][col+1]==0) updateLLR(llr, llrU, bit, bitU, listSize, (row+offset), (col+1), xlen, ylen);
- computeLLR(llr, row, col, i, offset);
- }
- }
- llrU[row][col]=1;
- // printf("LLR (a %f, b %f): llr[%d][%d] %f\n",32*a,32*b,col,row,32*llr[col][row]);
-}
-
-void updateBit(uint8_t ***bit,
- uint8_t **bitU,
- uint8_t listSize,
- uint16_t row,
- uint16_t col,
- uint16_t xlen,
- uint8_t ylen)
+static inline void updateBit(uint8_t listSize,
+ uint16_t row,
+ uint16_t col,
+ uint16_t xlen,
+ uint8_t ylen,
+ int zlen,
+ uint8_t bit[xlen][ylen][zlen],
+ uint8_t bitU[xlen][ylen])
{
uint16_t offset = ( xlen/(pow(2,(ylen-col))) );
for (uint8_t i=0; i= offset ) {
- if (bitU[row][col-1]==0) updateBit(bit, bitU, listSize, row, (col-1), xlen, ylen);
+ if (bitU[row][col-1]==0) updateBit(listSize, row, (col-1), xlen, ylen, zlen, bit, bitU);
bit[row][col][i] = bit[row][col-1][i];
} else {
- if (bitU[row][col-1]==0) updateBit(bit, bitU, listSize, row, (col-1), xlen, ylen);
- if (bitU[row+offset][col-1]==0) updateBit(bit, bitU, listSize, (row+offset), (col-1), xlen, ylen);
+ if (bitU[row][col-1]==0) updateBit(listSize, row, (col-1), xlen, ylen, zlen, bit, bitU);
+ if (bitU[row+offset][col-1]==0) updateBit(listSize, (row+offset), (col-1), xlen, ylen, zlen, bit, bitU);
bit[row][col][i] = ( (bit[row][col-1][i]+bit[row+offset][col-1][i]) % 2);
}
}
@@ -88,11 +62,60 @@ void updateBit(uint8_t ***bit,
bitU[row][col]=1;
}
+static inline void computeLLR(uint16_t row,
+ uint16_t col,
+ uint8_t i,
+ uint16_t offset,
+ int xlen,
+ int ylen,
+ int zlen,
+ double llr[xlen][ylen][zlen])
+{
+ double a = llr[row][col + 1][i];
+ double b = llr[row + offset][col + 1][i];
+ llr[row][col][i] = log((exp(a + b) + 1) / (exp(a) + exp(b))); //eq. (8a)
+}
+
+
+void updateLLR(uint8_t listSize,
+ uint16_t row,
+ uint16_t col,
+ uint16_t xlen,
+ uint8_t ylen,
+ int zlen,
+ double llr[xlen][ylen][zlen],
+ uint8_t llrU[xlen][ylen],
+ uint8_t bit[xlen][ylen][zlen],
+ uint8_t bitU[xlen][ylen]
+ )
+{
+ uint16_t offset = (xlen/(pow(2,(ylen-col-1))));
+ for (uint8_t i=0; i= offset ) {
+ if(bitU[row-offset][col]==0) updateBit(listSize, (row-offset), col, xlen, ylen, zlen, bit, bitU);
+ if(llrU[row-offset][col+1]==0) updateLLR(listSize, (row-offset), (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU );
+ if(llrU[row][col+1]==0) updateLLR(listSize, row, (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU);
+ llr[row][col][i] = (pow((-1),bit[row-offset][col][i])*llr[row-offset][col+1][i]) + llr[row][col+1][i];
+ } else {
+ if(llrU[row][col+1]==0) updateLLR(listSize, row, (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU );
+ if(llrU[row+offset][col+1]==0) updateLLR(listSize, (row+offset), (col+1), xlen, ylen, zlen, llr, llrU, bit, bitU );
+ computeLLR(row, col, i, offset, xlen, ylen, zlen, llr);
+ }
+ }
+ llrU[row][col]=1;
+
+ // printf("LLR (a %f, b %f): llr[%d][%d] %f\n",32*a,32*b,col,row,32*llr[col][row]);
+}
+
void updatePathMetric(double *pathMetric,
- double ***llr,
- uint8_t listSize,
- uint8_t bitValue,
- uint16_t row)
+ uint8_t listSize,
+ uint8_t bitValue,
+ uint16_t row,
+ int xlen,
+ int ylen,
+ int zlen,
+ double llr[xlen][ylen][zlen]
+ )
{
int8_t multiplier = (2*bitValue) - 1;
for (uint8_t i=0; ileft)
+ delete_nodes(n->left);
+ if(n->right)
+ delete_nodes(n->right);
+ free(n->alpha);
+ free(n->beta);
+ free(n);
+ }
+}
+
+void delete_decoder_tree(t_nrPolar_params *polarParams) {
+ if (polarParams->tree.root)
+ delete_nodes(polarParams->tree.root);
+}
+
void build_decoder_tree(t_nrPolar_params *polarParams)
{
polarParams->tree.num_nodes=0;
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
index c2e9fd9381..79af311e45 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
@@ -79,9 +79,10 @@ typedef struct decoder_tree_t_s {
struct nrPolar_params {
//messageType: 0=PBCH, 1=DCI, -1=UCI
- int idx; //idx = (messageType * messageLength * aggregation_prime);
- struct nrPolar_params *nextPtr;
+ struct nrPolar_params *nextPtr __attribute__((aligned(16)));
+ bool busy;
+ uint32_t idx;
uint8_t n_max;
uint8_t i_il;
uint8_t i_seg;
@@ -138,34 +139,46 @@ typedef struct nrPolar_params t_nrPolar_params;
void polar_encoder(uint32_t *input,
uint32_t *output,
- const t_nrPolar_params *polarParams);
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level);
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- const t_nrPolar_params *polarParams,
- uint16_t n_RNTI);
+ uint16_t n_RNTI,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level);
void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- const t_nrPolar_params *polarParams);
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level);
int8_t polar_decoder(double *input,
uint32_t *output,
- const t_nrPolar_params *polarParams,
- uint8_t listSize);
+ uint8_t listSize,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level);
uint32_t polar_decoder_int16(int16_t *input,
uint64_t *out,
uint8_t ones_flag,
- const t_nrPolar_params *polarParams);
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level);
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- const t_nrPolar_params *polarParams,
uint8_t listSize,
- uint16_t n_RNTI);
+ uint16_t n_RNTI,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level);
void generic_polar_decoder(const t_nrPolar_params *pp,
decoder_node_t *node);
@@ -183,13 +196,12 @@ void build_decoder_tree(t_nrPolar_params *pp);
void build_polar_tables(t_nrPolar_params *polarParams);
void init_polar_deinterleaver_table(t_nrPolar_params *polarParams);
-void nr_polar_print_polarParams(t_nrPolar_params *polarParams);
+void nr_polar_print_polarParams(void);
t_nrPolar_params *nr_polar_params (int8_t messageType,
uint16_t messageLength,
uint8_t aggregation_level,
- int decoder_flag,
- t_nrPolar_params **polarList_ext);
+ int decoder_flag);
uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level);
@@ -278,34 +290,6 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(uint8_t *matrix1,
uint16_t row,
uint16_t col);
-uint8_t ***nr_alloc_uint8_3D_array(uint16_t xlen,
- uint16_t ylen,
- uint16_t zlen);
-
-uint8_t **nr_alloc_uint8_2D_array(uint16_t xlen,
- uint16_t ylen);
-
-double ***nr_alloc_double_3D_array(uint16_t xlen,
- uint16_t ylen,
- uint16_t zlen);
-
-double **nr_alloc_double_2D_array(uint16_t xlen,
- uint16_t ylen);
-
-void nr_free_double_3D_array(double ***input,
- uint16_t xlen,
- uint16_t ylen);
-
-void nr_free_double_2D_array(double **input,
- uint16_t xlen);
-
-void nr_free_uint8_3D_array(uint8_t ***input,
- uint16_t xlen,
- uint16_t ylen);
-
-void nr_free_uint8_2D_array(uint8_t **input,
- uint16_t xlen);
-
void nr_sort_asc_double_1D_array_ind(double *matrix,
uint8_t *ind,
uint8_t len);
@@ -316,52 +300,33 @@ void nr_sort_asc_int16_1D_array_ind(int32_t *matrix,
void nr_free_double_2D_array(double **input, uint16_t xlen);
-void updateLLR(double ***llr,
- uint8_t **llrU,
- uint8_t ***bit,
- uint8_t **bitU,
- uint8_t listSize,
- uint16_t row,
- uint16_t col,
- uint16_t xlen,
- uint8_t ylen);
-
-void updateBit(uint8_t ***bit,
- uint8_t **bitU,
- uint8_t listSize,
- uint16_t row,
- uint16_t col,
- uint16_t xlen,
- uint8_t ylen);
-
+void updateLLR(uint8_t listSize,
+ uint16_t row,
+ uint16_t col,
+ uint16_t xlen,
+ uint8_t ylen,
+ int zlen,
+ double llr[xlen][ylen][zlen],
+ uint8_t llrU[xlen][ylen],
+ uint8_t bit[xlen][ylen][zlen],
+ uint8_t bitU[xlen][ylen]
+ );
void updatePathMetric(double *pathMetric,
- double ***llr,
- uint8_t listSize,
- uint8_t bitValue,
- uint16_t row);
-
+ uint8_t listSize,
+ uint8_t bitValue,
+ uint16_t row,
+ int xlen,
+ int ylen,
+ int zlen,
+ double llr[xlen][ylen][zlen]
+ );
void updatePathMetric2(double *pathMetric,
- double ***llr,
- uint8_t listSize,
- uint16_t row);
-
-void computeLLR(double ***llr,
- uint16_t row,
- uint16_t col,
- uint8_t i,
- uint16_t offset);
-
-void updateCrcChecksum(uint8_t **crcChecksum,
- uint8_t **crcGen,
- uint8_t listSize,
- uint32_t i2,
- uint8_t len);
-
-void updateCrcChecksum2(uint8_t **crcChecksum,
- uint8_t **crcGen,
- uint8_t listSize,
- uint32_t i2,
- uint8_t len);
+ uint8_t listSize,
+ uint16_t row,
+ int xlen,
+ int ylen,
+ int zlen,
+ double llr[xlen][ylen][zlen]);
//Also nr_polar_rate_matcher
static inline void nr_polar_interleaver(uint8_t *input,
@@ -379,5 +344,13 @@ static inline void nr_polar_deinterleaver(uint8_t *input,
{
for (int i=0; ibusy=false; \
+pthread_mutex_unlock(&PolarListMutex); \
+return
#endif
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
index 1dfaed8b94..4cba3fe078 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
@@ -43,7 +43,10 @@
void polar_encoder(uint32_t *in,
uint32_t *out,
- const t_nrPolar_params *polarParams) {
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level) {
+ t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH
/*
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<payloadBits);
@@ -57,10 +60,10 @@ void polar_encoder(uint32_t *in,
*/
//Calculate CRC.
nr_matrix_multiplication_uint8_1D_uint8_2D(polarParams->nr_polar_A,
- polarParams->crc_generator_matrix,
- polarParams->nr_polar_crc,
- polarParams->payloadBits,
- polarParams->crcParityBits);
+ polarParams->crc_generator_matrix,
+ polarParams->nr_polar_crc,
+ polarParams->payloadBits,
+ polarParams->crcParityBits);
for (uint8_t i = 0; i < polarParams->crcParityBits; i++)
polarParams->nr_polar_crc[i] = (polarParams->nr_polar_crc[i] % 2);
@@ -150,12 +153,19 @@ void polar_encoder(uint32_t *in,
#endif
nr_byte2bit_uint8_32(polarParams->nr_polar_E, polarParams->encoderLength, out);
+
+ polarReturn;
+
}
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- const t_nrPolar_params *polarParams,
- uint16_t n_RNTI) {
+ uint16_t n_RNTI,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level) {
+ t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
+
#ifdef DEBUG_POLAR_ENCODER_DCI
printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]);
#endif
@@ -249,6 +259,7 @@ void polar_encoder_dci(uint32_t *in,
printf("\n[polar_encoder_dci] out: ");
for (int i = 0; i < outputInd; i++) printf("[%d]->0x%08x\t", i, out[i]);
#endif
+ polarReturn;
}
static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
@@ -334,7 +345,7 @@ void build_polar_tables(t_nrPolar_params *polarParams) {
AssertFatal(polarParams->N==512 || polarParams->N==256 || polarParams->N==128,"N = %d, not done yet\n",polarParams->N);
// build G bit vectors for information bit positions and convert the bit as bytes tables in nr_polar_kronecker_power_matrices.c to 64 bit packed vectors.
// keep only rows of G which correspond to information/crc bits
- polarParams->G_N_tab = (uint64_t **)malloc((polarParams->K + polarParams->n_pc) * sizeof(int64_t *));
+ polarParams->G_N_tab = (uint64_t **)calloc((polarParams->K + polarParams->n_pc),sizeof(int64_t *));
int k=0;
for (int i=0; iN; i++) {
@@ -418,11 +429,14 @@ void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- const t_nrPolar_params *polarParams) {
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level) {
+
+ t_nrPolar_params *polarParams=nr_polar_params(messageType, messageLength, aggregation_level, false);
// AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
- uint64_t B[4]= {0,0,0,0},Cprime[4]= {0,0,0,0};
int bitlen = polarParams->payloadBits;
// append crc
AssertFatal(bitlen<129,"support for payloads <= 128 bits\n");
@@ -451,9 +465,12 @@ void polar_encoder_fast(uint64_t *A,
A32_flip[1+offset]=((uint8_t *)&Aprime)[2];
A32_flip[2+offset]=((uint8_t *)&Aprime)[1];
A32_flip[3+offset]=((uint8_t *)&Aprime)[0];
- if (polarParams->crcParityBits == 24) tcrc = (uint64_t)(((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)))&0xffffff);
- else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)(((crcmask^(crc11(A32_flip,bitlen)>>21)))&0x7ff);
- else if (polarParams->crcParityBits == 6) tcrc = (uint64_t)(((crcmask^(crc6(A32_flip,bitlen)>>26)))&0x3f);
+ if (polarParams->crcParityBits == 24)
+ tcrc = (uint64_t)(((crcmask^(crc24c(A32_flip,8*offset+bitlen)>>8)))&0xffffff);
+ else if (polarParams->crcParityBits == 11)
+ tcrc = (uint64_t)(((crcmask^(crc11(A32_flip,bitlen)>>21)))&0x7ff);
+ else if (polarParams->crcParityBits == 6)
+ tcrc = (uint64_t)(((crcmask^(crc6(A32_flip,bitlen)>>26)))&0x3f);
} else if (bitlen<=64) {
uint8_t A64_flip[8+offset];
if (ones_flag) {
@@ -470,8 +487,10 @@ void polar_encoder_fast(uint64_t *A,
A64_flip[5+offset]=((uint8_t *)&Aprime)[2];
A64_flip[6+offset]=((uint8_t *)&Aprime)[1];
A64_flip[7+offset]=((uint8_t *)&Aprime)[0];
- if (polarParams->crcParityBits == 24) tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)))&0xffffff;
- else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)((crcmask^(crc11(A64_flip,bitlen)>>21)))&0x7ff;
+ if (polarParams->crcParityBits == 24)
+ tcrc = (uint64_t)((crcmask^(crc24c(A64_flip,8*offset+bitlen)>>8)))&0xffffff;
+ else if (polarParams->crcParityBits == 11)
+ tcrc = (uint64_t)((crcmask^(crc11(A64_flip,bitlen)>>21)))&0x7ff;
}
else if (bitlen<=128) {
uint8_t A128_flip[16+offset];
@@ -481,38 +500,37 @@ void polar_encoder_fast(uint64_t *A,
A128_flip[2] = 0xff;
}
uint128_t Aprime= (uint128_t)(((uint128_t)*A)<<(128-bitlen));
- A128_flip[0+offset]=((uint8_t*)&Aprime)[15]; A128_flip[1+offset]=((uint8_t*)&Aprime)[14];
- A128_flip[2+offset]=((uint8_t*)&Aprime)[13]; A128_flip[3+offset]=((uint8_t*)&Aprime)[12];
- A128_flip[4+offset]=((uint8_t*)&Aprime)[11]; A128_flip[5+offset]=((uint8_t*)&Aprime)[10];
- A128_flip[6+offset] =((uint8_t*)&Aprime)[9]; A128_flip[7+offset] =((uint8_t*)&Aprime)[8];
- A128_flip[8+offset] =((uint8_t*)&Aprime)[7]; A128_flip[9+offset] =((uint8_t*)&Aprime)[6];
- A128_flip[10+offset]=((uint8_t*)&Aprime)[5]; A128_flip[11+offset]=((uint8_t*)&Aprime)[4];
- A128_flip[12+offset]=((uint8_t*)&Aprime)[3]; A128_flip[13+offset]=((uint8_t*)&Aprime)[2];
- A128_flip[14+offset]=((uint8_t*)&Aprime)[1]; A128_flip[15+offset]=((uint8_t*)&Aprime)[0];
- if (polarParams->crcParityBits == 24) tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)))&0xffffff;
- else if (polarParams->crcParityBits == 11) tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff;
+ for (int i=0; i<16 ; i++)
+ A128_flip[i+offset]=((uint8_t*)&Aprime)[15-i];
+ if (polarParams->crcParityBits == 24)
+ tcrc = (uint64_t)((crcmask^(crc24c(A128_flip,8*offset+bitlen)>>8)))&0xffffff;
+ else if (polarParams->crcParityBits == 11)
+ tcrc = (uint64_t)((crcmask^(crc11(A128_flip,bitlen)>>21)))&0x7ff;
}
int n;
// this is number of quadwords in the bit string
- int quadwlen = (polarParams->K>>6);
-
- if ((polarParams->K&63) > 0) quadwlen++;
+ int quadwlen = (polarParams->K+63)/64;
// Create the B bit string as
// 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1, p_0, p_1, ..., p_{N_parity-1}
//??? b_{N'-1} b_{N'-2} ... b_{N'-A} b_{N'-A-1} ... b_{N'-A-Nparity} = a_{N-1} a_{N-2} ... a_{N-A} p_{N_parity-1} ... p_0
-
- for (n=0; ncrcParityBits) | tcrc;
- else B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
+ uint64_t B[4]= {0};
+ B[0] = (A[0] << polarParams->crcParityBits) | tcrc;
+ for (n=1; n n)
+ B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
+ else
+ B[n] = (A[n-1]>>(64-polarParams->crcParityBits));
uint8_t *Bbyte = (uint8_t *)B;
// for each byte of B, lookup in corresponding table for 64-bit word corresponding to that byte and its position
+ uint64_t Cprime[4]= {0};
if (polarParams->K<65)
Cprime[0] = polarParams->cprime_tab0[0][Bbyte[0]] |
- polarParams->cprime_tab0[1][Bbyte[1]] |
+ polarParams->cprime_tab0[1][Bbyte[1]] |
polarParams->cprime_tab0[2][Bbyte[2]] |
polarParams->cprime_tab0[3][Bbyte[3]] |
polarParams->cprime_tab0[4][Bbyte[4]] |
@@ -684,4 +702,7 @@ void polar_encoder_fast(uint64_t *A,
}
memset((void*)out,0,polarParams->encoderLength>>3);
polar_rate_matching(polarParams,(void *)D, out);
+
+ polarReturn;
+
}
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c
index c4c68e4e0e..ffeacb6be1 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_matrix_and_array.c
@@ -43,163 +43,6 @@ void nr_matrix_multiplication_uint8_1D_uint8_2D(uint8_t *matrix1, uint8_t **matr
}
}
-uint8_t ***nr_alloc_uint8_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) {
- uint8_t ***output;
- int i, j;
-
- if ((output = malloc(xlen * sizeof(*output))) == NULL) {
- perror("[nr_alloc_uint8_3D_array] Problem at 1D allocation");
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- output[i] = NULL;
-
-
- for (i = 0; i < xlen; i++)
- if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
- perror("[nr_alloc_uint8_3D_array] Problem at 2D allocation");
- nr_free_uint8_3D_array(output, xlen, ylen);
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- for (j = 0; j < ylen; j++)
- output[i][j] = NULL;
-
-
- for (i = 0; i < xlen; i++)
- for (j = 0; j < ylen; j++)
- if ((output[i][j] = malloc(zlen * sizeof *output[i][j])) == NULL) {
- perror("[nr_alloc_uint8_3D_array] Problem at 3D allocation");
- nr_free_uint8_3D_array(output, xlen, ylen);
- return NULL;
- }
-
- return output;
-}
-
-uint8_t **nr_alloc_uint8_2D_array(uint16_t xlen, uint16_t ylen) {
- uint8_t **output;
- int i, j;
-
- if ((output = malloc(xlen * sizeof(*output))) == NULL) {
- perror("[nr_alloc_uint8_2D_array] Problem at 1D allocation");
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- output[i] = NULL;
-
-
- for (i = 0; i < xlen; i++)
- if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
- perror("[nr_alloc_uint8_2D_array] Problem at 2D allocation");
- nr_free_uint8_2D_array(output, xlen);
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- for (j = 0; j < ylen; j++)
- output[i][j] = 0;
-
- return output;
-}
-
-double ***nr_alloc_double_3D_array(uint16_t xlen, uint16_t ylen, uint16_t zlen) {
- double ***output;
- int i, j;
-
- if ((output = malloc(xlen * sizeof(*output))) == NULL) {
- perror("[nr_alloc_double_3D_array] Problem at 1D allocation");
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- output[i] = NULL;
-
-
- for (i = 0; i < xlen; i++)
- if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
- perror("[nr_alloc_double_3D_array] Problem at 2D allocation");
- nr_free_double_3D_array(output, xlen, ylen);
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- for (j = 0; j < ylen; j++)
- output[i][j] = NULL;
-
-
- for (i = 0; i < xlen; i++)
- for (j = 0; j < ylen; j++)
- if ((output[i][j] = malloc(zlen * sizeof *output[i][j])) == NULL) {
- perror("[nr_alloc_double_3D_array] Problem at 3D allocation");
- nr_free_double_3D_array(output, xlen, ylen);
- return NULL;
- }
-
- return output;
-}
-
-double **nr_alloc_double_2D_array(uint16_t xlen, uint16_t ylen) {
- double **output;
- int i, j;
-
- if ((output = malloc(xlen * sizeof(*output))) == NULL) {
- perror("[nr_alloc_double_3D_array] Problem at 1D allocation");
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- output[i] = NULL;
-
-
- for (i = 0; i < xlen; i++)
- if ((output[i] = malloc(ylen * sizeof *output[i])) == NULL) {
- perror("[nr_alloc_double_2D_array] Problem at 2D allocation");
- nr_free_double_2D_array(output, xlen);
- return NULL;
- }
- for (i = 0; i < xlen; i++)
- for (j = 0; j < ylen; j++)
- output[i][j] = 0;
-
-
- return output;
-}
-
-void nr_free_double_3D_array(double ***input, uint16_t xlen, uint16_t ylen) {
- int i, j;
-
- for (i = 0; i < xlen; i++) {
- for (j = 0; j < ylen; j++) {
- free(input[i][j]);
- }
- free(input[i]);
- }
- free(input);
-}
-
-void nr_free_double_2D_array(double **input, uint16_t xlen) {
- int i;
-
- for (i = 0; i < xlen; i++) {
- free(input[i]);
- }
- free(input);
-}
-
-void nr_free_uint8_3D_array(uint8_t ***input, uint16_t xlen, uint16_t ylen) {
- int i, j;
-
- for (i = 0; i < xlen; i++) {
- for (j = 0; j < ylen; j++) {
- free(input[i][j]);
- }
- free(input[i]);
- }
- free(input);
-}
-
-void nr_free_uint8_2D_array(uint8_t **input, uint16_t xlen) {
- for (int i = 0; i < xlen; i++) free(input[i]);
- free(input);
-}
-
// Modified Bubble Sort.
void nr_sort_asc_double_1D_array_ind(double *matrix, uint8_t *ind, uint8_t len) {
int swaps;
diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c
index f6a700117d..38a1ae86ae 100644
--- a/openair1/PHY/CODING/nr_polar_init.c
+++ b/openair1/PHY/CODING/nr_polar_init.c
@@ -33,178 +33,236 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#include "PHY/NR_TRANSPORT/nr_dci.h"
+#define PolarKey ((messageType<<24)|(messageLength<<8)|aggregation_level)
+static t_nrPolar_params * PolarList=NULL;
+pthread_mutex_t PolarListMutex=PTHREAD_MUTEX_INITIALIZER;
+
static int intcmp(const void *p1,const void *p2) {
return(*(int16_t *)p1 > *(int16_t *)p2);
}
-static void nr_polar_init(t_nrPolar_params * *polarParams,
- int8_t messageType,
+static void nr_polar_delete_list(t_nrPolar_params * polarParams) {
+ if (!polarParams)
+ return;
+ if (polarParams->nextPtr)
+ nr_polar_delete_list(polarParams->nextPtr);
+
+ delete_decoder_tree(polarParams);
+ //From build_polar_tables()
+ for (int k=0; k < polarParams->K + polarParams->n_pc; k++)
+ if (polarParams->G_N_tab[k])
+ free(polarParams->G_N_tab[k]);
+ free(polarParams->G_N_tab);
+ free(polarParams->rm_tab);
+ if (polarParams->crc_generator_matrix)
+ free(polarParams->crc_generator_matrix);
+ //polar_encoder vectors:
+ free(polarParams->nr_polar_crc);
+ free(polarParams->nr_polar_aPrime);
+ free(polarParams->nr_polar_APrime);
+ free(polarParams->nr_polar_D);
+ free(polarParams->nr_polar_E);
+ //Polar Coding vectors
+ free(polarParams->nr_polar_U);
+ free(polarParams->nr_polar_CPrime);
+ free(polarParams->nr_polar_B);
+ free(polarParams->nr_polar_A);
+ free(polarParams->interleaving_pattern);
+ free(polarParams->deinterleaving_pattern);
+ free(polarParams->rate_matching_pattern);
+ free(polarParams->information_bit_pattern);
+ free(polarParams->Q_I_N);
+ free(polarParams->Q_F_N);
+ free(polarParams->Q_PC_N);
+ free(polarParams->channel_interleaver_pattern);
+ free(polarParams);
+}
+
+static void nr_polar_delete(void) {
+ pthread_mutex_lock(&PolarListMutex);
+ nr_polar_delete_list(PolarList);
+ PolarList=NULL;
+ pthread_mutex_unlock(&PolarListMutex);
+}
+
+t_nrPolar_params * nr_polar_params(int8_t messageType,
uint16_t messageLength,
uint8_t aggregation_level,
int decoder_flag) {
- t_nrPolar_params *currentPtr = *polarParams;
- uint16_t aggregation_prime = (messageType >= 2) ? aggregation_level : nr_polar_aggregation_prime(aggregation_level);
-
+ // The lock is weak, because we never delete in the list, only at exit time
+ // therefore, returning t_nrPolar_params * from the list is safe for future usage
+ pthread_mutex_lock(&PolarListMutex);
+ if(!PolarList)
+ atexit(nr_polar_delete);
+
+ t_nrPolar_params *currentPtr = PolarList;
//Parse the list. If the node is already created, return without initialization.
while (currentPtr != NULL) {
//printf("currentPtr->idx %d, (%d,%d)\n",currentPtr->idx,currentPtr->payloadBits,currentPtr->encoderLength);
//LOG_D(PHY,"Looking for index %d\n",(messageType * messageLength * aggregation_prime));
- if (currentPtr->idx == (messageType * messageLength * aggregation_prime)) return;
- else currentPtr = currentPtr->nextPtr;
+ if (currentPtr->busy == false && currentPtr->idx == PolarKey ) {
+ currentPtr->busy=true;
+ pthread_mutex_unlock(&PolarListMutex);
+ if (decoder_flag && !currentPtr->tree.root)
+ build_decoder_tree(currentPtr);
+ return currentPtr ;
+ }
+ else
+ currentPtr = currentPtr->nextPtr;
}
// printf("currentPtr %p (polarParams %p)\n",currentPtr,polarParams);
//Else, initialize and add node to the end of the linked list.
t_nrPolar_params *newPolarInitNode = calloc(sizeof(t_nrPolar_params),1);
-
- if (newPolarInitNode != NULL) {
- // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime);
- newPolarInitNode->idx = (messageType * messageLength * aggregation_prime);
- newPolarInitNode->nextPtr = NULL;
- //printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level);
+ newPolarInitNode->busy=true;
+ pthread_mutex_unlock(&PolarListMutex);
- if (messageType == 0) { //PBCH
- newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX;
- newPolarInitNode->i_il = NR_POLAR_PBCH_I_IL;
- newPolarInitNode->i_seg = NR_POLAR_PBCH_I_SEG;
- newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC;
- newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
- newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL;
- newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
- newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
- newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
- newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
- newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P
- //printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength);
- } else if (messageType == 1) { //DCI
- newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
- newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
- newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG;
- newPolarInitNode->n_pc = NR_POLAR_DCI_N_PC;
- newPolarInitNode->n_pc_wm = NR_POLAR_DCI_N_PC_WM;
- newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL;
- newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS;
- newPolarInitNode->payloadBits = messageLength;
- newPolarInitNode->encoderLength = aggregation_level*108;
- newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
- newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
- //printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level);
- } else if (messageType == 2) { //UCI PUCCH2
- AssertFatal(aggregation_level>2,"Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n",aggregation_level);
- AssertFatal(messageLength>11,"Message length %d is too short for polar encoding of UCI\n",messageLength);
- newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX;
- newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL;
- newPolarInitNode->encoderLength = aggregation_level * 16;
+ AssertFatal(newPolarInitNode != NULL, "[nr_polar_init] New t_nrPolar_params * could not be created");
+
+ // LOG_D(PHY,"Setting new polarParams index %d, messageType %d, messageLength %d, aggregation_prime %d\n",(messageType * messageLength * aggregation_prime),messageType,messageLength,aggregation_prime);
+ newPolarInitNode->idx = PolarKey;
+ newPolarInitNode->nextPtr = NULL;
+ //printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level);
+
+ if (messageType == 0) { //PBCH
+ newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX;
+ newPolarInitNode->i_il = NR_POLAR_PBCH_I_IL;
+ newPolarInitNode->i_seg = NR_POLAR_PBCH_I_SEG;
+ newPolarInitNode->n_pc = NR_POLAR_PBCH_N_PC;
+ newPolarInitNode->n_pc_wm = NR_POLAR_PBCH_N_PC_WM;
+ newPolarInitNode->i_bil = NR_POLAR_PBCH_I_BIL;
+ newPolarInitNode->crcParityBits = NR_POLAR_PBCH_CRC_PARITY_BITS;
+ newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS;
+ newPolarInitNode->encoderLength = NR_POLAR_PBCH_E;
+ newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS;
+ newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P
+ //printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength);
+ } else if (messageType == 1) { //DCI
+ newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX;
+ newPolarInitNode->i_il = NR_POLAR_DCI_I_IL;
+ newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG;
+ newPolarInitNode->n_pc = NR_POLAR_DCI_N_PC;
+ newPolarInitNode->n_pc_wm = NR_POLAR_DCI_N_PC_WM;
+ newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL;
+ newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS;
+ newPolarInitNode->payloadBits = messageLength;
+ newPolarInitNode->encoderLength = aggregation_level*108;
+ newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS;
+ newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
+ //printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level);
+ } else if (messageType == 2) { //UCI PUCCH2
+ AssertFatal(aggregation_level>2,"Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n",aggregation_level);
+ AssertFatal(messageLength>11,"Message length %d is too short for polar encoding of UCI\n",messageLength);
+ newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX;
+ newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL;
+ newPolarInitNode->encoderLength = aggregation_level * 16;
- newPolarInitNode->i_seg = 0;
+ newPolarInitNode->i_seg = 0;
- if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088)||
- (messageLength >= 1013)) newPolarInitNode->i_seg = 1;
+ if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088)||
+ (messageLength >= 1013)) newPolarInitNode->i_seg = 1;
- newPolarInitNode->crcParityBits = 11;
- newPolarInitNode->n_pc = 0;
- newPolarInitNode->n_pc_wm = 0;
+ newPolarInitNode->crcParityBits = 11;
+ newPolarInitNode->n_pc = 0;
+ newPolarInitNode->n_pc_wm = 0;
- if (messageLength < 20) {
- newPolarInitNode->crcParityBits = 6;
- newPolarInitNode->n_pc = 3;
- if ((newPolarInitNode->encoderLength - messageLength - 6 + 3) < 193) newPolarInitNode->n_pc_wm = 1;
- }
-
-
-
- newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL;
-
- newPolarInitNode->payloadBits = messageLength;
- newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS;
- //newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
- //LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level);
- } else {
- AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType);
+ if (messageLength < 20) {
+ newPolarInitNode->crcParityBits = 6;
+ newPolarInitNode->n_pc = 3;
+ if ((newPolarInitNode->encoderLength - messageLength - 6 + 3) < 193) newPolarInitNode->n_pc_wm = 1;
}
- newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode.
- newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K,
- newPolarInitNode->encoderLength,
- newPolarInitNode->n_max);
- newPolarInitNode->n = log2(newPolarInitNode->N);
- newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n);
- //polar_encoder vectors:
- newPolarInitNode->nr_polar_crc = malloc(sizeof(uint8_t) * newPolarInitNode->crcParityBits);
- newPolarInitNode->nr_polar_aPrime = malloc(sizeof(uint8_t) * ((ceil((newPolarInitNode->payloadBits)/32.0)*4)+3));
- newPolarInitNode->nr_polar_APrime = malloc(sizeof(uint8_t) * newPolarInitNode->K);
- newPolarInitNode->nr_polar_D = malloc(sizeof(uint8_t) * newPolarInitNode->N);
- newPolarInitNode->nr_polar_E = malloc(sizeof(uint8_t) * newPolarInitNode->encoderLength);
- //Polar Coding vectors
- newPolarInitNode->nr_polar_U = malloc(sizeof(uint8_t) * newPolarInitNode->N); //Decoder: nr_polar_uHat
- newPolarInitNode->nr_polar_CPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_cHat
- newPolarInitNode->nr_polar_B = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_bHat
- newPolarInitNode->nr_polar_A = malloc(sizeof(uint8_t) * newPolarInitNode->payloadBits); //Decoder: nr_polar_aHat
- newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n);
- newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
- nr_polar_interleaving_pattern(newPolarInitNode->K,
- newPolarInitNode->i_il,
- newPolarInitNode->interleaving_pattern);
- newPolarInitNode->deinterleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
- for (int i=0; iK; i++)
- newPolarInitNode->deinterleaving_pattern[newPolarInitNode->interleaving_pattern[i]] = i;
- newPolarInitNode->rate_matching_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
- uint16_t *J = malloc(sizeof(uint16_t) * newPolarInitNode->N);
- nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern,
- J,
- nr_polar_subblock_interleaver_pattern,
- newPolarInitNode->K,
- newPolarInitNode->N,
- newPolarInitNode->encoderLength);
- newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N);
- newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc));
- newPolarInitNode->Q_F_N = malloc( sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value.
- newPolarInitNode->Q_PC_N = malloc( sizeof(int16_t) * (newPolarInitNode->n_pc));
+ newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL;
- for (int i = 0; i <= newPolarInitNode->N; i++)
- newPolarInitNode->Q_F_N[i] = -1; // Empty array.
-
- nr_polar_info_bit_pattern(newPolarInitNode->information_bit_pattern,
- newPolarInitNode->Q_I_N,
- newPolarInitNode->Q_F_N,
- J,
- newPolarInitNode->Q_0_Nminus1,
- newPolarInitNode->K,
- newPolarInitNode->N,
- newPolarInitNode->encoderLength,
- newPolarInitNode->n_pc);
- // sort the Q_I_N array in ascending order (first K positions)
- qsort((void *)newPolarInitNode->Q_I_N,newPolarInitNode->K,sizeof(int16_t),intcmp);
- newPolarInitNode->channel_interleaver_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
- nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern,
- newPolarInitNode->i_bil,
- newPolarInitNode->encoderLength);
- free(J);
- if (decoder_flag == 1) build_decoder_tree(newPolarInitNode);
- build_polar_tables(newPolarInitNode);
- init_polar_deinterleaver_table(newPolarInitNode);
- //printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
+ newPolarInitNode->payloadBits = messageLength;
+ newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS;
+ //newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P
+ //LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level);
} else {
- AssertFatal(1 == 0, "[nr_polar_init] New t_nrPolar_params * could not be created");
+ AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType);
}
- //Fixme: the list is not thread safe
- //The defect is not critical: we always append (never delete items) and adding two times the same is fine
- newPolarInitNode->nextPtr=*polarParams;
- *polarParams=newPolarInitNode;
- return;
+ newPolarInitNode->K = newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits; // Number of bits to encode.
+ newPolarInitNode->N = nr_polar_output_length(newPolarInitNode->K,
+ newPolarInitNode->encoderLength,
+ newPolarInitNode->n_max);
+ newPolarInitNode->n = log2(newPolarInitNode->N);
+ newPolarInitNode->G_N = nr_polar_kronecker_power_matrices(newPolarInitNode->n);
+ //polar_encoder vectors:
+ newPolarInitNode->nr_polar_crc = malloc(sizeof(uint8_t) * newPolarInitNode->crcParityBits);
+ newPolarInitNode->nr_polar_aPrime = malloc(sizeof(uint8_t) * ((ceil((newPolarInitNode->payloadBits)/32.0)*4)+3));
+ newPolarInitNode->nr_polar_APrime = malloc(sizeof(uint8_t) * newPolarInitNode->K);
+ newPolarInitNode->nr_polar_D = malloc(sizeof(uint8_t) * newPolarInitNode->N);
+ newPolarInitNode->nr_polar_E = malloc(sizeof(uint8_t) * newPolarInitNode->encoderLength);
+ //Polar Coding vectors
+ newPolarInitNode->nr_polar_U = malloc(sizeof(uint8_t) * newPolarInitNode->N); //Decoder: nr_polar_uHat
+ newPolarInitNode->nr_polar_CPrime = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_cHat
+ newPolarInitNode->nr_polar_B = malloc(sizeof(uint8_t) * newPolarInitNode->K); //Decoder: nr_polar_bHat
+ newPolarInitNode->nr_polar_A = malloc(sizeof(uint8_t) * newPolarInitNode->payloadBits); //Decoder: nr_polar_aHat
+ newPolarInitNode->Q_0_Nminus1 = nr_polar_sequence_pattern(newPolarInitNode->n);
+ newPolarInitNode->interleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
+ nr_polar_interleaving_pattern(newPolarInitNode->K,
+ newPolarInitNode->i_il,
+ newPolarInitNode->interleaving_pattern);
+ newPolarInitNode->deinterleaving_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->K);
+
+ for (int i=0; iK; i++)
+ newPolarInitNode->deinterleaving_pattern[newPolarInitNode->interleaving_pattern[i]] = i;
+
+ newPolarInitNode->rate_matching_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
+ uint16_t J[newPolarInitNode->N];
+ nr_polar_rate_matching_pattern(newPolarInitNode->rate_matching_pattern,
+ J,
+ nr_polar_subblock_interleaver_pattern,
+ newPolarInitNode->K,
+ newPolarInitNode->N,
+ newPolarInitNode->encoderLength);
+ newPolarInitNode->information_bit_pattern = malloc(sizeof(uint8_t) * newPolarInitNode->N);
+ newPolarInitNode->Q_I_N = malloc(sizeof(int16_t) * (newPolarInitNode->K + newPolarInitNode->n_pc));
+ newPolarInitNode->Q_F_N = malloc( sizeof(int16_t) * (newPolarInitNode->N + 1)); // Last element shows the final array index assigned a value.
+ newPolarInitNode->Q_PC_N = malloc( sizeof(int16_t) * (newPolarInitNode->n_pc));
+
+ for (int i = 0; i <= newPolarInitNode->N; i++)
+ newPolarInitNode->Q_F_N[i] = -1; // Empty array.
+
+ nr_polar_info_bit_pattern(newPolarInitNode->information_bit_pattern,
+ newPolarInitNode->Q_I_N,
+ newPolarInitNode->Q_F_N,
+ J,
+ newPolarInitNode->Q_0_Nminus1,
+ newPolarInitNode->K,
+ newPolarInitNode->N,
+ newPolarInitNode->encoderLength,
+ newPolarInitNode->n_pc);
+ // sort the Q_I_N array in ascending order (first K positions)
+ qsort((void *)newPolarInitNode->Q_I_N,newPolarInitNode->K,sizeof(int16_t),intcmp);
+ newPolarInitNode->channel_interleaver_pattern = malloc(sizeof(uint16_t) * newPolarInitNode->encoderLength);
+ nr_polar_channel_interleaver_pattern(newPolarInitNode->channel_interleaver_pattern,
+ newPolarInitNode->i_bil,
+ newPolarInitNode->encoderLength);
+ if (decoder_flag == 1)
+ build_decoder_tree(newPolarInitNode);
+ build_polar_tables(newPolarInitNode);
+ init_polar_deinterleaver_table(newPolarInitNode);
+ //printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
+
+ newPolarInitNode->nextPtr=PolarList;
+ PolarList=newPolarInitNode;
+ return newPolarInitNode;
}
-void nr_polar_print_polarParams(t_nrPolar_params *polarParams) {
+void nr_polar_print_polarParams() {
uint8_t i = 0;
- if (polarParams == NULL) {
+ if (PolarList == NULL) {
printf("polarParams is empty.\n");
} else {
+ t_nrPolar_params * polarParams=PolarList;
while (polarParams != NULL) {
- printf("polarParams[%d] = %d\n", i, polarParams->idx);
+ printf("polarParams[%d] = %d, %d, %d\n", i,
+ polarParams->idx>>24, (polarParams->idx>>8)&0xFFFF, polarParams->idx&0xFF);
polarParams = polarParams->nextPtr;
i++;
}
@@ -213,31 +271,6 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams) {
return;
}
-t_nrPolar_params *nr_polar_params (int8_t messageType,
- uint16_t messageLength,
- uint8_t aggregation_level,
- int decoding_flag,
- t_nrPolar_params **polarList_ext) {
- static t_nrPolar_params *polarList = NULL;
- nr_polar_init(polarList_ext != NULL ? polarList_ext : &polarList,
- messageType,messageLength,aggregation_level,decoding_flag);
- t_nrPolar_params *polarParams=polarList_ext != NULL ? *polarList_ext : polarList;
- const int tag=messageType * messageLength * (messageType>=2 ? aggregation_level : nr_polar_aggregation_prime(aggregation_level));
-
-
-
- while (polarParams != NULL) {
- // LOG_D(PHY,"nr_polar_params : tag %d (from nr_polar_init %d)\n",tag,polarParams->idx);
- if (polarParams->idx == tag)
- return polarParams;
-
- polarParams = polarParams->nextPtr;
- }
-
- AssertFatal(false,"Polar Init tables internal failure, no polarParams found\n");
- return NULL;
-}
-
uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level) {
if (aggregation_level == 0) return 0;
else if (aggregation_level == 1) return NR_POLAR_AGGREGATION_LEVEL_1_PRIME;
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index e6b6c82834..bf360d347a 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -242,37 +242,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
common_vars->debugBuff = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t)*100);
common_vars->debugBuff_sample_offset = 0;
-
- // Channel estimates for SRS
-/*
- for (UE_id=0; UE_idofdm_symbol_size );
- srs_vars[UE_id].srs_ch_estimates_time[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
- }
- } //UE_id
-*/
- /*generate_ul_ref_sigs_rx();
-
- init_ulsch_power_LUT();*/
-
-/*
- // SRS
- for (UE_id=0; UE_idofdm_symbol_size*sizeof(int32_t));
- }
-*/
// PRACH
prach_vars->prachF = (int16_t *)malloc16_clear( 1024*2*sizeof(int16_t) );
prach_vars->rxsigF = (int16_t **)malloc16_clear(Prx*sizeof(int16_t*));
- /*
- for (i=0;irxsigF[i] = (int16_t *)malloc16_clear( 1024*2*sizeof(int16_t) );
- }
- */
prach_vars->prach_ifft = (int32_t *)malloc16_clear(1024*2*sizeof(int32_t));
init_prach_list(gNB);
@@ -328,51 +300,102 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
{
NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms;
- NR_gNB_COMMON *const common_vars = &gNB->common_vars;
- NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars;
- /*LTE_eNB_SRS *const srs_vars = gNB->srs_vars;
- LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
- uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
- int Ptx=gNB->gNB_config.carrier_config.num_tx_ant.value;
+ const int Ptx = gNB->gNB_config.carrier_config.num_tx_ant.value;
+ const int Prx = gNB->gNB_config.carrier_config.num_rx_ant.value;
+ const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB()
+ const int n_buf = Prx * max_ul_mimo_layers;
+ uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
+ for (int slot = 0; slot < fp->slots_per_frame; slot++) {
+ for (int symb = 0; symb < fp->symbols_per_slot; symb++)
+ free_and_zero(pdcch_dmrs[slot][symb]);
+ free_and_zero(pdcch_dmrs[slot]);
+ }
+ free_and_zero(pdcch_dmrs);
+
+ uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs;
+ for (int slot = 0; slot < fp->slots_per_frame; slot++) {
+ for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
+ for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
+ free_and_zero(pdsch_dmrs[slot][symb][q]);
+ free_and_zero(pdsch_dmrs[slot][symb]);
+ }
+ free_and_zero(pdsch_dmrs[slot]);
+ }
+ free_and_zero(gNB->nr_gold_pdsch_dmrs);
+
+ uint32_t ****pusch_dmrs = gNB->nr_gold_pusch_dmrs;
+ for(int nscid = 0; nscid < 2; nscid++) {
+ for (int slot = 0; slot < fp->slots_per_frame; slot++) {
+ for (int symb = 0; symb < fp->symbols_per_slot; symb++)
+ free_and_zero(pusch_dmrs[nscid][slot][symb]);
+ free_and_zero(pusch_dmrs[nscid][slot]);
+ }
+ free_and_zero(pusch_dmrs[nscid]);
+ }
+ free_and_zero(pusch_dmrs);
+
+ uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
+ for (int slot = 0; slot < fp->slots_per_frame; slot++) {
+ for (int symb = 0; symb < fp->symbols_per_slot; symb++)
+ free_and_zero(csi_rs[slot][symb]);
+ free_and_zero(csi_rs[slot]);
+ }
+ free_and_zero(csi_rs);
+
+ for (int id = 0; id < NUMBER_OF_NR_SRS_MAX; id++) {
+ for (int i = 0; i < Prx; i++){
+ free_and_zero(gNB->nr_srs_info[id]->srs_received_signal[i]);
+ free_and_zero(gNB->nr_srs_info[id]->srs_ls_estimated_channel[i]);
+ free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_freq[i]);
+ free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time[i]);
+ free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted[i]);
+ }
+ free_and_zero(gNB->nr_srs_info[id]->srs_generated_signal);
+ free_and_zero(gNB->nr_srs_info[id]->noise_power);
+ free_and_zero(gNB->nr_srs_info[id]->srs_received_signal);
+ free_and_zero(gNB->nr_srs_info[id]->srs_ls_estimated_channel);
+ free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_freq);
+ free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time);
+ free_and_zero(gNB->nr_srs_info[id]->srs_estimated_channel_time_shifted);
+ free_and_zero(gNB->nr_srs_info[id]);
+ }
+
+ free_ul_reference_signal_sequences();
+ free_gnb_lowpapr_sequences();
+
+ reset_nr_transport(gNB);
+
+ NR_gNB_COMMON * common_vars = &gNB->common_vars;
for (int i = 0; i < Ptx; i++) {
free_and_zero(common_vars->txdataF[i]);
- /* rxdataF[i] is not allocated -> don't free */
+ free_and_zero(common_vars->beam_id[i]);
+ }
+
+ for (int i = 0; i < Prx; ++i) {
+ free_and_zero(common_vars->rxdataF[i]);
+ free_and_zero(common_vars->rxdata[i]);
}
free_and_zero(common_vars->txdataF);
+ free_and_zero(common_vars->rxdata);
free_and_zero(common_vars->rxdataF);
- // PDCCH DMRS sequences
- free_and_zero(pdcch_dmrs);
-/*
- // Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- for (i=0; i<64; i++) {
- free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
- }
+ free_and_zero(common_vars->beam_id);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
- } //UE_id
-
- //free_ul_ref_sigs();
-
- for (UE_id=0; UE_iddebugBuff);
+ NR_gNB_PRACH* prach_vars = &gNB->prach_vars;
free_and_zero(prach_vars->prachF);
+ free_and_zero(prach_vars->rxsigF);
+ free_and_zero(prach_vars->prach_ifft);
- for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
-
- free_and_zero(prach_vars->prach_ifft[0]);
- free_and_zero(prach_vars->rxsigF[0]);
-*/
+ NR_gNB_PUSCH** pusch_vars = gNB->pusch_vars;
for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
- for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ for (int i = 0; i < Prx; i++) {
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
}
- for (int i = 0; i < 4*fp->nb_antennas_rx; i++) {
+ for (int i = 0; i < n_buf; i++) {
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time[i]);
@@ -392,8 +415,8 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_ext);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_ptrs_estimates_ext);
- free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time);
free_and_zero(pusch_vars[ULSCH_id]->ptrs_phase_per_slot);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_estimates_time);
free_and_zero(pusch_vars[ULSCH_id]->ul_valid_re_per_slot);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp);
free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag0);
@@ -405,14 +428,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars[ULSCH_id]->llr);
free_and_zero(pusch_vars[ULSCH_id]);
} //ULSCH_id
-/*
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) gNB->UE_stats_ptr[UE_id] = NULL;
-*/
-
-
- free_gnb_lowpapr_sequences();
-
-
}
//Adding nr_schedule_handler
@@ -553,6 +568,16 @@ void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) {
}
}
+void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg)
+{
+ const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
+ const nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
+ const uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
+ for (int i=0; inumber_of_nr_dlsch_max; i++)
+ for (int j=0; j<2; j++)
+ free_gNB_dlsch(&msg->dlsch[i][j], grid_size);
+}
+
void init_nr_transport(PHY_VARS_gNB *gNB) {
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
LOG_I(PHY, "Initialise nr transport\n");
@@ -577,7 +602,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
for (int j=0; j<2; j++) {
// ULSCH for data
- gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
+ gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL);
if (!gNB->ulsch[i][j]) {
LOG_E(PHY,"Can't get gNB ulsch structures\n");
@@ -593,3 +618,18 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
//fp->pucch_config_common.deltaPUCCH_Shift = 1;
}
+
+void reset_nr_transport(PHY_VARS_gNB *gNB)
+{
+ const NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
+
+ for (int i = 0; i < NUMBER_OF_NR_PUCCH_MAX; i++)
+ free_gNB_pucch(gNB->pucch[i]);
+
+ for (int i = 0; i < NUMBER_OF_NR_SRS_MAX; i++)
+ free_gNB_srs(gNB->srs[i]);
+
+ for (int i=0; inumber_of_nr_ulsch_max; i++)
+ for (int j=0; j<2; j++)
+ free_gNB_ulsch(&gNB->ulsch[i][j], fp->N_RB_UL);
+}
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index d032746718..07f1d3b9e3 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -174,17 +174,13 @@ void nr_phy_free_RU(RU_t *ru)
LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
- free_and_zero(ru->nr_frame_parms);
- free_and_zero(ru->frame_parms);
-
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
- int32_t *ptr;
- for (i = 0; i < ru->nb_tx; i++) {
- ptr=&ru->common.txdata[i][-ru->sf_extension];
- free_and_zero(ptr);
- }
- for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
+ for (i = 0; i < ru->nb_tx; i++)
+ free_and_zero(ru->common.txdata[i]);
free_and_zero(ru->common.txdata);
+
+ for (i = 0; i < ru->nb_rx; i++)
+ free_and_zero(ru->common.rxdata[i]);
free_and_zero(ru->common.rxdata);
} // else: IF5 or local RF -> nothing to free()
@@ -193,7 +189,7 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->common.rxdata_7_5kHz);
// free beamforming input buffers (TX)
- for (i = 0; i < 15; i++) free_and_zero(ru->common.txdataF[i]);
+ for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF[i]);
free_and_zero(ru->common.txdataF);
// free IFFT input buffers (TX)
@@ -205,15 +201,21 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->common.rxdataF);
for (j=0;jnb_rx; i++) {
+ for (i = 0; i < ru->nb_rx; i++)
free_and_zero(ru->prach_rxsigF[j][i]);
- }
+ free_and_zero(ru->prach_rxsigF[j]);
}
- for (i = 0; i < ru->num_gNB; i++) {
- for (p = 0; p < 15; p++) {
- for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
- free_and_zero(ru->beam_weights[i][p]);
+
+ if (ru->do_precoding == 1) {
+ for (i = 0; i < ru->num_gNB; i++) {
+ for (p = 0; p < ru->nb_log_antennas; p++) {
+ for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
+ free_and_zero(ru->beam_weights[i][p]);
+ }
}
+ for(i=0; i< ru->nb_tx; ++i)
+ free_and_zero(ru->common.beam_id[i]);
+ free_and_zero(ru->common.beam_id);
}
}
free_and_zero(ru->common.sync_corr);
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index b09e8690f3..a27c541c80 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -111,6 +111,49 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
}
}
+void phy_term_nr_ue__PDSCH(NR_UE_PDSCH* pdsch, const NR_DL_FRAME_PARMS *const fp)
+{
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ for (int j = 0; j < NR_MAX_NB_LAYERS; j++) {
+ const int idx = j * fp->nb_antennas_rx + i;
+ for (int k = 0; k < NR_MAX_NB_LAYERS; k++)
+ free_and_zero(pdsch->rho[i][j*NR_MAX_NB_LAYERS+k]);
+ free_and_zero(pdsch->rxdataF_comp0[idx]);
+ free_and_zero(pdsch->dl_ch_estimates[idx]);
+ free_and_zero(pdsch->dl_ch_estimates_ext[idx]);
+ free_and_zero(pdsch->dl_bf_ch_estimates[idx]);
+ free_and_zero(pdsch->dl_bf_ch_estimates_ext[idx]);
+ free_and_zero(pdsch->dl_ch_mag0[idx]);
+ free_and_zero(pdsch->dl_ch_magb0[idx]);
+ free_and_zero(pdsch->dl_ch_magr0[idx]);
+ }
+ free_and_zero(pdsch->rxdataF_ext[i]);
+ free_and_zero(pdsch->rxdataF_uespec_pilots[i]);
+ free_and_zero(pdsch->ptrs_phase_per_slot[i]);
+ free_and_zero(pdsch->ptrs_re_per_slot[i]);
+ free_and_zero(pdsch->dl_ch_ptrs_estimates_ext[i]);
+ free_and_zero(pdsch->rho[i]);
+ }
+ free_and_zero(pdsch->pmi_ext);
+ free_and_zero(pdsch->llr[0]);
+ free_and_zero(pdsch->layer_llr[0]);
+ free_and_zero(pdsch->llr128);
+ free_and_zero(pdsch->rxdataF_ext);
+ free_and_zero(pdsch->rxdataF_uespec_pilots);
+ free_and_zero(pdsch->rxdataF_comp0);
+ free_and_zero(pdsch->rho);
+ free_and_zero(pdsch->dl_ch_estimates);
+ free_and_zero(pdsch->dl_ch_estimates_ext);
+ free_and_zero(pdsch->dl_bf_ch_estimates);
+ free_and_zero(pdsch->dl_bf_ch_estimates_ext);
+ free_and_zero(pdsch->dl_ch_mag0);
+ free_and_zero(pdsch->dl_ch_magb0);
+ free_and_zero(pdsch->dl_ch_magr0);
+ free_and_zero(pdsch->ptrs_phase_per_slot);
+ free_and_zero(pdsch->ptrs_re_per_slot);
+ free_and_zero(pdsch->dl_ch_ptrs_estimates_ext);
+}
+
void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
const NR_DL_FRAME_PARMS *const fp) {
AssertFatal( pusch, "pusch==0" );
@@ -120,9 +163,14 @@ void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
}
}
-int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
- int nb_connected_gNB,
- uint8_t abstraction_flag) {
+void phy_term_nr_ue_PUSCH(NR_UE_PUSCH *pusch)
+{
+ for (int i = 0; i < NR_MAX_NB_LAYERS; i++)
+ free_and_zero(pusch->txdataF_layers[i]);
+}
+
+int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
+{
// create shortcuts
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
NR_UE_COMMON *const common_vars = &ue->common_vars;
@@ -134,10 +182,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
int gNB_id;
int th_id;
uint32_t ****pusch_dmrs;
- uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
- int n_scid;
- abstraction_flag = 0;
- LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx);
+ LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx);
phy_init_nr_top(ue);
// many memory allocation sizes are hard coded
AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
@@ -191,7 +236,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
///////////
ue->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
pusch_dmrs = ue->nr_gold_pusch_dmrs;
- n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
for (slot=0; slotslots_per_frame; slot++) {
pusch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **));
@@ -208,7 +252,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
- nr_init_pusch_dmrs(ue, N_n_scid, n_scid);
///////////
////////////////////////////////////////////////////////////////////////////////////////////
@@ -230,29 +273,27 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
for (i=0; i<10; i++)
ue->tx_power_dBm[i]=-127;
- if (abstraction_flag == 0) {
- // init TX buffers
- common_vars->txdata = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
- common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
+ // init TX buffers
+ common_vars->txdata = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
+ common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
- for (i=0; inb_antennas_tx; i++) {
- common_vars->txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) );
- common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->samples_per_slot_wCP*sizeof(int32_t) );
- }
+ for (i=0; inb_antennas_tx; i++) {
+ common_vars->txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) );
+ common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->samples_per_slot_wCP*sizeof(int32_t) );
+ }
- // init RX buffers
- common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ // init RX buffers
+ common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+
+ for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ }
+
+ for (i=0; inb_antennas_rx; i++) {
+ common_vars->rxdata[i] = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
- }
-
- for (i=0; inb_antennas_rx; i++) {
- common_vars->rxdata[i] = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) );
-
- for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->samples_per_slot_wCP) );
- }
+ common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->samples_per_slot_wCP) );
}
}
@@ -271,9 +312,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
- ue->scramblingID_pdcch = fp->Nid_cell;
- nr_gold_pdcch(ue,fp->Nid_cell);
-
//PDSCH DMRS init (eNB offset = 0)
ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0];
@@ -293,12 +331,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
- // initializing the scrambling IDs for PDSCH DMRS
- for (int i=0; i<2; i++)
- ue->scramblingID[i]=fp->Nid_cell;
-
- nr_gold_pdsch(ue,ue->scramblingID);
-
// DLSCH
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
for (th_id=0; th_idnr_srs_info->srs_estimated_channel_time_shifted[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
}
- if (abstraction_flag == 0) {
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id], fp );
+ for (th_id=0; th_idpdsch_vars[th_id][gNB_id], fp );
+ }
+
+ for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
+ ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
+ ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
+ ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
+ ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
+ }
+
+
+ for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ }
+
+ for (i=0; inb_antennas_rx; i++)
+ for (j=0; j<4; j++) {
+ const int idx = (j*fp->nb_antennas_rx)+i;
+ const size_t num = 7*2*fp->N_RB_DL*12+4;
+
+ for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
+ }
}
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
- ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
- ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
- ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
- ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
- }
-
-
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- }
-
- for (i=0; inb_antennas_rx; i++)
- for (j=0; j<4; j++) {
- const int idx = (j*fp->nb_antennas_rx)+i;
- const size_t num = 7*2*fp->N_RB_DL*12+4;
-
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
- }
+ //const size_t num = 7*2*fp->N_RB_DL*12+4;
+ for (k=0; k<8; k++) { //harq_pid
+ for (l=0; l<8; l++) { //round
+ for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
}
- //const size_t num = 7*2*fp->N_RB_DL*12+4;
- for (k=0; k<8; k++) { //harq_pid
- for (l=0; l<8; l++) { //round
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- }
+ for (int i=0; inb_antennas_rx; i++)
+ for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
+ const int idx = (j*fp->nb_antennas_rx)+i;
- for (int i=0; inb_antennas_rx; i++)
- for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
- const int idx = (j*fp->nb_antennas_rx)+i;
-
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
- ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
- }
+ for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
+ ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
}
- }
- }
-
- // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
- for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
- ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
- ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
- ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- // Channel estimates
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
-
- for (i=0; inb_antennas_rx; i++) {
- ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
-
- for (j=0; j<4; j++) {
- int idx = (j*fp->nb_antennas_rx)+i;
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
- // size_t num = 7*2*fp->N_RB_DL*12;
- size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
}
- }
}
+ }
- // PBCH
- pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
- pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
- pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
- prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
- prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+ // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
+ for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ // Channel estimates
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
for (i=0; inb_antennas_rx; i++) {
- pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+ ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
- for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
+ for (j=0; j<4; j++) {
int idx = (j*fp->nb_antennas_rx)+i;
- pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
- pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
- pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
- pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
+ // size_t num = 7*2*fp->N_RB_DL*12;
+ size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
}
}
}
+ // PBCH
+ pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
+ prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+ prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+
+ for (i=0; inb_antennas_rx; i++) {
+ pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+
+ for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
+ int idx = (j*fp->nb_antennas_rx)+i;
+ pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+ pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+ }
+ }
+
pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64);
}
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
for (th_id=0; th_idpdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
- }
-
- if (abstraction_flag == 0) {
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id], fp );
- ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
- ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
- }
- } else { //abstraction == 1
- ue->sinr_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
+ ue->pdsch_vars[th_id][gNB_id] = malloc16_clear(sizeof(NR_UE_PDSCH));
+ ue->pdsch_vars[th_id][gNB_id]->llr[1] = malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
+ ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
}
ue->sinr_CQI_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
@@ -473,25 +495,224 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
return 0;
}
-void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
- int abstraction_flag) {
+void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
+{
+ const NR_DL_FRAME_PARMS* fp = &ue->frame_parms;
+ phy_term_nr_top();
+
+ for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
+ for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
+ phy_term_nr_ue_PUSCH(ue->pusch_vars[th_id][gNB_id]);
+ free_and_zero(ue->pusch_vars[th_id][gNB_id]);
+ free_and_zero(ue->pucch_vars[th_id][gNB_id]);
+ }
+ }
+
+ for (int slot = 0; slot < fp->slots_per_frame; slot++) {
+ for (int symb = 0; symb < fp->symbols_per_slot; symb++) {
+ for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++)
+ free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb][q]);
+ free_and_zero(ue->nr_gold_pusch_dmrs[slot][symb]);
+ }
+ free_and_zero(ue->nr_gold_pusch_dmrs[slot]);
+ }
+ free_and_zero(ue->nr_gold_pusch_dmrs);
+
+ NR_UE_COMMON* common_vars = &ue->common_vars;
+
+ for (int i = 0; i < fp->nb_antennas_tx; i++) {
+ free_and_zero(common_vars->txdata[i]);
+ free_and_zero(common_vars->txdataF[i]);
+ }
+
+ free_and_zero(common_vars->txdata);
+ free_and_zero(common_vars->txdataF);
+
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ free_and_zero(common_vars->rxdata[i]);
+ for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++)
+ free_and_zero(common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i]);
+ }
+ for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
+ free_and_zero(common_vars->common_vars_rx_data_per_thread[th_id].rxdataF);
+ }
+ free_and_zero(common_vars->rxdata);
+
+ for (int slot = 0; slot < fp->slots_per_frame; slot++) {
+ for (int symb = 0; symb < fp->symbols_per_slot; symb++)
+ free_and_zero(ue->nr_gold_pdcch[0][slot][symb]);
+ free_and_zero(ue->nr_gold_pdcch[0][slot]);
+ }
+ free_and_zero(ue->nr_gold_pdcch[0]);
+
+ for (int slot=0; slotslots_per_frame; slot++) {
+ for (int symb=0; symbsymbols_per_slot; symb++) {
+ for (int q=0; qnr_gold_pdsch[0][slot][symb][q]);
+ free_and_zero(ue->nr_gold_pdsch[0][slot][symb]);
+ }
+ free_and_zero(ue->nr_gold_pdsch[0][slot]);
+ }
+ free_and_zero(ue->nr_gold_pdsch[0]);
+
+ for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
+
+ // PDSCH
+ for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
+ for (int k = 0; k < 8; k++) { //harq_pid
+ for (int l = 0; l < 8; l++) { //round
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ for (int j = 0; j < 4; j++) { //frame_parms->nb_antennas_tx; j++)
+ const int idx = j * fp->nb_antennas_rx + i;
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx]);
+ }
+ }
+
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l]);
+ }
+ }
+
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ for (int j = 0; j < 4; j++) {
+ const int idx = (j*fp->nb_antennas_rx)+i;
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx]);
+ }
+ }
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr_shifts);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext);
+
+ phy_term_nr_ue__PDSCH(ue->pdsch_vars[th_id][gNB_id], fp);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]);
+ }
+
+ for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ for (int j = 0; j < 4; j++) {
+ int idx = j * fp->nb_antennas_rx + i;
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx]);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx]);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx]);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx]);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx]);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx]);
+ }
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho[i]);
+ }
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr16);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->wbar);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->e_rx);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates);
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time);
+
+ free_and_zero(ue->pdcch_vars[th_id][gNB_id]);
+ }
+
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ free_and_zero(ue->nr_srs_info->srs_received_signal[i]);
+ free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel[i]);
+ free_and_zero(ue->nr_srs_info->srs_estimated_channel_freq[i]);
+ free_and_zero(ue->nr_srs_info->srs_estimated_channel_time[i]);
+ free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted[i]);
+ }
+ free_and_zero(ue->nr_srs_info->srs_generated_signal);
+ free_and_zero(ue->nr_srs_info->noise_power);
+ free_and_zero(ue->nr_srs_info->srs_received_signal);
+ free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel);
+ free_and_zero(ue->nr_srs_info->srs_estimated_channel_freq);
+ free_and_zero(ue->nr_srs_info->srs_estimated_channel_time);
+ free_and_zero(ue->nr_srs_info->srs_estimated_channel_time_shifted);
+ free_and_zero(ue->nr_srs_info);
+
+ free_and_zero(ue->srs_vars[gNB_id]);
+
+ for (int i = 0; i < fp->nb_antennas_rx; i++) {
+ free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext[i]);
+
+ for (int j = 0; j < 4; j++) {
+ int idx = (j*fp->nb_antennas_rx)+i;
+ free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp[idx]);
+ free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates[idx]);
+ free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time[idx]);
+ free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext[idx]);
+ }
+ }
+
+ free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_ext);
+ free_and_zero(ue->pbch_vars[gNB_id]->rxdataF_comp);
+ free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates);
+ free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_ext);
+ free_and_zero(ue->pbch_vars[gNB_id]->dl_ch_estimates_time);
+ free_and_zero(ue->pbch_vars[gNB_id]->llr);
+ free_and_zero(ue->pbch_vars[gNB_id]->decoded_output);
+ free_and_zero(ue->pbch_vars[gNB_id]);
+
+ free_and_zero(ue->prach_vars[gNB_id]->prachF);
+ free_and_zero(ue->prach_vars[gNB_id]->prach);
+ free_and_zero(ue->prach_vars[gNB_id]);
+ }
+
+ const int gNB_id = ue->n_connected_gNB;
+ for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr[1]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]->layer_llr[1]);
+ free_and_zero(ue->pdsch_vars[th_id][gNB_id]);
+ }
+
+ free_and_zero(ue->sinr_CQI_dB);
+}
+
+void term_nr_ue_transport(PHY_VARS_NR_UE *ue)
+{
+ const int N_RB_DL = ue->frame_parms.N_RB_DL;
+ for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
+ for (int j = 0; j < 2; j++) {
+ for (int k = 0; k < RX_NB_TH_MAX; k++) {
+ free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL);
+ free_nr_ue_ulsch(&ue->ulsch[k][i][j], N_RB_DL);
+ }
+ }
+
+ free_nr_ue_dlsch(&ue->dlsch_SI[i], N_RB_DL);
+ free_nr_ue_dlsch(&ue->dlsch_ra[i], N_RB_DL);
+ }
+
+ free_nr_ue_dlsch(&ue->dlsch_MCH[0], N_RB_DL);
+}
+
+void init_nr_ue_transport(PHY_VARS_NR_UE *ue)
+{
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
for (int j=0; j<2; j++) {
for (int k=0; kdlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
+ AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n");
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]);
- AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
+ AssertFatal((ue->ulsch[k][i][j] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES))!=NULL,"Can't get ue ulsch structures\n");
LOG_D(PHY,"ulsch[%d][%d][%d] => %p\n",k,i,j,ue->ulsch[k][i][j]);
}
}
- ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
- ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
+ ue->dlsch_SI[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL);
+ ue->dlsch_ra[i] = new_nr_ue_dlsch(1,1,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL);
ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_gNB==1 ? 1 : 2;
}
//ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
- ue->dlsch_MCH[0] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
+ ue->dlsch_MCH[0] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL);
for(int i=0; i<5; i++)
ue->dl_stats[i] = 0;
@@ -555,3 +776,9 @@ void phy_init_nr_top(PHY_VARS_NR_UE *ue) {
//init_unscrambling_lut();
//set_taus_seed(1328);
}
+
+void phy_term_nr_top(void)
+{
+ free_ul_reference_signal_sequences();
+ free_context_synchro_nr();
+}
diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h
index dd9232de83..8648dd7d82 100644
--- a/openair1/PHY/INIT/phy_init.h
+++ b/openair1/PHY/INIT/phy_init.h
@@ -57,6 +57,7 @@ int l1_north_init_eNB(void);
int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
void phy_init_nr_top(PHY_VARS_NR_UE *ue);
+void phy_term_nr_top(void);
/*!
@@ -395,8 +396,9 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb);
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band);
void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band);
-int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
-void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
+int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB);
+void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB);
+void init_nr_ue_transport(PHY_VARS_NR_UE *ue);
void init_N_TA_offset(PHY_VARS_NR_UE *ue);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag);
@@ -405,11 +407,13 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
int l1_north_init_gNB(void);
void init_nr_transport(PHY_VARS_gNB *gNB);
+void reset_nr_transport(PHY_VARS_gNB *gNB);
void init_dfts(void);
void fill_subframe_mask(PHY_VARS_eNB *eNB);
void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
+void reset_DLSCH_struct(const PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
index a7054a44d2..0b665737a7 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
@@ -6481,7 +6481,7 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *c
sprintf(fname,"dlsch%d_rxF_r%d_uespec0.m",eNB_id,round);
sprintf(vname,"dl%d_rxF_r%d_uespec0",eNB_id,round);
LOG_M(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_uespec_pilots[0],
- 12*(ue->frame_parms.N_RB_DL)*NSYMB,1,1);
+ 12*(ue->frame_parms.N_RB_DL),1,1);
/*
LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB,1,1);
LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB,1,1);
diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c
index 4a419ae926..c3c4c7a2ee 100644
--- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c
+++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c
@@ -122,23 +122,20 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC,
*********************************************************************/
int16_t get_index_for_dmrs_lowpapr_seq(int16_t num_dmrs_res) {
-
- int16_t index = -1;
-
- if (num_dmrs_res >= dmrs_ul_allocated_res[(MAX_INDEX_DMRS_UL_ALLOCATED_REs-1)])
+
+ int16_t index = num_dmrs_res/6 - 1;
+
+ if (index >= MAX_INDEX_DMRS_UL_ALLOCATED_REs)
index = MAX_INDEX_DMRS_UL_ALLOCATED_REs-1;
- else
- index = (num_dmrs_res/6) -1;
for (;index >= 0; index--) {
if (dmrs_ul_allocated_res[index] == num_dmrs_res)
break;
-
}
- LOG_D(PHY, "num_dmrs_res: %d INDEX RETURNED: %d", num_dmrs_res, index);
- return index;
+ LOG_D(PHY, "num_dmrs_res: %d INDEX RETURNED: %d", num_dmrs_res, index);
+ return index;
}
/*******************************************************************
@@ -204,6 +201,11 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS,
void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling)
{
+ /* prevent multiple calls, relevant when both UE & gNB initialize this */
+ static bool already_called = false;
+ if (already_called) return;
+ already_called = true;
+
unsigned int u,Msc_RS;
unsigned int v = 0; // sequence hopping and group hopping are not supported yet
@@ -223,6 +225,11 @@ void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling)
void generate_ul_reference_signal_sequences(unsigned int scaling)
{
+ /* prevent multiple calls, relevant when both UE & gNB initialize this */
+ static bool already_called = false;
+ if (already_called) return;
+ already_called = true;
+
unsigned int u,v,Msc_RS;
#if 0
@@ -295,10 +302,10 @@ void free_ul_reference_signal_sequences(void)
for (u=0; u < U_GROUP_NUMBER; u++) {
for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) {
if (rv_ul_ref_sig[u][v][Msc_RS])
- free16(rv_ul_ref_sig[u][v][Msc_RS],2*sizeof(int16_t)*ul_allocated_re[Msc_RS]);
+ free_and_zero(rv_ul_ref_sig[u][v][Msc_RS]);
if ((v==0) && (Msc_RS < MAX_INDEX_DMRS_UL_ALLOCATED_REs))
if (dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS])
- free16(dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS],2*sizeof(int16_t)*dmrs_ul_allocated_res[Msc_RS]);
+ free_and_zero(dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS]);
}
}
}
@@ -321,7 +328,7 @@ void free_gnb_lowpapr_sequences(void)
v=0;
for (u=0; u < U_GROUP_NUMBER; u++) {
if (gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS])
- free16(gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS],2*sizeof(int16_t)*dmrs_ul_allocated_res[Msc_RS]);
+ free_and_zero(gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS]);
}
}
}
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c
index d233eb9ba6..0af56ba706 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dci.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c
@@ -130,11 +130,8 @@ void nr_generate_dci(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
uint16_t Nid = dci_pdu->ScramblingId;
uint16_t scrambling_RNTI = dci_pdu->ScramblingRNTI;
- t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
- dci_pdu->PayloadSizeBits,
- dci_pdu->AggregationLevel,
- 0,NULL);
- polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr);
+ polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1,
+ NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel);
#ifdef DEBUG_CHANNEL_CODING
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel);
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
index 6d16fa531c..cdf0e6c152 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
@@ -55,42 +55,39 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
NR_gNB_DLSCH_t *dlsch = *dlschptr;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
- if (dlsch) {
- if (N_RB != 273) {
- a_segments = a_segments*N_RB;
- a_segments = a_segments/273 +1;
- }
-
-#ifdef DEBUG_DLSCH_FREE
- LOG_D(PHY,"Freeing dlsch %p\n",dlsch);
-#endif
- NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
-
- if (harq->b) {
- free16(harq->b, a_segments * 1056);
- harq->b = NULL;
-#ifdef DEBUG_DLSCH_FREE
- LOG_D(PHY, "Freeing harq->b (%p)\n", harq->b);
-#endif
- }
-
-#ifdef DEBUG_DLSCH_FREE
- LOG_D(PHY, "Freeing dlsch process %d c (%p)\n", i, harq->c);
-#endif
-
- for (r = 0; r < a_segments; r++) {
-#ifdef DEBUG_DLSCH_FREE
- LOG_D(PHY, "Freeing dlsch process %d c[%d] (%p)\n", i, r, harq->c[r]);
-#endif
-
- if (harq->c[r]) {
- free16(harq->c[r], 1056);
- harq->c[r] = NULL;
- }
- }
- free16(dlsch, sizeof(NR_gNB_DLSCH_t));
- *dlschptr = NULL;
+ if (N_RB != 273) {
+ a_segments = a_segments*N_RB;
+ a_segments = a_segments/273 +1;
}
+
+ NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
+ if (harq->b) {
+ free16(harq->b, a_segments * 1056);
+ harq->b = NULL;
+ }
+ for (r = 0; r < a_segments; r++) {
+ free(harq->c[r]);
+ harq->c[r] = NULL;
+ }
+ free(harq->pdu);
+
+ for (int aa = 0; aa < 64; aa++)
+ free(dlsch->calib_dl_ch_estimates[aa]);
+ free(dlsch->calib_dl_ch_estimates);
+
+ for (int q=0; qmod_symbs[q]);
+
+ for (int layer = 0; layer < NR_MAX_NB_LAYERS; layer++) {
+ free(dlsch->txdataF_precoding[layer]);
+ free(dlsch->txdataF[layer]);
+ for (int aa = 0; aa < 64; aa++)
+ free(dlsch->ue_spec_bf_weights[layer][aa]);
+ free(dlsch->ue_spec_bf_weights[layer]);
+ }
+
+ free(dlsch);
+ *dlschptr = NULL;
}
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c
index bf5edccb1b..fc7df46496 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c
@@ -299,8 +299,8 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
/// CRC, coding and rate matching
polar_encoder_fast (&a_reversed, (void*)pbch->pbch_e, 0, 0,
- nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL,0,NULL)
- );
+ NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
+
#ifdef DEBUG_PBCH_ENCODING
printf("Channel coding:\n");
diff --git a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
index e6a9b8c5dc..a62138621d 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.c
@@ -92,6 +92,5 @@ uint8_t get_l0(uint16_t dlDmrsSymbPos) {
if ((mask&1) == 1) break;
mask>>=1;
}
- AssertFatal(l0 < 4,"impossible l0 %d\n",l0);
return (l0);
}
diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
index d45858bca0..b62698c748 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
@@ -106,6 +106,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
uint8_t abstraction_flag,
uint16_t N_RB);
+void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
+
/** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs
- RB extraction (signal and channel estimates)
- channel compensation (matched filtering)
@@ -296,6 +298,7 @@ int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type);
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type);
NR_gNB_PUCCH_t *new_gNB_pucch(void);
+void free_gNB_pucch(NR_gNB_PUCCH_t *pucch);
void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame,
@@ -308,6 +311,7 @@ int nr_find_pucch(uint16_t rnti,
PHY_VARS_gNB *gNB);
NR_gNB_SRS_t *new_gNB_srs(void);
+void free_gNB_srs(NR_gNB_SRS_t *srs);
int nr_find_srs(uint16_t rnti,
int frame,
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h
index f7bb3be577..0791fd2bbc 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h
@@ -33,9 +33,9 @@
#include "PHY/defs_gNB.h"
#include "common/utils/threadPool/thread-pool.h"
-void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch,uint8_t N_RB_UL);
+void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch, uint16_t N_RB_UL);
-NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint8_t abstraction_flag);
+NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
/*! \brief Perform PUSCH decoding. TS 38.212 V15.4.0 subclause 6.2
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
index a398df877e..e9ed278bb1 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
@@ -54,60 +54,40 @@
//extern double cpuf;
-void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr,uint8_t N_RB_UL)
+void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
{
int i,r;
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated
NR_gNB_ULSCH_t *ulsch = *ulschptr;
- if (ulsch) {
- if (N_RB_UL != 273) {
- a_segments = a_segments*N_RB_UL;
- a_segments = a_segments/273 +1;
- }
-
-
- for (i=0; iharq_processes[i]) {
- if (ulsch->harq_processes[i]->b) {
- free16(ulsch->harq_processes[i]->b,a_segments*1056);
- ulsch->harq_processes[i]->b = NULL;
- }
- for (r=0; rharq_processes[i]->c[r],(8448)*sizeof(uint8_t));
- ulsch->harq_processes[i]->c[r] = NULL;
- }
- for (r=0; rharq_processes[i]->d[r]) {
- free16(ulsch->harq_processes[i]->d[r],(68*384)*sizeof(int16_t));
- ulsch->harq_processes[i]->d[r] = NULL;
- }
- }
- for (r=0; rharq_processes[i]->w[r]) {
- free16(ulsch->harq_processes[i]->w[r],(3*(6144+64))*sizeof(int16_t));
- ulsch->harq_processes[i]->w[r] = NULL;
- }
- }
- for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r]){
- nrLDPC_free_mem(ulsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
- ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
- }
- }
- free16(ulsch->harq_processes[i],sizeof(NR_UL_gNB_HARQ_t));
- ulsch->harq_processes[i] = NULL;
- }
- }
- free16(ulsch,sizeof(NR_gNB_ULSCH_t));
- *ulschptr = NULL;
+ if (N_RB_UL != 273) {
+ a_segments = a_segments*N_RB_UL;
+ a_segments = a_segments/273 +1;
}
+
+ for (i=0; iharq_processes[i]) {
+ if (ulsch->harq_processes[i]->b) {
+ free_and_zero(ulsch->harq_processes[i]->b);
+ ulsch->harq_processes[i]->b = NULL;
+ }
+ for (r=0; rharq_processes[i]->c[r]);
+ free_and_zero(ulsch->harq_processes[i]->d[r]);
+ free_and_zero(ulsch->harq_processes[i]->w[r]);
+ nrLDPC_free_mem(ulsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
+ ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
+ }
+ free_and_zero(ulsch->harq_processes[i]);
+ ulsch->harq_processes[i] = NULL;
+ }
+ }
+ free_and_zero(*ulschptr);
}
-NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint8_t abstraction_flag)
+NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
{
NR_gNB_ULSCH_t *ulsch;
@@ -129,13 +109,11 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
- if (abstraction_flag == 0) {
- for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
- ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
- ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
- ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t));
- }
+ for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
+ ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
+ ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
+ ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t));
}
}
diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
index 56d87866ed..b85dbd1454 100644
--- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c
+++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
@@ -62,6 +62,11 @@ NR_gNB_PUCCH_t *new_gNB_pucch(void){
return (pucch);
}
+void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
+{
+ free_and_zero(pucch);
+}
+
int nr_find_pucch(uint16_t rnti,
int frame,
int slot,
@@ -1533,7 +1538,6 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
}
else { // polar coded case
- t_nrPolar_params *currentPtr = nr_polar_params(2,nb_bit,pucch_pdu->prb_size,1,&gNB->uci_polarParams);
__m64 *rp_re[Prx2][2];
__m64 *rp2_re[Prx2][2];
__m64 *rp_im[Prx2][2];
@@ -1660,7 +1664,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} // half_prb
} // symb
// run polar decoder on llrs
- decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, currentPtr);
+ decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, 2,nb_bit,pucch_pdu->prb_size);
LOG_D(PHY,"UCI decoderState %d, payload[0] %llu\n",decoderState,(unsigned long long)decodedPayload[0]);
if (decoderState>0) decoderState=1;
corr_dB = dB_fixed64(corr);
diff --git a/openair1/PHY/NR_TRANSPORT/srs_rx.c b/openair1/PHY/NR_TRANSPORT/srs_rx.c
index c16becdb20..2d7aefdee0 100644
--- a/openair1/PHY/NR_TRANSPORT/srs_rx.c
+++ b/openair1/PHY/NR_TRANSPORT/srs_rx.c
@@ -49,6 +49,11 @@ NR_gNB_SRS_t *new_gNB_srs(void){
return (srs);
}
+void free_gNB_srs(NR_gNB_SRS_t *srs)
+{
+ free_and_zero(srs);
+}
+
int nr_find_srs(uint16_t rnti,
int frame,
int slot,
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
index 30eae2d30f..7281f8e290 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
@@ -642,6 +642,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short p,
unsigned char symbol,
unsigned short BWPStart,
+ uint8_t config_type,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch)
{
@@ -653,10 +654,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
int16_t *fl=NULL,*fm=NULL,*fr=NULL,*fml=NULL,*fmr=NULL,*fmm=NULL,*fdcl=NULL,*fdcr=NULL,*fdclh=NULL,*fdcrh=NULL, *frl=NULL, *frr=NULL;
int ch_offset,symbol_offset;
- NR_UE_DLSCH_t **dlsch = ue->dlsch[proc->thread_id][gNB_id];
- const unsigned char harq_pid = dlsch[0]->current_harq_pid;
- NR_DL_UE_HARQ_t *dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
-
uint8_t nushift;
int **dl_ch_estimates =ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates;
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
@@ -678,7 +675,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
if (is_SI) {
rb_offset -= BWPStart;
}
- uint8_t config_type = dlsch0_harq->dmrsConfigType;
int8_t delta = get_delta(p, config_type);
// checking if re-initialization of scrambling IDs is needed
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
index c5330ce2f2..4dec92143a 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
@@ -72,6 +72,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
unsigned short p,
unsigned char symbol,
unsigned short BWPStart,
+ uint8_t config_type,
unsigned short bwp_start_subcarrier,
unsigned short nb_rb_pdsch);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index 84c9627c8a..5e18f6cc6d 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -130,76 +130,75 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
*/
int c = 0, r = 0;
- uint16_t bundle_j = 0, f_bundle_j = 0, f_reg = 0;
+ uint16_t f_bundle_j = 0;
uint32_t coreset_C = 0;
uint16_t index_z, index_llr;
int coreset_interleaved = 0;
+ int N_regs = coreset_nbr_rb*coreset_time_dur;
if (reg_bundle_size_L != 0) { // interleaving will be done only if reg_bundle_size_L != 0
coreset_interleaved = 1;
- coreset_C = (uint32_t) (coreset_nbr_rb / (coreset_interleaver_size_R * reg_bundle_size_L));
+ coreset_C = (uint32_t) (N_regs / (coreset_interleaver_size_R * reg_bundle_size_L));
} else {
reg_bundle_size_L = 6;
}
+ int B_rb = reg_bundle_size_L/coreset_time_dur; // nb of RBs occupied by each REG bundle
+ int num_bundles_per_cce = 6/reg_bundle_size_L;
+ int max_bundles = NR_MAX_PDCCH_AGG_LEVEL*num_bundles_per_cce;
+ int f_bundle_j_list[max_bundles];
- int f_bundle_j_list[(2*NR_MAX_PDCCH_AGG_LEVEL) - 1] = {};
-
- for (int reg = 0; reg < coreset_nbr_rb; reg++) {
- if ((reg % reg_bundle_size_L) == 0) {
+ // for each bundle
+ for (int nb = 0; nb < max_bundles; nb++) {
+ if (coreset_interleaved == 0) f_bundle_j = nb;
+ else {
if (r == coreset_interleaver_size_R) {
r = 0;
c++;
}
-
- bundle_j = (c * coreset_interleaver_size_R) + r;
- f_bundle_j = ((r * coreset_C) + c + n_shift) % (coreset_nbr_rb / reg_bundle_size_L);
-
- if (coreset_interleaved == 0) f_bundle_j = bundle_j;
-
- f_bundle_j_list[reg / 6] = f_bundle_j;
-
+ f_bundle_j = ((r * coreset_C) + c + n_shift) % (N_regs / reg_bundle_size_L);
+ r++;
}
- if ((reg % reg_bundle_size_L) == 0) r++;
+ f_bundle_j_list[nb] = f_bundle_j;
}
- // Get cce_list indices by reg_idx in ascending order
- int f_bundle_j_list_id = 0;
- int f_bundle_j_list_ord[(2*NR_MAX_PDCCH_AGG_LEVEL)-1] = {};
+ // Get cce_list indices by bundle index in ascending order
+ int f_bundle_j_list_ord[number_of_candidates][max_bundles];
for (int c_id = 0; c_id < number_of_candidates; c_id++ ) {
- f_bundle_j_list_id = CCE[c_id];
- for (int p = 0; p < NR_MAX_PDCCH_AGG_LEVEL; p++) {
- for (int p2 = CCE[c_id]; p2 < CCE[c_id] + L[c_id]; p2++) {
- AssertFatal(p2<2*NR_MAX_PDCCH_AGG_LEVEL,"number_of_candidates %d : p2 %d, CCE[%d] %d, L[%d] %d\n",number_of_candidates,p2,c_id,CCE[c_id],c_id,L[c_id]);
- if (f_bundle_j_list[p2] == p) {
- AssertFatal(f_bundle_j_list_id < 2*NR_MAX_PDCCH_AGG_LEVEL,"f_bundle_j_list_id %d\n",f_bundle_j_list_id);
- f_bundle_j_list_ord[f_bundle_j_list_id] = p;
+ int start_bund_cand = CCE[c_id]*num_bundles_per_cce;
+ int max_bund_per_cand = L[c_id]*num_bundles_per_cce;
+ int f_bundle_j_list_id = 0;
+ for(int nb = 0; nb < max_bundles; nb++) {
+ for(int bund_cand = start_bund_cand; bund_cand < start_bund_cand+max_bund_per_cand; bund_cand++){
+ if (f_bundle_j_list[bund_cand] == nb) {
+ f_bundle_j_list_ord[c_id][f_bundle_j_list_id] = nb;
f_bundle_j_list_id++;
- break;
+
}
}
}
}
- int rb = 0;
+ int rb_count = 0;
+ int data_sc = 9; // 9 sub-carriers with data per PRB
for (int c_id = 0; c_id < number_of_candidates; c_id++ ) {
for (int symbol_idx = start_symbol; symbol_idx < start_symbol+coreset_time_dur; symbol_idx++) {
- for (int cce_count = CCE[c_id/coreset_time_dur]+c_id%coreset_time_dur; cce_count < CCE[c_id/coreset_time_dur]+c_id%coreset_time_dur+L[c_id]; cce_count += coreset_time_dur) {
- for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx++) {
-
- f_reg = (f_bundle_j_list_ord[cce_count] * reg_bundle_size_L) + reg_in_cce_idx;
- index_z = 9 * rb;
- index_llr = (uint16_t) (f_reg + symbol_idx * coreset_nbr_rb) * 9;
-
- for (int i = 0; i < 9; i++) {
- z[index_z + i] = llr[index_llr + i];
+ for (int cce_count = 0; cce_count < L[c_id]; cce_count ++) {
+ for (int k=0; k \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n",
- cce_count,reg_in_cce_idx,bundle_j,symbol_idx,c_id,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
- f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
+ LOG_I(PHY,"[candidate=%d,symbol_idx=%d,cce=%d,REG bundle=%d,PRB=%d] z[%d]=(%d,%d) <-> \t llr[%d]=(%d,%d) \n",
+ c_id,symbol_idx,cce_count,k,f*B_rb + rb,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
+ (index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
#endif
+ }
+ rb_count++;
}
- rb++;
}
}
}
@@ -783,15 +782,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
rel15->number_of_candidates,
rel15->CCE,
rel15->L);
- /*
- nr_pdcch_unscrambling(rel15->rnti,
- frame_parms,
- slot,
- pdcch_vars->e_rx,
- rel15->coreset.duration*n_rb*9*2,
- // get_nCCE(n_pdcch_symbols, frame_parms, mi) * 72,
- rel15->coreset.pdcch_dmrs_scrambling_id);
- */
+
LOG_D(PHY,"we end nr_pdcch_unscrambling()\n");
LOG_D(PHY,"Ending nr_rx_pdcch() function\n");
@@ -832,14 +823,18 @@ void nr_pdcch_unscrambling(int16_t *z,
/* This function compares the received DCI bits with
* re-encoded DCI bits and returns the number of mismatched bits
*/
-uint16_t nr_dci_false_detection(uint64_t *dci,
- int16_t *soft_in,
- const t_nrPolar_params *polar_param,
- int encoded_length,
- int rnti) {
+static uint16_t nr_dci_false_detection(uint64_t *dci,
+ int16_t *soft_in,
+ int encoded_length,
+ int rnti,
+ int8_t messageType,
+ uint16_t messageLength,
+ uint8_t aggregation_level
+ ) {
uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD];
- polar_encoder_fast(dci, (void*)encoder_output, rnti, 1, (t_nrPolar_params *)polar_param);
+ polar_encoder_fast(dci, (void*)encoder_output, rnti, 1,
+ messageType, messageLength, aggregation_level);
uint8_t *enout_p = (uint8_t*)encoder_output;
uint16_t x = 0;
@@ -866,6 +861,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
//int gNB_id = 0;
int16_t tmp_e[16*108];
rnti_t n_rnti;
+ int e_rx_cand_idx = 0;
for (int j=0;jnumber_of_candidates;j++) {
int CCEind = rel15->CCE[j];
@@ -886,26 +882,24 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
if (dci_found==1) continue;
int dci_length = rel15->dci_length_options[k];
uint64_t dci_estimation[2]= {0};
- const t_nrPolar_params *currentPtrDCI = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L, 1, &ue->polarList);
LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n",
- j, rel15->number_of_candidates, CCEind, CCEind*9*6*2, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]);
+ j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]);
- nr_pdcch_unscrambling(&pdcch_vars->e_rx[CCEind*108], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e);
+ nr_pdcch_unscrambling(&pdcch_vars->e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e);
#ifdef DEBUG_DCI_DECODING
- uint32_t * z = (uint32_t *) &pdcch_vars->e_rx[CCEind*108];
- for (int index_z = 0; index_z < 96; index_z++){
+ uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx];
+ for (int index_z = 0; index_z < L*6; index_z++){
for (int i=0; i<9; i++) {
LOG_D(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]));
}
}
#endif
-
uint16_t crc = polar_decoder_int16(tmp_e,
dci_estimation,
1,
- currentPtrDCI);
+ NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
n_rnti = rel15->rnti;
LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d)\n",
@@ -913,7 +907,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
if (crc == n_rnti) {
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n",
proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation);
- uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,currentPtrDCI,L*108,n_rnti);
+ uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,L*108,n_rnti, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
ue->dci_thres = (ue->dci_thres + mb) / 2;
if (mb > (ue->dci_thres+20)) {
LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,L*108,ue->dci_thres);
@@ -935,6 +929,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
LOG_D(PHY,"(%i.%i) Decoded crc %x does not match rnti %x for DCI format %d\n", proc->frame_rx, proc->nr_slot_rx, crc, n_rnti, rel15->dci_format_options[k]);
}
}
+ e_rx_cand_idx += 9*L*6*2; //e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG and 2 uint16_t per RE)
}
pdcch_vars->nb_search_space = 0;
return(dci_ind->number_of_dcis);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
index 8064093eed..a9b8ce2e55 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
@@ -79,7 +79,7 @@ void init_dlsch_tpool(uint8_t num_dlsch_threads) {
free(params);
}
-void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
+void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) {
int i,r;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
NR_UE_DLSCH_t *dlsch=*dlschptr;
@@ -131,7 +131,7 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr,uint8_t N_RB_DL) {
}
}
-NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag) {
+NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_ldpc_iterations,uint16_t N_RB_DL) {
NR_UE_DLSCH_t *dlsch;
uint8_t exit_flag = 0,i,r;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
@@ -167,30 +167,28 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
else
exit_flag=3;
- if (abstraction_flag == 0) {
- for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
- dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
+ for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
+ dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
- if (dlsch->harq_processes[i]->c[r])
- memset(dlsch->harq_processes[i]->c[r],0,1056);
- else
- exit_flag=2;
+ if (dlsch->harq_processes[i]->c[r])
+ memset(dlsch->harq_processes[i]->c[r],0,1056);
+ else
+ exit_flag=2;
- dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
+ dlsch->harq_processes[i]->d[r] = (short *)malloc16((5*8448)*sizeof(short));
- if (dlsch->harq_processes[i]->d[r])
- memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
- else
- exit_flag=2;
+ if (dlsch->harq_processes[i]->d[r])
+ memset(dlsch->harq_processes[i]->d[r],0,(5*8448)*sizeof(short));
+ else
+ exit_flag=2;
- dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
+ dlsch->harq_processes[i]->w[r] = (short *)malloc16((5*8448)*sizeof(short));
- if (dlsch->harq_processes[i]->w[r])
- memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
- else
- exit_flag=2;
- }
+ if (dlsch->harq_processes[i]->w[r])
+ memset(dlsch->harq_processes[i]->w[r],0,(5*8448)*sizeof(short));
+ else
+ exit_flag=2;
}
} else {
exit_flag=1;
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index 075aaecc08..75517b7a6f 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -931,12 +931,12 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
for (aarx=0; aarxnb_antennas_rx; aarx++) {
for (aatx=0; aatxnb_antennas_rx+aarx][symbol*nb_rb*12];
for (atx=0; atxnb_antennas_rx+aarx][symbol*nb_rb*12];
dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[atx*frame_parms->nb_antennas_rx+aarx][symbol*nb_rb*12];
for (rb=0; rbofdm_symbol_size + fp->nb_prefix_samples0)+(ue->symbol_offset-n_symb_prefix0)*(fp->ofdm_symbol_size + fp->nb_prefix_samples);
// for a correct computation of frame number to sync with the one decoded at MIB we need to take into account in which of the n_frames we got sync
ue->init_sync_frame = n_frames - 1 - is;
+
+ // compute the scramblingID_pdcch and the gold pdcch
+ ue->scramblingID_pdcch = fp->Nid_cell;
+ nr_gold_pdcch(ue,fp->Nid_cell);
+
+ // compute the scrambling IDs for PDSCH DMRS
+ for (int i=0; i<2; i++)
+ ue->scramblingID[i]=fp->Nid_cell;
+
+ nr_gold_pdsch(ue,ue->scramblingID);
+
+ // initialize the pusch dmrs
+ uint16_t N_n_scid[2] = {fp->Nid_cell,fp->Nid_cell};
+ int n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
+ nr_init_pusch_dmrs(ue, N_n_scid, n_scid);
+
// we also need to take into account the shift by samples_per_frame in case the if is true
if (ue->ssb_offset < sync_pos_frame){
ue->rx_offset = fp->samples_per_frame - sync_pos_frame + ue->ssb_offset;
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
index dff347f7c0..6b5185dc2c 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
@@ -533,8 +533,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0,0);
//polar decoding de-rate matching
- const t_nrPolar_params *currentPtr = nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL,1,&ue->polarList);
- decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,currentPtr);
+ decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,
+ NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
if(decoderState) return(decoderState);
@@ -601,7 +601,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
#endif
nr_downlink_indication_t dl_indication;
- fapi_nr_rx_indication_t *rx_ind = calloc(1, sizeof(*rx_ind));
+ fapi_nr_rx_indication_t *rx_ind=calloc(sizeof(*rx_ind),1);
uint16_t number_pdus = 1;
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id);
@@ -609,6 +609,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
if (ue->if_inst && ue->if_inst->dl_indication)
ue->if_inst->dl_indication(&dl_indication, NULL);
+ else
+ free(rx_ind); // dl_indication would free(), so free() here if not called
return 0;
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index 239731208e..9bc3643557 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -50,24 +50,23 @@
\brief This function frees memory allocated for a particular DLSCH at UE
@param dlsch Pointer to DLSCH to be removed
*/
-void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlsch,uint8_t N_RB_DL);
+void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlsch, uint16_t N_RB_DL);
-/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
+/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft)
\brief This function allocates structures for a particular DLSCH at UE
@returns Pointer to DLSCH to be removed
@param Kmimo Kmimo factor from 36-212/36-213
@param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
@param Nsoft Soft-LLR buffer size from UE-Category
@params N_RB_DL total number of resource blocks (determine the operating BW)
- @param abstraction_flag Flag to indicate abstracted interface
*/
-NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint16_t N_RB_DL, uint8_t abstraction_flag);
+NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint16_t N_RB_DL);
-void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch,unsigned char N_RB_UL);
+void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulsch, uint16_t N_RB_UL);
-NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag);
+NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids);
/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception.
@param stream0_in Input from channel compensated (MR combined) stream 0
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
index aa4c858574..0ab4c94b96 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
@@ -43,7 +43,7 @@
//#define DEBUG_ULSCH_CODING
-void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL)
+void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr, uint16_t N_RB_UL)
{
int i, r;
@@ -105,12 +105,8 @@ void free_nr_ue_ulsch(NR_UE_ULSCH_t **ulschptr,unsigned char N_RB_UL)
}
-NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
- int number_of_harq_pids,
- uint8_t abstraction_flag)
+NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, int number_of_harq_pids)
{
- NR_UE_ULSCH_t *ulsch;
- unsigned char exit_flag = 0,i,r;
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated
if (N_RB_UL != 273) {
@@ -120,97 +116,54 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
- ulsch = (NR_UE_ULSCH_t *)malloc16(sizeof(NR_UE_ULSCH_t));
+ NR_UE_ULSCH_t *ulsch = malloc16(sizeof(NR_UE_ULSCH_t));
+ DevAssert(ulsch);
+ memset(ulsch, 0, sizeof(*ulsch));
- if (ulsch) {
- memset(ulsch,0,sizeof(NR_UE_ULSCH_t));
+ ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
+ ulsch->Mlimit = 4; // maximum harq retransmissions
- ulsch->number_harq_processes_for_pusch = NR_MAX_ULSCH_HARQ_PROCESSES;
- ulsch->Mlimit = 4; // maximum harq retransmissions
+ //for (i=0; i<10; i++)
+ //ulsch->harq_ids[i] = 0;
- //for (i=0; i<10; i++)
- //ulsch->harq_ids[i] = 0;
+ for (int i = 0; i < number_of_harq_pids; i++) {
- for (i=0; iharq_processes[i] = malloc16(sizeof(NR_UL_UE_HARQ_t));
+ DevAssert(ulsch->harq_processes[i]);
+ memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t));
- ulsch->harq_processes[i] = (NR_UL_UE_HARQ_t *)malloc16(sizeof(NR_UL_UE_HARQ_t));
+ ulsch->harq_processes[i]->a = malloc16(ulsch_bytes);
+ DevAssert(ulsch->harq_processes[i]->a);
+ bzero(ulsch->harq_processes[i]->a,ulsch_bytes);
- // printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
- if (ulsch->harq_processes[i]) {
- memset(ulsch->harq_processes[i], 0, sizeof(NR_UL_UE_HARQ_t));
- ulsch->harq_processes[i]->b = (uint8_t*)malloc16(ulsch_bytes);
- ulsch->harq_processes[i]->a = (unsigned char*)malloc16(ulsch_bytes);
+ ulsch->harq_processes[i]->b = malloc16(ulsch_bytes);
+ DevAssert(ulsch->harq_processes[i]->b);
+ bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
- if (ulsch->harq_processes[i]->a) {
- bzero(ulsch->harq_processes[i]->a,ulsch_bytes);
- } else {
- printf("Can't allocate PDU\n");
- exit_flag=1;
- }
+ for (int r = 0; r < a_segments; r++) {
+ // account for filler in first segment and CRCs for multiple segment case
+ ulsch->harq_processes[i]->c[r] = malloc16(8448);
+ DevAssert(ulsch->harq_processes[i]->c[r]);
+ bzero(ulsch->harq_processes[i]->c[r],8448);
- if (ulsch->harq_processes[i]->b)
- bzero(ulsch->harq_processes[i]->b,ulsch_bytes);
- else {
- LOG_E(PHY,"Can't get b\n");
- exit_flag=1;
- }
-
- if (abstraction_flag==0) {
- for (r=0; rharq_processes[i]->c[r] = (uint8_t*)malloc16(8448);
- ulsch->harq_processes[i]->d[r] = (uint8_t*)malloc16(68*384); //max size for coded output
-
- if (ulsch->harq_processes[i]->c[r]) {
- bzero(ulsch->harq_processes[i]->c[r],8448);
- } else {
- printf("Can't get c\n");
- exit_flag=2;
- }
- if (ulsch->harq_processes[i]->d[r]) {
- bzero(ulsch->harq_processes[i]->d[r],(68*384));
- } else {
- printf("Can't get d\n");
- exit_flag=2;
- }
- }
- ulsch->harq_processes[i]->e = (uint8_t*)malloc16(14*N_RB_UL*12*8);
- if (ulsch->harq_processes[i]->e) {
- bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
- } else {
- printf("Can't get e\n");
- exit_flag=1;
- }
- ulsch->harq_processes[i]->f = (uint8_t*)malloc16(14*N_RB_UL*12*8);
- if (ulsch->harq_processes[i]->f) {
- bzero(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
- } else {
- printf("Can't get f\n");
- exit_flag=1;
- }
- }
-
- ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
- ulsch->harq_processes[i]->first_tx = 1;
- } else {
- LOG_E(PHY,"Can't get harq_p %d\n",i);
- exit_flag=3;
- }
+ ulsch->harq_processes[i]->d[r] = malloc16(68*384); //max size for coded output
+ DevAssert(ulsch->harq_processes[i]->d[r]);
+ bzero(ulsch->harq_processes[i]->d[r],(68*384));
}
- if (exit_flag==0) {
- for (i=0; iharq_processes[i]->round=0;
- }
- return(ulsch);
- }
+ ulsch->harq_processes[i]->e = malloc16(14*N_RB_UL*12*8);
+ DevAssert(ulsch->harq_processes[i]->e);
+ bzero(ulsch->harq_processes[i]->e,14*N_RB_UL*12*8);
+
+ ulsch->harq_processes[i]->f = malloc16(14*N_RB_UL*12*8);
+ DevAssert(ulsch->harq_processes[i]->f);
+ bzero(ulsch->harq_processes[i]->f,14*N_RB_UL*12*8);
+
+ ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
+ ulsch->harq_processes[i]->first_tx = 1;
}
- LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
- free_nr_ue_ulsch(&ulsch,N_RB_UL);
- return(NULL);
-
-
+ return(ulsch);
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
index 0c188e9119..41cf9c2ffa 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
@@ -128,7 +128,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
uint8_t num_of_codewords = 1; // tmp assumption
- int Nid_cell = 0;
int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
uint16_t number_dmrs_symbols = 0;
@@ -153,7 +152,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
if (start_sc >= frame_parms->ofdm_symbol_size)
start_sc -= frame_parms->ofdm_symbol_size;
- ulsch_ue->Nid_cell = Nid_cell;
+ ulsch_ue->Nid_cell = frame_parms->Nid_cell;
for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) {
if((ul_dmrs_symb_pos >> i) & 0x01)
@@ -391,7 +390,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
// Perform this on gold sequence, not required when SC FDMA operation is done,
LOG_D(PHY,"DMRS in symbol %d\n",l);
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
-
+
} else {
dmrs_idx = 0;
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
index 4fc11d5fc6..88bdc3a9cd 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
@@ -440,33 +440,10 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
void free_context_pss_nr(void)
{
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
-
- if (primary_synchro_time_nr[i] != NULL) {
- free(primary_synchro_time_nr[i]);
- primary_synchro_time_nr[i] = NULL;
- }
- else {
- LOG_E(PHY,"Fatal memory deallocation problem \n");
- assert(0);
- }
-
- if (primary_synchro_nr[i] != NULL) {
- free(primary_synchro_nr[i]);
- primary_synchro_nr[i] = NULL;
- }
- else {
- LOG_E(PHY,"Fatal memory deallocation problem \n");
- assert(0);
- }
-
- if (pss_corr_ue[i] != NULL) {
- free(pss_corr_ue[i]);
- pss_corr_ue[i] = NULL;
- }
- else {
- LOG_E(PHY,"Fatal memory deallocation problem \n");
- assert(0);
- }
+ free_and_zero(primary_synchro_nr[i]);
+ free_and_zero(primary_synchro_nr2[i]);
+ free_and_zero(primary_synchro_time_nr[i]);
+ free_and_zero(pss_corr_ue[i]);
}
}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
index ddec605253..4dcce9f60f 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/pucch_nr.c
@@ -850,7 +850,7 @@ static inline void nr_pucch2_3_4_scrambling(uint16_t M_bit,uint16_t rnti,uint16_
printf("\t\t [nr_pucch2_3_4_scrambling] scrambling M_bit=%d bits\n", M_bit);
#endif
}
-void nr_uci_encoding(uint64_t payload,
+static void nr_uci_encoding(uint64_t payload,
uint8_t nr_bit,
int fmt,
uint8_t is_pi_over_2_bpsk_enabled,
@@ -946,12 +946,10 @@ void nr_uci_encoding(uint64_t payload,
AssertFatal(nrofPRB<=16,"Number of PRB >16\n");
} else if (A>=12) {
AssertFatal(A<65,"Polar encoding not supported yet for UCI with more than 64 bits\n");
- t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_UCI_PUCCH_MESSAGE_TYPE,
- A,
- nrofPRB,
- 1,
- NULL);
- polar_encoder_fast(&payload, b, 0,0,currentPtr);
+ polar_encoder_fast(&payload, b, 0,0,
+ NR_POLAR_UCI_PUCCH_MESSAGE_TYPE,
+ A,
+ nrofPRB);
}
}
diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h
index a4552c8c27..b4aee78310 100644
--- a/openair1/PHY/defs_L1_NB_IoT.h
+++ b/openair1/PHY/defs_L1_NB_IoT.h
@@ -122,7 +122,7 @@ static inline void* malloc16_clear( size_t size )
#include "PHY/impl_defs_top_NB_IoT.h"
#include "PHY/impl_defs_lte_NB_IoT.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
//#include "PHY/CODING/defs.h"
#include "PHY/CODING/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
@@ -452,9 +452,6 @@ typedef struct {
int sub_frame_start;
///
int sub_frame_step;
- ///
- unsigned long long gotIQs;
-
} UE_rxtx_proc_NB_IoT_t;
/// Context data structure for eNB subframe processing
diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h
index 76dd92ef5d..6b18e55c4b 100644
--- a/openair1/PHY/defs_RU.h
+++ b/openair1/PHY/defs_RU.h
@@ -36,7 +36,7 @@
#include "common_lib.h"
#include "openairinterface5g_limits.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "defs_common.h"
#include "nfapi_nr_interface_scf.h"
diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h
index fc3d939f65..fa55384093 100644
--- a/openair1/PHY/defs_UE.h
+++ b/openair1/PHY/defs_UE.h
@@ -59,7 +59,7 @@
#include "defs_common.h"
#include "impl_defs_top.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/TOOLS/tools_defs.h"
#include "platform_types.h"
@@ -154,7 +154,6 @@ typedef struct {
int sub_frame_start;
int sub_frame_step;
- unsigned long long gotIQs;
} UE_rxtx_proc_t;
/// Context data structure for eNB subframe processing
diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h
index c79530434a..86df85db5c 100644
--- a/openair1/PHY/defs_common.h
+++ b/openair1/PHY/defs_common.h
@@ -58,7 +58,7 @@
#include "assertions.h"
//#include
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "platform_types.h"
#define MAX_NUM_RU_PER_eNB 64
diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h
index 995a4a934e..3a48dc51d6 100644
--- a/openair1/PHY/defs_eNB.h
+++ b/openair1/PHY/defs_eNB.h
@@ -58,7 +58,7 @@
#include "defs_common.h"
#include "defs_RU.h"
#include "impl_defs_top.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
//#include "PHY/CODING/coding_defs.h"
#include "PHY/TOOLS/tools_defs.h"
#include "platform_types.h"
@@ -202,7 +202,7 @@ typedef struct {
int repetition_number[4];
} LTE_eNB_PRACH;
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/TOOLS/tools_defs.h"
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h
index 7c7d30a6e2..c24bd81549 100644
--- a/openair1/PHY/defs_gNB.h
+++ b/openair1/PHY/defs_gNB.h
@@ -779,7 +779,7 @@ typedef struct PHY_VARS_gNB_s {
/// statistics for ULSCH measurement collection
NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX];
- t_nrPolar_params *uci_polarParams;
+ t_nrPolar_params **polarParams;
/// SRS variables
nr_srs_info_t *nr_srs_info[NUMBER_OF_NR_SRS_MAX];
@@ -856,7 +856,7 @@ typedef struct PHY_VARS_gNB_s {
/*
time_stats_t phy_proc;
*/
- time_stats_t *phy_proc_tx[2];
+ time_stats_t phy_proc_tx;
time_stats_t phy_proc_rx;
time_stats_t rx_prach;
/*
@@ -973,7 +973,6 @@ typedef struct processingData_L1tx {
uint16_t num_pdsch_slot;
int num_dl_pdcch;
int num_ul_pdcch;
- time_stats_t phy_proc_tx;
} processingData_L1tx_t;
#endif
diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h
index 0fa839f104..f4b49ececa 100644
--- a/openair1/PHY/defs_nr_UE.h
+++ b/openair1/PHY/defs_nr_UE.h
@@ -96,7 +96,7 @@
#include "impl_defs_top.h"
#include "impl_defs_nr.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/TOOLS/tools_defs.h"
#include "platform_types.h"
@@ -814,7 +814,6 @@ typedef struct {
fapi_nr_config_request_t nrUE_config;
- t_nrPolar_params *polarList;
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX+1]; // two RxTx Threads
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h
index 78599dcbb6..d3352fb520 100644
--- a/openair1/PHY/defs_nr_common.h
+++ b/openair1/PHY/defs_nr_common.h
@@ -387,8 +387,6 @@ struct NR_DL_FRAME_PARMS {
uint8_t N_ssb;
/// SSB index
uint8_t ssb_index;
- /// PBCH polar encoder params
- t_nrPolar_params pbch_polar_params;
/// OFDM symbol offset divisor for UL
uint32_t ofdm_offset_divisor;
};
diff --git a/openair1/PHY/thread_NR_UE.h b/openair1/PHY/thread_NR_UE.h
index 901d8faec9..a3cc2d9782 100644
--- a/openair1/PHY/thread_NR_UE.h
+++ b/openair1/PHY/thread_NR_UE.h
@@ -62,7 +62,6 @@ typedef struct {
int sub_frame_start;
int sub_frame_step;
- unsigned long long gotIQs;
uint8_t decoder_thread_available1;
int dci_err_cnt;
} UE_nr_rxtx_proc_t;
diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c
index 2dbaa738dc..4b9f9534f0 100644
--- a/openair1/SCHED_NR/fapi_nr_l1.c
+++ b/openair1/SCHED_NR/fapi_nr_l1.c
@@ -165,6 +165,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
notifiedFIFO_elt_t *res;
res = pullTpool(gNB->L1_tx_free, gNB->threadPool);
processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res);
+ const time_stats_t ts = exec_time_stats_NotifiedFIFO(res);
+ merge_meas(&gNB->phy_proc_tx, &ts);
msgTx->num_pdsch_slot=0;
msgTx->num_dl_pdcch=0;
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 41f395c090..1ddf4b0d07 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -134,8 +134,6 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,1);
- if (do_meas==1) start_meas(&msgTx->phy_proc_tx);
-
// clear the transmit data array and beam index for the current slot
for (aa=0; aacarrier_config.num_tx_ant.value; aa++) {
memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t));
@@ -193,8 +191,6 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0);
-
- if (do_meas==1) stop_meas(&msgTx->phy_proc_tx);
}
void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h
index d7e0332b85..2124397c47 100644
--- a/openair1/SCHED_NR/sched_nr.h
+++ b/openair1/SCHED_NR/sched_nr.h
@@ -54,5 +54,6 @@ void nr_fep_full(RU_t *ru, int slot);
void nr_fep_full_2thread(RU_t *ru, int slot);
void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
int nr_phy_init_RU(RU_t *ru);
+void nr_phy_free_RU(RU_t *ru);
#endif
diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h
index b85d4c1b50..c362bb470f 100644
--- a/openair1/SCHED_NR_UE/defs.h
+++ b/openair1/SCHED_NR_UE/defs.h
@@ -295,9 +295,6 @@ uint8_t nr_pdcch_alloc2ul_subframe(NR_DL_FRAME_PARMS *frame_parms,uint8_t n);
uint32_t nr_pdcch_alloc2ul_frame(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n);
-uint16_t nr_get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
-
-
int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
/*! \brief UL time alignment procedures for TA application
diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
index 485d732c04..8af91b1f38 100644
--- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
+++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c
@@ -90,8 +90,11 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
rx_ind->pdu_list[j].pdu = CALLOC(tx_req_body->pdu_length, sizeof(*rx_ind->pdu_list[j].pdu));
memcpy(rx_ind->pdu_list[j].pdu, tx_req_body->pdu, tx_req_body->pdu_length * sizeof(*rx_ind->pdu_list[j].pdu));
rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti;
- rx_ind->pdu_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance;
- rx_ind->pdu_list[j].ul_cqi = scheduled_response->tx_request->tx_config.ul_cqi;
+ /* TODO: Implement channel modeling to abstract TA and CQI. For now,
+ we hard code the values below since they are set in L1 and we are
+ abstracting L1. */
+ rx_ind->pdu_list[j].timing_advance = 31;
+ rx_ind->pdu_list[j].ul_cqi = 255;
char buffer[1024];
hexdump(rx_ind->pdu_list[j].pdu, rx_ind->pdu_list[j].pdu_length, buffer, sizeof(buffer));
LOG_D(NR_MAC, "Hexdump of pdu %s before queuing rx_ind\n",
@@ -113,7 +116,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
crc_ind->crc_list[j].num_cb = pusch_config_pdu->pusch_data.num_cb;
crc_ind->crc_list[j].rnti = pusch_config_pdu->rnti;
crc_ind->crc_list[j].tb_crc_status = 0;
- crc_ind->crc_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance;
+ crc_ind->crc_list[j].timing_advance = 31;
crc_ind->crc_list[j].ul_cqi = 255;
}
@@ -204,12 +207,66 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
}
}
}
+ dl_config->number_pdus = 0;
}
}
return 0;
}
+
+void configure_dlsch(NR_UE_DLSCH_t *dlsch0,
+ fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
+ module_id_t module_id,
+ int rnti) {
+
+ const uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr;
+ dlsch0->current_harq_pid = current_harq_pid;
+ dlsch0->active = 1;
+ dlsch0->rnti = rnti;
+
+ LOG_D(PHY,"current_harq_pid = %d\n", current_harq_pid);
+
+ NR_DL_UE_HARQ_t *dlsch0_harq = dlsch0->harq_processes[current_harq_pid];
+ AssertFatal(dlsch0_harq, "no harq_process for HARQ PID %d\n", current_harq_pid);
+
+ dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart;
+ dlsch0_harq->BWPSize = dlsch_config_pdu->BWPSize;
+ dlsch0_harq->nb_rb = dlsch_config_pdu->number_rbs;
+ dlsch0_harq->start_rb = dlsch_config_pdu->start_rb;
+ dlsch0_harq->nb_symbols = dlsch_config_pdu->number_symbols;
+ dlsch0_harq->start_symbol = dlsch_config_pdu->start_symbol;
+ dlsch0_harq->dlDmrsSymbPos = dlsch_config_pdu->dlDmrsSymbPos;
+ dlsch0_harq->dmrsConfigType = dlsch_config_pdu->dmrsConfigType;
+ dlsch0_harq->n_dmrs_cdm_groups = dlsch_config_pdu->n_dmrs_cdm_groups;
+ dlsch0_harq->dmrs_ports = dlsch_config_pdu->dmrs_ports;
+ dlsch0_harq->mcs = dlsch_config_pdu->mcs;
+ dlsch0_harq->rvidx = dlsch_config_pdu->rv;
+ dlsch0->g_pucch = dlsch_config_pdu->accumulated_delta_PUCCH;
+ //get nrOfLayers from DCI info
+ uint8_t Nl = 0;
+ for (int i = 0; i < 12; i++) { // max 12 ports
+ if ((dlsch_config_pdu->dmrs_ports>>i)&0x01) Nl += 1;
+ }
+ dlsch0_harq->Nl = Nl;
+ dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table;
+ downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch_config_pdu->rv, dlsch0->rnti_type);
+ if (dlsch0_harq->status != ACTIVE) {
+ // dlsch0_harq->status not ACTIVE due to false retransmission
+ // Reset the following flag to skip PDSCH procedures in that case and retrasmit harq status
+ dlsch0->active = 0;
+ update_harq_status(module_id,dlsch0->current_harq_pid,dlsch0_harq->ack);
+ }
+ /* PTRS */
+ dlsch0_harq->PTRSFreqDensity = dlsch_config_pdu->PTRSFreqDensity;
+ dlsch0_harq->PTRSTimeDensity = dlsch_config_pdu->PTRSTimeDensity;
+ dlsch0_harq->PTRSPortIndex = dlsch_config_pdu->PTRSPortIndex;
+ dlsch0_harq->nEpreRatioOfPDSCHToPTRS = dlsch_config_pdu->nEpreRatioOfPDSCHToPTRS;
+ dlsch0_harq->PTRSReOffset = dlsch_config_pdu->PTRSReOffset;
+ dlsch0_harq->pduBitmap = dlsch_config_pdu->pduBitmap;
+ LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\n", dlsch0->g_pucch, dlsch0_harq->mcs);
+}
+
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
bool found = false;
@@ -217,7 +274,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
module_id_t module_id = scheduled_response->module_id;
uint8_t cc_id = scheduled_response->CC_id, thread_id;
- uint32_t i;
int slot = scheduled_response->slot;
// Note: we have to handle the thread IDs for this. To be revisited completely.
@@ -229,89 +285,53 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
if(scheduled_response->dl_config != NULL){
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
-
+ fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu;
+ fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config;
pdcch_vars->nb_search_space = 0;
- for (i = 0; i < dl_config->number_pdus; ++i){
+ for (int i = 0; i < dl_config->number_pdus; ++i){
AssertFatal(dl_config->number_pdus < FAPI_NR_DL_CONFIG_LIST_NUM,"dl_config->number_pdus %d out of bounds\n",dl_config->number_pdus);
AssertFatal(dl_config->dl_config_list[i].pdu_type<=FAPI_NR_DL_CONFIG_TYPES,"pdu_type %d > 2\n",dl_config->dl_config_list[i].pdu_type);
LOG_D(PHY, "In %s: frame %d slot %d received 1 DL %s PDU of %d total DL PDUs:\n",
__FUNCTION__, scheduled_response->frame, slot, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus);
- if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
-
- fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
- memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
- pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
- pdcch_vars->sfn = scheduled_response->frame;
- pdcch_vars->slot = slot;
- LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space);
-
- } else {
-
- fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
- uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr;
-
- if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
- dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
- }
- else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
+ switch(dl_config->dl_config_list[i].pdu_type) {
+ case FAPI_NR_DL_CONFIG_TYPE_DCI:
+ pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
+ memcpy(&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],pdcch_config,sizeof(*pdcch_config));
+ pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
+ pdcch_vars->sfn = scheduled_response->frame;
+ pdcch_vars->slot = slot;
+ LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space);
+ break;
+ case FAPI_NR_DL_CONFIG_TYPE_CSI_IM:
+ LOG_I(PHY,"Received CSI-IM PDU at FAPI\n");
+ break;
+ case FAPI_NR_DL_CONFIG_TYPE_CSI_RS:
+ LOG_I(PHY,"Received CSI-RS PDU at FAPI\n");
+ break;
+ case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH:
+ dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
dlsch0->rnti_type = _RA_RNTI_;
- dlsch0->harq_processes[current_harq_pid]->status = ACTIVE;
- }
- else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
+ dlsch0->harq_processes[dlsch_config_pdu->harq_process_nbr]->status = ACTIVE;
+ configure_dlsch(dlsch0, dlsch_config_pdu, module_id,
+ dl_config->dl_config_list[i].dlsch_config_pdu.rnti);
+ break;
+ case FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH:
+ dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0];
dlsch0->rnti_type = _SI_RNTI_;
- dlsch0->harq_processes[current_harq_pid]->status = ACTIVE;
- }
-
- dlsch0->current_harq_pid = current_harq_pid;
- dlsch0->active = 1;
- dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
-
- LOG_D(PHY,"slot %d current_harq_pid = %d\n",slot, current_harq_pid);
-
- NR_DL_UE_HARQ_t *dlsch0_harq = dlsch0->harq_processes[current_harq_pid];
- if (dlsch0_harq){
-
- dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart;
- dlsch0_harq->BWPSize = dlsch_config_pdu->BWPSize;
- dlsch0_harq->nb_rb = dlsch_config_pdu->number_rbs;
- dlsch0_harq->start_rb = dlsch_config_pdu->start_rb;
- dlsch0_harq->nb_symbols = dlsch_config_pdu->number_symbols;
- dlsch0_harq->start_symbol = dlsch_config_pdu->start_symbol;
- dlsch0_harq->dlDmrsSymbPos = dlsch_config_pdu->dlDmrsSymbPos;
- dlsch0_harq->dmrsConfigType = dlsch_config_pdu->dmrsConfigType;
- dlsch0_harq->n_dmrs_cdm_groups = dlsch_config_pdu->n_dmrs_cdm_groups;
- dlsch0_harq->dmrs_ports = dlsch_config_pdu->dmrs_ports;
- dlsch0_harq->mcs = dlsch_config_pdu->mcs;
- dlsch0_harq->rvidx = dlsch_config_pdu->rv;
- dlsch0->g_pucch = dlsch_config_pdu->accumulated_delta_PUCCH;
- //get nrOfLayers from DCI info
- uint8_t Nl = 0;
- for (i = 0; i < 12; i++) { // max 12 ports
- if ((dlsch_config_pdu->dmrs_ports>>i)&0x01) Nl += 1;
- }
- dlsch0_harq->Nl = Nl;
- dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table;
- downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch_config_pdu->rv, dlsch0->rnti_type);
- if (dlsch0_harq->status != ACTIVE) {
- // dlsch0_harq->status not ACTIVE due to false retransmission
- // Reset the following flag to skip PDSCH procedures in that case and retrasmit harq status
- dlsch0->active = 0;
- update_harq_status(module_id,dlsch0->current_harq_pid,dlsch0_harq->ack);
- }
- /* PTRS */
- dlsch0_harq->PTRSFreqDensity = dlsch_config_pdu->PTRSFreqDensity;
- dlsch0_harq->PTRSTimeDensity = dlsch_config_pdu->PTRSTimeDensity;
- dlsch0_harq->PTRSPortIndex = dlsch_config_pdu->PTRSPortIndex;
- dlsch0_harq->nEpreRatioOfPDSCHToPTRS = dlsch_config_pdu->nEpreRatioOfPDSCHToPTRS;
- dlsch0_harq->PTRSReOffset = dlsch_config_pdu->PTRSReOffset;
- dlsch0_harq->pduBitmap = dlsch_config_pdu->pduBitmap;
- LOG_D(MAC, ">>>> \tdlsch0->g_pucch = %d\tdlsch0_harq.mcs = %d\n",
- dlsch0->g_pucch, dlsch0_harq->mcs);
- }
+ dlsch0->harq_processes[dlsch_config_pdu->harq_process_nbr]->status = ACTIVE;
+ configure_dlsch(dlsch0, dlsch_config_pdu, module_id,
+ dl_config->dl_config_list[i].dlsch_config_pdu.rnti);
+ break;
+ case FAPI_NR_DL_CONFIG_TYPE_DLSCH:
+ dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
+ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
+ configure_dlsch(dlsch0, dlsch_config_pdu, module_id,
+ dl_config->dl_config_list[i].dlsch_config_pdu.rnti);
+ break;
}
}
dl_config->number_pdus = 0;
@@ -322,9 +342,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
fapi_nr_ul_config_request_t *ul_config = scheduled_response->ul_config;
int pdu_done = 0;
pthread_mutex_lock(&ul_config->mutex_ul_config);
- LOG_D(PHY, "%d.%d ul S ul_config %p pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_done, ul_config->number_pdus);
- for (i = 0; i < ul_config->number_pdus; ++i){
+ LOG_D(PHY, "%d.%d ul S ul_config %p pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_done, ul_config->number_pdus);
+ for (int i = 0; i < ul_config->number_pdus; ++i){
AssertFatal(ul_config->ul_config_list[i].pdu_type <= FAPI_NR_UL_CONFIG_TYPES,"pdu_type %d out of bounds\n",ul_config->ul_config_list[i].pdu_type);
LOG_D(PHY, "In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n", __FUNCTION__, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 6a52ae6691..8f95e7fa03 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -576,6 +576,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_
get_dmrs_port(aatx,dlsch0_harq->dmrs_ports),
m,
BWPStart,
+ dlsch0_harq->dmrsConfigType,
ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12,
pdsch_nb_rb);
#if 0
@@ -610,7 +611,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_
dual_stream_UE = 0;
gNB_id_i = gNB_id+1;
i_mod = 0;
- if (( m==first_symbol_with_data ) && (m<4))
+ if (m==first_symbol_with_data)
first_symbol_flag = 1;
else
first_symbol_flag = 0;
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index c1443700f3..231d63cf04 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -64,6 +64,13 @@
void feptx_ofdm(RU_t *ru, int frame, int subframe);
void feptx_prec(RU_t *ru, int frame, int subframe);
+const char *__asan_default_options()
+{
+ /* don't do leak checking in nr_ulsim, not finished yet */
+ return "detect_leaks=0";
+}
+
+
double cpuf;
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
//#define MCS_COUNT 23//added for PHY abstraction
@@ -122,7 +129,6 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
for (aa=0; aanb_antennas_tx; aa++) {
- // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
@@ -140,7 +146,7 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
}
void DL_channel(RU_t *ru,PHY_VARS_UE *UE,uint subframe,int awgn_flag,double SNR, int tx_lev,int hold_channel,int abstx, int num_rounds, int trials, int round, channel_desc_t *eNB2UE[4],
- double *s_re[2],double *s_im[2],double *r_re[2],double *r_im[2],FILE *csv_fd) {
+ double *s_re[NB_ANTENNAS_TX],double *s_im[NB_ANTENNAS_TX],double *r_re[NB_ANTENNAS_RX],double *r_im[NB_ANTENNAS_RX],FILE *csv_fd) {
int i,u;
int aa,aarx,aatx;
double channelx,channely;
@@ -1538,9 +1544,9 @@ int main(int argc, char **argv) {
LOG_M("txsig0.m","txs0", &ru->common.txdata[0][subframe* eNB->frame_parms.samples_per_tti], eNB->frame_parms.samples_per_tti,1,1);
if (transmission_mode<7) {
- LOG_M("txsigF0.m","txsF0x", &ru->common.txdataF_BF[0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+ LOG_M("txsigF0.m","txsF0x", &ru->common.txdataF_BF[0][0],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
} else if (transmission_mode == 7) {
- LOG_M("txsigF0.m","txsF0", &ru->common.txdataF_BF[5][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
+ LOG_M("txsigF0.m","txsF0", &ru->common.txdataF_BF[5][0],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
LOG_M("txsigF0_BF.m","txsF0_BF", &ru->common.txdataF_BF[0][0],eNB->frame_parms.ofdm_symbol_size,1,1);
}
}
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
index 3b4e6782da..57c06e3b13 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c
@@ -112,7 +112,6 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
for (aa=0; aanb_antennas_tx; aa++) {
- // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
diff --git a/openair1/SIMULATION/LTE_PHY/framegen.c b/openair1/SIMULATION/LTE_PHY/framegen.c
index f5b1e6d45e..b9f0221b2d 100644
--- a/openair1/SIMULATION/LTE_PHY/framegen.c
+++ b/openair1/SIMULATION/LTE_PHY/framegen.c
@@ -333,7 +333,6 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
for (aa=0; aanb_antennas_tx; aa++) {
- // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c
index 31c3b47227..7efe9f4530 100644
--- a/openair1/SIMULATION/LTE_PHY/mbmssim.c
+++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c
@@ -121,7 +121,6 @@ void do_OFDM_mod_l(int32_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_
slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1);
for (aa=0; aanb_antennas_tx; aa++) {
- // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc());
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 1b1058535e..a1894d03d7 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -58,6 +58,12 @@
#include "common/ran_context.h"
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
+const char *__asan_default_options()
+{
+ /* don't do leak checking in ulsim, not finished yet */
+ return "detect_leaks=0";
+}
+
double cpuf;
#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0))
//#define MCS_COUNT 23//added for PHY abstraction
@@ -334,10 +340,10 @@ int main(int argc, char **argv) {
double s_re1[30720],s_im1[30720],r_re1[30720],r_im1[30720];
double r_re2[30720],r_im2[30720];
double r_re3[30720],r_im3[30720];
- double *s_re[2]= {s_re0,s_re1};
- double *s_im[2]= {s_im0,s_im1};
- double *r_re[4]= {r_re0,r_re1,r_re2,r_re3};
- double *r_im[4]= {r_im0,r_im1,r_im2,r_im3};
+ double *s_re[NB_ANTENNAS_TX]= {s_re0,s_re1, NULL, NULL};
+ double *s_im[NB_ANTENNAS_TX]= {s_im0,s_im1, NULL, NULL};
+ double *r_re[NB_ANTENNAS_RX]= {r_re0,r_re1,r_re2,r_re3};
+ double *r_im[NB_ANTENNAS_RX]= {r_im0,r_im1,r_im2,r_im3};
double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
double iqim=0.0;
int cqi_error,cqi_errors,ack_errors,cqi_crc_falsepositives,cqi_crc_falsenegatives;
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index f566b93d9c..f3aae9a3f7 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -29,6 +29,7 @@
#include "common/config/config_userapi.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
+#include "common/utils/load_module_shlib.h"
#include "T.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_common.h"
@@ -355,7 +356,7 @@ int main(int argc, char **argv)
}
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
- RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
+ RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
initTpool(gNBthreads, gNB->threadPool, true);
@@ -412,7 +413,7 @@ int main(int argc, char **argv)
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
//phy_init_nr_top(frame_parms);
- if (init_nr_ue_signal(UE, 1, 0) != 0) {
+ if (init_nr_ue_signal(UE, 1) != 0) {
printf("Error at UE NR initialisation\n");
exit(-1);
}
@@ -421,8 +422,7 @@ int main(int argc, char **argv)
//init_nr_ue_transport(UE, 0);
for (int sf = 0; sf < 2; sf++) {
for (i = 0; i < 2; i++) {
- UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL,
- 0);
+ UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL);
if (!UE->dlsch[sf][0][i]) {
printf("Can't get ue dlsch structures\n");
@@ -433,8 +433,6 @@ int main(int argc, char **argv)
}
}
- UE->dlsch_SI[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
- UE->dlsch_ra[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
processingData_L1tx_t msgDataTx;
init_DLSCH_struct(gNB, &msgDataTx);
@@ -472,16 +470,13 @@ int main(int argc, char **argv)
rel15->dlDmrsSymbPos = 4;
rel15->mcsIndex[0] = Imcs;
rel15->numDmrsCdmGrpsNoData = 1;
- double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
- short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
- short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
+ double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
+ short channel_output_fixed[16 * 68 * 384];
//unsigned char *estimated_output;
- unsigned char *estimated_output_bit;
- unsigned char *test_input_bit;
unsigned int errors_bit = 0;
- test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
+ unsigned char test_input_bit[16 * 68 * 384];
//estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
- estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
+ unsigned char estimated_output_bit[16 * 68 * 384];
NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[0][0][0];
NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid];
harq_process->mcs = Imcs;
@@ -495,9 +490,10 @@ int main(int argc, char **argv)
harq_process->dlDmrsSymbPos = 4;
harq_process->n_dmrs_cdm_groups = 1;
printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
+
unsigned char *test_input;
test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
-
+ //unsigned char test_input[TBS / 8] __attribute__ ((aligned(16)));
for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand();
@@ -554,12 +550,6 @@ int main(int argc, char **argv)
i,modulated_input[i],
i,channel_output_fixed[i]);
*/
-
- //Uncoded BER
- if (channel_output_fixed[i] < 0)
- channel_output_uncoded[i] = 1; //QPSK demod
- else
- channel_output_uncoded[i] = 0;
}
#ifdef DEBUG_CODER
@@ -641,12 +631,22 @@ int main(int argc, char **argv)
}
}*/
- for (i = 0; i < 2; i++) {
- printf("gNB %d\n", i);
- free_gNB_dlsch(&(msgDataTx.dlsch[0][i]),N_RB_DL);
- printf("UE %d\n", i);
- free_nr_ue_dlsch(&(UE->dlsch[0][0][i]),N_RB_DL);
- }
+ free(test_input);
+
+ free_channel_desc_scm(gNB2UE);
+
+ reset_DLSCH_struct(gNB, &msgDataTx);
+
+ phy_free_nr_gNB(gNB);
+ free(gNB->threadPool);
+ free(RC.gNB[0]);
+ free(RC.gNB);
+
+ for (int sf = 0; sf < 2; sf++)
+ for (int i = 0; i < 2; i++)
+ free_nr_ue_dlsch(&UE->dlsch[sf][0][i], N_RB_DL);
+ term_nr_ue_signal(UE, 1);
+ free(UE);
for (i = 0; i < 2; i++) {
free(s_re[i]);
@@ -671,6 +671,9 @@ int main(int argc, char **argv)
if (ouput_vcd)
vcd_signal_dumper_close();
+ loader_reset();
+ logTerm();
+
return (n_errors);
}
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 7b3fa0c205..8807d87ddc 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -73,6 +73,12 @@
#include
#include
+const char *__asan_default_options()
+{
+ /* don't do leak checking in nr_ulsim, not finished yet */
+ return "detect_leaks=0";
+}
+
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
rlc_info_t Rlc_info_um,Rlc_info_am_config;
@@ -435,7 +441,7 @@ int main(int argc, char **argv)
FILE *scg_fd=NULL;
- while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:qX:")) != -1) {
+ while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:q:m:w:T:U:X:")) != -1) {
switch (c) {
case 'f':
scg_fd = fopen(optarg,"r");
@@ -601,16 +607,17 @@ int main(int argc, char **argv)
case 'b':
g_rbSize = atoi(optarg);
break;
+
case 'D':
dlsch_threads = atoi(optarg);
- break;
+ break;
+
case 'e':
g_mcsIndex = atoi(optarg);
break;
case 'q':
- g_mcsTableIdx = 1;
- get_softmodem_params()->use_256qam_table = 1;
+ g_mcsTableIdx = atoi(optarg);
break;
case 'm':
@@ -674,7 +681,7 @@ int main(int argc, char **argv)
printf("-c Start symbol for PDSCH (fixed for now)\n");
printf("-j Number of symbols for PDSCH (fixed for now)\n");
printf("-e MSC index\n");
- printf("-q Use 2nd MCS table (256 QAM table) for PDSCH\n");
+ printf("-q MCS Table index\n");
printf("-t Acceptable effective throughput (in percentage)\n");
printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n");
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n");
@@ -775,11 +782,14 @@ int main(int argc, char **argv)
fill_scc_sim(rrc.carrier.servingcellconfigcommon,&ssb_bitmap,N_RB_DL,N_RB_DL,mu,mu);
ssb_bitmap = 1;// Enable only first SSB with index ssb_indx=0
fix_scc(scc,ssb_bitmap);
-
prepare_scd(scd);
- fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 6, 0, 0, 0);
+ NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t));
+ prepare_sim_uecap(UE_Capability_nr,scc,mu,
+ N_RB_DL,g_mcsTableIdx);
+ // TODO do a UECAP for phy-sim
+ fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, UE_Capability_nr, 0, 1, n_tx, 6, 0, 0, 0);
/* RRC parameter validation for secondaryCellGroup */
fix_scd(scd);
@@ -917,16 +927,25 @@ int main(int argc, char **argv)
UE->perfect_ce = 0;
- if (init_nr_ue_signal(UE, 1, 0) != 0)
+ if (init_nr_ue_signal(UE, 1) != 0)
{
printf("Error at UE NR initialisation\n");
exit(-1);
}
- init_nr_ue_transport(UE,0);
+ init_nr_ue_transport(UE);
nr_gold_pbch(UE);
- nr_gold_pdcch(UE,0);
+
+ // compute the scramblingID_pdcch and the gold pdcch
+ UE->scramblingID_pdcch = frame_parms->Nid_cell;
+ nr_gold_pdcch(UE, frame_parms->Nid_cell);
+
+ // compute the scrambling IDs for PDSCH DMRS
+ for (int i = 0; i < 2; i++)
+ UE->scramblingID[i] = frame_parms->Nid_cell;
+
+ nr_gold_pdsch(UE, UE->scramblingID);
nr_l2_init_ue(NULL);
UE_mac = get_mac_inst(0);
@@ -999,8 +1018,6 @@ int main(int argc, char **argv)
msgDataTx->slot = slot;
msgDataTx->frame = frame;
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
- reset_meas(&msgDataTx->phy_proc_tx);
- gNB->phy_proc_tx[0] = &msgDataTx->phy_proc_tx;
for (SNR = snr0; SNR < snr1; SNR += .2) {
@@ -1314,7 +1331,7 @@ int main(int argc, char **argv)
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n",
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3);
- printDistribution(gNB->phy_proc_tx[0],table_tx,"PHY proc tx");
+ printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
printStatIndent3(&gNB->tinput,"DLSCH LDPC input processing time");
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index 0f5752c227..f3a8d21fdd 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -27,6 +27,7 @@
#include
#include "common/config/config_userapi.h"
#include "common/utils/LOG/log.h"
+#include "common/utils/load_module_shlib.h"
#include "common/ran_context.h"
#include "common/utils/nr/nr_common.h"
#include "PHY/types.h"
@@ -438,12 +439,13 @@ int main(int argc, char **argv)
printf("Initializing gNodeB for mu %d, N_RB_DL %d\n",mu,N_RB_DL);
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
- RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
+ RC.gNB[0] = malloc16_clear(sizeof(*(RC.gNB[0])));
gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx;
+ frame_parms->nb_antenna_ports_gNB = n_tx;
frame_parms->N_RB_DL = N_RB_DL;
frame_parms->Nid_cell = Nid_cell;
frame_parms->nushift = Nid_cell%4;
@@ -533,19 +535,13 @@ int main(int argc, char **argv)
for (i=0; i<2; i++) {
- s_re[i] = malloc(frame_length_complex_samples*sizeof(double));
- bzero(s_re[i],frame_length_complex_samples*sizeof(double));
- s_im[i] = malloc(frame_length_complex_samples*sizeof(double));
- bzero(s_im[i],frame_length_complex_samples*sizeof(double));
-
- r_re[i] = malloc(frame_length_complex_samples*sizeof(double));
- bzero(r_re[i],frame_length_complex_samples*sizeof(double));
- r_im[i] = malloc(frame_length_complex_samples*sizeof(double));
- bzero(r_im[i],frame_length_complex_samples*sizeof(double));
+ s_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
+ s_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
+ r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
+ r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
- txdata[i] = malloc(frame_length_complex_samples*sizeof(int));
- bzero(r_re[i],frame_length_complex_samples*sizeof(int));
+ txdata[i] = malloc16_clear(frame_length_complex_samples*sizeof(int));
}
if (pbch_file_fd!=NULL) {
@@ -554,8 +550,8 @@ int main(int argc, char **argv)
//configure UE
- UE = malloc(sizeof(PHY_VARS_NR_UE));
- memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
+ UE = malloc16_clear(sizeof(*UE));
+ memcpy(&UE->frame_parms,frame_parms,sizeof(UE->frame_parms));
//phy_init_nr_top(UE); //called from init_nr_ue_signal
if (run_initial_sync==1) UE->is_synchronized = 0;
else UE->is_synchronized = 1;
@@ -565,7 +561,7 @@ int main(int argc, char **argv)
if(eps!=0.0)
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
- if (init_nr_ue_signal(UE, 1, 0) != 0) {
+ if (init_nr_ue_signal(UE, 1) != 0) {
printf("Error at UE NR initialisation\n");
exit(-1);
}
@@ -780,6 +776,15 @@ int main(int argc, char **argv)
} // NSR
+ free_channel_desc_scm(gNB2UE);
+
+ phy_free_nr_gNB(gNB);
+ free(RC.gNB[0]);
+ free(RC.gNB);
+
+ term_nr_ue_signal(UE, 1);
+ free(UE);
+
for (i=0; i<2; i++) {
free(s_re[i]);
free(s_im[i]);
@@ -800,6 +805,9 @@ int main(int argc, char **argv)
if (input_fd)
fclose(input_fd);
+ loader_reset();
+ logTerm();
+
return(n_errors);
}
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
index 2d1ca3d25a..bc4f4a0b60 100644
--- a/openair1/SIMULATION/NR_PHY/prachsim.c
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -25,6 +25,7 @@
#include
#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
#include "common/utils/LOG/log.h"
#include "common/ran_context.h"
@@ -662,7 +663,6 @@ int main(int argc, char **argv){
RC.nb_nr_L1_inst=1;
phy_init_nr_gNB(gNB,0,1); //lowmem
nr_phy_init_RU(ru);
- gNB->common_vars.rxdata = ru->common.rxdata;
set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4);
// Configure UE
@@ -674,7 +674,7 @@ int main(int argc, char **argv){
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
UE->nrUE_config.prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t));
- if (init_nr_ue_signal(UE, 1, 0) != 0){
+ if (init_nr_ue_signal(UE, 1) != 0){
printf("Error at UE NR initialisation\n");
exit(-1);
}
@@ -781,7 +781,7 @@ int main(int argc, char **argv){
// multipath channel
// dump_nr_prach_config(&gNB->frame_parms,subframe);
- for (i = 0; i < frame_parms->samples_per_subframe<<1; i++) {
+ for (i = 0; i < frame_parms->samples_per_subframe; i++) {
for (aa=0; aa<1; aa++) {
if (awgn_flag == 0) {
s_re[aa][i] = ((double)(((short *)&txdata[aa][prach_start]))[(i<<1)]);
@@ -879,7 +879,8 @@ int main(int argc, char **argv){
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
- gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion];
+ for (int i = 0; i < ru->nb_rx; ++i)
+ gNB->prach_vars.rxsigF[i] = ru->prach_rxsigF[prachOccasion][i];
if (n_frames == 1) printf("ncs %d,num_seq %d\n",prach_pdu->num_cs, prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
rx_nr_prach(gNB, prach_pdu, prachOccasion, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay);
@@ -897,7 +898,7 @@ int main(int argc, char **argv){
#ifdef NR_PRACH_DEBUG
LOG_M("prach0.m","prach0", &txdata[0][prach_start], frame_parms->samples_per_subframe, 1, 1);
LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1);
- LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
+ LOG_M("rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1);
LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1);
LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1);
@@ -922,6 +923,28 @@ int main(int argc, char **argv){
break;
} //SNR loop
+ free_channel_desc_scm(UE2gNB);
+
+ nr_phy_free_RU(ru);
+ free(RC.ru[0]);
+ free(RC.ru);
+
+ phy_free_nr_gNB(gNB);
+ // allocated in set_tdd_config_nr()
+ int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<gNB_config.prach_config.num_prach_fd_occasions_list);
+ for (int i = 0; i < nb_slots_to_set; ++i)
+ free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list);
+ free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list);
+ free(RC.gNB[0]);
+ free(RC.gNB);
+
+ term_nr_ue_signal(UE, 1);
+ free(UE->nrUE_config.prach_config.num_prach_fd_occasions_list);
+ free(UE);
+ free(PHY_vars_UE_g[0]);
+ free(PHY_vars_UE_g);
+
for (i=0; i<2; i++) {
free(s_re[i]);
free(s_im[i]);
@@ -936,5 +959,8 @@ int main(int argc, char **argv){
if (input_fd) fclose(input_fd);
+ loader_reset();
+ logTerm();
+
return(0);
}
diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c
index 465fe71f60..151d51d726 100644
--- a/openair1/SIMULATION/NR_PHY/pucchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pucchsim.c
@@ -26,6 +26,7 @@
#include
#include
#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
#include "common/utils/LOG/log.h"
#include "common/ran_context.h"
#include "PHY/types.h"
@@ -70,7 +71,6 @@ int main(int argc, char **argv)
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
double cfo=0;
uint8_t snr1set=0;
- int **txdataF,**rxdataF;
double **s_re,**s_im,**r_re,**r_im;
//int sync_pos, sync_pos_slot;
//FILE *rx_frame_file;
@@ -372,7 +372,7 @@ int main(int argc, char **argv)
printf("Transmitted payload is %ld, do_DTX = %d\n",actual_payload,do_DTX);
- RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
+ RC.gNB = calloc(1, sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
gNB->pucch0_thres = pucch_DTX_thres;
@@ -441,24 +441,15 @@ int main(int argc, char **argv)
s_im = malloc(n_tx*sizeof(double*));
r_re = malloc(n_rx*sizeof(double*));
r_im = malloc(n_rx*sizeof(double*));
- txdataF = malloc(n_tx*sizeof(int*));
- rxdataF = malloc(n_rx*sizeof(int*));
- gNB->common_vars.rxdataF=rxdataF;
memcpy((void*)&gNB->frame_parms,(void*)frame_parms,sizeof(frame_parms));
for (int aatx=0; aatxsymbols_per_slot*frame_parms->ofdm_symbol_size);
- txdataF[aatx] = memalign(32,14*frame_parms->ofdm_symbol_size*sizeof(int));
- bzero(txdataF[aatx],14*frame_parms->ofdm_symbol_size*sizeof(int));
}
for (int aarx=0; aarxsymbols_per_slot*frame_parms->ofdm_symbol_size);
- rxdataF[aarx] = memalign(32,14*frame_parms->ofdm_symbol_size*sizeof(int));
- bzero(rxdataF[aarx],14*frame_parms->ofdm_symbol_size*sizeof(int));
}
uint8_t mcs=0;
@@ -474,7 +465,6 @@ int main(int argc, char **argv)
mcs=table2_mcs[actual_payload+shift];
else AssertFatal(1==0,"Either nr_bit %d or sr_flag %d must be non-zero\n", nr_bit, sr_flag);
}
- else if (format == 2 && nr_bit > 11) gNB->uci_polarParams = nr_polar_params(2, nr_bit, nrofPRB, 1, NULL);
startingPRB_intraSlotHopping = N_RB_DL-1;
uint32_t hopping_id = Nid_cell;
@@ -490,7 +480,7 @@ int main(int argc, char **argv)
if(eps!=0.0)
UE->UE_fo_compensation = 1; // if a frequency offset is set then perform fo estimation and compensation
- if (init_nr_ue_signal(UE, 1, 0) != 0)
+ if (init_nr_ue_signal(UE, 1) != 0)
{
printf("Error at UE NR initialisation\n");
exit(-1);
@@ -536,6 +526,7 @@ int main(int argc, char **argv)
ack_nack_errors=0;
sr_errors=0;
n_errors = 0;
+ int **txdataF = gNB->common_vars.txdataF;
for (trial=0; trialofdm_symbol_size*sizeof(int));
@@ -560,18 +551,17 @@ int main(int argc, char **argv)
if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB);
- int i0;
- double txr,txi,rxr,rxi,nr,ni;
+ struct complex16 **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF;
for (int symb=0; symbframe_parms.symbols_per_slot;symb++) {
if (symb= startingSymbolIndex+nrofSymbols) {
- i0 = symb*gNB->frame_parms.ofdm_symbol_size;
+ int i0 = symb*gNB->frame_parms.ofdm_symbol_size;
for (int re=0;reframe_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
for (int aarx=0;aarxframe_parms.ofdm_symbol_size;
+ int i0 = (startingSymbolIndex + symb)*gNB->frame_parms.ofdm_symbol_size;
for (int re=0;reframe_parms.first_carrier_offset + re)%gNB->frame_parms.ofdm_symbol_size);
- phasor.r = cos(2*M_PI*phase*re);
+ struct complexd phasor;
+ phasor.r = cos(2*M_PI*phase*re);
phasor.i = sin(2*M_PI*phase*re);
for (int aarx=0;aarxchF[aarx][re].r - txi*UE2gNB->chF[aarx][re].i;
- rxi = txr*UE2gNB->chF[aarx][re].i + txi*UE2gNB->chF[aarx][re].r;
- rxr_tmp = rxr*phasor.r - rxi*phasor.i;
+ double txr = (double)(((int16_t *)txdataF[0])[(i<<1)]);
+ double txi = (double)(((int16_t *)txdataF[0])[1+(i<<1)]);
+ double rxr={0},rxi={0};
+ for (int l = 0; lchannel_length; l++) {
+ rxr = txr*UE2gNB->chF[aarx][l].r - txi*UE2gNB->chF[aarx][l].i;
+ rxi = txr*UE2gNB->chF[aarx][l].i + txi*UE2gNB->chF[aarx][l].r;
+ }
+ double rxr_tmp = rxr*phasor.r - rxi*phasor.i;
rxi = rxr*phasor.i + rxi*phasor.r;
rxr = rxr_tmp;
- nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
- ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
- ((int16_t*)rxdataF[aarx])[i<<1] = (int16_t)(100.0*(rxr + nr)/sqrt((double)txlev));
- ((int16_t*)rxdataF[aarx])[1+(i<<1)]=(int16_t)(100.0*(rxi + ni)/sqrt((double)txlev));
+ double nr = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
+ double ni = sqrt(sigma2/2)*gaussdouble(0.0,1.0);
+ rxdataF[aarx][i].r = (int16_t)(100.0*(rxr + nr)/sqrt((double)txlev));
+ rxdataF[aarx][i].i=(int16_t)(100.0*(rxi + ni)/sqrt((double)txlev));
if (n_trials==1 && abs(txr) > 0) printf("symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d\n",
symb, re, aarx, txr,txi,
UE2gNB->chF[aarx][re].r,UE2gNB->chF[aarx][re].i,
nr,ni, rxr,rxi,
- ((int16_t*)rxdataF[aarx])[i<<1],((int16_t*)rxdataF[aarx])[1+(i<<1)]);
+ rxdataF[aarx][i].r,rxdataF[aarx][i].i);
}
}
}
int rxlev=0;
- for (int aarx=0;aarxofdm_symbol_size],
+ for (int aarx=0;aarxofdm_symbol_size],
frame_parms->ofdm_symbol_size);
int rxlev_pucch=0;
- for (int aarx=0;aarxofdm_symbol_size],
+ for (int aarx=0;aarxofdm_symbol_size],
12);
// set UL mask for pucch allocation
@@ -660,25 +652,26 @@ int main(int argc, char **argv)
if(sr_flag==1){
if (uci_pdu.sr->sr_indication == 0 || uci_pdu.sr->sr_confidence_level == 1)
sr_errors+=1;
+ free(uci_pdu.sr);
}
// harq value 0 -> pass
+ nfapi_nr_harq_t *harq_list = uci_pdu.harq->harq_list;
// confidence value 0 -> good confidence
- const int harq_value0 = uci_pdu.harq->harq_list[0].harq_value;
- const int harq_value1 = uci_pdu.harq->harq_list[1].harq_value;
const int confidence_lvl = uci_pdu.harq->harq_confidence_level;
if(nr_bit>0){
if (nr_bit==1 && do_DTX == 0)
- ack_nack_errors+=(actual_payload^(!harq_value0));
+ ack_nack_errors+=(actual_payload^(!harq_list[0].harq_value));
else if (do_DTX == 0)
- ack_nack_errors+=(((actual_payload&1)^(!harq_value0))+((actual_payload>>1)^(!harq_value1)));
- else if ((!confidence_lvl && !harq_value0) ||
- (!confidence_lvl && nr_bit == 2 && !harq_value1))
+ ack_nack_errors+=(((actual_payload&1)^(!harq_list[0].harq_value))+((actual_payload>>1)^(!harq_list[1].harq_value)));
+ else if ((!confidence_lvl && !harq_list[0].harq_value) ||
+ (!confidence_lvl && nr_bit == 2 && !harq_list[1].harq_value))
ack_nack_errors++;
free(uci_pdu.harq->harq_list);
}
+ free(uci_pdu.harq);
}
else if (format==1) {
- nr_decode_pucch1(rxdataF,PUCCH_GroupHopping,hopping_id,
+ nr_decode_pucch1((int32_t **)rxdataF,PUCCH_GroupHopping,hopping_id,
&(payload_received),frame_parms,amp,nr_slot_tx,
m0,nrofSymbols,startingSymbolIndex,startingPRB,
startingPRB_intraSlotHopping,timeDomainOCC,nr_bit);
@@ -734,26 +727,34 @@ int main(int argc, char **argv)
break;
}
}
+ free_channel_desc_scm(UE2gNB);
+ term_freq_channel();
+
+ phy_free_nr_gNB(gNB);
+ free(RC.gNB[0]);
+ free(RC.gNB);
+
+ term_nr_ue_signal(UE, 1);
+ free(UE);
for (int aatx=0; aatx
#include
#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
#include "common/utils/LOG/log.h"
#include "common/ran_context.h"
#include "PHY/types.h"
@@ -372,7 +373,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
- RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
+ RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0];
//gNB_config = &gNB->gNB_config;
@@ -400,7 +401,7 @@ int main(int argc, char **argv)
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
//phy_init_nr_top(frame_parms);
- if (init_nr_ue_signal(UE, 1, 0) != 0) {
+ if (init_nr_ue_signal(UE, 1) != 0) {
printf("Error at UE NR initialisation.\n");
exit(-1);
}
@@ -408,7 +409,7 @@ int main(int argc, char **argv)
for (sf = 0; sf < 2; sf++) {
for (i = 0; i < 2; i++) {
- UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0);
+ UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8);
if (!UE->ulsch[sf][0][i]) {
printf("Can't get ue ulsch structures.\n");
@@ -454,46 +455,39 @@ int main(int argc, char **argv)
rel15_ul->pusch_data.tb_size = TBS/8;
///////////////////////////////////////////////////
- double *modulated_input = malloc16(sizeof(double) * 16 * 68 * 384); // [hna] 16 segments, 68*Zc
- short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
- short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
+ double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc
+ short channel_output_fixed[16 * 68 * 384];
+ short channel_output_uncoded[16 * 68 * 384];
unsigned int errors_bit_uncoded = 0;
- unsigned char *estimated_output_bit;
- unsigned char *test_input_bit;
unsigned int errors_bit = 0;
- test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
- estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
-
- unsigned char *test_input;
- test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
-
- for (i = 0; i < TBS / 8; i++)
- test_input[i] = (unsigned char) rand();
+ unsigned char test_input_bit[16 * 68 * 384];
+ unsigned char estimated_output_bit[16 * 68 * 384];
/////////////////////////[adk] preparing UL harq_process parameters/////////////////////////
///////////
NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid];
+ DevAssert(harq_process_ul_ue);
N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig
N_RE_prime = NR_NB_SC_PER_RB*nb_symb_sch - nb_re_dmrs - N_PRB_oh;
- if (harq_process_ul_ue) {
+ harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
+ harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
+ harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
+ harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
+ harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
+ harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
+ harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
+ harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
+ unsigned char *test_input = harq_process_ul_ue->a;
- harq_process_ul_ue->pusch_pdu.rnti = n_rnti;
- harq_process_ul_ue->pusch_pdu.mcs_index = Imcs;
- harq_process_ul_ue->pusch_pdu.nrOfLayers = Nl;
- harq_process_ul_ue->pusch_pdu.rb_size = nb_rb;
- harq_process_ul_ue->pusch_pdu.nr_of_symbols = nb_symb_sch;
- harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*nb_codewords;
- harq_process_ul_ue->pusch_pdu.pusch_data.rv_index = rvidx;
- harq_process_ul_ue->pusch_pdu.pusch_data.tb_size = TBS/8;
- harq_process_ul_ue->a = &test_input[0];
-
- }
///////////
////////////////////////////////////////////////////////////////////////////////////////////
+ for (i = 0; i < TBS / 8; i++)
+ test_input[i] = (unsigned char) rand();
+
#ifdef DEBUG_NR_ULSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
#endif
@@ -620,6 +614,19 @@ int main(int argc, char **argv)
printf("\n");
}
+ for (sf = 0; sf < 2; sf++)
+ for (i = 0; i < 2; i++)
+ free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL);
+ term_nr_ue_signal(UE, 1);
+ free(UE);
+
+ phy_free_nr_gNB(gNB);
+ free(gNB->threadPool);
+ free(gNB->respDecode);
+ free(RC.gNB[0]);
+ free(RC.gNB);
+
+ free_channel_desc_scm(gNB2UE);
if (output_fd)
fclose(output_fd);
@@ -627,6 +634,9 @@ int main(int argc, char **argv)
if (input_fd)
fclose(input_fd);
+ loader_reset();
+ logTerm();
+
return (n_errors);
}
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 6e9b88593c..76d896a047 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -68,6 +68,12 @@
#include
//#define DEBUG_ULSIM
+const char *__asan_default_options()
+{
+ /* don't do leak checking in nr_ulsim, not finished yet */
+ return "detect_leaks=0";
+}
+
LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
rlc_info_t Rlc_info_um,Rlc_info_am_config;
@@ -683,7 +689,6 @@ int main(int argc, char **argv)
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_free,NULL);
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
msgDataTx->slot = -1;
- gNB->phy_proc_tx[0] = &msgDataTx->phy_proc_tx;
//gNB_config = &gNB->gNB_config;
//memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
@@ -725,7 +730,8 @@ int main(int argc, char **argv)
prepare_scd(scd);
- fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0, 0);
+ // TODO do a UECAP for phy-sim
+ fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, NULL, 0, 1, n_tx, 0, 0, 0, 0);
// xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
@@ -760,28 +766,17 @@ int main(int argc, char **argv)
PHY_vars_UE_g[0][0] = UE;
memcpy(&UE->frame_parms, frame_parms, sizeof(NR_DL_FRAME_PARMS));
- //phy_init_nr_top(frame_parms);
- if (init_nr_ue_signal(UE, 1, 0) != 0) {
+ if (init_nr_ue_signal(UE, 1) != 0) {
printf("Error at UE NR initialisation\n");
exit(-1);
}
- //nr_init_frame_parms_ue(&UE->frame_parms);
- init_nr_ue_transport(UE, 0);
+ init_nr_ue_transport(UE);
- /*
- for (int sf = 0; sf < 2; sf++) {
- for (i = 0; i < 2; i++) {
-
- UE->ulsch[sf][0][i] = new_nr_ue_ulsch(N_RB_UL, 8, 0);
-
- if (!UE->ulsch[sf][0][i]) {
- printf("Can't get ue ulsch structures\n");
- exit(-1);
- }
- }
- }
- */
+ // initialize the pusch dmrs
+ uint16_t N_n_scid[2] = {frame_parms->Nid_cell,frame_parms->Nid_cell};
+ int n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
+ nr_init_pusch_dmrs(UE, N_n_scid, n_scid);
//Configure UE
NR_UE_RRC_INST_t rrcue;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
index f3dbc78a73..4334bd12f9 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
@@ -71,7 +71,7 @@ static nfapi_config_request_t *config =&config_t;
/*************** FUNCTIONS ****************************************/
//void phy_init_nr_top(NR_DL_FRAME_PARMS *frame_parms);
-int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_eNB, uint8_t abstraction_flag);
+int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_eNB);
/*******************************************************************
*
@@ -248,7 +248,7 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
//phy_init_nr_top(frame_parms);
- if (init_nr_ue_signal(PHY_vars_UE, 1, 0) != 0) {
+ if (init_nr_ue_signal(PHY_vars_UE, 1) != 0) {
LOG_E(PHY,"Error at UE NR initialisation : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
return (0);
}
diff --git a/openair1/SIMULATION/TOOLS/abstraction.c b/openair1/SIMULATION/TOOLS/abstraction.c
index a6b0586882..b1cd691ec4 100644
--- a/openair1/SIMULATION/TOOLS/abstraction.c
+++ b/openair1/SIMULATION/TOOLS/abstraction.c
@@ -33,11 +33,26 @@
// NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED)
double **cos_lut=NULL,* *sin_lut=NULL;
+static int freq_channel_init = 0;
+static int n_samples_max = 0;
//#if 1
-
+void term_freq_channel(void)
+{
+ for (int f = -(n_samples_max >> 1); f <= n_samples_max >> 1; f++) {
+ const int idx = f + (n_samples_max >> 1);
+ if (cos_lut[idx])
+ free_and_zero(cos_lut[idx]);
+ if (sin_lut[idx])
+ free_and_zero(sin_lut[idx]);
+ }
+ free_and_zero(cos_lut);
+ free_and_zero(sin_lut);
+ freq_channel_init = 0;
+ n_samples_max = 0;
+}
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs) {
double delta_f,freq; // 90 kHz spacing
@@ -78,8 +93,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs)
int16_t f,f2,d;
uint8_t aarx,aatx,l;
double *clut,*slut;
- static int freq_channel_init=0;
- static int n_samples_max=0;
// do some error checking
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
diff --git a/openair1/SIMULATION/TOOLS/channel_sim.c b/openair1/SIMULATION/TOOLS/channel_sim.c
index 197a296a51..de8db5d7cb 100644
--- a/openair1/SIMULATION/TOOLS/channel_sim.c
+++ b/openair1/SIMULATION/TOOLS/channel_sim.c
@@ -40,7 +40,6 @@
#include "PHY_INTERFACE/phy_interface_extern.h"
#include "UTIL/OCG/OCG.h"
#include "UTIL/OPT/opt.h" // to test OPT
-#include "UTIL/FIFO/types.h"
#define RF
diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c
index b00f6e31d5..0f6b8fb1bc 100644
--- a/openair1/SIMULATION/TOOLS/random_channel.c
+++ b/openair1/SIMULATION/TOOLS/random_channel.c
@@ -125,7 +125,7 @@ void fill_channel_desc(channel_desc_t *chan_desc,
chan_desc->ch[i] = (struct complexd *) malloc(channel_length * sizeof(struct complexd));
for (i = 0; ichF[i] = (struct complexd *) malloc(12*257 * sizeof(struct complexd)); // allocate for up to 257 RBs, 12 samples per RB
+ chan_desc->chF[i] = (struct complexd *) malloc(275 * 12 * sizeof(struct complexd)); // allocate for up to 275 RBs, 12 symbols per RB
LOG_D(OCM,"[CHANNEL] Filling a (nb_taps %d)\n",nb_taps);
diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h
index ce470fe0b0..f12483d70a 100644
--- a/openair1/SIMULATION/TOOLS/sim.h
+++ b/openair1/SIMULATION/TOOLS/sim.h
@@ -479,6 +479,7 @@ void randominit(unsigned int seed_init);
double uniformrandom(void);
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples,int scs);
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int scs);
+void term_freq_channel(void);
uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
void multipath_tv_channel(channel_desc_t *desc,
double **tx_sig_re,
diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h
index 60d48c8284..ca7dd0b0bb 100644
--- a/openair2/COMMON/ngap_messages_types.h
+++ b/openair2/COMMON/ngap_messages_types.h
@@ -353,9 +353,18 @@ typedef struct pdusession_tobeswitched_s {
uint32_t gtp_teid;
} pdusession_tobeswitched_t;
+typedef struct qos_flow_tobe_modified_s {
+ uint8_t qfi; // 0~63
+} qos_flow_tobe_modified_t;
+
typedef struct pdusession_modify_s {
/* Unique pdusession_id for the UE. */
uint8_t pdusession_id;
+
+ uint8_t nb_of_qos_flow;
+
+ // qos_flow_add_or_modify
+ qos_flow_tobe_modified_t qos[QOSFLOW_MAX_VALUE];
} pdusession_modify_t;
typedef enum ngap_Cause_e {
@@ -821,7 +830,7 @@ typedef struct ngap_pdusession_modify_req_s {
/* Number of pdusession to be modify in the list */
uint8_t nb_pdusessions_tomodify;
- /* E RAB modify request */
+ /* pdu session modify request */
pdusession_t pdusession_modify_params[NGAP_MAX_PDUSESSION];
} ngap_pdusession_modify_req_t;
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index cb93c2feb8..6637d05a8a 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -69,7 +69,7 @@
#include "nfapi_interface.h"
#include "PHY_INTERFACE/IF_Module.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
#include "PHY/defs_common.h" // for PRACH_RESOURCES_t
#include "PHY/LTE_TRANSPORT/transport_common.h"
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
index 1f7c8b7747..ede8b89f42 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
@@ -315,21 +315,21 @@ void get_info_from_tda_tables(int default_abc,
int tda,
int dmrs_TypeA_Position,
int normal_CP,
+ bool *is_mapping_typeA,
int *startSymbolIndex,
int *nrOfSymbols) {
int k0 = 0;
- int is_mapping_typeA = 1;
switch(default_abc){
case 1:
if (normal_CP){
if (dmrs_TypeA_Position){
- is_mapping_typeA = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][0];
k0 = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][1];
*startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][2];
*nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[tda][3];
}
else{
- is_mapping_typeA = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][0];
k0 = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][1];
*startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][2];
*nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[tda][3];
@@ -337,13 +337,13 @@ void get_info_from_tda_tables(int default_abc,
}
else{
if (dmrs_TypeA_Position){
- is_mapping_typeA = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][0];
k0 = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][1];
*startSymbolIndex = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][2];
*nrOfSymbols = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[tda][3];
}
else{
- is_mapping_typeA = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][0];
k0 = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][1];
*startSymbolIndex = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][2];
*nrOfSymbols = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[tda][3];
@@ -352,13 +352,13 @@ void get_info_from_tda_tables(int default_abc,
break;
case 2:
if (dmrs_TypeA_Position){
- is_mapping_typeA = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][0];
k0 = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][1];
*startSymbolIndex = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][2];
*nrOfSymbols = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[tda][3];
}
else{
- is_mapping_typeA = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][0];
k0 = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][1];
*startSymbolIndex = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][2];
*nrOfSymbols = table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[tda][3];
@@ -366,13 +366,13 @@ void get_info_from_tda_tables(int default_abc,
break;
case 3:
if (dmrs_TypeA_Position){
- is_mapping_typeA = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][0];
k0 = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][1];
*startSymbolIndex = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][2];
*nrOfSymbols = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[tda][3];
}
else{
- is_mapping_typeA = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][0];
+ *is_mapping_typeA = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][0];
k0 = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][1];
*startSymbolIndex = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][2];
*nrOfSymbols = table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[tda][3];
@@ -382,7 +382,6 @@ void get_info_from_tda_tables(int default_abc,
AssertFatal(1==0,"Invalid default time domaing allocation type\n");
}
AssertFatal(k0==0,"Only k0 = 0 is supported\n");
- AssertFatal(is_mapping_typeA==1,"Only mapping type A is currently supported\n");
}
const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"};
@@ -2722,6 +2721,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
LOG_D(NR_MAC,"DAI1 nbits %d\n",dci_pdu->dai[0].nbits);
// 2nd DAI
if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig &&
+ cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup &&
cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) { //TODO not sure about that
dci_pdu->dai[1].nbits = 2;
size += dci_pdu->dai[1].nbits;
@@ -2993,7 +2993,8 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
dci_pdu->srs_request.nbits = 3;
size += dci_pdu->srs_request.nbits;
// CBGTI
- if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig&&
+ if (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig &&
+ cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup &&
cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
uint8_t maxCBGperTB = (cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock + 1) * 2;
long *maxCWperDCI_rrc = pdsch_Config->maxNrofCodeWordsScheduledByDCI;
@@ -3338,65 +3339,65 @@ uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i
void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
- NR_NZP_CSI_RS_Resource_t *nzpcsi,
+ struct NR_CSI_ResourcePeriodicityAndOffset *periodicityAndOffset,
int *period, int *offset) {
- if(nzpcsi != NULL) {
+ if(periodicityAndOffset != NULL) {
- NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = nzpcsi->periodicityAndOffset->present;
+ NR_CSI_ResourcePeriodicityAndOffset_PR p_and_o = periodicityAndOffset->present;
switch(p_and_o){
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots4:
*period = 4;
- *offset = nzpcsi->periodicityAndOffset->choice.slots4;
+ *offset = periodicityAndOffset->choice.slots4;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots5:
*period = 5;
- *offset = nzpcsi->periodicityAndOffset->choice.slots5;
+ *offset = periodicityAndOffset->choice.slots5;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots8:
*period = 8;
- *offset = nzpcsi->periodicityAndOffset->choice.slots8;
+ *offset = periodicityAndOffset->choice.slots8;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots10:
*period = 10;
- *offset = nzpcsi->periodicityAndOffset->choice.slots10;
+ *offset = periodicityAndOffset->choice.slots10;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots16:
*period = 16;
- *offset = nzpcsi->periodicityAndOffset->choice.slots16;
+ *offset = periodicityAndOffset->choice.slots16;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots20:
*period = 20;
- *offset = nzpcsi->periodicityAndOffset->choice.slots20;
+ *offset = periodicityAndOffset->choice.slots20;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots32:
*period = 32;
- *offset = nzpcsi->periodicityAndOffset->choice.slots32;
+ *offset = periodicityAndOffset->choice.slots32;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots40:
*period = 40;
- *offset = nzpcsi->periodicityAndOffset->choice.slots40;
+ *offset = periodicityAndOffset->choice.slots40;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots64:
*period = 64;
- *offset = nzpcsi->periodicityAndOffset->choice.slots64;
+ *offset = periodicityAndOffset->choice.slots64;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots80:
*period = 80;
- *offset = nzpcsi->periodicityAndOffset->choice.slots80;
+ *offset = periodicityAndOffset->choice.slots80;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots160:
*period = 160;
- *offset = nzpcsi->periodicityAndOffset->choice.slots160;
+ *offset = periodicityAndOffset->choice.slots160;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots320:
*period = 320;
- *offset = nzpcsi->periodicityAndOffset->choice.slots320;
+ *offset = periodicityAndOffset->choice.slots320;
break;
case NR_CSI_ResourcePeriodicityAndOffset_PR_slots640:
*period = 640;
- *offset = nzpcsi->periodicityAndOffset->choice.slots640;
+ *offset = periodicityAndOffset->choice.slots640;
break;
default:
AssertFatal(1==0,"No periodicity and offset found in CSI resource");
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
index 74c2d01579..e39c310564 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
@@ -141,6 +141,7 @@ void get_info_from_tda_tables(int default_abc,
int tda,
int dmrs_TypeA_Position,
int normal_CP,
+ bool *is_mapping_typeA,
int *startSymbolIndex,
int *nrOfSymbols);
@@ -161,7 +162,7 @@ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH);
void find_period_offest_SR (NR_SchedulingRequestResourceConfig_t *SchedulingReqRec, int *period, int *offset);
void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
- NR_NZP_CSI_RS_Resource_t *nzpcsi,
+ struct NR_CSI_ResourcePeriodicityAndOffset *periodicityAndOffset,
int *period, int *offset);
void reverse_n_bits(uint8_t *value, uint16_t bitlen);
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h
index b59908db3d..34e6aec61b 100644
--- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h
@@ -214,6 +214,7 @@ uint8_t get_ssb_rsrp_payload(NR_UE_MAC_INST_t *mac,
uint8_t nr_get_csi_payload(NR_UE_MAC_INST_t *mac,
PUCCH_sched_t *pucch,
+ int csi_report_id,
NR_CSI_MeasConfig_t *csi_MeasConfig);
uint8_t get_rsrp_index(int rsrp);
@@ -271,6 +272,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList,
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
+ int *mappingtype,
uint8_t time_domain_ind,
int default_abc,
bool use_default);
@@ -350,6 +352,8 @@ and fills the PRACH PDU per each FD occasion.
*/
void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id);
void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id);
+void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot);
+void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot);
/* \brief This function schedules the Msg3 transmission
@param
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 1a14661012..71dd5d790a 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -470,6 +470,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList,
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
+ int *mapping_type,
uint8_t time_domain_ind,
int default_abc,
bool use_default){
@@ -547,13 +548,15 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
}
else {// Default configuration from tables
+ bool is_typeA;
get_info_from_tda_tables(default_abc,
time_domain_ind,
dmrs_typeA_pos,
1, // normal CP
+ &is_typeA,
&sliv_S,
&sliv_L);
-
+ *mapping_type = is_typeA? typeA : typeB;
dlsch_config_pdu->number_symbols = sliv_L;
dlsch_config_pdu->start_symbol = sliv_S;
}
@@ -868,12 +871,17 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
else if (mac->scc_SIB && mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup)
pdsch_TimeDomainAllocationList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
+ int mappingtype;
/* TIME_DOM_RESOURCE_ASSIGNMENT */
- if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,pdsch_TimeDomainAllocationList,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val,default_abc,rnti==SI_RNTI) < 0) {
+ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,pdsch_TimeDomainAllocationList,
+ NULL,dlsch_config_pdu_1_0,&mappingtype,
+ dci->time_domain_assignment.val,
+ default_abc,rnti==SI_RNTI) < 0) {
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
return -1;
}
- int mappingtype = pdsch_TimeDomainAllocationList ? pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType : ((dlsch_config_pdu_1_0->start_symbol <= 3)? typeA: typeB);
+ if(pdsch_TimeDomainAllocationList && rnti!=SI_RNTI)
+ mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
/* dmrs symbol positions*/
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
@@ -1065,13 +1073,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
return -1;
}
/* TIME_DOM_RESOURCE_ASSIGNMENT */
+ int mappingtype;
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = choose_dl_tda_list(pdsch_Config,bwpc->pdsch_ConfigCommon->choice.setup);
- if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,pdsch_TimeDomainAllocationList,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val,0,false) < 0) {
+ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,pdsch_TimeDomainAllocationList,
+ NULL,dlsch_config_pdu_1_1,&mappingtype,
+ dci->time_domain_assignment.val,0,false) < 0) {
LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot);
return -1;
}
-
- int mappingtype = pdsch_TimeDomainAllocationList ? pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType : ((dlsch_config_pdu_1_1->start_symbol <= 3)? typeA: typeB);
+ if(pdsch_TimeDomainAllocationList)
+ mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType;
dlsch_config_pdu_1_1->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? NFAPI_NR_DMRS_TYPE1 : NFAPI_NR_DMRS_TYPE2;
@@ -2401,7 +2412,7 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac,
"CSI resource not found among PUCCH resources\n");
pucch->resource_indicator = found;
- csi_bits = nr_get_csi_payload(mac, pucch, csi_measconfig);
+ csi_bits += nr_get_csi_payload(mac, pucch, csi_report_id, csi_measconfig);
}
}
else
@@ -2415,31 +2426,30 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac,
uint8_t nr_get_csi_payload(NR_UE_MAC_INST_t *mac,
PUCCH_sched_t *pucch,
+ int csi_report_id,
NR_CSI_MeasConfig_t *csi_MeasConfig) {
int n_csi_bits = 0;
AssertFatal(csi_MeasConfig->csi_ReportConfigToAddModList->list.count>0,"No CSI Report configuration available\n");
- for (int csi_report_id=0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){
- struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id];
- NR_CSI_ResourceConfigId_t csi_ResourceConfigId = csi_reportconfig->resourcesForChannelMeasurement;
- switch(csi_reportconfig->reportQuantity.present) {
- case NR_CSI_ReportConfig__reportQuantity_PR_none:
- break;
- case NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP:
- n_csi_bits += get_ssb_rsrp_payload(mac,pucch,csi_reportconfig,csi_ResourceConfigId,csi_MeasConfig);
- break;
- case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP:
- case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI:
- case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1:
- case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI:
- case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI:
- case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI:
- AssertFatal(1==0,"Measurement report based on CSI-RS not availalble\n");
- default:
- AssertFatal(1==0,"Invalid CSI report quantity type %d\n",csi_reportconfig->reportQuantity.present);
- }
+ struct NR_CSI_ReportConfig *csi_reportconfig = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id];
+ NR_CSI_ResourceConfigId_t csi_ResourceConfigId = csi_reportconfig->resourcesForChannelMeasurement;
+ switch(csi_reportconfig->reportQuantity.present) {
+ case NR_CSI_ReportConfig__reportQuantity_PR_none:
+ break;
+ case NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP:
+ n_csi_bits = get_ssb_rsrp_payload(mac,pucch,csi_reportconfig,csi_ResourceConfigId,csi_MeasConfig);
+ break;
+ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP:
+ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI:
+ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1:
+ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI:
+ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI:
+ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI:
+ AssertFatal(1==0,"Measurement report based on CSI-RS not availalble\n");
+ default:
+ AssertFatal(1==0,"Invalid CSI report quantity type %d\n",csi_reportconfig->reportQuantity.present);
}
return (n_csi_bits);
}
@@ -3843,6 +3853,21 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
LOG_A(NR_MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID);
rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
ra->RA_RAPID_found = 1;
+ if (get_softmodem_params()->emulate_l1) {
+ /* When we are emulating L1 with multiple UEs, the rx_indication will have
+ multiple RAR PDUs. The code would previously handle each of these PDUs,
+ but it should only be handling the single RAR that matches the current
+ UE. */
+ LOG_I(NR_MAC, "RAR PDU found for our UE with PDU index %d\n", pdu_id);
+ dl_info->rx_ind->number_pdus = 1;
+ if (pdu_id != 0) {
+ memcpy(&dl_info->rx_ind->rx_indication_body[0],
+ &dl_info->rx_ind->rx_indication_body[pdu_id],
+ sizeof(fapi_nr_rx_indication_body_t));
+ }
+ mac->nr_ue_emul_l1.expected_rar = false;
+ memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(mac->nr_ue_emul_l1.index_has_rar));
+ }
break;
}
if (rarh->E == 0) {
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
index ec89361b57..b548ead0a7 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
@@ -776,7 +776,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
return -1;
}
/* TIME_DOM_RESOURCE_ASSIGNMENT */
- if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_TimeDomainAllocationList, NULL, pusch_config_pdu, NULL, dci->time_domain_assignment.val,0,false) < 0) {
+ if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_TimeDomainAllocationList, NULL, pusch_config_pdu, NULL, NULL, dci->time_domain_assignment.val,0,false) < 0) {
return -1;
}
@@ -1054,6 +1054,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
nr_dcireq_t dcireq;
if(mac->cg != NULL){ // we have a cg
+
+ nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
+ nr_schedule_csi_for_im(mac, rx_frame, rx_slot);
+
dcireq.module_id = mod_id;
dcireq.gNB_index = gNB_index;
dcireq.cc_id = cc_id;
@@ -2317,7 +2321,6 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
return;
if (N_UCI > 0) {
-
LOG_D(NR_MAC,"%d.%d configure pucch, O_SR %d, O_ACK %d, O_CSI %d\n",frameP,slotP,O_SR,O_ACK,O_CSI);
pucch->resource_set_id = find_pucch_resource_set(mac, O_ACK + O_CSI);
select_pucch_resource(mac, pucch);
@@ -2341,9 +2344,206 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response);
}
-
}
+
+void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
+
+ if (mac->ra.ra_state != RA_SUCCEEDED && get_softmodem_params()->phy_test == 0)
+ return;
+
+ NR_CellGroupConfig_t *CellGroup = mac->cg;
+
+ if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated ||
+ !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig)
+ return;
+
+ NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
+
+ if (csi_measconfig->csi_IM_ResourceToAddModList == NULL)
+ return;
+
+ fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
+ NR_CSI_IM_Resource_t *imcsi;
+ int period, offset;
+ NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
+ int mu = mac->DLbwp[dl_bwp_id-1] ?
+ mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
+ mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
+
+ for (int id = 0; id < csi_measconfig->csi_IM_ResourceToAddModList->list.count; id++){
+ imcsi = csi_measconfig->csi_IM_ResourceToAddModList->list.array[id];
+ csi_period_offset(NULL,imcsi->periodicityAndOffset,&period,&offset);
+ if((frame*nr_slots_per_frame[mu]+slot-offset)%period != 0)
+ continue;
+ fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].csiim_config_pdu.csiim_config_rel15;
+ const NR_BWP_Downlink_t *dlbwp = mac->DLbwp[dl_bwp_id-1];
+ const int locationAndBandwidth = dlbwp != NULL ? dlbwp->bwp_Common->genericParameters.locationAndBandwidth:
+ mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth;
+ csiim_config_pdu->bwp_size = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE);
+ csiim_config_pdu->bwp_start = NRRIV2PRBOFFSET(locationAndBandwidth, MAX_BWP_SIZE);
+ csiim_config_pdu->subcarrier_spacing = mu;
+ csiim_config_pdu->start_rb = imcsi->freqBand->startingRB;
+ csiim_config_pdu->nr_of_rbs = imcsi->freqBand->nrofRBs;
+ // As specified in 5.2.2.4 of 38.214
+ switch (imcsi->csi_IM_ResourceElementPattern->present) {
+ case NR_CSI_IM_Resource__csi_IM_ResourceElementPattern_PR_pattern0:
+ for (int i = 0; i<4; i++) {
+ csiim_config_pdu->k_csiim[i] = (imcsi->csi_IM_ResourceElementPattern->choice.pattern0->subcarrierLocation_p0<<1) + (i>>1);
+ csiim_config_pdu->l_csiim[i] = imcsi->csi_IM_ResourceElementPattern->choice.pattern0->symbolLocation_p0 + (i%2);
+ }
+ break;
+ case NR_CSI_IM_Resource__csi_IM_ResourceElementPattern_PR_pattern1:
+ for (int i = 0; i<4; i++) {
+ csiim_config_pdu->k_csiim[i] = (imcsi->csi_IM_ResourceElementPattern->choice.pattern1->subcarrierLocation_p1<<2) + i;
+ csiim_config_pdu->l_csiim[i] = imcsi->csi_IM_ResourceElementPattern->choice.pattern1->symbolLocation_p1;
+ }
+ break;
+ default:
+ AssertFatal(1==0, "Invalid CSI-IM pattern\n");
+ }
+ dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_CSI_IM;
+ dl_config->number_pdus = dl_config->number_pdus + 1;
+ }
+}
+
+void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
+
+ if (mac->ra.ra_state != RA_SUCCEEDED && get_softmodem_params()->phy_test == 0)
+ return;
+
+ NR_CellGroupConfig_t *CellGroup = mac->cg;
+
+ if (!CellGroup || !CellGroup->spCellConfig || !CellGroup->spCellConfig->spCellConfigDedicated ||
+ !CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig)
+ return;
+
+ NR_CSI_MeasConfig_t *csi_measconfig = CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
+
+ if (csi_measconfig->nzp_CSI_RS_ResourceToAddModList == NULL)
+ return;
+
+ fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
+ NR_NZP_CSI_RS_Resource_t *nzpcsi;
+ int period, offset;
+ NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
+ int mu = mac->DLbwp[dl_bwp_id-1] ?
+ mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing :
+ mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
+
+ for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
+ nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
+ csi_period_offset(NULL,nzpcsi->periodicityAndOffset,&period,&offset);
+ if((frame*nr_slots_per_frame[mu]+slot-offset)%period != 0)
+ continue;
+ LOG_D(MAC,"Scheduling reception of CSI-RS in frame %d slot %d\n",frame,slot);
+ fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].csirs_config_pdu.csirs_config_rel15;
+
+ NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
+
+ const NR_BWP_Downlink_t *dlbwp = mac->DLbwp[dl_bwp_id-1];
+ const int locationAndBandwidth = dlbwp != NULL ? dlbwp->bwp_Common->genericParameters.locationAndBandwidth:
+ mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth;
+ csirs_config_pdu->bwp_size = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE);
+ csirs_config_pdu->bwp_start = NRRIV2PRBOFFSET(locationAndBandwidth, MAX_BWP_SIZE);
+ csirs_config_pdu->subcarrier_spacing = mu;
+ csirs_config_pdu->start_rb = resourceMapping.freqBand.startingRB;
+ csirs_config_pdu->nr_of_rbs = resourceMapping.freqBand.nrofRBs;
+ csirs_config_pdu->csi_type = 1; // NZP-CSI-RS
+ csirs_config_pdu->symb_l0 = resourceMapping.firstOFDMSymbolInTimeDomain;
+ if (resourceMapping.firstOFDMSymbolInTimeDomain2)
+ csirs_config_pdu->symb_l1 = *resourceMapping.firstOFDMSymbolInTimeDomain2;
+ csirs_config_pdu->cdm_type = resourceMapping.cdm_Type;
+ csirs_config_pdu->freq_density = resourceMapping.density.present;
+ if ((resourceMapping.density.present == NR_CSI_RS_ResourceMapping__density_PR_dot5)
+ && (resourceMapping.density.choice.dot5 == NR_CSI_RS_ResourceMapping__density__dot5_evenPRBs))
+ csirs_config_pdu->freq_density--;
+ csirs_config_pdu->scramb_id = nzpcsi->scramblingID;
+ switch(resourceMapping.frequencyDomainAllocation.present){
+ case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1:
+ csirs_config_pdu->row = 1;
+ csirs_config_pdu->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row1.buf[0])>>4)&0x0f;
+ break;
+ case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2:
+ csirs_config_pdu->row = 2;
+ csirs_config_pdu->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) |
+ ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<4)&0xff0));
+ break;
+ case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row4:
+ csirs_config_pdu->row = 4;
+ csirs_config_pdu->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.row4.buf[0])>>5)&0x07;
+ break;
+ case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other:
+ csirs_config_pdu->freq_domain = ((resourceMapping.frequencyDomainAllocation.choice.other.buf[0])>>2)&0x3f;
+ // determining the row of table 7.4.1.5.3-1 in 38.211
+ switch(resourceMapping.nrofPorts){
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p1:
+ AssertFatal(1==0,"Resource with 1 CSI port shouldn't be within other rows\n");
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p2:
+ csirs_config_pdu->row = 3;
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p4:
+ csirs_config_pdu->row = 5;
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p8:
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
+ csirs_config_pdu->row = 8;
+ else{
+ int num_k = 0;
+ for (int k=0; k<6; k++)
+ num_k+=(((csirs_config_pdu->freq_domain)>>k)&0x01);
+ if(num_k==4)
+ csirs_config_pdu->row = 6;
+ else
+ csirs_config_pdu->row = 7;
+ }
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p12:
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
+ csirs_config_pdu->row = 10;
+ else
+ csirs_config_pdu->row = 9;
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p16:
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
+ csirs_config_pdu->row = 12;
+ else
+ csirs_config_pdu->row = 11;
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p24:
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
+ csirs_config_pdu->row = 14;
+ else{
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4)
+ csirs_config_pdu->row = 15;
+ else
+ csirs_config_pdu->row = 13;
+ }
+ break;
+ case NR_CSI_RS_ResourceMapping__nrofPorts_p32:
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm4_FD2_TD2)
+ csirs_config_pdu->row = 17;
+ else{
+ if (resourceMapping.cdm_Type == NR_CSI_RS_ResourceMapping__cdm_Type_cdm8_FD2_TD4)
+ csirs_config_pdu->row = 18;
+ else
+ csirs_config_pdu->row = 16;
+ }
+ break;
+ default:
+ AssertFatal(1==0,"Invalid number of ports in CSI-RS resource\n");
+ }
+ break;
+ default:
+ AssertFatal(1==0,"Invalid freqency domain allocation in CSI-RS resource\n");
+ }
+ dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_CSI_RS;
+ dl_config->number_pdus = dl_config->number_pdus + 1;
+ }
+}
+
+
// This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x
// PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3.
// - todo:
diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c
index 1c7522cacc..f794baa011 100644
--- a/openair2/LAYER2/NR_MAC_gNB/config.c
+++ b/openair2/LAYER2/NR_MAC_gNB/config.c
@@ -631,16 +631,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
sched_ctrl->update_pdsch_ps = true;
sched_ctrl->update_pusch_ps = true;
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
- if (sched_ctrl->available_dl_harq.len == 0) {
+ if (get_softmodem_params()->sa) {
// add all available DL HARQ processes for this UE in SA
create_dl_harq_list(sched_ctrl, pdsch);
}
- else {
- const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ?
- get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
- AssertFatal(sched_ctrl->available_dl_harq.len==nrofHARQ,
- "Reconfiguration of available harq processes not yet supported\n");
- }
// update coreset/searchspace
void *bwpd = NULL;
NR_BWP_t *genericParameters = NULL;
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index 47a14c9012..dc17e4ff55 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -1034,6 +1034,7 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu,
int start_symbol_index,nr_of_symbols;
SLIV2SL(startSymbolAndLength, &start_symbol_index, &nr_of_symbols);
+ int mcsindex = -1; // init value
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
pusch_pdu->rnti = rnti;
@@ -1042,10 +1043,7 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu,
pusch_pdu->bwp_size = bwp_size;
pusch_pdu->subcarrier_spacing = scs;
pusch_pdu->cyclic_prefix = 0;
- pusch_pdu->mcs_index = 1;
pusch_pdu->mcs_table = 0;
- pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
- pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL)
pusch_pdu->transform_precoding = 1;
else
@@ -1082,15 +1080,23 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu,
for(int i = start_symbol_index; i < start_symbol_index+nr_of_symbols; i++)
num_dmrs_symb += (pusch_pdu->ul_dmrs_symb_pos >> i) & 1;
- pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->qam_mod_order,
- pusch_pdu->target_code_rate,
- pusch_pdu->rb_size,
- pusch_pdu->nr_of_symbols,
- num_dmrs_symb*12, // nb dmrs set for no data in dmrs symbol
- 0, //nb_rb_oh
- 0, // to verify tb scaling
- pusch_pdu->nrOfLayers)>>3;
+ int TBS = 0;
+ while(TBS<7) { // TBS for msg3 is 7 bytes (except for RRCResumeRequest1 currently not implemented)
+ mcsindex++;
+ pusch_pdu->target_code_rate = nr_get_code_rate_ul(mcsindex,pusch_pdu->mcs_table);
+ pusch_pdu->qam_mod_order = nr_get_Qm_ul(mcsindex,pusch_pdu->mcs_table);
+ TBS = nr_compute_tbs(pusch_pdu->qam_mod_order,
+ pusch_pdu->target_code_rate,
+ pusch_pdu->rb_size,
+ pusch_pdu->nr_of_symbols,
+ num_dmrs_symb*12, // nb dmrs set for no data in dmrs symbol
+ 0, //nb_rb_oh
+ 0, // to verify tb scaling
+ pusch_pdu->nrOfLayers)>>3;
+ pusch_pdu->mcs_index = mcsindex;
+ pusch_pdu->pusch_data.tb_size = TBS;
+ }
}
void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra, uint8_t *RAR_pdu)
@@ -1182,7 +1188,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
time_domain_assignment = 1;
else
time_domain_assignment = 0;
- uint8_t mcsIndex = 0;
+ int mcsIndex = -1; // initialization value
int rbStart = 0;
int rbSize = 8;
@@ -1339,9 +1345,6 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
pdsch_pdu_rel15->SubcarrierSpacing = genericParameters->subcarrierSpacing;
pdsch_pdu_rel15->CyclicPrefix = 0;
pdsch_pdu_rel15->NrOfCodewords = 1;
- pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx);
- pdsch_pdu_rel15->qamModOrder[0] = 2;
- pdsch_pdu_rel15->mcsIndex[0] = mcsIndex;
pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx;
pdsch_pdu_rel15->rvIndex[0] = 0;
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
@@ -1365,9 +1368,38 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
startSymbolIndex,
mappingtype, 1);
- int x_Overhead = 0;
uint8_t tb_scaling = 0;
- nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling);
+ int R, Qm;
+ uint8_t N_PRB_DMRS;
+ uint32_t TBS=0;
+ if (dmrsConfigType == NFAPI_NR_DMRS_TYPE1) {
+ // if no data in dmrs cdm group is 1 only even REs have no data
+ // if no data in dmrs cdm group is 2 both odd and even REs have no data
+ N_PRB_DMRS = pdsch_pdu_rel15->numDmrsCdmGrpsNoData*6;
+ }
+ else {
+ N_PRB_DMRS = pdsch_pdu_rel15->numDmrsCdmGrpsNoData*4;
+ }
+ uint16_t dmrs_length = get_num_dmrs(pdsch_pdu_rel15->dlDmrsSymbPos);
+
+ while(TBS<9) { // min TBS for RAR is 9 bytes
+ mcsIndex++;
+ R = nr_get_code_rate_dl(mcsIndex, mcsTableIdx);
+ Qm = nr_get_Qm_dl(mcsIndex, mcsTableIdx);
+ TBS = nr_compute_tbs(Qm,
+ R,
+ rbSize,
+ nrOfSymbols,
+ N_PRB_DMRS*dmrs_length,
+ 0, // overhead
+ tb_scaling, // tb scaling
+ 1)>>3; // layers
+
+ pdsch_pdu_rel15->targetCodeRate[0] = R;
+ pdsch_pdu_rel15->qamModOrder[0] = Qm;
+ pdsch_pdu_rel15->mcsIndex[0] = mcsIndex;
+ pdsch_pdu_rel15->TBSize[0] = TBS;
+ }
// Fill PDCCH DL DCI PDU
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci];
@@ -1667,20 +1699,16 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
int rbSize = 0;
uint8_t tb_scaling = 0;
uint16_t *vrb_map = cc[CC_id].vrb_map;
-
do {
- do {
+ if(rbSize < BWPSize)
rbSize++;
- LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT);
- harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx),
- nr_get_code_rate_dl(mcsIndex, mcsTableIdx),
- rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
- } while (rbSize < BWPSize && harq->tb_size < ra->mac_pdu_length);
- if(harq->tb_size < ra->mac_pdu_length) {
- rbSize = 0;
+ else
mcsIndex++;
- }
- } while(rbSize < BWPSize && harq->tb_size < ra->mac_pdu_length && mcsIndex<=28);
+ LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT);
+ harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx),
+ nr_get_code_rate_dl(mcsIndex, mcsTableIdx),
+ rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
+ } while (harq->tb_size < ra->mac_pdu_length && mcsIndex<=28);
AssertFatal(harq->tb_size >= ra->mac_pdu_length,"Cannot allocate Msg4\n");
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
index b54c380286..4a561914eb 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
@@ -613,14 +613,15 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
int startSymbolIndex = 0;
int nrOfSymbols = 0;
+ bool is_typeA;
get_info_from_tda_tables(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern,
time_domain_allocation,
gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
- 1, &startSymbolIndex, &nrOfSymbols);
+ 1, &is_typeA,
+ &startSymbolIndex, &nrOfSymbols);
- // TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C)
- int mappingtype = (startSymbolIndex <= 3)? typeA: typeB;
+ int mappingtype = is_typeA? typeA: typeB;
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype, 1);
// Configure sched_ctrlCommon for SIB1
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
index a83aff97e3..c7cdbb8a9c 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
@@ -393,12 +393,17 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
#define BLER_UPDATE_FRAME 10
#define BLER_FILTER 0.9f
-int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t slot, int UE_id)
+int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t slot, int UE_id, int mcs_table)
{
gNB_MAC_INST *nrmac = RC.nrmac[mod_id];
const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
+ int max_allowed_mcs = (mcs_table == 1) ? 27 : 28;
+ int max_mcs = nrmac->dl_max_mcs;
+ if (nrmac->dl_max_mcs>max_allowed_mcs)
+ max_mcs = max_allowed_mcs;
+
NR_DL_bler_stats_t *bler_stats = &nrmac->UE_info.UE_sched_ctrl[UE_id].dl_bler_stats;
/* first call: everything is zero. Initialize to sensible default */
if (bler_stats->last_frame_slot == 0 && bler_stats->mcs == 0) {
@@ -444,7 +449,7 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t
if (bler_stats->rd2_bler > nrmac->dl_rd2_bler_threshold && old_mcs > 6) {
new_mcs -= 2;
} else if (bler_stats->rd2_bler < nrmac->dl_rd2_bler_threshold) {*/
- if (bler_stats->bler < nrmac->dl_bler_target_lower && old_mcs < nrmac->dl_max_mcs && dtx > 9)
+ if (bler_stats->bler < nrmac->dl_bler_target_lower && old_mcs < max_mcs && dtx > 9)
new_mcs += 1;
else if (bler_stats->bler > nrmac->dl_bler_target_upper && old_mcs > 6)
new_mcs -= 1;
@@ -587,7 +592,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
/* check whether we need to switch the TDA allocation since the last
* (re-)transmission */
if (ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_ps) {
- nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, ps->nrOfLayers, sched_ctrl, ps);
+ nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, ps->nrOfLayers, sched_ctrl, ps);
sched_ctrl->update_pdsch_ps = false;
}
} else {
@@ -746,7 +751,7 @@ void pf_dl(module_id_t module_id,
/* Calculate coeff */
set_dl_mcs(sched_pdsch,sched_ctrl,&mac->dl_max_mcs,ps->mcsTableIdx);
- sched_pdsch->mcs = get_mcs_from_bler(module_id, /* CC_id = */ 0, frame, slot, UE_id);
+ sched_pdsch->mcs = get_mcs_from_bler(module_id, /* CC_id = */ 0, frame, slot, UE_id, ps->mcsTableIdx);
layers[UE_id] = set_dl_nrOfLayers(sched_ctrl);
const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index f0ab473582..7e6383911e 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -532,6 +532,7 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc,
ps->mcsTableIdx = 2;
}
else ps->mcsTableIdx = 0;
+ LOG_D(NR_MAC,"MCS Table Index: %d\n",ps->mcsTableIdx);
NR_PDSCH_Config_t *pdsch_Config;
if (bwp &&
@@ -1945,14 +1946,45 @@ void dump_nr_list(NR_list_t *listP)
void create_nr_list(NR_list_t *list, int len)
{
list->head = -1;
- list->next = calloc(len, sizeof(*list->next));
- AssertFatal(list, "cannot calloc() memory for NR_list_t->next\n");
+ list->next = malloc(len * sizeof(*list->next));
+ AssertFatal(list->next, "cannot malloc() memory for NR_list_t->next\n");
for (int i = 0; i < len; ++i)
list->next[i] = -1;
list->tail = -1;
list->len = len;
}
+/*
+ * Resize an NR_list
+ */
+void resize_nr_list(NR_list_t *list, int new_len)
+{
+ if (new_len == list->len)
+ return;
+ if (new_len > list->len) {
+ /* list->head remains */
+ const int old_len = list->len;
+ int* n = realloc(list->next, new_len * sizeof(*list->next));
+ AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
+ list->next = n;
+ for (int i = old_len; i < new_len; ++i)
+ list->next[i] = -1;
+ /* list->tail remains */
+ list->len = new_len;
+ } else { /* new_len < len */
+ AssertFatal(list->head < new_len, "shortened list head out of index %d (new len %d)\n", list->head, new_len);
+ AssertFatal(list->tail < new_len, "shortened list tail out of index %d (new len %d)\n", list->head, new_len);
+ for (int i = 0; i < list->len; ++i)
+ AssertFatal(list->next[i] < new_len, "shortened list entry out of index %d (new len %d)\n", list->next[i], new_len);
+ /* list->head remains */
+ int *n = realloc(list->next, new_len * sizeof(*list->next));
+ AssertFatal(n, "cannot realloc() memory for NR_list_t->next\n");
+ list->next = n;
+ /* list->tail remains */
+ list->len = new_len;
+ }
+}
+
/*
* Destroy an NR_list
*/
@@ -2213,10 +2245,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
"no pdsch-ServingCellConfig found for UE %d\n",
UE_id);
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig ? servingCellConfig->pdsch_ServingCellConfig->choice.setup : NULL;
- // add DL HARQ processes for this UE only in NSA
- // (SA still doesn't have information on nrofHARQ_ProcessesForPDSCH at this stage)
- if (!get_softmodem_params()->sa)
- create_dl_harq_list(sched_ctrl,pdsch);
+ // pdsch == NULL in SA -> will create default (8) number of HARQ processes
+ create_dl_harq_list(sched_ctrl, pdsch);
// add all available UL HARQ processes for this UE
// nb of ul harq processes not configurable
create_nr_list(&sched_ctrl->available_ul_harq, 16);
@@ -2244,11 +2274,31 @@ void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl,
const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ?
get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
// add all available DL HARQ processes for this UE
- create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
- for (int harq = 0; harq < nrofHARQ; harq++)
- add_tail_nr_list(&sched_ctrl->available_dl_harq, harq);
- create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
- create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
+ AssertFatal(sched_ctrl->available_dl_harq.len == sched_ctrl->feedback_dl_harq.len
+ && sched_ctrl->available_dl_harq.len == sched_ctrl->retrans_dl_harq.len,
+ "HARQ lists have different lengths (%d/%d/%d)\n",
+ sched_ctrl->available_dl_harq.len,
+ sched_ctrl->feedback_dl_harq.len,
+ sched_ctrl->retrans_dl_harq.len);
+ if (sched_ctrl->available_dl_harq.len == 0) {
+ create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
+ for (int harq = 0; harq < nrofHARQ; harq++)
+ add_tail_nr_list(&sched_ctrl->available_dl_harq, harq);
+ create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
+ create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
+ } else if (sched_ctrl->available_dl_harq.len == nrofHARQ) {
+ LOG_D(NR_MAC, "nrofHARQ %d already configured\n", nrofHARQ);
+ } else {
+ const int old_nrofHARQ = sched_ctrl->available_dl_harq.len;
+ AssertFatal(nrofHARQ > old_nrofHARQ,
+ "cannot resize HARQ list to be smaller (nrofHARQ %d, old_nrofHARQ %d)\n",
+ nrofHARQ, old_nrofHARQ);
+ resize_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
+ for (int harq = old_nrofHARQ; harq < nrofHARQ; harq++)
+ add_tail_nr_list(&sched_ctrl->available_dl_harq, harq);
+ resize_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ);
+ resize_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ);
+ }
}
/* hack data to remove UE in the phy */
@@ -2457,11 +2507,11 @@ void nr_csirs_scheduling(int Mod_idP,
for (int id = 0; id < csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.count; id++){
nzpcsi = csi_measconfig->nzp_CSI_RS_ResourceToAddModList->list.array[id];
NR_CSI_RS_ResourceMapping_t resourceMapping = nzpcsi->resourceMapping;
- csi_period_offset(NULL,nzpcsi,&period,&offset);
+ csi_period_offset(NULL,nzpcsi->periodicityAndOffset,&period,&offset);
if((frame*n_slots_frame+slot-offset)%period == 0) {
- LOG_I(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot);
+ LOG_D(MAC,"Scheduling CSI-RS in frame %d slot %d\n",frame,slot);
nfapi_nr_dl_tti_request_pdu_t *dl_tti_csirs_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
memset((void*)dl_tti_csirs_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
@@ -2505,7 +2555,7 @@ void nr_csirs_scheduling(int Mod_idP,
case NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row2:
csirs_pdu_rel15->row = 2;
csirs_pdu_rel15->freq_domain = (((resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]>>4)&0x0f) |
- ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<8)&0xff0));
+ ((resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]<<4)&0xff0));
for (int rb = csirs_pdu_rel15->start_rb; rb < (csirs_pdu_rel15->start_rb + csirs_pdu_rel15->nr_of_rbs); rb++)
vrb_map[rb+csirs_pdu_rel15->bwp_start] |= SL_to_bitmap(csirs_pdu_rel15->symb_l0, 1);
break;
@@ -2520,6 +2570,7 @@ void nr_csirs_scheduling(int Mod_idP,
// determining the row of table 7.4.1.5.3-1 in 38.211
switch(resourceMapping.nrofPorts){
case NR_CSI_RS_ResourceMapping__nrofPorts_p1:
+ AssertFatal(1==0,"Resource with 1 CSI port shouldn't be within other rows\n");
break;
case NR_CSI_RS_ResourceMapping__nrofPorts_p2:
csirs_pdu_rel15->row = 3;
diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
index 0357d83336..fb4ba7ec74 100644
--- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
@@ -357,6 +357,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
/* Functions to manage an NR_list_t */
void dump_nr_list(NR_list_t *listP);
void create_nr_list(NR_list_t *listP, int len);
+void resize_nr_list(NR_list_t *list, int new_len);
void destroy_nr_list(NR_list_t *list);
void add_nr_list(NR_list_t *listP, int id);
void remove_nr_list(NR_list_t *listP, int id);
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
index 47e0ba50aa..2943da6894 100644
--- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
@@ -55,7 +55,7 @@
/* PHY */
#include "PHY/defs_gNB.h"
-#include "PHY/TOOLS/time_meas.h"
+#include "time_meas.h"
/* Interface */
#include "nfapi_nr_interface_scf.h"
@@ -642,6 +642,8 @@ typedef struct {
int ul_failure;
struct CSI_Report CSI_report;
bool SR;
+ bool update_pdsch_ps;
+ bool update_pusch_ps;
bool set_mcs;
bool update_pdsch_ps;
bool update_pusch_ps;
diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
index a08c9d2c78..1f66400af1 100644
--- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
@@ -101,13 +101,6 @@ typedef struct {
static rlc_data_req_queue q;
-extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
- const NR_SRB_ToAddModList_t * const srb2add_listP,
- const NR_DRB_ToAddModList_t * const drb2add_listP,
- const NR_DRB_ToReleaseList_t * const drb2release_listP,
- const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
- struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
-
static void *rlc_data_req_thread(void *_)
{
int i;
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c
index d7923e5490..af8cb5715a 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c
@@ -1044,7 +1044,7 @@ next_pdu:
set_end_different_sdu:
/* don't go more than rx_highest_status - 1 */
if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) {
- ret.so_end = (entity->rx_highest_status - 1 + entity->sn_modulus) %
+ ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) %
entity->sn_modulus;
ret.so_end = 0xffff;
return ret;
@@ -1305,9 +1305,8 @@ static int missing_size(nr_rlc_entity_am_t *entity, missing_data_t *m,
missing_data_t m_nack;
/* be careful to limit a range to 255 SNs, that is: cut if needed */
- sn_count = m->sn_end - m->sn_start + 1;
- if (sn_count < 0)
- sn_count += entity->sn_modulus;
+ sn_count = (m->sn_end - m->sn_start + entity->sn_modulus)
+ % entity->sn_modulus + 1;
sn_start = m->sn_start;
diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
index 57bb411dcc..2654988557 100644
--- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c
@@ -63,7 +63,7 @@ extern uint16_t sl_ahead;
void handle_nr_rach(NR_UL_IND_t *UL_info)
{
- if(NFAPI_MODE == NFAPI_MODE_PNF) {
+ if (NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->rach_ind.number_of_pdus > 0) {
LOG_D(PHY,"UL_info->UL_info->rach_ind.number_of_pdus:%d SFN/Slot:%d.%d \n", UL_info->rach_ind.number_of_pdus, UL_info->rach_ind.sfn,UL_info->rach_ind.slot);
oai_nfapi_nr_rach_indication(&UL_info->rach_ind);
@@ -71,69 +71,29 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
}
return;
}
- NR_UL_IND_t UL_INFO;
- nfapi_nr_rach_indication_t *rach_ind = NULL;
- if (get_softmodem_params()->emulate_l1)
- {
- if (gnb_rach_ind_queue.num_items == 0)
- return;
- LOG_I(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items);
- rach_ind = get_queue(&gnb_rach_ind_queue);
- UL_INFO.rach_ind = *rach_ind;
- UL_INFO.module_id = UL_info->module_id;
- UL_INFO.CC_id = UL_info->CC_id;
- }
- else
- {
- UL_INFO.rach_ind = UL_info->rach_ind;
- UL_INFO.module_id = UL_info->module_id;
- UL_INFO.CC_id = UL_info->CC_id;
- }
-
- int frame_diff = UL_info->frame - UL_INFO.rach_ind.sfn;
- if (frame_diff < 0)
- {
+ int frame_diff = UL_info->frame - UL_info->rach_ind.sfn;
+ if (frame_diff < 0) {
frame_diff += 1024;
}
bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7);
- if (UL_INFO.rach_ind.number_of_pdus>0 && in_timewindow) {
+ if (UL_info->rach_ind.number_of_pdus > 0 && in_timewindow) {
LOG_A(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
- UL_info->frame, UL_info->slot, UL_INFO.rach_ind.sfn, UL_INFO.rach_ind.slot);
- int npdus = UL_INFO.rach_ind.number_of_pdus;
- for(int i = 0; i < npdus; i++) {
- UL_INFO.rach_ind.number_of_pdus--;
+ UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot);
+ for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
UL_info->rach_ind.number_of_pdus--;
- if (UL_INFO.rach_ind.pdu_list[i].num_preamble>0)
- AssertFatal(UL_INFO.rach_ind.pdu_list[i].num_preamble==1,
- "More than 1 preamble not supported\n");
-
- nr_initiate_ra_proc(UL_INFO.module_id,
- UL_INFO.CC_id,
- UL_INFO.rach_ind.sfn,
- UL_INFO.rach_ind.slot,
- UL_INFO.rach_ind.pdu_list[i].preamble_list[0].preamble_index,
- UL_INFO.rach_ind.pdu_list[i].freq_index,
- UL_INFO.rach_ind.pdu_list[i].symbol_index,
- UL_INFO.rach_ind.pdu_list[i].preamble_list[0].timing_advance);
+ AssertFatal(UL_info->rach_ind.pdu_list[i].num_preamble == 1, "More than 1 preamble not supported\n");
+ nr_initiate_ra_proc(UL_info->module_id,
+ UL_info->CC_id,
+ UL_info->rach_ind.sfn,
+ UL_info->rach_ind.slot,
+ UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_index,
+ UL_info->rach_ind.pdu_list[i].freq_index,
+ UL_info->rach_ind.pdu_list[i].symbol_index,
+ UL_info->rach_ind.pdu_list[i].preamble_list[0].timing_advance);
}
}
- if (get_softmodem_params()->emulate_l1)
- {
- if (rach_ind && rach_ind->number_of_pdus > 0)
- {
- for(int i = 0; i < rach_ind->number_of_pdus; i++)
- {
- free(rach_ind->pdu_list[i].preamble_list);
- rach_ind->pdu_list[i].preamble_list = NULL;
- }
- free(rach_ind->pdu_list);
- rach_ind->pdu_list = NULL;
- }
- free(rach_ind);
- rach_ind = NULL;
- }
}
@@ -148,26 +108,11 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
return;
}
- NR_UL_IND_t UL_INFO;
- nfapi_nr_uci_indication_t *uci_ind = NULL;
- if (get_softmodem_params()->emulate_l1)
- {
- if (gnb_uci_ind_queue.num_items == 0)
- return;
- LOG_I(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items);
- uci_ind = get_queue(&gnb_uci_ind_queue);
- UL_INFO.uci_ind = *uci_ind;
- }
- else
- {
- UL_INFO.uci_ind = UL_info->uci_ind;
- }
-
const module_id_t mod_id = UL_info->module_id;
- const frame_t frame = UL_INFO.uci_ind.sfn;
- const sub_frame_t slot = UL_INFO.uci_ind.slot;
- int num_ucis = UL_INFO.uci_ind.num_ucis;
- nfapi_nr_uci_t *uci_list = UL_INFO.uci_ind.uci_list;
+ const frame_t frame = UL_info->uci_ind.sfn;
+ const sub_frame_t slot = UL_info->uci_ind.slot;
+ int num_ucis = UL_info->uci_ind.num_ucis;
+ nfapi_nr_uci_t *uci_list = UL_info->uci_ind.uci_list;
for (int i = 0; i < num_ucis; i++) {
switch (uci_list[i].pdu_type) {
@@ -178,7 +123,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1;
LOG_D(NR_MAC, "The received uci has sfn slot %d %d, num_ucis %d and pdu_size %d\n",
- UL_INFO.uci_ind.sfn, UL_INFO.uci_ind.slot, num_ucis, uci_list[i].pdu_size);
+ UL_info->uci_ind.sfn, UL_info->uci_ind.slot, num_ucis, uci_list[i].pdu_size);
handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu);
break;
}
@@ -192,39 +137,8 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
}
}
- if (get_softmodem_params()->emulate_l1)
- {
- for (int i = 0; i < num_ucis; i++) {
- switch (uci_list[i].pdu_type) {
- case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
- if (uci_list[i].pucch_pdu_format_0_1.harq) {
- free(uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
- uci_list[i].pucch_pdu_format_0_1.harq->harq_list = NULL;
- }
- free(uci_list[i].pucch_pdu_format_0_1.harq);
- uci_list[i].pucch_pdu_format_0_1.harq = NULL;
- free(uci_list[i].pucch_pdu_format_0_1.sr);
- uci_list[i].pucch_pdu_format_0_1.sr = NULL;
- break;
+ UL_info->uci_ind.num_ucis = 0;
- case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
- free(uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
- free(uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
- free(uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
- break;
- }
- }
- if (uci_ind && num_ucis > 0) {
- free(uci_list);
- uci_list = NULL;
- }
- free(uci_ind);
- uci_ind = NULL;
- }
- else
- {
- UL_info->uci_ind.num_ucis = 0;
- }
}
static bool crc_sfn_slot_matcher(void *wanted, void *candidate)
@@ -264,173 +178,202 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
return;
}
- NR_UL_IND_t UL_INFO;
- nfapi_nr_rx_data_indication_t *rx_ind = NULL;
- nfapi_nr_crc_indication_t *crc_ind = NULL;
- if (get_softmodem_params()->emulate_l1)
- {
- rx_ind = get_queue(&gnb_rx_ind_queue);
- if (!rx_ind)
- {
- LOG_D(NR_PHY, "No rx data indication (empty gnb_rx_ind_queue)\n");
- return;
+ if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) {
+ AssertFatal(UL_info->rx_ind.number_of_pdus == UL_info->crc_ind.number_crcs,
+ "number_of_pdus %d, number_crcs %d\n",
+ UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs);
+ for (int i = 0; i < UL_info->rx_ind.number_of_pdus; i++) {
+ const nfapi_nr_rx_data_pdu_t *rx = &UL_info->rx_ind.pdu_list[i];
+ const nfapi_nr_crc_t *crc = &UL_info->crc_ind.crc_list[i];
+ LOG_D(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
+ "UL_info->rx_ind.pdu_list[%d].rnti:%04x\n",
+ i, crc->rnti, i, rx->rnti);
+
+ AssertFatal(crc->rnti == rx->rnti, "mis-match between CRC RNTI %04x and RX RNTI %04x\n",
+ crc->rnti, rx->rnti);
+
+ LOG_D(NR_MAC,
+ "%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n",
+ UL_info->frame,
+ UL_info->slot,
+ crc->tb_crc_status ? "error" : "ok",
+ crc->tb_crc_status);
+
+ /* if CRC passes, pass PDU, otherwise pass NULL as error indication */
+ nr_rx_sdu(UL_info->module_id,
+ UL_info->CC_id,
+ UL_info->rx_ind.sfn,
+ UL_info->rx_ind.slot,
+ rx->rnti,
+ crc->tb_crc_status ? NULL : rx->pdu,
+ rx->pdu_length,
+ rx->timing_advance,
+ rx->ul_cqi,
+ rx->rssi);
+ handle_nr_ul_harq(UL_info->CC_id, UL_info->module_id, UL_info->frame, UL_info->slot, crc);
}
-
- int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot);
-
- crc_ind = unqueue_matching(&gnb_crc_ind_queue,
- MAX_QUEUE_SIZE,
- crc_sfn_slot_matcher,
- &sfn_slot);
- if (!crc_ind)
- {
- LOG_D(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot);
- put_queue(&gnb_rx_ind_queue, rx_ind);
- return;
- }
-
- UL_INFO.rx_ind = *rx_ind;
- UL_INFO.crc_ind = *crc_ind;
- UL_INFO.module_id = UL_info->module_id;
- UL_INFO.CC_id = UL_info->CC_id;
}
- else
+ UL_info->rx_ind.number_of_pdus = 0;
+ UL_info->crc_ind.number_crcs = 0;
+}
+
+static void free_unqueued_nfapi_indications(nfapi_nr_rach_indication_t *rach_ind,
+ nfapi_nr_uci_indication_t *uci_ind,
+ nfapi_nr_rx_data_indication_t *rx_ind,
+ nfapi_nr_crc_indication_t *crc_ind) {
+ if (rach_ind && rach_ind->number_of_pdus > 0)
{
- UL_INFO.rx_ind = UL_info->rx_ind;
- UL_INFO.crc_ind = UL_info->crc_ind;
- UL_INFO.module_id = UL_info->module_id;
- UL_INFO.CC_id = UL_info->CC_id;
+ for(int i = 0; i < rach_ind->number_of_pdus; i++)
+ {
+ free_and_zero(rach_ind->pdu_list[i].preamble_list);
+ }
+ free_and_zero(rach_ind->pdu_list);
+ free_and_zero(rach_ind);
}
+ if (uci_ind && uci_ind->num_ucis > 0)
+ {
+ for (int i = 0; i < uci_ind->num_ucis; i++) {
+ switch (uci_ind->uci_list[i].pdu_type) {
+ case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
+ if (uci_ind->uci_list[i].pucch_pdu_format_0_1.harq) {
+ free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
+ }
+ free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq);
+ free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_0_1.sr);
+ break;
- UL_INFO.frame = UL_INFO.rx_ind.sfn;
- UL_INFO.slot = UL_INFO.rx_ind.slot;
- UL_INFO.module_id = UL_info->module_id;
- UL_INFO.CC_id = UL_info->CC_id;
- LOG_D(NR_MAC, " UL_info frame slot vs rx_ind frame slot vs crc_ind slot frame slot = %u %u vs %u %u vs %u %u\n",
- UL_info->frame, UL_info->slot,
- UL_INFO.rx_ind.sfn, UL_INFO.rx_ind.slot,
- UL_INFO.crc_ind.sfn, UL_INFO.crc_ind.slot
- );
+ case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
+ free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
+ free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
+ free_and_zero(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
+ break;
+ }
+ }
+ free_and_zero(uci_ind->uci_list);
+ free_and_zero(uci_ind);
+ }
+ if (rx_ind && rx_ind->number_of_pdus > 0)
+ {
+ free_and_zero(rx_ind->pdu_list);
+ free_and_zero(rx_ind);
+ }
+ if (crc_ind && crc_ind->number_crcs > 0)
+ {
+ free_and_zero(crc_ind->crc_list);
+ free_and_zero(crc_ind);
+ }
+}
- if (UL_INFO.rx_ind.number_of_pdus > 0 && UL_INFO.crc_ind.number_crcs > 0) {
- for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) {
- int j;
- for (j = 0; j < UL_INFO.crc_ind.number_crcs; j++) {
- // find crc_indication j corresponding rx_indication i
- const nfapi_nr_rx_data_pdu_t *rx = &UL_INFO.rx_ind.pdu_list[i];
- const nfapi_nr_crc_t *crc = &UL_INFO.crc_ind.crc_list[j];
- LOG_D(NR_PHY,
- "UL_INFO.crc_ind.pdu_list[%d].rnti:%04x "
- "UL_INFO.rx_ind.pdu_list[%d].rnti:%04x\n",
- j,
- crc->rnti,
- i,
- rx->rnti);
+static void remove_crc_pdu(nfapi_nr_crc_indication_t *crc_ind, int index) {
+ AssertFatal(index >= 0, "Invalid index %d\n", index);
+ AssertFatal(index < crc_ind->number_crcs, "Invalid index %d\n", index);
+ AssertFatal(crc_ind->number_crcs > 0, "Invalid crc_ind->number_crcs %d\n", crc_ind->number_crcs);
- if (crc->rnti != rx->rnti)
- {
- LOG_D(NR_MAC, "mis-match between CRC rnti %04x and RX rnit %04x\n", crc->rnti, rx->rnti);
- continue;
- }
+ memmove(crc_ind->crc_list + index,
+ crc_ind->crc_list + index + 1,
+ sizeof(*crc_ind->crc_list) * (crc_ind->number_crcs - index - 1));
+ crc_ind->number_crcs--;
+}
- LOG_D(NR_MAC,
- "%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n",
- UL_INFO.frame,
- UL_INFO.slot,
- crc->tb_crc_status ? "error" : "ok",
- crc->tb_crc_status);
+static void remove_rx_pdu(nfapi_nr_rx_data_indication_t *rx_ind, int index) {
+ AssertFatal(index >= 0, "Invalid index %d\n", index);
+ AssertFatal(index < rx_ind->number_of_pdus, "Invalid index %d\n", index);
+ AssertFatal(rx_ind->number_of_pdus > 0, "Invalid rx_ind->number_of_pdus %d\n", rx_ind->number_of_pdus);
- /* if CRC passes, pass PDU, otherwise pass NULL as error indication */
- nr_rx_sdu(UL_INFO.module_id,
- UL_INFO.CC_id,
- UL_INFO.rx_ind.sfn,
- UL_INFO.rx_ind.slot,
- rx->rnti,
- crc->tb_crc_status ? NULL : rx->pdu,
- rx->pdu_length,
- rx->timing_advance,
- rx->ul_cqi,
- rx->rssi);
- handle_nr_ul_harq(UL_INFO.CC_id, UL_INFO.module_id, UL_INFO.frame, UL_INFO.slot, crc);
+ memmove(rx_ind->pdu_list + index,
+ rx_ind->pdu_list + index + 1,
+ sizeof(*rx_ind->pdu_list) * (rx_ind->number_of_pdus - index - 1));
+ rx_ind->number_of_pdus--;
+}
+
+static bool crc_ind_has_rnti(nfapi_nr_crc_indication_t *crc_ind, uint16_t rnti) {
+ for (int i = 0; i < crc_ind->number_crcs; i++) {
+ if (rnti == crc_ind->crc_list[i].rnti) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool rx_ind_has_rnti(nfapi_nr_rx_data_indication_t *rx_ind, uint16_t rnti) {
+ for (int i = 0; i < rx_ind->number_of_pdus; i++) {
+ if (rnti == rx_ind->pdu_list[i].rnti) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static void match_crc_rx_pdu(nfapi_nr_rx_data_indication_t *rx_ind, nfapi_nr_crc_indication_t *crc_ind) {
+ AssertFatal(crc_ind->number_crcs > 0 && rx_ind->number_of_pdus > 0,
+ "Invalid number of crc_ind->number_crcs %d or rx_ind->number_of_pdus %d\n",
+ crc_ind->number_crcs, rx_ind->number_of_pdus);
+ if (crc_ind->number_crcs > rx_ind->number_of_pdus) {
+ int num_unmatched_crcs = 0;
+ nfapi_nr_crc_indication_t *crc_ind_unmatched = calloc(1, sizeof(*crc_ind_unmatched));
+ crc_ind_unmatched->header = crc_ind->header;
+ crc_ind_unmatched->sfn = crc_ind->sfn;
+ crc_ind_unmatched->slot = crc_ind->slot;
+ crc_ind_unmatched->number_crcs = crc_ind->number_crcs - rx_ind->number_of_pdus;
+ crc_ind_unmatched->crc_list = calloc(crc_ind_unmatched->number_crcs, sizeof(nfapi_nr_crc_t));
+ for (int i = 0; i < crc_ind->number_crcs; i++) {
+ if (!rx_ind_has_rnti(rx_ind, crc_ind->crc_list[i].rnti)) {
+ LOG_I(NR_MAC, "crc_ind->crc_list[%d].rnti %x does not match any rx_ind pdu rnti\n",
+ i, crc_ind->crc_list[i].rnti);
+ crc_ind_unmatched->crc_list[num_unmatched_crcs] = crc_ind->crc_list[i];
+ num_unmatched_crcs++;
+ remove_crc_pdu(crc_ind, i);
+ }
+ if (crc_ind->number_crcs == rx_ind->number_of_pdus) {
break;
- } // for (j=0;jemulate_l1)
- {
- int last = UL_INFO.crc_ind.number_crcs - 1;
- if (j < last)
- {
- crc_ind->crc_list[j] = crc_ind->crc_list[last];
- UL_INFO.crc_ind.number_crcs--;
- }
- else if (j == last)
- {
- UL_INFO.crc_ind.number_crcs--;
- }
-
- last = UL_INFO.rx_ind.number_of_pdus - 1;
- if (i < last)
- {
- rx_ind->pdu_list[i] = rx_ind->pdu_list[last];
- UL_INFO.rx_ind.number_of_pdus--;
- i--;
- }
- else if (i == last)
- {
- UL_INFO.rx_ind.number_of_pdus--;
- }
- }
- } // for (i=0;iemulate_l1)
- {
- if (UL_INFO.crc_ind.number_crcs > 0)
- {
- crc_ind->number_crcs = UL_INFO.crc_ind.number_crcs;
- requeue(&gnb_crc_ind_queue, crc_ind);
- }
-
- if (UL_INFO.rx_ind.number_of_pdus > 0)
- {
- rx_ind->number_of_pdus = UL_INFO.rx_ind.number_of_pdus;
- requeue(&gnb_rx_ind_queue, rx_ind);
- }
-
- if (UL_INFO.crc_ind.number_crcs == 0)
- {
- free(crc_ind->crc_list);
- crc_ind->crc_list = NULL;
- free(crc_ind);
- crc_ind = NULL;
- }
- if (UL_INFO.rx_ind.number_of_pdus == 0)
- {
- free(rx_ind->pdu_list);
- rx_ind->pdu_list = NULL;
- free(rx_ind);
- rx_ind = NULL;
}
}
- else
+ AssertFatal(crc_ind_unmatched->number_crcs == num_unmatched_crcs, "crc_ind num_pdus %d doesnt match %d\n",
+ crc_ind_unmatched->number_crcs, num_unmatched_crcs);
+ if (!requeue(&gnb_crc_ind_queue, crc_ind_unmatched))
{
- UL_info->crc_ind.number_crcs = 0;
- UL_info->rx_ind.number_of_pdus = 0;
+ LOG_E(NR_PHY, "requeue failed for crc_ind_unmatched.\n");
+ free_and_zero(crc_ind_unmatched->crc_list);
+ free_and_zero(crc_ind_unmatched);
}
- } else if ((UL_INFO.rx_ind.number_of_pdus != 0)
- || (UL_INFO.crc_ind.number_crcs != 0)) {
- LOG_E(NR_PHY,
- "hoping not to have mis-match between CRC ind and RX ind - "
- "hopefully the missing message is coming shortly "
- "rx_ind:%d(SFN/SL:%d/%d) crc_ind:%d(SFN/SL:%d/%d) \n",
- UL_INFO.rx_ind.number_of_pdus,
- UL_INFO.rx_ind.sfn,
- UL_INFO.rx_ind.slot,
- UL_INFO.crc_ind.number_crcs,
- UL_INFO.crc_ind.sfn,
- UL_INFO.crc_ind.slot);
+ }
+ else if (crc_ind->number_crcs < rx_ind->number_of_pdus) {
+ int num_unmatched_rxs = 0;
+ nfapi_nr_rx_data_indication_t *rx_ind_unmatched = calloc(1, sizeof(*rx_ind_unmatched));
+ rx_ind_unmatched->header = rx_ind->header;
+ rx_ind_unmatched->sfn = rx_ind->sfn;
+ rx_ind_unmatched->slot = rx_ind->slot;
+ rx_ind_unmatched->number_of_pdus = rx_ind->number_of_pdus - crc_ind->number_crcs;
+ rx_ind_unmatched->pdu_list = calloc(rx_ind_unmatched->number_of_pdus, sizeof(nfapi_nr_pdu_t));
+ for (int i = 0; i < rx_ind->number_of_pdus; i++) {
+ if (!crc_ind_has_rnti(crc_ind, rx_ind->pdu_list[i].rnti)) {
+ LOG_I(NR_MAC, "rx_ind->pdu_list[%d].rnti %d does not match any crc_ind pdu rnti\n",
+ i, rx_ind->pdu_list[i].rnti);
+ rx_ind_unmatched->pdu_list[num_unmatched_rxs] = rx_ind->pdu_list[i];
+ num_unmatched_rxs++;
+ remove_rx_pdu(rx_ind, i);
+ }
+ if (rx_ind->number_of_pdus == crc_ind->number_crcs) {
+ break;
+ }
+ }
+ AssertFatal(rx_ind_unmatched->number_of_pdus == num_unmatched_rxs, "rx_ind num_pdus %d doesnt match %d\n",
+ rx_ind_unmatched->number_of_pdus, num_unmatched_rxs);
+ if (!requeue(&gnb_rx_ind_queue, rx_ind_unmatched))
+ {
+ LOG_E(NR_PHY, "requeue failed for rx_ind_unmatched.\n");
+ free_and_zero(rx_ind_unmatched->pdu_list);
+ free_and_zero(rx_ind_unmatched);
+ }
+ }
+ else {
+ LOG_E(NR_MAC, "The number of crc pdus %d = the number of rx pdus %d\n",
+ crc_ind->number_crcs, rx_ind->number_of_pdus);
}
}
void NR_UL_indication(NR_UL_IND_t *UL_info) {
- AssertFatal(UL_info!=NULL,"UL_INFO is null\n");
+ AssertFatal(UL_info!=NULL,"UL_info is null\n");
#ifdef DUMP_FAPI
dump_ul(UL_info);
#endif
@@ -440,17 +383,63 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
NR_IF_Module_t *ifi = nr_if_inst[module_id];
gNB_MAC_INST *mac = RC.nrmac[module_id];
LOG_D(NR_PHY,"SFN/SLOT:%d.%d module_id:%d CC_id:%d UL_info[rach_pdus:%zu rx_ind:%zu crcs:%zu]\n",
- UL_info->frame,UL_info->slot,
- module_id,CC_id, gnb_rach_ind_queue.num_items,
- gnb_rx_ind_queue.num_items, gnb_crc_ind_queue.num_items);
+ UL_info->frame, UL_info->slot,
+ module_id, CC_id,
+ gnb_rach_ind_queue.num_items,
+ gnb_rx_ind_queue.num_items,
+ gnb_crc_ind_queue.num_items);
+
+ nfapi_nr_rach_indication_t *rach_ind = NULL;
+ nfapi_nr_uci_indication_t *uci_ind = NULL;
+ nfapi_nr_rx_data_indication_t *rx_ind = NULL;
+ nfapi_nr_crc_indication_t *crc_ind = NULL;
+ if (get_softmodem_params()->emulate_l1)
+ {
+ if (gnb_rach_ind_queue.num_items > 0) {
+ LOG_D(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items);
+ rach_ind = get_queue(&gnb_rach_ind_queue);
+ AssertFatal(rach_ind->number_of_pdus > 0, "Invalid number of PDUs\n");
+ UL_info->rach_ind = *rach_ind;
+ }
+ if (gnb_uci_ind_queue.num_items > 0) {
+ LOG_D(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items);
+ uci_ind = get_queue(&gnb_uci_ind_queue);
+ AssertFatal(uci_ind->num_ucis > 0, "Invalid number of PDUs\n");
+ UL_info->uci_ind = *uci_ind;
+ }
+ if (gnb_rx_ind_queue.num_items > 0 && gnb_crc_ind_queue.num_items > 0) {
+ LOG_D(NR_MAC, "gnb_rx_ind_queue size = %zu and gnb_crc_ind_queue size = %zu\n",
+ gnb_rx_ind_queue.num_items, gnb_crc_ind_queue.num_items);
+ rx_ind = get_queue(&gnb_rx_ind_queue);
+ int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot);
+ crc_ind = unqueue_matching(&gnb_crc_ind_queue,
+ MAX_QUEUE_SIZE,
+ crc_sfn_slot_matcher,
+ &sfn_slot);
+ if (!crc_ind) {
+ LOG_I(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot);
+ requeue(&gnb_rx_ind_queue, rx_ind);
+ }
+ else {
+ AssertFatal(rx_ind->number_of_pdus > 0, "Invalid number of PDUs\n");
+ AssertFatal(crc_ind->number_crcs > 0, "Invalid number of PDUs\n");
+ if (crc_ind->number_crcs != rx_ind->number_of_pdus)
+ match_crc_rx_pdu(rx_ind, crc_ind);
+ UL_info->rx_ind = *rx_ind;
+ UL_info->crc_ind = *crc_ind;
+ }
+ }
+ }
handle_nr_rach(UL_info);
-
handle_nr_uci(UL_info);
// clear UL DCI prior to handling ULSCH
mac->UL_dci_req[CC_id].numPdus = 0;
handle_nr_ulsch(UL_info);
+ if (get_softmodem_params()->emulate_l1) {
+ free_unqueued_nfapi_indications(rach_ind, uci_ind, rx_ind, crc_ind);
+ }
if (NFAPI_MODE != NFAPI_MODE_PNF) {
if (ifi->CC_mask==0) {
diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
index 08807e0202..9bce0e8843 100644
--- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
@@ -296,11 +296,11 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
{
NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id);
mac->nr_ue_emul_l1.expected_sib = false;
- memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(*mac->nr_ue_emul_l1.index_has_sib));
+ memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(mac->nr_ue_emul_l1.index_has_sib));
mac->nr_ue_emul_l1.expected_rar = false;
- memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(*mac->nr_ue_emul_l1.index_has_rar));
+ memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(mac->nr_ue_emul_l1.index_has_rar));
mac->nr_ue_emul_l1.expected_dci = false;
- memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(*mac->nr_ue_emul_l1.index_has_dci));
+ memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(mac->nr_ue_emul_l1.index_has_dci));
int pdu_idx = 0;
int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs;
@@ -424,7 +424,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
if (!dl_info->rx_ind)
{
- dl_info->rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t));
+ dl_info->rx_ind = CALLOC(num_pdus, sizeof(fapi_nr_rx_indication_t));
}
AssertFatal(dl_info->rx_ind != NULL, "%s: Out of memory in calloc", __FUNCTION__);
fapi_nr_rx_indication_t *rx_ind = dl_info->rx_ind;
@@ -1038,7 +1038,8 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t
// Note: sdu should always be processed because data and timing advance updates are transmitted by the UE
int8_t handle_dlsch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){
- dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid;
+ if (get_softmodem_params()->emulate_l1)
+ dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid;
update_harq_status(dl_info->module_id,
dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid,
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index b069591316..c3e41978e5 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -4293,9 +4293,10 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer,
LTE_MeasResultListEUTRA_t *measResultListEUTRA2=&measResultNeighCells->choice.measResultListEUTRA;
asn1cSequenceAdd(measResultListEUTRA2->list, struct LTE_MeasResultEUTRA, measresulteutra_list);
measresulteutra_list->physCellId = phy_id;
- //asn1cCalloc(measresulteutra_list->cgi_Info, measresult_cgi2);
- //measresult_cgi2->cellGlobalId= {0};
- //measresult_cgi2->trackingAreaCode= {0};
+ /* TODO: This asn1cCalloc leaks memory but also masks a bug.
+ If we delete this asn1cCalloc statement, eNB will crash in NSA mode.
+ Please don't delete the following line unless the bug has been found. */
+ asn1cCalloc(measresulteutra_list->cgi_Info, measresult_cgi2);
struct LTE_MeasResultEUTRA__measResult* measResult= &measresulteutra_list->measResult;
asn1cCallocOne(measResult->rsrpResult, rsrp_tar);
asn1cCallocOne(measResult->rsrqResult, rsrq_tar);
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c
index a931c648dc..e6634a8a51 100755
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c
@@ -2022,6 +2022,30 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr
ASN_SEQUENCE_ADD(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig_drb);
}
+void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
+ rrc_gNB_carrier_data_t *carrier,
+ NR_UE_NR_Capability_t *uecap) {
+
+ NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig;
+ if (SpCellConfig == NULL) return;
+
+ NR_ServingCellConfigCommon_t *scc = carrier->servingcellconfigcommon;
+
+ NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP;
+ set_dl_mcs_table(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing,
+ uecap, bwp_Dedicated, scc);
+
+ struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList;
+ if (DL_BWP_list) {
+ for (int i=0; ilist.count; i++){
+ NR_BWP_Downlink_t *bwp = DL_BWP_list->list.array[i];
+ int scs = bwp->bwp_Common->genericParameters.subcarrierSpacing;
+ set_dl_mcs_table(scs, uecap, bwp->bwp_Dedicated, carrier->servingcellconfigcommon);
+ }
+ }
+}
+
+
void fill_initial_cellGroupConfig(int uid,
NR_CellGroupConfig_t *cellGroupConfig,
NR_ServingCellConfigCommon_t *scc,
@@ -2443,6 +2467,8 @@ int16_t do_RRCReconfiguration(
NR_SDAP_Config_t *sdap_config,
NR_MeasConfig_t *meas_config,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
+ rrc_gNB_ue_context_t *const ue_context_pP,
+ rrc_gNB_carrier_data_t *carrier,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
NR_CellGroupConfig_t *cellGroupConfig)
//------------------------------------------------------------------------------
@@ -2479,15 +2505,6 @@ int16_t do_RRCReconfiguration(
ie->radioBearerConfig->srb3_ToRelease = NULL;
ie->radioBearerConfig->drb_ToReleaseList = DRB_releaseList;
}
- /******************** Secondary Cell Group ********************/
- // rrc_gNB_carrier_data_t *carrier = &(gnb_rrc_inst->carrier);
- // fill_default_secondaryCellGroup( carrier->servingcellconfigcommon,
- // ue_context_pP->ue_context.secondaryCellGroup,
- // 1,
- // 1,
- // carrier->pdsch_AntennaPorts,
- // carrier->initial_csi_index[ue_context_p->local_uid + 1],
- // ue_context_pP->local_uid);
/******************** Meas Config ********************/
// measConfig
@@ -2503,6 +2520,9 @@ int16_t do_RRCReconfiguration(
}
if(cellGroupConfig!=NULL){
+ update_cellGroupConfig(cellGroupConfig,
+ carrier,
+ ue_context_pP->ue_context.UE_Capability_nr);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)cellGroupConfig,
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h
index 30093d471d..946b8a319c 100644
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.h
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h
@@ -112,6 +112,10 @@ void fill_initial_cellGroupConfig(int uid,
NR_ServingCellConfig_t *servingcellconfigdedicated,
rrc_gNB_carrier_data_t *carrier) ;
+void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
+ rrc_gNB_carrier_data_t *carrier,
+ NR_UE_NR_Capability_t *uecap);
+
void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGroupConfig_t *ue_context_mastercellGroup);
int16_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
@@ -148,6 +152,8 @@ int16_t do_RRCReconfiguration(
NR_SDAP_Config_t *sdap_config,
NR_MeasConfig_t *meas_config,
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList,
+ rrc_gNB_ue_context_t *const ue_context_pP,
+ rrc_gNB_carrier_data_t *carrier,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
NR_CellGroupConfig_t *cellGroupConfig);
diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c
index 6b7f9a21b9..f8f05f2fe5 100644
--- a/openair2/RRC/NR/nr_rrc_config.c
+++ b/openair2/RRC/NR/nr_rrc_config.c
@@ -31,17 +31,64 @@
#include "nr_rrc_config.h"
#include "common/utils/nr/nr_common.h"
+void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
+ NR_ServingCellConfigCommon_t *scc,
+ int numerology,
+ int rbsize,
+ int mcs_table) {
+
+ int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
+ NR_BandNR_t *nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t));
+ nr_bandnr->bandNR = band;
+ ASN_SEQUENCE_ADD(&cap->rf_Parameters.supportedBandListNR.list,
+ nr_bandnr);
+ if (mcs_table == 1) {
+ int bw = get_supported_band_index(numerology, band, rbsize);
+ if (band>256) {
+ NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[0];
+ bandNRinfo->pdsch_256QAM_FR2 = CALLOC(1,sizeof(*bandNRinfo->pdsch_256QAM_FR2));
+ *bandNRinfo->pdsch_256QAM_FR2 = NR_BandNR__pdsch_256QAM_FR2_supported;
+ }
+ else{
+ cap->phy_Parameters.phy_ParametersFR1 = CALLOC(1,sizeof(*cap->phy_Parameters.phy_ParametersFR1));
+ NR_Phy_ParametersFR1_t *phy_fr1 = cap->phy_Parameters.phy_ParametersFR1;
+ phy_fr1->pdsch_256QAM_FR1 = CALLOC(1,sizeof(*phy_fr1->pdsch_256QAM_FR1));
+ *phy_fr1->pdsch_256QAM_FR1 = NR_Phy_ParametersFR1__pdsch_256QAM_FR1_supported;
+ }
+ cap->featureSets = CALLOC(1,sizeof(*cap->featureSets));
+ NR_FeatureSets_t *fs=cap->featureSets;
+ fs->featureSetsDownlinkPerCC = CALLOC(1,sizeof(*fs->featureSetsDownlinkPerCC));
+ NR_FeatureSetDownlinkPerCC_t *fs_cc = CALLOC(1,sizeof(NR_FeatureSetDownlinkPerCC_t));
+ fs_cc->supportedSubcarrierSpacingDL = numerology;
+ if(band>256) {
+ fs_cc->supportedBandwidthDL.present = NR_SupportedBandwidth_PR_fr2;
+ fs_cc->supportedBandwidthDL.choice.fr2 = bw;
+ }
+ else{
+ fs_cc->supportedBandwidthDL.present = NR_SupportedBandwidth_PR_fr1;
+ fs_cc->supportedBandwidthDL.choice.fr1 = bw;
+ }
+ fs_cc->supportedModulationOrderDL = CALLOC(1,sizeof(*fs_cc->supportedModulationOrderDL));
+ *fs_cc->supportedModulationOrderDL = NR_ModulationOrder_qam256;
+ ASN_SEQUENCE_ADD(&fs->featureSetsDownlinkPerCC->list,
+ fs_cc);
+ }
+}
+
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){
lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
-
+ int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+ // coreset duration setting to be improved in the framework of RRC harmonization, potentially using a common function
+ int len_coreset = 1;
+ if (curr_bwp < 48)
+ len_coreset = 2;
// setting default TDA for DL with
struct NR_PDSCH_TimeDomainResourceAllocation *timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
- timedomainresourceallocation->startSymbolAndLength = get_SLIV(1,13); // basic slot configuration starting in symbol 1 til the end of the slot
+ timedomainresourceallocation->startSymbolAndLength = get_SLIV(len_coreset,14-len_coreset); // basic slot configuration starting in symbol 1 til the end of the slot
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
timedomainresourceallocation);
-
if(frame_type==TDD) {
// TDD
if(scc->tdd_UL_DL_ConfigurationCommon) {
@@ -49,7 +96,7 @@ void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){
if(dl_symb > 1) {
timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
timedomainresourceallocation->mappingType = NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA;
- timedomainresourceallocation->startSymbolAndLength = get_SLIV(1,dl_symb-1); // mixed slot configuration starting in symbol 1 til the end of the dl allocation
+ timedomainresourceallocation->startSymbolAndLength = get_SLIV(len_coreset,dl_symb-len_coreset); // mixed slot configuration starting in symbol 1 til the end of the dl allocation
ASN_SEQUENCE_ADD(&scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,
timedomainresourceallocation);
}
@@ -102,6 +149,52 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){
ASN_SEQUENCE_ADD(&scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,pusch_timedomainresourceallocation_msg3);
}
}
-
}
+
+void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap,
+ NR_BWP_DownlinkDedicated_t *bwp_Dedicated,
+ NR_ServingCellConfigCommon_t *scc) {
+
+ if (cap == NULL){
+ bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL;
+ return;
+ }
+
+ int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
+ struct NR_FrequencyInfoDL__scs_SpecificCarrierList scs_list = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList;
+ int bw_rb = -1;
+ for(int i=0; isubcarrierSpacing){
+ bw_rb = scs_list.list.array[i]->carrierBandwidth;
+ break;
+ }
+ }
+ AssertFatal(bw_rb>0,"Could not find scs-SpecificCarrierList element for scs %d",scs);
+ int bw = get_supported_band_index(scs, band, bw_rb);
+ AssertFatal(bw>0,"Supported band corresponding to %d RBs not found\n", bw_rb);
+
+ bool supported = false;
+ if (band>256) {
+ for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) {
+ NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i];
+ if(bandNRinfo->bandNR == band && bandNRinfo->pdsch_256QAM_FR2) {
+ supported = true;
+ break;
+ }
+ }
+ }
+ else if (cap->phy_Parameters.phy_ParametersFR1 && cap->phy_Parameters.phy_ParametersFR1->pdsch_256QAM_FR1)
+ supported = true;
+
+ if (supported) {
+ if(bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL)
+ bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table));
+ *bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256;
+ }
+ else
+ bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL;
+}
+
+
+
diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h
index 192fee754e..1a0d091e35 100644
--- a/openair2/RRC/NR/nr_rrc_config.h
+++ b/openair2/RRC/NR/nr_rrc_config.h
@@ -113,6 +113,14 @@ typedef struct physicalcellgroup_s{
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc);
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay);
+void set_dl_mcs_table(int scs, NR_UE_NR_Capability_t *cap,
+ NR_BWP_DownlinkDedicated_t *bwp_Dedicated,
+ NR_ServingCellConfigCommon_t *scc);
+void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
+ NR_ServingCellConfigCommon_t *scc,
+ int numerology,
+ int rbsize,
+ int mcs_table);
#endif
diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h
index 556b2b1604..d5dfd90e72 100644
--- a/openair2/RRC/NR/nr_rrc_defs.h
+++ b/openair2/RRC/NR/nr_rrc_defs.h
@@ -345,14 +345,18 @@ typedef struct gNB_RRC_UE_s {
uint8_t setup_e_rabs;
/* Number of e_rab to be setup in the list */
uint8_t nb_of_e_rabs;
- /* Total number of pdu session already setup in the list */
- uint8_t setup_pdu_sessions;
- /* Number of pdu session to be setup in the list */
- uint8_t nb_of_pdusessions;
/* Number of e_rab to be modified in the list */
uint8_t nb_of_modify_e_rabs;
uint8_t nb_of_failed_e_rabs;
e_rab_param_t modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
+ /* Total number of pdu session already setup in the list */
+ uint8_t setup_pdu_sessions;
+ /* Number of pdu session to be setup in the list */
+ uint8_t nb_of_pdusessions;
+ /* Number of e_rab to be modified in the list */
+ uint8_t nb_of_modify_pdusessions;
+ uint8_t nb_of_failed_pdusessions;
+ pdu_session_param_t modify_pdusession[NR_NB_RB_MAX];
/* list of e_rab to be setup by RRC layers */
/* list of pdu session to be setup by RRC layers */
e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h
index 0875c2d6c1..708aad8a0d 100644
--- a/openair2/RRC/NR/nr_rrc_proto.h
+++ b/openair2/RRC/NR/nr_rrc_proto.h
@@ -76,6 +76,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti);
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_CellGroupConfig_t *secondaryCellGroup,
+ NR_UE_NR_Capability_t *uecap,
int scg_id,
int servCellIndex,
int dl_antenna_ports,
@@ -94,6 +95,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
+ NR_UE_NR_Capability_t *uecap,
int dl_antenna_ports,
int minRXTXTIMEpdsch,
int do_csirs,
@@ -218,3 +220,24 @@ void
rrc_gNB_generate_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP);
+
+rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
+ const NR_SRB_ToAddModList_t * const srb2add_listP,
+ const NR_DRB_ToAddModList_t * const drb2add_listP,
+ const NR_DRB_ToReleaseList_t * const drb2release_listP,
+ const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
+ struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
+
+boolean_t nr_rrc_pdcp_config_asn1_req(
+ const protocol_ctxt_t *const ctxt_pP,
+ NR_SRB_ToAddModList_t *const srb2add_list,
+ NR_DRB_ToAddModList_t *const drb2add_list,
+ NR_DRB_ToReleaseList_t *const drb2release_list,
+ const uint8_t security_modeP,
+ uint8_t *const kRRCenc,
+ uint8_t *const kRRCint,
+ uint8_t *const kUPenc,
+ uint8_t *const kUPint
+ ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
+ ,rb_id_t *const defaultDRB,
+ struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index b369080122..bffbd55bba 100755
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -98,6 +98,7 @@
#include
#include
#include
+#include
#include "BIT_STRING.h"
#include "assertions.h"
@@ -740,6 +741,8 @@ rrc_gNB_generate_defaultRRCReconfiguration(
dedicatedNAS_MessageList = NULL;
}
+ gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
+ gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
@@ -750,8 +753,10 @@ rrc_gNB_generate_defaultRRCReconfiguration(
NULL,
NULL,
dedicatedNAS_MessageList,
+ ue_context_pP,
+ &rrc->carrier,
NULL,
- NULL);
+ ue_p->masterCellGroup);
free(ue_context_pP->ue_context.nas_pdu.buffer);
@@ -1011,6 +1016,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
NULL,
NULL,
dedicatedNAS_MessageList,
+ ue_context_pP,
+ &rrc->carrier,
NULL,
cellGroupConfig);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n");
@@ -1053,6 +1060,178 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
#endif
}
+//-----------------------------------------------------------------------------
+void
+rrc_gNB_modify_dedicatedRRCReconfiguration(
+ const protocol_ctxt_t *const ctxt_pP,
+ rrc_gNB_ue_context_t *ue_context_pP)
+//-----------------------------------------------------------------------------
+{
+ NR_DRB_ToAddMod_t *DRB_config = NULL;
+ NR_DRB_ToAddModList_t **DRB_configList = NULL;
+ NR_DRB_ToAddModList_t *DRB_configList2 = NULL;
+ struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
+ *dedicatedNAS_MessageList = NULL;
+ NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
+ uint8_t buffer[RRC_BUF_SIZE];
+ uint16_t size;
+ int qos_flow_index = 0;
+ int i, j;
+
+ uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
+ DRB_configList = &ue_context_pP->ue_context.DRB_configList;
+
+ DRB_configList2 = CALLOC(1, sizeof(NR_DRB_ToAddModList_t));
+ memset(DRB_configList2, 0, sizeof(NR_DRB_ToAddModList_t));
+
+ dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList));
+
+ for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
+ // bypass the new and already configured pdu sessions
+ if (ue_context_pP->ue_context.modify_pdusession[i].status >= PDU_SESSION_STATUS_DONE) {
+ ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
+ continue;
+ }
+
+ if (ue_context_pP->ue_context.modify_pdusession[i].cause != NGAP_CAUSE_NOTHING) {
+ // set xid of failure pdu session
+ ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
+ ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_FAILED;
+ continue;
+ }
+
+ // search exist DRB_config
+ for (j = 0; j < (*DRB_configList)->list.count; j++) {
+ if ((*DRB_configList)->list.array[j]->cnAssociation->choice.sdap_Config->pdu_Session ==
+ ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id) {
+ DRB_config = (*DRB_configList)->list.array[j];
+ break;
+ }
+ }
+
+ if (DRB_config == NULL) {
+ ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
+ ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_FAILED;
+ ue_context_pP->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
+ ue_context_pP->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_unspecified;
+ ue_context_pP->ue_context.nb_of_failed_pdusessions++;
+ continue;
+ }
+
+ // Reference TS23501 Table 5.7.4-1: Standardized 5QI to QoS characteristics mapping
+ for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos; qos_flow_index++) {
+ switch (ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].fiveQI) {
+ case 1: //100ms
+ case 2: //150ms
+ case 3: //50ms
+ case 4: //300ms
+ case 5: //100ms
+ case 6: //300ms
+ case 7: //100ms
+ case 8: //300ms
+ case 9: //300ms Video (Buffered Streaming)TCP-based (e.g., www, e-mail, chat, ftp, p2p file sharing, progressive video, etc.)
+ // TODO
+ break;
+
+ default:
+ LOG_E(NR_RRC,"not supported 5qi %lu\n", ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].fiveQI);
+ ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_FAILED;
+ ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
+ ue_context_pP->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
+ ue_context_pP->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_not_supported_5QI_value;
+ ue_context_pP->ue_context.nb_of_failed_pdusessions++;
+ continue;
+ }
+
+ LOG_I(NR_RRC, "PDU SESSION ID %ld, DRB ID %ld (index %d), QOS flow %d, 5QI %ld \n",
+ DRB_config->cnAssociation->choice.sdap_Config->pdu_Session,
+ DRB_config->drb_Identity, i,
+ qos_flow_index,
+ ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].fiveQI
+ );
+ }
+
+ ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config);
+
+ ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_DONE;
+ ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
+
+ if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) {
+ dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t));
+ memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t));
+ OCTET_STRING_fromBuf(dedicatedNAS_Message,
+ (char *)ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer,
+ ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.length);
+ ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message);
+
+ LOG_I(NR_RRC,"add NAS info with size %d (pdusession id %d)\n",ue_context_pP->ue_context.pduSession[i].param.nas_pdu.length,
+ ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id);
+ } else {
+ // TODO
+ LOG_E(NR_RRC,"no NAS info (pdusession id %d)\n", ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id);
+ }
+ }
+
+ /* If list is empty free the list and reset the address */
+ if (dedicatedNAS_MessageList->list.count == 0) {
+ free(dedicatedNAS_MessageList);
+ dedicatedNAS_MessageList = NULL;
+ }
+
+ memset(buffer, 0, sizeof(buffer));
+ size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
+ xid,
+ NULL,
+ DRB_configList2,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ dedicatedNAS_MessageList,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n");
+
+ /* Free all NAS PDUs */
+ for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
+ if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) {
+ /* Free the NAS PDU buffer and invalidate it */
+ free(ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer);
+ ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer = NULL;
+ }
+ }
+
+ LOG_I(NR_RRC,
+ "[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCReconfiguration (bytes %d, UE RNTI %x)\n",
+ ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
+ LOG_D(NR_RRC,
+ "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
+ ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_gNB_mui, ctxt_pP->module_id, DCCH);
+
+#ifdef ITTI_SIM
+ MessageDef *message_p;
+ uint8_t *message_buffer;
+ message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size);
+ memcpy (message_buffer, buffer, size);
+ message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND);
+ GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
+ GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
+ GNB_RRC_DCCH_DATA_IND (message_p).size = size;
+ itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
+#else
+ nr_rrc_data_req(
+ ctxt_pP,
+ DCCH,
+ rrc_gNB_mui++,
+ SDU_CONFIRM_NO,
+ size,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
+#endif
+}
+
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
@@ -1110,6 +1289,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
NULL,
dedicatedNAS_MessageList,
NULL,
+ NULL,
+ NULL,
NULL);
ue_context_pP->ue_context.pdu_session_release_command_flag = 1;
@@ -1659,6 +1840,8 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete(
NULL, // MeasObj_list,
NULL,
NULL,
+ NULL,
+ NULL,
NULL);
LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,
"[MSG] RRC Reconfiguration\n");
@@ -2258,10 +2441,23 @@ rrc_gNB_decode_dcch(
//NGAP_PDUSESSION_RELEASE_RESPONSE
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(ctxt_pP, ue_context_p, xid);
} else if (ue_context_p->ue_context.established_pdu_sessions_flag != 1) {
- if (ue_context_p->ue_context.setup_pdu_sessions > 0) {
+ if (ue_context_p->ue_context.nb_of_pdusessions > 0) {
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
+ ue_context_p->ue_context.nb_of_pdusessions = 0;
+ }
+ }
+ if (ue_context_p->ue_context.nb_of_modify_pdusessions > 0) {
+ rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(ctxt_pP,
+ ue_context_p,
+ ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
+ ue_context_p->ue_context.nb_of_modify_pdusessions = 0;
+ ue_context_p->ue_context.nb_of_failed_pdusessions = 0;
+ memset(ue_context_p->ue_context.modify_pdusession, 0, sizeof(ue_context_p->ue_context.modify_pdusession));
+
+ for(int i = 0; i < NR_NB_RB_MAX; i++) {
+ ue_context_p->ue_context.modify_pdusession[i].xid = -1;
}
}
}
@@ -3226,51 +3422,6 @@ unsigned int get_ul_bw_mask(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) {
return(0);
}
-int is_dl_256QAM_supported(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) {
- int common_band = *rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
- int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
- if (common_band>256) {
- for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) {
- NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i];
- if (bandNRinfo->bandNR == common_band && !bandNRinfo->pdsch_256QAM_FR2) return (0);
- }
- }
- else if (cap->phy_Parameters.phy_ParametersFR1 && !cap->phy_Parameters.phy_ParametersFR1->pdsch_256QAM_FR1) return(0);
-
- // check featureSet
- NR_FeatureSets_t *fs=cap->featureSets;
- if (fs) {
- // go through DL feature sets and look for one with current SCS
- for (int i=0;ifeatureSetsDownlinkPerCC->list.count;i++) {
- if (fs->featureSetsDownlinkPerCC->list.array[i]->supportedSubcarrierSpacingDL == common_scs &&
- fs->featureSetsDownlinkPerCC->list.array[i]->supportedModulationOrderDL &&
- *fs->featureSetsDownlinkPerCC->list.array[i]->supportedModulationOrderDL == NR_ModulationOrder_qam256) return(1);
- }
- }
- return(0);
-}
-
-int is_ul_256QAM_supported(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) {
- int common_band = *rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0];
- int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
- for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) {
- NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i];
- if (bandNRinfo->bandNR == common_band && !bandNRinfo->pusch_256QAM) return (0);
- }
-
- // check featureSet
- NR_FeatureSets_t *fs=cap->featureSets;
- if (fs) {
- // go through UL feature sets and look for one with current SCS
- for (int i=0;ifeatureSetsUplinkPerCC->list.count;i++) {
- if (fs->featureSetsUplinkPerCC->list.array[i]->supportedSubcarrierSpacingUL == common_scs &&
- fs->featureSetsUplinkPerCC->list.array[i]->supportedModulationOrderUL &&
- *fs->featureSetsUplinkPerCC->list.array[i]->supportedModulationOrderUL == NR_ModulationOrder_qam256) return(1);
- }
- }
- return(0);
-}
-
int get_ul_mimo_layersCB(gNB_RRC_INST *rrc,NR_UE_NR_Capability_t *cap) {
int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
@@ -3340,11 +3491,9 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
}
if (ue_context_p->ue_context.UE_Capability_nr) {
- fprintf(fd,"NR RRC UE cap: BW DL %x. BW UL %x, 256 QAM DL %s, 256 QAM UL %s, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n",
+ fprintf(fd,"NR RRC UE cap: BW DL %x. BW UL %x, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n",
get_dl_bw_mask(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
get_ul_bw_mask(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
- is_dl_256QAM_supported(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr) == 1 ? "yes" : "no",
- is_ul_256QAM_supported(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr) == 1 ? "yes" : "no",
get_dl_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
get_ul_mimo_layersCB(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr),
get_ul_mimo_layers(RC.nrrrc[0],ue_context_p->ue_context.UE_Capability_nr));
@@ -3539,6 +3688,10 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(msg_p, msg_name_p, instance);
break;
+ case NGAP_PDUSESSION_MODIFY_REQ:
+ rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(msg_p, msg_name_p, instance);
+ break;
+
case NGAP_PDUSESSION_RELEASE_COMMAND:
rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c
index 08f5a01986..4286ea0d62 100644
--- a/openair2/RRC/NR/rrc_gNB_NGAP.c
+++ b/openair2/RRC/NR/rrc_gNB_NGAP.c
@@ -1058,6 +1058,264 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
}
}
+//------------------------------------------------------------------------------
+int
+rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(
+ MessageDef *msg_p,
+ const char *msg_name,
+ instance_t instance
+)
+//------------------------------------------------------------------------------
+{
+ uint16_t ue_initial_id;
+ uint32_t gNB_ue_ngap_id;
+ uint8_t nb_pdusessions_tomodify;
+ rrc_gNB_ue_context_t *ue_context_p = NULL;
+ uint8_t i;
+ uint8_t qos_flow_index;
+ protocol_ctxt_t ctxt;
+
+ ue_initial_id = NGAP_PDUSESSION_MODIFY_REQ(msg_p).ue_initial_id;
+ gNB_ue_ngap_id = NGAP_PDUSESSION_MODIFY_REQ(msg_p).gNB_ue_ngap_id;
+ nb_pdusessions_tomodify = NGAP_PDUSESSION_MODIFY_REQ(msg_p).nb_pdusessions_tomodify;
+
+ ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id);
+ if (ue_context_p == NULL) {
+ LOG_W(NR_RRC, "[gNB %ld] In NGAP_PDUSESSION_MODIFY_REQ: unknown UE from NGAP ids (%d, %u)\n", instance, ue_initial_id, gNB_ue_ngap_id);
+ // TODO
+ return (-1);
+ } else {
+ PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
+ ctxt.eNB_index = 0;
+
+ ue_context_p->ue_context.gNB_ue_ngap_id = gNB_ue_ngap_id;
+ {
+ int j;
+ boolean_t is_treated[NGAP_MAX_PDUSESSION] = {FALSE};
+ uint8_t nb_of_failed_pdusessions = 0;
+
+ for (i = 0; i < nb_pdusessions_tomodify; i++) {
+ if (is_treated[i] == TRUE) {
+ continue;
+ }
+
+ //Check if same PDU session ID to handle multiple pdu sessions
+ for (j = i+1; j < nb_pdusessions_tomodify; j++) {
+ if (is_treated[j] == FALSE &&
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[j].pdusession_id ==
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id) {
+ // handle multiple pdu session id
+ LOG_D(NR_RRC, "handle multiple pdu session id \n");
+ ue_context_p->ue_context.modify_pdusession[j].status = PDU_SESSION_STATUS_NEW;
+ ue_context_p->ue_context.modify_pdusession[j].param.pdusession_id =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[j].pdusession_id;
+ ue_context_p->ue_context.modify_pdusession[j].cause = NGAP_CAUSE_RADIO_NETWORK;
+ ue_context_p->ue_context.modify_pdusession[j].cause_value = NGAP_CauseRadioNetwork_multiple_PDU_session_ID_instances;
+ nb_of_failed_pdusessions++;
+ is_treated[i] = TRUE;
+ is_treated[j] = TRUE;
+ }
+ }
+ // handle multiple pdu session id case
+ if (is_treated[i] == TRUE) {
+ LOG_D(NR_RRC, "handle multiple pdu session id \n");
+ ue_context_p->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_NEW;
+ ue_context_p->ue_context.modify_pdusession[i].param.pdusession_id =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id;
+ ue_context_p->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
+ ue_context_p->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_multiple_PDU_session_ID_instances;
+ nb_of_failed_pdusessions++;
+ continue;
+ }
+
+ // Check pdu session ID is established
+ for (j = 0; j < NR_NB_RB_MAX -3; j++) {
+ if (ue_context_p->ue_context.pduSession[j].param.pdusession_id ==
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id) {
+ if (ue_context_p->ue_context.pduSession[j].status == PDU_SESSION_STATUS_TORELEASE ||
+ ue_context_p->ue_context.pduSession[j].status == PDU_SESSION_STATUS_DONE) {
+ break;
+ }
+ // Found established pdu session, prepare to send RRC message
+ ue_context_p->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_NEW;
+ ue_context_p->ue_context.modify_pdusession[i].param.pdusession_id =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id;
+ ue_context_p->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_NOTHING;
+ if (NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nas_pdu.buffer != NULL) {
+ ue_context_p->ue_context.modify_pdusession[i].param.nas_pdu.buffer =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nas_pdu.buffer;
+ ue_context_p->ue_context.modify_pdusession[i].param.nas_pdu.length =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nas_pdu.length;
+ }
+ // Save new pdu session parameters, qos, upf addr, teid
+ for (qos_flow_index = 0; qos_flow_index < NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nb_qos; qos_flow_index++) {
+ ue_context_p->ue_context.modify_pdusession[i].param.qos[qos_flow_index] =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].qos[qos_flow_index];
+ }
+ ue_context_p->ue_context.modify_pdusession[i].param.nb_qos =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nb_qos;
+
+ ue_context_p->ue_context.modify_pdusession[i].param.upf_addr =
+ ue_context_p->ue_context.pduSession[j].param.upf_addr;
+ ue_context_p->ue_context.modify_pdusession[i].param.gtp_teid =
+ ue_context_p->ue_context.pduSession[j].param.gtp_teid;
+
+ is_treated[i] = TRUE;
+ break;
+ }
+ }
+
+ // handle Unknown pdu session ID
+ if (is_treated[i] == FALSE) {
+ LOG_D(NR_RRC, "handle Unknown pdu session ID \n");
+ ue_context_p->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_NEW;
+ ue_context_p->ue_context.modify_pdusession[i].param.pdusession_id =
+ NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id;
+ ue_context_p->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
+ ue_context_p->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_unknown_PDU_session_ID;
+ nb_of_failed_pdusessions++;
+ is_treated[i] = TRUE;
+ }
+ }
+
+ ue_context_p->ue_context.nb_of_modify_pdusessions = nb_pdusessions_tomodify;
+ ue_context_p->ue_context.nb_of_failed_pdusessions = nb_of_failed_pdusessions;
+ }
+
+ if (ue_context_p->ue_context.nb_of_failed_pdusessions < ue_context_p->ue_context.nb_of_modify_pdusessions) {
+ LOG_D(NR_RRC, "generate RRCReconfiguration \n");
+ rrc_gNB_modify_dedicatedRRCReconfiguration(&ctxt, ue_context_p);
+ } else { // all pdu modification failed
+ LOG_I(NR_RRC, "pdu session modify failed, fill NGAP_PDUSESSION_MODIFY_RESP with the pdu session information that failed to modify \n");
+ uint8_t nb_of_pdu_sessions_failed = 0;
+ MessageDef *msg_fail_p = NULL;
+ msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_MODIFY_RESP);
+ if (msg_fail_p == NULL) {
+ LOG_E(NR_RRC, "itti_alloc_new_message failed, msg_fail_p is NULL \n");
+ return (-1);
+ }
+
+ NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).nb_of_pdusessions = 0;
+
+ for (nb_of_pdu_sessions_failed = 0; nb_of_pdu_sessions_failed < ue_context_p->ue_context.nb_of_failed_pdusessions; nb_of_pdu_sessions_failed++) {
+ NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).pdusessions_failed[nb_of_pdu_sessions_failed].pdusession_id =
+ ue_context_p->ue_context.modify_pdusession[nb_of_pdu_sessions_failed].param.pdusession_id;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).pdusessions_failed[nb_of_pdu_sessions_failed].cause =
+ ue_context_p->ue_context.modify_pdusession[nb_of_pdu_sessions_failed].cause;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).pdusessions_failed[nb_of_pdu_sessions_failed].cause_value =
+ ue_context_p->ue_context.modify_pdusession[nb_of_pdu_sessions_failed].cause_value;
+ }
+
+ NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).nb_of_pdusessions_failed =
+ ue_context_p->ue_context.nb_of_failed_pdusessions;
+ itti_send_msg_to_task(TASK_NGAP, instance, msg_fail_p);
+ ue_context_p->ue_context.nb_of_modify_pdusessions = 0;
+ ue_context_p->ue_context.nb_of_failed_pdusessions = 0;
+ memset(ue_context_p->ue_context.modify_pdusession, 0, sizeof(ue_context_p->ue_context.modify_pdusession));
+ return (0);
+ }
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+int
+rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(
+ const protocol_ctxt_t *const ctxt_pP,
+ rrc_gNB_ue_context_t *const ue_context_pP,
+ uint8_t xid
+)
+//------------------------------------------------------------------------------
+{
+ MessageDef *msg_p = NULL;
+ int i, j;
+ uint8_t qos_flow_index;
+ uint8_t pdu_sessions_failed = 0;
+ uint8_t pdu_sessions_done = 0;
+
+ msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_MODIFY_RESP);
+ if (msg_p == NULL) {
+ LOG_E(NR_RRC, "itti_alloc_new_message failed, msg_p is NULL \n");
+ return (-1);
+ }
+
+ LOG_I(NR_RRC, "send message NGAP_PDUSESSION_MODIFY_RESP \n");
+
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id;
+
+ for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
+ if (xid == ue_context_pP->ue_context.modify_pdusession[i].xid) {
+ if (ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_DONE) {
+ for (j = 0; j < ue_context_pP->ue_context.setup_pdu_sessions; j++) {
+ if (ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id ==
+ ue_context_pP->ue_context.pduSession[j].param.pdusession_id) {
+ LOG_I(NR_RRC, "update pdu session %d \n", ue_context_pP->ue_context.pduSession[j].param.pdusession_id);
+ // Update ue_context_pP->ue_context.pduSession
+ ue_context_pP->ue_context.pduSession[j].status = PDU_SESSION_STATUS_ESTABLISHED;
+ ue_context_pP->ue_context.pduSession[j].cause = NGAP_CAUSE_NOTHING;
+ for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos; qos_flow_index++) {
+ ue_context_pP->ue_context.pduSession[j].param.qos[qos_flow_index] =
+ ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index];
+ }
+ break;
+ }
+ }
+
+ if (j < ue_context_pP->ue_context.setup_pdu_sessions) {
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].pdusession_id =
+ ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id;
+ for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos; qos_flow_index++) {
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].qos[qos_flow_index].qfi =
+ ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].qfi;
+ }
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].nb_of_qos_flow =
+ ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos;
+ LOG_I(NR_RRC, "Modify Resp (msg index %d, pdu session index %d, status %d, xid %d): nb_of_modify_pdusessions %d, pdusession_id %d \n ",
+ pdu_sessions_done, i, ue_context_pP->ue_context.modify_pdusession[i].status, xid,
+ ue_context_pP->ue_context.nb_of_modify_pdusessions,
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].pdusession_id);
+ pdu_sessions_done++;
+ } else {
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].pdusession_id =
+ ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause = NGAP_CAUSE_RADIO_NETWORK;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause_value = NGAP_CauseRadioNetwork_unknown_PDU_session_ID;
+ pdu_sessions_failed++;
+ }
+ } else if ((ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_NEW) ||
+ (ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_ESTABLISHED)) {
+ LOG_D (NR_RRC, "PDU SESSION is NEW or already ESTABLISHED\n");
+ } else if (ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_FAILED) {
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].pdusession_id =
+ ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause =
+ ue_context_pP->ue_context.modify_pdusession[i].cause;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause_value =
+ ue_context_pP->ue_context.modify_pdusession[i].cause_value;
+ pdu_sessions_failed++;
+ }
+ } else {
+ LOG_D(NR_RRC,"xid does not correspond (context pdu session index %d, status %d, xid %d/%d) \n ",
+ i, ue_context_pP->ue_context.modify_pdusession[i].status, xid, ue_context_pP->ue_context.modify_pdusession[i].xid);
+ }
+ }
+
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).nb_of_pdusessions = pdu_sessions_done;
+ NGAP_PDUSESSION_MODIFY_RESP(msg_p).nb_of_pdusessions_failed = pdu_sessions_failed;
+
+ if (pdu_sessions_done > 0 || pdu_sessions_failed > 0) {
+ LOG_D(NR_RRC,"NGAP_PDUSESSION_MODIFY_RESP: sending the message: nb_of_pdusessions %d, total pdu session %d, index %d\n",
+ ue_context_pP->ue_context.nb_of_modify_pdusessions, ue_context_pP->ue_context.setup_pdu_sessions, i);
+ itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
+ } else {
+ itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------------
void
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(
const module_id_t gnb_mod_idP,
diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.h b/openair2/RRC/NR/rrc_gNB_NGAP.h
index 8779d62ff6..5833c8aac2 100644
--- a/openair2/RRC/NR/rrc_gNB_NGAP.h
+++ b/openair2/RRC/NR/rrc_gNB_NGAP.h
@@ -38,6 +38,7 @@
#include "NR_RRCSetupComplete-IEs.h"
#include "NR_RegisteredAMF.h"
#include "NR_UL-DCCH-Message.h"
+#include "NGAP_CauseRadioNetwork.h"
typedef struct rrc_ue_ngap_ids_s {
/* Tree related data */
@@ -107,6 +108,27 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
instance_t instance
);
+int
+rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(
+ MessageDef *msg_p,
+ const char *msg_name,
+ instance_t instance
+);
+
+int
+rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(
+ const protocol_ctxt_t *const ctxt_pP,
+ rrc_gNB_ue_context_t *const ue_context_pP,
+ uint8_t xid
+);
+
+void
+rrc_gNB_modify_dedicatedRRCReconfiguration(
+ const protocol_ctxt_t *const ctxt_pP,
+ rrc_gNB_ue_context_t *ue_context_pP
+);
+
+
void
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(
const module_id_t gnb_mod_idP,
diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c
index fc0794d812..9a47c22828 100644
--- a/openair2/RRC/NR/rrc_gNB_nsa.c
+++ b/openair2/RRC/NR/rrc_gNB_nsa.c
@@ -42,27 +42,7 @@
#include
#include
#include "UTIL/OSA/osa_defs.h"
-
-extern boolean_t nr_rrc_pdcp_config_asn1_req(
- const protocol_ctxt_t *const ctxt_pP,
- NR_SRB_ToAddModList_t *const srb2add_list,
- NR_DRB_ToAddModList_t *const drb2add_list,
- NR_DRB_ToReleaseList_t *const drb2release_list,
- const uint8_t security_modeP,
- uint8_t *const kRRCenc,
- uint8_t *const kRRCint,
- uint8_t *const kUPenc,
- uint8_t *const kUPint
- ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
- ,rb_id_t *const defaultDRB,
- struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
-
-extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
- const NR_SRB_ToAddModList_t * const srb2add_listP,
- const NR_DRB_ToAddModList_t * const drb2add_listP,
- const NR_DRB_ToReleaseList_t * const drb2release_listP,
- const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
- struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
+#include
void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList, x2ap_ENDC_sgnb_addition_req_t *m, NR_CG_ConfigInfo_IEs_t *cg_config_info) {
struct rrc_gNB_ue_context_s *ue_context_p = NULL;
@@ -268,6 +248,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
ue_context_p->ue_context.spCellConfig->spCellConfigDedicated,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
+ ue_context_p->ue_context.UE_Capability_nr,
carrier->pdsch_AntennaPorts,
carrier->minRXTXTIME,
carrier->do_CSIRS,
@@ -278,6 +259,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
NULL,
reconfig_ies,
ue_context_p->ue_context.secondaryCellGroup,
+ ue_context_p->ue_context.UE_Capability_nr,
carrier->pdsch_AntennaPorts,
carrier->minRXTXTIME,
carrier->do_CSIRS,
diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c
index 73eb46441d..3d8c57ec4a 100644
--- a/openair2/RRC/NR/rrc_gNB_reconfig.c
+++ b/openair2/RRC/NR/rrc_gNB_reconfig.c
@@ -45,6 +45,7 @@
#include "SIMULATION/TOOLS/sim.h"
#include "executables/softmodem-common.h"
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"
+#include "nr_rrc_config.h"
#define false 0
#define true 1
@@ -87,6 +88,7 @@ void fill_default_nsa_downlinkBWP(NR_BWP_Downlink_t *bwp,
NR_CellGroupConfig_t *secondaryCellGroup,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_ServingCellConfigCommon_t *servingcellconfigcommon,
+ NR_UE_NR_Capability_t *uecap,
int dl_antenna_ports,
uint64_t bitmap) {
@@ -305,42 +307,7 @@ void fill_default_nsa_downlinkBWP(NR_BWP_Downlink_t *bwp,
bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1;
- if (!get_softmodem_params()->use_256qam_table) {
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL;
- } else {
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table));
- *bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256;
- }
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI));
- *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling));
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize =
- calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize));
- *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType1;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL;
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1;
- if (!get_softmodem_params()->use_256qam_table) {
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL;
- } else {
- bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table));
- *bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256;
- }
+ set_dl_mcs_table(bwp->bwp_Common->genericParameters.subcarrierSpacing, uecap, bwp->bwp_Dedicated, servingcellconfigcommon);
bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI));
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling;
@@ -582,8 +549,8 @@ void fill_default_nsa_uplinkBWP(NR_BWP_Uplink_t *ubwp,
pusch_Config->pusch_TimeDomainAllocationList = NULL;
pusch_Config->pusch_AggregationFactor=NULL;
pusch_Config->mcs_Table=NULL;
- pusch_Config->mcs_TableTransformPrecoder=NULL;
pusch_Config->transformPrecoder= NULL;
+ pusch_Config->mcs_TableTransformPrecoder=NULL;
/* if msg3_transformprecoding is set in conf file - pusch config should not disable it */
if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) {
pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder));
@@ -680,6 +647,7 @@ void fill_default_nsa_uplinkBWP(NR_BWP_Uplink_t *ubwp,
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_CellGroupConfig_t *secondaryCellGroup,
+ NR_UE_NR_Capability_t *uecap,
int scg_id,
int servCellIndex,
int dl_antenna_ports,
@@ -691,6 +659,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
+ if(uecap == NULL)
+ LOG_E(RRC,"No UE Capabilities available when programming default CellGroup in NSA\n");
+
// This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4.
// However, if in the future NUMBER_OF_UE_MAX is increased, it will be necessary to improve the allocation of SRS resources,
// where the startPosition = 2 or 3 and sl160 = 17, 17, 27 ... 157 only give us 30 different allocations.
@@ -964,12 +935,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL;
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL;
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1;
- if (!get_softmodem_params()->use_256qam_table) {
- secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL;
- } else {
- secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table));
- *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table = NR_PDSCH_Config__mcs_Table_qam256;
- }
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL;
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI));
*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1;
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling;
@@ -1064,8 +1030,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
pusch_Config->pusch_TimeDomainAllocationList = NULL;
pusch_Config->pusch_AggregationFactor=NULL;
pusch_Config->mcs_Table=NULL;
- pusch_Config->mcs_TableTransformPrecoder=NULL;
pusch_Config->transformPrecoder= NULL;
+ pusch_Config->mcs_TableTransformPrecoder=NULL;
/* if msg3_transformprecoding is set in conf file - pusch config should not disable it */
if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) {
pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder));
@@ -1194,7 +1160,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList));
for (int bwp_loop = 0; bwp_loop < n_dl_bwp; bwp_loop++) {
NR_BWP_Downlink_t *bwp = calloc(1,sizeof(*bwp));
- fill_default_nsa_downlinkBWP(bwp, bwp_loop, secondaryCellGroup, servingcellconfigdedicated, servingcellconfigcommon, dl_antenna_ports, bitmap);
+ fill_default_nsa_downlinkBWP(bwp, bwp_loop, secondaryCellGroup, servingcellconfigdedicated, servingcellconfigcommon, uecap, dl_antenna_ports, bitmap);
ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp);
}
secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id));
@@ -1531,17 +1497,17 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
resourceMapping.frequencyDomainAllocation.choice.row2.buf = calloc(2, sizeof(uint8_t));
resourceMapping.frequencyDomainAllocation.choice.row2.size = 2;
resourceMapping.frequencyDomainAllocation.choice.row2.bits_unused = 4;
- resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]=0;
- resourceMapping.frequencyDomainAllocation.choice.row2.buf[1]=16;
+ resourceMapping.frequencyDomainAllocation.choice.row2.buf[0] = 0;
+ resourceMapping.frequencyDomainAllocation.choice.row2.buf[1] = 16;
resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
break;
case 2:
resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other;
- resourceMapping.frequencyDomainAllocation.choice.row2.buf = calloc(2, sizeof(uint8_t));
- resourceMapping.frequencyDomainAllocation.choice.row2.size = 1;
- resourceMapping.frequencyDomainAllocation.choice.row2.bits_unused = 2;
- resourceMapping.frequencyDomainAllocation.choice.row2.buf[0]=4;
+ resourceMapping.frequencyDomainAllocation.choice.other.buf = calloc(2, sizeof(uint8_t));
+ resourceMapping.frequencyDomainAllocation.choice.other.size = 1;
+ resourceMapping.frequencyDomainAllocation.choice.other.bits_unused = 2;
+ resourceMapping.frequencyDomainAllocation.choice.other.buf[0] = 4;
resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p2;
resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_fd_CDM2;
break;
@@ -1574,6 +1540,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
NR_ServingCellConfig_t *servingcellconfigdedicated,
NR_RRCReconfiguration_IEs_t *reconfig,
NR_CellGroupConfig_t *secondaryCellGroup,
+ NR_UE_NR_Capability_t *uecap,
int dl_antenna_ports,
int minRXTXTIME,
int do_csirs,
@@ -1588,6 +1555,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
fill_default_secondaryCellGroup(servingcellconfigcommon,
servingcellconfigdedicated,
secondaryCellGroup,
+ uecap,
1,
1,
dl_antenna_ports,
diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c
index 03231922f6..41c7cc142b 100644
--- a/openair2/RRC/NR_UE/rrc_UE.c
+++ b/openair2/RRC/NR_UE/rrc_UE.c
@@ -72,6 +72,7 @@
#include
#include "nr_nas_msg_sim.h"
+#include
NR_UE_RRC_INST_t *NR_UE_rrc_inst;
/* NAS Attach request with IMSI */
@@ -178,27 +179,6 @@ static int nr_rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_NR_t subS
return (0);
}
-extern boolean_t nr_rrc_pdcp_config_asn1_req(
- const protocol_ctxt_t *const ctxt_pP,
- NR_SRB_ToAddModList_t *const srb2add_list,
- NR_DRB_ToAddModList_t *const drb2add_list,
- NR_DRB_ToReleaseList_t *const drb2release_list,
- const uint8_t security_modeP,
- uint8_t *const kRRCenc,
- uint8_t *const kRRCint,
- uint8_t *const kUPenc,
- uint8_t *const kUPint
- ,LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9
- ,rb_id_t *const defaultDRB,
- struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
-
-extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
- const NR_SRB_ToAddModList_t * const srb2add_listP,
- const NR_DRB_ToAddModList_t * const drb2add_listP,
- const NR_DRB_ToReleaseList_t * const drb2release_listP,
- const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
- struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
-
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id,
const uint8_t *buffer,
@@ -2230,7 +2210,7 @@ nr_rrc_ue_establish_srb2(
// nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig);
}
- if(ie->nonCriticalExtension->masterCellGroup!=NULL) {
+ if((ie->nonCriticalExtension) && (ie->nonCriticalExtension->masterCellGroup!=NULL)) {
nr_rrc_ue_process_masterCellGroup(
ctxt_pP,
gNB_index,
@@ -2243,7 +2223,7 @@ nr_rrc_ue_establish_srb2(
}
/* Check if there is dedicated NAS information to forward to NAS */
- if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) {
+ if ((ie->nonCriticalExtension) && (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL)) {
int list_count;
uint32_t pdu_length;
uint8_t *pdu_buffer;
diff --git a/openair2/UTIL/FIFO/pad_list.c b/openair2/UTIL/FIFO/pad_list.c
deleted file mode 100644
index 124893a756..0000000000
--- a/openair2/UTIL/FIFO/pad_list.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * 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
- */
-
-/*! \file pad_list.c
-* \brief list management primimtives
-* \author Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER, Navid Nikaein
-* \date 2012 - 2014
-* \version 0.5
-* @ingroup util
-*/
-//#define LIST_C
-//#define NULL 0
-
-#include
-#include
-#include "pad_list.h"
-//#include
-
-
-void job_list_init (Job_List_t *listP) {
- listP->tail = NULL;
- listP->head = NULL;
- listP->nb_elements = 0;
-}
-
-void event_list_init (Event_List_t *listP) {
- listP->tail = NULL;
- listP->head = NULL;
- listP->nb_elements = 0;
-}
-
-void pkt_list_init (Packet_OTG_List_t *listP) {
- listP->tail = NULL;
- listP->head = NULL;
- listP->nb_elements = 0;
-}
-
-//-----------------------------------------------------------------------------
-
-void job_list_free (Job_List_t *listP) {
- Job_elt_t *le;
-
- while ((le = job_list_remove_head (listP))) {
- free(le);
- }
-}
-
-void event_list_free (Event_List_t *listP) {
- Event_elt_t *le;
-
- while ((le = event_list_remove_head (listP))) {
- free(le);
- }
-}
-
-void pkt_list_free (Packet_OTG_List_t *listP) {
- Packet_otg_elt_t *le;
-
- while ((le = pkt_list_remove_head (listP))) {
- free(le);
- }
-}
-
-//-----------------------------------------------------------------------------
-
-Job_elt_t *job_list_get_head (Job_List_t *listP) {
- return listP->head;
-}
-
-Event_elt_t *event_list_get_head (Event_List_t *listP) {
- return listP->head;
-}
-
-Packet_otg_elt_t *pkt_list_get_head (Packet_OTG_List_t *listP) {
- return listP->head;
-}
-
-//-----------------------------------------------------------------------------
-
-/*
- * remove an element from head of a list
- * @param pointer on targeted list
- * @return pointer on removed Job_elt_t
- */
-Job_elt_t *job_list_remove_head (Job_List_t *listP) {
- // access optimisation
- Job_elt_t *head;
- head = listP->head;
-
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- } else {
- //msg("[MEM_MGT][WARNING] remove_head_from_list(%s) no elements\n",listP->name);
- }
-
- return head;
-}
-
-Event_elt_t *event_list_remove_head (Event_List_t *listP) {
- // access optimisation
- Event_elt_t *head;
- head = listP->head;
-
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- } else {
- //msg("[MEM_MGT][WARNING] remove_head_from_list(%s) no elements\n",listP->name);
- }
-
- return head;
-}
-
-Packet_otg_elt_t *pkt_list_remove_head (Packet_OTG_List_t *listP) {
- // access optimisation
- Packet_otg_elt_t *head;
- head = listP->head;
-
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- } else {
- //msg("[MEM_MGT][WARNING] remove_head_from_list(%s) no elements\n",listP->name);
- }
-
- return head;
-}
-
-//-----------------------------------------------------------------------------
-
-Job_elt_t *job_list_remove_element (Job_elt_t *elementP, Job_List_t *listP) {
- // access optimisation;
- Job_elt_t *head;
-
- if (elementP != NULL) {
- // test head
- head = listP->head;
-
- if (listP->head == elementP) {
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- }
- } else {
- while (head) {
- if (head->next == elementP) {
- head->next = elementP->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- if (listP->tail == elementP) {
- listP->tail = head;
- }
-
- return elementP;
- } else {
- head = head->next;
- }
- }
- }
- }
-
- return elementP;
-}
-
-Event_elt_t *event_list_remove_element (Event_elt_t *elementP, Event_List_t *listP) {
- // access optimisation;
- Event_elt_t *head;
-
- if (elementP != NULL) {
- // test head
- head = listP->head;
-
- if (listP->head == elementP) {
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- }
- } else {
- while (head) {
- if (head->next == elementP) {
- head->next = elementP->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- if (listP->tail == elementP) {
- listP->tail = head;
- }
-
- return elementP;
- } else {
- head = head->next;
- }
- }
- }
- }
-
- return elementP;
-}
-
-Packet_otg_elt_t *pkt_list_remove_element (Packet_otg_elt_t *elementP, Packet_OTG_List_t *listP) {
- // access optimisation;
- Packet_otg_elt_t *head;
-
- if (elementP != NULL) {
- // test head
- head = listP->head;
-
- if (listP->head == elementP) {
- // almost one element
- if (head != NULL) {
- listP->head = head->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- // if only one element, update tail
- if (listP->head == NULL) {
- listP->tail = NULL;
- } else {
- head->next = NULL;
- }
- }
- } else {
- while (head) {
- if (head->next == elementP) {
- head->next = elementP->next;
- listP->nb_elements = listP->nb_elements - 1;
-
- if (listP->tail == elementP) {
- listP->tail = head;
- }
-
- return elementP;
- } else {
- head = head->next;
- }
- }
- }
- }
-
- return elementP;
-}
-
-//-----------------------------------------------------------------------------
-/*
- * add an element to the beginning of a list
- * @param pointer on targeted list
- * @return pointer on removed Job_elt_t
- */
-
-void job_list_add_head (Job_elt_t *elementP, Job_List_t *listP) {
- // access optimisation;
- Job_elt_t *head;
-
- if (elementP != NULL) {
- head = listP->head;
- listP->nb_elements = listP->nb_elements + 1;
-
- // almost one element
- if (head == NULL) {
- listP->head = elementP;
- listP->tail = elementP;
- } else {
- elementP->next = head;
- listP->head = elementP;
- }
- }
-}
-
-void event_list_add_head (Event_elt_t *elementP, Event_List_t *listP) {
- // access optimisation;
- Event_elt_t *head;
-
- if (elementP != NULL) {
- head = listP->head;
- listP->nb_elements = listP->nb_elements + 1;
-
- // almost one element
- if (head == NULL) {
- listP->head = elementP;
- listP->tail = elementP;
- } else {
- elementP->next = head;
- listP->head = elementP;
- }
- }
-}
-
-void pkt_list_add_head (Packet_otg_elt_t *elementP, Packet_OTG_List_t *listP) {
- // access optimisation;
- Packet_otg_elt_t *head;
-
- if (elementP != NULL) {
- head = listP->head;
- listP->nb_elements = listP->nb_elements + 1;
-
- // almost one element
- if (head == NULL) {
- listP->head = elementP;
- listP->tail = elementP;
- } else {
- elementP->next = head;
- listP->head = elementP;
- }
- }
-}
-
-void event_list_add_element (Event_elt_t *elementP, Event_elt_t *previous, Event_List_t *listP) {
- // access optimisation;
- Event_elt_t *next;
-
- if (elementP != NULL && previous != NULL) {
- elementP->next = NULL;
- next = previous->next;
- listP->nb_elements = listP->nb_elements + 1;
-
- // almost one element
- if (next == NULL) {
- previous->next = elementP;
- listP->tail = elementP;
- } else {
- elementP->next = previous->next;
- previous->next = elementP;
- }
- }
-}
-
-
-//-----------------------------------------------------------------------------
-/*
- * add an element to the end of a list
- * @param pointer on targeted list
- * @return pointer on removed Job_elt_t
- */
-void job_list_add_tail_eurecom (Job_elt_t *elementP, Job_List_t *listP) {
- Job_elt_t *tail;
-
- if (elementP != NULL) {
- // access optimisation
- listP->nb_elements = listP->nb_elements + 1;
- elementP->next = NULL;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = elementP;
- } else {
- tail->next = elementP;
- }
-
- listP->tail = elementP;
- } else {
- //msg("[CNT_LIST][ERROR] add_cnt_tail() element NULL\n");
- }
-}
-
-void event_list_add_tail_eurecom (Event_elt_t *elementP, Event_List_t *listP) {
- Event_elt_t *tail;
-
- if (elementP != NULL) {
- // access optimisation
- listP->nb_elements = listP->nb_elements + 1;
- elementP->next = NULL;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = elementP;
- } else {
- tail->next = elementP;
- }
-
- listP->tail = elementP;
- } else {
- //msg("[CNT_LIST][ERROR] add_cnt_tail() element NULL\n");
- }
-}
-
-void pkt_list_add_tail_eurecom (Packet_otg_elt_t *elementP, Packet_OTG_List_t *listP) {
- Packet_otg_elt_t *tail;
-
- if (elementP != NULL) {
- // access optimisation
- listP->nb_elements = listP->nb_elements + 1;
- elementP->next = NULL;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = elementP;
- } else {
- tail->next = elementP;
- }
-
- listP->tail = elementP;
- } else {
- //msg("[CNT_LIST][ERROR] add_cnt_tail() element NULL\n");
- }
-}
-
-//-----------------------------------------------------------------------------
-void job_list_add_list (Job_List_t *sublistP, Job_List_t *listP) {
- if (sublistP) {
- if (sublistP->head) {
- // access optimisation
- Job_elt_t *tail;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = sublistP->head;
- } else {
- tail->next = sublistP->head;
- }
-
- listP->tail = sublistP->tail;
- // clear sublist
- sublistP->head = NULL;
- sublistP->tail = NULL;
- listP->nb_elements = listP->nb_elements + sublistP->nb_elements;
- sublistP->nb_elements = 0;
- }
- }
-}
-
-void event_list_add_list (Event_List_t *sublistP, Event_List_t *listP) {
- if (sublistP) {
- if (sublistP->head) {
- // access optimisation
- Event_elt_t *tail;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = sublistP->head;
- } else {
- tail->next = sublistP->head;
- }
-
- listP->tail = sublistP->tail;
- // clear sublist
- sublistP->head = NULL;
- sublistP->tail = NULL;
- listP->nb_elements = listP->nb_elements + sublistP->nb_elements;
- sublistP->nb_elements = 0;
- }
- }
-}
-
-void pkt_list_add_list (Packet_OTG_List_t *sublistP, Packet_OTG_List_t *listP) {
- if (sublistP) {
- if (sublistP->head) {
- // access optimisation
- Packet_otg_elt_t *tail;
- tail = listP->tail;
-
- // almost one element
- if (tail == NULL) {
- listP->head = sublistP->head;
- } else {
- tail->next = sublistP->head;
- }
-
- listP->tail = sublistP->tail;
- // clear sublist
- sublistP->head = NULL;
- sublistP->tail = NULL;
- listP->nb_elements = listP->nb_elements + sublistP->nb_elements;
- sublistP->nb_elements = 0;
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-void job_list_display (Job_List_t *listP) {
- //Correct the output once the content of struct Job is fixed
- /*Job_elt_t *cursor;
- unsigned short nb_elements = 0;
-
- if (listP) {
- cursor = listP->head;
- if (cursor) {
- while (cursor != NULL) {
- if (cursor->job.type == eNB_DL)
- printf ("DL eNB From (%d,%d)\n", (cursor->job).nid, (cursor->job).mid);
- else if (cursor->job.type == UE_DL)
- printf ("DL UE From (%d,%d)\n", (cursor->job).nid, (cursor->job).mid);
- else if (cursor->job.type == UE_UL)
- printf ("UL UE From (%d,%d)\n", (cursor->job).nid, (cursor->job).mid);
- else if (cursor->job.type == eNB_UL)
- printf ("UL eNB From (%d,%d)\n", (cursor->job).nid, (cursor->job).mid);
- //msg ("From (%d,%d) To (%d,%d)\n", (cursor->job).node1, (cursor->job).master1, (cursor->job).node2, (cursor->job).master2);
- cursor = cursor->next;
- nb_elements++;
- }
- printf ("Found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- //msg ("Found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- }
- } else {
- printf ("[SDU_MNGT][WARNING] display_cnt_dbl_lk_list_up() : list is NULL\n");
- //msg ("[SDU_MNGT][WARNING] display_cnt_dbl_lk_list_up() : list is NULL\n");
- }*/
-}
-
-void event_list_display (Event_List_t *listP) {
- Event_elt_t *cursor;
- unsigned short nb_elements = 0;
-
- if (listP) {
- cursor = listP->head;
-
- if (cursor) {
- while (cursor != NULL) {
- printf ("Ev (%d,%d)\n", (cursor->event).type, (cursor->event).frame);
- //msg ("From (%d,%d) To (%d,%d)\n", (cursor->job).node1, (cursor->job).master1, (cursor->job).node2, (cursor->job).master2);
- cursor = cursor->next;
- nb_elements++;
- }
-
- printf ("Found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- //msg ("Found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- }
- } else {
- printf ("[SDU_MNGT][WARNING] display_cnt_dbl_lk_list_up() : list is NULL\n");
- //msg ("[SDU_MNGT][WARNING] display_cnt_dbl_lk_list_up() : list is NULL\n");
- }
-}
-
-void pkt_list_display (Packet_OTG_List_t *listP) {
- Packet_otg_elt_t *cursor;
- unsigned short nb_elements = 0;
-
- if (listP) {
- cursor = listP->head;
-
- if (cursor) {
- while (cursor != NULL) {
- printf ("Pkt (DST %d, RB %ld)\n", (cursor->otg_pkt).dst_id, (cursor->otg_pkt).rb_id);
- //msg ("From (%d,%d) To (%d,%d)\n", (cursor->job).node1, (cursor->job).master1, (cursor->job).node2, (cursor->job).master2);
- cursor = cursor->next;
- nb_elements++;
- }
-
- printf ("Found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- //msg ("Found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements);
- }
- } else {
- printf ("[SDU_MNGT][WARNING] display_cnt_dbl_lk_list_up() : list is NULL\n");
- //msg ("[SDU_MNGT][WARNING] display_cnt_dbl_lk_list_up() : list is NULL\n");
- }
-}
diff --git a/openair2/UTIL/FIFO/pad_list.h b/openair2/UTIL/FIFO/pad_list.h
deleted file mode 100644
index 2a9ef9893f..0000000000
--- a/openair2/UTIL/FIFO/pad_list.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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
- */
-
-/*! \file pad_list.c
-* \brief list management primimtives
-* \author Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER, Navid Nikaein
-* \date 2012 - 2014
-* \version 0.5
-* @ingroup util
-*/
-
-#ifndef __list_H__
-#define __list_H__
-
-#include "types.h"
-//-----------------------------------------------------------------------------
-
-typedef struct Job_List_s {
- Job_elt_t *head;
- Job_elt_t *tail;
- int nb_elements;
-} Job_List_t;
-
-typedef struct Event_List_s {
- Event_elt_t *head;
- Event_elt_t *tail;
- int nb_elements;
-} Event_List_t;
-
-typedef struct Packet_OTG_List_s {
- Packet_otg_elt_t *head;
- Packet_otg_elt_t *tail;
- int nb_elements;
-} Packet_OTG_List_t;
-
-//-----------------------------------------------------------------------------
-void job_list_init (Job_List_t*);
-void job_list_free (Job_List_t* listP);
-Job_elt_t* job_list_get_head (Job_List_t*);
-Job_elt_t* job_list_remove_head (Job_List_t* );
-Job_elt_t* job_list_remove_element (Job_elt_t*, Job_List_t*);
-void job_list_add_head (Job_elt_t* , Job_List_t* );
-void job_list_add_tail_eurecom (Job_elt_t* , Job_List_t* );
-void job_list_add_list (Job_List_t* , Job_List_t* );
-void job_list_display (Job_List_t* );
-
-void event_list_init (Event_List_t*);
-void event_list_free (Event_List_t* listP);
-Event_elt_t* event_list_get_head (Event_List_t*);
-Event_elt_t* event_list_remove_head (Event_List_t* );
-Event_elt_t* event_list_remove_element (Event_elt_t*, Event_List_t*);
-void event_list_add_head (Event_elt_t* , Event_List_t* );
-void event_list_add_element (Event_elt_t* , Event_elt_t* , Event_List_t* );
-void event_list_add_tail_eurecom (Event_elt_t* , Event_List_t* );
-void event_list_add_list (Event_List_t* , Event_List_t* );
-void event_list_display (Event_List_t* );
-
-void pkt_list_init (Packet_OTG_List_t*);
-void pkt_list_free (Packet_OTG_List_t* listP);
-Packet_otg_elt_t* pkt_list_get_head (Packet_OTG_List_t*);
-Packet_otg_elt_t* pkt_list_remove_head (Packet_OTG_List_t* );
-Packet_otg_elt_t* pkt_list_remove_element (Packet_otg_elt_t*, Packet_OTG_List_t*);
-void pkt_list_add_head (Packet_otg_elt_t* , Packet_OTG_List_t* );
-void pkt_list_add_element (Packet_otg_elt_t* , Packet_otg_elt_t* , Packet_OTG_List_t* );
-void pkt_list_add_tail_eurecom (Packet_otg_elt_t* , Packet_OTG_List_t* );
-void pkt_list_add_list (Packet_OTG_List_t* , Packet_OTG_List_t* );
-void pkt_list_display (Packet_OTG_List_t* );
-
-#endif
diff --git a/openair2/UTIL/FIFO/types.h b/openair2/UTIL/FIFO/types.h
deleted file mode 100644
index f949b2b72b..0000000000
--- a/openair2/UTIL/FIFO/types.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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
- */
-
-/*! \file pad_list.c
-* \brief list management primimtives
-* \author Mohamed Said MOSLI BOUKSIAA, Lionel GAUTHIER, Navid Nikaein
-* \date 2012 - 2014
-* \version 0.5
-* @ingroup util
-*/
-
-#ifndef __FIFO_TYPES_H__
-#define __FIFO_TYPES_H__
-#include "platform_types.h"
-
-/* Types regrouping both user-defined and regular events */
-typedef enum {
- MIN_ET=0,
- OAI_ET=MIN_ET, // config events
- SYS_ET,
- TOPO_ET,
- APP_ET,
- EMU_ET,
- DL_ET, // frame events
- UL_ET,
- S_ET,
- PHY_ET, // protocol events
- MAC_ET,
- RLC_ET,
- PDCP_ET,
- RRC_ET,
- MAX_ET
-} Event_Type_t;
-
-/* decomposition of node functions into jobs for a given event */
-typedef enum Job_type_e { JT_OTG, JT_PDCP, JT_PHY_MAC, JT_INIT_SYNC, JT_DL, JT_UL, RN_DL, RN_UL, JT_END} Job_Type_t;
-
-typedef enum Operation_Type_e { READ, WRITE, RESET} Operation_Type_t;
-
-typedef struct Job_s {
- enum Job_type_e type;
- int exe_time; /* execution time at the worker*/
- int nid; /* node id*/
- eNB_flag_t eNB_flag;
- frame_t frame;
- int last_slot;
- int next_slot;
- int ctime;
-} Job_t;
-
-typedef struct Signal_buffers_s { // (s = transmit, r,r0 = receive)
- double **s_re;
- double **s_im;
- double **r_re;
- double **r_im;
- double **r_re0;
- double **r_im0;
-} Signal_buffers_t;
-
-/*!\brief sybframe type : DL, UL, SF, */
-
-typedef struct Packet_otg_s {
- unsigned int sdu_buffer_size;
- unsigned char *sdu_buffer;
- module_id_t module_id;
- rb_id_t rb_id;
- module_id_t dst_id;
- boolean_t is_ue;
- pdcp_transmission_mode_t mode;
-} Packet_otg_t;
-
-typedef struct {
- Event_Type_t type;
- enum Operation_Type_e optype; //op
- char *key;
- void *value;
- frame_t frame;
- int ue;
- int lcid;
-} Event_t;
-
-/*typedef struct Global_Time {
- uint32_t frame;
- int32_t slot;
- int32_t last_slot;
- int32_t next_slot;
- double time_s;
- double time_ms;
-};*/
-
-
-
-typedef struct Packet_otg_elt_s {
- struct Packet_otg_elt_s *next;
- struct Packet_otg_elt_s *previous;
- Packet_otg_t otg_pkt;
-} Packet_otg_elt_t;
-
-typedef struct Job_element_s {
- struct Job_element_s *next;
- Job_t job;
-} Job_elt_t;
-
-typedef struct Event_element_s {
- struct Event_element_s *next;
- struct Event_element_s *previous;
- Event_t event;
-} Event_elt_t;
-#endif
diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c
index 38e6149ccd..2b1d19001a 100644
--- a/openair2/X2AP/x2ap_eNB.c
+++ b/openair2/X2AP/x2ap_eNB.c
@@ -621,7 +621,12 @@ void x2ap_eNB_handle_sgNB_release_request(instance_t instance,
}
target = x2ap_get_eNB(NULL, x2ap_release_req->assoc_id, 0);
- DevAssert(target != NULL);
+ if (target == NULL) {
+ X2AP_ERROR("no X2AP target eNB on assoc_id %d, dropping sgNB release request\n", x2ap_release_req->assoc_id);
+ /* x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge() would handle the
+ * ack, but does not do anything */
+ return;
+ }
/* id_source is not used by oai's gNB so it's not big deal. For
* interoperability with other gNBs things may need to be refined.
diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c
index 769eab5260..d1a9e97025 100644
--- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c
+++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c
@@ -1096,7 +1096,8 @@ static int _nas_message_decrypt(
"Unknown security header type %u", security_header_type);
LOG_FUNC_RETURN (0);
};
-
+ LOG_FUNC_RETURN (0);
+
}
/****************************************************************************
diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h
index 283dd2bffa..60f7beacd0 100644
--- a/openair3/NGAP/ngap_common.h
+++ b/openair3/NGAP/ngap_common.h
@@ -87,6 +87,9 @@
#include "NGAP_PDUSessionResourceModifyItemModReq.h"
#include "NGAP_PDUSessionResourceModifyRequestTransfer.h"
#include "NGAP_QosFlowAddOrModifyRequestItem.h"
+#include "NGAP_PDUSessionResourceModifyResponseTransfer.h"
+#include "NGAP_QosFlowAddOrModifyResponseList.h"
+#include "NGAP_QosFlowAddOrModifyResponseItem.h"
#include "NGAP_TAIListForPagingItem.h"
#include "NGAP_GNB-ID.h"
#include "NGAP_GlobalGNB-ID.h"
diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c
index 4692d2cd32..35b152f129 100644
--- a/openair3/NGAP/ngap_gNB_handlers.c
+++ b/openair3/NGAP/ngap_gNB_handlers.c
@@ -1614,13 +1614,6 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
return -1;
}
- /* PDUSession Resource modify request = UE-related procedure -> stream != 0 */
- if (stream == 0) {
- NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
- assoc_id, stream);
- return -1;
- }
-
ue_desc_p->rx_stream = stream;
if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) {
@@ -1702,14 +1695,20 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
switch(pdusessionTransfer_ies->id) {
/* optional PDUSessionAggregateMaximumBitRate */
case NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate:
+ // TODO
+ NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate\n");
break;
/* optional UL-NGU-UP-TNLModifyList */
case NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLModifyList:
+ // TODO
+ NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLModifyList\n");
break;
/* optional NetworkInstance */
case NGAP_ProtocolIE_ID_id_NetworkInstance:
+ // TODO
+ NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_NetworkInstance\n");
break;
/* optional QosFlowAddOrModifyRequestList */
@@ -1729,6 +1728,12 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
/* Set the QOS informations */
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].qfi = (uint8_t)qosFlowItem_p->qosFlowIdentifier;
if(qosFlowItem_p->qosFlowLevelQosParameters) {
+ if (qosFlowItem_p->qosFlowLevelQosParameters->qosCharacteristics.present == NGAP_QosCharacteristics_PR_nonDynamic5QI) {
+ NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].fiveQI =
+ qosFlowItem_p->qosFlowLevelQosParameters->qosCharacteristics.choice.nonDynamic5QI->fiveQI;
+ } else if (qosFlowItem_p->qosFlowLevelQosParameters->qosCharacteristics.present == NGAP_QosCharacteristics_PR_dynamic5QI) {
+ // TODO
+ }
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].allocation_retention_priority.priority_level =
qosFlowItem_p->qosFlowLevelQosParameters->allocationAndRetentionPriority.priorityLevelARP;
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].allocation_retention_priority.pre_emp_capability =
@@ -1742,14 +1747,20 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
/* optional QosFlowToReleaseList */
case NGAP_ProtocolIE_ID_id_QosFlowToReleaseList:
+ // TODO
+ NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_QosFlowToReleaseList\n");
break;
/* optional AdditionalUL-NGU-UP-TNLInformation */
case NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation:
+ // TODO
+ NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation\n");
break;
/* optional CommonNetworkInstance */
case NGAP_ProtocolIE_ID_id_CommonNetworkInstance:
+ // TODO
+ NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_CommonNetworkInstance\n");
break;
default:
diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c
index a40e8328da..3f4b7d1aa1 100644
--- a/openair3/NGAP/ngap_gNB_nas_procedures.c
+++ b/openair3/NGAP/ngap_gNB_nas_procedures.c
@@ -1179,7 +1179,7 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance,
ie->value.choice.RAN_UE_NGAP_ID = pdusession_modify_resp_p->gNB_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
- /* optional */
+ /* PDUSessionResourceModifyListModRes optional */
if (pdusession_modify_resp_p->nb_of_pdusessions > 0) {
ie = (NGAP_PDUSessionResourceModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceModifyListModRes;
@@ -1187,13 +1187,32 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance,
ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_PDUSessionResourceModifyListModRes;
for (i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions; i++) {
- NGAP_PDUSessionResourceModifyItemModRes_t *item;
-
- item = (NGAP_PDUSessionResourceModifyItemModRes_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyItemModRes_t));
- item->pDUSessionID = pdusession_modify_resp_p->pdusessions[i].pdusession_id;
-
- NGAP_DEBUG("pdusession_modify_resp: modified pdusession ID %ld\n", item->pDUSessionID);
- ASN_SEQUENCE_ADD(&ie->value.choice.PDUSessionResourceModifyListModRes.list, item);
+ NGAP_PDUSessionResourceModifyItemModRes_t *item;
+ NGAP_PDUSessionResourceModifyResponseTransfer_t *transfer_p = NULL;
+
+ item = (NGAP_PDUSessionResourceModifyItemModRes_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyItemModRes_t));
+ item->pDUSessionID = pdusession_modify_resp_p->pdusessions[i].pdusession_id;
+
+ transfer_p = (NGAP_PDUSessionResourceModifyResponseTransfer_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyResponseTransfer_t));
+ transfer_p->qosFlowAddOrModifyResponseList = (NGAP_QosFlowAddOrModifyResponseList_t *)calloc(1, sizeof(NGAP_QosFlowAddOrModifyResponseList_t));
+
+ uint8_t qos_flow_index;
+ for (qos_flow_index = 0; qos_flow_index < pdusession_modify_resp_p->pdusessions[i].nb_of_qos_flow; qos_flow_index++) {
+ NGAP_QosFlowAddOrModifyResponseItem_t *qosFlowAddOrModifyResponseItem_p = calloc(1, sizeof(NGAP_QosFlowAddOrModifyResponseItem_t));
+ qosFlowAddOrModifyResponseItem_p->qosFlowIdentifier =
+ pdusession_modify_resp_p->pdusessions[i].qos[qos_flow_index].qfi;
+ ASN_SEQUENCE_ADD(&transfer_p->qosFlowAddOrModifyResponseList->list, qosFlowAddOrModifyResponseItem_p);
+ }
+
+ memset(&res, 0, sizeof(res));
+ res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, transfer_p);
+ item->pDUSessionResourceModifyResponseTransfer.buf = res.buffer;
+ item->pDUSessionResourceModifyResponseTransfer.size = res.result.encoded;
+
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, transfer_p);
+
+ NGAP_DEBUG("pdusession_modify_resp: modified pdusession ID %ld\n", item->pDUSessionID);
+ ASN_SEQUENCE_ADD(&ie->value.choice.PDUSessionResourceModifyListModRes.list, item);
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
diff --git a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/attach_complete.pdml b/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/attach_complete.pdml
deleted file mode 100644
index f7c27272aa..0000000000
--- a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/attach_complete.pdml
+++ /dev/null
@@ -1,4242 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb.band7.tm1.usrpb210.epc.local.conf b/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb.band7.tm1.usrpb210.epc.local.conf
deleted file mode 100644
index ad6c81f56b..0000000000
--- a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb.band7.tm1.usrpb210.epc.local.conf
+++ /dev/null
@@ -1,162 +0,0 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
-# Asn1_verbosity, choice in: none, info, annoying
-Asn1_verbosity = "none";
-
-eNBs =
-(
- {
- ////////// Identification parameters:
- eNB_ID = 0xe00;
-
- cell_type = "CELL_MACRO_ENB";
-
- eNB_name = "eNB_Eurecom_LTEBox";
-
- // Tracking area code, 0x0000 and 0xfffe are reserved values
- tracking_area_code = 1;
- plmn_list = ( { mcc = 208; mnc = 95; mnc_length = 2; } );
-
- ////////// Physical parameters:
-
- component_carriers = (
- {
- frame_type = "FDD";
- tdd_config = 3;
- tdd_config_s = 0;
- prefix_type = "NORMAL";
- eutra_band = 7;
- downlink_frequency = 2660000000L;
- uplink_frequency_offset = -120000000;
- Nid_cell = 0;
- N_RB_DL = 25;
- Nid_cell_mbsfn = 0;
- nb_antennas_tx = 1;
- nb_antennas_rx = 1;
- tx_gain = 90;
- rx_gain = 120;
- prach_root = 0;
- prach_config_index = 0;
- prach_high_speed = "DISABLE";
- prach_zero_correlation = 1;
- prach_freq_offset = 2;
- pucch_delta_shift = 1;
- pucch_nRB_CQI = 1;
- pucch_nCS_AN = 0;
- pucch_n1_AN = 0;
- pdsch_referenceSignalPower = -26;
- pdsch_p_b = 0;
- pusch_n_SB = 1;
- pusch_enable64QAM = "DISABLE";
- pusch_hoppingMode = "interSubFrame";
- pusch_hoppingOffset = 0;
- pusch_groupHoppingEnabled = "ENABLE";
- pusch_groupAssignment = 0;
- pusch_sequenceHoppingEnabled = "DISABLE";
- pusch_nDMRS1 = 1;
- phich_duration = "NORMAL";
- phich_resource = "ONESIXTH";
- srs_enable = "DISABLE";
- /* srs_BandwidthConfig =;
- srs_SubframeConfig =;
- srs_ackNackST =;
- srs_MaxUpPts =;*/
-
- pusch_p0_Nominal = -90;
- pusch_alpha = "AL1";
- pucch_p0_Nominal = -108;
- msg3_delta_Preamble = 6;
- pucch_deltaF_Format1 = "deltaF2";
- pucch_deltaF_Format1b = "deltaF3";
- pucch_deltaF_Format2 = "deltaF0";
- pucch_deltaF_Format2a = "deltaF0";
- pucch_deltaF_Format2b = "deltaF0";
-
- rach_numberOfRA_Preambles = 64;
- rach_preamblesGroupAConfig = "DISABLE";
- /*
- rach_sizeOfRA_PreamblesGroupA = ;
- rach_messageSizeGroupA = ;
- rach_messagePowerOffsetGroupB = ;
- */
- rach_powerRampingStep = 4;
- rach_preambleInitialReceivedTargetPower = -108;
- rach_preambleTransMax = 10;
- rach_raResponseWindowSize = 10;
- rach_macContentionResolutionTimer = 48;
- rach_maxHARQ_Msg3Tx = 4;
-
- pcch_default_PagingCycle = 128;
- pcch_nB = "oneT";
- bcch_modificationPeriodCoeff = 2;
- ue_TimersAndConstants_t300 = 1000;
- ue_TimersAndConstants_t301 = 1000;
- ue_TimersAndConstants_t310 = 1000;
- ue_TimersAndConstants_t311 = 10000;
- ue_TimersAndConstants_n310 = 20;
- ue_TimersAndConstants_n311 = 1;
- }
- );
-
- srb1_parameters :
- {
- # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
- timer_poll_retransmit = 80;
-
- # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
- timer_reordering = 35;
-
- # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
- timer_status_prohibit = 0;
-
- # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
- poll_pdu = 4;
-
- # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
- poll_byte = 99999;
-
- # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
- max_retx_threshold = 4;
- }
-
- # ------- SCTP definitions
- SCTP :
- {
- # Number of streams to use in input/output
- SCTP_INSTREAMS = 2;
- SCTP_OUTSTREAMS = 2;
- };
-
-
- ////////// MME parameters:
- mme_ip_address = ( { ipv4 = "192.188.2.2";
- ipv6 = "192:168:30::17";
- active = "yes";
- preference = "ipv4";
- }
- );
-
- NETWORK_INTERFACES :
- {
- ENB_INTERFACE_NAME_FOR_S1_MME = "tun2";
- ENB_IPV4_ADDRESS_FOR_S1_MME = "192.188.2.2/24";
-
- ENB_INTERFACE_NAME_FOR_S1U = "lo";
- ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.1/24";
- ENB_PORT_FOR_S1U = 2153; # Spec 2152
- };
-
- log_config :
- {
- global_log_level ="info";
- hw_log_level ="info";
- phy_log_level ="info";
- mac_log_level ="info";
- rlc_log_level ="info";
- pdcp_log_level ="info";
- rrc_log_level ="info";
- gtpu_log_level ="info";
- udp_log_level ="info";
- };
-
- }
-);
diff --git a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb1.conf b/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb1.conf
deleted file mode 100644
index 9ffed9c5fe..0000000000
--- a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb1.conf
+++ /dev/null
@@ -1,159 +0,0 @@
-Active_eNBs = ( "eNB_Eurecom_LTEBox");
-# Asn1_verbosity, choice in: none, info, annoying
-Asn1_verbosity = "none";
-
-eNBs =
-(
- {
- ////////// Identification parameters:
- eNB_ID = 0xe00;
-
- cell_type = "CELL_MACRO_ENB";
-
- eNB_name = "eNB_Eurecom_LTEBox";
-
- // Tracking area code, 0x0000 and 0xfffe are reserved values
- tracking_area_code = 1;
- plmn_list = ( { mcc = 208; mnc = 95; mnc_length = 2; } );
-
- ////////// Physical parameters:
-
- component_carriers = (
- {
- frame_type = "FDD";
- tdd_config = 3;
- tdd_config_s = 0;
- prefix_type = "NORMAL";
- eutra_band = 7;
- downlink_frequency = 2660000000L;
- uplink_frequency_offset = -120000000;
- Nid_cell = 0;
- N_RB_DL = 25;
- Nid_cell_mbsfn = 0;
- nb_antennas_tx = 1;
- nb_antennas_rx = 1;
- tx_gain = 90;
- rx_gain = 120;
- prach_root = 0;
- prach_config_index = 0;
- prach_high_speed = "DISABLE";
- prach_zero_correlation = 1;
- prach_freq_offset = 2;
- pucch_delta_shift = 1;
- pucch_nRB_CQI = 1;
- pucch_nCS_AN = 0;
- pucch_n1_AN = 0;
- pdsch_referenceSignalPower = -26;
- pdsch_p_b = 0;
- pusch_n_SB = 1;
- pusch_enable64QAM = "DISABLE";
- pusch_hoppingMode = "interSubFrame";
- pusch_hoppingOffset = 0;
- pusch_groupHoppingEnabled = "ENABLE";
- pusch_groupAssignment = 0;
- pusch_sequenceHoppingEnabled = "DISABLE";
- pusch_nDMRS1 = 1;
- phich_duration = "NORMAL";
- phich_resource = "ONESIXTH";
- srs_enable = "DISABLE";
- /* srs_BandwidthConfig =;
- srs_SubframeConfig =;
- srs_ackNackST =;
- srs_MaxUpPts =;*/
-
- pusch_p0_Nominal = -90;
- pusch_alpha = "AL1";
- pucch_p0_Nominal = -108;
- msg3_delta_Preamble = 6;
- pucch_deltaF_Format1 = "deltaF2";
- pucch_deltaF_Format1b = "deltaF3";
- pucch_deltaF_Format2 = "deltaF0";
- pucch_deltaF_Format2a = "deltaF0";
- pucch_deltaF_Format2b = "deltaF0";
-
- rach_numberOfRA_Preambles = 64;
- rach_preamblesGroupAConfig = "DISABLE";
- /*
- rach_sizeOfRA_PreamblesGroupA = ;
- rach_messageSizeGroupA = ;
- rach_messagePowerOffsetGroupB = ;
- */
- rach_powerRampingStep = 4;
- rach_preambleInitialReceivedTargetPower = -108;
- rach_preambleTransMax = 10;
- rach_raResponseWindowSize = 10;
- rach_macContentionResolutionTimer = 48;
- rach_maxHARQ_Msg3Tx = 4;
-
- pcch_default_PagingCycle = 128;
- pcch_nB = "oneT";
- bcch_modificationPeriodCoeff = 2;
- ue_TimersAndConstants_t300 = 1000;
- ue_TimersAndConstants_t301 = 1000;
- ue_TimersAndConstants_t310 = 1000;
- ue_TimersAndConstants_t311 = 10000;
- ue_TimersAndConstants_n310 = 20;
- ue_TimersAndConstants_n311 = 1;
- }
- );
-
-
- srb1_parameters :
- {
- # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
- timer_poll_retransmit = 80;
-
- # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
- timer_reordering = 35;
-
- # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
- timer_status_prohibit = 0;
-
- # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
- poll_pdu = 4;
-
- # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
- poll_byte = 99999;
-
- # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
- max_retx_threshold = 4;
- }
-
- # ------- SCTP definitions
- SCTP :
- {
- # Number of streams to use in input/output
- SCTP_INSTREAMS = 2;
- SCTP_OUTSTREAMS = 2;
- };
-
- ////////// MME parameters:
- mme_ip_address = ( { ipv4 = "192.168.12.17";
- ipv6 = "192:168:30::17";
- active = "yes";
- preference = "ipv4";
- }
- );
-
- NETWORK_INTERFACES :
- {
- ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
- ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.213/24";
-
- ENB_INTERFACE_NAME_FOR_S1U = "eth0";
- ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.213/24";
- ENB_PORT_FOR_S1U = 2152; # Spec 2152
- };
-
- log_config :
- {
- global_log_level ="debug";
- hw_log_level ="info";
- phy_log_level ="info";
- rlc_log_level ="info";
- pdcp_log_level ="info";
- rrc_log_level ="info";
- };
-
- }
-);
diff --git a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/trace.pdml b/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/trace.pdml
deleted file mode 100644
index d2d2598de6..0000000000
--- a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/trace.pdml
+++ /dev/null
@@ -1,4411 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.c b/openair3/TEST/EPC_TEST/generate_scenario.c
deleted file mode 100644
index a8a3590945..0000000000
--- a/openair3/TEST/EPC_TEST/generate_scenario.c
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- * 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
- */
-
-/*
- generate_scenario.c
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "assertions.h"
-#include "generate_scenario.h"
-#include "s1ap_eNB.h"
-#include "intertask_interface.h"
-
-#define ENB_CONFIG_STRING_ACTIVE_ENBS "Active_eNBs"
-
-#define ENB_CONFIG_STRING_ENB_LIST "eNBs"
-#define ENB_CONFIG_STRING_ENB_ID "eNB_ID"
-#define ENB_CONFIG_STRING_CELL_TYPE "cell_type"
-#define ENB_CONFIG_STRING_ENB_NAME "eNB_name"
-
-#define ENB_CONFIG_STRING_TRACKING_AREA_CODE "tracking_area_code"
-#define ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE "mobile_country_code"
-#define ENB_CONFIG_STRING_MOBILE_NETWORK_CODE "mobile_network_code"
-
-
-#define ENB_CONFIG_STRING_MME_IP_ADDRESS "mme_ip_address"
-#define ENB_CONFIG_STRING_MME_IPV4_ADDRESS "ipv4"
-#define ENB_CONFIG_STRING_MME_IPV6_ADDRESS "ipv6"
-#define ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE "active"
-#define ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE "preference"
-
-#define ENB_CONFIG_STRING_SCTP_CONFIG "SCTP"
-#define ENB_CONFIG_STRING_SCTP_INSTREAMS "SCTP_INSTREAMS"
-#define ENB_CONFIG_STRING_SCTP_OUTSTREAMS "SCTP_OUTSTREAMS"
-
-#define ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG "NETWORK_INTERFACES"
-#define ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1_MME "ENB_INTERFACE_NAME_FOR_S1_MME"
-#define ENB_CONFIG_STRING_ENB_IPV4_ADDRESS_FOR_S1_MME "ENB_IPV4_ADDRESS_FOR_S1_MME"
-#define ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1U "ENB_INTERFACE_NAME_FOR_S1U"
-#define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U"
-#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
-
-
-#define ENB_CONFIG_MAX_XSLT_PARAMS 32
-
-Enb_properties_array_t g_enb_properties;
-char *g_test_dir = NULL;
-char *g_pdml_in_origin = NULL;
-extern int xmlLoadExtDtdDefaultValue;
-
-#define GENERATE_PDML_FILE 1
-#define GENERATE_SCENARIO 2
-
-#define GS_IS_FILE 1
-#define GS_IS_DIR 2
-
-//------------------------------------------------------------------------------
-// test if file exist in current directory
-int is_file_exists( const char const * file_nameP, const char const *file_roleP)
-{
- struct stat s;
- int err = stat(file_nameP, &s);
- if(-1 == err) {
- if(ENOENT == errno) {
- fprintf(stderr, "Please provide a valid %s, %s does not exist\n", file_roleP, file_nameP);
- } else {
- perror("stat");
- exit(1);
- }
- } else {
- if(S_ISREG(s.st_mode)) {
- return GS_IS_FILE;
- } else if(S_ISDIR(s.st_mode)) {
- return GS_IS_DIR;
- } else {
- fprintf(stderr, "Please provide a valid test %s, %s exists but is not found valid\n", file_roleP, file_nameP);
- }
- }
- return 0;
-}
-
-
-//------------------------------------------------------------------------------
-int strip_extension(char *in_filename)
-{
- static const uint8_t name_min_len = 1;
- static const uint8_t max_ext_len = 5; // .pdml !
- fprintf(stdout, "strip_extension %s\n", in_filename);
-
- if (NULL != in_filename) {
- /* Check chars starting at end of string to find last '.' */
- for (ssize_t i = strlen(in_filename); i >= name_min_len; i--) {
- if (in_filename[i] == '.') {
- in_filename[i] = '\0';
- return i;
- }
- }
- }
- return -1;
-}
-//------------------------------------------------------------------------------
-// return number of splitted items
-int split_path( char * pathP, char *** resP)
-{
- char * saveptr1;
- char * p = strtok_r (pathP, "/", &saveptr1);
- int n_spaces = 0;
-
- /// split string and append tokens to 'res'
- while (p) {
- *resP = realloc (*resP, sizeof (char*) * ++n_spaces);
- AssertFatal (*resP, "realloc failed");
- (*resP)[n_spaces-1] = p;
- p = strtok_r (NULL, "/", &saveptr1);
- }
- return n_spaces;
-}
-
-//------------------------------------------------------------------------------
-int generate_test_scenario(const char const * test_nameP, const char const * pdml_in_basenameP)
-//------------------------------------------------------------------------------
-{
- //int fd_pdml_in;
- xsltStylesheetPtr cur = NULL;
- xmlDocPtr doc, res;
- FILE *test_scenario_file = NULL;
- const char test_scenario_filename[NAME_MAX];
- const char *params[2*ENB_CONFIG_MAX_XSLT_PARAMS];
- int nb_params = 0;
- int i,j;
- char astring[1024];
- char *astring2 = NULL;
- struct in_addr addr;
-
- memset(test_scenario_filename, 0, sizeof(test_scenario_filename));
- memset(astring, 0, sizeof(astring));
- if (getcwd(astring, sizeof(astring)) != NULL) {
- fprintf(stdout, "working in %s directory\n", astring);
- } else {
- perror("getcwd() error");
- exit(1);
- }
-
- xmlSubstituteEntitiesDefault(1);
- xmlLoadExtDtdDefaultValue = 1;
- cur = xsltParseStylesheetFile("/usr/share/oai/xsl/generic_scenario.xsl");
- if (NULL == cur) {
- AssertFatal (0, "Could not parse stylesheet file /usr/share/oai/xsl/generic_scenario.xsl!\n");
- } else {
- fprintf(stdout, "XSLT style sheet: /usr/share/oai/xsl/generic_scenario.xsl\n");
- }
-
- doc = xmlParseFile(pdml_in_basenameP);
- if (NULL == doc) {
- AssertFatal (0, "Could not parse pdml file %s!\n", pdml_in_basenameP);
- } else {
- fprintf(stdout, "pdml file: %s\n", pdml_in_basenameP);
- }
- params[nb_params++] = "test_name";
- sprintf(astring, "%s", pdml_in_basenameP);
- if (strip_extension(astring) > 0) {
- astring2 = strdup(astring);
- sprintf(astring, "\"%s\"", astring2);
- free(astring2);
- astring2 = NULL;
- } else {
- fprintf(stderr, "Assigning test name failed: %s\n", astring);
- }
- params[nb_params++] = strdup(astring);
-
- for (i = 0; i < g_enb_properties.number; i++) {
- // eNB S1-C IPv4 address
- sprintf(astring, "enb%d_s1c", i);
- params[nb_params++] = strdup(astring);
- addr.s_addr = g_enb_properties.properties[i]->enb_ipv4_address_for_S1_MME;
- sprintf(astring, "\"%s\"", inet_ntoa(addr));
- params[nb_params++] = strdup(astring);
-
- // MME S1-C IPv4 address
- for (j = 0; j < g_enb_properties.properties[i]->nb_mme; j++) {
- sprintf(astring, "mme%d_s1c_%d", i, j);
- params[nb_params++] = strdup(astring);
- AssertFatal (g_enb_properties.properties[i]->mme_ip_address[j].ipv4_address,
- "Only support MME IPv4 address\n");
- sprintf(astring, "\"%s\"", g_enb_properties.properties[i]->mme_ip_address[j].ipv4_address);
- params[nb_params++] = strdup(astring);
- }
- }
- params[nb_params] = NULL;
- res = xsltApplyStylesheet(cur, doc, params);
- if (NULL != res) {
- // since pdml filename is not relative (no path), just filename in current directory we can safely remove
- sprintf(test_scenario_filename,"%s",pdml_in_basenameP);
- if (strip_extension(test_scenario_filename) > 0) {
- strcat(test_scenario_filename, ".xml");
- test_scenario_file = fopen( test_scenario_filename, "w+");
- if (NULL != test_scenario_file) {
- xsltSaveResultToFile(test_scenario_file, res, cur);
- fclose(test_scenario_file);
- fprintf(stdout, "Wrote test scenario to %s\n", test_scenario_filename);
- } else {
- fprintf(stderr, "Error in fopen(%s)\n", test_scenario_filename);
- }
- } else {
- fprintf(stderr, "Error in strip_extension()\n");
- }
- } else {
- fprintf(stderr, "Error in xsltApplyStylesheet()\n");
- }
- xsltFreeStylesheet(cur);
- xmlFreeDoc(res);
- xmlFreeDoc(doc);
-
- xsltCleanupGlobals();
- xmlCleanupParser();
-}
-
-//------------------------------------------------------------------------------
-static void enb_config_display(void)
-//------------------------------------------------------------------------------
-{
- int i;
-
- printf( "\n----------------------------------------------------------------------\n");
- printf( " ENB CONFIG FILE CONTENT LOADED:\n");
- printf( "----------------------------------------------------------------------\n");
- for (i = 0; i < g_enb_properties.number; i++) {
- printf( "ENB CONFIG for instance %d:\n\n", i);
- printf( "\teNB name: \t%s\n",g_enb_properties.properties[i]->eNB_name);
- printf( "\teNB ID: \t%"PRIu32"\n",g_enb_properties.properties[i]->eNB_id);
- printf( "\tCell type: \t%s\n",g_enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
- printf( "\tTAC: \t%"PRIu16"\n",g_enb_properties.properties[i]->tac);
- printf( "\tMCC: \t%"PRIu16"\n",g_enb_properties.properties[i]->mcc);
-
- if (g_enb_properties.properties[i]->mnc_digit_length == 3) {
- printf( "\tMNC: \t%03"PRIu16"\n",g_enb_properties.properties[i]->mnc);
- } else {
- printf( "\tMNC: \t%02"PRIu16"\n",g_enb_properties.properties[i]->mnc);
- }
- printf( "\n--------------------------------------------------------\n");
- }
-}
-
-
-#ifdef LIBCONFIG_LONG
-#define libconfig_int long
-#else
-#define libconfig_int int
-#endif
-//------------------------------------------------------------------------------
-void enb_config_init(const char const * lib_config_file_name_pP)
-//------------------------------------------------------------------------------
-{
- config_t cfg;
- config_setting_t *setting = NULL;
- config_setting_t *subsetting = NULL;
- config_setting_t *setting_mme_addresses = NULL;
- config_setting_t *setting_mme_address = NULL;
- config_setting_t *setting_enb = NULL;
- int num_enb_properties = 0;
- int enb_properties_index = 0;
- int num_enbs = 0;
- int num_mme_address = 0;
- int i = 0;
- int j = 0;
- int parse_errors = 0;
- libconfig_int enb_id = 0;
- const char* cell_type = NULL;
- const char* tac = 0;
- const char* enb_name = NULL;
- const char* mcc = 0;
- const char* mnc = 0;
- char* ipv4 = NULL;
- char* ipv6 = NULL;
- char* active = NULL;
- char* preference = NULL;
- const char* active_enb[EPC_TEST_SCENARIO_MAX_ENB];
- char* enb_interface_name_for_S1U = NULL;
- char* enb_ipv4_address_for_S1U = NULL;
- libconfig_int enb_port_for_S1U = 0;
- char* enb_interface_name_for_S1_MME = NULL;
- char* enb_ipv4_address_for_S1_MME = NULL;
- char *address = NULL;
- char *cidr = NULL;
-
-
- AssertFatal (lib_config_file_name_pP != NULL,
- "Bad parameter lib_config_file_name_pP %s , must reference a valid eNB config file\n",
- lib_config_file_name_pP);
-
- memset((char*)active_enb, 0 , EPC_TEST_SCENARIO_MAX_ENB * sizeof(char*));
-
- config_init(&cfg);
-
- /* Read the file. If there is an error, report it and exit. */
- if (! config_read_file(&cfg, lib_config_file_name_pP)) {
- config_destroy(&cfg);
- AssertFatal (0, "Failed to parse eNB configuration file %s!\n", lib_config_file_name_pP);
- }
-
- // Get list of active eNBs, (only these will be configured)
- setting = config_lookup(&cfg, ENB_CONFIG_STRING_ACTIVE_ENBS);
-
- if (setting != NULL) {
- num_enbs = config_setting_length(setting);
-
- for (i = 0; i < num_enbs; i++) {
- setting_enb = config_setting_get_elem(setting, i);
- active_enb[i] = config_setting_get_string (setting_enb);
- AssertFatal (active_enb[i] != NULL,
- "Failed to parse config file %s, %dth attribute %s \n",
- lib_config_file_name_pP, i, ENB_CONFIG_STRING_ACTIVE_ENBS);
- active_enb[i] = strdup(active_enb[i]);
- num_enb_properties += 1;
- }
- }
-
- /* Output a list of all eNBs. */
- setting = config_lookup(&cfg, ENB_CONFIG_STRING_ENB_LIST);
-
- if (setting != NULL) {
- enb_properties_index = g_enb_properties.number;
- parse_errors = 0;
- num_enbs = config_setting_length(setting);
-
- for (i = 0; i < num_enbs; i++) {
- setting_enb = config_setting_get_elem(setting, i);
-
- if (! config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_ENB_ID, &enb_id)) {
- /* Calculate a default eNB ID */
-# if defined(ENABLE_USE_MME)
- uint32_t hash;
-
- hash = s1ap_generate_eNB_id ();
- enb_id = i + (hash & 0xFFFF8);
-# else
- enb_id = i;
-# endif
- }
-
- if ( !( config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_CELL_TYPE, &cell_type)
- && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_ENB_NAME, &enb_name)
- && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_TRACKING_AREA_CODE, &tac)
- && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE, &mcc)
- && config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_MOBILE_NETWORK_CODE, &mnc)
-
-
- )
- ) {
- AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, %d th enb\n",
- lib_config_file_name_pP, i);
- continue; // FIXME this prevents segfaults below, not sure what happens after function exit
- }
-
- // search if in active list
- for (j=0; j < num_enb_properties; j++) {
- if (strcmp(active_enb[j], enb_name) == 0) {
- g_enb_properties.properties[enb_properties_index] = calloc(1, sizeof(Enb_properties_t));
-
- g_enb_properties.properties[enb_properties_index]->eNB_id = enb_id;
-
- if (strcmp(cell_type, "CELL_MACRO_ENB") == 0) {
- g_enb_properties.properties[enb_properties_index]->cell_type = CELL_MACRO_ENB;
- } else if (strcmp(cell_type, "CELL_HOME_ENB") == 0) {
- g_enb_properties.properties[enb_properties_index]->cell_type = CELL_HOME_ENB;
- } else {
- AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for cell_type choice: CELL_MACRO_ENB or CELL_HOME_ENB !\n",
- lib_config_file_name_pP, i, cell_type);
- }
-
- g_enb_properties.properties[enb_properties_index]->eNB_name = strdup(enb_name);
- g_enb_properties.properties[enb_properties_index]->tac = (uint16_t)atoi(tac);
- g_enb_properties.properties[enb_properties_index]->mcc = (uint16_t)atoi(mcc);
- g_enb_properties.properties[enb_properties_index]->mnc = (uint16_t)atoi(mnc);
- g_enb_properties.properties[enb_properties_index]->mnc_digit_length = strlen(mnc);
- AssertFatal((g_enb_properties.properties[enb_properties_index]->mnc_digit_length == 2) ||
- (g_enb_properties.properties[enb_properties_index]->mnc_digit_length == 3),
- "BAD MNC DIGIT LENGTH %d",
- g_enb_properties.properties[i]->mnc_digit_length);
-
-
- setting_mme_addresses = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_MME_IP_ADDRESS);
- num_mme_address = config_setting_length(setting_mme_addresses);
- g_enb_properties.properties[enb_properties_index]->nb_mme = 0;
-
- for (j = 0; j < num_mme_address; j++) {
- setting_mme_address = config_setting_get_elem(setting_mme_addresses, j);
-
- if ( !(
- config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IPV4_ADDRESS, (const char **)&ipv4)
- && config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IPV6_ADDRESS, (const char **)&ipv6)
- && config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IP_ADDRESS_ACTIVE, (const char **)&active)
- && config_setting_lookup_string(setting_mme_address, ENB_CONFIG_STRING_MME_IP_ADDRESS_PREFERENCE, (const char **)&preference)
- )
- ) {
- AssertError (0, parse_errors ++,
- "Failed to parse eNB configuration file %s, %d th enb %d th mme address !\n",
- lib_config_file_name_pP, i, j);
- continue; // FIXME will prevent segfaults below, not sure what happens at function exit...
- }
-
- g_enb_properties.properties[enb_properties_index]->nb_mme += 1;
-
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv4_address = strdup(ipv4);
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6_address = strdup(ipv6);
-
- if (strcmp(active, "yes") == 0) {
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].active = 1;
- } // else { (calloc)
-
- if (strcmp(preference, "ipv4") == 0) {
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv4 = 1;
- } else if (strcmp(preference, "ipv6") == 0) {
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6 = 1;
- } else if (strcmp(preference, "no") == 0) {
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv4 = 1;
- g_enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6 = 1;
- }
- }
-
-
- // NETWORK_INTERFACES
- subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
-
- if (subsetting != NULL) {
- if ( (
- config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1_MME,
- (const char **)&enb_interface_name_for_S1_MME)
- && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_IPV4_ADDRESS_FOR_S1_MME,
- (const char **)&enb_ipv4_address_for_S1_MME)
- && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_INTERFACE_NAME_FOR_S1U,
- (const char **)&enb_interface_name_for_S1U)
- && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U,
- (const char **)&enb_ipv4_address_for_S1U)
- && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_PORT_FOR_S1U,
- &enb_port_for_S1U)
- )
- ) {
- g_enb_properties.properties[enb_properties_index]->enb_interface_name_for_S1U = strdup(enb_interface_name_for_S1U);
- cidr = enb_ipv4_address_for_S1U;
- address = strtok(cidr, "/");
-
- if (address) {
- IPV4_STR_ADDR_TO_INT_NWBO ( address, g_enb_properties.properties[enb_properties_index]->enb_ipv4_address_for_S1U, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" );
- }
-
- g_enb_properties.properties[enb_properties_index]->enb_port_for_S1U = enb_port_for_S1U;
-
- g_enb_properties.properties[enb_properties_index]->enb_interface_name_for_S1_MME = strdup(enb_interface_name_for_S1_MME);
- cidr = enb_ipv4_address_for_S1_MME;
- address = strtok(cidr, "/");
-
- if (address) {
- IPV4_STR_ADDR_TO_INT_NWBO ( address, g_enb_properties.properties[enb_properties_index]->enb_ipv4_address_for_S1_MME, "BAD IP ADDRESS FORMAT FOR eNB S1_MME !\n" );
- }
- }
- } // if (subsetting != NULL) {
- enb_properties_index += 1;
- } // if (strcmp(active_enb[j], enb_name) == 0)
- } // for (j=0; j < num_enb_properties; j++)
- } // for (i = 0; i < num_enbs; i++)
- } // if (setting != NULL) {
-
- g_enb_properties.number += num_enb_properties;
-
-
- AssertFatal (parse_errors == 0,
- "Failed to parse eNB configuration file %s, found %d error%s !\n",
- lib_config_file_name_pP, parse_errors, parse_errors > 1 ? "s" : "");
-}
-
-
-//------------------------------------------------------------------------------
-static void usage (
- int argc,
- char *argv[])
-//------------------------------------------------------------------------------
-{
- fprintf (stdout, "Please report any bug to: %s\n",PACKAGE_BUGREPORT);
- fprintf (stdout, "Usage: %s [options]\n\n", argv[0]);
- fprintf (stdout, "\n");
- fprintf (stdout, "Mandatory options:\n");
- fprintf (stdout, "\t-c | --enb-conf-file Provide the old eNB config file for generating a copy of the original test\n");
- fprintf (stdout, "\t-d | --test-dir Directory where a set of files related to a particular test are located\n");
- fprintf (stdout, "\t-p | --pdml File name (with no path) in 'test-dir' directory of an original scenario that has to be reworked (IP addresses) with new testbed\n");
- fprintf (stdout, "\n");
- fprintf (stdout, "Other options:\n");
- fprintf (stdout, "\t-h | --help Print this help and return\n");
- fprintf (stdout, "\t-v | --version Print informations about the version of this executable\n");
- fprintf (stdout, "\n");
- fprintf (stdout, "Example of generate_scenario use case: \n");
- fprintf (stdout, "\n");
- fprintf (stdout, " Generate a generix xml scenario from a captured pcap file: \n");
- fprintf (stdout, " +---------------------+ \n");
- fprintf (stdout, " |captured pcap-ng file| \n");
- fprintf (stdout, " +----------+----------+ \n");
- fprintf (stdout, " |\n");
- fprintf (stdout, " mme_test_s1_pcap2pdml --pcap_file <`captured pcap-ng file`>\n");
- fprintf (stdout, " |\n");
- fprintf (stdout, " +--------V----------+ +--------------------+\n");
- fprintf (stdout, " |'pdml-in-orig' file| |'enb-conf-file' file|\n");
- fprintf (stdout, " +--------+----------+ +--------------------+\n");
- fprintf (stdout, " | |\n");
- fprintf (stdout, " +----------------------------+\n");
- fprintf (stdout, " |\n");
- fprintf (stdout, " generate_scenario -d -p <'pdml-in-orig' file> -c <'enb-conf-file' file> \n");
- fprintf (stdout, " |\n");
- fprintf (stdout, " +------------V--------------+\n");
- fprintf (stdout, " +'xml-test-scenario' file |\n");
- fprintf (stdout, " +---------------------------+\n");
- fprintf (stdout, "\n");
-}
-
-//------------------------------------------------------------------------------
-int
-config_parse_opt_line (
- int argc,
- char *argv[])
-//------------------------------------------------------------------------------
-{
- int option;
- int rv = 0;
- char *enb_config_file_name = NULL;
- char *pdml_in_file_name = NULL;
- char *test_dir_name = NULL;
-
- enum long_option_e {
- LONG_OPTION_START = 0x100, /* Start after regular single char options */
- LONG_OPTION_ENB_CONF_FILE,
- LONG_OPTION_PDML,
- LONG_OPTION_TEST_DIR,
- LONG_OPTION_HELP,
- LONG_OPTION_VERSION,
- };
-
- static struct option long_options[] = {
- {"enb-conf-file", required_argument, 0, LONG_OPTION_ENB_CONF_FILE},
- {"pdml ", required_argument, 0, LONG_OPTION_PDML},
- {"test-dir", required_argument, 0, LONG_OPTION_TEST_DIR},
- {"help", no_argument, 0, LONG_OPTION_HELP},
- {"version", no_argument, 0, LONG_OPTION_VERSION},
- {NULL, 0, NULL, 0}
- };
-
- /*
- * Parsing command line
- */
- while ((option = getopt_long (argc, argv, "vhp:n:c:s:d:", long_options, NULL)) != -1) {
- switch (option) {
- case LONG_OPTION_ENB_CONF_FILE:
- case 'c':
- if (optarg) {
- enb_config_file_name = optarg;
- printf("eNB config file name is %s\n", enb_config_file_name);
- rv |= GENERATE_SCENARIO;
- }
- break;
-
- case LONG_OPTION_PDML:
- case 'p':
- if (optarg) {
- pdml_in_file_name = strdup(optarg);
- printf("PDML input file name is %s\n", pdml_in_file_name);
- rv |= GENERATE_SCENARIO;
- }
- break;
-
- case LONG_OPTION_TEST_DIR:
- case 'd':
- if (optarg) {
- test_dir_name = strdup(optarg);
- if (is_file_exists(test_dir_name, "test dirname") != GS_IS_DIR) {
- fprintf(stderr, "Please provide a valid test dirname, %s is not a valid directory name\n", test_dir_name);
- exit(1);
- }
- printf("Test dir name is %s\n", test_dir_name);
- }
- break;
-
- case LONG_OPTION_VERSION:
- case 'v':
- printf("Version %s\n", PACKAGE_VERSION);
- exit (0);
- break;
-
- case LONG_OPTION_HELP:
- case 'h':
- default:
- usage (argc, argv);
- exit (0);
- }
- }
- if (NULL == test_dir_name) {
- fprintf(stderr, "Please provide a valid test dirname\n");
- exit(1);
- }
- g_test_dir = test_dir_name; test_dir_name = NULL;
- if (chdir(g_test_dir) != 0) {
- fprintf(stderr, "Error: chdir %s returned %s\n", g_test_dir, strerror(errno));
- exit(1);
- }
- if (rv & GENERATE_SCENARIO) {
- if (NULL == enb_config_file_name) {
- fprintf(stderr, "Error: please provide the original eNB config file name that should be in %s\n", g_test_dir);
- }
- if (is_file_exists(enb_config_file_name, "ENB config file") != GS_IS_FILE) {
- fprintf(stderr, "Error: eNB config file name %s is not found in dir %s\n", enb_config_file_name, g_test_dir);
- }
- enb_config_init(enb_config_file_name);
- //enb_config_display();
-
- if (NULL == pdml_in_file_name) {
- fprintf(stderr, "Error: please provide the PDML file name that should be in %s\n", g_test_dir);
- }
- if (is_file_exists(pdml_in_file_name, "PDML file") != GS_IS_FILE) {
- fprintf(stderr, "Error: PDML file name %s is not found in dir %s\n", pdml_in_file_name, g_test_dir);
- }
- g_pdml_in_origin = pdml_in_file_name; pdml_in_file_name = NULL;
- }
- return rv;
-}
-
-//------------------------------------------------------------------------------
-int main( int argc, char **argv )
-//------------------------------------------------------------------------------
-{
- int actions = 0;
-
- memset((char*) &g_enb_properties, 0 , sizeof(g_enb_properties));
-
- actions = config_parse_opt_line (argc, argv); //Command-line options
- if (actions & GENERATE_SCENARIO) {
- generate_test_scenario(g_test_dir, g_pdml_in_origin);
- }
-
- return 0;
-}
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.h b/openair3/TEST/EPC_TEST/generate_scenario.h
deleted file mode 100644
index 8deded3f52..0000000000
--- a/openair3/TEST/EPC_TEST/generate_scenario.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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
- */
-
-/*
- generate_scenario.h
- -------------------
- AUTHOR : Lionel GAUTHIER
- COMPANY : EURECOM
- EMAIL : Lionel.Gauthier@eurecom.fr
-*/
-
-#ifndef GENERATE_SCENARIO_H_
-#define GENERATE_SCENARIO_H_
-#include
-#include