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 e606513935..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): @@ -636,7 +639,7 @@ class Containerize(): mySSH.copyout(self.eNBIPAddress, self.eNBUserName, self.eNBPassword, './' + self.eNB_logFile[self.eNB_instance], self.eNBSourceCodePath + '/cmake_targets/') logging.info('\u001B[1m Undeploying OAI Object Pass\u001B[0m') - def DeployGenObject(self, HTML): + def DeployGenObject(self, HTML, RAN, UE): self.exitStatus = 0 logging.info('\u001B[1m Checking Services to deploy\u001B[0m') cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose config --services' @@ -679,12 +682,15 @@ class Containerize(): healthy = 0 while (count < 10): count += 1 + containerStatus = [] deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30) healthy = 0 for state in deployStatus.split('\n'): - res = re.search('Up \(healthy\)', state) - if res is not None: + if re.search('Up \(healthy\)', state) is not None: healthy += 1 + if re.search('rfsim4g-db-init.*Exit 0', state) is not None: + subprocess.check_output('docker rm -f rfsim4g-db-init || true', shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30) + containerStatus.append(state) if healthy == self.nb_healthy[0]: count = 100 else: @@ -694,27 +700,41 @@ class Containerize(): if self.tsharkStarted == False: logging.debug('Starting tshark on public network') self.CaptureOnDockerNetworks() - self.tsharkStarted = True HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) + for cState in containerStatus: + logging.debug(cState) logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m') else: - self.exitStatus = 1 HTML.CreateHtmlTestRow('Could not deploy in time', 'KO', CONST.ALL_PROCESSES_OK) + for cState in containerStatus: + logging.debug(cState) logging.error('\u001B[1m Deploying OAI Object(s) FAILED\u001B[0m') + HTML.testCase_id = 'AUTO-UNDEPLOY' + UE.testCase_id = 'AUTO-UNDEPLOY' + HTML.desc = 'Automatic Undeployment' + UE.desc = 'Automatic Undeployment' + UE.ShowTestID() + self.UndeployGenObject(HTML, RAN, UE) + self.exitStatus = 1 def CaptureOnDockerNetworks(self): cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml config | grep com.docker.network.bridge.name | sed -e "s@^.*name: @@"' networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - cmd = 'sudo nohup tshark -f "not tcp and not arp and not port 53 and not host archive.ubuntu.com and not host security.ubuntu.com and not port 2152"' + if re.search('4g.*rfsimulator', self.yamlPath[0]) is not None: + cmd = 'sudo nohup tshark -f "(host 192.168.61.11 and icmp) or (not host 192.168.61.11 and not host 192.168.61.30 and not arp and not port 53 and not port 2152)"' + elif re.search('5g.*rfsimulator', self.yamlPath[0]) is not None: + cmd = 'sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 and not host 192.168.71.150 and not arp and not port 53 and not port 2152 and not port 2153)"' + else: + return for name in networkNames.split('\n'): - res = re.search('rfsim', name) - if res is not None: + if re.search('rfsim', name) is not None: cmd += ' -i ' + name cmd += ' -w /tmp/capture_' ymlPath = self.yamlPath[0].split('/') cmd += ymlPath[1] + '.pcap > /tmp/tshark.log 2>&1 &' logging.debug(cmd) networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + self.tsharkStarted = True def UndeployGenObject(self, HTML, RAN, UE): self.exitStatus = 0 @@ -745,7 +765,11 @@ class Containerize(): cName = res.group('container_name') cmd = 'cd ' + self.yamlPath[0] + ' && docker logs ' + cName + ' > ' + cName + '.log 2>&1' logging.debug(cmd) - deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30) + if re.search('magma-mme', cName) is not None: + cmd = 'cd ' + self.yamlPath[0] + ' && docker cp -L ' + cName + ':/var/log/mme.log ' + cName + '-full.log' + logging.debug(cmd) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30) fullStatus = True if anyLogs: cmd = 'mkdir -p '+ logPath + ' && cp ' + self.yamlPath[0] + '/*.log ' + logPath @@ -767,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/benetel-4g.conf b/ci-scripts/conf_files/benetel-4g.conf index 9423ebe56e..e2974a171d 100644 --- a/ci-scripts/conf_files/benetel-4g.conf +++ b/ci-scripts/conf_files/benetel-4g.conf @@ -269,17 +269,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf index dc86567c1f..bfe61188b6 100644 --- a/ci-scripts/conf_files/benetel-5g.conf +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -262,18 +262,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf index e2c94b14ab..1102528cd3 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf @@ -201,15 +201,10 @@ eNBs = ( log_config = { global_log_level = "info"; - global_log_verbosity = "medium"; pdcp_log_level = "info"; - pdcp_log_verbosity = "high"; rrc_log_level = "info"; - rrc_log_verbosity = "medium"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; gtp_log_level = "info"; - gtp_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf index 5b994ed29b..ec7620a724 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf @@ -201,15 +201,10 @@ eNBs = ( log_config = { global_log_level = "info"; - global_log_verbosity = "medium"; pdcp_log_level = "info"; - pdcp_log_verbosity = "high"; rrc_log_level = "info"; - rrc_log_verbosity = "medium"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; gtp_log_level = "info"; - gtp_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf index 148c5a9903..7e64ad8039 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf @@ -201,15 +201,10 @@ eNBs = ( log_config = { global_log_level = "info"; - global_log_verbosity = "medium"; pdcp_log_level = "info"; - pdcp_log_verbosity = "high"; rrc_log_level = "info"; - rrc_log_verbosity = "medium"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; gtp_log_level = "info"; - gtp_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index a3ecffb9be..217c694055 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -96,17 +96,11 @@ RUs = ( 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"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf index 1920992d70..61d4cff51b 100644 --- a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf @@ -96,17 +96,11 @@ RUs = ( 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"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf index 5df8da05a3..4342e8f4b4 100644 --- a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf @@ -96,17 +96,11 @@ RUs = ( 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"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf index e70ca78205..122654df26 100644 --- a/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf @@ -257,18 +257,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf index 400d1a6c9d..ae572f9e05 100644 --- a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf +++ b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf @@ -385,19 +385,12 @@ eNBs = 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"; }; } ); @@ -457,17 +450,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf index bd2999b5d5..5a4be9f187 100644 --- a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf @@ -260,18 +260,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf index 19ef6d0797..7ac056b75e 100644 --- a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf @@ -404,18 +404,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf index d2e91fb872..24c35dedbf 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf @@ -264,18 +264,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf index f116c3708d..4a16a64105 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf @@ -264,18 +264,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf index 6c8d5ba6f0..bccd37abe9 100644 --- a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf @@ -264,18 +264,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf index f34878c569..0633d233ef 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -165,19 +165,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf index e2e482a7c7..4de8a3f759 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -165,19 +165,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf index bfea139e92..df902faf8b 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -165,19 +165,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf index 4e0025770b..0da4b1181a 100644 --- a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf @@ -163,19 +163,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf index 1627d21e1a..bd7e19ca60 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf @@ -256,18 +256,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf index efa1fa64b8..fdd2304ba5 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf @@ -265,18 +265,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf index 6fc8401236..5b05627700 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf @@ -263,18 +263,11 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf index 087ee37f01..44d22a8953 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf @@ -263,19 +263,12 @@ NETWORK_CONTROLLER : 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"; }; @include "channelmod_rfsimu.conf" diff --git a/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf index 64bcb4b35f..38cd90cd44 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf @@ -264,18 +264,11 @@ NETWORK_CONTROLLER : log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf index 72754165d0..c8223d0c42 100644 --- a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf @@ -258,17 +258,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf index da65aad775..609d76d720 100644 --- a/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf @@ -262,18 +262,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf index 682fb376cf..a98179197f 100644 --- a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -306,20 +306,12 @@ security = { 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/conf_files/episci/episci_nr-ue.nfapi.conf b/ci-scripts/conf_files/episci/episci_nr-ue.nfapi.conf index f5563ecc02..22ffb4cd3d 100644 --- a/ci-scripts/conf_files/episci/episci_nr-ue.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_nr-ue.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; uicc0 = { diff --git a/ci-scripts/conf_files/episci/episci_nr-ue0.nfapi.conf b/ci-scripts/conf_files/episci/episci_nr-ue0.nfapi.conf index f5563ecc02..22ffb4cd3d 100644 --- a/ci-scripts/conf_files/episci/episci_nr-ue0.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_nr-ue0.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; uicc0 = { diff --git a/ci-scripts/conf_files/episci/episci_nr-ue1.nfapi.conf b/ci-scripts/conf_files/episci/episci_nr-ue1.nfapi.conf index 5df3ccf6cc..3d1c008f23 100644 --- a/ci-scripts/conf_files/episci/episci_nr-ue1.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_nr-ue1.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; uicc0 = { diff --git a/ci-scripts/conf_files/episci/episci_nr-ue2.nfapi.conf b/ci-scripts/conf_files/episci/episci_nr-ue2.nfapi.conf index b1ce5fee8d..73c3292809 100644 --- a/ci-scripts/conf_files/episci/episci_nr-ue2.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_nr-ue2.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; uicc0 = { diff --git a/ci-scripts/conf_files/episci/episci_nr-ue3.nfapi.conf b/ci-scripts/conf_files/episci/episci_nr-ue3.nfapi.conf index aea5104f1c..1f8f7306c6 100644 --- a/ci-scripts/conf_files/episci/episci_nr-ue3.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_nr-ue3.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; uicc0 = { diff --git a/ci-scripts/conf_files/episci/episci_rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/episci/episci_rcc.band7.tm1.nfapi.conf index 4e596f81b5..81951e5219 100644 --- a/ci-scripts/conf_files/episci/episci_rcc.band7.tm1.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_rcc.band7.tm1.nfapi.conf @@ -231,17 +231,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/episci/episci_rcc.band78.tm1.106PRB.nfapi.conf b/ci-scripts/conf_files/episci/episci_rcc.band78.tm1.106PRB.nfapi.conf index b64b88ddea..9b3f205a0f 100644 --- a/ci-scripts/conf_files/episci/episci_rcc.band78.tm1.106PRB.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_rcc.band78.tm1.106PRB.nfapi.conf @@ -248,18 +248,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/episci/episci_ue.nfapi.conf b/ci-scripts/conf_files/episci/episci_ue.nfapi.conf index 0170a46655..8f7c8ee68a 100644 --- a/ci-scripts/conf_files/episci/episci_ue.nfapi.conf +++ b/ci-scripts/conf_files/episci/episci_ue.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; diff --git a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf index c0d4c6d4c9..0597e96245 100644 --- a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -307,20 +307,12 @@ security = { 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/conf_files/episci/proxy_nr-ue.nfapi.conf b/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf index 8411ed8fc6..b6c0e9b5a1 100644 --- a/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf +++ b/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; uicc0 = { diff --git a/ci-scripts/conf_files/episci/proxy_rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/episci/proxy_rcc.band7.tm1.nfapi.conf index d4c72d6c14..50ece56b23 100644 --- a/ci-scripts/conf_files/episci/proxy_rcc.band7.tm1.nfapi.conf +++ b/ci-scripts/conf_files/episci/proxy_rcc.band7.tm1.nfapi.conf @@ -231,17 +231,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/episci/proxy_rcc.band78.tm1.106PRB.nfapi.conf b/ci-scripts/conf_files/episci/proxy_rcc.band78.tm1.106PRB.nfapi.conf index 0ef317d63e..3410104199 100644 --- a/ci-scripts/conf_files/episci/proxy_rcc.band78.tm1.106PRB.nfapi.conf +++ b/ci-scripts/conf_files/episci/proxy_rcc.band78.tm1.106PRB.nfapi.conf @@ -288,18 +288,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/episci/proxy_ue.nfapi.conf b/ci-scripts/conf_files/episci/proxy_ue.nfapi.conf index 3f227d573c..51c30fb42d 100644 --- a/ci-scripts/conf_files/episci/proxy_ue.nfapi.conf +++ b/ci-scripts/conf_files/episci/proxy_ue.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index d3cfbfc973..1e84e479bc 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -254,22 +254,13 @@ security = { 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 ="debug"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; ngap_log_level ="debug"; - ngap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index 64f2dd5d0e..95fa75bc1d 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -273,22 +273,13 @@ serveraddr = "server"; 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; ngap_log_level ="debug"; - ngap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf index e3bdde8469..082cc826f3 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf @@ -291,19 +291,11 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 3955b1542e..6af8a23407 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -287,19 +287,11 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf index dd9c210c0d..e8c6cab1b4 100644 --- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -266,18 +266,11 @@ security = { 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"; }; diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf index 13838a178a..7d3409d4d4 100644 --- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -245,18 +245,11 @@ security = { 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"; }; diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf index adb79ceb8d..e798e40d64 100644 --- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf @@ -266,18 +266,11 @@ security = { 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"; }; diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf index 72ead42784..b92c7df92d 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf @@ -294,19 +294,11 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index 32a40fe951..6c778a7c31 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -298,19 +298,11 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index 3579d1e3c2..5c826ca862 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -293,19 +293,11 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 9cc8f554e8..d21cf90cd9 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -255,18 +255,11 @@ security = { 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"; }; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index 249b7e4527..55cb7b36c4 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -263,19 +263,12 @@ security = { 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"; }; uicc: { diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf index f232106d56..7c4bb9cc59 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -265,19 +265,12 @@ security = { 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"; }; uicc: { diff --git a/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf index 21bdb4e9d2..7f5a9d4343 100644 --- a/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -280,20 +280,12 @@ security = { 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/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/conf_files/lte-fdd-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-basic-sim.conf index a4d8e007dc..6c81d512a6 100644 --- a/ci-scripts/conf_files/lte-fdd-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-basic-sim.conf @@ -257,17 +257,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf index 458ab7cf89..c2f6ab9d6c 100644 --- a/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf @@ -406,19 +406,12 @@ NETWORK_CONTROLLER : 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"; }; //rfsimulator : diff --git a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf index e80ff2b9cb..9c74d2e328 100644 --- a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf @@ -406,19 +406,12 @@ NETWORK_CONTROLLER : 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"; }; //rfsimulator : diff --git a/ci-scripts/conf_files/lte-tdd-basic-sim.conf b/ci-scripts/conf_files/lte-tdd-basic-sim.conf index f443a907f2..ddfdddda83 100644 --- a/ci-scripts/conf_files/lte-tdd-basic-sim.conf +++ b/ci-scripts/conf_files/lte-tdd-basic-sim.conf @@ -165,19 +165,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/nr-ue.nfapi.conf b/ci-scripts/conf_files/nr-ue.nfapi.conf index b12e0c8d05..90798702cf 100644 --- a/ci-scripts/conf_files/nr-ue.nfapi.conf +++ b/ci-scripts/conf_files/nr-ue.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; diff --git a/ci-scripts/conf_files/rcc.band38.tm1.50PRB.multi.rru.conf b/ci-scripts/conf_files/rcc.band38.tm1.50PRB.multi.rru.conf index 502e3c548a..6651f380e4 100644 --- a/ci-scripts/conf_files/rcc.band38.tm1.50PRB.multi.rru.conf +++ b/ci-scripts/conf_files/rcc.band38.tm1.50PRB.multi.rru.conf @@ -227,17 +227,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf index d01e4e1c4e..47bcc35cb3 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -168,19 +168,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf index 7f6bff304d..660478ca11 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -168,19 +168,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf index d4f2eb9ef2..6997c80234 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -168,19 +168,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf index 683fff0bc8..798871edce 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf @@ -263,17 +263,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf index 574c8b2545..628188aea2 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf @@ -263,17 +263,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf index 49365a1f61..75d947c009 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf @@ -263,17 +263,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.mbms-s1ap.if4p5.50PRB.lo.conf b/ci-scripts/conf_files/rcc.band7.tm1.mbms-s1ap.if4p5.50PRB.lo.conf index 640b85930a..1bcd26b931 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.mbms-s1ap.if4p5.50PRB.lo.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.mbms-s1ap.if4p5.50PRB.lo.conf @@ -365,17 +365,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.mbms.if4p5.50PRB.lo.conf b/ci-scripts/conf_files/rcc.band7.tm1.mbms.if4p5.50PRB.lo.conf index 7fe682f29e..e398310a35 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.mbms.if4p5.50PRB.lo.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.mbms.if4p5.50PRB.lo.conf @@ -365,17 +365,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf index 281f7433af..6f7a5d2dfd 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf @@ -230,17 +230,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/rru.band38.tm1.master.conf b/ci-scripts/conf_files/rru.band38.tm1.master.conf index 101ce83892..e6bd0b75aa 100644 --- a/ci-scripts/conf_files/rru.band38.tm1.master.conf +++ b/ci-scripts/conf_files/rru.band38.tm1.master.conf @@ -30,18 +30,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/rru.band38.tm1.slave.conf b/ci-scripts/conf_files/rru.band38.tm1.slave.conf index d5efe6bd61..2bc79028b4 100644 --- a/ci-scripts/conf_files/rru.band38.tm1.slave.conf +++ b/ci-scripts/conf_files/rru.band38.tm1.slave.conf @@ -30,18 +30,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/ci-scripts/conf_files/rru.fdd.band7.conf b/ci-scripts/conf_files/rru.fdd.band7.conf index 057f518046..a3b297049d 100644 --- a/ci-scripts/conf_files/rru.fdd.band7.conf +++ b/ci-scripts/conf_files/rru.fdd.band7.conf @@ -31,17 +31,10 @@ THREAD_STRUCT = log_config = { global_log_level ="error"; - global_log_verbosity ="medium"; hw_log_level ="error"; - hw_log_verbosity ="medium"; phy_log_level ="error"; - phy_log_verbosity ="medium"; mac_log_level ="error"; - mac_log_verbosity ="high"; rlc_log_level ="error"; - rlc_log_verbosity ="medium"; pdcp_log_level ="error"; - pdcp_log_verbosity ="medium"; rrc_log_level ="error"; - rrc_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/rru.tdd.band40.conf b/ci-scripts/conf_files/rru.tdd.band40.conf index 5ce3a515f5..40af241cca 100644 --- a/ci-scripts/conf_files/rru.tdd.band40.conf +++ b/ci-scripts/conf_files/rru.tdd.band40.conf @@ -31,17 +31,10 @@ THREAD_STRUCT = log_config = { global_log_level ="error"; - global_log_verbosity ="medium"; hw_log_level ="error"; - hw_log_verbosity ="medium"; phy_log_level ="error"; - phy_log_verbosity ="medium"; mac_log_level ="error"; - mac_log_verbosity ="high"; rlc_log_level ="error"; - rlc_log_verbosity ="medium"; pdcp_log_level ="error"; - pdcp_log_verbosity ="medium"; rrc_log_level ="error"; - rrc_log_verbosity ="medium"; }; diff --git a/ci-scripts/conf_files/ue.nfapi.conf b/ci-scripts/conf_files/ue.nfapi.conf index 2b602cbcf2..09ad7529b1 100644 --- a/ci-scripts/conf_files/ue.nfapi.conf +++ b/ci-scripts/conf_files/ue.nfapi.conf @@ -1,18 +1,11 @@ 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="full"; }; 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 43772fb655..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') @@ -910,7 +916,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re elif action == 'Deploy_Run_PhySim': PHYSIM.Deploy_PhySim(HTML, RAN) elif action == 'DeployGenObject': - CONTAINERS.DeployGenObject(HTML) + CONTAINERS.DeployGenObject(HTML, RAN, CiTestObj) if CONTAINERS.exitStatus==1: RAN.prematureExit = True elif action == 'UndeployGenObject': 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_4g_rfsim_fdd_05MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml index fd254f1856..a598b2bdc1 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz.xml @@ -66,8 +66,8 @@ DeployGenObject Deploy OAI 4G CoreNetwork yaml_files/4g_rfsimulator_fdd_05MHz - oai_hss oai_mme oai_spgwc oai_spgwu trf_gen - 6 + oai_hss redis magma_mme oai_spgwc oai_spgwu trf_gen + 7 @@ -75,15 +75,15 @@ Deploy OAI 4G eNB RF sim (FDD 05MHz) yaml_files/4g_rfsimulator_fdd_05MHz enb - 7 + 8 DeployGenObject - Deploy OAI 4G NR-UE RF sim (FDD 05MHz) + Deploy OAI 4G LTE-UE RF sim (FDD 05MHz) yaml_files/4g_rfsimulator_fdd_05MHz oai_ue0 - 8 + 9 diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml index 2ff9461b93..07ea358ad5 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_05MHz_noS1.xml @@ -60,7 +60,7 @@ DeployGenObject - Deploy OAI 4G NR-UE RF sim (FDD 05MHz) + Deploy OAI 4G LTE-UE RF sim (FDD 05MHz) yaml_files/4g_rfsimulator_fdd_05MHz_noS1 oai_ue0 2 diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml index f00e277c36..29acfa3b09 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_10MHz.xml @@ -66,8 +66,8 @@ DeployGenObject Deploy OAI 4G CoreNetwork yaml_files/4g_rfsimulator_fdd_10MHz - oai_hss oai_mme oai_spgwc oai_spgwu trf_gen - 6 + oai_hss redis magma_mme oai_spgwc oai_spgwu trf_gen + 7 @@ -75,15 +75,15 @@ Deploy OAI 4G eNB RF sim (FDD 10MHz) yaml_files/4g_rfsimulator_fdd_10MHz enb - 7 + 8 DeployGenObject - Deploy OAI 4G NR-UE RF sim (FDD 10MHz) + Deploy OAI 4G LTE-UE RF sim (FDD 10MHz) yaml_files/4g_rfsimulator_fdd_10MHz oai_ue0 - 8 + 9 diff --git a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml index 52e1ac7de1..74f712ebda 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_fdd_20MHz.xml @@ -66,8 +66,8 @@ DeployGenObject Deploy OAI 4G CoreNetwork yaml_files/4g_rfsimulator_fdd_20MHz - oai_hss oai_mme oai_spgwc oai_spgwu trf_gen - 6 + oai_hss redis magma_mme oai_spgwc oai_spgwu trf_gen + 7 @@ -75,15 +75,15 @@ Deploy OAI 4G eNB RF sim (FDD 20MHz) yaml_files/4g_rfsimulator_fdd_20MHz enb - 7 + 8 DeployGenObject - Deploy OAI 4G NR-UE RF sim (FDD 20MHz) + Deploy OAI 4G LTE-UE RF sim (FDD 20MHz) yaml_files/4g_rfsimulator_fdd_20MHz oai_ue0 - 8 + 9 diff --git a/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml index cdaee430ef..aa70db1fed 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml @@ -81,7 +81,7 @@ DeployGenObject - Deploy OAI 4G NR-UE RF sim (TDD 05MHz) + Deploy OAI 4G LTE-UE RF sim (TDD 05MHz) yaml_files/4g_rfsimulator_tdd_05MHz oai_ue0 8 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/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md index b2a7f8e30c..400559d269 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md @@ -48,8 +48,9 @@ Now pull images. ```bash $ docker pull cassandra:2.1 +$ docker pull redis:6.0.5 $ docker pull rdefosseoai/oai-hss:latest -$ docker pull rdefosseoai/oai-mme:latest +$ docker pull rdefosseoai/magma-mme:latest $ docker pull rdefosseoai/oai-spgwc:latest $ docker pull rdefosseoai/oai-spgwu-tiny:latest @@ -57,13 +58,15 @@ $ docker pull rdefosseoai/oai-enb:develop $ docker pull rdefosseoai/oai-lte-ue:develop ``` +If the `redis` tag is not available, pick the newest available `6.0.x` tag at [Docker Hub Redis Tags](https://hub.docker.com/_/redis?tab=tags). + And **re-tag** them for tutorials' docker-compose file to work. ```bash $ docker image tag rdefosseoai/oai-spgwc:latest oai-spgwc:latest $ docker image tag rdefosseoai/oai-hss:latest oai-hss:latest $ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest -$ docker image tag rdefosseoai/oai-mme:latest oai-mme:latest +$ docker image tag rdefosseoai/magma-mme:latest magma-mme:latest $ docker image tag rdefosseoai/oai-enb:develop oai-enb:develop $ docker image tag rdefosseoai/oai-lte-ue:develop oai-lte-ue:develop @@ -81,14 +84,14 @@ How to build the Traffic-Generator image is explained [here](https://github.com/ **Just `docker-compose up -d` WILL NOT WORK!** -All the following commands **SHALL** be run from the `ci-scripts/yaml_files/4g_rfsimulator` folder. +All the following commands **SHALL** be run from the `ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz` folder. ## 2.1. Deploy and Configure Cassandra Database ## It is very crutial that the Cassandra DB is fully configured before you do anything else! ```bash -$ cd ci-scripts/yaml_files/4g_rfsimulator +$ cd ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz $ docker-compose up -d db_init Creating network "rfsim4g-oai-private-net" with the default driver Creating network "rfsim4g-oai-public-net" with the default driver @@ -128,11 +131,12 @@ $ sudo tshark -i rfsim4g-public -f 'port 3868 or port 2123 or port 36412 or port ## 2.2. Deploy OAI CN4G containers ## ```bash -$ docker-compose up -d oai_mme oai_spgwu trf_gen +$ docker-compose up -d magma_mme oai_spgwu trf_gen rfsim4g-cassandra is up-to-date -Creating rfsim4g-trf-gen ... done +Creating rfsim4g-trf-gen ... done +Creating rfsim4g-redis ... done Creating rfsim4g-oai-hss ... done -Creating rfsim4g-oai-mme ... done +Creating rfsim4g-magma-mme ... done Creating rfsim4g-oai-spgwc ... done Creating rfsim4g-oai-spgwu-tiny ... done ``` @@ -144,11 +148,12 @@ $ docker-compose ps -a Name Command State Ports ------------------------------------------------------------------------------------------------------------------------- rfsim4g-cassandra docker-entrypoint.sh cassa ... Up (healthy) 7000/tcp, 7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp -rfsim4g-oai-hss /openair-hss/bin/entrypoin ... Up (healthy) 5868/tcp, 9042/tcp, 9080/tcp, 9081/tcp -rfsim4g-oai-mme /openair-mme/bin/entrypoin ... Up (healthy) 2123/udp, 3870/tcp, 5870/tcp -rfsim4g-oai-spgwc /openair-spgwc/bin/entrypo ... Up (healthy) 2123/udp, 8805/udp -rfsim4g-oai-spgwu-tiny /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp -rfsim4g-trf-gen /bin/bash -c ip route add ... Up (healthy) +rfsim4g-magma-mme /bin/bash -c /magma-mme/bi ... Up (healthy) 2123/udp, 3870/tcp, 5870/tcp +rfsim4g-oai-hss /openair-hss/bin/entrypoin ... Up (healthy) 5868/tcp, 9042/tcp, 9080/tcp, 9081/tcp +rfsim4g-oai-spgwc /openair-spgwc/bin/entrypo ... Up (healthy) 2123/udp, 8805/udp +rfsim4g-oai-spgwu-tiny /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim4g-redis /bin/bash -c redis-server ... Up (healthy) 6379/tcp +rfsim4g-trf-gen /bin/bash -c ip route add ... Up (healthy) ``` ## 2.3. Deploy OAI eNB in RF simulator mode ## @@ -165,77 +170,55 @@ $ docker-compose ps -a Name Command State Ports ------------------------------------------------------------------------------------------------------------------------- rfsim4g-cassandra docker-entrypoint.sh cassa ... Up (healthy) 7000/tcp, 7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp -rfsim4g-oai-enb /opt/oai-enb/bin/entrypoin ... Up (healthy) 2152/udp, 36412/udp, 36422/udp -rfsim4g-oai-hss /openair-hss/bin/entrypoin ... Up (healthy) 5868/tcp, 9042/tcp, 9080/tcp, 9081/tcp -rfsim4g-oai-mme /openair-mme/bin/entrypoin ... Up (healthy) 2123/udp, 3870/tcp, 5870/tcp -rfsim4g-oai-spgwc /openair-spgwc/bin/entrypo ... Up (healthy) 2123/udp, 8805/udp -rfsim4g-oai-spgwu-tiny /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp -rfsim4g-trf-gen /bin/bash -c ip route add ... Up (healthy) +rfsim4g-magma-mme /bin/bash -c /magma-mme/bi ... Up (healthy) 2123/udp, 3870/tcp, 5870/tcp +rfsim4g-oai-enb /opt/oai-enb/bin/entrypoin ... Up (healthy) 2152/udp, 36412/udp, 36422/udp +rfsim4g-oai-hss /openair-hss/bin/entrypoin ... Up (healthy) 5868/tcp, 9042/tcp, 9080/tcp, 9081/tcp +rfsim4g-oai-spgwc /openair-spgwc/bin/entrypo ... Up (healthy) 2123/udp, 8805/udp +rfsim4g-oai-spgwu-tiny /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim4g-redis /bin/bash -c redis-server ... Up (healthy) 6379/tcp +rfsim4g-trf-gen /bin/bash -c ip route add ... Up (healthy) ``` -Check if the eNB connected to MME: +Check if the eNB connected to MME: with MAGMA-MME, the logs are not pushed to `stdout` but to a file at `/var/log/mme.log` ```bash -$ docker logs rfsim4g-oai-mme +$ docker exec rfsim4g-magma-mme /bin/bash -c "cat /var/log/mme.log" ... -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0039 ======================================= STATISTICS ============================================ +000141 Fri Feb 11 09:49:29 2022 7EFFE7BE4700 DEBUG S6A tasks/s6a/s6a_peer.c :0095 Diameter identity of MME: mme.openairinterface.org with length: 24 +000142 Fri Feb 11 09:49:29 2022 7EFFE7BE4700 DEBUG S6A tasks/s6a/s6a_peer.c :0130 S6a peer connection attempt 1 / 8 +000143 Fri Feb 11 09:49:29 2022 7EFFE7BE4700 DEBUG S6A tasks/s6a/s6a_peer.c :0141 Peer hss.openairinterface.org is now connected... +000144 Fri Feb 11 09:49:29 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 +000146 Fri Feb 11 09:49:29 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_main.c :0083 MME APP ZMQ latency: 214. +000145 Fri Feb 11 09:49:29 2022 7EFFE83E5700 DEBUG S1AP tasks/s1ap/s1ap_mme.c :0121 S1AP ZMQ latency: 146. +000147 Fri Feb 11 09:50:23 2022 7EFFE83E5700 DEBUG S1AP tasks/s1ap/s1ap_mme.c :0121 S1AP ZMQ latency: 144. +000148 Fri Feb 11 09:50:23 2022 7EFFE83E5700 DEBUG S1AP tasks/s1ap/s1ap_mme_handlers.c :3775 Create eNB context for assoc_id: 4121 +000149 Fri Feb 11 09:50:23 2022 7EFFE83E5700 DEBUG S1AP tasks/s1ap/s1ap_mme.c :0121 S1AP ZMQ latency: 48. +000150 Fri Feb 11 09:50:23 2022 7EFFE83E5700 DEBUG S1AP tasks/s1ap/s1ap_mme_handlers.c :0536 New s1 setup request incoming from eNB-rf-sim macro eNB id: 00e01 +000151 Fri Feb 11 09:50:23 2022 7EFFE83E5700 DEBUG S1AP tasks/s1ap/s1ap_mme_handlers.c :0639 Adding eNB with enb_id :3585 to the list of served eNBs +000152 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0049 ======================================= STATISTICS ============================================ -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0042 | Current Status| Added since last display| Removed since last display | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0048 Connected eNBs | 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0054 Attached UEs | 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0060 Connected UEs | 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0066 Default Bearers| 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0072 S1-U Bearers | 0 | 0 | 0 | +000153 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0050 | Current Status| +000154 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0053 Attached UEs | 0 | +000155 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0056 Connected UEs | 0 | +000156 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0059 Connected eNBs | 0 | +000157 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0062 Default Bearers| 0 | +000158 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0065 S1-U Bearers | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0075 ======================================= STATISTICS ============================================ +000159 Fri Feb 11 09:50:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0070 ======================================= STATISTICS ============================================ -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0469 Client association changed: 0 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0101 ---------------------- -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0102 SCTP Status: -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0103 assoc id .....: 675 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0104 state ........: 4 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0105 instrms ......: 2 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0106 outstrms .....: 2 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0108 fragmentation : 1452 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0109 pending data .: 0 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0110 unack data ...: 0 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0111 rwnd .........: 106496 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0112 peer info : -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0114 state ....: 2 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0116 cwnd .....: 4380 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0118 srtt .....: 0 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0120 rto ......: 3000 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0122 mtu ......: 1500 -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0123 ---------------------- -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0479 New connection -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0205 ---------------------- -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0206 Local addresses: -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0217 - [192.168.61.3] -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0234 ---------------------- -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0151 ---------------------- -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0152 Peer addresses: -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0163 - [192.168.61.20] -DEBUG SCTP enair-mme/src/sctp/sctp_common.c:0178 ---------------------- -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0554 SCTP RETURNING!! -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0547 [675][44] Msg of length 51 received from port 36412, on stream 0, PPID 18 -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0554 SCTP RETURNING!! -DEBUG S1AP mme/src/s1ap/s1ap_mme_handlers.c:2826 Create eNB context for assoc_id: 675 -DEBUG S1AP mme/src/s1ap/s1ap_mme_handlers.c:0361 S1-Setup-Request macroENB_ID.size 3 (should be 20) -DEBUG S1AP mme/src/s1ap/s1ap_mme_handlers.c:0321 New s1 setup request incoming from macro eNB id: 00e01 -DEBUG S1AP mme/src/s1ap/s1ap_mme_handlers.c:0423 Adding eNB to the list of served eNBs -DEBUG S1AP mme/src/s1ap/s1ap_mme_handlers.c:0438 Adding eNB id 3585 to the list of served eNBs -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0283 [44][675] Sending buffer 0x7f9394009f90 of 27 bytes on stream 0 with ppid 18 -DEBUG SCTP rc/sctp/sctp_primitives_server.c:0296 Successfully sent 27 bytes on stream 0 -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0039 ======================================= STATISTICS ============================================ +000160 Fri Feb 11 09:50:28 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 +000161 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0049 ======================================= STATISTICS ============================================ -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0042 | Current Status| Added since last display| Removed since last display | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0048 Connected eNBs | 1 | 1 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0054 Attached UEs | 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0060 Connected UEs | 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0066 Default Bearers| 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0072 S1-U Bearers | 0 | 0 | 0 | +000162 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0050 | Current Status| +000163 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0053 Attached UEs | 0 | +000164 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0056 Connected UEs | 0 | +000165 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0059 Connected eNBs | 1 | +000166 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0062 Default Bearers| 0 | +000167 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0065 S1-U Bearers | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0075 ======================================= STATISTICS ============================================ +000168 Fri Feb 11 09:51:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0070 ======================================= STATISTICS ============================================ + +000169 Fri Feb 11 09:51:28 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 ... ``` @@ -253,14 +236,14 @@ $ docker-compose ps -a Name Command State Ports ------------------------------------------------------------------------------------------------------------------------- rfsim4g-cassandra docker-entrypoint.sh cassa ... Up (healthy) 7000/tcp, 7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp -rfsim4g-oai-enb /opt/oai-enb/bin/entrypoin ... Up (healthy) 2152/udp, 36412/udp, 36422/udp -rfsim4g-oai-hss /openair-hss/bin/entrypoin ... Up (healthy) 5868/tcp, 9042/tcp, 9080/tcp, 9081/tcp -rfsim4g-oai-lte-ue0 /opt/oai-lte-ue/bin/entryp ... Up (healthy) 10000/tcp -rfsim4g-oai-mme /openair-mme/bin/entrypoin ... Up (healthy) 2123/udp, 3870/tcp, 5870/tcp -rfsim4g-oai-spgwc /openair-spgwc/bin/entrypo ... Up (healthy) 2123/udp, 8805/udp -rfsim4g-oai-spgwu-tiny /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp -rfsim4g-trf-gen /bin/bash -c ip route add ... Up (healthy) -Creating rfsim4g-oai-enb ... done +rfsim4g-magma-mme /bin/bash -c /magma-mme/bi ... Up (healthy) 2123/udp, 3870/tcp, 5870/tcp +rfsim4g-oai-enb /opt/oai-enb/bin/entrypoin ... Up (healthy) 2152/udp, 36412/udp, 36422/udp +rfsim4g-oai-hss /openair-hss/bin/entrypoin ... Up (healthy) 5868/tcp, 9042/tcp, 9080/tcp, 9081/tcp +rfsim4g-oai-lte-ue0 /opt/oai-lte-ue/bin/entryp ... Up (healthy) 10000/tcp +rfsim4g-oai-spgwc /openair-spgwc/bin/entrypo ... Up (healthy) 2123/udp, 8805/udp +rfsim4g-oai-spgwu-tiny /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim4g-redis /bin/bash -c redis-server ... Up (healthy) 6379/tcp +rfsim4g-trf-gen /bin/bash -c ip route add ... Up (healthy) ``` Making sure the OAI UE is connected: @@ -268,40 +251,69 @@ Making sure the OAI UE is connected: ```bash $ docker logs rfsim4g-oai-enb ... -[RRC] RRCConnectionReconfiguration Encoded 1098 bits (138 bytes) -[RRC] [eNB 0] Frame 0, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes 138, UE id 617b) -[RRC] sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB -[PDCP] [FRAME 00000][eNB][MOD 00][RNTI 617b][SRB 02] Action ADD LCID 2 (SRB id 2) configured with SN size 5 bits and RLC AM -[PDCP] [FRAME 00000][eNB][MOD 00][RNTI 617b][DRB 01] Action ADD LCID 3 (DRB id 1) configured with SN size 12 bits and RLC AM -[SCTP] Successfully sent 46 bytes on stream 1 for assoc_id 676 -[RRC] [FRAME 00000][eNB][MOD 00][RNTI 617b] UE State = RRC_RECONFIGURED (default DRB, xid 0) -[PDCP] [FRAME 00000][eNB][MOD 00][RNTI 617b][SRB 02] Action MODIFY LCID 2 RB id 2 reconfigured with SN size 5 and RLC AM -[PDCP] [FRAME 00000][eNB][MOD 00][RNTI 617b][DRB 01] Action MODIFY LCID 3 RB id 1 reconfigured with SN size 1 and RLC AM -[RRC] [eNB 0] Frame 0 CC 0 : SRB2 is now active -[RRC] [eNB 0] Frame 0 : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE rnti 617b, reconfiguring DRB 1/LCID 3 -[RRC] [eNB 0] Frame 0 : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete, reconfiguring DRB 1/LCID 3 -[MAC] UE 0 RNTI 617b adding LC 3 idx 2 to scheduling control (total 3) -[MAC] Added physicalConfigDedicated 0x7f98e0004950 for 0.0 -[S1AP] initial_ctxt_resp_p: e_rab ID 5, enb_addr 192.168.61.20, SIZE 4 -[SCTP] Successfully sent 40 bytes on stream 1 for assoc_id 676 -[SCTP] Successfully sent 61 bytes on stream 1 for assoc_id 676 +7320446.555734 [RRC] I [FRAME 00000][eNB][MOD 00][RNTI bd8c] Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes 10) +7320446.555739 [RRC] I sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB +7320446.570284 [RRC] I [FRAME 00000][eNB][MOD 00][RNTI bd8c] received ueCapabilityInformation on UL-DCCH 1 from UE +7320446.570293 [RRC] A got UE capabilities for UE bd8c +7320446.570346 [RRC] W drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated +7320446.570370 [RRC] I [eNB 0] frame 0: requesting A2, A3, A4, and A5 event reporting +7320446.570435 [RRC] I RRCConnectionReconfiguration Encoded 1146 bits (144 bytes) +7320446.570440 [RRC] I [eNB 0] Frame 0, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes 144, UE id bd8c) +7320446.570445 [RRC] I sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB +7320446.570446 [SCTP] I Successfully sent 46 bytes on stream 1 for assoc_id 4120 +7320446.570449 [PDCP] I [FRAME 00000][eNB][MOD 00][RNTI bd8c][SRB 02] Action ADD LCID 2 (SRB id 2) configured with SN size 5 bits and RLC AM +7320446.570455 [PDCP] I [FRAME 00000][eNB][MOD 00][RNTI bd8c][DRB 01] Action ADD LCID 3 (DRB id 1) configured with SN size 12 bits and RLC AM +7320446.583036 [RRC] I [FRAME 00000][eNB][MOD 00][RNTI bd8c] UE State = RRC_RECONFIGURED (default DRB, xid 0) +7320446.583056 [PDCP] I [FRAME 00000][eNB][MOD 00][RNTI bd8c][SRB 02] Action MODIFY LCID 2 RB id 2 reconfigured with SN size 5 and RLC AM +7320446.583060 [PDCP] I [FRAME 00000][eNB][MOD 00][RNTI bd8c][DRB 01] Action MODIFY LCID 3 RB id 1 reconfigured with SN size 1 and RLC AM +7320446.583065 [RRC] I [eNB 0] Frame 0 CC 0 : SRB2 is now active +7320446.583067 [RRC] I [eNB 0] Frame 0 : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE rnti bd8c, reconfiguring DRB 1/LCID 3 +7320446.583070 [RRC] I [eNB 0] Frame 0 : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete, reconfiguring DRB 1/LCID 3 +7320446.583074 [MAC] I UE 0 RNTI bd8c adding LC 3 idx 2 to scheduling control (total 3) +7320446.583077 [MAC] I Added physicalConfigDedicated 0x7fd18c46be50 for 0.0 +7320446.583095 [S1AP] I initial_ctxt_resp_p: e_rab ID 5, enb_addr 192.168.61.20, SIZE 4 +7320446.583150 [SCTP] I Successfully sent 40 bytes on stream 1 for assoc_id 4120 +7320446.595495 [SCTP] I Successfully sent 61 bytes on stream 1 for assoc_id 4120 +7320446.774197 [SCTP] I Found data for descriptor 103 +7320446.774227 [SCTP] I [4120][103] Msg of length 53 received, on stream 1, PPID 18 +7320446.774295 [RRC] I [eNB 0] Received S1AP_DOWNLINK_NAS: ue_initial_id 0, eNB_ue_s1ap_id 4527568 +7320446.774316 [RRC] I sent RRC_DCCH_DATA_REQ to TASK_PDCP_ENB ... ``` -On the MME: +On the MME: be patient, the statistics display update is slow! ```bash -$ docker logs rfsim4g-oai-mme -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0039 ======================================= STATISTICS ============================================ +$ docker exec rfsim4g-magma-mme /bin/bash -c "cat /var/log/mme.log" +000413 Fri Feb 11 09:52:52 2022 7EFFE8BE6700 INFO GTPv2- lib/gtpv2-c/nwgtpv2c-0.11/src/Nw:2376 Stopped active timer 0x2 for info 0x0x60700001a9b0! +000414 Fri Feb 11 09:52:52 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 +000415 Fri Feb 11 09:52:52 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_main.c :0083 MME APP ZMQ latency: 172. +000416 Fri Feb 11 09:52:52 2022 7EFFEA3E9700 INFO MME-AP tasks/mme_app/mme_app_main.c :0137 Received S11 MODIFY BEARER RESPONSE from SPGW +000417 Fri Feb 11 09:52:52 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_main.c :0150 S11 MODIFY BEARER RESPONSE local S11 teid = 1 +000418 Fri Feb 11 09:52:52 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 +000419 Fri Feb 11 09:53:28 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 +000420 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0049 ======================================= STATISTICS ============================================ -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0042 | Current Status| Added since last display| Removed since last display | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0048 Connected eNBs | 1 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0054 Attached UEs | 1 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0060 Connected UEs | 1 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0066 Default Bearers| 0 | 0 | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0072 S1-U Bearers | 0 | 0 | 0 | +000421 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0050 | Current Status| +000422 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0053 Attached UEs | 0 | +000423 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0056 Connected UEs | 0 | +000424 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0059 Connected eNBs | 1 | +000425 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0062 Default Bearers| 0 | +000426 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0065 S1-U Bearers | 0 | -DEBUG MME-AP src/mme_app/mme_app_statistics.c:0075 ======================================= STATISTICS ============================================ +000427 Fri Feb 11 09:53:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0070 ======================================= STATISTICS ============================================ + +000428 Fri Feb 11 09:54:28 2022 7EFFEA3E9700 DEBUG MME-AP tasks/mme_app/mme_app_state_mana:0097 Inside get_state with read_from_db 0 +000429 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0049 ======================================= STATISTICS ============================================ + +000430 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0050 | Current Status| +000431 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0053 Attached UEs | 1 | +000432 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0056 Connected UEs | 1 | +000433 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0059 Connected eNBs | 1 | +000434 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0062 Default Bearers| 1 | +000435 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0065 S1-U Bearers | 1 | + +000436 Fri Feb 11 09:54:28 2022 7EFFEC3ED700 DEBUG SERVIC tasks/service303/service303_mme_:0070 ======================================= STATISTICS ============================================ ``` On the LTE UE: @@ -377,16 +389,18 @@ Stopping rfsim4g-oai-lte-ue0 ... done Stopping rfsim4g-oai-enb ... done Stopping rfsim4g-oai-spgwu-tiny ... done Stopping rfsim4g-oai-spgwc ... done -Stopping rfsim4g-oai-mme ... done +Stopping rfsim4g-magma-mme ... done Stopping rfsim4g-oai-hss ... done +Stopping rfsim4g-redis ... done Stopping rfsim4g-trf-gen ... done Stopping rfsim4g-cassandra ... done Removing rfsim4g-oai-lte-ue0 ... done Removing rfsim4g-oai-enb ... done Removing rfsim4g-oai-spgwu-tiny ... done Removing rfsim4g-oai-spgwc ... done -Removing rfsim4g-oai-mme ... done +Removing rfsim4g-magma-mme ... done Removing rfsim4g-oai-hss ... done +Removing rfsim4g-redis ... done Removing rfsim4g-trf-gen ... done Removing rfsim4g-cassandra ... done Removing network rfsim4g-oai-private-net @@ -443,19 +457,23 @@ My 1st UE IMSI is an aggregation of `MCC`, `MNC`, `SHORT_IMSI`. ## 5.2. PLMN and TAI ## -in MME config: +in MME config, in the docker-compose there is not much besides REALM fields: ```yaml + TZ: Europe/Paris REALM: openairinterface.org -.. - MCC: '208' - MNC: '96' - MME_GID: 32768 - MME_CODE: 3 - TAC_0: 1 - TAC_1: 2 - TAC_2: 3 + PREFIX: /openair-mme/etc + HSS_HOSTNAME: hss + HSS_FQDN: hss.openairinterface.org + HSS_REALM: openairinterface.org MME_FQDN: mme.openairinterface.org + FEATURES: mme_oai +``` + +Everything is hard-coded in the `mme.conf` that is mounted as a volume: look for instances of + +``` +MCC="208" ; MNC="96"; TAC = "1"; ``` in SPGW-C/-U configs: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index e852643ab9..b15e794c10 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -58,57 +58,45 @@ services: timeout: 5s retries: 5 - oai_mme: - image: oai-mme:latest - container_name: rfsim4g-oai-mme + redis: + image: redis:6.0.5 + container_name: rfsim4g-redis privileged: true - depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.6 + volumes: + - ./redis_extern.conf:/usr/local/etc/redis/redis.conf + entrypoint: /bin/bash -c "redis-server /usr/local/etc/redis/redis.conf" + healthcheck: + test: /bin/bash -c "redis-cli -h 192.168.61.6 -p 6380 ping" + interval: 10s + timeout: 5s + retries: 5 + + magma_mme: + image: magma-mme:latest + container_name: rfsim4g-magma-mme + hostname: mme + privileged: true + depends_on: [oai_hss, redis] networks: public_net: ipv4_address: 192.168.61.3 environment: + TZ: Europe/Paris REALM: openairinterface.org PREFIX: /openair-mme/etc - INSTANCE: 1 - PID_DIRECTORY: /var/run - HSS_IP_ADDR: 192.168.61.2 HSS_HOSTNAME: hss HSS_FQDN: hss.openairinterface.org HSS_REALM: openairinterface.org - MCC: '208' - MNC: '96' - MME_GID: 32768 - MME_CODE: 3 - TAC_0: 1 - TAC_1: 2 - TAC_2: 3 MME_FQDN: mme.openairinterface.org - MME_S6A_IP_ADDR: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S1_MME: eth0 - MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S11: eth0 - MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S10: lo - MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 - OUTPUT: CONSOLE - SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 - PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 - PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 - MCC_SGW_0: '208' - MNC3_SGW_0: '096' - TAC_LB_SGW_0: '01' - TAC_HB_SGW_0: '00' - MCC_MME_0: '208' - MNC3_MME_0: '096' - TAC_LB_MME_0: '02' - TAC_HB_MME_0: '00' - MCC_MME_1: '208' - MNC3_MME_1: '096' - TAC_LB_MME_1: '03' - TAC_HB_MME_1: '00' - TAC_LB_SGW_TEST_0: '03' - TAC_HB_SGW_TEST_0: '00' - SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + FEATURES: mme_oai + volumes: + - ./mme_fd.sprint.conf:/magma-mme/etc/mme_fd.conf.tmplt + - ./mme.conf:/magma-mme/etc/mme.conf + - ./entrypoint.sh:/magma-mme/bin/entrypoint.sh + entrypoint: /bin/bash -c "/magma-mme/bin/entrypoint.sh" healthcheck: test: /bin/bash -c "pgrep oai_mme" interval: 10s @@ -118,7 +106,7 @@ services: oai_spgwc: image: oai-spgwc:latest privileged: true - depends_on: [oai_mme] + depends_on: [magma_mme] container_name: rfsim4g-oai-spgwc networks: public_net: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/entrypoint.sh b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/entrypoint.sh new file mode 100755 index 0000000000..24960e215d --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/entrypoint.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +INSTANCE=1 +PREFIX='/magma-mme/etc' +MY_REALM='openairinterface.org' + +declare -A MME_CONF + +pushd $PREFIX +MME_CONF[@MME_S6A_IP_ADDR@]="192.168.61.3" +MME_CONF[@INSTANCE@]=$INSTANCE +MME_CONF[@PREFIX@]=$PREFIX +MME_CONF[@REALM@]=$MY_REALM +MME_CONF[@MME_FQDN@]="mme.${MME_CONF[@REALM@]}" +MME_CONF[@HSS_HOSTNAME@]='hss' +MME_CONF[@HSS_FQDN@]="${MME_CONF[@HSS_HOSTNAME@]}.${MME_CONF[@REALM@]}" +MME_CONF[@HSS_IP_ADDR@]="192.168.61.2" + +cp mme_fd.conf.tmplt $PREFIX/mme_fd.conf + +for K in "${!MME_CONF[@]}"; do + egrep -lRZ "$K" $PREFIX/mme_fd.conf | xargs -0 -l sed -i -e "s|$K|${MME_CONF[$K]}|g" + ret=$?;[[ ret -ne 0 ]] && echo "Could not replace $K with ${MME_CONF[$K]}" +done + +sed -i -e "s@etc/freeDiameter@etc@" /magma-mme/etc/mme_fd.conf +sed -i -e "s@bind: 127.0.0.1@bind: 192.168.61.6@" /etc/magma/redis.yml +# Generate freeDiameter certificate +popd +cd /magma-mme/scripts +./check_mme_s6a_certificate $PREFIX mme.${MME_CONF[@REALM@]} + +cd /magma-mme +nohup /magma-mme/bin/sctpd > /var/log/sctpd.log 2>&1 & +sleep 5 +/magma-mme/bin/oai_mme -c /magma-mme/etc/mme.conf diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/mme.conf b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/mme.conf new file mode 100644 index 0000000000..4f491cc63d --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/mme.conf @@ -0,0 +1,134 @@ +# generated by generate_mme_config_script.py +MME : +{ + REALM = "openairinterface.org" + PID_DIRECTORY = "/var/run"; + MAXENB = 8; # power of 2 + MAXUE = 16; # power of 2 + RELATIVE_CAPACITY = 10; + + EMERGENCY_ATTACH_SUPPORTED = "no"; + UNAUTHENTICATED_IMSI_SUPPORTED = "no"; + + # EPS network feature support + EPS_NETWORK_FEATURE_SUPPORT_IMS_VOICE_OVER_PS_SESSION_IN_S1 = "no"; # DO NOT CHANGE + EPS_NETWORK_FEATURE_SUPPORT_EMERGENCY_BEARER_SERVICES_IN_S1_MODE = "no"; # DO NOT CHANGE + EPS_NETWORK_FEATURE_SUPPORT_LOCATION_SERVICES_VIA_EPC = "no"; # DO NOT CHANGE + EPS_NETWORK_FEATURE_SUPPORT_EXTENDED_SERVICE_REQUEST = "no"; # DO NOT CHANGE + + # Display statistics about whole system (expressed in seconds) + MME_STATISTIC_TIMER = 10; + IP_CAPABILITY = "IPV4"; # UE PDN_TYPE + USE_STATELESS = ""; + + INTERTASK_INTERFACE : + { + # max queue size per task + ITTI_QUEUE_SIZE = 2000000; + }; + + S6A : + { + S6A_CONF = "/magma-mme/etc/mme_fd.conf"; # YOUR MME freeDiameter config file path + HSS_HOSTNAME = "hss.openairinterface.org"; + HSS_REALM = "openairinterface.org"; + }; + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 8; + SCTP_OUTSTREAMS = 8; + }; + + # ------- S1AP definitions + S1AP : + { + # outcome drop timer value (seconds) + S1AP_OUTCOME_TIMER = 10; + }; + + # ------- MME served GUMMEIs + GUMMEI_LIST = ( + { MCC="208" ; MNC="96"; MME_GID="32768" ; MME_CODE="3"; } + ); + + # ------- MME served TAIs + TAI_LIST = ( + {MCC="208" ; MNC="96"; TAC = "1"; } + ); + + TAC_LIST = ( + {MCC="208" ; MNC="96"; TAC = "1"; } + ); + + CSFB : + { + NON_EPS_SERVICE_CONTROL = "OFF"; + CSFB_MCC = "208"; + CSFB_MNC = "96"; + LAC = "1"; + }; + NAS : + { + ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST = [ "EIA2" , "EIA1" , "EIA0" ]; + ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST = [ "EEA0" , "EEA1" , "EEA2" ]; + T3402 = 1 # in minutes (default is 12 minutes) + T3412 = 54 # in minutes (default is 54 minutes, network dependent) + T3422 = 6 # in seconds (default is 6s) + T3450 = 6 # in seconds (default is 6s) + T3460 = 6 # in seconds (default is 6s) + T3470 = 6 # in seconds (default is 6s) + T3485 = 8 # UNUSED in seconds (default is 8s) + T3486 = 8 # UNUSED in seconds (default is 8s) + T3489 = 4 # UNUSED in seconds (default is 4s) + T3495 = 8 # UNUSED in seconds (default is 8s) + }; + + SGS : + { + TS6_1 = 10 # in seconds (default is 10s) + TS8 = 4 # in seconds (default is 4s) + TS9 = 2 # in seconds (default is 4s) + TS10 = 4 # in seconds (default is 4s) + TS13 = 4 # in seconds (default is 4s) + }; + + NETWORK_INTERFACES : + { + MME_INTERFACE_NAME_FOR_S1_MME = "eth0"; + MME_IPV4_ADDRESS_FOR_S1_MME = "192.168.61.3/24"; + MME_INTERFACE_NAME_FOR_S11_MME = "eth0"; + MME_IPV4_ADDRESS_FOR_S11_MME = "192.168.61.3/24"; + MME_PORT_FOR_S11_MME = 2123; + }; + + LOGGING : + { + OUTPUT = "CONSOLE"; + THREAD_SAFE = "no"; + COLOR = "no"; + + SCTP_LOG_LEVEL = "ERROR"; + GTPV1U_LOG_LEVEL = "INFO"; + SPGW_APP_LOG_LEVEL = "INFO"; + UDP_LOG_LEVEL = "INFO"; + S1AP_LOG_LEVEL = "DEBUG"; + NAS_LOG_LEVEL = "INFO"; + MME_APP_LOG_LEVEL = "DEBUG"; + GTPV2C_LOG_LEVEL = "INFO"; + S11_LOG_LEVEL = "DEBUG"; + S6A_LOG_LEVEL = "DEBUG"; + UTIL_LOG_LEVEL = "INFO"; + MSC_LOG_LEVEL = "ERROR"; + ITTI_LOG_LEVEL = "ERROR"; + MME_SCENARIO_PLAYER_LOG_LEVEL = "ERROR"; + ASN1_VERBOSITY = "INFO"; + }; + + S-GW : + { + SGW_IPV4_ADDRESS_FOR_S11 = "192.168.61.4"; + }; +}; diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/mme_fd.sprint.conf b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/mme_fd.sprint.conf new file mode 100644 index 0000000000..6f87ed8c2b --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/mme_fd.sprint.conf @@ -0,0 +1,169 @@ +# -------- Local --------- + +# Uncomment if the framework cannot resolv it. +Identity = "@MME_FQDN@"; +Realm = "@REALM@"; + +# TLS configuration (see previous section) +TLS_Cred = "@PREFIX@/freeDiameter/mme.cert.pem", + "@PREFIX@/freeDiameter/mme.key.pem"; +TLS_CA = "@PREFIX@/freeDiameter/mme.cacert.pem"; + +# Disable use of TCP protocol (only listen and connect in SCTP) +# Default : TCP enabled +No_SCTP; + +# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option. +# Prefer TCP instead of SCTP for establishing new connections. +# This setting may be overwritten per peer in peer configuration blocs. +# Default : SCTP is attempted first. +Prefer_TCP; + + +No_IPv6; + +# Overwrite the number of SCTP streams. This value should be kept low, +# especially if you are using TLS over SCTP, because it consumes a lot of +# resources in that case. See tickets 19 and 27 for some additional details on +# this. +# Limit the number of SCTP streams +SCTP_streams = 3; + + +# By default, freeDiameter acts as a Diameter Relay Agent by forwarding all +# messages it cannot handle locally. This parameter disables this behavior. +NoRelay; + +# Use RFC3588 method for TLS protection, where TLS is negociated after CER/CEA exchange is completed +# on the unsecure connection. The alternative is RFC6733 mechanism, where TLS protects also the +# CER/CEA exchange on a dedicated secure port. +# This parameter only affects outgoing connections. +# The setting can be also defined per-peer (see Peers configuration section). +# Default: use RFC6733 method with separate port for TLS. + +#TLS_old_method; + +AppServThreads = 4; + +# Specify the addresses on which to bind the listening server. This must be +# specified if the framework is unable to auto-detect these addresses, or if the +# auto-detected values are incorrect. Note that the list of addresses is sent +# in CER or CEA message, so one should pay attention to this parameter if some +# adresses should be kept hidden. +ListenOn = "@MME_S6A_IP_ADDR@"; + +Port = 3870; +SecPort = 5870; + +# -------- Extensions --------- + +# Uncomment (and create rtd.conf) to specify routing table for this peer. +#LoadExtension = "/usr/local/lib/freeDiameter/rt_default.fdx" : "rtd.conf"; + +#LoadExtension = "/usr/local/lib/freeDiameter/_sample.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/app_acct.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/app_diameap.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/app_radgw.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/app_redirect.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/app_sip.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dbg_interactive.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dbg_monitor.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dbg_msg_dumps.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dbg_msg_timings.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dbg_rt.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_3gpp2_avps.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_CreditControl.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_CxDx.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Gx.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_NAS.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Ro.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Rx.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_S6mS6n.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_SGd.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_SLh.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Sd.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Sh.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_T4.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_T6aT6bT7.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Tsp.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_dcca.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_dcca_3gpp.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_dcca_starent.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_draftload_avps.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_eap.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_etsi283034_avps.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_legacy_xml.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_mip6a.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_mip6i.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_nas_mipv6.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_nasreq.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4004_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4006bis_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4072_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4590_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5447_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5580_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5777_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5778_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc6734_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc6942_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7155_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7683_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7944_avps.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_sip.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29061_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29128_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29154_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29173_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29212_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29214_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29215_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29217_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29229_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29272_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29273_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29329_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29336_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29337_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29338_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29343_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29344_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29345_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29368_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29468_avps.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_ts32299_avps.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_busypeers.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_default.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_ereg.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_ignore_dh.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_load_balance.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_randomize.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/rt_redirect.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/test_acct.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/test_app.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/test_hss.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/test_netemul.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/test_rt_any.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/test_sip.fdx"; +#LoadExtension = "/usr/local/lib/freeDiameter/dict_Rf.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_S6as6d.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_S6t.fdx"; +LoadExtension = "/usr/local/lib/freeDiameter/dict_S6c.fdx"; + + +# -------- Peers --------- + +# The framework will actively attempt to establish and maintain a connection +# with the peers listed here. +# For only accepting incoming connections, see the acl_wl.fx extension. + +# ConnectPeer +# Declare a remote peer to which this peer must maintain a connection. +# In addition, this allows specifying non-default parameters for this peer only +# (for example disable SCTP with this peer, or use RFC3588-flavour TLS). +# Note that by default, if a peer is not listed as a ConnectPeer entry, an +# incoming connection from this peer will be rejected. If you want to accept +# incoming connections from other peers, see the acl_wl.fdx? extension which +# allows exactly this. + +ConnectPeer= "@HSS_FQDN@" { ConnectTo = "@HSS_IP_ADDR@"; No_SCTP ; No_IPv6; Prefer_TCP; No_TLS; port = 3868;}; diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/redis_extern.conf b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/redis_extern.conf new file mode 100644 index 0000000000..1ee9dd9a78 --- /dev/null +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/redis_extern.conf @@ -0,0 +1,33 @@ +# +# Copyright (c) 2016-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +# Jinja template for Redis configuration +# See the default config file for options and explanations: +# https://github.com/antirez/redis/blob/unstable/redis.conf + +# TODO: make sensible, production-aware config decisions + +bind 192.168.61.6 +port 6380 + +daemonize no +loglevel notice + +timeout 0 +databases 1 + +dbfilename redis_dump.rdb +dir /data + +# Save the DB on disk + +save 900 1 + +save 300 10 + +save 60 1000 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index 4c1ceb424a..e1e992c94c 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -58,57 +58,45 @@ services: timeout: 5s retries: 5 - oai_mme: - image: oai-mme:latest - container_name: rfsim4g-oai-mme + redis: + image: redis:6.0.5 + container_name: rfsim4g-redis privileged: true - depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.6 + volumes: + - ../4g_rfsimulator_fdd_05MHz/redis_extern.conf:/usr/local/etc/redis/redis.conf + entrypoint: /bin/bash -c "redis-server /usr/local/etc/redis/redis.conf" + healthcheck: + test: /bin/bash -c "redis-cli -h 192.168.61.6 -p 6380 ping" + interval: 10s + timeout: 5s + retries: 5 + + magma_mme: + image: magma-mme:latest + container_name: rfsim4g-magma-mme + hostname: mme + privileged: true + depends_on: [oai_hss, redis] networks: public_net: ipv4_address: 192.168.61.3 environment: + TZ: Europe/Paris REALM: openairinterface.org PREFIX: /openair-mme/etc - INSTANCE: 1 - PID_DIRECTORY: /var/run - HSS_IP_ADDR: 192.168.61.2 HSS_HOSTNAME: hss HSS_FQDN: hss.openairinterface.org HSS_REALM: openairinterface.org - MCC: '208' - MNC: '96' - MME_GID: 32768 - MME_CODE: 3 - TAC_0: 1 - TAC_1: 2 - TAC_2: 3 MME_FQDN: mme.openairinterface.org - MME_S6A_IP_ADDR: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S1_MME: eth0 - MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S11: eth0 - MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S10: lo - MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 - OUTPUT: CONSOLE - SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 - PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 - PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 - MCC_SGW_0: '208' - MNC3_SGW_0: '096' - TAC_LB_SGW_0: '01' - TAC_HB_SGW_0: '00' - MCC_MME_0: '208' - MNC3_MME_0: '096' - TAC_LB_MME_0: '02' - TAC_HB_MME_0: '00' - MCC_MME_1: '208' - MNC3_MME_1: '096' - TAC_LB_MME_1: '03' - TAC_HB_MME_1: '00' - TAC_LB_SGW_TEST_0: '03' - TAC_HB_SGW_TEST_0: '00' - SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + FEATURES: mme_oai + volumes: + - ../4g_rfsimulator_fdd_05MHz/mme_fd.sprint.conf:/magma-mme/etc/mme_fd.conf.tmplt + - ../4g_rfsimulator_fdd_05MHz/mme.conf:/magma-mme/etc/mme.conf + - ../4g_rfsimulator_fdd_05MHz/entrypoint.sh:/magma-mme/bin/entrypoint.sh + entrypoint: /bin/bash -c "/magma-mme/bin/entrypoint.sh" healthcheck: test: /bin/bash -c "pgrep oai_mme" interval: 10s @@ -118,7 +106,7 @@ services: oai_spgwc: image: oai-spgwc:latest privileged: true - depends_on: [oai_mme] + depends_on: [magma_mme] container_name: rfsim4g-oai-spgwc networks: public_net: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index 4a61181afb..ad665813f2 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -58,57 +58,45 @@ services: timeout: 5s retries: 5 - oai_mme: - image: oai-mme:latest - container_name: rfsim4g-oai-mme + redis: + image: redis:6.0.5 + container_name: rfsim4g-redis privileged: true - depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.6 + volumes: + - ../4g_rfsimulator_fdd_05MHz/redis_extern.conf:/usr/local/etc/redis/redis.conf + entrypoint: /bin/bash -c "redis-server /usr/local/etc/redis/redis.conf" + healthcheck: + test: /bin/bash -c "redis-cli -h 192.168.61.6 -p 6380 ping" + interval: 10s + timeout: 5s + retries: 5 + + magma_mme: + image: magma-mme:latest + container_name: rfsim4g-magma-mme + hostname: mme + privileged: true + depends_on: [oai_hss, redis] networks: public_net: ipv4_address: 192.168.61.3 environment: + TZ: Europe/Paris REALM: openairinterface.org PREFIX: /openair-mme/etc - INSTANCE: 1 - PID_DIRECTORY: /var/run - HSS_IP_ADDR: 192.168.61.2 HSS_HOSTNAME: hss HSS_FQDN: hss.openairinterface.org HSS_REALM: openairinterface.org - MCC: '208' - MNC: '96' - MME_GID: 32768 - MME_CODE: 3 - TAC_0: 1 - TAC_1: 2 - TAC_2: 3 MME_FQDN: mme.openairinterface.org - MME_S6A_IP_ADDR: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S1_MME: eth0 - MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S11: eth0 - MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S10: lo - MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 - OUTPUT: CONSOLE - SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 - PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 - PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 - MCC_SGW_0: '208' - MNC3_SGW_0: '096' - TAC_LB_SGW_0: '01' - TAC_HB_SGW_0: '00' - MCC_MME_0: '208' - MNC3_MME_0: '096' - TAC_LB_MME_0: '02' - TAC_HB_MME_0: '00' - MCC_MME_1: '208' - MNC3_MME_1: '096' - TAC_LB_MME_1: '03' - TAC_HB_MME_1: '00' - TAC_LB_SGW_TEST_0: '03' - TAC_HB_SGW_TEST_0: '00' - SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + FEATURES: mme_oai + volumes: + - ../4g_rfsimulator_fdd_05MHz/mme_fd.sprint.conf:/magma-mme/etc/mme_fd.conf.tmplt + - ../4g_rfsimulator_fdd_05MHz/mme.conf:/magma-mme/etc/mme.conf + - ../4g_rfsimulator_fdd_05MHz/entrypoint.sh:/magma-mme/bin/entrypoint.sh + entrypoint: /bin/bash -c "/magma-mme/bin/entrypoint.sh" healthcheck: test: /bin/bash -c "pgrep oai_mme" interval: 10s @@ -118,7 +106,7 @@ services: oai_spgwc: image: oai-spgwc:latest privileged: true - depends_on: [oai_mme] + depends_on: [magma_mme] container_name: rfsim4g-oai-spgwc networks: public_net: diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index 3424780791..ffa92bac49 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -58,57 +58,45 @@ services: timeout: 5s retries: 5 - oai_mme: - image: oai-mme:latest - container_name: rfsim4g-oai-mme + redis: + image: redis:6.0.5 + container_name: rfsim4g-redis privileged: true - depends_on: [oai_hss] + networks: + public_net: + ipv4_address: 192.168.61.6 + volumes: + - ../4g_rfsimulator_fdd_05MHz/redis_extern.conf:/usr/local/etc/redis/redis.conf + entrypoint: /bin/bash -c "redis-server /usr/local/etc/redis/redis.conf" + healthcheck: + test: /bin/bash -c "redis-cli -h 192.168.61.6 -p 6380 ping" + interval: 10s + timeout: 5s + retries: 5 + + magma_mme: + image: magma-mme:latest + container_name: rfsim4g-magma-mme + hostname: mme + privileged: true + depends_on: [oai_hss, redis] networks: public_net: ipv4_address: 192.168.61.3 environment: + TZ: Europe/Paris REALM: openairinterface.org PREFIX: /openair-mme/etc - INSTANCE: 1 - PID_DIRECTORY: /var/run - HSS_IP_ADDR: 192.168.61.2 HSS_HOSTNAME: hss HSS_FQDN: hss.openairinterface.org HSS_REALM: openairinterface.org - MCC: '208' - MNC: '96' - MME_GID: 32768 - MME_CODE: 3 - TAC_0: 1 - TAC_1: 2 - TAC_2: 3 MME_FQDN: mme.openairinterface.org - MME_S6A_IP_ADDR: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S1_MME: eth0 - MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S11: eth0 - MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3 - MME_INTERFACE_NAME_FOR_S10: lo - MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10 - OUTPUT: CONSOLE - SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4 - PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0 - PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0 - MCC_SGW_0: '208' - MNC3_SGW_0: '096' - TAC_LB_SGW_0: '01' - TAC_HB_SGW_0: '00' - MCC_MME_0: '208' - MNC3_MME_0: '096' - TAC_LB_MME_0: '02' - TAC_HB_MME_0: '00' - MCC_MME_1: '208' - MNC3_MME_1: '096' - TAC_LB_MME_1: '03' - TAC_HB_MME_1: '00' - TAC_LB_SGW_TEST_0: '03' - TAC_HB_SGW_TEST_0: '00' - SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0 + FEATURES: mme_oai + volumes: + - ../4g_rfsimulator_fdd_05MHz/mme_fd.sprint.conf:/magma-mme/etc/mme_fd.conf.tmplt + - ../4g_rfsimulator_fdd_05MHz/mme.conf:/magma-mme/etc/mme.conf + - ../4g_rfsimulator_fdd_05MHz/entrypoint.sh:/magma-mme/bin/entrypoint.sh + entrypoint: /bin/bash -c "/magma-mme/bin/entrypoint.sh" healthcheck: test: /bin/bash -c "pgrep oai_mme" interval: 10s @@ -118,7 +106,7 @@ services: oai_spgwc: image: oai-spgwc:latest privileged: true - depends_on: [oai_mme] + depends_on: [magma_mme] container_name: rfsim4g-oai-spgwc networks: public_net: diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 6a39f2147e..74a23905f0 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -241,12 +241,12 @@ services: NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 - GNB_NGA_IP_ADDRESS: 192.168.71.136 + GNB_NGA_IP_ADDRESS: 192.168.71.140 GNB_NGU_IF_NAME: eth0 - GNB_NGU_IP_ADDRESS: 192.168.71.136 + GNB_NGU_IP_ADDRESS: 192.168.71.140 F1_IF_NAME: eth0 - F1_CU_IP_ADDRESS: 192.168.71.136 - F1_DU_IP_ADDRESS: 192.168.71.138 + F1_CU_IP_ADDRESS: 192.168.71.140 + F1_DU_IP_ADDRESS: 192.168.71.142 F1_CU_D_PORT: 2153 F1_DU_D_PORT: 2153 USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time @@ -254,7 +254,7 @@ services: - oai-ext-dn networks: public_net: - ipv4_address: 192.168.71.136 + ipv4_address: 192.168.71.140 healthcheck: test: /bin/bash -c "pgrep nr-softmodem" interval: 10s @@ -277,12 +277,12 @@ services: NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 - GNB_NGA_IP_ADDRESS: 192.168.71.138 + GNB_NGA_IP_ADDRESS: 192.168.71.142 GNB_NGU_IF_NAME: eth0 - GNB_NGU_IP_ADDRESS: 192.168.71.138 + GNB_NGU_IP_ADDRESS: 192.168.71.142 F1_IF_NAME: eth0 - F1_CU_IP_ADDRESS: 192.168.71.136 - F1_DU_IP_ADDRESS: 192.168.71.138 + F1_CU_IP_ADDRESS: 192.168.71.140 + F1_DU_IP_ADDRESS: 192.168.71.142 F1_CU_D_PORT: 2153 F1_DU_D_PORT: 2153 USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time @@ -290,7 +290,7 @@ services: - oai-cu networks: public_net: - ipv4_address: 192.168.71.138 + ipv4_address: 192.168.71.142 healthcheck: test: /bin/bash -c "pgrep nr-softmodem" interval: 10s @@ -301,7 +301,7 @@ services: privileged: true container_name: rfsim5g-oai-nr-ue environment: - RFSIMULATOR: 192.168.71.138 + RFSIMULATOR: 192.168.71.142 FULL_IMSI: '208990100001100' FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' OPC: 'C42449363BBAD02B66D16BC975D77CC1' @@ -313,7 +313,7 @@ services: - oai-du networks: public_net: - ipv4_address: 192.168.71.137 + ipv4_address: 192.168.71.150 healthcheck: test: /bin/bash -c "pgrep nr-uesoftmodem" interval: 10s diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index f0476b0a1e..808be7d83d 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -241,15 +241,15 @@ services: NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 - GNB_NGA_IP_ADDRESS: 192.168.71.136 + GNB_NGA_IP_ADDRESS: 192.168.71.140 GNB_NGU_IF_NAME: eth0 - GNB_NGU_IP_ADDRESS: 192.168.71.136 + GNB_NGU_IP_ADDRESS: 192.168.71.140 USE_ADDITIONAL_OPTIONS: --sa -E --rfsim --log_config.global_log_options level,nocolor,time depends_on: - oai-ext-dn networks: public_net: - ipv4_address: 192.168.71.136 + ipv4_address: 192.168.71.140 healthcheck: test: /bin/bash -c "pgrep nr-softmodem" interval: 10s @@ -260,7 +260,7 @@ services: privileged: true container_name: rfsim5g-oai-nr-ue environment: - RFSIMULATOR: 192.168.71.136 + RFSIMULATOR: 192.168.71.140 FULL_IMSI: '208990100001100' FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' OPC: 'C42449363BBAD02B66D16BC975D77CC1' @@ -272,7 +272,7 @@ services: - oai-gnb networks: public_net: - ipv4_address: 192.168.71.137 + ipv4_address: 192.168.71.150 healthcheck: test: /bin/bash -c "pgrep nr-uesoftmodem" interval: 10s diff --git a/ci-scripts/yaml_files/fr1_epc_20897/mme.conf b/ci-scripts/yaml_files/fr1_epc_20897/mme.conf index 9dcb44ef2a..923bf1c388 100644 --- a/ci-scripts/yaml_files/fr1_epc_20897/mme.conf +++ b/ci-scripts/yaml_files/fr1_epc_20897/mme.conf @@ -114,7 +114,6 @@ MME : MME_APP_LOG_LEVEL = "TRACE"; S6A_LOG_LEVEL = "TRACE"; UTIL_LOG_LEVEL = "ERROR"; - MSC_LOG_LEVEL = "ERROR"; ITTI_LOG_LEVEL = "ERROR"; ASN1_VERBOSITY = "annoying"; }; diff --git a/ci-scripts/yaml_files/magma_nsa_20897/mme.conf b/ci-scripts/yaml_files/magma_nsa_20897/mme.conf index 242b780a40..6bdace2c28 100644 --- a/ci-scripts/yaml_files/magma_nsa_20897/mme.conf +++ b/ci-scripts/yaml_files/magma_nsa_20897/mme.conf @@ -121,7 +121,6 @@ MME : S11_LOG_LEVEL = "DEBUG"; S6A_LOG_LEVEL = "DEBUG"; UTIL_LOG_LEVEL = "INFO"; - MSC_LOG_LEVEL = "ERROR"; ITTI_LOG_LEVEL = "ERROR"; MME_SCENARIO_PLAYER_LOG_LEVEL = "ERROR"; ASN1_VERBOSITY = "INFO"; diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b7b365741c..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 @@ -938,10 +832,6 @@ add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only vali add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????") add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????") -add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams") -add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") -add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") - add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") @@ -1019,7 +909,6 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE ########################## #add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") #add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") -add_definitions(-DNEW_GTPU=1) ########################## # RRC LAYER OPTIONS @@ -1097,8 +986,7 @@ include_directories("${OPENAIR3_DIR}/S1AP") include_directories("${OPENAIR2_DIR}/X2AP") include_directories("${OPENAIR2_DIR}/M2AP") include_directories("${OPENAIR2_DIR}/F1AP") -include_directories("${OPENAIR3_DIR}/UDP") -include_directories("${OPENAIR3_DIR}/GTPV1-U") +include_directories("${OPENAIR3_DIR}/ocp-gtpu") include_directories("${OPENAIR3_DIR}/M3AP") include_directories("${OPENAIR3_DIR}/MME_APP") include_directories("${OPENAIR_DIR}/targets/COMMON") @@ -1111,7 +999,6 @@ include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/S1AP") include_directories("${OPENAIR2_DIR}/UTIL/OSA") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") -include_directories("${OPENAIR2_DIR}/LAYER2/PROTO_AGENT") include_directories("${OPENAIR2_DIR}/UTIL/MEM") include_directories("${OPENAIR2_DIR}/UTIL/LISTS") include_directories("${OPENAIR2_DIR}/UTIL/FIFO") @@ -1124,8 +1011,6 @@ include_directories("${OPENAIR2_DIR}/UTIL/CLI") include_directories("${OPENAIR2_DIR}/UTIL/OPT") include_directories("${OPENAIR2_DIR}/UTIL/OMV") include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES") -include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared") -include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include") include_directories("${OPENAIR_DIR}") # Utilities Library @@ -1270,27 +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) - -add_library(PROTO_AGENT - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c - ) -set(PROTO_AGENT_LIB PROTO_AGENT) -include_directories(${OPENAIR2_DIR}/LAYER2/PROTO_AGENT) - - - set(PROTOBUF_LIB "protobuf-c") #set(PROTOBUF_LIB "protobuf") #for Cpp @@ -1301,60 +1165,19 @@ add_library(HASHTABLE ) include_directories(${OPENAIR_DIR}/common/utils/hashtable) -add_library(msc MODULE ${OPENAIR_DIR}/common/utils/msc/msc.c ) -target_link_libraries (msc LFDS) - -include_directories(${OPENAIR_DIR}/common/utils/msc) - -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 @@ -1617,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 ) @@ -1754,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} @@ -1808,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 @@ -2036,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 ) @@ -2161,7 +1982,6 @@ add_library(L2_NR ${MAC_NR_SRC} ${GNB_APP_SRC} ) -target_compile_definitions(L2_NR PUBLIC NEW_GTPU) add_library(L2_LTE_NR ${L2_RRC_SRC} @@ -2169,7 +1989,6 @@ add_library(L2_LTE_NR ${ENB_APP_SRC} ${MCE_APP_SRC} ) -target_compile_definitions(L2_LTE_NR PUBLIC NEW_GTPU) add_dependencies(L2_NR rrc_flag nr_rrc_flag s1ap_flag x2_flag) @@ -2210,32 +2029,14 @@ add_library(CN_UTILS ${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c ) -set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U) - -add_library (GTPV1U_OCP +add_library (GTPV1U ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.c ${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp ) -target_compile_definitions(GTPV1U_OCP PUBLIC NEW_GTPU) -add_dependencies(GTPV1U_OCP rrc_flag) +add_dependencies(GTPV1U rrc_flag) include_directories(${OPENAIR3_DIR}/ocp-gtp) -#NR case -set (NR_GTPV1U_SRC - ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c - ${RRC_DIR}/rrc_eNB_GTPV1U.c - ${GTPV1U_DIR}/gtpv1u_eNB.c - ${GTPV1U_DIR}/gtpv1u_gNB.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c - ${GTPV1U_DIR}/gtpv1u_teid_pool.c - ) -add_library(NR_GTPV1U ${NR_GTPV1U_SRC}) -add_dependencies(NR_GTPV1U rrc_flag) - set (MME_APP_SRC ${OPENAIR3_DIR}/MME_APP/mme_app.c ${OPENAIR3_DIR}/MME_APP/mme_config.c @@ -2251,9 +2052,6 @@ set(SCTP_SRC add_library(SCTP_CLIENT ${SCTP_SRC}) add_dependencies(SCTP_CLIENT rrc_flag) -add_library(UDP ${OPENAIR3_DIR}/UDP/udp_eNB_task.c) -add_dependencies(UDP rrc_flag) - set(NAS_SRC ${OPENAIR3_DIR}/NAS/) set(libnas_api_OBJS ${NAS_SRC}COMMON/API/NETWORK/as_message.c @@ -2750,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 @@ -2779,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 @@ -2794,34 +2591,30 @@ 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) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} + ${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 (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 @@ -2837,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) @@ -2852,39 +2642,11 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l target_link_libraries (ocp-enb -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB 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 - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} + ${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}) - -add_executable(cu_test - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/cu_test.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c - ${T_SOURCE} -) -target_link_libraries(cu_test - ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB} - ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ITTI -) - -add_executable(du_test - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/du_test.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_handler.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_common.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_net_comm.c - ${OPENAIR2_DIR}/LAYER2/PROTO_AGENT/proto_agent_async.c - ${T_SOURCE} -) -target_link_libraries(du_test - ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FSPT_MSG_LIB} ${PROTOBUF_LIB} - ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ITTI -) +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 @@ -2893,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 @@ -2928,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} ) @@ -2946,13 +2700,13 @@ endif() target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB - SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON + SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -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 ${PROTOBUF_LIB} ${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}) @@ -2965,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 @@ -2975,75 +2728,31 @@ 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 ) -target_compile_definitions(nr-softmodem PUBLIC NEW_GTPU) target_link_libraries (nr-softmodem -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA - ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB + 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} ${FLEXRAN_AGENT_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 ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} + X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${FSPT_MSG_LIB} -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 UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA - ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${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 ####################################### @@ -3051,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 @@ -3063,28 +2771,24 @@ 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} ) target_link_libraries (nr-uesoftmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB + RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_USER_LIB S1AP_LIB S1AP_ENB - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} -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} ${PROTOBUF_LIB} ${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}) @@ -3092,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 @@ -3106,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} ) @@ -3140,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} ) @@ -3172,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} ) @@ -3187,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} ) @@ -3203,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} ) @@ -3219,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} ) @@ -3241,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 @@ -3260,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} ) @@ -3276,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 @@ -3286,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} ) @@ -3300,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_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} 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_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -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 @@ -3368,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) @@ -3389,13 +3019,13 @@ if (${T_TRACER}) ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai - coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO + coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB - CN_UTILS GTPV1U_OCP GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB - ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) + CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) endif() @@ -3487,31 +3117,26 @@ 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} ) -target_compile_definitions(nr-ittisim PUBLIC NEW_GTPU) target_link_libraries (nr-ittisim -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA - ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB + 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} ${FLEXRAN_AGENT_LIB} LFDS7 ${RAL_LIB} ${NAS_SIM_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 ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} + X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${FSPT_MSG_LIB} PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE -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/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index bd71125cf0..dc91f3c31c 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -409,7 +409,6 @@ set(emm_HDR add_library(emm ${emm_SRC} ${emm_HDR}) target_include_directories(emm PRIVATE - ${OPENAIR_DIR}/common/utils/msc ${OPENAIR_DIR}/common/utils ${OPENAIR_DIR}/openair2/COMMON ${OPENAIR_NAS_DIR}/UE @@ -693,7 +692,6 @@ include_directories( ${OPENAIR_TARGETS}/COMMON ${OPENAIR_NAS_DIR}/UE ${OPENAIR_DIR}/common/utils - ${OPENAIR_DIR}/common/utils/msc ${OPENAIR3_DIR}/COMMON ${OPENAIR3_DIR}/SECU ${OPENAIR_NAS_DIR}/src 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/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf index 7158790b28..df4ec5d01c 100755 --- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf +++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf @@ -165,19 +165,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf index 70819d0e29..f9bb8338bf 100755 --- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf +++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf @@ -165,19 +165,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf index 7381fefc1a..5c3d9214bc 100755 --- a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf +++ b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf @@ -165,19 +165,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf index 8eecfa2ac5..f214f12783 100755 --- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf +++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf @@ -165,19 +165,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf index ce2b71bdd2..f9f70281ca 100755 --- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf +++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf @@ -165,19 +165,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf index 11e6e24418..87deb03172 100755 --- a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf +++ b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf @@ -165,19 +165,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf index 11f6adbb4d..039b1d8aa3 100755 --- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf +++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf @@ -182,19 +182,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf index 3bf79f94bf..3c70040bfc 100755 --- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf +++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf @@ -182,19 +182,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf index 67a2bae08c..f9d3da2c35 100755 --- a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf +++ b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf @@ -182,19 +182,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf index 02f29c4c2e..c4b3e00a75 100755 --- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf +++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf @@ -184,19 +184,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf index 71a479a512..e2786ef21c 100755 --- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf +++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf @@ -184,19 +184,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf index 09958d62e4..8cd9bd6c67 100755 --- a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf +++ b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf @@ -184,19 +184,12 @@ eNBs = 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"; }; } ); diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 92bcfd88e2..930f2a7f77 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -39,35 +39,25 @@ 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 msc" +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/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template index 7a097fffb0..28da13437c 100755 --- a/cmake_targets/epc_test/CMakeLists.template +++ b/cmake_targets/epc_test/CMakeLists.template @@ -26,7 +26,6 @@ set ( LOG_NO_THREAD True ) set ( DEADLINE_SCHEDULER False ) set ( MAC_CONTEXT 1 ) set ( MAX_NUM_CCs 1 ) -set ( MESSAGE_CHART_GENERATOR False) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX False ) diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index e58f5c9bb1..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 } @@ -409,7 +410,6 @@ check_install_ubuntu_packages() { libxml2 \ libxml2-dev \ libxslt1-dev \ - mscgen \ octave-signal \ openssh-client \ openssh-server \ 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/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template index e62df04bc6..d2d2d3e053 100755 --- a/cmake_targets/s1c_mme_test/CMakeLists.template +++ b/cmake_targets/s1c_mme_test/CMakeLists.template @@ -26,7 +26,6 @@ set ( LOG_NO_THREAD True ) set ( DEADLINE_SCHEDULER False ) set ( MAC_CONTEXT 1 ) set ( MAX_NUM_CCs 1 ) -set ( MESSAGE_CHART_GENERATOR False) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX False ) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index ec5de6a0d1..55a39c6b2b 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -765,7 +765,6 @@ check_install_oai_software() { libxml2 \ libxml2-dev \ libxslt1-dev \ - mscgen \ octave-signal \ openssh-client \ openssh-server \ @@ -793,7 +792,7 @@ check_install_oai_software() { fi $SUDO $INSTALLER install -y python-epdb vim-common else - $SUDO $INSTALLER install -y mscgen pydb + $SUDO $INSTALLER install -y pydb fi $SUDO $INSTALLER install -y \ diff --git a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt index 238554f8e2..b55266dfe7 100755 --- a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt +++ b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt @@ -85,18 +85,7 @@ Tools available: 1) itti_analyser (list messages exchanged between protocol layers) 2) xforms (Layer 1) -3) mscgen (under construction, but can give some results now) - (http://www.mcternan.me.uk/mscgen/) - We use the software to generate sequence diagrams - with traces generated during the execution of the eNB. - After the enb execution: - yang@yang:...$ cd /tmp - yang@yang:/tmp$ /home/yang/openair4G/trunk/targets/SCRIPTS/msc_gen.py - The results are located in the current directory (/tmp in this example) in a folder. The name of the folder - is the current date (for example: 2015-04-08_20.34.10). - The results are input files for the mscgen tool containing events or messages and the - corresponding generated png files. -4) vcd (timing mesurements) +3) vcd (timing mesurements) diff --git a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt index 9996a53e19..805d121e6d 100755 --- a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt +++ b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt @@ -92,18 +92,7 @@ Tools available: 1) itti_analyser (list messages exchanged between protocol layers) 2) xforms (Layer 1) -3) mscgen (under construction, but can give some results now) - (http://www.mcternan.me.uk/mscgen/) - We use the software to generate sequence diagrams - with traces generated during the execution of the eNB. - After the enb execution: - yang@yang:...$ cd /tmp - yang@yang:/tmp$ /home/yang/openair4G/trunk/targets/SCRIPTS/msc_gen.py - The results are located in the current directory (/tmp in this example) in a folder. The name of the folder - is the current date (for example: 2015-04-08_20.34.10). - The results are input files for the mscgen tool containing events or messages and the - corresponding generated png files. -4) vcd (timing mesurements) +3) vcd (timing mesurements) diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp index 1a4c6b10b8..db22e31493 100755 --- a/cmake_targets/tools/run_enb_s1_usrp +++ b/cmake_targets/tools/run_enb_s1_usrp @@ -32,8 +32,6 @@ ################################ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) source $THIS_SCRIPT_PATH/build_helper -declare -i g_run_msc_gen=0 -declare g_msc_dir="/tmp" function help() @@ -55,7 +53,6 @@ function help() echo_error " -M, --target-dl-mcs mcs Downlink target MCS." echo_error " -n, --T-no-wait don't wait for tracer, start immediately" echo_error " -p, --T-port port use given port" - echo_error " -m, --mscgen directory Generate mscgen output files in a directory" echo_error " -s, --show-stdout Do not redirect stdout and stderr to file /tmp/lte_softmodem.stdout.txt." echo_error " -S, --enable-missed-slot Continue execution in case of missed slot." echo_error " -T, --target-ul-mcs mcs Uplink target MCS." @@ -68,30 +65,10 @@ function help() } -function do_msc_gen() -{ - cd $g_msc_dir - last_created_file=`ls -t mscgen* | head -1 | tr -d ':'` - $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py - sync - last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'` - - if [ x"$last_created_file" != x"$last_created_file2" ]; then - if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then - command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png - fi - fi - -} - - function control_c() # run if user hits control-c { echo_warning "\nExiting by ctrl+c\n" - if [ $g_run_msc_gen -eq 1 ]; then - do_msc_gen - fi exit $? } @@ -153,18 +130,6 @@ function main() exe_arguments="$exe_arguments --rf-config-file=$rf_config_file" fi ;; - -m | --mscgen) - g_msc_dir=$2 - # can omit file name if last arg on the line - if [ -d "$g_msc_dir" ]; then - echo "setting mscgen log files to dir: $g_msc_dir" - g_run_msc_gen=1 - shift 2; - else - echo_error "Mscgen log dir does not exist" - exit -1 - fi - ;; -M | --target-dl-mcs) echo "setting target dl MCS to $2" exe_arguments="$exe_arguments -m $2" @@ -251,9 +216,6 @@ function main() else gdb -n -x ~/.gdb_lte_softmodem fi - if [ $g_run_msc_gen -eq 1 ]; then - do_msc_gen - fi fi } diff --git a/cmake_targets/tools/run_enb_ue_virt_noS1 b/cmake_targets/tools/run_enb_ue_virt_noS1 index 79d5bc35dc..5f8e7e5374 100755 --- a/cmake_targets/tools/run_enb_ue_virt_noS1 +++ b/cmake_targets/tools/run_enb_ue_virt_noS1 @@ -57,7 +57,6 @@ function help() echo_error " -l, --log-level set the global log level (8:trace, 7:debug, 6:info, 4:warn, 3:error). Note that the log configuration is eNB config file is ignored for oaisim." echo_error " -h, --help Print this help." echo_error " -K, --itti-dump-file filename ITTI dump file containing all ITTI events occuring during EPC runtime.(can omit file name if last argument)" - echo_error " -m, --mscgen directory Generate mscgen output files in a directory" echo_error " -V, --vcd Dump timings of processing in a GTKWave compliant file format." echo_error " -W, --wireshark-l2 Dump MAC frames for visualization with wireshark." echo_error " You need to open Wireshark, open the preferences, and check try heuristics for the UDP protocol, MAC-LTE, RLC-LTE," @@ -75,11 +74,9 @@ function main() cecho "OPENAIR_DIR = $OPENAIR_DIR" $green local -i run_gdb=0 - local -i run_mscgen=0 local exe_arguments="" local DEFAULT_CONFIG_FILE_ENB=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf local CONFIG_FILE_ENB=$DEFAULT_CONFIG_FILE_ENB - local MSC_DIR="/tmp" local abstraction_flag=0 until [ -z "$1" ] @@ -136,17 +133,6 @@ function main() exe_arguments="$exe_arguments -K $ITTI_DUMP_FILE" ;; - -m | --mscgen) - MSC_DIR=$2 - if [ -d "$MSC_DIR" ]; then - echo "setting mscgen log files to dir: $MSC_DIR" - run_mscgen=1 - shift 2; - else - echo_error "Mscgen log dir does not exist" - exit -1 - fi - ;; # -u | --num-ue ) -V | --vcd) @@ -212,10 +198,6 @@ function main() cd $OPENAIR_DIR/targets/bin - if [ $run_mscgen -eq 1 ]; then - $SUDO rm -f /tmp/openair.msc.* - fi - if [ $run_gdb -eq 0 ]; then exec $SUDO $OPENAIR_DIR/targets/bin/oaisim_nos1.Rel14 $exe_arguments | tee /tmp/enb_ue_nos1.log.txt else @@ -227,20 +209,6 @@ function main() cat ~/.gdb_enb_ue_nos1 $SUDO gdb -n -x ~/.gdb_enb_ue_nos1 fi - - if [ $run_mscgen -eq 1 ]; then - cd $MSC_DIR - last_created_file=`ls -t mscgen* | head -1 | tr -d ':'` - $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py --profile E_UTRAN - sync - last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'` - - if [ x"$last_created_file" != x"$last_created_file2" ]; then - if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then - command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png - fi - fi - fi } main "$@" diff --git a/cmake_targets/tools/run_enb_ue_virt_s1 b/cmake_targets/tools/run_enb_ue_virt_s1 index 50fc819ec8..76bc3c2b39 100755 --- a/cmake_targets/tools/run_enb_ue_virt_s1 +++ b/cmake_targets/tools/run_enb_ue_virt_s1 @@ -81,7 +81,6 @@ function help() echo_error " -g, --gdb Run with GDB." echo_error " -h, --help Print this help." echo_error " -K, --itti-dump-file filename ITTI dump file containing all ITTI events occuring during EPC runtime.(can omit file name if last argument)" - echo_error " -m, --mscgen directory Generate mscgen output files in a directory" echo_error " -V, --vcd Dump timings of processing in a GTKWave compliant file format." echo_error " -W, --wireshark-l2 Dump MAC frames for visualization with wireshark." echo_error " You need to open Wireshark, open the preferences, and check try heuristics for the UDP protocol, MAC-LTE, RLC-LTE," @@ -100,11 +99,9 @@ function main() cecho "OPENAIR_DIR = $OPENAIR_DIR" $green local -i run_gdb=0 - local -i run_mscgen=0 local exe_arguments="" local DEFAULT_CONFIG_FILE_ENB=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_mme.conf local CONFIG_FILE_ENB=$DEFAULT_CONFIG_FILE_ENB - local MSC_DIR="/tmp" until [ -z "$1" ] do @@ -160,19 +157,6 @@ function main() exe_arguments="$exe_arguments -K $ITTI_DUMP_FILE" ;; - -m | --mscgen) - MSC_DIR=$2 - # can omit file name if last arg on the line - if [ -d "$MSC_DIR" ]; then - echo "setting mscgen log files to dir: $MSC_DIR" - run_mscgen=1 - shift 2; - else - echo_error "Mscgen log dir does not exist" - exit -1 - fi - ;; - -V | --vcd) echo "setting gtk-wave output" exe_arguments="$exe_arguments -V /tmp/oai_gtk_wave.vcd" @@ -258,10 +242,6 @@ function main() cd $OPENAIR_DIR/targets/bin - if [ $run_mscgen -eq 1 ]; then - rm -f /tmp/openair.msc.* - fi - if [ $run_gdb -eq 0 ]; then exec $OPENAIR_DIR/targets/bin/oaisim.Rel14 $exe_arguments | tee /tmp/enb_ue_s1.log.txt else @@ -273,21 +253,6 @@ function main() cat ~/.gdb_enb_ue_s1 gdb -n -x ~/.gdb_enb_ue_s1 fi - - if [ $run_mscgen -eq 1 ]; then - cd $MSC_DIR - last_created_file=`ls -t mscgen* | head -1 | tr -d ':'` - $OPENAIR_DIR/targets/SCRIPTS/msc_gen.py --profile E_UTRAN - sync - last_created_file2=`ls -t mscgen* | head -1 | tr -d ':'` - - if [ x"$last_created_file" != x"$last_created_file2" ]; then - if [ -f ./$last_created_file2/oai_mscgen_page_0.png ]; then - command -v eog 2>/dev/null && eog ./$last_created_file2/oai_mscgen_page_0.png - fi - fi - fi - } sudo echo diff --git a/common/config/DOC/config/rtusage.md b/common/config/DOC/config/rtusage.md index 10cbee2495..8db58ddac3 100644 --- a/common/config/DOC/config/rtusage.md +++ b/common/config/DOC/config/rtusage.md @@ -65,7 +65,6 @@ To get help on supported parameters you can use specific options: -R: Enable online log -g: Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error)) --telnetsrv: Start embedded telnet server - --msc: Enable the MSC tracing utility -------------------------------------------------------------------- [LIBCONFIG] loader: 2/2 parameters successfully set, (2 to default value) diff --git a/common/ran_context.h b/common/ran_context.h index db981e9182..055c6f783e 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -42,17 +42,11 @@ //#include "ENB_APP/enb_config.h" #include "flexran_agent_defs.h" -#include "gtpv1u.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uMsg.h" -#include "NwGtpv1uPrivate.h" -#include "gtpv1u_eNB_defs.h" -#include "gtpv1u_gNB_defs.h" - #include "PHY/defs_L1_NB_IoT.h" #include "RRC/LTE/defs_NB_IoT.h" #include "RRC/LTE/rrc_defs.h" #include "RRC/NR/nr_rrc_defs.h" +#include typedef struct { @@ -110,8 +104,6 @@ typedef struct { struct gNB_MAC_INST_s **nrmac; /// GTPu descriptor gtpv1u_data_t *gtpv1u_data_g; - /// NR GTPu descriptor - nr_gtpv1u_data_t *nr_gtpv1u_data_g; /// RU descriptors. These describe what each radio unit is supposed to do and contain the necessary functions for fronthaul interfaces struct RU_t_s **ru; /// Mask to indicate fronthaul setup status of RU (hard-limit to 64 RUs) diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md index 041c29e688..2f6fa5e6ea 100644 --- a/common/utils/LOG/DOC/rtusage.md +++ b/common/utils/LOG/DOC/rtusage.md @@ -49,7 +49,6 @@ The list of components defined within oai can be retrieved from the [config mod [CONFIG] log_config.perf_log_level set to default value "info" [CONFIG] log_config.oip_log_level set to default value "info" [CONFIG] log_config.cli_log_level set to default value "info" -[CONFIG] log_config.msc_log_level set to default value "info" [CONFIG] log_config.ocm_log_level set to default value "info" [CONFIG] log_config.udp_log_level set to default value "info" [CONFIG] log_config.gtpv1u_log_level set to default value "info" @@ -108,8 +107,6 @@ The list of components defined within oai can be retrieved from the [config mod [CONFIG] log_config.oip_log_infile set to default value [CONFIG] cli_log_infile: 0 [CONFIG] log_config.cli_log_infile set to default value -[CONFIG] msc_log_infile: 0 -[CONFIG] log_config.msc_log_infile set to default value [CONFIG] ocm_log_infile: 0 [CONFIG] log_config.ocm_log_infile set to default value [CONFIG] udp_log_infile: 0 diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index 29e4f718c6..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) @@ -449,7 +459,6 @@ int logInit (void) register_log_component("OCG","",OCG); register_log_component("PERF","",PERF); register_log_component("OIP","",OIP); - register_log_component("MSC","log",MSC); register_log_component("OCM","log",OCM); register_log_component("HW","",HW); register_log_component("OSA","",OSA); @@ -503,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 46c73427c1..1f19d55878 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -212,7 +212,6 @@ typedef enum { PERF, OIP, CLI, - MSC, OCM, UDP_, GTPU, @@ -303,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 ); @@ -473,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/assertions.h b/common/utils/assertions.h index d85dab79a0..573036b1d9 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -25,14 +25,21 @@ #include #include #include +#include +#include #include #include "backtrace.h" -#define _Assert_Exit_ \ - fprintf(stderr, "\nExiting execution\n"); \ - fflush(stdout); \ - fflush(stderr); \ - abort(); +#define _Assert_Exit_ \ + if (getenv("gdbStacks")) { \ + char tmp [1000]; \ + sprintf(tmp,"gdb -ex='set confirm off' -ex 'thread apply all bt' -ex q -p %d < /dev/null", getpid()); \ + __attribute__((unused)) int dummy=system(tmp); \ + } \ + fprintf(stderr, "\nExiting execution\n"); \ + fflush(stdout); \ + fflush(stderr); \ + abort(); #define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ do { \ 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/lte/ue_power.h b/common/utils/lte/ue_power.h deleted file mode 100644 index caeebec2c8..0000000000 --- a/common/utils/lte/ue_power.h +++ /dev/null @@ -1,34 +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 ue_power.h -* \brief support routines used in MAC and PHY -* \author R. Knopp, F. Kaltenberger -* \date 2020 -* \version 0.1 -* \company Eurecom -* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr -* \note -* \warning -*/ - -int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs); - diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c deleted file mode 100644 index 84b723b022..0000000000 --- a/common/utils/msc/msc.c +++ /dev/null @@ -1,785 +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 msc.c - * \brief Message chart generator logging utility (generated files to processed by a script to produce a mscgen input file for generating a sequence diagram document) - * \author Lionel GAUTHIER - * \date 2015 - * \email: lionel.gauthier@eurecom.fr - */ -#include -#include -#include -#include -#include -#include - -#define MSC_LIBRARY -#include "msc.h" - -#include "liblfds611.h" -#include "intertask_interface.h" - - - -#include "assertions.h" - -//------------------------------- -#define MSC_MAX_QUEUE_ELEMENTS 1024 -#define MSC_MAX_PROTO_NAME_LENGTH 16 -#define MSC_MAX_MESSAGE_LENGTH 512 - -//------------------------------- - -FILE *g_msc_fd; -char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH]; - -msc_interface_t msc_interface; - -typedef unsigned long msc_message_number_t; -typedef struct msc_queue_item_s { - char *message_str; - uint32_t message_str_size; - uint8_t *message_bin; - uint32_t message_bin_size; -} msc_queue_item_t; - -msc_message_number_t g_message_number = 0; -struct lfds611_queue_state *g_msc_message_queue_p = NULL; -struct lfds611_stack_state *g_msc_memory_stack_p = NULL; - -//------------------------------------------------------------------------------ -void *msc_task(void *args_p) -//------------------------------------------------------------------------------ -{ - MessageDef *received_message_p = NULL; - // const char *msg_name = NULL; - // instance_t instance = 0; - long timer_id; - itti_mark_task_ready(TASK_MSC); - msc_start_use(); - timer_setup(0, // seconds - 50000, // usec - TASK_MSC, - INSTANCE_DEFAULT, - TIMER_PERIODIC, - NULL, - &timer_id); - - while(1) { - itti_receive_msg(TASK_MSC, &received_message_p); - - if (received_message_p != NULL) { - // msg_name = ITTI_MSG_NAME (received_message_p); - // instance = ITTI_MSG_DESTINATION_INSTANCE (received_message_p); - switch (ITTI_MSG_ID(received_message_p)) { - case TIMER_HAS_EXPIRED: { - msc_flush_messages(); - } - break; - - case TERMINATE_MESSAGE: { - fprintf(stderr, " *** Exiting MSC thread\n"); - timer_remove(timer_id); - msc_end(); - itti_exit_task(); - } - break; - - case MESSAGE_TEST: { - } - break; - - default: { - } - break; - } - } - } - - fprintf(stderr, "Task MSC exiting\n"); - return NULL; -} - -//------------------------------------------------------------------------------ -int msc_init(const msc_env_t envP, const int max_threadsP) -//------------------------------------------------------------------------------ -{ - int i; - int rv; - void *pointer_p; - char msc_filename[256]; - fprintf(stderr, "Initializing MSC logs\n"); - rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%i.log", envP); // TODO NAME - - if ((0 >= rv) || (256 < rv)) { - fprintf(stderr, "Error in MSC log file name"); - } - - g_msc_fd = fopen(msc_filename,"w"); - AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno)); - rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2); - - if (0 >= rv) { - AssertFatal (0, "lfds611_stack_new failed!\n"); - } - - rv = lfds611_queue_new(&g_msc_message_queue_p, (lfds611_atom_t)MSC_MAX_QUEUE_ELEMENTS); - AssertFatal (rv, "lfds611_queue_new failed!\n"); - AssertFatal (g_msc_message_queue_p != NULL, "g_msc_message_queue_p is NULL!\n"); - msc_start_use(); - - for (i=0; i < max_threadsP * 30; i++) { - pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH); - AssertFatal (pointer_p, "malloc failed!\n"); - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p ); - AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %d\n", i); - } - - for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) { - switch (i) { - case MSC_IP_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_IP_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if (envP == MSC_E_UTRAN_LIPA) { - msc_log_declare_proto(i); - } - - break; - - case MSC_NAS_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_RRC_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_PDCP_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_RLC_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_MAC_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_PHY_UE: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_PHY_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_MAC_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_RLC_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_PDCP_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_RRC_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_S1AP_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_GTPU_ENB: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_GTPU_SGW: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_S1AP_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_MMEAPP_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_NAS_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - msc_log_declare_proto(i); - break; - - case MSC_NAS_EMM_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_NAS_ESM_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_SP_GWAPP_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if (envP == MSC_MME_GW) { - msc_log_declare_proto(i); - } - - break; - - case MSC_S11_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if (envP == MSC_MME) { - msc_log_declare_proto(i); - } - - break; - - case MSC_S6A_MME: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - } - - break; - - case MSC_HSS: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - - if ((envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - } - - break; - case MSC_F1AP_CU: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_CU"); - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} - //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - //} - break; - case MSC_F1AP_DU: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_DU"); - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} - //if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) { - msc_log_declare_proto(i); - //} - break; - default: - rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN"); - - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) { - g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0; - } - } - } - - rv = itti_create_task (TASK_MSC, msc_task, NULL); - AssertFatal (rv == 0, "Create task for MSC failed!\n"); - fprintf(stderr, "Initializing MSC logs Done\n"); - return 0; -} - -//------------------------------------------------------------------------------ -void msc_start_use(void) -//------------------------------------------------------------------------------ -{ - lfds611_queue_use(g_msc_message_queue_p); - lfds611_stack_use(g_msc_memory_stack_p); -} - - -//------------------------------------------------------------------------------ -void msc_flush_messages(void) -//------------------------------------------------------------------------------ -{ - int rv; - msc_queue_item_t *item_p = NULL; - - while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void **)&item_p )) == 1) { - if (NULL != item_p->message_str) { - fputs(item_p->message_str, g_msc_fd); - // TODO BIN DATA - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str ); - } - - // TODO FREE BIN DATA - free(item_p); - } - - fflush(g_msc_fd); -} - - -//------------------------------------------------------------------------------ -void msc_end(void) -//------------------------------------------------------------------------------ -{ - int rv; - - if (NULL != g_msc_fd ) { - msc_flush_messages(); - rv = fflush(g_msc_fd); - - if (rv != 0) { - fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno)); - } - - rv = fclose(g_msc_fd); - - if (rv != 0) { - fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno)); - } - } -} - -//------------------------------------------------------------------------------ -void msc_log_declare_proto( - const msc_proto_t protoP -) -//------------------------------------------------------------------------------ -{ - int rv = 0; - msc_queue_item_t *new_item_p = NULL; - char *char_message_p = NULL; - - if ((MIN_MSC_PROTOS <= protoP) && (MAX_MSC_PROTOS > protoP)) { - // may be build a memory pool for that also ? - new_item_p = malloc(sizeof(msc_queue_item_t)); - - if (NULL != new_item_p) { - rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p); - - if (0 == rv) { - msc_flush_messages(); - rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p); - } - - if (1 == rv) { - rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [PROTO] %d %s\n", __sync_fetch_and_add (&g_message_number, 1), protoP, &g_msc_proto2str[protoP][0]); - - if (0 > rv) { - fprintf(stderr, "Error while declaring new protocol in MSC: %s", strerror(errno)); - } - - new_item_p->message_str = char_message_p; - new_item_p->message_str_size = rv; - new_item_p->message_bin = NULL; - new_item_p->message_bin_size = 0; - rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p ); - - if (0 == rv) { - rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p ); - - if (0 == rv) { - fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p); - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p ); - free(new_item_p); - } - } - - return; - } else { - fprintf(stderr, "Error while lfds611_stack_pop()\n"); - } - - free(new_item_p); - } else { - fprintf(stderr, "Error while malloc in MSC"); - } - } -} -//------------------------------------------------------------------------------ -void msc_log_event( - const msc_proto_t protoP, - char *format, ...) -//------------------------------------------------------------------------------ -{ - va_list args; - int rv; - int rv2; - msc_queue_item_t *new_item_p = NULL; - char *char_message_p = NULL; - - if ((MIN_MSC_PROTOS > protoP) || (MAX_MSC_PROTOS <= protoP)) { - return; - } - - new_item_p = malloc(sizeof(msc_queue_item_t)); - - if (NULL != new_item_p) { - rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p); - - if (0 == rv) { - msc_flush_messages(); - rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p); - } - - if (1 == rv) { - rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [EVENT] %d ", __sync_fetch_and_add (&g_message_number, 1), protoP); - - if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) { - fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]); - goto error_event; - } - - va_start(args, format); - rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args); - va_end(args); - - if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) { - fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]); - goto error_event; - } - - rv += rv2; - rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n"); - - if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) { - fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]); - goto error_event; - } - - rv += rv2; - new_item_p->message_str = char_message_p; - new_item_p->message_str_size = rv; - new_item_p->message_bin = NULL; - new_item_p->message_bin_size = 0; - rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p ); - - if (0 == rv) { - fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p); - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p ); - free(new_item_p); - } - } else { - fprintf(stderr, "Error while lfds611_stack_pop()\n"); - } - } - - return; -error_event: - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p ); - free(new_item_p); -} -//------------------------------------------------------------------------------ -void msc_log_message( - const char *const message_operationP, - const msc_proto_t proto1P, - const msc_proto_t proto2P, - const uint8_t *const bytesP, - const unsigned int num_bytes, - char *format, ...) -//------------------------------------------------------------------------------ -{ - va_list args; - uint64_t mac = 0; // TO DO mac on bytesP param - int rv; - int rv2; - msc_queue_item_t *new_item_p = NULL; - char *char_message_p = NULL; - - if ((MIN_MSC_PROTOS > proto1P) || (MAX_MSC_PROTOS <= proto1P) || - (MIN_MSC_PROTOS > proto2P) || (MAX_MSC_PROTOS <= proto2P) ) { - return; - } - - new_item_p = malloc(sizeof(msc_queue_item_t)); - - if (NULL != new_item_p) { - rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p); - - if (0 == rv) { - msc_flush_messages(); - rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p); - } - - if (1 == rv) { - rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [MESSAGE] %d %s %d %"PRIu64" ", - __sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac); - - if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) { - fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]); - goto error_event; - } - - va_start(args, format); - rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, format, args); - va_end(args); - - if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) { - fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]); - goto error_event; - } - - rv += rv2; - rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n"); - - if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) { - fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]); - goto error_event; - } - - rv += rv2; - new_item_p->message_str = char_message_p; - new_item_p->message_str_size = rv; - new_item_p->message_bin = NULL; // TO DO - new_item_p->message_bin_size = 0; // TO DO - rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p ); - - if (0 == rv) { - fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p); - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p ); - free(new_item_p); - } - } else { - fprintf(stderr, "Error while lfds611_stack_pop()\n"); - msc_flush_messages(); - } - } - - return; -error_event: - rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p ); - free(new_item_p); -} - -//------------------------------------------------------------------------------ -// function called when oai loader loads the msc shared lib -int msc_autoinit(msc_interface_t *msc_interface) -//------------------------------------------------------------------------------ -{ - msc_interface->msc_init = msc_init; - msc_interface->msc_start_use = msc_start_use; - msc_interface->msc_end = msc_end; - msc_interface->msc_log_event = msc_log_event; - msc_interface->msc_log_message = msc_log_message; - msc_interface->msc_loaded = 1; - return 0; -} diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h deleted file mode 100644 index adb0d9e657..0000000000 --- a/common/utils/msc/msc.h +++ /dev/null @@ -1,131 +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 - */ - -#ifndef MSC_H_ -#define MSC_H_ -#include -#include - -typedef enum { - MIN_MSC_ENV = 0, - MSC_E_UTRAN = MIN_MSC_ENV, - MSC_E_UTRAN_LIPA, - MSC_MME_GW, - MSC_MME, - MSC_SP_GW, - MAX_MSC_ENV -} msc_env_t; - - -typedef enum { - MIN_MSC_PROTOS = 0, - MSC_IP_UE = MIN_MSC_PROTOS, - MSC_NAS_UE, - MSC_RRC_UE, - MSC_PDCP_UE, - MSC_RLC_UE, - MSC_MAC_UE, - MSC_PHY_UE, - MSC_PHY_ENB, - MSC_MAC_ENB, - MSC_RLC_ENB, - MSC_PDCP_ENB, - MSC_PDCP_GNB, - MSC_RRC_ENB, - MSC_RRC_GNB, - MSC_IP_ENB, - MSC_S1AP_ENB, - MSC_NGAP_GNB, - MSC_GTPU_ENB, - MSC_GTPU_GNB, - MSC_GTPU_SGW, - MSC_S1AP_MME, - MSC_NGAP_AMF, - MSC_MMEAPP_MME, - MSC_NAS_MME, - MSC_NAS_EMM_MME, - MSC_NAS_ESM_MME, - MSC_SP_GWAPP_MME, - MSC_S11_MME, - MSC_S6A_MME, - MSC_HSS, - MSC_F1AP_CU, - MSC_F1AP_DU, - MSC_X2AP_SRC_ENB, - MSC_X2AP_TARGET_ENB, - MAX_MSC_PROTOS, -} msc_proto_t; - - - -// Access stratum -#define MSC_AS_TIME_FMT "%05u:%02u" - -#define MSC_AS_TIME_ARGS(CTXT_Pp) \ - (CTXT_Pp)->frame, \ - (CTXT_Pp)->subframe - -typedef int(*msc_init_t)(const msc_env_t, const int ); -typedef void(*msc_start_use_t)(void ); -typedef void(*msc_end_t)(void); -typedef void(*msc_log_event_t)(const msc_proto_t,char *, ...); -typedef void(*msc_log_message_t)(const char *const, const msc_proto_t, const msc_proto_t, - const uint8_t *const, const unsigned int, char *, ...); -typedef struct msc_interface { - int msc_loaded; - msc_init_t msc_init; - msc_start_use_t msc_start_use; - msc_end_t msc_end; - msc_log_event_t msc_log_event; - msc_log_message_t msc_log_message; -} msc_interface_t; - -#ifdef MSC_LIBRARY -int msc_init(const msc_env_t envP, const int max_threadsP); -void msc_start_use(void); -void msc_flush_messages(void); -void msc_end(void); -void msc_log_declare_proto(const msc_proto_t protoP); -void msc_log_event(const msc_proto_t protoP,char *format, ...); -void msc_log_message( - const char *const message_operationP, - const msc_proto_t receiverP, - const msc_proto_t senderP, - const uint8_t *const bytesP, - const unsigned int num_bytes, - char *format, ...); - -#else - -#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded - -extern msc_interface_t msc_interface; -#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2) -#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use -#define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end -#define MSC_LOG_EVENT(mScPaRaMs, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_event(mScPaRaMs, fORMAT, ##aRGS) -#define MSC_LOG_RX_MESSAGE(rECEIVER, sENDER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("<-",rECEIVER, sENDER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS) -#define MSC_LOG_RX_DISCARDED_MESSAGE(rECEIVER, sENDER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("x-",rECEIVER, sENDER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS) -#define MSC_LOG_TX_MESSAGE(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("->",sENDER, rECEIVER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS) -#define MSC_LOG_TX_MESSAGE_FAILED(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("-x",sENDER, rECEIVER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS) -#endif - -#endif diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 4950b29bf3..49743b3bdc 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: @@ -231,7 +252,6 @@ uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) { } } - void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) { uint8_t count=0, start=0, start_set=0; @@ -483,6 +503,7 @@ int get_nr_table_idx(int nr_bandP, uint8_t scs_index) { return i; } + int get_subband_size(int NPRB,int size) { // implements table 5.2.1.4-2 from 36.214 // 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/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 3188e5889f..e595311b26 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -256,8 +256,8 @@ typedef struct IttiMsgText_s { #include //#include -#include -#include +#include +#include void *rrc_enb_process_itti_msg(void *); #include #include @@ -338,10 +338,7 @@ void *rrc_enb_process_msg(void *); TASK_DEF(TASK_RRC_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ - TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\ TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ - TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ - TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\ TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \ @@ -560,7 +557,6 @@ MessageDef *itti_alloc_new_message_sized( This function should be called from the main thread after having created all ITTI tasks. **/ void itti_wait_tasks_end(void); -#define ADDED_QUEUES_MAX 10 // Fix me: MSC component too hard to understand, we keep room for 10 queues created dynamically void itti_set_task_real_time(task_id_t task_id); /** \brief Send a termination message to all tasks. diff --git a/common/utils/telnetsrv/DOC/telnetlog.md b/common/utils/telnetsrv/DOC/telnetlog.md index 36c5cfb348..cb008fc8bb 100644 --- a/common/utils/telnetsrv/DOC/telnetlog.md +++ b/common/utils/telnetsrv/DOC/telnetlog.md @@ -62,7 +62,6 @@ component verbosity level enabled 16 PERF: medium info N 17 OIP: medium info N 18 CLI: medium info N -19 MSC: medium info N 20 OCM: medium info N 21 UDP: medium info N 22 GTPV1U: medium info N 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/configuration/bladeRF/enb-band7-5mhz.conf b/configuration/bladeRF/enb-band7-5mhz.conf index 9d19207522..985f4eb378 100644 --- a/configuration/bladeRF/enb-band7-5mhz.conf +++ b/configuration/bladeRF/enb-band7-5mhz.conf @@ -206,19 +206,12 @@ eNBs = log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="debug"; - rlc_log_verbosity ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; } @@ -267,17 +260,10 @@ RUs = ( log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; 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 0e77cfa580..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() @@ -369,7 +365,7 @@ gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the o # New GTP ## initialization -ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything +gtpv1uTask(): this creates only the thread, doesn't configure anything gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address ## newGtpuCreateTunnel() 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/doc/testing_gnb_w_cots_ue_resources/enb.conf b/doc/testing_gnb_w_cots_ue_resources/enb.conf index a6bbd98bda..027b6f2499 100755 --- a/doc/testing_gnb_w_cots_ue_resources/enb.conf +++ b/doc/testing_gnb_w_cots_ue_resources/enb.conf @@ -206,19 +206,12 @@ eNBs = log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="debug"; - rlc_log_verbosity ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; } @@ -267,17 +260,10 @@ RUs = ( log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; diff --git a/doc/testing_gnb_w_cots_ue_resources/gnb.conf b/doc/testing_gnb_w_cots_ue_resources/gnb.conf index aae22a92ba..c96d207445 100755 --- a/doc/testing_gnb_w_cots_ue_resources/gnb.conf +++ b/doc/testing_gnb_w_cots_ue_resources/gnb.conf @@ -258,18 +258,11 @@ security = { 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"; }; diff --git a/doc/testing_gnb_w_cots_ue_resources/oai_enb.log b/doc/testing_gnb_w_cots_ue_resources/oai_enb.log index 9b9de24a86..7356c0c88d 100755 --- a/doc/testing_gnb_w_cots_ue_resources/oai_enb.log +++ b/doc/testing_gnb_w_cots_ue_resources/oai_enb.log @@ -62,7 +62,6 @@ ITTI init, useMME: 1 [TMR] Starting itti queue: TASK_RRC_UE as task 31 [TMR] Starting itti queue: TASK_NAS_UE as task 32 [TMR] Starting itti queue: TASK_RAL_UE as task 33 -[TMR] Starting itti queue: TASK_MSC as task 34 [TMR] Starting itti queue: TASK_GTPV1_U as task 35 [TMR] Starting itti queue: TASK_UDP as task 36 [TMR] Starting itti queue: TASK_CU_F1 as task 37 diff --git a/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log b/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log index 37b3c10516..3c76c0d0d6 100755 --- a/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log +++ b/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log @@ -58,7 +58,6 @@ CPU Freq is 3.092986 [TMR] Starting itti queue: TASK_RRC_UE as task 31 [TMR] Starting itti queue: TASK_NAS_UE as task 32 [TMR] Starting itti queue: TASK_RAL_UE as task 33 -[TMR] Starting itti queue: TASK_MSC as task 34 [TMR] Starting itti queue: TASK_GTPV1_U as task 35 [TMR] Starting itti queue: TASK_UDP as task 36 [TMR] Starting itti queue: TASK_CU_F1 as task 37 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-common.h b/executables/nr-softmodem-common.h index 45d7852adc..47fd816db5 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -104,7 +104,6 @@ #define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n" #define CONFIG_HLP_LOGV "Set the global log verbosity \n" #define CONFIG_HLP_TELN "Start embedded telnet server \n" -#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n" #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CONFIG_HLP_NOS1 "Disable s1 interface\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" @@ -112,13 +111,11 @@ /* command line parameters for LOG utility */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------*/ -#define START_MSC softmodem_params.start_msc #define CMDLINE_LOGPARAMS_DESC_NR { \ {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {"G" , CONFIG_HLP_LOGV, 0, uptr:&glog_verbosity, defintval:0, TYPE_UINT16, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ - {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ } #define CMDLINE_ONLINELOG_IDX 0 diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 5f57919645..ac5a1b0132 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -29,8 +29,6 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include -#include "msc.h" - #include "PHY/types.h" #include "common/ran_context.h" @@ -64,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" @@ -365,7 +361,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { //Use check on x2ap to consider the NSA scenario and check on AMF_MODE_ENABLED for the SA scenario if(is_x2ap_enabled() || AMF_MODE_ENABLED) { - if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) { + if (itti_create_task (TASK_GTPV1_U, >pv1uTask, NULL) < 0) { LOG_E(GTPU, "Create task for GTPV1U failed\n"); return -1; } @@ -589,48 +585,21 @@ static void wait_nfapi_init(char *thread_name) { } void init_pdcp(void) { + uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? + PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT: + LINK_ENB_PDCP_TO_GTPV1U_BIT; + if (!get_softmodem_params()->nsa) { if (!NODE_IS_DU(RC.nrrrc[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; - } - + pdcp_layer_init(); nr_pdcp_module_init(pdcp_initmask, 0); - - if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { - LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); - } else { - LOG_I(PDCP, "node is gNB \n"); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); - } - } else { - LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); } } else { 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((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); } } - int main( int argc, char **argv ) { int ru_id, CC_id = 0; start_background_system(); @@ -684,7 +653,6 @@ int main( int argc, char **argv ) { cpuf=get_cpu_freq_GHz(); itti_init(TASK_MAX, tasks_info); // initialize mscgen log after ITTI - MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); if(PDCP_USE_NETLINK && !IS_SOFTMODEM_NOS1) { netlink_init(); diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 4190a6074b..834e89b403 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -5,7 +5,6 @@ #include "flexran_agent.h" #include "PHY/defs_gNB.h" -#include "proto_agent.h" #define DEFAULT_DLF 2680000000 @@ -65,5 +64,6 @@ void init_gNB_afterRU(void); extern int stop_L1L2(module_id_t gnb_id); extern int restart_L1L2(module_id_t gnb_id); +void init_pdcp(void); #endif diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 0a59ba3b6a..543be7a8b5 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -18,7 +18,8 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ - +#define _GNU_SOURCE +#include #include #include "executables/nr-uesoftmodem.h" #include "PHY/phy_extern_nr_ue.h" @@ -166,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); @@ -765,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 462a07c707..0000000000 --- a/executables/ocp-gnb.c +++ /dev/null @@ -1,1007 +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; -msc_interface_t msc_interface; -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.c b/executables/softmodem-common.c index 3e20081b18..12c60e98fd 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -45,7 +45,6 @@ static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; -msc_interface_t msc_interface; int usrp_tx_thread = 0; uint8_t nfapi_mode=0; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 9aca677473..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,34 +157,29 @@ 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" #define CONFIG_HLP_FLOG "Enable online log \n" #define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n" -#define CONFIG_HLP_LOGV "Set the global log verbosity \n" #define CONFIG_HLP_TELN "Start embedded telnet server \n" -#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n" #define CONFIG_FLOG_OPT "R" #define CONFIG_LOGL_OPT "g" /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters for LOG utility */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*-------------------------------------------------------------------------------------------------------------------------------------------------*/ -#define START_MSC softmodem_params.start_msc #define CMDLINE_LOGPARAMS_DESC { \ {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ - {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \ } @@ -250,12 +244,10 @@ typedef struct { int chain_offset; int numerology; int band; - unsigned int start_msc; uint32_t clock_source; 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 f107b5b973..7fb42e566a 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 @@ -46,7 +46,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 3b429a5e84..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 @@ -444,7 +444,7 @@ typedef struct { uint8_t pucch_resource_id; uint8_t pdsch_to_harq_feedback_time_ind; uint8_t n_dmrs_cdm_groups; - uint8_t dmrs_ports[10]; + uint16_t dmrs_ports; uint8_t n_front_load_symb; uint8_t tci_state; fapi_nr_dl_srs_config_t srs_config; @@ -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/lte_init.c b/openair1/PHY/INIT/lte_init.c index 308a059d51..c92d926a8f 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -415,10 +415,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig, fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset ); - LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_eNB][MOD %02"PRIu8"][]\n", eNB->Mod_id); LOG_I (PHY, "[eNB %" PRIu8 "] Initializing DL_FRAME_PARMS : N_RB_DL %" PRIu8 ", PHICH Resource %d, PHICH Duration %d\n", eNB->Mod_id, fp->N_RB_DL, fp->phich_config_common.phich_resource, fp->phich_config_common.phich_duration); - LOG_D (PHY, "[MSC_NEW][FRAME 00000][PHY_eNB][MOD %02" PRIu8 "][]\n", eNB->Mod_id); crcTableInit(); lte_gold (fp, eNB->lte_gold_table, fp->Nid_cell); generate_pcfich_reg_mapping (fp); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 3bf450703c..bf360d347a 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -104,7 +104,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, load_dftslib(); - LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id); crcTableInit(); init_scrambling_luts(); init_pucch2_luts(); @@ -243,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); @@ -329,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]); @@ -393,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); @@ -406,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 @@ -554,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"); @@ -578,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"); @@ -594,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 4024ed1617..07f1d3b9e3 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -124,32 +124,32 @@ int nr_phy_init_RU(RU_t *ru) { ru->num_gNB,NUMBER_OF_gNB_MAX); LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB); - - if (ru->do_precoding == 1) { + if (ru->do_precoding == 1) { int beam_count = 0; if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1 + for (p=0;pnb_log_antennas;p++) { //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0 beam_count++; } AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); - for (i=0; inum_gNB; i++) { - int l_ind = 0; - for (p=0;pnb_log_antennas;p++) { + for (i=0; inum_gNB; i++) { + int l_ind = 0; + for (p=0;pnb_log_antennas;p++) { //if ((fp->L_ssb >> (63-p)) & 0x01) { - ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); - for (j=0; jnb_tx; j++) { - ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i); - for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; - //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); - l_ind++; - } // for j + ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); + for (j=0; jnb_tx; j++) { + ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); + AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i); + for (re=0; reofdm_symbol_size; re++) + ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; + //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); + l_ind++; + } // for j //} - } // for p - } //for i + } // for p + } //for i } ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*)); @@ -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 b571afe416..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,11 +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_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_gNB_INST); + 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]" ); @@ -192,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 **)); @@ -209,7 +252,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } - nr_init_pusch_dmrs(ue, N_n_scid, n_scid); /////////// //////////////////////////////////////////////////////////////////////////////////////////// @@ -231,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) ); } } @@ -272,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]; @@ -294,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) ); @@ -474,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; @@ -556,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.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index c6c89c80be..37ef5fb207 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -224,21 +224,23 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n", start_sc, rel15->StartSymbolIndex, rel15->rbSize, nb_re,rel15->nrOfLayers); #endif - start_meas(&gNB->dlsch_resource_mapping_stats); - for (int ap=0; apnrOfLayers; ap++) { - // DMRS params for this ap - get_Wt(Wt, ap, dmrs_Type); - get_Wf(Wf, ap, dmrs_Type); - delta = get_delta(ap, dmrs_Type); - l_prime = 0; // single symbol ap 0 + start_meas(&gNB->dlsch_resource_mapping_stats); + for (int nl=0; nlnrOfLayers; nl++) { + + int dmrs_port = get_dmrs_port(nl,rel15->dmrsPorts); + // DMRS params for this dmrs port + get_Wt(Wt, dmrs_port, dmrs_Type); + get_Wf(Wf, dmrs_port, dmrs_Type); + delta = get_delta(dmrs_port, dmrs_Type); + l_prime = 0; // single symbol nl 0 l0 = get_l0(rel15->dlDmrsSymbPos); l_overline = l0; #ifdef DEBUG_DLSCH_MAPPING uint8_t dmrs_symbol = l0+l_prime; - printf("DMRS Type %d params for ap %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n", - 1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); + printf("DMRS Type %d params for nl %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n", + 1+dmrs_Type,nl, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); #endif uint16_t m=0, dmrs_idx=0; @@ -307,7 +309,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, if (ptrs_symbol) is_ptrs_re = is_ptrs_subcarrier(k, rel15->rnti, - ap, + nl, rel15->dmrsConfigType, rel15->PTRSFreqDensity, rel15->rbSize, @@ -317,12 +319,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, /* Map DMRS Symbol */ if ( (dmrs_symbol_map & (1 << l)) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 ] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 ] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", - dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); + dmrs_idx, l, k, k_prime, n, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1)], + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); #endif dmrs_idx++; k_prime++; @@ -330,30 +332,30 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, n+=(k_prime)?0:1; } else if(is_ptrs_re){ - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; #ifdef DEBUG_DLSCH_MAPPING printf("ptrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d, mod_ptrs: %d %d\n", - ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)],mod_ptrs[ptrs_idx<<1],mod_ptrs[(ptrs_idx<<1)+1]); + ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF_precoding[nl])[((l*frame_parms->ofdm_symbol_size + k)<<1)], + ((int16_t*)txdataF_precoding[nl])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1],mod_ptrs[ptrs_idx<<1],mod_ptrs[(ptrs_idx<<1)+1]); #endif ptrs_idx++; } /* Map DATA Symbol */ else if( ptrs_symbol || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (amp * tx_layers[ap][m<<1]) >> 15; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (amp * tx_layers[nl][m<<1]) >> 15; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * tx_layers[nl][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); + m, l, k, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1)], + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); #endif m++; } /* mute RE */ else { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; } if (++k >= frame_parms->ofdm_symbol_size) k -= frame_parms->ofdm_symbol_size; @@ -369,26 +371,26 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, } // fix the alignment issues later, use 64-bit SIMD below instead of 128. if (0/*(frame_parms->N_RB_DL&1)==0*/) { - __m128i *txF=(__m128i*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)]; + __m128i *txF=(__m128i*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)]; - __m128i *txl = (__m128i*)&tx_layers[ap][m<<1]; + __m128i *txl = (__m128i*)&tx_layers[nl][m<<1]; __m128i amp128=_mm_set1_epi16(amp); for (int i=0; i<(upper_limit>>2); i++) { txF[i] = _mm_mulhrs_epi16(amp128,txl[i]); } //RE loop, first part m+=upper_limit; if (remaining_re > 0) { - txF = (__m128i*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size)<<1)]; - txl = (__m128i*)&tx_layers[ap][m<<1]; + txF = (__m128i*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size)<<1)]; + txl = (__m128i*)&tx_layers[nl][m<<1]; for (int i=0; i<(remaining_re>>2); i++) { txF[i] = _mm_mulhrs_epi16(amp128,txl[i]); } } } else { - __m64 *txF=(__m64*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)]; + __m64 *txF=(__m64*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)]; - __m64 *txl = (__m64*)&tx_layers[ap][m<<1]; + __m64 *txl = (__m64*)&tx_layers[nl][m<<1]; __m64 amp64=_mm_set1_pi16(amp); for (int i=0; i<(upper_limit>>1); i++) { @@ -396,31 +398,31 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, #ifdef DEBUG_DLSCH_MAPPING if ((i&1) > 0) printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, start_sc+(i>>1), txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1)], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1]); + m, l, start_sc+(i>>1), txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1)], + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1]); #endif /* handle this, mute RE */ /*else { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[anl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; }*/ } //RE loop, first part m+=upper_limit; if (remaining_re > 0) { - txF = (__m64*)&txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size)<<1)]; - txl = (__m64*)&tx_layers[ap][m<<1]; + txF = (__m64*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size)<<1)]; + txl = (__m64*)&tx_layers[nl][m<<1]; for (int i=0; i<(remaining_re>>1); i++) { txF[i] = _mm_mulhrs_pi16(amp64,txl[i]); #ifdef DEBUG_DLSCH_MAPPING if ((i&1) > 0) printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, i>>1, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) ], - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1]); + m, l, i>>1, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) ], + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1]); #endif /* handle this, mute RE */ /*else { - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; - txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; }*/ } //RE loop, second part } // 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 7ac2e67be0..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)); } } @@ -328,8 +306,8 @@ void nr_processULSegment(void* arg) { rv_index, ulsch_harq->new_rx, E, - ulsch_harq->F, - Kr-ulsch_harq->F-2*(p_decoderParms->Z))==-1) { + ulsch_harq->F, + Kr-ulsch_harq->F-2*(p_decoderParms->Z))==-1) { stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); 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_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 9b9f1add6e..caf3a19d85 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -272,6 +272,8 @@ typedef struct { uint8_t dmrsConfigType; // Number of DMRS CDM groups with no data uint8_t n_dmrs_cdm_groups; + /// DMRS ports bitmap + uint16_t dmrs_ports; /// Starting Symbol number uint16_t start_symbol; /// Current subband PMI allocation 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/TOOLS/lte_enb_scope.c b/openair1/PHY/TOOLS/lte_enb_scope.c index 7fde9f244c..0e873addbc 100644 --- a/openair1/PHY/TOOLS/lte_enb_scope.c +++ b/openair1/PHY/TOOLS/lte_enb_scope.c @@ -49,12 +49,6 @@ void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; - printf("XXX %d %d %d\n", - sizeofArray(phy_vars_eNB->UE_stats), - sizeofArray( phy_vars_eNB->UE_stats[i].dlsch_NAK), - sizeofArray( *phy_vars_eNB->UE_stats[i].dlsch_NAK) - ); - for (i=0; iUE_stats); i++) { for (k=0; kUE_stats[i].dlsch_NAK); k++) { //harq_processes for (j=0; jUE_stats[i].dlsch_NAK); j++) { diff --git a/openair1/PHY/TOOLS/lte_ue_scope.c b/openair1/PHY/TOOLS/lte_ue_scope.c index 00560f2d74..9b3f65d7d1 100644 --- a/openair1/PHY/TOOLS/lte_ue_scope.c +++ b/openair1/PHY/TOOLS/lte_ue_scope.c @@ -51,7 +51,7 @@ void reset_stats(FL_OBJECT *button, long arg) { int i,j,k; PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0]; - for (i=0; idlsch[i][0]->Mlimit; j++) { phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0; 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 2d2697a4b7..fa55384093 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -55,12 +55,11 @@ #include #include #include "common_lib.h" -#include "msc.h" #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" @@ -155,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 a371b2334b..86df85db5c 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -54,12 +54,11 @@ #include #include #include "common_lib.h" -#include "msc.h" #include #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 030d50bc04..3a48dc51d6 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -55,11 +55,10 @@ #include #include "common_lib.h" -#include "msc.h" #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" @@ -203,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 bca956bf75..f4b49ececa 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -44,7 +44,6 @@ #include #include #include "common_lib.h" -#include "msc.h" #include "fapi_nr_ue_interface.h" #include "assertions.h" @@ -97,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" @@ -815,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/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 569d2a464a..ee1e0be49a 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -43,7 +43,6 @@ #include #include "assertions.h" -#include "msc.h" #include diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index 4d0fe428e8..805354ce1b 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -40,7 +40,6 @@ #include "assertions.h" -#include "msc.h" #include diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 15eba7b5bc..dc84279a96 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -69,7 +69,6 @@ #include "assertions.h" #include "common/utils/system.h" -#include "msc.h" #include 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/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 1ea8dbdf3c..b0f59d5f47 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -41,7 +41,6 @@ #include "assertions.h" -#include "msc.h" #include diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 4d3174007a..b90f14a129 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -44,7 +44,6 @@ #include "T.h" #include "assertions.h" -#include "msc.h" #include // RU OFDM Modulator gNodeB diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 7e9f4d091a..1ddf4b0d07 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -39,7 +39,6 @@ #include "executables/softmodem-common.h" #include "assertions.h" -#include "msc.h" #include @@ -89,7 +88,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ nr_generate_pss(&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_sss(&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - if (cfg->carrier_config.num_tx_ant.value <= 4) + if (fp->Lmax == 4) nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); else nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); @@ -135,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)); @@ -190,12 +187,10 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, //apply the OFDM symbol rotation here for (aa=0; aacarrier_config.num_tx_ant.value; aa++) { - apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size); + apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size); } 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/vars.h b/openair1/SCHED_NR/vars.h deleted file mode 100644 index e69de29bb2..0000000000 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 4f4757ec5a..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,87 +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->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 < 4; i++) { - if (dlsch_config_pdu->dmrs_ports[i] >= i) 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; @@ -320,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 97a7e2e489..0d284de71c 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -561,23 +561,24 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ uint16_t s1 = dlsch0_harq->nb_symbols; bool is_SI = dlsch0->rnti_type == _SI_RNTI_; - LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n", - ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0_harq->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0_harq->dlDmrsSymbPos); + LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x, Nl %d\n", + ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0_harq->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0_harq->dlDmrsSymbPos, dlsch0_harq->Nl); for (m = s0; m < (s0 +s1); m++) { if (dlsch0_harq->dlDmrsSymbPos & (1 << m)) { for (uint8_t aatx=0; aatxNl; aatx++) {//for MIMO Config: it shall loop over no_layers + LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_slot_rx,m); nr_pdsch_channel_estimation(ue, proc, gNB_id, is_SI, nr_slot_rx, - aatx /*p*/, + 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); - LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_slot_rx,m); #if 0 ///LOG_M: the channel estimation int nr_frame_rx = proc->frame_rx; @@ -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; @@ -1528,7 +1529,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI int ret_pdsch = 0; if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); ret_pdsch = nr_ue_pdsch_procedures(ue, proc, 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 93368f4ab9..e797c01096 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; @@ -175,7 +181,12 @@ gtpv1u_update_ngu_tunnel( return 0; } -int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { +int gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return 0; +} + +int gtpv1u_delete_ngu_tunnel( const instance_t instance, + gtpv1u_gnb_delete_tunnel_req_t *req) { return 0; } @@ -271,17 +282,13 @@ void nr_dlsim_preprocessor(module_id_t module_id, NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - ps->nrOfLayers = g_nrOfLayers; - - int dci_format = sched_ctrl->search_space && sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats ? - NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; - nr_set_pdsch_semi_static(scc, UE_info->CellGroup[0], sched_ctrl->active_bwp, NULL, /* tda = */ 2, - dci_format, + g_nrOfLayers, + sched_ctrl, ps); NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; @@ -434,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"); @@ -600,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': @@ -673,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"); @@ -774,10 +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, 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); @@ -915,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); @@ -997,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) { @@ -1216,7 +1235,7 @@ int main(int argc, char **argv) nr_ue_dcireq(&dcireq); //to be replaced with function pointer later nr_ue_scheduled_response(&scheduled_response); - + phy_procedures_nrUE_RX(UE, &UE_proc, 0, @@ -1312,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 fb0f37d7ac..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" @@ -72,13 +73,11 @@ openair0_config_t openair0_cfg[MAX_CARDS]; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; uint16_t sl_ahead = 0; -msc_interface_t msc_interface; uint32_t N_RB_DL = 106; //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ -msc_interface_t msc_interface; uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } @@ -143,7 +142,12 @@ gtpv1u_update_ngu_tunnel( return 0; } -int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { +int gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return 0; +} + +int gtpv1u_delete_ngu_tunnel( const instance_t instance, + gtpv1u_gnb_delete_tunnel_req_t *req) { return 0; } @@ -659,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 @@ -671,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); } @@ -778,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)]); @@ -876,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); @@ -894,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); @@ -919,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]); @@ -933,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 d07469a4b7..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); @@ -688,8 +681,8 @@ int main(int argc, char **argv) ack_nack_errors+=((actual_payload^payload_received)&1) + (((actual_payload^payload_received)&2)>>1); } else if (format==2) { - nfapi_nr_uci_pucch_pdu_format_2_3_4_t uci_pdu; - nfapi_nr_pucch_pdu_t pucch_pdu; + nfapi_nr_uci_pucch_pdu_format_2_3_4_t uci_pdu={0}; + nfapi_nr_pucch_pdu_t pucch_pdu={0}; pucch_pdu.rnti = 0x1234; pucch_pdu.subcarrier_spacing = 1; pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1; @@ -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 1d312ad3d7..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; @@ -139,7 +145,12 @@ gtpv1u_create_s1u_tunnel( return 0; } -int ocp_gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { +int gtpv1u_delete_s1u_tunnel(const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return 0; +} + +int gtpv1u_delete_ngu_tunnel( const instance_t instance, + gtpv1u_gnb_delete_tunnel_req_t *req) { return 0; } @@ -678,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)); @@ -720,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, 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); @@ -755,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 f09d1a7ce1..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(1200 * sizeof(struct complexd)); // allocate for up to 100 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/gtpv1_u_messages_def.h b/openair2/COMMON/gtpv1_u_messages_def.h index 2835d07e4a..44e9d4fbdf 100644 --- a/openair2/COMMON/gtpv1_u_messages_def.h +++ b/openair2/COMMON/gtpv1_u_messages_def.h @@ -19,18 +19,12 @@ * contact@openairinterface.org */ -MESSAGE_DEF(GTPV1U_ENB_UPDATE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_update_tunnel_req_t, Gtpv1uUpdateTunnelReq) -MESSAGE_DEF(GTPV1U_ENB_UPDATE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_enb_update_tunnel_resp_t, Gtpv1uUpdateTunnelResp) -MESSAGE_DEF(GTPV1U_ENB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_delete_tunnel_req_t, Gtpv1uDeleteTunnelReq) -MESSAGE_DEF(GTPV1U_ENB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_enb_delete_tunnel_resp_t, Gtpv1uDeleteTunnelResp) -MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_ind_t, Gtpv1uTunnelDataInd) + MESSAGE_DEF(GTPV1U_ENB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_tunnel_data_req_t, Gtpv1uTunnelDataReq) MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_req_t,Gtpv1uDataForwardingReq) MESSAGE_DEF(GTPV1U_ENB_DATA_FORWARDING_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_data_forwarding_ind_t,Gtpv1uDataForwardingInd) MESSAGE_DEF(GTPV1U_ENB_END_MARKER_REQ, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_req_t, Gtpv1uEndMarkerReq) MESSAGE_DEF(GTPV1U_ENB_END_MARKER_IND, MESSAGE_PRIORITY_MED, gtpv1u_enb_end_marker_ind_t, Gtpv1uEndMarkerInd) -MESSAGE_DEF(GTPV1U_REQ, MESSAGE_PRIORITY_MED, Gtpv1uReq, gtpv1uReq) +MESSAGE_DEF(GTPV1U_REQ, MESSAGE_PRIORITY_MED, Gtpv1uReq, gtpv1uReq) -MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_req_t, NRGtpv1uDeleteTunnelReq) -MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_resp_t, NRGtpv1uDeleteTunnelResp) MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq) diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 2dd476ab68..096f0f4697 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -28,10 +28,6 @@ #define GTPV1U_MAX_BEARERS_PER_UE max_val_LTE_DRB_Identity #define NR_GTPV1U_MAX_BEARERS_PER_UE max_val_NR_DRB_Identity -#define GTPV1U_ENB_UPDATE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uUpdateTunnelReq -#define GTPV1U_ENB_UPDATE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uUpdateTunnelResp -#define GTPV1U_ENB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDeleteTunnelReq -#define GTPV1U_ENB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDeleteTunnelResp #define GTPV1U_ENB_TUNNEL_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataInd #define GTPV1U_ENB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uTunnelDataReq #define GTPV1U_ENB_DATA_FORWARDING_REQ(mSGpTR) (mSGpTR)->ittiMsg.Gtpv1uDataForwardingReq @@ -41,8 +37,6 @@ #define GTPV1U_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uReq -#define GTPV1U_GNB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelReq -#define GTPV1U_GNB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelResp #define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq #define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF @@ -200,7 +194,6 @@ typedef struct gtpv1u_gnb_create_tunnel_resp_s { pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; transport_layer_addr_t gnb_addr; } gtpv1u_gnb_create_tunnel_resp_t; - typedef struct gtpv1u_gnb_delete_tunnel_req_s { rnti_t rnti; uint8_t num_pdusession; @@ -212,7 +205,6 @@ typedef struct gtpv1u_gnb_delete_tunnel_resp_s { uint8_t status; ///< Status of NGU endpoint deleteion (Failed = 0xFF or Success = 0x0) teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted } gtpv1u_gnb_delete_tunnel_resp_t; - typedef struct gtpv1u_gnb_tunnel_data_req_s { uint8_t *buffer; uint32_t length; 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/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index a08bcf4baf..f4550f63a1 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -55,7 +55,6 @@ #include "common/config/config_userapi.h" #include "RRC_config_tools.h" #include "enb_paramdef.h" -#include "proto_agent.h" #include "executables/thread-common.h" #include @@ -2080,7 +2079,7 @@ int RCconfig_gtpu(void ) { GTPV1U_REQ(message).localPort = enb_port_for_S1U; strcpy(GTPV1U_REQ(message).localAddrStr,address); sprintf(GTPV1U_REQ(message).localPortStr,"%d", enb_port_for_S1U); - itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for S1U\n"); diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index a393930c81..66451530a6 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -357,7 +357,6 @@ #include #include "T.h" #include "common/ran_context.h" -#include "msc.h" /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 13f08b9458..b3c7363ca4 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -35,7 +35,6 @@ #include "f1ap_cu_rrc_message_transfer.h" #include "f1ap_cu_ue_context_management.h" #include "f1ap_cu_task.h" -#include "proto_agent.h" #include //Fixme: Uniq dirty DU instance, by global var, datamodel need better management @@ -47,7 +46,7 @@ static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); sprintf(tmp.originService, "%d", IPaddrs->my_portd); sprintf(tmp.destinationService, "%d", IPaddrs->remote_portd); - return ocp_gtpv1Init(tmp); + return gtpv1Init(tmp); } static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind, diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index ce54e90191..6d4757be6f 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -481,14 +481,6 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, for (int i=0; i 0, "System Information %d is missing",i); - MSC_LOG_RX_MESSAGE( - MSC_F1AP_DU, - MSC_F1AP_CU, - 0, - 0, - MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - assoc_id); LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message\n"); itti_send_msg_to_task(TASK_F1APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; @@ -910,14 +902,6 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).num_cells_to_activate = num_cells_to_activate; - MSC_LOG_RX_MESSAGE( - MSC_F1AP_DU, - MSC_F1AP_CU, - 0, - 0, - MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - assoc_id); LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message \n"); itti_send_msg_to_task(TASK_F1APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 537f0060ae..c8cfadb999 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -35,7 +35,6 @@ #include "f1ap_du_ue_context_management.h" #include "f1ap_du_rrc_message_transfer.h" #include "f1ap_du_task.h" -#include "proto_agent.h" #include //Fixme: Uniq dirty DU instance, by global var, datamodel need better management @@ -103,7 +102,7 @@ static instance_t du_create_gtpu_instance_to_cu(char *CUaddr, uint16_t CUport, c strncpy(tmp.destinationHost, CUaddr, sizeof(tmp.destinationHost)-1); sprintf(tmp.originService, "%d", DUport); sprintf(tmp.destinationService, "%d", CUport); - return ocp_gtpv1Init(tmp); + return gtpv1Init(tmp); } void *F1AP_DU_task(void *arg) { diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 7d51d95840..821e2def84 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -31,8 +31,8 @@ #include #include #include +#include #include -#include #include "gnb_app.h" #include "gnb_config.h" @@ -135,34 +135,6 @@ static uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end) /*------------------------------------------------------------------------------*/ -static void init_pdcp(void) { - if (!NODE_IS_DU(RC.nrrrc[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) { - LOG_I(PDCP, "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); - - if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { - LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); - pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req); - } else { - LOG_I(PDCP, "node is gNB \n"); - pdcp_set_rlc_data_req_func(rlc_data_req); - pdcp_set_pdcp_data_ind_func(pdcp_data_ind); - } - } else { - LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); - pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind); - } -} - -/*------------------------------------------------------------------------------*/ - void *gNB_app_task(void *args_p) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index ec666f9415..2aaf15ae82 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1227,7 +1227,7 @@ int RCconfig_nr_gtpu(void ) { GTPV1U_REQ(message).localPort = port; strcpy(GTPV1U_REQ(message).localAddrStr,address); sprintf(GTPV1U_REQ(message).localPortStr,"%d", port); - itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for NGU or S1U\n"); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index e62978782c..e5b95a7f47 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -34,7 +34,6 @@ #include "assertions.h" #include "platform_types.h" -#include "msc.h" #include "LAYER2/MAC/mac.h" #include "LAYER2/MAC/mac_extern.h" @@ -1421,8 +1420,6 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, rnti_t rnti) { unsigned char i; RA_t *ra = (RA_t *) & RC.mac[module_idP]->common_channels[CC_id].ra[0]; - MSC_LOG_EVENT(MSC_PHY_ENB, "RA Cancelling procedure ue %" PRIx16 " ", - rnti); LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d Cancelling RA procedure for UE rnti %x\n", module_idP, CC_id, frameP, rnti); 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/MAC/main.c b/openair2/LAYER2/MAC/main.c index 4554b247f5..fa647454ba 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -216,7 +216,6 @@ void mac_init_cell_params(int Mod_idP, int CC_idP) int j; UE_TEMPLATE *UE_template; - LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", Mod_idP); //COMMON_channels_t *cc = &RC.mac[Mod_idP]->common_channels[CC_idP]; memset(&RC.mac[Mod_idP]->eNB_stats, 0, sizeof(eNB_STATS)); diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 1aa959e103..af68cebbe1 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -348,7 +348,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, Size16 = (uint16_t) Size; // LOG_D(MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n",module_idP,frameP,Size); LOG_I(RRC, - "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n", + "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_DATA_REQ (RRCConnectionRequest eNB %d) --->][MAC_UE][MOD %02d][]\n", frameP, module_idP, eNB_indexP, module_idP); LOG_I(MAC, "[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 4aa47f493a..94b7ab18bf 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"}; @@ -2328,11 +2327,6 @@ static inline uint8_t get_table_idx(uint8_t mcs_table, uint8_t dci_format, uint8 } -/* returns the total DMRS symbols in a slot*/ -uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype){ - return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols, startSymbol, mappingtype)); -} - // Table 5.1.2.2.1-1 38.214 uint8_t getRBGSize(uint16_t bwp_size, long rbg_size_config) { @@ -2726,6 +2720,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; @@ -2996,7 +2991,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; @@ -3115,9 +3111,9 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI) { +int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI, int length) { - int l0;int dmrs_AdditionalPosition = 0;int maxLength = 0; + int l0;int dmrs_AdditionalPosition = 0; NR_DMRS_DownlinkConfig_t *dmrs_config = NULL; LOG_D(MAC, "NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", NrOfSymbols, startSymbol, mappingtype_fromDCI, dmrs_TypeA_Position); @@ -3129,7 +3125,6 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i // in case of DCI FORMAT 1_0 or dedicated pdsch config not received additionposition = pos2, len1 should be used // referred to section 5.1.6.2 in 38.214 dmrs_AdditionalPosition = 2; - maxLength = 1; if (pdsch_Config != NULL) { if (mappingtype_fromDCI == typeA) { // Type A @@ -3144,8 +3139,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i AssertFatal(dmrs_config != NULL," DMRS configs not present in PDSCH DMRS Downlink config\n"); - // default values of maxlength = len2, additionalposition is pos2 - if (dmrs_config->maxLength != NULL) maxLength = 2; + // default values of additionalposition is pos2 if (dmrs_config->dmrs_AdditionalPosition != NULL) dmrs_AdditionalPosition = *dmrs_config->dmrs_AdditionalPosition; } @@ -3160,11 +3154,6 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i // For TypeB, ld is the duration of the scheduled PDSCH resources ld = (mappingtype_fromDCI == typeA) ? (NrOfSymbols + startSymbol) : NrOfSymbols; - // Section 7.4.1.1.2 in Spec 38.211 - //For PDSCH Mapping typeB, if PDSCH duration ld <=4, only single symbol DMRS is supported - if (mappingtype_fromDCI == typeB && ld <= 4) - maxLength = 1; - AssertFatal(ld > 2 && ld < 15,"Illegal NrOfSymbols according to Table 5.1.2.1-1 Spec 38.214 %d\n",ld); AssertFatal((NrOfSymbols + startSymbol) < 15,"Illegal S+L according to Table 5.1.2.1-1 Spec 38.214 S:%d L:%d\n",startSymbol, NrOfSymbols); @@ -3181,7 +3170,8 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i } - if (maxLength == 1) { + // number of front loaded symbols + if (length == 1) { row = ld - 2; l_prime = table_7_4_1_1_2_3_pdsch_dmrs_positions_l[row][column]; l0 = 1 << l0; @@ -3192,7 +3182,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i l0 = 1<=0,"ERROR in configuration.Check Time Domain allocation of this Grant. l_prime < 1. row:%d, column:%d\n", row, column); l_prime = (mappingtype_fromDCI == typeA) ? (l_prime | l0) : (l_prime << startSymbol); @@ -3347,65 +3337,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 91450fc796..c150c4f134 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -41,7 +41,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); -int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI); +int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI,int length); int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP); @@ -140,6 +140,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); @@ -160,7 +161,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); @@ -177,8 +178,6 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower, uint8_t NrOfSymbols); -uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype); - /* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16 @param *pusch_config, pointer to pusch config @param *ubwp pointer to uplink bwp diff --git a/openair2/LAYER2/NR_MAC_UE/mac_extern.h b/openair2/LAYER2/NR_MAC_UE/mac_extern.h index 7fd63666f0..ac837d7798 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_extern.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_extern.h @@ -57,12 +57,12 @@ extern const uint8_t table_7_3_1_1_2_21[19][4]; extern const uint8_t table_7_3_1_1_2_22[6][5]; extern const uint8_t table_7_3_1_1_2_23[5][6]; extern const uint8_t table_7_3_2_3_3_1[12][5]; -extern const uint8_t table_7_3_2_3_3_2_oneCodeword[31][6]; +extern const uint8_t table_7_3_2_3_3_2_oneCodeword[31][10]; extern const uint8_t table_7_3_2_3_3_2_twoCodeword[4][10]; -extern const uint8_t table_7_3_2_3_3_3_oneCodeword[24][5]; +extern const uint8_t table_7_3_2_3_3_3_oneCodeword[24][7]; extern const uint8_t table_7_3_2_3_3_3_twoCodeword[2][7]; -extern const uint8_t table_7_3_2_3_3_4_oneCodeword[58][6]; -extern const uint8_t table_7_3_2_3_3_4_twoCodeword[6][10]; +extern const uint8_t table_7_3_2_3_3_4_oneCodeword[58][14]; +extern const uint8_t table_7_3_2_3_3_4_twoCodeword[6][14]; extern const uint16_t table_7_2_1[16]; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 4158c78b05..3e4d53b985 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/mac_vars.c b/openair2/LAYER2/NR_MAC_UE/mac_vars.c index 383267090f..b435dd773f 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_vars.c +++ b/openair2/LAYER2/NR_MAC_UE/mac_vars.c @@ -257,161 +257,161 @@ const uint8_t table_7_3_1_1_2_23[5][6] = { }; const uint8_t table_7_3_2_3_3_1[12][5] = { - {1,0,0,0,0}, {1,1,0,0,0}, {1,0,1,0,0}, - {2,0,0,0,0}, + {1,1,1,0,0}, {2,1,0,0,0}, - {2,2,0,0,0}, - {2,3,0,0,0}, {2,0,1,0,0}, - {2,2,3,0,0}, - {2,0,1,2,0}, - {2,0,1,2,3}, - {2,0,2,0,0} + {2,0,0,1,0}, + {2,0,0,0,1}, + {2,1,1,0,0}, + {2,0,0,1,1}, + {2,1,1,1,0}, + {2,1,1,1,1}, + {2,1,0,1,0} }; -const uint8_t table_7_3_2_3_3_2_oneCodeword[31][6] = { - {1,0,0,0,0,1}, - {1,1,0,0,0,1}, - {1,0,1,0,0,1}, - {2,0,0,0,0,1}, - {2,1,0,0,0,1}, - {2,2,0,0,0,1}, - {2,3,0,0,0,1}, - {2,0,1,0,0,1}, - {2,2,3,0,0,1}, - {2,0,1,2,0,1}, - {2,0,1,2,3,1}, - {2,0,2,0,0,1}, - {2,0,0,0,0,2}, - {2,1,0,0,0,2}, - {2,2,0,0,0,2}, - {2,3,0,0,0,2}, - {2,4,0,0,0,2}, - {2,5,0,0,0,2}, - {2,6,0,0,0,2}, - {2,7,0,0,0,2}, - {2,0,1,0,0,2}, - {2,2,3,0,0,2}, - {2,4,5,0,0,2}, - {2,6,7,0,0,2}, - {2,0,4,0,0,2}, - {2,2,6,0,0,2}, - {2,0,1,4,0,2}, - {2,2,3,6,0,2}, - {2,0,1,4,5,2}, - {2,2,3,6,7,2}, - {2,0,2,4,6,2} +const uint8_t table_7_3_2_3_3_2_oneCodeword[31][10] = { + {1,1,0,0,0,0,0,0,0,1}, + {1,0,1,0,0,0,0,0,0,1}, + {1,1,1,0,0,0,0,0,0,1}, + {2,1,0,0,0,0,0,0,0,1}, + {2,0,1,0,0,0,0,0,0,1}, + {2,0,0,1,0,0,0,0,0,1}, + {2,0,0,0,1,0,0,0,0,1}, + {2,1,1,0,0,0,0,0,0,1}, + {2,0,0,1,1,0,0,0,0,1}, + {2,1,1,1,0,0,0,0,0,1}, + {2,1,1,1,1,0,0,0,0,1}, + {2,1,0,1,0,0,0,0,0,1}, + {2,1,0,0,0,0,0,0,0,2}, + {2,0,1,0,0,0,0,0,0,2}, + {2,0,0,1,0,0,0,0,0,2}, + {2,0,0,0,1,0,0,0,0,2}, + {2,0,0,0,0,1,0,0,0,2}, + {2,0,0,0,0,0,1,0,0,2}, + {2,0,0,0,0,0,0,1,0,2}, + {2,0,0,0,0,0,0,0,1,2}, + {2,1,1,0,0,0,0,0,0,2}, + {2,0,0,1,1,0,0,0,0,2}, + {2,0,0,0,0,1,1,0,0,2}, + {2,0,0,0,0,0,0,1,1,2}, + {2,1,0,0,0,1,0,0,0,2}, + {2,0,0,1,0,0,0,1,0,2}, + {2,1,1,0,0,1,0,0,0,2}, + {2,0,0,1,1,0,0,1,0,2}, + {2,1,1,0,0,1,1,0,0,2}, + {2,0,0,1,1,0,0,1,1,2}, + {2,1,0,1,0,1,0,1,0,2} }; const uint8_t table_7_3_2_3_3_2_twoCodeword[4][10] = { - {2,0,1,2,3,4,0,0,0,2}, - {2,0,1,2,3,4,6,0,0,2}, - {2,0,1,2,3,4,5,6,0,2}, - {2,0,1,2,3,4,5,6,7,2} + {2,1,1,1,1,1,0,0,0,2}, + {2,1,1,1,1,1,0,1,0,2}, + {2,1,1,1,1,1,1,1,0,2}, + {2,1,1,1,1,1,1,1,1,2} }; -const uint8_t table_7_3_2_3_3_3_oneCodeword[24][5] = { - {1,0,0,0,0}, - {1,1,0,0,0}, - {1,0,1,0,0}, - {2,0,0,0,0}, - {2,1,0,0,0}, - {2,2,0,0,0}, - {2,3,0,0,0}, - {2,0,1,0,0}, - {2,2,3,0,0}, - {2,0,1,2,0}, - {2,0,1,2,3}, - {3,0,0,0,0}, - {3,1,0,0,0}, - {3,2,0,0,0}, - {3,3,0,0,0}, - {3,4,0,0,0}, - {3,5,0,0,0}, - {3,0,1,0,0}, - {3,2,3,0,0}, - {3,4,5,0,0}, - {3,0,1,2,0}, - {3,3,4,5,0}, - {3,0,1,2,3}, - {2,0,2,0,0} +const uint8_t table_7_3_2_3_3_3_oneCodeword[24][7] = { + {1,1,0,0,0,0,0}, + {1,0,1,0,0,0,0}, + {1,1,1,0,0,0,0}, + {2,1,0,0,0,0,0}, + {2,0,1,0,0,0,0}, + {2,0,0,1,0,0,0}, + {2,0,0,0,1,0,0}, + {2,1,1,0,0,0,0}, + {2,0,0,1,1,0,0}, + {2,1,1,1,0,0,0}, + {2,1,1,1,1,0,0}, + {3,1,0,0,0,0,0}, + {3,0,1,0,0,0,0}, + {3,0,0,1,0,0,0}, + {3,0,0,0,1,0,0}, + {3,0,0,0,0,1,0}, + {3,0,0,0,0,0,1}, + {3,1,1,0,0,0,0}, + {3,0,0,1,1,0,0}, + {3,0,0,0,0,1,1}, + {3,1,1,1,0,0,0}, + {3,0,0,0,1,1,1}, + {3,1,1,1,1,0,0}, + {3,1,0,1,0,0,0} }; const uint8_t table_7_3_2_3_3_3_twoCodeword[2][7] = { - {3,0,1,2,3,4,0}, - {3,0,1,2,3,4,5} + {3,1,1,1,1,1,0}, + {3,1,1,1,1,1,1} }; -const uint8_t table_7_3_2_3_3_4_oneCodeword[58][6] = { - {1,0,0,0,0,1}, - {1,1,0,0,0,1}, - {1,0,1,0,0,1}, - {2,0,0,0,0,1}, - {2,1,0,0,0,1}, - {2,2,0,0,0,1}, - {2,3,0,0,0,1}, - {2,0,1,0,0,1}, - {2,2,3,0,0,1}, - {2,0,1,2,0,1}, - {2,0,1,2,3,1}, - {3,0,0,0,0,1}, - {3,1,0,0,0,1}, - {3,2,0,0,0,1}, - {3,3,0,0,0,1}, - {3,4,0,0,0,1}, - {3,5,0,0,0,1}, - {3,0,1,0,0,1}, - {3,2,3,0,0,1}, - {3,4,5,0,0,1}, - {3,0,1,2,0,1}, - {3,3,4,5,0,1}, - {3,0,1,2,3,1}, - {2,0,2,0,0,1}, - {3,0,0,0,0,2}, - {3,1,0,0,0,2}, - {3,2,0,0,0,2}, - {3,3,0,0,0,2}, - {3,4,0,0,0,2}, - {3,5,0,0,0,2}, - {3,6,0,0,0,2}, - {3,7,0,0,0,2}, - {3,8,0,0,0,2}, - {3,9,0,0,0,2}, - {3,10,0,0,0,2}, - {3,11,0,0,0,2}, - {3,0,1,0,0,2}, - {3,2,3,0,0,2}, - {3,4,5,0,0,2}, - {3,6,7,0,0,2}, - {3,8,9,0,0,2}, - {3,10,11,0,0,2}, - {3,0,1,6,0,2}, - {3,2,3,8,0,2}, - {3,4,5,10,0,2}, - {3,0,1,6,7,2}, - {3,2,3,8,9,2}, - {3,4,5,10,11,2}, - {1,0,0,0,0,2}, - {1,1,0,0,0,2}, - {1,6,0,0,0,2}, - {1,7,0,0,0,2}, - {1,0,1,0,0,2}, - {1,6,7,0,0,2}, - {2,0,1,0,0,2}, - {2,2,3,0,0,2}, - {2,6,7,0,0,2}, - {2,8,9,0,0,2} +const uint8_t table_7_3_2_3_3_4_oneCodeword[58][14] = { + {1,1,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,1,0,0,0,0,0,0,0,0,0,0,1}, + {1,1,1,0,0,0,0,0,0,0,0,0,0,1}, + {2,1,0,0,0,0,0,0,0,0,0,0,0,1}, + {2,0,1,0,0,0,0,0,0,0,0,0,0,1}, + {2,0,0,1,0,0,0,0,0,0,0,0,0,1}, + {2,0,0,0,1,0,0,0,0,0,0,0,0,1}, + {2,1,1,0,0,0,0,0,0,0,0,0,0,1}, + {2,0,0,1,1,0,0,0,0,0,0,0,0,1}, + {2,1,1,1,0,0,0,0,0,0,0,0,0,1}, + {2,1,1,1,1,0,0,0,0,0,0,0,0,1}, + {3,1,0,0,0,0,0,0,0,0,0,0,0,1}, + {3,0,1,0,0,0,0,0,0,0,0,0,0,1}, + {3,0,0,1,0,0,0,0,0,0,0,0,0,1}, + {3,0,0,0,1,0,0,0,0,0,0,0,0,1}, + {3,0,0,0,0,1,0,0,0,0,0,0,0,1}, + {3,0,0,0,0,0,1,0,0,0,0,0,0,1}, + {3,1,1,0,0,0,0,0,0,0,0,0,0,1}, + {3,0,0,1,1,0,0,0,0,0,0,0,0,1}, + {3,0,0,0,0,1,1,0,0,0,0,0,0,1}, + {3,1,1,1,0,0,0,0,0,0,0,0,0,1}, + {3,0,0,0,1,1,1,0,0,0,0,0,0,1}, + {3,1,1,1,1,0,0,0,0,0,0,0,0,1}, + {2,1,0,1,0,0,0,0,0,0,0,0,0,1}, + {3,1,0,0,0,0,0,0,0,0,0,0,0,2}, + {3,0,1,0,0,0,0,0,0,0,0,0,0,2}, + {3,0,0,1,0,0,0,0,0,0,0,0,0,2}, + {3,0,0,0,1,0,0,0,0,0,0,0,0,2}, + {3,0,0,0,0,1,0,0,0,0,0,0,0,2}, + {3,0,0,0,0,0,1,0,0,0,0,0,0,2}, + {3,0,0,0,0,0,0,1,0,0,0,0,0,2}, + {3,0,0,0,0,0,0,0,1,0,0,0,0,2}, + {3,0,0,0,0,0,0,0,0,1,0,0,0,2}, + {3,0,0,0,0,0,0,0,0,0,1,0,0,2}, + {3,0,0,0,0,0,0,0,0,0,0,1,0,2}, + {3,0,0,0,0,0,0,0,0,0,0,0,1,2}, + {3,1,1,0,0,0,0,0,0,0,0,0,0,2}, + {3,0,0,1,1,0,0,0,0,0,0,0,0,2}, + {3,0,0,0,0,1,1,0,0,0,0,0,0,2}, + {3,0,0,0,0,0,0,1,1,0,0,0,0,2}, + {3,0,0,0,0,0,0,0,0,1,1,0,0,2}, + {3,0,0,0,0,0,0,0,0,0,0,1,1,2}, + {3,1,1,0,0,0,0,1,0,0,0,0,0,2}, + {3,0,0,1,1,0,0,0,0,1,0,0,0,2}, + {3,0,0,0,0,1,1,0,0,0,0,1,0,2}, + {3,1,1,0,0,0,0,1,1,0,0,0,0,2}, + {3,0,0,1,1,0,0,0,0,1,1,0,0,2}, + {3,0,0,0,0,1,1,0,0,0,0,1,1,2}, + {1,1,0,0,0,0,0,0,0,0,0,0,0,2}, + {1,0,1,0,0,0,0,0,0,0,0,0,0,2}, + {1,0,0,0,0,0,0,1,0,0,0,0,0,2}, + {1,0,0,0,0,0,0,0,1,0,0,0,0,2}, + {1,1,1,0,0,0,0,0,0,0,0,0,0,2}, + {1,0,0,0,0,0,0,1,1,0,0,0,0,2}, + {2,1,1,0,0,0,0,0,0,0,0,0,0,2}, + {2,0,0,1,1,0,0,0,0,0,0,0,0,2}, + {2,0,0,0,0,0,0,1,1,0,0,0,0,2}, + {2,0,0,0,0,0,0,0,0,1,1,0,0,2} }; -const uint8_t table_7_3_2_3_3_4_twoCodeword[6][10] = { - {3,0,1,2,3,4,0,0,0,1}, - {3,0,1,2,3,4,5,0,0,1}, - {2,0,1,2,3,6,0,0,0,2}, - {2,0,1,2,3,6,8,0,0,2}, - {2,0,1,2,3,6,7,8,0,2}, - {2,0,1,2,3,6,7,8,9,2} +const uint8_t table_7_3_2_3_3_4_twoCodeword[6][14] = { + {3,1,1,1,1,1,0,0,0,0,0,0,0,1}, + {3,1,1,1,1,1,1,0,0,0,0,0,0,1}, + {2,1,1,1,1,0,0,1,0,0,0,0,0,2}, + {2,1,1,1,1,0,0,1,0,1,0,0,0,2}, + {2,1,1,1,1,0,0,1,1,1,0,0,0,2}, + {2,1,1,1,1,0,0,1,1,1,1,0,0,2}, }; // table 7.2-1 TS 38.321 diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 26cefbc9e1..c57736990c 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; } @@ -859,26 +862,33 @@ 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, (get_softmodem_params()->nsa) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position, dlsch_config_pdu_1_0->number_symbols, dlsch_config_pdu_1_0->start_symbol, - mappingtype); + mappingtype, 1); dlsch_config_pdu_1_0->dmrsConfigType = (mac->DLbwp[0] != NULL) ? (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; + /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ if (dlsch_config_pdu_1_0->number_symbols == 2) dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; else dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; + dlsch_config_pdu_1_0->dmrs_ports = 1; // only port 0 in case of DCI 1_0 /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* MCS TABLE INDEX */ @@ -1054,20 +1064,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); - - /* dmrs symbol positions*/ - dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config, - mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position, - dlsch_config_pdu_1_1->number_symbols, - dlsch_config_pdu_1_1->start_symbol, - mappingtype); + 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; @@ -1132,6 +1138,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr uint8_t n_codewords = 1; // FIXME!!! long *max_length = NULL; long *dmrs_type = NULL; + dlsch_config_pdu_1_1->n_front_load_symb = 1; // default value if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA) { max_length = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength; dmrs_type = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type; @@ -1143,31 +1150,35 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr if ((dmrs_type == NULL) && (max_length == NULL)){ // Table 7.3.1.2.2-1: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=1 dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_1[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_1[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_1[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_1[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_1[dci->antenna_ports.val][4]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_1[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_1[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_1[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_1[dci->antenna_ports.val][4]<<3)); } if ((dmrs_type == NULL) && (max_length != NULL)){ // Table 7.3.1.2.2-2: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=2 if (n_codewords == 1) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][4]; - dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][5]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][4]<<3) + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][5]<<4) + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][6]<<5) + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][7]<<6) + + (table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][8]<<7)); + dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][9]; } if (n_codewords == 2) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][4]; - dlsch_config_pdu_1_1->dmrs_ports[4] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][5]; - dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][6]; - dlsch_config_pdu_1_1->dmrs_ports[6] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][7]; - dlsch_config_pdu_1_1->dmrs_ports[7] = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][8]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][4]<<3) + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][5]<<4) + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][6]<<5) + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][7]<<6) + + (table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][8]<<7)); dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][9]; } } @@ -1175,44 +1186,67 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // Table 7.3.1.2.2-3: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=1 if (n_codewords == 1) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][4]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][4]<<3) + + (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][5]<<4) + + (table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][6]<<5)); } if (n_codewords == 2) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][4]; - dlsch_config_pdu_1_1->dmrs_ports[4] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][5]; - dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][6]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][4]<<3) + + (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][5]<<4) + + (table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][6]<<5)); } } if ((dmrs_type != NULL) && (max_length != NULL)){ // Table 7.3.1.2.2-4: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=2 if (n_codewords == 1) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][4]; - dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][5]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][4]<<3) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][5]<<4) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][6]<<5) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][7]<<6) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][8]<<7) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][9]<<8) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][10]<<9) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][11]<<10) + + (table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][12]<<11)); + dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][13]; } if (n_codewords == 2) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][0]; - dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][1]; - dlsch_config_pdu_1_1->dmrs_ports[1] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][2]; - dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][3]; - dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][4]; - dlsch_config_pdu_1_1->dmrs_ports[4] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][5]; - dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][6]; - dlsch_config_pdu_1_1->dmrs_ports[6] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][7]; - dlsch_config_pdu_1_1->dmrs_ports[7] = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][8]; + dlsch_config_pdu_1_1->dmrs_ports = (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][1] + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][2]<<1) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][3]<<2) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][4]<<3) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][5]<<4) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][6]<<5) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][7]<<6) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][8]<<7) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][9]<<8) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][10]<<9) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][11]<<10) + + (table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][12]<<11)); dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_4_twoCodeword[dci->antenna_ports.val][9]; } } + + /* dmrs symbol positions*/ + dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config, + mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position, + dlsch_config_pdu_1_1->number_symbols, + dlsch_config_pdu_1_1->start_symbol, + mappingtype, + dlsch_config_pdu_1_1->n_front_load_symb); + /* TCI */ if (mac->dl_config_request.dl_config_list[0].dci_config_pdu.dci_config_rel15.coreset.tci_present_in_dci == 1){ // 0 bit if higher layer parameter tci-PresentInDCI is not enabled @@ -2369,7 +2403,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 @@ -2383,31 +2417,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); } @@ -3809,6 +3842,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 1a2e52a603..e1058e1173 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -768,7 +768,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; } @@ -1046,6 +1046,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; @@ -2307,7 +2311,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); @@ -2331,9 +2334,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 70ab595f51..7833b41f0b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -365,8 +365,9 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts cfg->ssb_table.ssb_mask_list[1].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; cfg->num_tlv+=2; + // logical antenna ports cfg->carrier_config.num_tx_ant.value = pdsch_AntennaPorts; - AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 13, "pdsch_AntennaPorts in 1...12\n"); + AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 33, "pdsch_AntennaPorts in 1...32\n"); cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG; int num_ssb=0; @@ -626,17 +627,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, process_CellGroup(CellGroup,&UE_info->UE_sched_ctrl[UE_id]); const NR_ServingCellConfig_t *servingCellConfig = CellGroup ? CellGroup->spCellConfig->spCellConfigDedicated : NULL; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + 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 486c5d0763..f36dbc4a16 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1039,6 +1039,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; @@ -1047,10 +1048,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 @@ -1087,15 +1085,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) @@ -1189,7 +1195,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; @@ -1346,9 +1352,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; @@ -1370,11 +1373,40 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, - mappingtype); + 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]; @@ -1619,7 +1651,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra scc->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, - mappingtype); + mappingtype, 1); uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos); @@ -1661,12 +1693,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra uint8_t tb_scaling = 0; uint16_t *vrb_map = cc[CC_id].vrb_map; do { - rbSize++; + if(rbSize < BWPSize) + rbSize++; + else + mcsIndex++; 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); + 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); int i = 0; while ((i < rbSize) && (rbStart + rbSize <= BWPSize)) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index ac08e18c11..7d16a4ee01 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -388,7 +388,6 @@ uint32_t schedule_control_sib1(module_id_t module_id, // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6; uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); - LOG_D(MAC,"dlDmrsSymbPos %x\n",dlDmrsSymbPos); int rbSize = 0; uint32_t TBS = 0; @@ -613,16 +612,16 @@ 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; - - uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype); + 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 uint32_t TBS = schedule_control_sib1(module_idP, CC_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 3c441b7c6c..5032ee601f 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; @@ -563,7 +568,7 @@ bool allocate_dl_retransmission(module_id_t module_id, int rbStart = 0; // start wrt BWPstart NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - const long f = (sched_ctrl->active_bwp ||bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; + int rbSize = 0; const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n"); @@ -586,27 +591,32 @@ 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) - nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, ps); + if (ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_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 { /* the retransmission will use a different time domain allocation, check * that we have enough resources */ - NR_pdsch_semi_static_t temp_ps; - temp_ps.nrOfLayers = 1; - nr_set_pdsch_semi_static(scc, cg, sched_ctrl->active_bwp, bwpd, tda, f, &temp_ps); + + NR_pdsch_semi_static_t temp_ps = *ps; + nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, ps->nrOfLayers, sched_ctrl, &temp_ps); while (rbStart < bwpSize && !(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbStart++; while (rbStart + rbSize < bwpSize && (rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) rbSize++; + uint32_t new_tbs; uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, retInfo->R, + temp_ps.nrOfLayers, temp_ps.nrOfSymbols, temp_ps.N_PRB_DMRS * temp_ps.N_DMRS_SLOT, retInfo->tb_size, + 1, /* minimum of 1RB: need to find exact TBS, don't preclude any number */ rbSize, &new_tbs, &new_rbSize); @@ -702,6 +712,7 @@ void pf_dl(module_id_t module_id, float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; + int layers[MAX_MOBILES_PER_GNB]; NR_list_t UE_sched = { .head = -1, .next = ue_array, .tail = -1, .len = MAX_MOBILES_PER_GNB }; /* Loop UE_info->list to check retransmission */ @@ -714,6 +725,8 @@ void pf_dl(module_id_t module_id, /* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */ sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; + layers[UE_id] = ps->nrOfLayers; // initialization of layers to the previous value in the strcuture + /* Calculate Throughput */ const float a = 0.0005f; // corresponds to 200ms window const uint32_t b = UE_info->mac_stats[UE_id].dlsch_current_bytes; @@ -737,9 +750,19 @@ void pf_dl(module_id_t module_id, continue; /* Calculate coeff */ - ps->nrOfLayers = 1; - sched_pdsch->mcs = get_mcs_from_bler(module_id, /* CC_id = */ 0, frame, slot, UE_id); - uint32_t tbs = pf_tbs[ps->mcsTableIdx][sched_pdsch->mcs]; + 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, 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); + uint32_t tbs = nr_compute_tbs(Qm, + R, + 1, /* rbSize */ + 10, /* hypothetical number of slots */ + 0, /* N_PRB_DMRS * N_DMRS_SLOT */ + 0 /* N_PRB_oh, 0 for initialBWP */, + 0 /* tb_scaling */, + layers[UE_id]) >> 3; coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id]; LOG_D(NR_MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", b, UE_id, thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]); @@ -748,8 +771,9 @@ void pf_dl(module_id_t module_id, } } + const int min_rbSize = 5; /* Loop UE_sched to find max coeff and allocate transmission */ - while (max_num_ue > 0 && n_rb_sched > 0 && UE_sched.head >= 0) { + while (max_num_ue > 0 && n_rb_sched >= min_rbSize && UE_sched.head >= 0) { /* Find max coeff from UE_sched*/ int *max = &UE_sched.head; /* assume head is max */ @@ -809,9 +833,6 @@ void pf_dl(module_id_t module_id, LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); continue; } - /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ - max_num_ue--; - if (max_num_ue < 0) return; /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ @@ -825,9 +846,14 @@ void pf_dl(module_id_t module_id, frame, slot); mac->pdcch_cand[cid]--; - return; + continue; } + /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE + * and PUCCH */ + max_num_ue--; + AssertFatal(max_num_ue >= 0, "Illegal max_num_ue %d\n", max_num_ue); + sched_ctrl->cce_index = CCEIndex; fill_pdcch_vrb_map(mac, @@ -842,9 +868,13 @@ void pf_dl(module_id_t module_id, AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n"); NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; - const long f = (sched_ctrl->active_bwp || bwpd) ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; - if (ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, bwpd, tda, f, ps); + + if (ps->nrOfLayers != layers[UE_id] || + 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, layers[UE_id], sched_ctrl, ps); + sched_ctrl->update_pdsch_ps = false; + } const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); // Freq-demain allocation @@ -865,9 +895,11 @@ void pf_dl(module_id_t module_id, const int oh = 3 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, + ps->nrOfLayers, ps->nrOfSymbols, ps->N_PRB_DMRS * ps->N_DMRS_SLOT, sched_ctrl->num_total_bytes + oh, + min_rbSize, max_rbSize, &TBS, &rbSize); @@ -1048,8 +1080,7 @@ void nr_schedule_ue_spec(module_id_t module_id, harq->is_waiting = true; UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++; - LOG_D(NR_MAC, - "%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n", + LOG_D(NR_MAC,"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n", frame, slot, UE_id, @@ -1061,6 +1092,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ps->nrOfSymbols, ps->dl_dmrs_symb_pos, sched_pdsch->mcs, + nrOfLayers, TBS, current_harq_pid, harq->round, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 8ae9e6a870..915b7b7434 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -165,7 +165,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, scc->dmrs_TypeA_Position, NrOfSymbols, StartSymbolIndex, - mappingtype); + mappingtype, 1); /* AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n"); @@ -278,12 +278,11 @@ void nr_preprocessor_phytest(module_id_t module_id, UE_id); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; - const long f = sched_ctrl->active_bwp ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; ps->nrOfLayers = target_dl_Nl; - if (ps->time_domain_allocation != tda) - nr_set_pdsch_semi_static( - scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, f, ps); + + if (ps->time_domain_allocation != tda || ps->nrOfLayers != target_dl_Nl) + nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, NULL, tda, target_dl_Nl, sched_ctrl, ps); /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -519,12 +518,14 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ sched_ctrl->coreset, Y); - if (sched_ctrl->cce_index < 0) { + if (CCEIndex < 0) { LOG_E(MAC, "%s(): CCE list not empty, couldn't schedule PUSCH\n", __func__); nr_mac->pdcch_cand[cid]--; return false; } + sched_ctrl->cce_index = CCEIndex; + const int mcs = target_ul_mcs; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = mcs; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 5c1ef2128f..ac0b186218 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -113,6 +113,20 @@ uint8_t nr_ss_first_symb_idx_scs_120_120_mux3[4] = {4,8,2,6}; uint8_t nr_max_number_of_candidates_per_slot[4] = {44, 36, 22, 20}; uint8_t nr_max_number_of_cces_per_slot[4] = {56, 56, 48, 32}; +// CQI TABLES +// Table 1 (38.214 5.2.2.1-2) +uint16_t cqi_table1[16][2] = {{0,0},{2,78},{2,120},{2,193},{2,308},{2,449},{2,602},{4,378}, + {4,490},{4,616},{6,466},{6,567},{6,666},{6,772},{6,873},{6,948}}; + +// Table 2 (38.214 5.2.2.1-3) +uint16_t cqi_table2[16][2] = {{0,0},{2,78},{2,193},{2,449},{4,378},{4,490},{4,616},{6,466}, + {6,567},{6,666},{6,772},{6,873},{8,711},{8,797},{8,885},{8,948}}; + +// Table 2 (38.214 5.2.2.1-4) +uint16_t cqi_table3[16][2] = {{0,0},{2,30},{2,50},{2,78},{2,120},{2,193},{2,308},{2,449}, + {2,602},{4,378},{4,490},{4,616},{6,466},{6,567},{6,666},{6,772}}; + + static inline uint8_t get_max_candidates(uint8_t scs) { AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs); return (nr_max_number_of_candidates_per_slot[scs]); @@ -123,6 +137,59 @@ static inline uint8_t get_max_cces(uint8_t scs) { return (nr_max_number_of_cces_per_slot[scs]); } +uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl) { + + // TODO check this but it should be enough for now + // if there is not csi report RI is 0 from initialization + return (sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.ri + 1); + +} + +void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch, + NR_UE_sched_ctrl_t *sched_ctrl, + uint8_t *target_mcs, + uint8_t mcs_table_idx) { + + if (sched_ctrl->set_mcs) { + // TODO for wideband case and multiple TB + int cqi_idx = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb; + uint16_t target_coderate,target_qm; + if (cqi_idx>0) { + int cqi_table = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table; + AssertFatal(cqi_table == mcs_table_idx, "Indices of MCS tables don't correspond\n"); + switch (cqi_table) { + case 0: + target_qm = cqi_table1[cqi_idx][0]; + target_coderate = cqi_table1[cqi_idx][1]; + break; + case 1: + target_qm = cqi_table2[cqi_idx][0]; + target_coderate = cqi_table2[cqi_idx][1]; + break; + case 2: + target_qm = cqi_table3[cqi_idx][0]; + target_coderate = cqi_table3[cqi_idx][1]; + break; + default: + AssertFatal(1==0,"Invalid cqi table index %d\n",cqi_table); + } + int max_mcs = 28; + int R,Qm; + if (mcs_table_idx == 1) + max_mcs = 27; + for (int i=0; i<=max_mcs; i++) { + R = nr_get_code_rate_dl(i, mcs_table_idx); + Qm = nr_get_Qm_dl(i, mcs_table_idx); + if ((Qm == target_qm) && (target_coderate <= R)) { + *target_mcs = i; + break; + } + } + } + sched_ctrl->set_mcs = FALSE; + } +} + void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { //TODO first basic implementation of dmrs port selection @@ -130,23 +197,29 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { // for now it assumes a selection of Nl consecutive dmrs ports // and a single front loaded symbol // dmrs_ports_id is the index of Tables 7.3.1.2.2-1/2/3/4 + // number of front loaded symbols need to be consistent with maxLength + // when a more complete implementation is done switch (ps->nrOfLayers) { case 1: ps->dmrs_ports_id = 0; ps->numDmrsCdmGrpsNoData = 1; + ps->frontloaded_symb = 1; break; case 2: ps->dmrs_ports_id = 2; ps->numDmrsCdmGrpsNoData = 1; + ps->frontloaded_symb = 1; break; case 3: ps->dmrs_ports_id = 9; ps->numDmrsCdmGrpsNoData = 2; + ps->frontloaded_symb = 1; break; case 4: ps->dmrs_ports_id = 10; ps->numDmrsCdmGrpsNoData = 2; + ps->frontloaded_symb = 1; break; default: AssertFatal(1==0,"Number of layers %d\n not supported or not valid\n",ps->nrOfLayers); @@ -385,16 +458,18 @@ void fill_pdcch_vrb_map(gNB_MAC_INST *mac, bool nr_find_nb_rb(uint16_t Qm, uint16_t R, + uint8_t nrOfLayers, uint16_t nb_symb_sch, uint16_t nb_dmrs_prb, uint32_t bytes, + uint16_t nb_rb_min, uint16_t nb_rb_max, uint32_t *tbs, uint16_t *nb_rb) { /* is the maximum (not even) enough? */ *nb_rb = nb_rb_max; - *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3; /* check whether it does not fit, or whether it exactly fits. Some algorithms * might depend on the return value! */ if (bytes > *tbs) @@ -403,17 +478,17 @@ bool nr_find_nb_rb(uint16_t Qm, return true; /* is the minimum enough? */ - *nb_rb = 5; - *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + *nb_rb = nb_rb_min; + *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3; if (bytes <= *tbs) return true; /* perform binary search to allocate all bytes within a TBS up to nb_rb_max * RBs */ int hi = nb_rb_max; - int lo = 1; + int lo = nb_rb_min; for (int p = (hi + lo) / 2; lo + 1 < hi; p = (hi + lo) / 2) { - const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3; if (bytes == TBS) { hi = p; break; @@ -424,7 +499,7 @@ bool nr_find_nb_rb(uint16_t Qm, } } *nb_rb = hi; - *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3; /* return whether we could allocate all bytes and stay below nb_rb_max */ return *tbs >= bytes && *nb_rb <= nb_rb_max; } @@ -434,18 +509,12 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Downlink_t *bwp, const NR_BWP_DownlinkDedicated_t *bwpd0, int tda, - const long dci_format, + uint8_t layers, + NR_UE_sched_ctrl_t *sched_ctrl, NR_pdsch_semi_static_t *ps) { - ps->time_domain_allocation = tda; + bool reset_dmrs = false; - const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ? - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList : - scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); - const int mapping_type = tdaList->list.array[tda]->mappingType; - const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols); NR_BWP_DownlinkDedicated_t *bwpd; if (bwp && bwp->bwp_Dedicated) { @@ -454,7 +523,6 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, bwpd = (NR_BWP_DownlinkDedicated_t*)bwpd0; } - ps->mcsTableIdx = 0; if (bwpd->pdsch_Config && bwpd->pdsch_Config->choice.setup && bwpd->pdsch_Config->choice.setup->mcs_Table) { @@ -464,16 +532,69 @@ 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); - if(dci_format == 0) // format 1_0 - ps->numDmrsCdmGrpsNoData = (ps->nrOfSymbols == 2 ? 1 : 2); + NR_PDSCH_Config_t *pdsch_Config; + if (bwp && + bwp->bwp_Dedicated && + bwp->bwp_Dedicated->pdsch_Config && + bwp->bwp_Dedicated->pdsch_Config->choice.setup) + pdsch_Config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; else - set_dl_dmrs_ports(ps); - ps->dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; + pdsch_Config = NULL; + + if (ps->time_domain_allocation != tda) { + reset_dmrs = true; + ps->time_domain_allocation = tda; + const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp ? + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList : + scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); + ps->mapping_type = tdaList->list.array[tda]->mappingType; + if (pdsch_Config) { + if (ps->mapping_type == NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeB) + ps->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type == NULL ? 0 : 1; + else + ps->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + } + else + ps->dmrsConfigType = NFAPI_NR_DMRS_TYPE1; + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols); + } + + const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + int dci_format; + if (sched_ctrl->search_space) { + dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; + } + else { + dci_format = NR_DL_DCI_FORMAT_1_0; + } + if (dci_format == NR_DL_DCI_FORMAT_1_0) { + if (ps->nrOfSymbols == 2) + ps->numDmrsCdmGrpsNoData = 1; + else + ps->numDmrsCdmGrpsNoData = 2; + ps->dmrs_ports_id = 0; + ps->frontloaded_symb = 1; + ps->nrOfLayers = 1; + } + else { + if (ps->nrOfLayers != layers || + ps->numDmrsCdmGrpsNoData == 0) { + reset_dmrs = true; + ps->nrOfLayers = layers; + set_dl_dmrs_ports(ps); + } + } ps->N_PRB_DMRS = ps->numDmrsCdmGrpsNoData * (ps->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4); - ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type); - ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos); + + if (reset_dmrs) { + ps->dl_dmrs_symb_pos = fill_dmrs_mask(bwpd ? bwpd->pdsch_Config->choice.setup : NULL, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, ps->mapping_type, ps->frontloaded_symb); + ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos); + } LOG_D(NR_MAC,"bwpd0 %p, bwpd %p : Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",bwpd0,bwpd,ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT); } @@ -1851,14 +1972,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 */ @@ -2056,6 +2208,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG compute_csi_bitlen (CellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, mod_idP); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); + sched_ctrl->set_mcs = TRUE; sched_ctrl->lcid_mask = 0; if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) { sched_ctrl->lcid_mask = 1<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); @@ -2144,11 +2295,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 */ @@ -2357,11 +2528,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)); @@ -2405,7 +2576,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; @@ -2420,6 +2591,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/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 5880f59655..7d32eb1007 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -161,7 +161,7 @@ void nr_schedule_pucch(int Mod_idP, //! Calculating number of bits set -uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ +uint8_t number_of_bits_set (uint8_t buf){ uint8_t nb_of_bits_set = 0; uint8_t mask = 0xff; uint8_t index = 0; @@ -172,14 +172,13 @@ uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ mask>>=1; } - *max_ri = 8-index; return nb_of_bits_set; } void compute_rsrp_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, uint8_t nb_resources, - nr_csi_report_t *csi_report){ + nr_csi_report_t *csi_report) { if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { if (NULL != csi_reportconfig->groupBasedBeamReporting.choice.disabled->nrofReportedRS) @@ -211,42 +210,24 @@ uint8_t compute_ri_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, nr_csi_report_t *csi_report){ struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; - uint8_t nb_allowed_ri, ri_restriction,ri_bitlen; - uint8_t max_ri = 0; + uint8_t nb_allowed_ri, ri_bitlen; + uint8_t ri_restriction = 0; if (codebookConfig == NULL) { csi_report->csi_meas_bitlen.ri_bitlen=0; - return max_ri; + return ri_restriction; } // codebook type1 single panel if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==codebookConfig->codebookType.choice.type1->subType.present){ struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two){ - // two antenna ports case - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - * */ - AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - if (0==*(csi_reportconfig->dummy)){ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } + nb_allowed_ri = number_of_bits_set(ri_restriction); + ri_bitlen = ceil(log2(nb_allowed_ri)); + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; } @@ -254,43 +235,27 @@ uint8_t compute_ri_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, if (type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction) { // 4 ports - AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present*/ - if (0==*(csi_reportconfig->dummy)){ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } + nb_allowed_ri = number_of_bits_set(ri_restriction); + ri_bitlen = ceil(log2(nb_allowed_ri)); + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; } else { // more than 4 ports - AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - /* Replace dummy with the nrofCQIsPerReport from the CSIreport - config when equalent ASN structure present */ - if (0==*(csi_reportconfig->dummy)){ - nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } - else{ - nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); - ri_bitlen = ceil(log2(nb_allowed_ri)); - } + nb_allowed_ri = number_of_bits_set(ri_restriction); + ri_bitlen = ceil(log2(nb_allowed_ri)); + csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; } } - return max_ri; + return ri_restriction; } else AssertFatal(1==0,"Other configurations not yet implemented\n"); @@ -298,66 +263,295 @@ uint8_t compute_ri_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, } void compute_li_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, - uint8_t max_ri, + uint8_t ri_restriction, nr_csi_report_t *csi_report){ struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; - if (codebookConfig == NULL) { - csi_report->csi_meas_bitlen.li_bitlen=0; - return; + for(int i=0; i<8; i++) { + if (codebookConfig == NULL || ((ri_restriction>>i)&0x01) == 0) + csi_report->csi_meas_bitlen.li_bitlen[i]=0; + else { + // codebook type1 single panel + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==codebookConfig->codebookType.choice.type1->subType.present) + csi_report->csi_meas_bitlen.li_bitlen[i]=ceil(log2(i+1))<2?ceil(log2(i+1)):2; + else + AssertFatal(1==0,"Other configurations not yet implemented\n"); + } } - // codebook type1 single panel - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==codebookConfig->codebookType.choice.type1->subType.present){ - /* From Spec 38.212 - * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator - * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, - * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause - * 5.2.2.2.1 [6, TS 38.214]. - * - * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to - * calculate RI for antennas equal or more than two. - */ - //! TODO: The bit length of LI is as follows LI = log2(RI), Need to confirm wheather we should consider maximum RI can be reported from ri_restricted - // or we should consider reported RI. If we need to consider reported RI for calculating LI bit length then we need to modify the code. - csi_report->csi_meas_bitlen.li_bitlen=ceil(log2(max_ri))<2?ceil(log2(max_ri)):2; - } - else - AssertFatal(1==0,"Other configurations not yet implemented\n"); } +void get_n1n2_o1o2_singlepanel(int *n1, int *n2, int *o1, int *o2, + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo *morethantwo) { + + // Table 5.2.2.2.1-2 in 38.214 for supported configurations + switch(morethantwo->n1_n2.present){ + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction): + *n1 = 2; + *n2 = 1; + *o1 = 4; + *o2 = 1; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction): + *n1 = 2; + *n2 = 2; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction): + *n1 = 4; + *n2 = 1; + *o1 = 4; + *o2 = 1; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction): + *n1 = 3; + *n2 = 2; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction): + *n1 = 6; + *n2 = 1; + *o1 = 4; + *o2 = 1; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction): + *n1 = 4; + *n2 = 2; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction): + *n1 = 8; + *n2 = 1; + *o1 = 4; + *o2 = 1; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_three_TypeI_SinglePanel_Restriction): + *n1 = 4; + *n2 = 3; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_two_TypeI_SinglePanel_Restriction): + *n1 = 4; + *n2 = 2; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_twelve_one_TypeI_SinglePanel_Restriction): + *n1 = 12; + *n2 = 1; + *o1 = 4; + *o2 = 1; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_four_TypeI_SinglePanel_Restriction): + *n1 = 4; + *n2 = 4; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_two_TypeI_SinglePanel_Restriction): + *n1 = 8; + *n2 = 2; + *o1 = 4; + *o2 = 4; + break; + case (NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_sixteen_one_TypeI_SinglePanel_Restriction): + *n1 = 16; + *n2 = 1; + *o1 = 4; + *o2 = 1; + break; + default: + AssertFatal(1==0,"Not supported configuration for n1_n2 in codebook configuration"); + } +} + +void get_x1x2_bitlen_singlepanel(int n1, int n2, int o1, int o2, + int *x1, int *x2, int rank, int codebook_mode) { + + // Table 6.3.1.1.2-1 in 38.212 + switch(rank){ + case 1: + if(n2>1) { + if (codebook_mode == 1) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 2; + } + else { + *x1 = ceil(log2(n1*o1/2)) + ceil(log2(n2*o2/2)); + *x2 = 4; + } + } + else{ + if (codebook_mode == 1) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 2; + } + else { + *x1 = ceil(log2(n1*o1/2)); + *x2 = 4; + } + } + break; + case 2: + if(n1*n2 == 2) { + if (codebook_mode == 1) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 1; + } + else { + *x1 = ceil(log2(n1*o1/2)); + *x2 = 3; + } + *x1 += 1; + } + else { + if(n2>1) { + if (codebook_mode == 1) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 3; + } + else { + *x1 = ceil(log2(n1*o1/2)) + ceil(log2(n2*o2/2)); + *x2 = 3; + } + } + else{ + if (codebook_mode == 1) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 1; + } + else { + *x1 = ceil(log2(n1*o1/2)); + *x2 = 3; + } + } + *x1 += 2; + } + break; + case 3: + case 4: + if(n1*n2 == 2) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 1; + } + else { + if(n1*n2 >= 8) { + *x1 = ceil(log2(n1*o1/2)) + ceil(log2(n2*o2)) + 2; + *x2 = 1; + } + else { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)) + 2; + *x2 = 1; + } + } + break; + case 5: + case 6: + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 1; + break; + case 7: + case 8: + if(n1 == 4 && n2 == 1) { + *x1 = ceil(log2(n1*o1/2)) + ceil(log2(n2*o2)); + *x2 = 1; + } + else { + if(n1 > 2 && n2 == 2) { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2/2)); + *x2 = 1; + } + else { + *x1 = ceil(log2(n1*o1)) + ceil(log2(n2*o2)); + *x2 = 1; + } + } + break; + default: + AssertFatal(1==0,"Invalid rank in x1 x2 bit length computation\n"); + } +} + + +void compute_pmi_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, + uint8_t ri_restriction, + nr_csi_report_t *csi_report){ + + struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; + for(int i=0; i<8; i++) { + csi_report->csi_meas_bitlen.pmi_x1_bitlen[i]=0; + csi_report->csi_meas_bitlen.pmi_x2_bitlen[i]=0; + if (codebookConfig == NULL || ((ri_restriction>>i)&0x01) == 0) + return; + else { + if(codebookConfig->codebookType.present == NR_CodebookConfig__codebookType_PR_type1) { + if(codebookConfig->codebookType.choice.type1->subType.present == NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel) { + if(codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present == + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two) { + if (i==0) + csi_report->csi_meas_bitlen.pmi_x2_bitlen[i]=2; + if (i==1) + csi_report->csi_meas_bitlen.pmi_x2_bitlen[i]=1; + } + else { // more than two + int n1,n2,o1,o2,x1,x2; + get_n1n2_o1o2_singlepanel(&n1,&n2,&o1,&o2,codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.moreThanTwo); + get_x1x2_bitlen_singlepanel(n1,n2,o1,o2,&x1,&x2,i+1,codebookConfig->codebookType.choice.type1->codebookMode); + csi_report->csi_meas_bitlen.pmi_x1_bitlen[i]=x1; + csi_report->csi_meas_bitlen.pmi_x2_bitlen[i]=x2; + } + } + else + AssertFatal(1==0,"Type1 Multi-panel Codebook Config not yet implemented\n"); + } + else + AssertFatal(1==0,"Type2 Codebook Config not yet implemented\n"); + } + } +} + void compute_cqi_bitlen(struct NR_CSI_ReportConfig *csi_reportconfig, - uint8_t max_ri, + uint8_t ri_restriction, nr_csi_report_t *csi_report){ struct NR_CodebookConfig *codebookConfig = csi_reportconfig->codebookConfig; struct NR_CSI_ReportConfig__reportFreqConfiguration *freq_config = csi_reportconfig->reportFreqConfiguration; if (*freq_config->cqi_FormatIndicator == NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI) { - csi_report->csi_meas_bitlen.cqi_bitlen = 4; - if(codebookConfig != NULL) { - if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel == codebookConfig->codebookType.choice.type1->subType.present){ - struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; - if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { - if (type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present > - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction) { - // more than 4 antenna ports - if (max_ri > 4) - csi_report->csi_meas_bitlen.cqi_bitlen += 4; // CQI for second TB + for(int i=0; i<8; i++) { + if ((ri_restriction>>i)&0x01) { + csi_report->csi_meas_bitlen.cqi_bitlen[i] = 4; + if(codebookConfig != NULL) { + if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel == codebookConfig->codebookType.choice.type1->subType.present){ + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *type1single = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; + if (type1single->nrOfAntennaPorts.present == NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo) { + if (type1single->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present > + NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction) { + // more than 4 antenna ports + if (i > 4) + csi_report->csi_meas_bitlen.cqi_bitlen[i] += 4; // CQI for second TB + } + } } } } + else + csi_report->csi_meas_bitlen.cqi_bitlen[i] = 0; } } else AssertFatal(1==0,"Sub-band CQI reporting not yet supported"); } + //!TODO : same function can be written to handle csi_resources void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP){ uint8_t csi_report_id = 0; uint8_t nb_resources = 0; - uint8_t max_ri = 0; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; NR_CSI_ResourceConfigId_t csi_ResourceConfigId; struct NR_CSI_ResourceConfig *csi_resourceconfig; @@ -428,8 +622,21 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in break; case (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI): csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2(nb_resources)); - max_ri = compute_ri_bitlen(csi_reportconfig, csi_report); - compute_cqi_bitlen(csi_reportconfig, max_ri, csi_report); + csi_report->csi_meas_bitlen.ri_restriction = compute_ri_bitlen(csi_reportconfig, csi_report); + compute_cqi_bitlen(csi_reportconfig, csi_report->csi_meas_bitlen.ri_restriction, csi_report); + break; + case (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI): + csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2(nb_resources)); + csi_report->csi_meas_bitlen.ri_restriction = compute_ri_bitlen(csi_reportconfig, csi_report); + compute_cqi_bitlen(csi_reportconfig, csi_report->csi_meas_bitlen.ri_restriction, csi_report); + compute_pmi_bitlen(csi_reportconfig, csi_report->csi_meas_bitlen.ri_restriction, csi_report); + break; + case (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI): + csi_report->csi_meas_bitlen.cri_bitlen=ceil(log2(nb_resources)); + csi_report->csi_meas_bitlen.ri_restriction = compute_ri_bitlen(csi_reportconfig, csi_report); + compute_li_bitlen(csi_reportconfig, csi_report->csi_meas_bitlen.ri_restriction, csi_report); + compute_cqi_bitlen(csi_reportconfig, csi_report->csi_meas_bitlen.ri_restriction, csi_report); + compute_pmi_bitlen(csi_reportconfig, csi_report->csi_meas_bitlen.ri_restriction, csi_report); break; default: AssertFatal(1==0,"Not yet supported CSI report quantity type"); @@ -442,7 +649,8 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, int UE_id, uint8_t csi_report_id) { - uint16_t csi_bitlen =0; + uint16_t csi_bitlen = 0; + uint16_t max_bitlen = 0; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; L1_RSRP_bitlen_t * CSI_report_bitlen = NULL; CSI_Meas_bitlen_t * csi_meas_bitlen = NULL; @@ -455,7 +663,18 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, (CSI_report_bitlen->nb_ssbri_cri -1 ))); } else{ csi_meas_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements - csi_bitlen+= (csi_meas_bitlen->cri_bitlen +csi_meas_bitlen->ri_bitlen+csi_meas_bitlen->li_bitlen+csi_meas_bitlen->cqi_bitlen+csi_meas_bitlen->pmi_x1_bitlen+csi_meas_bitlen->pmi_x2_bitlen); + uint16_t temp_bitlen; + for (int i=0; i<8; i++) { + temp_bitlen = (csi_meas_bitlen->cri_bitlen+ + csi_meas_bitlen->ri_bitlen+ + csi_meas_bitlen->li_bitlen[i]+ + csi_meas_bitlen->cqi_bitlen[i]+ + csi_meas_bitlen->pmi_x1_bitlen[i]+ + csi_meas_bitlen->pmi_x2_bitlen[i]); + if(temp_bitlen>max_bitlen) + max_bitlen = temp_bitlen; + } + csi_bitlen += max_bitlen; } return csi_bitlen; @@ -723,36 +942,32 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) { idx: resource set index */ - //for all reported SSB - for (idx = 0; idx < nb_of_csi_ssb_report; idx++) { - nr_ssbri_cri = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri; - //extracting the ssb indexes - for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { - ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx]; - } - - //if strongest measured RSRP is configured - strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; - LOG_D(NR_MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); - - //if current ssb rsrp is greater than better rsrp - if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report; - } - - for(diff_rsrp_idx =1; diff_rsrp_idx < nr_ssbri_cri; diff_rsrp_idx++) { - ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx-1], strongest_ssb_rsrp); - - //if current reported rsrp is greater than better rsrp - if(ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] > better_rsrp_reported) { - better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx]; - target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; - } - } + nr_ssbri_cri = sched_ctrl->CSI_report.ssb_cri_report.nr_ssbri_cri; + //extracting the ssb indexes + for (ssb_idx = 0; ssb_idx < nr_ssbri_cri; ssb_idx++) { + ssb_index[idx * nb_of_csi_ssb_report + ssb_idx] = sched_ctrl->CSI_report.ssb_cri_report.CRI_SSBRI[ssb_idx]; } + //if strongest measured RSRP is configured + strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report.ssb_cri_report.RSRP); + ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp; + LOG_D(NR_MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp); + + //if current ssb rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_of_csi_ssb_report] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report; + } + + for(diff_rsrp_idx =1; diff_rsrp_idx < nr_ssbri_cri; diff_rsrp_idx++) { + ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report.ssb_cri_report.diff_RSRP[diff_rsrp_idx-1], strongest_ssb_rsrp); + + //if current reported rsrp is greater than better rsrp + if(ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx] > better_rsrp_reported) { + better_rsrp_reported = ssb_rsrp[idx * nb_of_csi_ssb_report + diff_rsrp_idx]; + target_ssb_beam_index = idx * nb_of_csi_ssb_report + diff_rsrp_idx; + } + } if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) { if( ssb_rsrp[target_ssb_beam_index] - ssb_rsrp[curr_ssb_beam_index] > L1_RSRP_HYSTERIS) { @@ -881,7 +1096,8 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, int *cumul_bits, NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){ - uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; + nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id]; + uint8_t cri_ssbri_bitlen = csi_report->CSI_report_bitlen.cri_ssbri_bitlen; uint16_t curr_payload; /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report @@ -902,44 +1118,43 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info, multiple simultaneous spatial domain receive filter */ - int idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; + sched_ctrl->CSI_report.ssb_cri_report.nr_ssbri_cri = csi_report->CSI_report_bitlen.nb_ssbri_cri; - for (int csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { + for (int csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { curr_payload = pickandreverse_bits(payload, cri_ssbri_bitlen, *cumul_bits); - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] = - *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] = - *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { + sched_ctrl->CSI_report.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] = + *(csi_report->SSB_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + LOG_D(MAC,"SSB_index = %d\n",sched_ctrl->CSI_report.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]); + } + else { + sched_ctrl->CSI_report.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] = + *(csi_report->CSI_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); + LOG_D(MAC,"CSI-RS Resource Indicator = %d\n",sched_ctrl->CSI_report.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]); + } *cumul_bits += cri_ssbri_bitlen; - if(UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type == NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP) - LOG_D(MAC,"CSI-RS Resource Indicator = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]); - else - LOG_D(MAC,"SSB Resource Indicator = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]); + } curr_payload = pickandreverse_bits(payload, 7, *cumul_bits); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = curr_payload & 0x7f; + sched_ctrl->CSI_report.ssb_cri_report.RSRP = curr_payload & 0x7f; *cumul_bits += 7; - for (int diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { + for (int diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { curr_payload = pickandreverse_bits(payload, 4, *cumul_bits); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = curr_payload & 0x0f; + sched_ctrl->CSI_report.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = curr_payload & 0x0f; *cumul_bits += 4; } - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - int strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); + csi_report->nb_of_csi_ssb_report++; + int strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report.ssb_cri_report.RSRP); NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; // including ssb rsrp in mac stats stats->cumul_rsrp += strongest_ssb_rsrp; stats->num_rsrp_meas++; LOG_D(MAC,"rsrp_id = %d rsrp = %d\n", - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP, - strongest_ssb_rsrp); + sched_ctrl->CSI_report.ssb_cri_report.RSRP, + get_measured_rsrp(sched_ctrl->CSI_report.ssb_cri_report.RSRP)); } @@ -948,39 +1163,122 @@ void evaluate_cri_report(uint8_t *payload, int cumul_bits, NR_UE_sched_ctrl_t *sched_ctrl){ - int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id? - uint8_t temp_cri = pickandreverse_bits(payload, cri_bitlen, cumul_bits); - sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.cri = temp_cri; + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cri = temp_cri; } -void evaluate_ri_report(uint8_t *payload, - uint8_t ri_bitlen, - NR_UE_sched_ctrl_t *sched_ctrl){ +int evaluate_ri_report(uint8_t *payload, + uint8_t ri_bitlen, + uint8_t ri_restriction, + int cumul_bits, + NR_UE_sched_ctrl_t *sched_ctrl){ - AssertFatal(1==0,"Evaluation of RI report not yet implemented\n"); + uint8_t ri_index = pickandreverse_bits(payload, ri_bitlen, cumul_bits); + int count=0; + for (int i=0; i<8; i++) { + if ((ri_restriction>>i)&0x01) { + if(count == ri_index) { + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.ri = i; + LOG_I(MAC,"CSI Reported Rank %d\n", i+1); + return i; + } + count++; + } + } + AssertFatal(1==0, "Decoded ri %d does not correspond to any valid value in ri_restriction %d\n",ri_index,ri_restriction); } void evaluate_cqi_report(uint8_t *payload, - uint8_t cqi_bitlen, - int *cumul_bits, - NR_UE_sched_ctrl_t *sched_ctrl){ + nr_csi_report_t *csi_report, + int cumul_bits, + uint8_t ri, + NR_UE_sched_ctrl_t *sched_ctrl, + long *cqi_Table){ //TODO sub-band CQI report not yet implemented - int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id? - - uint8_t temp_cqi = pickandreverse_bits(payload, 4, *cumul_bits); - sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi; - *cumul_bits += 4; + int cqi_bitlen = csi_report->csi_meas_bitlen.cqi_bitlen[ri]; + + uint8_t temp_cqi = pickandreverse_bits(payload, 4, cumul_bits); + + // NR_CSI_ReportConfig__cqi_Table_table1 = 0 + // NR_CSI_ReportConfig__cqi_Table_table2 = 1 + // NR_CSI_ReportConfig__cqi_Table_table3 = 2 + if (cqi_Table) + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.cqi_table = *cqi_Table; + else + AssertFatal(1==0,"CQI Table not present in RRC configuration\n"); + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi; LOG_I(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi); if (cqi_bitlen > 4) { - temp_cqi = pickandreverse_bits(payload, 4, *cumul_bits); - sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi; + temp_cqi = pickandreverse_bits(payload, 4, cumul_bits); + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi; LOG_D(MAC,"Wide-band CQI for the second TB %d\n", temp_cqi); } + sched_ctrl->set_mcs = TRUE; } + +uint8_t evaluate_pmi_report(uint8_t *payload, + nr_csi_report_t *csi_report, + int cumul_bits, + uint8_t ri, + NR_UE_sched_ctrl_t *sched_ctrl){ + + int x1_bitlen = csi_report->csi_meas_bitlen.pmi_x1_bitlen[ri]; + int x2_bitlen = csi_report->csi_meas_bitlen.pmi_x2_bitlen[ri]; + int tot_bitlen = x1_bitlen + x2_bitlen; + + //in case of 2 port CSI configuration x1 is empty and the information bits are in x2 + int temp_pmi = pickandreverse_bits(payload, tot_bitlen, cumul_bits); + + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1 = temp_pmi&((1<CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2 = (temp_pmi>>x1_bitlen)&((1<CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1, + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2); + + return tot_bitlen; + +} + + +int evaluate_li_report(uint8_t *payload, + nr_csi_report_t *csi_report, + int cumul_bits, + uint8_t ri, + NR_UE_sched_ctrl_t *sched_ctrl){ + + int li_bitlen = csi_report->csi_meas_bitlen.li_bitlen[ri]; + + if (li_bitlen>0) { + int temp_li = pickandreverse_bits(payload, li_bitlen, cumul_bits); + LOG_I(MAC,"LI %d\n",temp_li); + sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.li = temp_li; + } + return li_bitlen; + +} + +void skip_zero_padding(int *cumul_bits, + nr_csi_report_t *csi_report, + uint8_t ri, + uint16_t max_bitlen) { + + // actual number of reported bits depends on the reported rank + // zero padding bits are added to have a predetermined max bit length to decode + + uint16_t reported_bitlen = csi_report->csi_meas_bitlen.cri_bitlen+ + csi_report->csi_meas_bitlen.ri_bitlen+ + csi_report->csi_meas_bitlen.li_bitlen[ri]+ + csi_report->csi_meas_bitlen.cqi_bitlen[ri]+ + csi_report->csi_meas_bitlen.pmi_x1_bitlen[ri]+ + csi_report->csi_meas_bitlen.pmi_x2_bitlen[ri]; + + *cumul_bits+=(max_bitlen-reported_bitlen); +} + + void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, frame_t frame, @@ -993,21 +1291,25 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; + uint16_t bitlen = uci_pdu->csi_part1.csi_part1_bit_len; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; int cumul_bits = 0; + int r_index = -1; for (int csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; + nr_csi_report_t *csi_report = &UE_info->csi_report_template[UE_id][csi_report_id]; + csi_report->nb_of_csi_ssb_report = 0; uint8_t cri_bitlen = 0; uint8_t ri_bitlen = 0; - uint8_t cqi_bitlen = 0; + uint8_t li_bitlen = 0; + uint8_t pmi_bitlen = 0; NR_CSI_ReportConfig_t *csirep = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; int period, offset; csi_period_offset(csirep, NULL, &period, &offset); // verify if report with current id has been scheduled for this frame and slot if ((n_slots_frame*frame + slot - offset)%period == 0) { - reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; + reportQuantity_type = csi_report->reportQuantity_type; LOG_D(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); switch(reportQuantity_type){ case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP: @@ -1017,18 +1319,49 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type); break; case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI: - cri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen; + cri_bitlen = csi_report->csi_meas_bitlen.cri_bitlen; if(cri_bitlen) evaluate_cri_report(payload,cri_bitlen,cumul_bits,sched_ctrl); cumul_bits += cri_bitlen; - ri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen; + ri_bitlen = csi_report->csi_meas_bitlen.ri_bitlen; if(ri_bitlen) - evaluate_ri_report(payload,ri_bitlen,sched_ctrl); + r_index = evaluate_ri_report(payload,ri_bitlen,csi_report->csi_meas_bitlen.ri_restriction,cumul_bits,sched_ctrl); cumul_bits += ri_bitlen; - //TODO add zero padding bits when needed - cqi_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen; - if(cqi_bitlen) - evaluate_cqi_report(payload,cqi_bitlen,&cumul_bits,sched_ctrl); + if (r_index != -1) + skip_zero_padding(&cumul_bits,csi_report,r_index,bitlen); + evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl,csirep->cqi_Table); + break; + case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI: + cri_bitlen = csi_report->csi_meas_bitlen.cri_bitlen; + if(cri_bitlen) + evaluate_cri_report(payload,cri_bitlen,cumul_bits,sched_ctrl); + cumul_bits += cri_bitlen; + ri_bitlen = csi_report->csi_meas_bitlen.ri_bitlen; + if(ri_bitlen) + r_index = evaluate_ri_report(payload,ri_bitlen,csi_report->csi_meas_bitlen.ri_restriction,cumul_bits,sched_ctrl); + cumul_bits += ri_bitlen; + if (r_index != -1) + skip_zero_padding(&cumul_bits,csi_report,r_index,bitlen); + pmi_bitlen = evaluate_pmi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl); + cumul_bits += pmi_bitlen; + evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl,csirep->cqi_Table); + break; + case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI: + cri_bitlen = csi_report->csi_meas_bitlen.cri_bitlen; + if(cri_bitlen) + evaluate_cri_report(payload,cri_bitlen,cumul_bits,sched_ctrl); + cumul_bits += cri_bitlen; + ri_bitlen = csi_report->csi_meas_bitlen.ri_bitlen; + if(ri_bitlen) + r_index = evaluate_ri_report(payload,ri_bitlen,csi_report->csi_meas_bitlen.ri_restriction,cumul_bits,sched_ctrl); + cumul_bits += ri_bitlen; + li_bitlen = evaluate_li_report(payload,csi_report,cumul_bits,r_index,sched_ctrl); + cumul_bits += li_bitlen; + if (r_index != -1) + skip_zero_padding(&cumul_bits,csi_report,r_index,bitlen); + pmi_bitlen = evaluate_pmi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl); + cumul_bits += pmi_bitlen; + evaluate_cqi_report(payload,csi_report,cumul_bits,r_index,sched_ctrl,csirep->cqi_Table); break; default: AssertFatal(1==0, "Invalid or not supported CSI measurement report\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index e77fa0ef29..aa49b14fe5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -720,7 +720,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt++; UE_info->mac_stats[UE_id].ulsch_DTX++; } - if (UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { + if (!get_softmodem_params()->phy_test && UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt >= pusch_failure_thres) { LOG_W(NR_MAC,"Detected UL Failure on PUSCH after %d PUSCH DTX, stopping scheduling\n", UE_info->UE_sched_ctrl[UE_id].pusch_consecutive_dtx_cnt); UE_info->UE_sched_ctrl[UE_id].ul_failure = 1; @@ -985,8 +985,11 @@ bool allocate_ul_retransmission(module_id_t module_id, if (ps->time_domain_allocation != tda || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data + || sched_ctrl->update_pusch_ps) { nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + sched_ctrl->update_pusch_ps = false; + } /* Check the resource is enough for retransmission */ while (rbStart < bwpSize && @@ -996,7 +999,6 @@ bool allocate_ul_retransmission(module_id_t module_id, LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); return false; } - LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } else { NR_pusch_semi_static_t temp_ps; @@ -1015,9 +1017,11 @@ bool allocate_ul_retransmission(module_id_t module_id, uint16_t new_rbSize; bool success = nr_find_nb_rb(retInfo->Qm, retInfo->R, + 1, // layers temp_ps.nrOfSymbols, temp_ps.N_PRB_DMRS * temp_ps.num_dmrs_symb, retInfo->tb_size, + 1, /* minimum of 1RB: need to find exact TBS, don't preclude any number */ rbSize, &new_tbs, &new_rbSize); @@ -1218,8 +1222,11 @@ void pf_ul(module_id_t module_id, const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data + || sched_ctrl->update_pusch_ps) { nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + sched_ctrl->update_pusch_ps = false; + } LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); while (rbStart < bwpSize && @@ -1273,8 +1280,9 @@ void pf_ul(module_id_t module_id, } + const int min_rbSize = 5; /* Loop UE_sched to find max coeff and allocate transmission */ - while (UE_sched.head >= 0 && max_num_ue> 0 && n_rb_sched > 0) { + while (UE_sched.head >= 0 && max_num_ue> 0 && n_rb_sched >= min_rbSize) { /* Find max coeff */ int *max = &UE_sched.head; /* Find max coeff: assume head is max */ int *p = &UE_sched.next[*max]; @@ -1320,8 +1328,7 @@ void pf_ul(module_id_t module_id, /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ max_num_ue--; - if (max_num_ue < 0) - return; + AssertFatal(max_num_ue >= 0, "Illegal max_num_ue %d\n", max_num_ue); NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; @@ -1340,8 +1347,11 @@ void pf_ul(module_id_t module_id, const int tda = sched_ctrl->active_ubwp ? nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot] : 0; if (ps->time_domain_allocation != tda || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data + || sched_ctrl->update_pusch_ps) { nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + sched_ctrl->update_pusch_ps = false; + } update_ul_ue_R_Qm(sched_pusch, ps); while (rbStart < bwpSize && @@ -1367,9 +1377,11 @@ void pf_ul(module_id_t module_id, uint32_t TBS = 0; nr_find_nb_rb(sched_pusch->Qm, sched_pusch->R, + 1, // layers ps->nrOfSymbols, ps->N_PRB_DMRS * ps->num_dmrs_symb, B, + min_rbSize, max_rbSize, &TBS, &rbSize); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index e59574fd54..8b734e3b95 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -245,7 +245,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu, uint16_t O_csi, uint16_t O_ack, uint8_t O_sr, - int r_pucch); + int r_pucch); void find_search_space(int ss_type, NR_BWP_Downlink_t *bwp, @@ -318,7 +318,8 @@ void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, const NR_BWP_Downlink_t *bwp, const NR_BWP_DownlinkDedicated_t *bwpd0, int tda, - const long dci_format, + uint8_t layers, + NR_UE_sched_ctrl_t *sched_ctrl, NR_pdsch_semi_static_t *ps); void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc, @@ -358,6 +359,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); @@ -462,6 +464,13 @@ void find_SSB_and_RO_available(module_id_t module_idP); void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps); +void set_dl_mcs(NR_sched_pdsch_t *sched_pdsch, + NR_UE_sched_ctrl_t *sched_ctrl, + uint8_t *target_mcs, + uint8_t mcs_table_idx); + +uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl); + void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp); void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp); @@ -469,9 +478,11 @@ bool find_free_CCE(module_id_t module_id, sub_frame_t slot, int UE_id); bool nr_find_nb_rb(uint16_t Qm, uint16_t R, + uint8_t nrOfLayers, uint16_t nb_symb_sch, uint16_t nb_dmrs_prb, uint32_t bytes, + uint16_t nb_rb_min, uint16_t nb_rb_max, uint32_t *tbs, uint16_t *nb_rb); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1dc7de00e0..eccffca031 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" @@ -397,7 +397,8 @@ typedef struct NR_sched_srs { typedef struct NR_pdsch_semi_static { int time_domain_allocation; uint8_t numDmrsCdmGrpsNoData; - + uint8_t frontloaded_symb; + int mapping_type; int startSymbolIndex; int nrOfSymbols; uint8_t nrOfLayers; @@ -483,6 +484,7 @@ struct CRI_RI_LI_PMI_CQI { uint8_t pmi_x2; uint8_t wb_cqi_1tb; uint8_t wb_cqi_2tb; + uint8_t cqi_table; }; typedef struct CRI_SSB_RSRP { @@ -493,11 +495,8 @@ typedef struct CRI_SSB_RSRP { } CRI_SSB_RSRP_t; struct CSI_Report { - NR_CSI_Report_Config_PR present; - union Config_CSI_Report { - struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; - struct CRI_SSB_RSRP ssb_cri_report; - } choice; + struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; + struct CRI_SSB_RSRP ssb_cri_report; }; #define MAX_SR_BITLEN 8 @@ -510,12 +509,13 @@ typedef struct { }L1_RSRP_bitlen_t; typedef struct{ + uint8_t ri_restriction; uint8_t cri_bitlen; uint8_t ri_bitlen; - uint8_t li_bitlen; - uint8_t pmi_x1_bitlen; - uint8_t pmi_x2_bitlen; - uint8_t cqi_bitlen; + uint8_t li_bitlen[8]; + uint8_t pmi_x1_bitlen[8]; + uint8_t pmi_x2_bitlen[8]; + uint8_t cqi_bitlen[8]; } CSI_Meas_bitlen_t; typedef struct nr_csi_report { @@ -624,9 +624,11 @@ typedef struct { int pusch_consecutive_dtx_cnt; int pucch_consecutive_dtx_cnt; int ul_failure; - struct CSI_Report CSI_report[MAX_CSI_REPORTS]; + struct CSI_Report CSI_report; bool SR; - + bool update_pdsch_ps; + bool update_pusch_ps; + bool set_mcs; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free @@ -679,7 +681,6 @@ typedef struct { NR_mac_stats_t mac_stats[MAX_MOBILES_PER_GNB]; NR_list_t list; int num_UEs; - bool active[MAX_MOBILES_PER_GNB]; rnti_t rnti[MAX_MOBILES_PER_GNB]; NR_CellGroupConfig_t *CellGroup[MAX_MOBILES_PER_GNB]; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 4d2e157728..108a5dbe91 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -48,7 +48,6 @@ #include "platform_constants.h" #include "nfapi/oai_integration/vendor_ext.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#include "msc.h" #include "common/ngran_types.h" #include "targets/COMMON/openairinterface5g_limits.h" #include "targets/RT/USER/lte-softmodem.h" @@ -60,7 +59,6 @@ #include # include "gtpv1u_eNB_task.h" -# include "gtpv1u.h" #include #include "ENB_APP/enb_config.h" @@ -229,7 +227,7 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt, LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; - itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); + itti_send_msg_to_task(TASK_GTPV1_U, CUuniqInstance, message_p); return TRUE; } @@ -1058,14 +1056,6 @@ pdcp_data_ind( ctxt_pP->rnti, rb_id + 4, sdu_buffer_sizeP - payload_offset ); - MSC_LOG_TX_MESSAGE( - MSC_PDCP_ENB, - MSC_GTPU_ENB, - NULL,0, - "0 GTPV1U_ENB_TUNNEL_DATA_REQ ue %x rab %u len %u", - ctxt_pP->rnti, - rb_id + 4, - sdu_buffer_sizeP - payload_offset); //LOG_T(PDCP,"Sending to GTPV1U %d bytes\n", sdu_buffer_sizeP - payload_offset); gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX); @@ -1078,7 +1068,7 @@ pdcp_data_ind( GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; - itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); packet_forwarded = TRUE; } } else { @@ -2228,20 +2218,6 @@ pdcp_config_set_security( pdcp_pP->kUPenc = kUPenc; /* Activate security */ pdcp_pP->security_activated = 1; - MSC_LOG_EVENT( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - "0 Set security ciph %X integ %x UE %"PRIx16" ", - pdcp_pP->cipheringAlgorithm, - pdcp_pP->integrityProtAlgorithm, - ctxt_pP->rnti); - } else { - MSC_LOG_EVENT( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - "0 Set security failed UE %"PRIx16" ", - ctxt_pP->rnti); - LOG_E(PDCP,PROTOCOL_PDCP_CTXT_FMT" bad security mode %d", - PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP), - security_modeP); } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index b49b020428..f6a61330d0 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -58,7 +58,6 @@ extern int otg_enabled; #include "nfapi/oai_integration/vendor_ext.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "platform_constants.h" -#include "msc.h" #include "pdcp.h" #include "assertions.h" @@ -85,8 +84,6 @@ extern struct msghdr nas_msg_rx; # include "gtpv1u_eNB_task.h" -# include "gtpv1u_eNB_defs.h" - extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP); uint16_t ue_id_g; // Global variable to identify the ID for each UE. It is updated in main() of lte-uesoftmodem.c @@ -343,12 +340,6 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, ctxt.rnti, rab_id); - MSC_LOG_RX_MESSAGE((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, - NULL, 0, - MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt.instance, rab_id, rab_id, len); pdcp_data_req( &ctxt, SRB_FLAG_NO, @@ -368,14 +359,6 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p // , NULL, NULL // ); } else { - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt.instance, rab_id, rab_id, len); LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, @@ -566,17 +549,6 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.destinationL2Id ); } else { /* else of h_rc == HASH_TABLE_OK */ - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - pdcp_read_header_g.inst, - pdcp_read_header_g.rb_id, - rab_id, - pdcp_read_header_g.data_size); LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", ctxt.frame, @@ -739,17 +711,6 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) ctxt.module_id, ctxt.rnti, rab_id); - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - pc5s_header->inst, - pc5s_header->rb_id, - rab_id, - pc5s_header->data_size); /* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and * gcc, from v9, now warns about it. fix these warnings by using local variables @@ -771,17 +732,6 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) pc5s_header->sourceL2Id = sourceL2Id; pc5s_header->destinationL2Id=destinationL2Id; } else { /* else of h_rc == HASH_TABLE_OK */ - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - pc5s_header->inst, - pc5s_header->rb_id, - rab_id, - pc5s_header->data_size); LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", ctxt.frame, @@ -803,16 +753,6 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP) ctxt.module_id, ctxt.rnti, DEFAULT_RAB_ID); - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, - NULL,0, - MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u default rab %u size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - pc5s_header->inst, - pc5s_header->rb_id, - DEFAULT_RAB_ID, - pc5s_header->data_size); /* pointers to pc5s_header fields possibly not aligned because pc5s_header points to a packed structure * Using these possibly unaligned pointers in a function call may trigger alignment errors at run time and * gcc, from v9, now warns about it. fix these warnings by using local variables diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c index 891c38209b..0bd1b8fa8d 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c @@ -60,7 +60,6 @@ #include "pdcp.h" #include "pdcp_primitives.h" -#include "msc.h" #define PDCP_QUEUE_NB_ELEMENTS 200 @@ -187,7 +186,6 @@ void *pdcp_netlink_thread_fct(void *arg) pdcp_thread_read_state = 0; memset(nl_rx_buf, 0, NL_MAX_PAYLOAD); LOG_I(PDCP, "[NETLINK_THREAD] binding to fd %d\n",nas_sock_fd); - MSC_START_USE(); while (1) { len = recvmsg(nas_sock_fd, &nas_msg_rx, 0); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index cb108f5d26..6664dd2a33 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -37,7 +37,6 @@ #include "LAYER2/MAC/mac_extern.h" #include "pdcp.h" -#include "msc.h" #include "pdcp_primitives.h" //----------------------------------------------------------------------------- @@ -223,11 +222,6 @@ pdcp_validate_security( if (stream_check_integrity(pdcp_pP->integrityProtAlgorithm, &decrypt_params, &pdcp_pdu_buffer[sdu_buffer_size]) != 0) { - MSC_LOG_EVENT( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - " Security: failed MAC-I Algo %X UE %"PRIx16" ", - pdcp_pP->integrityProtAlgorithm, - ctxt_pP->rnti); LOG_E(PDCP, "[OSA][RB %ld] %s failed to validate MAC-I (key %llx) of incoming PDU\n", rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/PROTO_AGENT/cu_test.c b/openair2/LAYER2/PROTO_AGENT/cu_test.c deleted file mode 100644 index a26b06dd41..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/cu_test.c +++ /dev/null @@ -1,172 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "ENB_APP/enb_paramdef.h" -#include "LAYER2/PROTO_AGENT/proto_agent.h" -#define BUF_MAX 1400 - -int recv_client = 0; -FILE *output; - -void usage(char *prg_name) { - fprintf(stderr, "usage: %s \n", prg_name); - fprintf(stderr, " - is stdin\n"); - fprintf(stderr, " received packets are written to stdout\n"); -} - -long uelapsed(struct timeval *s, struct timeval *e) { - return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec); -} - -boolean_t -pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_buffer_sizeP, - mem_block_t *const sdu_buffer_pP -) { - fwrite(sdu_buffer_pP->data, sdu_buffer_sizeP, 1, stdout); - fflush(stdout); - free_mem_block(sdu_buffer_pP, __func__); - /* cannot free because of const */ - //free(ctxt_pP); - recv_client = 1; - return 0; -} - -void close_proto_agent(void) { - proto_agent_stop(0); -} - -int main(int argc, char *argv[]) { - const cudu_params_t params = { - .local_ipv4_address = "192.168.12.45", - .local_port = 6464, - .remote_ipv4_address = "192.168.12.45", - .remote_port = 6465 - }; - protocol_ctxt_t p; - memset(&p, 0, sizeof p); - mem_block_t mem; - char s[BUF_MAX]; - size_t size, totsize = 0; - struct timeval t_start, t_end; - FILE *f; - - if (argc != 2) { - usage(argv[0]); - return 1; - } - - if (strcmp(argv[1], "-") == 0) { - f = stdin; - } else { - f = fopen(argv[1], "r"); - } - - if (!f) { - fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno)); - return 2; - } - - pool_buffer_init(); - - if (proto_agent_start(0, ¶ms) != 0) { - fprintf(stderr, "error on proto_agent_start()\n"); - fclose(f); - return 3; - } - - atexit(close_proto_agent); - - /* wait for first packet of client */ - while (!recv_client) sleep(1); - - fprintf(stderr, "reading file\n"); - /* now send back at the same time */ - gettimeofday(&t_start, NULL); - - while ((size = fread(s, 1, BUF_MAX, f)) > 0) { - usleep(10); - totsize += size; - mem.data = &s[0]; - proto_agent_send_rlc_data_req(&p, 0, 0, 0, 0, 0, size, &mem); - } - - gettimeofday(&t_end, NULL); - fclose(f); - long us = uelapsed(&t_start, &t_end); - fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", - totsize, us / 1000, ((float) totsize ) / us, - ((float) totsize) / us * 8); - fprintf(stderr, "check files using 'diff afile bfile'\n"); - /* give some time in case the other direction is slower */ - sleep(5); - return 0; -} - -/* - ********************************************************* - * arbitrary functions, needed for linking (used or not) * - ********************************************************* - */ - -rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id - ) { - fprintf(stderr, "This should never be called on the CU\n"); - exit(1); -} - -pthread_t new_thread(void *(*f)(void *), void *b) { - pthread_t t; - pthread_attr_t att; - - if (pthread_attr_init(&att)) { - fprintf(stderr, "pthread_attr_init err\n"); - exit(1); - } - - if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { - fprintf(stderr, "pthread_attr_setdetachstate err\n"); - exit(1); - } - - if (pthread_create(&t, &att, f, b)) { - fprintf(stderr, "pthread_create err\n"); - exit(1); - } - - if (pthread_attr_destroy(&att)) { - fprintf(stderr, "pthread_attr_destroy err\n"); - exit(1); - } - - return t; -} - -int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) { - return 0; -} - -int config_get(paramdef_t *params,int numparams, char *prefix) { - return 0; -} - -int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) { - return 0; -} diff --git a/openair2/LAYER2/PROTO_AGENT/du_test.c b/openair2/LAYER2/PROTO_AGENT/du_test.c deleted file mode 100644 index ee62298438..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/du_test.c +++ /dev/null @@ -1,163 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "ENB_APP/enb_paramdef.h" -#include "LAYER2/PROTO_AGENT/proto_agent.h" - -#define BUF_MAX 1400 - -void usage(char *prg_name) { - fprintf(stderr, "usage: %s \n", prg_name); - fprintf(stderr, " - is stdin\n"); - fprintf(stderr, " received packets are written to stdout\n"); -} - -long uelapsed(struct timeval *s, struct timeval *e) { - return e->tv_sec * 1000000 + e->tv_usec - (s->tv_sec * 1000000 + s->tv_usec); -} - - -rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id - ) { - fwrite(sdu_pP->data, sdu_sizeP, 1, stdout); - fflush(stdout); - free_mem_block(sdu_pP, __func__); - //free(ctxt_pP); - return 0; -} - -void close_proto_agent(void) { - proto_agent_stop(0); -} - -int main(int argc, char *argv[]) { - const cudu_params_t params = { - .local_ipv4_address = "192.168.12.45", - .local_port = 6465, - .remote_ipv4_address = "192.168.12.45", - .remote_port = 6464 - }; - protocol_ctxt_t p; - memset(&p, 0, sizeof p); - mem_block_t mem; - char s[BUF_MAX]; - size_t size, totsize = 0; - struct timeval t_start, t_end; - FILE *f; - - if (argc != 2) { - usage(argv[0]); - return 1; - } - - if (strcmp(argv[1], "-") == 0) { - f = stdin; - } else { - f = fopen(argv[1], "r"); - } - - if (!f) { - fprintf(stderr, "cannot open %s: %s\n", argv[1], strerror(errno)); - return 2; - } - - pool_buffer_init(); - - if (proto_agent_start(0, ¶ms) != 0) { - fprintf(stderr, "error on proto_agent_start()\n"); - fclose(f); - return 3; - } - - atexit(close_proto_agent); - gettimeofday(&t_start, NULL); - - while ((size = fread(s, 1, BUF_MAX, f)) > 0) { - usleep(10); - totsize += size; - mem.data = &s[0]; - proto_agent_send_pdcp_data_ind(&p, 0, 0, 0, size, &mem); - } - - gettimeofday(&t_end, NULL); - fclose(f); - long us = uelapsed(&t_start, &t_end); - fprintf(stderr, "read %zu bytes in %ld ms -> %.3fMB/s, %.3fMbps\n", - totsize, us / 1000, ((float) totsize ) / us, - ((float) totsize) / us * 8); - fprintf(stderr, "check files using 'diff afile bfile'\n"); - /* wait, we are possibly receiving data */ - sleep(5); - return 0; -} - -/* - ********************************************************* - * arbitrary functions, needed for linking (used or not) * - ********************************************************* - */ - -boolean_t -pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_buffer_sizeP, - mem_block_t *const sdu_buffer_pP -) { - fprintf(stderr, "This should never be called on the DU\n"); - exit(1); -} - -pthread_t new_thread(void *(*f)(void *), void *b) { - pthread_t t; - pthread_attr_t att; - - if (pthread_attr_init(&att)) { - fprintf(stderr, "pthread_attr_init err\n"); - exit(1); - } - - if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { - fprintf(stderr, "pthread_attr_setdetachstate err\n"); - exit(1); - } - - if (pthread_create(&t, &att, f, b)) { - fprintf(stderr, "pthread_create err\n"); - exit(1); - } - - if (pthread_attr_destroy(&att)) { - fprintf(stderr, "pthread_attr_destroy err\n"); - exit(1); - } - - return t; -} - -int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) { - return 0; -} - -int config_get(paramdef_t *params,int numparams, char *prefix) { - return 0; -} - -int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) { - return 0; -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c deleted file mode 100644 index 5cf71b826d..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ /dev/null @@ -1,278 +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 enb_agent.h - * \brief top level enb agent receive thread and itti task - * \author Navid Nikaein and Xenofon Foukas - * \date 2016 - * \version 0.1 - */ -#define _GNU_SOURCE -#include "proto_agent_common.h" -#include "common/utils/LOG/log.h" -#include "proto_agent.h" -#include "assertions.h" -#include "proto_agent_net_comm.h" -#include "proto_agent_async.h" -#include -#include - -#define ENB_AGENT_MAX 9 - -proto_agent_instance_t proto_agent[MAX_DU]; - -//pthread_t new_thread(void *(*f)(void *), void *b); - -Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void *args); - -#define TEST_MOD 0 - -#define ECHO - -/* Server side function; upon a new connection - reception, sends the hello packets -*/ -int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) { - int channel_id; - // RS: CUDU does not work! - //DevAssert(p->local_interface); - //DevAssert(p->local_ipv4_address); - //DevAssert(p->local_port > 1024); // "unprivileged" port - //DevAssert(p->remote_ipv4_address); - //DevAssert(p->remote_port > 1024); // "unprivileged" port - proto_agent[mod_id].mod_id = mod_id; - proto_agent[mod_id].exit = 0; - /* Initialize the channel container */ - /* TODO only initialize the first time */ - proto_agent_init_channel_container(); - /*Create the async channel info*/ - proto_agent_async_channel_t *channel_info; - channel_info = proto_agent_async_channel_info(mod_id, p->local_ipv4_address, p->local_port, - p->remote_ipv4_address, p->remote_port); - - if (!channel_info) goto error; - - /* Create a channel using the async channel info */ - channel_id = proto_agent_create_channel((void *) channel_info, - proto_agent_async_msg_send, - proto_agent_async_msg_recv, - proto_agent_async_release); - - if (channel_id <= 0) goto error; - - proto_agent_channel_t *channel = proto_agent_get_channel(channel_id); - - if (!channel) goto error; - - proto_agent[mod_id].channel = channel; - /* Register the channel for all underlying agents (use ENB_AGENT_MAX) */ - proto_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); - // Code for sending the HELLO/ECHO_REQ message once a connection is established - //uint8_t *msg = NULL; - //Protocol__FlexsplitMessage *init_msg=NULL; - //if (udp == 0) - //{ - // // If the comm is not UDP, allow the server to send the first packet over the channel - // //printf( "Proto agent Server: Calling the echo_request packet constructor\n"); - // msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); - // if (msg_flag != 0) - // goto error; - // - // int msgsize = 0; - // if (init_msg != NULL) - // msg = proto_agent_pack_message(init_msg, &msgsize); - // if (msg!= NULL) - // { - // LOG_D(PROTO_AGENT, "Server sending the message over the async channel\n"); - // proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); - // } - // /* After sending the message, wait for any replies; - // the server thread blocks until it reads any data - // over the channel - // */ - //} - //proto_agent[mod_id].recv_thread = new_thread(proto_agent_receive, &proto_agent[mod_id]); - threadCreate(&proto_agent[mod_id].recv_thread, proto_agent_receive, &proto_agent[mod_id], "proto", -1, OAI_PRIORITY_RT_LOW); - fprintf(stderr, "[PROTO_AGENT] server started at port %s:%d\n", p->local_ipv4_address, p->local_port); - return 0; -error: - LOG_E(PROTO_AGENT, "there was an error\n"); - return 1; -} - -void proto_agent_stop(mod_id_t mod_id) { - if (!proto_agent[mod_id].channel) return; - - /* unlock the independent read thread proto_agent_receive() */ - proto_agent[mod_id].exit = 1; - proto_agent_async_msg_recv_unlock(proto_agent[mod_id].channel->channel_info); - proto_agent_async_release(proto_agent[mod_id].channel); - proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id); - free(proto_agent[mod_id].channel); - proto_agent[mod_id].channel = NULL; - LOG_W(PROTO_AGENT, "server stopped\n"); -} - -//void -//proto_agent_send_hello(void) -//{ -// uint8_t *msg = NULL; -// Protocol__FlexsplitMessage *init_msg=NULL; -// int msg_flag = 0; -// -// -// //printf( "PDCP agent: Calling the HELLO packet constructor\n"); -// msg_flag = proto_agent_hello(proto_agent[TEST_MOD].mod_id, NULL, &init_msg); -// -// int msgsize = 0; -// if (msg_flag == 0) -// { -// proto_agent_serialize_message(init_msg, &msg, &msgsize); -// } -// -// LOG_D(PROTO_AGENT, "Agent sending the message over the async channel\n"); -// proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[TEST_MOD]); -//} - - - -rlc_op_status_t proto_agent_send_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, const mui_t muiP, - confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,const uint32_t *const SrcID, const uint32_t *const DstID) { - uint8_t *msg = NULL; - Protocol__FlexsplitMessage *init_msg=NULL; - int msg_flag = 0; - int msgsize = 0; - mod_id_t mod_id = ctxt_pP->module_id; - data_req_args args; - DevAssert(proto_agent[mod_id].channel); - DevAssert(proto_agent[mod_id].channel->channel_info); - args.ctxt = ctxt_pP; - args.srb_flag = srb_flagP; - args.MBMS_flag = MBMS_flagP; - args.rb_id = rb_idP; - args.mui = muiP; - args.confirm = confirmP; - args.sdu_size = sdu_sizeP; - args.sdu_p = sdu_pP; - msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) &args, &init_msg); - - if (msg_flag != 0 || !init_msg) goto error; - - msg = proto_agent_pack_message(init_msg, &msgsize); - - if (!msg) goto error; - - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); - free_mem_block(sdu_pP, __func__); - return RLC_OP_STATUS_OK; -error: - LOG_E(PROTO_AGENT, "PROTO_AGENT there was an error\n"); - return RLC_OP_STATUS_INTERNAL_ERROR; -} - - -boolean_t proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, - sdu_size_t sdu_sizeP, mem_block_t *sdu_pP, - const uint32_t *const SrcID, const uint32_t *const DstID) { - uint8_t *msg = NULL; - Protocol__FlexsplitMessage *init_msg = NULL; - int msg_flag = 0; - int msgsize = 0; - mod_id_t mod_id = ctxt_pP->module_id; - data_req_args args; - DevAssert(proto_agent[mod_id].channel); - DevAssert(proto_agent[mod_id].channel->channel_info); - args.ctxt = ctxt_pP; - args.srb_flag = srb_flagP; - args.MBMS_flag = MBMS_flagP; - args.rb_id = rb_idP; - args.sdu_size = sdu_sizeP; - args.sdu_p = sdu_pP; - msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) &args, &init_msg); - - if (msg_flag != 0 || !init_msg) goto error; - - msg = proto_agent_pack_message(init_msg, &msgsize); - - if (!msg) goto error; - - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); - free_mem_block(sdu_pP, __func__); - return TRUE; -error: - LOG_E(PROTO_AGENT, "there was an error in %s\n", __func__); - return FALSE; -} - -void * -proto_agent_receive(void *args) { - proto_agent_instance_t *inst = args; - void *data = NULL; - int size; - int priority; - err_code_t err_code; - pthread_setname_np(pthread_self(), "proto_rx"); - Protocol__FlexsplitMessage *msg; - uint8_t *ser_msg; - - while (1) { - msg = NULL; - ser_msg = NULL; - - if ((size = proto_agent_async_msg_recv(&data, &priority, inst->channel->channel_info)) < 0) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - if (inst->exit) break; - - LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); - msg = proto_agent_handle_message(inst->mod_id, data, size); - - if (!msg) { - LOG_D(PROTO_AGENT, "msg to send back is NULL\n"); - continue; - } - - ser_msg = proto_agent_pack_message(msg, &size); - - if (!ser_msg) { - continue; - } - - LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); - - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(PROTO_AGENT, "sent message with size %d\n", size); - } - - return NULL; -error: - LOG_E(PROTO_AGENT, "proto_agent_receive(): error %d occured\n",err_code); - return NULL; -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h deleted file mode 100644 index 4badda43b7..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ /dev/null @@ -1,49 +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 proto_agent.h - * \brief top level protocol agent - * \author Navid Nikaein and Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#ifndef PROTO_AGENT_H_ -#define PROTO_AGENT_H_ -#include "ENB_APP/enb_config.h" // for enb properties -#include "proto_agent_common.h" -#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h" -#include "RRC/NR/nr_rrc_defs.h" - - -void *proto_agent_receive(void *args); - -int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p); -void proto_agent_stop(mod_id_t mod_id); - -rlc_op_status_t proto_agent_send_rlc_data_req( const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, - sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,const uint32_t *const SrcID, const uint32_t *const DstID); - -pdcp_data_ind_t proto_agent_send_pdcp_data_ind; - -#endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c deleted file mode 100644 index df3684ee27..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ /dev/null @@ -1,93 +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 - */ - -#include "proto_agent_async.h" -#include "proto_agent_defs.h" - - -#include "common/utils/LOG/log.h" - -proto_agent_async_channel_t * -proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port, - const char* peer_ip, uint16_t peer_port) -{ - proto_agent_async_channel_t *channel; - channel = malloc(sizeof(proto_agent_async_channel_t)); - - if (channel == NULL) - goto error; - - channel->enb_id = mod_id; - channel->link = new_link_udp_server(bind_ip, bind_port); - - if (channel->link == NULL) goto error; - - channel->send_queue = new_message_queue(); - if (channel->send_queue == NULL) goto error; - channel->receive_queue = new_message_queue(); - if (channel->receive_queue == NULL) goto error; - - channel->manager = create_link_manager(channel->send_queue, - channel->receive_queue, - channel->link); - /* manually set remote IP&port for UDP server remote end */ - channel->manager->peer_port = peer_port; - channel->manager->peer_addr = peer_ip; - - if (channel->manager == NULL) goto error; - - return channel; - - error: - if (channel) - free(channel); - LOG_E(PROTO_AGENT, "error creating proto_agent_async_channel_t\n"); - return NULL; -} - -int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) -{ - proto_agent_async_channel_t *channel = channel_info; - return message_put(channel->send_queue, data, size, priority); -} - -int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info) -{ - proto_agent_async_channel_t *channel = channel_info; - return message_get(channel->receive_queue, data, priority); -} - -void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel) { - message_get_unlock(channel->receive_queue); -} - -void proto_agent_async_release(proto_agent_channel_t *channel) -{ - proto_agent_async_channel_t *channel_info = channel->channel_info; - - destroy_link_manager(channel_info->manager); - - destroy_message_queue(channel_info->send_queue); - destroy_message_queue(channel_info->receive_queue); - - close_link(channel_info->link); - free(channel_info); -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h deleted file mode 100644 index 6bc952e804..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.h +++ /dev/null @@ -1,56 +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 enb_agent_async.h - * \brief channel implementation for async interface - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#ifndef PROTO_AGENT_ASYNC_H_ -#define PROTO_AGENT_ASYNC_H_ - -#include "proto_agent_net_comm.h" - -typedef struct proto_agent_async_channel_s { - mod_id_t enb_id; - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; -} proto_agent_async_channel_t; - -proto_agent_async_channel_t * -proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bind_port, - const char *peer_ip, uint16_t peer_port); - -int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info); - -int proto_agent_async_msg_recv(void **data, int *priority, void *channel_info); - -/* unlocks a running proto_agent_async_msg_recv() */ -void proto_agent_async_msg_recv_unlock(proto_agent_async_channel_t *channel); - -void proto_agent_async_release(proto_agent_channel_t *channel); - - -#endif /*PROTO_AGENT_ASYNC_H_*/ diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c deleted file mode 100644 index d3d00d1ada..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ /dev/null @@ -1,719 +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 proto_agent_common.c - * \brief common primitives for all agents - * \author Navid Nikaein and Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#include -#include -#include - -#include "PHY/phy_extern.h" -#include "proto_agent_common.h" -#include "common/utils/LOG/log.h" -#include "common/ran_context.h" - -extern RAN_CONTEXT_t RC; - -/* - * message primitives - */ - -// Function to fill in the dl_data header (32bits) with the appropriate fields (doing bitwise operations) -void fill_dl_data_header(int pdu_type, int spare, int seq_no, uint32_t *header) { - uint32_t type = pdu_type; - uint32_t spare_ = spare; - uint32_t seq = seq_no; - type = type << 28; - spare_ = spare_ << 24; - *header = (type | spare_); - *header = (*header | seq); - return; -} - - -// Function to retrieve data from the dl_data header (32bits) (doing bitwise operations) -void read_dl_data_header(int *pdu_type, int *spare, int *seqno, uint32_t header) { - *pdu_type = header; - *spare = header; - *seqno = header; - *pdu_type = *pdu_type >> 28; - *spare = *spare << 4; - *spare = *spare >> 28; - *seqno = *seqno << 8; - *seqno = *seqno >> 8; - return; -} - -int f1u_serialize_message(Protocol__F1uMessage *msg, void **buf,int *size) { - *size = protocol__f1u_message__get_packed_size(msg); - *buf = malloc(*size); - - if (!(*buf)) - goto error; - - protocol__f1u_message__pack(msg, *buf); - return 0; -error: - LOG_E(F1U, "an error occured\n"); - return -1; -} - -int f1u_deserialize_message(void *data, int size, Protocol__F1uMessage **msg) { - *msg = protocol__f1u_message__unpack(NULL, size, data); - - if (*msg == NULL) - goto error; - - return 0; -error: - LOG_E(F1U, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int f1u_dl_data_create_header(uint32_t pdu_type, uint32_t f1u_sn, Protocol__DlDataHeader **header) { - *header = malloc(sizeof(Protocol__DlDataHeader)); - - if(*header == NULL) - goto error; - - protocol__dl_data_header__init(*header); - LOG_D(F1U, "Initialized the DL Data User header\n"); - fill_dl_data_header(pdu_type, 0, f1u_sn, &(*header)->fields); - return 0; -error: - LOG_E(F1U, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int f1u_dl_data(const void *params, Protocol__F1uMessage **msg) { - // Initialize the PDCP params - dl_data_args *args = (dl_data_args *)params; - Protocol__DlDataHeader *header; - - if (f1u_dl_data_create_header(args->pdu_type, args->sn, &header) != 0) - goto error; - - Protocol__DlUserData *dl_data = NULL; - *msg = malloc(sizeof(Protocol__DlUserData)); - - if(*msg == NULL) - goto error; - - // FIXME: Is the following used? It seems to be overwritten by the function - // protocol__dl_user_data__init() anyway - //dl_data = *msg; - protocol__dl_user_data__init(dl_data); - // Copy data to the bytes structure - dl_data->pdu.data = malloc(args->sdu_size); - dl_data->pdu.len = args->sdu_size; - memcpy(dl_data->pdu.data, args->sdu_p, args->sdu_size); - dl_data->frame = args->frame; - dl_data->subframe = args->subframe; - dl_data->rnti = args->rnti; - dl_data->header = header; - return 0; -error: - - if(header != NULL) - free(header); - - if(*msg != NULL) - free(*msg); - - LOG_E(F1U, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size) { - *size = protocol__flexsplit_message__get_packed_size(msg); - *buf = malloc(*size); - - if (!(*buf)) - goto error; - - protocol__flexsplit_message__pack(msg, *buf); - return 0; -error: - LOG_E(MAC, "an error occured\n"); - return -1; -} - -/* We assume that the buffer size is equal to the message size. - Should be chekced durint Tx/Rx */ -int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg) { - *msg = protocol__flexsplit_message__unpack(NULL, size, data); - - if (*msg == NULL) - goto error; - - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header) { - *header = malloc(sizeof(Protocol__FspHeader)); - - if(*header == NULL) - goto error; - - protocol__fsp_header__init(*header); - LOG_D(PROTO_AGENT, "Initialized the PROTOBUF message header\n"); - (*header)->version = FLEXSPLIT_VERSION; - LOG_D(PROTO_AGENT, "Set the vversion to FLEXSPLIT_VERSION\n"); - (*header)->has_version = 1; - (*header)->type = type; - (*header)->has_type = 1; - (*header)->xid = xid; - (*header)->has_xid = 1; - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - return 1; -} - -int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspCtxt *ctxt = NULL; - Protocol__FspRlcPdu *pdu = NULL; - Protocol__FspRlcData *rlc_data = NULL; - Protocol__FspRlcDataReq *data_req = NULL; - // Initialize the PDCP params - data_req_args *args = (data_req_args *)params; - // Create the protobuf header - Protocol__FspHeader *header; - xid_t xid = mod_id; - LOG_D(PROTO_AGENT, "creating the data_req message\n"); - - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) - goto error; - - /* Begin constructing the messages. They are defined as follows: - * 1) fspRlcPdu is storing the bytes of the packet - * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) - * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData - */ - ctxt = malloc(sizeof(Protocol__FspCtxt)); - pdu = malloc(sizeof(Protocol__FspRlcPdu)); - rlc_data = malloc(sizeof(Protocol__FspRlcData)); - data_req = malloc(sizeof(Protocol__FspRlcDataReq)); - protocol__fsp_ctxt__init(ctxt); - protocol__fsp_rlc_pdu__init(pdu); - protocol__fsp_rlc_data__init(rlc_data); - protocol__fsp_rlc_data_req__init(data_req); - // Copy data to the RlcPdu structure - pdu->fsp_pdu_data.data = malloc(args->sdu_size); - pdu->fsp_pdu_data.len = args->sdu_size; - memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size); - pdu->has_fsp_pdu_data = 1; - // Copy data to the ctxt structure - ctxt->fsp_mod_id = args->ctxt->module_id; - ctxt->fsp_enb_flag = args->ctxt->enb_flag; - ctxt->fsp_instance = args->ctxt->instance; - ctxt->fsp_rnti = args->ctxt->rnti; - ctxt->fsp_frame = args->ctxt->frame; - ctxt->fsp_subframe = args->ctxt->subframe; - ctxt->fsp_enb_index = args->ctxt->eNB_index; - ctxt->has_fsp_mod_id = 1; - ctxt->has_fsp_enb_flag = 1; - ctxt->has_fsp_instance = 1; - ctxt->has_fsp_rnti = 1; - ctxt->has_fsp_frame = 1; - ctxt->has_fsp_subframe = 1; - ctxt->has_fsp_enb_index = 1; - rlc_data->fsp_ctxt = ctxt; - rlc_data->fsp_srb_flag = args->srb_flag; - rlc_data->fsp_mbms_flag = args->MBMS_flag; - rlc_data->fsp_rb_id = args->rb_id; - rlc_data->fsp_muip = args->mui; - rlc_data->fsp_confirm = args->confirm; - rlc_data->fsp_sdu_buffer_size = args->sdu_size; - rlc_data->fsp_pdu = pdu; - rlc_data->has_fsp_srb_flag = 1; - rlc_data->has_fsp_mbms_flag = 1; - rlc_data->has_fsp_rb_id = 1; - rlc_data->has_fsp_muip = 1; - rlc_data->has_fsp_confirm = 1; - rlc_data->has_fsp_sdu_buffer_size = 1; - // Up to here, everything is a signle message that is packed inside another. The final data_req - // will be created later, after the setting of all variables - data_req->header = header; - data_req->enb_id = mod_id; - data_req->has_enb_id = 1; - data_req->pdcp_data = rlc_data; - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK - (*msg)->has_msg_dir = 1; - (*msg)->data_req_msg = data_req; - return 0; -error: - - if(header != NULL) - free(header); - - if(pdu!=NULL) - free(pdu); - - if(rlc_data!=NULL) - free(rlc_data); - - if(data_req!= NULL) - free(data_req); - - if(*msg != NULL) - free(*msg); - - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG) - goto error; - - free(msg->data_req_msg->header); - free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data); - free(msg->data_req_msg->pdcp_data->fsp_pdu); - free(msg->data_req_msg->pdcp_data->fsp_ctxt); - free(msg->data_req_msg->pdcp_data); - free(msg->data_req_msg); - free(msg); - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { -/* code useless in this status: return 0 anyways - rlc_op_status_t result = 0; - printf("PROTO_AGENT: handling the data_req_ack message\n"); - Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; - Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; - result = data_ack->result; - printf("PROTO_AGENT: ACK RESULT IS %u\n", result); - ack_result = result; -*/ - return 0; -} - - -int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - rlc_op_status_t result = 0; - Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; - Protocol__FspRlcDataReq *data_req = input->data_req_msg; - Protocol__FspCtxt *ctxt = NULL; - Protocol__FspRlcData *rlc_data = NULL; - rlc_data = data_req->pdcp_data; - ctxt = rlc_data->fsp_ctxt; - protocol_ctxt_t ctxt_pP; - srb_flag_t srb_flagP = 0; - rb_id_t rb_idP = 0; - mui_t muiP = 0; - confirm_t confirmP = 0; - MBMS_flag_t flag_MBMS = 0; - sdu_size_t pdcp_pdu_size = 0; - mem_block_t *pdcp_pdu_p = NULL; - // Create a new protocol context for handling the packet - ctxt_pP.module_id = ctxt->fsp_mod_id; - ctxt_pP.enb_flag = ctxt->fsp_enb_flag; - ctxt_pP.instance = ctxt->fsp_instance; - ctxt_pP.rnti = ctxt->fsp_rnti; - ctxt_pP.frame = ctxt->fsp_frame; - ctxt_pP.subframe = ctxt->fsp_subframe; - ctxt_pP.eNB_index = ctxt->fsp_enb_index; - srb_flagP = rlc_data->fsp_srb_flag; - flag_MBMS = rlc_data->fsp_mbms_flag; - rb_idP = rlc_data->fsp_rb_id; - muiP = rlc_data->fsp_muip; - confirmP = rlc_data->fsp_confirm; - pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; - pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__); - - if (!pdcp_pdu_p) { - LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; - } - - memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - if (RC.nrrrc) { - LOG_D(PROTO_AGENT, "proto_agent received pdcp_data_req \n"); - // for (int i = 0; i < pdcp_pdu_size; i++) - // printf(" %2.2x", (unsigned char)pdcp_pdu_p->data[i]); - // printf("\n"); - du_rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); - result = 1; - } else { - result = rlc_data_req(&ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p, NULL, NULL); - } - return result; -} - -int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG) - goto error; - - free(msg->data_ind_msg->header); - free(msg->data_ind_msg->rlc_data->fsp_pdu->fsp_pdu_data.data); - free(msg->data_ind_msg->rlc_data->fsp_pdu); - free(msg->data_ind_msg->rlc_data->fsp_ctxt); - free(msg->data_ind_msg->rlc_data); - free(msg->data_ind_msg); - free(msg); - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspCtxt *ctxt = NULL; - Protocol__FspRlcPdu *pdu = NULL; - Protocol__FspRlcData *rlc_data = NULL; - Protocol__FspPdcpDataInd *data_ind = NULL; - // Initialize the PDCP params - data_req_args *args = (data_req_args *)params; - // Create the protobuf header - Protocol__FspHeader *header; - xid_t xid = mod_id; - LOG_D(PROTO_AGENT, "creating the data_ind message\n"); - - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_PDCP_DATA_IND, &header) != 0) - goto error; - - /* Begin constructing the messages. They are defined as follows: - * 1) fspRlcPdu is storing the bytes of the packet - * 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message) - * 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData - */ - ctxt = malloc(sizeof(Protocol__FspCtxt)); - pdu = malloc(sizeof(Protocol__FspRlcPdu)); - rlc_data = malloc(sizeof(Protocol__FspRlcData)); - data_ind = malloc(sizeof(Protocol__FspPdcpDataInd)); - protocol__fsp_ctxt__init(ctxt); - protocol__fsp_rlc_pdu__init(pdu); - protocol__fsp_rlc_data__init(rlc_data); - protocol__fsp_pdcp_data_ind__init(data_ind); - // Copy data to the RlcPdu structure - pdu->fsp_pdu_data.data = malloc(args->sdu_size); - pdu->fsp_pdu_data.len = args->sdu_size; - memcpy(pdu->fsp_pdu_data.data, args->sdu_p->data, args->sdu_size); - pdu->has_fsp_pdu_data = 1; - // Copy data to the ctxt structure - ctxt->fsp_mod_id = args->ctxt->module_id; - ctxt->fsp_enb_flag = args->ctxt->enb_flag; - ctxt->fsp_instance = args->ctxt->instance; - ctxt->fsp_rnti = args->ctxt->rnti; - ctxt->fsp_frame = args->ctxt->frame; - ctxt->fsp_subframe = args->ctxt->subframe; - ctxt->fsp_enb_index = args->ctxt->eNB_index; - ctxt->has_fsp_mod_id = 1; - ctxt->has_fsp_enb_flag = 1; - ctxt->has_fsp_instance = 1; - ctxt->has_fsp_rnti = 1; - ctxt->has_fsp_frame = 1; - ctxt->has_fsp_subframe = 1; - ctxt->has_fsp_enb_index = 1; - rlc_data->fsp_ctxt = ctxt; - rlc_data->fsp_srb_flag = args->srb_flag; - rlc_data->fsp_mbms_flag = args->MBMS_flag; - rlc_data->fsp_rb_id = args->rb_id; - rlc_data->fsp_sdu_buffer_size = args->sdu_size; - rlc_data->fsp_pdu = pdu; - rlc_data->has_fsp_srb_flag = 1; - rlc_data->has_fsp_mbms_flag = 1; - rlc_data->has_fsp_rb_id = 1; - rlc_data->has_fsp_sdu_buffer_size = 1; - // Up to here, everything is a signle message that is packed inside another. The final data_req - // will be created later, after the setting of all variables - data_ind->header = header; - data_ind->enb_id = mod_id; - data_ind->has_enb_id = 1; - data_ind->rlc_data = rlc_data; - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - LOG_D(PROTO_AGENT,"setting the message case to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_IND_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK - (*msg)->has_msg_dir = 1; - (*msg)->data_ind_msg = data_ind; //data_req; - return 0; -error: - - if(header != NULL) - free(header); - - if(pdu!=NULL) - free(pdu); - - if(rlc_data!=NULL) - free(rlc_data); - - if(data_ind!= NULL) - free(data_ind); - - if(*msg != NULL) - free(*msg); - - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - boolean_t result = 0; - Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; - Protocol__FspPdcpDataInd *data_ind = input->data_ind_msg; - Protocol__FspCtxt *ctxt = NULL; - Protocol__FspRlcData *rlc_data = NULL; - rlc_data = data_ind->rlc_data; - ctxt = rlc_data->fsp_ctxt; - protocol_ctxt_t ctxt_pP; - srb_flag_t srb_flagP = 0; - rb_id_t rb_idP = 0; - sdu_size_t pdcp_pdu_size = 0; - MBMS_flag_t flag_MBMS = 0; - mem_block_t *pdcp_pdu_p = NULL; - // Create a new protocol context for handling the packet - ctxt_pP.module_id = ctxt->fsp_mod_id; - ctxt_pP.enb_flag = ctxt->fsp_enb_flag; - ctxt_pP.instance = ctxt->fsp_instance; - ctxt_pP.rnti = ctxt->fsp_rnti; - ctxt_pP.frame = ctxt->fsp_frame; - ctxt_pP.subframe = ctxt->fsp_subframe; - ctxt_pP.brOption = 0; - ctxt_pP.eNB_index = ctxt->fsp_enb_index; - srb_flagP = rlc_data->fsp_srb_flag; - flag_MBMS = rlc_data->fsp_mbms_flag; - rb_idP = rlc_data->fsp_rb_id; - pdcp_pdu_size = rlc_data->fsp_pdu->fsp_pdu_data.len; - pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__); - - if (!pdcp_pdu_p) goto error; - - memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); - // if (xid == 1) - // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); - // else if (xid == 0) // FIXME: USE a preprocessed definition - LOG_D(PROTO_AGENT, "[inst %ld] Received PDCP PDU with size %d for UE RNTI %x RB %ld, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP); - result = pdcp_data_ind(&ctxt_pP, - srb_flagP, - flag_MBMS, - rb_idP, - pdcp_pdu_size, - pdcp_pdu_p, NULL, NULL); - return result; -error: - - if (pdcp_pdu_p) - free_mem_block(pdcp_pdu_p, __func__); - - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspHeader *header; - Protocol__FspHello *hello_msg = NULL; - /*TODO: Need to set random xid or xid from received hello message*/ - xid_t xid = mod_id; - - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) - goto error; - - LOG_D(PROTO_AGENT, "creating the HELLO message\n"); - hello_msg = malloc(sizeof(Protocol__FspHello)); - - if(hello_msg == NULL) - goto error; - - protocol__fsp_hello__init(hello_msg); - hello_msg->header = header; - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->has_msg_dir = 1; - (*msg)->hello_msg = hello_msg; - return 0; -error: - - if(header != NULL) - free(header); - - if(hello_msg!=NULL) - free(hello_msg); - - if(*msg != NULL) - free(*msg); - - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_HELLO_MSG) - goto error; - - free(msg->hello_msg->header); - free(msg->hello_msg); - free(msg); - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_echo_request(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - Protocol__FspHeader *header; - Protocol__FspEchoRequest *echo_request_msg = NULL; - xid_t xid = mod_id; - - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) - goto error; - - LOG_D(PROTO_AGENT, "creating the echo request message\n"); - echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); - - if(echo_request_msg == NULL) - goto error; - - protocol__fsp_echo_request__init(echo_request_msg); - echo_request_msg->header = header; - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - LOG_D(PROTO_AGENT,"setting the message direction to %d\n", PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; - (*msg)->has_msg_dir = 1; - (*msg)->echo_request_msg = echo_request_msg; - return 0; -error: - - if(header != NULL) - free(header); - - if(echo_request_msg != NULL) - free(echo_request_msg); - - if(*msg != NULL) - free(*msg); - - return -1; -} - -int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REQUEST_MSG) - goto error; - - free(msg->echo_request_msg->header); - free(msg->echo_request_msg); - free(msg); - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { - xid_t xid; - Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; - Protocol__FspEchoRequest *echo_req = input->echo_request_msg; - Protocol__FspEchoReply *echo_reply_msg = NULL; - xid = (echo_req->header)->xid; - LOG_D(PROTO_AGENT, "creating the echo reply message\n"); - Protocol__FspHeader *header; - - if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) - goto error; - - echo_reply_msg = malloc(sizeof(Protocol__FspEchoReply)); - - if(echo_reply_msg == NULL) - goto error; - - protocol__fsp_echo_reply__init(echo_reply_msg); - echo_reply_msg->header = header; - *msg = malloc(sizeof(Protocol__FlexsplitMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexsplit_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->has_msg_dir = 1; - (*msg)->echo_reply_msg = echo_reply_msg; - return 0; -error: - - if(header != NULL) - free(header); - - if(echo_reply_msg != NULL) - free(echo_reply_msg); - - if(*msg != NULL) - free(*msg); - - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG) - goto error; - - free(msg->echo_reply_msg->header); - free(msg->echo_reply_msg); - free(msg); - return 0; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h deleted file mode 100644 index 8f553e05e1..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ /dev/null @@ -1,138 +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 enb_agent_common.h - * \brief common message primitves and utilities - * \author Navid Nikaein and Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - - - -#ifndef PROTO_AGENT_COMMON_H_ -#define PROTO_AGENT_COMMON_H_ - -#include - -#include "flexsplit.pb-c.h" - -// Do not need these -//#include "stats_messages.pb-c.h" -//#include "stats_common.pb-c.h" - -#include "proto_agent_defs.h" -//#include "ENB_APP/enb_config.h" -#include "UTIL/MEM/mem_block.h" - -//#include "LAYER2/MAC/extern.h" -//#include "LAYER2/RLC/rlc.h" - -# include "tree.h" -# include "intertask_interface.h" - -#define FLEXSPLIT_VERSION 0 - -typedef int (*proto_agent_message_decoded_callback)( - mod_id_t mod_id, - const void *params, - Protocol__FlexsplitMessage **msg -); - -typedef int (*proto_agent_message_destruction_callback)( - Protocol__FlexsplitMessage *msg -); - - - -/********************************** - * progRAN protocol messages helper - * functions and generic handlers - **********************************/ - -int proto_agent_serialize_message(Protocol__FlexsplitMessage *msg, uint8_t **buf, int *size); -int proto_agent_deserialize_message(void *data, int size, Protocol__FlexsplitMessage **msg); - -uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size); - -err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg); - -int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **header); - -int proto_agent_hello(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_destroy_hello(Protocol__FlexsplitMessage *msg); -int proto_agent_echo_request(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg); -int proto_agent_echo_reply(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg); - -int proto_agent_pdcp_data_req(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_pdcp_data_req_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg); -int proto_agent_pdcp_data_ind(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); -int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg); -int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); - -int just_print(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); - - -int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); - - -Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, - uint8_t *data, - int size); - -Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args); - -typedef struct _data_req_args data_req_args; -typedef struct _dl_data_args dl_data_args; - -struct _data_req_args{ - const protocol_ctxt_t* ctxt; - srb_flag_t srb_flag; - MBMS_flag_t MBMS_flag; - rb_id_t rb_id; - mui_t mui; - confirm_t confirm; - sdu_size_t sdu_size; - mem_block_t *sdu_p; -}; - -struct _dl_data_args{ - uint8_t pdu_type; - uint32_t sn; - frame_t frame; - sub_frame_t subframe; - rnti_t rnti; - sdu_size_t sdu_size; - mem_block_t *sdu_p; -}; - - -#endif - - - - - - - diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h deleted file mode 100644 index cd730a6de8..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_defs.h +++ /dev/null @@ -1,118 +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 enb_agent_defs.h - * \brief enb agent common definitions - * \author Navid Nikaein and Xenofon Foukas - * \date 2016 - * \version 0.1 - */ -#ifndef PROTO_AGENT_DEFS_H_ -#define PROTO_AGENT_DEFS_H_ - -#include -#include -#include -#include - -#include "openairinterface5g_limits.h" -#include "UTIL/ASYNC_IF/link_manager.h" - -#define DEFAULT_PROTO_AGENT_IPv4_ADDRESS "127.0.0.1" -#define DEFAULT_PROTO_AGENT_PORT 2210 -#define DEFAULT_PROTO_AGENT_CACHE "/mnt/oai_agent_cache" - -typedef enum { - - PROTO_AGENT_DEFAULT=0, - - ENB_AGENT_PHY=1, - ENB_AGENT_MAC=2, - ENB_AGENT_RLC=3, - ENB_AGENT_PDCP=4, - ENB_AGENT_RRC=5, - ENB_AGENT_S1AP=6, - ENB_AGENT_GTP=7, - ENB_AGENT_X2AP=8, - - ENB_AGENT_MAX=9, - -} proto_agent_id_t; - -/* -typedef enum { - ENB_AGENT_ACTION_NONE = 0x0, - - ENB_AGENT_ACTION_SEND = 0x1, - - ENB_AGENT_ACTION_APPLY = 0x2, - - ENB_AGENT_ACTION_CLEAR = 0x4, - - ENB_AGENT_ACTION_WRITE = 0x8, - - ENB_AGENT_ACTION_FILTER = 0x10, - - ENB_AGENT_ACTION_PREPROCESS = 0x20, - - ENB_AGENT_ACTION_METER = 0x40, - - ENB_AGENT_ACTION_MAX = 0x7f, -} agent_action_t; -*/ -/* -typedef enum { - - RAN_LTE_OAI= 0, - - RAN_NAME_MAX = 0x7f, -} ran_name_t; -*/ -typedef uint8_t xid_t; -typedef uint8_t mod_id_t; // module or enb id -typedef uint8_t lcid_t; -typedef int32_t err_code_t; - -typedef struct { - /* general info */ - - /* stats */ - - uint32_t total_rx_msg; - uint32_t total_tx_msg; - - uint32_t rx_msg[NUMBER_OF_eNB_MAX]; - uint32_t tx_msg[NUMBER_OF_eNB_MAX]; - -} proto_agent_info_t; - -/* forward declaration */ -struct proto_agent_channel_s; - -typedef struct proto_agent_instance_s { - mod_id_t mod_id; - proto_agent_info_t agent_info; - struct proto_agent_channel_s *channel; - pthread_t recv_thread; - uint8_t exit; -} proto_agent_instance_t; - -#endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c deleted file mode 100644 index 82f7849717..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ /dev/null @@ -1,138 +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 enb_agent_handler.c - * \brief enb agent tx and rx message handler - * \author Navid Nikaein and Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - - -#include "proto_agent_common.h" -#include "common/utils/LOG/log.h" -#include "assertions.h" - -proto_agent_message_decoded_callback proto_agent_messages_callback[][3] = { - {proto_agent_hello, 0, 0}, /* agent hello */ - {proto_agent_echo_reply, 0, 0}, /* echo */ - {0, just_print, 0}, /* just print */ - {proto_agent_pdcp_data_req_process, proto_agent_pdcp_data_req_process, 0}, /* PDCP data REQ */ - {0, proto_agent_get_ack_result, 0}, /* get ACK result */ - {proto_agent_pdcp_data_ind_process, proto_agent_pdcp_data_ind_process, 0}, /* PDCP data IND */ - {0, just_print, 0}, /* just print */ -}; - -proto_agent_message_destruction_callback proto_message_destruction_callback[] = { - proto_agent_destroy_hello, - proto_agent_destroy_echo_request, - proto_agent_destroy_echo_reply, - proto_agent_destroy_pdcp_data_req, - 0, - proto_agent_destroy_pdcp_data_ind, - 0, -}; - -//static const char *proto_agent_direction2String[] = { -// "", /* not_set */ -// "originating message", /* originating message */ -// "successfull outcome", /* successfull outcome */ -// "unsuccessfull outcome", /* unsuccessfull outcome */ -//}; - - -Protocol__FlexsplitMessage* proto_agent_handle_message (mod_id_t mod_id, - uint8_t *data, - int size){ - - Protocol__FlexsplitMessage *decoded_message = NULL; - Protocol__FlexsplitMessage *reply_message = NULL; - err_code_t err_code; - DevAssert(data != NULL); - - LOG_D(PROTO_AGENT, "Deserializing message with size %u \n", size); - if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) { - err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; - goto error; - } - /* after deserialization, we don't need the original data memory anymore */ - free(data); - Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; - if (header->has_type) - { - LOG_D(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir); - } - - if ((decoded_message->msg_case > sizeof(proto_agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || - (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)) - { - err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; - LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); - goto error; - } - - - err_code = ((*proto_agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); - - if ( err_code < 0 ) - { - LOG_I(PROTO_AGENT, "decoded_message case : %d, direction : %d \n", decoded_message->msg_case-1, decoded_message->msg_dir-1); - goto error; - } - - protocol__flexsplit_message__free_unpacked(decoded_message, NULL); - LOG_D(PROTO_AGENT,"Returning REPLY message after the callback\n"); - return reply_message; - - error: - LOG_E(PROTO_AGENT,"errno %d occured\n",err_code); - return NULL; -} - - - -uint8_t *proto_agent_pack_message(Protocol__FlexsplitMessage *msg, int *size) -{ - uint8_t *buffer; - err_code_t err_code = PROTOCOL__FLEXSPLIT_ERR__NO_ERR; - - if (proto_agent_serialize_message(msg, &buffer, size) < 0 ) { - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENCODING; - goto error; - } - - if (proto_message_destruction_callback[msg->msg_case-1]) - err_code = ((*proto_message_destruction_callback[msg->msg_case-1])(msg)); - - DevAssert(buffer !=NULL); - - LOG_D(PROTO_AGENT,"Serialized the enb mac stats reply (size %d)\n", *size); - return buffer; - - error : - LOG_E(PROTO_AGENT,"errno %d occured\n",err_code); - - return NULL; -} - -err_code_t proto_agent_destroy_flexsplit_message(Protocol__FlexsplitMessage *msg) { - return ((*proto_message_destruction_callback[msg->msg_case-1])(msg)); -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c deleted file mode 100644 index 925c11c8f8..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ /dev/null @@ -1,152 +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 enb_agent_net_comm.c - * \brief enb agent network interface abstraction - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#include "proto_agent_net_comm.h" -#include "common/utils/LOG/log.h" - -proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX]; -static proto_agent_channel_instance_t channel_instance; -int proto_agent_channel_id = 0; - -int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) { - int i; - - if (channel == NULL) { - return -1; - } - - if (agent_id == ENB_AGENT_MAX) { - for (i = 0; i < ENB_AGENT_MAX; i++) { - proto_channel[mod_id][i] = channel; - } - } else { - proto_channel[mod_id][agent_id] = channel; - } - return 0; -} - -void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id) { - int i; - - if (agent_id == ENB_AGENT_MAX) { - for (i = 0; i < ENB_AGENT_MAX; i++) { - proto_channel[mod_id][i] = NULL; - } - } else { - proto_channel[mod_id][agent_id] = NULL; - } -} - -int proto_agent_create_channel(void *channel_info, - int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *priority, void *channel_info), - void (*release)(proto_agent_channel_t *channel)) { - - int channel_id = ++proto_agent_channel_id; - proto_agent_channel_t *channel = (proto_agent_channel_t *) malloc(sizeof(proto_agent_channel_t)); - channel->channel_id = channel_id; - channel->channel_info = channel_info; - channel->msg_send = msg_send; - channel->msg_recv = msg_recv; - channel->release = release; - - /*element should be a real pointer*/ - RB_INSERT(proto_agent_channel_map, &channel_instance.proto_agent_head, channel); - - LOG_D(PROTO_AGENT, "Created a new channel with id 0x%x\n", channel->channel_id); - - return channel_id; -} - -int proto_agent_destroy_channel(int channel_id) { - int i, j; - - /*Check to see if channel exists*/ - struct proto_agent_channel_s *e = NULL; - struct proto_agent_channel_s search; - memset(&search, 0, sizeof(struct proto_agent_channel_s)); - - e = RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search); - - if (e == NULL) { - return -1; - } - - /*Unregister the channel from all agents*/ - for (i = 0; i < NUMBER_OF_eNB_MAX; i++) { - for (j = 0; j < ENB_AGENT_MAX; j++) { - if (proto_channel[i][j] != NULL) { - if (proto_channel[i][j]->channel_id == e->channel_id) { - proto_channel[i][j] = NULL; - } - } - } - } - - /*Remove the channel from the tree and free memory*/ - RB_REMOVE(proto_agent_channel_map, &channel_instance.proto_agent_head, e); - e->release(e); - free(e); - - return 0; -} - -err_code_t proto_agent_init_channel_container(void) { - int i, j; - LOG_D(PROTO_AGENT, "init RB tree for channel container\n"); - - RB_INIT(&channel_instance.proto_agent_head); - - for (i = 0; i < NUMBER_OF_eNB_MAX; i++) { - for (j = 0; j < ENB_AGENT_MAX; j++) { - proto_channel[i][j] = NULL; - } - } - - return 0; -} - -RB_GENERATE(proto_agent_channel_map,proto_agent_channel_s, entry, proto_agent_compare_channel); - -int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b) { - if (a->channel_id < b->channel_id) return -1; - if (a->channel_id > b->channel_id) return 1; - - // equal timers - return 0; -} - -proto_agent_channel_t * proto_agent_get_channel(int channel_id) { - - struct proto_agent_channel_s search; - memset(&search, 0, sizeof(struct proto_agent_channel_s)); - search.channel_id = channel_id; - - return RB_FIND(proto_agent_channel_map, &channel_instance.proto_agent_head, &search); - -} diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h deleted file mode 100644 index 55fca5a928..0000000000 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h +++ /dev/null @@ -1,82 +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 enb_agent_net_comm.h - * \brief enb agent network interface abstraction - * \autho Xenofon Foukas - * \date 2016 - * \version 0.1 - */ -#ifndef PROTO_AGENT_NET_COMM_H_ -#define PROTO_AGENT_NET_COMM_H_ - -#include "proto_agent_defs.h" - -#include "tree.h" -#define ENB_AGENT_MAX 9 - -/* forward declaration */ -struct proto_agent_async_channel_s; - -/*Channel related information used for Tx/Rx of protocol messages*/ -typedef struct proto_agent_channel_s { - RB_ENTRY(proto_agent_channel_s) entry; - int channel_id; - struct proto_agent_async_channel_s *channel_info; - /*Callbacks for channel message Tx and Rx*/ - int (*msg_send)(void *data, int size, int priority, void *channel_info); - int (*msg_recv)(void **data, int *priority, void *channel_info); - void (*release)(struct proto_agent_channel_s *channel); -} proto_agent_channel_t; - -typedef struct proto_agent_channel_instance_s{ - RB_HEAD(proto_agent_channel_map, proto_agent_channel_s) proto_agent_head; -} proto_agent_channel_instance_t; - - -/*Register a channel to an agent. Use ENB_AGENT_MAX to register the - *same channel to all agents*/ -int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id); - -/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/ -void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id); - -/*Create a new channel. Returns the id of the new channel or negative number otherwise*/ -int proto_agent_create_channel(void *channel_info, - int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *priority, void *channel_info), - void (*release)(proto_agent_channel_t *channel)); - -/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ -int proto_agent_destroy_channel(int channel_id); - -/*Return an agent communication channel based on its id*/ -proto_agent_channel_t * proto_agent_get_channel(int channel_id); - -/*Should be called before performing any channel operations*/ -err_code_t proto_agent_init_channel_container(void); - -int proto_agent_compare_channel(struct proto_agent_channel_s *a, struct proto_agent_channel_s *b); - -/* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(proto_agent_channel_map, proto_agent_channel_s, entry, proto_agent_compare_channel); - -#endif /*ENB_AGENT_COMM_H_*/ diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index de947225bb..4eb0907046 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -27,7 +27,6 @@ //----------------------------------------------------------------------------- #include "assertions.h" -#include "msc.h" #include "hashtable.h" #include "rlc_am.h" #include "rlc_am_segment.h" @@ -238,17 +237,6 @@ void config_req_rlc_am_asn1 ( (config_am_pP->ul_AM_RLC.t_PollRetransmitdl_AM_RLC.t_Reordering<32) && (config_am_pP->dl_AM_RLC.t_StatusProhibitenb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_PollRetx %u t_Reord %u t_StatusPro %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit], - am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering], - t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]); LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d)\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p), maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold], @@ -267,14 +255,6 @@ void config_req_rlc_am_asn1 ( am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering], t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]); } else { - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p)); LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"ILLEGAL CONFIG_REQ (max_retx_threshold=%ld poll_pdu=%ld poll_byte=%ld t_poll_retransmit=%ld t_reord=%ld t_status_prohibit=%ld), RLC-AM NOT CONFIGURED\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p), @@ -537,27 +517,6 @@ rlc_am_mac_status_indication ( } } - if (MESSAGE_CHART_GENERATOR) { - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_MAC_ENB:MSC_MAC_UE, - NULL,0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS-IND %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc)); - MSC_LOG_TX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_MAC_ENB:MSC_MAC_UE, - NULL,0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS-RESP BO:%u/n%u(%u) %s sdu remain %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc), - status_resp.buffer_occupancy_in_bytes, - status_resp.buffer_occupancy_in_pdus,rlc->nb_sdu, - (status_resp.head_sdu_is_segmented)?"sdu seg":"sdu not seg", - status_resp.head_sdu_remaining_size_to_send); - } - if (LOG_DEBUGFLAG(DEBUG_RLC)) { LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_STATUS_INDICATION (DATA) -> %d bytes\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc), @@ -610,7 +569,7 @@ rlc_am_mac_data_request ( data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state; - if ( (MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC))&& data_req.data.nb_elements > 0) { + if ( (LOG_DEBUGFLAG(DEBUG_RLC))&& data_req.data.nb_elements > 0) { tb_p = data_req.data.head; while (tb_p != NULL) { @@ -619,39 +578,6 @@ rlc_am_mac_data_request ( if ((((struct mac_tb_req *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) { if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { - if (MESSAGE_CHART_GENERATOR) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA SN %u size %u RF %u P %u FI %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - pdu_info.sn, - tb_size_in_bytes, - pdu_info.rf, - pdu_info.p, - pdu_info.fi); - - if (pdu_info.rf) { - message_string_size += sprintf(&message_string[message_string_size], " LSF %u\n", pdu_info.lsf); - message_string_size += sprintf(&message_string[message_string_size], " SO %u\n", pdu_info.so); - } - - if (pdu_info.e) { - message_string_size += sprintf(&message_string[message_string_size], "| HE:"); - - for (index=0; index < pdu_info.num_li; index++) { - message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]); - } - } - - MSC_LOG_TX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (char *)rlc_am_pdu_sn_10_p, - tb_size_in_bytes, - message_string); - } - if ( LOG_DEBUGFLAG(DEBUG_RLC)) { message_string_size = 0; message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); @@ -723,34 +649,6 @@ rlc_am_mac_data_request ( if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) { tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size; //tb_size_in_bytes modified by rlc_am_get_control_pdu_infos! - if (MESSAGE_CHART_GENERATOR ) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS ACK_SN %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - l_rlc_p->control_pdu_info.ack_sn); - - for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) { - if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) { - message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u SO START %u SO END %u", - l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn, - l_rlc_p->control_pdu_info.nack_list[num_nack].so_start, - l_rlc_p->control_pdu_info.nack_list[num_nack].so_end); - } else { - message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u", - l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn); - } - } - - MSC_LOG_TX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (char *)rlc_am_pdu_sn_10_p, - tb_size_in_bytes, - message_string); - } - if ( LOG_DEBUGFLAG(DEBUG_RLC)) { message_string_size = 0; message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); @@ -780,7 +678,7 @@ rlc_am_mac_data_request ( tb_p = tb_p->next; } /* while */ - } /* MESSAGE_CHART_GENERATOR && data_req.data.nb_elements > 0 */ + } /* data_req.data.nb_elements > 0 */ data_req.buffer_occupancy_in_pdus = 0; return data_req; @@ -812,7 +710,7 @@ rlc_am_mac_data_indication ( (void)index; (void)l_rlc_p; /* avoid gcc warning "unused variable" */ - if ( LOG_DEBUGFLAG(DEBUG_RLC) || MESSAGE_CHART_GENERATOR ) { + if ( LOG_DEBUGFLAG(DEBUG_RLC)) { if (data_indP.data.nb_elements > 0) { tb_p = data_indP.data.head; @@ -822,39 +720,6 @@ rlc_am_mac_data_indication ( if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) { if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) { - if (MESSAGE_CHART_GENERATOR) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA SN %u size %u RF %u P %u FI %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - pdu_info.sn, - tb_size_in_bytes, - pdu_info.rf, - pdu_info.p, - pdu_info.fi); - - if (pdu_info.rf) { - message_string_size += sprintf(&message_string[message_string_size], " LSF %u\n", pdu_info.lsf); - message_string_size += sprintf(&message_string[message_string_size], " SO %u\n", pdu_info.so); - } - - if (pdu_info.e) { - message_string_size += sprintf(&message_string[message_string_size], "| HE:"); - - for (index=0; index < pdu_info.num_li; index++) { - message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]); - } - } - - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (char *)rlc_am_pdu_sn_10_p, - tb_size_in_bytes, - message_string); - } - if ( LOG_DEBUGFLAG(DEBUG_RLC)) { message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); @@ -923,34 +788,6 @@ rlc_am_mac_data_indication ( } } else { if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) { - if (MESSAGE_CHART_GENERATOR) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS size ACK_SN %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - l_rlc_p->control_pdu_info.ack_sn); - - for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) { - if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) { - message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u SO START %u SO END %u", - l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn, - l_rlc_p->control_pdu_info.nack_list[num_nack].so_start, - l_rlc_p->control_pdu_info.nack_list[num_nack].so_end); - } else { - message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u", - l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn); - } - } - - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (char *)rlc_am_pdu_sn_10_p, - tb_size_in_bytes, - message_string); - } - if ( LOG_DEBUGFLAG(DEBUG_RLC)) { message_string_size = 0; message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); @@ -1009,16 +846,6 @@ rlc_am_data_req ( mui = ((struct rlc_am_data_req *) (sdu_pP->data))->mui; data_offset = ((struct rlc_am_data_req *) (sdu_pP->data))->data_offset; data_size = ((struct rlc_am_data_req *) (sdu_pP->data))->data_size; - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (const char *)(&sdu_pP->data[data_offset]), - data_size, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-REQ size %u mui %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - data_size, - mui); if (LOG_DEBUGFLAG(DEBUG_RLC)) { message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); @@ -1094,22 +921,6 @@ rlc_am_data_req ( l_rlc_p->vt_s); } } else { - if( MESSAGE_CHART_GENERATOR) { - mui = ((struct rlc_am_data_req *) (sdu_pP->data))->mui; - data_offset = ((struct rlc_am_data_req *) (sdu_pP->data))->data_offset; - data_size = ((struct rlc_am_data_req *) (sdu_pP->data))->data_size; - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (const char *)(&sdu_pP->data[data_offset]), - data_size, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-REQ size %u mui %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p), - data_size, - mui); - } - LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d vtA=%d vtS=%d\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p), l_rlc_p->nb_sdu, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index 3127f67eca..b4073303dd 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -78,16 +78,7 @@ int pmtl_rc = pthread_mutex_trylock(mUTEX);\ if (pmtl_rc != 0){\ if (pmtl_rc == EBUSY) {\ - MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 " PROTOCOL_RLC_AM_MSC_FMT " Warning try lock %s busy",\ - PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\ - #mUTEX);\ pthread_mutex_lock(mUTEX);\ - } else {\ - MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 " PROTOCOL_RLC_AM_MSC_FMT " Error try lock %s %d",\ - PROTOCOL_RLC_AM_MSC_ARGS(cTXT,rLC),\ - #mUTEX, pmtl_rc);\ }\ }\ } while (0); diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c index 793d0057ac..0957c20bdf 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c @@ -30,7 +30,6 @@ #include "list.h" //#include "LAYER2/MAC/extern.h" #include "common/utils/LOG/log.h" -#include "msc.h" //----------------------------------------------------------------------------- inline void @@ -152,16 +151,6 @@ rlc_am_send_sdu ( #if !ENABLE_ITTI RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus); #endif - MSC_LOG_TX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (const char *)(rlc_pP->output_sdu_in_construction->data), - rlc_pP->output_sdu_size_to_write, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-IND size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), - rlc_pP->output_sdu_size_to_write - ); rlc_data_ind (ctxt_pP, BOOL_NOT(rlc_pP->is_data_plane), MBMS_FLAG_NO, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c index f9a4affb6b..916d1513b0 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c @@ -24,7 +24,6 @@ #include "platform_types.h" //----------------------------------------------------------------------------- #include "assertions.h" -#include "msc.h" #include "rlc.h" #include "rlc_am.h" #include "list.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c index 4d34338ea9..56b37e1e39 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_retransmit.c @@ -28,7 +28,6 @@ #include "rlc.h" #include "LAYER2/MAC/mac_extern.h" #include "common/utils/LOG/log.h" -#include "msc.h" //----------------------------------------------------------------------------- boolean_t rlc_am_nack_pdu ( const protocol_ctxt_t* const ctxt_pP, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c index dbe55c483d..ed81e119ac 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c @@ -26,7 +26,6 @@ //----------------------------------------------------------------------------- #include "platform_types.h" //----------------------------------------------------------------------------- -#include "msc.h" #include "list.h" #include "rlc_am.h" #include "LAYER2/MAC/mac_extern.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c index e421a36619..969ed2d7a5 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_poll_retransmit.c @@ -29,7 +29,6 @@ #include "rlc_am.h" #include "LAYER2/MAC/mac_extern.h" #include "common/utils/LOG/log.h" -#include "msc.h" //----------------------------------------------------------------------------- void rlc_am_check_timer_poll_retransmit( @@ -69,11 +68,6 @@ rlc_am_check_timer_poll_retransmit( rlc_pP->t_poll_retransmit.running = 0; rlc_pP->t_poll_retransmit.timed_out = 1; rlc_pP->stat_timer_poll_retransmit_timed_out += 1; -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_poll_retransmit timed-out",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); -#endif LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] TIME-OUT\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); @@ -144,11 +138,6 @@ rlc_am_stop_and_reset_timer_poll_retransmit( rlc_pP->t_poll_retransmit.ms_time_out = 0; rlc_pP->t_poll_retransmit.ms_start = 0; rlc_pP->t_poll_retransmit.timed_out = 0; -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_poll_retransmit stopped & reseted",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); -#endif } //----------------------------------------------------------------------------- void @@ -167,11 +156,6 @@ rlc_am_start_timer_poll_retransmit( LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] STARTED (TIME-OUT = FRAME %05d)\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->t_poll_retransmit.ms_time_out); -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_poll_retransmit started (TO %u ms)",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), rlc_pP->t_poll_retransmit.ms_time_out); -#endif } else { LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T_POLL_RETRANSMIT] NOT STARTED, CAUSE CONFIGURED 0 ms\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c index 262b8a8391..d161d29a65 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_reordering.c @@ -28,7 +28,6 @@ #include "rlc_am.h" # include "LAYER2/MAC/mac_extern.h" #include "common/utils//LOG/log.h" -#include "msc.h" //----------------------------------------------------------------------------- void rlc_am_check_timer_reordering( @@ -64,12 +63,6 @@ rlc_am_check_timer_reordering( // - start t-Reordering; // - set VR(X) to VR(H). -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_reordering timed out",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); -#endif - //AssertFatal (rlc_pP->vr_x != RLC_SN_UNDEFINED, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id); if(rlc_pP->vr_x == RLC_SN_UNDEFINED){ LOG_E(RLC, "RLC AM TReordering Expiry vrX not defined LcId=%d\n", rlc_pP->channel_id); @@ -153,11 +146,6 @@ rlc_am_stop_and_reset_timer_reordering( rlc_pP->t_reordering.ms_time_out = 0; rlc_pP->t_reordering.ms_start = 0; rlc_pP->t_reordering.timed_out = 0; -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_reordering stopped & reseted",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); -#endif } //----------------------------------------------------------------------------- void @@ -175,11 +163,6 @@ rlc_am_start_timer_reordering( LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] STARTED (TIME-OUT = %5u ms)\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->t_reordering.ms_time_out); -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_reordering started (TO %u ms)",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), rlc_pP->t_reordering.ms_time_out); -#endif } else { LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-REORDERING] NOT STARTED, CAUSE CONFIGURED 0 ms\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c index 5b0b0a70fa..aae7465bcf 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_timer_status_prohibit.c @@ -28,7 +28,6 @@ #include "rlc_am.h" #include "LAYER2/MAC/mac_extern.h" #include "common/utils/LOG/log.h" -#include "msc.h" //----------------------------------------------------------------------------- void rlc_am_check_timer_status_prohibit( @@ -60,12 +59,6 @@ rlc_am_check_timer_status_prohibit( rlc_pP->t_status_prohibit.running = 0; rlc_pP->t_status_prohibit.timed_out = 1; rlc_pP->stat_timer_status_prohibit_timed_out += 1; - -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_status_prohibit timed out",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); -#endif LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-STATUS-PROHIBIT] TIME-OUT\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); //#warning TO DO rlc_am_check_timer_status_prohibit @@ -91,11 +84,6 @@ rlc_am_stop_and_reset_timer_status_prohibit( rlc_pP->t_status_prohibit.ms_time_out = 0; rlc_pP->t_status_prohibit.ms_start = 0; rlc_pP->t_status_prohibit.timed_out = 0; -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_status_prohibit stopped & reseted",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP)); -#endif } } //----------------------------------------------------------------------------- @@ -117,11 +105,6 @@ rlc_am_start_timer_status_prohibit( PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->t_status_prohibit.ms_time_out); LOG_D(RLC, "TIME-OUT = FRAME %u\n", rlc_pP->t_status_prohibit.ms_time_out); -#if MESSAGE_CHART_GENERATOR_RLC_MAC - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" t_status_prohibit started (TO %u ms)",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), rlc_pP->t_status_prohibit.ms_time_out); -#endif } else { LOG_T(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[T-STATUS-PROHIBIT] NOT STARTED, CAUSE CONFIGURED 0 ms\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 654ddb8da7..1d40b12cc8 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -30,7 +30,6 @@ #include "intertask_interface.h" #endif #include "assertions.h" -#include "msc.h" #include "rlc_um.h" #include "list.h" #include "rlc_primitives.h" @@ -166,7 +165,6 @@ rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind char message_string[10000]; mem_block_t *tb_p; int16_t tb_size_in_bytes; - size_t message_string_size = 0; rlc_um_pdu_info_t pdu_info; int index; int octet_index; @@ -183,38 +181,15 @@ rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p)); - if (data_indP.data.nb_elements > 0 && MESSAGE_CHART_GENERATOR) { + if (data_indP.data.nb_elements > 0) { tb_p = data_indP.data.head; while (tb_p != NULL) { tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size; rlc_um_get_pdu_infos(ctxt_pP,l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT"DATA SN %u size %u FI %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p), - pdu_info.sn, - tb_size_in_bytes, - pdu_info.fi); - - if (pdu_info.e) { - message_string_size += sprintf(&message_string[message_string_size], "| HE:"); - - for (index=0; index < pdu_info.num_li; index++) { - message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]); - } - } - - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (const char *)pdu_info.payload, - tb_size_in_bytes, - message_string); tb_p = tb_p->next; } - }/*MESSAGE_CHART_GENERATOR*/ + } list_free (&data_indP.data); break; @@ -237,7 +212,7 @@ rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind // - enters the LOCAL_SUSPEND state. data_indP.tb_size = data_indP.tb_size >> 3; - if (data_indP.data.nb_elements > 0 && (MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC))) { + if (data_indP.data.nb_elements > 0 && (LOG_DEBUGFLAG(DEBUG_RLC))) { LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_IND %d TBs\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p), data_indP.data.nb_elements); @@ -251,32 +226,6 @@ rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind &pdu_info, l_rlc_p->rx_sn_length); - if (MESSAGE_CHART_GENERATOR) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT"DATA SN %u size %u FI %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p), - pdu_info.sn, - tb_size_in_bytes, - pdu_info.fi); - - if (pdu_info.e) { - message_string_size += sprintf(&message_string[message_string_size], "| HE:"); - - for (index=0; index < pdu_info.num_li; index++) { - message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]); - } - } - - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (char *)pdu_info.payload, - tb_size_in_bytes, - message_string); - } - if (LOG_DEBUGFLAG(DEBUG_RLC)) { message_string_size = 0; message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); @@ -483,89 +432,61 @@ rlc_um_mac_data_request (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP,cons continue; } - if (MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC) ) { + if (LOG_DEBUGFLAG(DEBUG_RLC) ) { rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length); - if(MESSAGE_CHART_GENERATOR) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], - MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT" DATA SN %u size %u FI %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p), - pdu_info.sn, - tb_size_in_bytes, - pdu_info.fi); + message_string_size = 0; + message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); + message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); + message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size); + message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size); + message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n"); + message_string_size += sprintf(&message_string[message_string_size], "Header :\n"); + message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi); + message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e); + message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn); - if (pdu_info.e) { - message_string_size += sprintf(&message_string[message_string_size], "|HE:"); + if (pdu_info.e) { + message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n"); - for (index=0; index < pdu_info.num_li; index++) { - message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]); - } + for (index=0; index < pdu_info.num_li; index++) { + message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]); } - - MSC_LOG_TX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB, - (const char *)pdu_info.payload, - pdu_info.payload_size, - message_string); } - if(LOG_DEBUGFLAG(DEBUG_RLC)) { - message_string_size = 0; - message_string_size += sprintf(&message_string[message_string_size], "Bearer : %ld\n", l_rlc_p->rb_id); - message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes); - message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size); - message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size); - message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n"); - message_string_size += sprintf(&message_string[message_string_size], "Header :\n"); - message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi); - message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e); - message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn); + message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n"); + message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n"); + message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n"); + message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n"); - if (pdu_info.e) { - message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n"); - - for (index=0; index < pdu_info.num_li; index++) { - message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]); - } - } - - message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n"); - message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n"); - message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n"); - message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n"); - - for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) { - if ((octet_index % 16) == 0) { - if (octet_index != 0) { - message_string_size += sprintf(&message_string[message_string_size], " |\n"); - } - - message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index); + for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) { + if ((octet_index % 16) == 0) { + if (octet_index != 0) { + message_string_size += sprintf(&message_string[message_string_size], " |\n"); } - /* - * Print every single octet in hexadecimal form - */ - message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]); - /* - * Align newline and pipes according to the octets in groups of 2 - */ + message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index); } /* - * Append enough spaces and put final pipe + * Print every single octet in hexadecimal form */ - for (index = octet_index; index < 16; ++index) { - message_string_size += sprintf(&message_string[message_string_size], " "); - } + message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]); + /* + * Align newline and pipes according to the octets in groups of 2 + */ + } - message_string_size += sprintf(&message_string[message_string_size], " |\n"); - LOG_UI(RLC, "%s\n", message_string); - } /*LOG_DEBUGFLAG(DEBUG_RLC) */ - } /* MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC) */ + /* + * Append enough spaces and put final pipe + */ + for (index = octet_index; index < 16; ++index) { + message_string_size += sprintf(&message_string[message_string_size], " "); + } + + message_string_size += sprintf(&message_string[message_string_size], " |\n"); + LOG_UI(RLC, "%s\n", message_string); + } /* LOG_DEBUGFLAG(DEBUG_RLC) */ tb_p = tb_p->next; } /* while (tb_p != NULL) */ @@ -607,15 +528,6 @@ rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t //rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer; rlc_p->stat_tx_pdcp_sdu += 1; rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size; - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT" DATA-REQ size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, rlc_p), - ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size); if (LOG_DEBUGFLAG(DEBUG_RLC) ) { data_offset = sizeof (struct rlc_um_data_req_alloc); @@ -660,14 +572,6 @@ rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t list_add_tail_eurecom(sdu_pP, &rlc_p->input_sdus); RLC_UM_MUTEX_UNLOCK(&rlc_p->lock_input_sdus); - if (MESSAGE_CHART_GENERATOR) { - if (rlc_p->buffer_occupancy > 4096) { - MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 "PROTOCOL_RLC_AM_MSC_FMT" BO %u bytes",\ - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_p), rlc_p->buffer_occupancy); - } - } - LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT" BO %d , NB SDU %d\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->buffer_occupancy, diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h index be06551dde..bd04ff3ece 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h @@ -56,28 +56,13 @@ rLC_Pp->rb_id,\ __FUNCTION__ -#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %" PRIx16 " %s %02ld]" -#define PROTOCOL_RLC_UM_MSC_ARGS(CTXT_Pp, rLC_Pp) \ - CTXT_Pp->rnti,\ - (rLC_Pp->is_data_plane) ? "DRB UM" : "SRB UM",\ - rLC_Pp->rb_id - #if defined(TRACE_RLC_MUTEX) #define RLC_UM_MUTEX_LOCK(mUTEX, cTXT, rLC) \ do {\ int pmtl_rc = pthread_mutex_trylock(mUTEX);\ if (pmtl_rc != 0){\ if (pmtl_rc == EBUSY) {\ - MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 " PROTOCOL_RLC_UM_MSC_FMT " Warning try lock %s busy",\ - PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\ - #mUTEX);\ pthread_mutex_lock(mUTEX);\ - } else {\ - MSC_LOG_EVENT((cTXT->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\ - "0 " PROTOCOL_RLC_UM_MSC_FMT " Error try lock %s %d",\ - PROTOCOL_RLC_UM_MSC_ARGS(cTXT,rLC),\ - #mUTEX, pmtl_rc);\ }\ }\ } while (0); diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index 05c3423f76..bec815ac5d 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -32,7 +32,6 @@ #include "rlc_um_control_primitives.h" #include "LTE_T-Reordering.h" -#include "msc.h" //----------------------------------------------------------------------------- void config_req_rlc_um ( @@ -173,15 +172,6 @@ void config_req_rlc_um_asn1 ( PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->rb_id, ul_rlc_pP->sn_FieldLength); - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ UL sn_FieldLength %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), - ul_rlc_pP->sn_FieldLength); return; } } @@ -201,15 +191,6 @@ void config_req_rlc_um_asn1 ( PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->rb_id, dl_rlc_pP->sn_FieldLength); - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ DL sn_FieldLength %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), - dl_rlc_pP->sn_FieldLength); return; } @@ -220,15 +201,6 @@ void config_req_rlc_um_asn1 ( PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p), rlc_p->rb_id, dl_rlc_pP->t_Reordering); - MSC_LOG_RX_DISCARDED_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_Reord %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), - dl_rlc_pP->t_Reordering); return; } } @@ -239,34 +211,12 @@ void config_req_rlc_um_asn1 ( ul_sn_FieldLength, dl_sn_FieldLength, mbms_flagP); - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_Reord %u rx snfl %u tx snfl %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), - t_Reordering, - ul_sn_FieldLength, - dl_sn_FieldLength); } else { rlc_um_configure(ctxt_pP,rlc_p, t_Reordering, dl_sn_FieldLength, ul_sn_FieldLength, mbms_flagP); - MSC_LOG_RX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE, - NULL, - 0, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ t_Reord %u rx snfl %u tx snfl %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc_p), - t_Reordering, - dl_sn_FieldLength, - ul_sn_FieldLength); } } } diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c index c8faa08358..6d2380d4ff 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c @@ -24,7 +24,6 @@ #include "platform_types.h" #include "assertions.h" //----------------------------------------------------------------------------- -#include "msc.h" #include "rlc.h" #include "rlc_um.h" #include "rlc_primitives.h" diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c index 2eba223803..ca43dab667 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c @@ -35,7 +35,6 @@ #include "list.h" #include "LAYER2/MAC/mac_extern.h" #include "common/utils/LOG/log.h" -#include "msc.h" //----------------------------------------------------------------------------- inline void @@ -117,17 +116,6 @@ rlc_um_send_sdu (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) rlc_pP->stat_rx_pdcp_sdu += 1; rlc_pP->stat_rx_pdcp_bytes += rlc_pP->output_sdu_size_to_write; - MSC_LOG_TX_MESSAGE( - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE, - (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, - (const char*)(rlc_pP->output_sdu_in_construction->data), - rlc_pP->output_sdu_size_to_write, - MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT" DATA-IND size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP,rlc_pP), - rlc_pP->output_sdu_size_to_write - ); - #if TEST_RLC_UM #if TRACE_RLC_UM_DISPLAY_ASCII_DATA rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write] = 0; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index 932bb1376e..4c047e3d92 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -27,7 +27,6 @@ //----------------------------------------------------------------------------- #include #include "assertions.h" -#include "msc.h" #include "list.h" #include "rlc_um.h" #include "rlc_primitives.h" diff --git a/openair2/LAYER2/RLC/rlc_proto_agent_primitives.h b/openair2/LAYER2/RLC/rlc_proto_agent_primitives.h deleted file mode 100644 index 75ccc9fcdd..0000000000 --- a/openair2/LAYER2/RLC/rlc_proto_agent_primitives.h +++ /dev/null @@ -1,16 +0,0 @@ - -#ifndef __PROTO_AGENT_RLC_PRIMITIVES_H__ -#define __PROTO_AGENT_RLC_PRIMITIVES_H__ - -#include "RRC/LTE/rrc_defs.h" -#include "LAYER2/PROTO_AGENT/proto_agent.h" -// PROTO AGENT -pthread_t async_server_thread; -int async_server_thread_finalize (void); -void async_server_thread_init (void); - -pthread_mutex_t async_server_lock; -pthread_cond_t async_server_notify; -int async_server_shutdown; - -#endif diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index ab8578a0e7..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; @@ -674,7 +667,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, sdap_gnb_ul_header_handler(buf[0]); // Handler for the UL gNB SDAP Header } LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset); - itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); } } } @@ -728,7 +721,7 @@ rb_found: LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; - itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); + itti_send_msg_to_task(TASK_GTPV1_U, CUuniqInstance, message_p); } else { memblock = get_free_mem_block(size, __FUNCTION__); @@ -1103,7 +1096,7 @@ boolean_t nr_rrc_pdcp_config_asn1_req( if (kRRCint != NULL) { /* todo */ } - + if (drb2release_list != NULL) { // TODO } 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/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 78e06d37e2..baae1fa436 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -40,8 +40,6 @@ #include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" -#include "openair2/LAYER2/PROTO_AGENT/proto_agent.h" - extern RAN_CONTEXT_t RC; #include @@ -518,7 +516,7 @@ rb_found: req->pdusession_id=rb_id; LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); extern instance_t DUuniqInstance; - itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); + itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg); return; } } diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 16c3db0cae..2a6f00c13c 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -440,7 +440,7 @@ rb_found: req->rnti=ue->rnti; req->rab_id=rb_id+4; LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); + itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg); return; } } diff --git a/openair2/M2AP/m2ap_MCE_generate_messages.c b/openair2/M2AP/m2ap_MCE_generate_messages.c index a28097cf1a..969863b445 100644 --- a/openair2/M2AP/m2ap_MCE_generate_messages.c +++ b/openair2/M2AP/m2ap_MCE_generate_messages.c @@ -39,7 +39,6 @@ #include "m2ap_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -174,8 +173,6 @@ int m2ap_MCE_generate_m2_setup_request( return -1; } - //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 M2Setup/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); - m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 0); return ret; @@ -311,8 +308,6 @@ int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MC m2ap_MCE_data_p->state = M2AP_MCE_STATE_READY; - //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 M2Setup/successfulOutcome assoc_id %u", m2ap_MCE_data_p->assoc_id); - m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 0); return ret; @@ -367,11 +362,6 @@ int m2ap_MCE_generate_m2_setup_failure(instance_t instance, return -1; } - //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, - // MSC_M2AP_TARGET_MCE, NULL, 0, - // "0 M2Setup/unsuccessfulOutcome assoc_id %u cause %u value %u", - // assoc_id, cause_type, cause_value); - m2ap_MCE_itti_send_sctp_data_req(instance, assoc_id, buffer, len, 0); return ret; @@ -557,8 +547,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2Handover/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -650,8 +638,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2Handover/successfulOutcome assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -712,8 +698,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2UEContextRelease/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -796,8 +780,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2HandoverCancel/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; diff --git a/openair2/M2AP/m2ap_MCE_handler.c b/openair2/M2AP/m2ap_MCE_handler.c index 5a0e303218..3f6d5ff64d 100644 --- a/openair2/M2AP/m2ap_MCE_handler.c +++ b/openair2/M2AP/m2ap_MCE_handler.c @@ -44,7 +44,6 @@ #include "m2ap_MCE_interface_management.h" //#include "m2ap_eNB_interface_management.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" diff --git a/openair2/M2AP/m2ap_MCE_interface_management.c b/openair2/M2AP/m2ap_MCE_interface_management.c index 3b12f41cbe..28f5fccffa 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.c +++ b/openair2/M2AP/m2ap_MCE_interface_management.c @@ -210,16 +210,7 @@ int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, AssertFatal(MCE_MBMS_M2AP_ID!=-1,"MCE_MBMS_M2AP_ID was not sent\n"); AssertFatal(ENB_MBMS_M2AP_ID!=-1,"ENB_MBMS_M2AP_ID was not sent\n"); //M2AP_SESSION_START_RESP(msg_p). -// MSC_LOG_RX_MESSAGE( -// MSC_M2AP_MCE, -// MSC_M2AP_ENB, - //return 0; -// 0, -// 0, -// MSC_AS_TIME_FMT" MCE_handle_M2_SESSION_START_RESPONSE successfulOutcome assoc_id %d", -// 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -// assoc_id); -// + LOG_D(M2AP, "Sending M2AP_SESSION_START_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); @@ -348,14 +339,6 @@ int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, AssertFatal(MCE_MBMS_M2AP_ID!=-1,"MCE_MBMS_M2AP_ID was not sent\n"); AssertFatal(ENB_MBMS_M2AP_ID!=-1,"ENB_MBMS_M2AP_ID was not sent\n"); // M2AP_SESSION_STOP_RESP(msg_p). - // MSC_LOG_RX_MESSAGE( - // MSC_M2AP_MCE, - // MSC_M2AP_ENB, - // 0, - // 0, - // MSC_AS_TIME_FMT" MCE_handle_M2_SESSION_STOP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); // LOG_D(M2AP, "Sending M2AP_SESSION_START_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); @@ -645,14 +628,6 @@ int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, // } // // M2AP_SESSION_STOP_RESP(msg_p). -// MSC_LOG_RX_MESSAGE( -// MSC_M2AP_MCE, -// MSC_M2AP_ENB, -// 0, -// 0, -// MSC_AS_TIME_FMT" MCE_handle_M2_SCHEDULING_INFORMATION_RESPONSE successfulOutcome assoc_id %d", -// 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -// assoc_id); // // LOG_D(M2AP, "Sending M2AP_SCHEDULING_INFO_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); @@ -836,15 +811,6 @@ int MCE_handle_M2_SETUP_REQUEST(instance_t instance, *m2ap_mce_data_from_enb = M2AP_SETUP_REQ(message_p); //printf("m2ap_mce_data_from_enb->assoc_id %d %d\n",m2ap_mce_data_from_enb->assoc_id,assoc_id); -// MSC_LOG_TX_MESSAGE( -// MSC_M2AP_MCE, -// MSC_RRC_ENB, -// 0, -// 0, -// MSC_AS_TIME_FMT" MCE_handle_M2_SETUP_REQUEST", -// 0,0//MSC_AS_TIME_ARGS(ctxt_pP), -// ); -// if (num_mbms_available > 0) { itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); } else { @@ -1217,15 +1183,6 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, //for (int i=0;i 0, "System Information %d is missing",i); - //MSC_LOG_RX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_CU, - // 0, - // 0, - // MSC_AS_TIME_FMT" eNB_handle_M2_SETUP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); - //LOG_D(M2AP, "Sending M2AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MOeNBLE_ID_TO_INSTANCE(assoc_id)); @@ -1430,16 +1387,7 @@ int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, //AssertFatal(MCE_MBMS_M2AP_ID!=-1,"MCE_MBMS_M2AP_ID was not sent\n"); //AssertFatal(ENB_MBMS_M2AP_ID!=-1,"ENB_MBMS_M2AP_ID was not sent\n"); //M2AP_SESSION_START_RESP(msg_p). -// MSC_LOG_RX_MESSAGE( -// MSC_M2AP_MCE, -// MSC_M2AP_ENB, - //return 0; -// 0, -// 0, -// MSC_AS_TIME_FMT" MCE_handle_M2_SESSION_START_RESPONSE successfulOutcome assoc_id %d", -// 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -// assoc_id); -// + //LOG_D(M2AP, "Sending ITTI message to ENB_APP with assoc_id (%d->%d)\n", //assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); diff --git a/openair2/M2AP/m2ap_eNB_generate_messages.c b/openair2/M2AP/m2ap_eNB_generate_messages.c index b6c821e1ce..6496d608b8 100644 --- a/openair2/M2AP/m2ap_eNB_generate_messages.c +++ b/openair2/M2AP/m2ap_eNB_generate_messages.c @@ -39,7 +39,6 @@ #include "m2ap_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -169,15 +168,6 @@ // // // LOG_W(M2AP,"pdu.present %d\n",pdu.present); -// // MSC_LOG_TX_MESSAGE( -// // MSC_M2AP_eNB, -// // MSC_M2AP_MCE, -// // (const char *)buffer, -// // len, -// // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", -// // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -// // m2ap_eNB_data_p->ENBname); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p, m2ap_eNB_data_p->assoc_id, buffer, len, 0); // // return 0; @@ -315,8 +305,6 @@ // // m2ap_eNB_data_p->state = M2AP_ENB_STATE_READY; // -// //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 M2Setup/successfulOutcome assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 0); // // return ret; @@ -371,11 +359,6 @@ // return -1; // } // -// //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, -// // MSC_M2AP_TARGET_ENB, NULL, 0, -// // "0 M2Setup/unsuccessfulOutcome assoc_id %u cause %u value %u", -// // assoc_id, cause_type, cause_value); -// // m2ap_eNB_itti_send_sctp_data_req(instance, assoc_id, buffer, len, 0); // // return ret; @@ -561,8 +544,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2Handover/initiatingMessage assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -654,8 +635,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2Handover/successfulOutcome assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -716,8 +695,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2UEContextRelease/initiatingMessage assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -800,8 +777,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2HandoverCancel/initiatingMessage assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; diff --git a/openair2/M2AP/m2ap_eNB_handler.c b/openair2/M2AP/m2ap_eNB_handler.c index 9abc337408..7c4a9758da 100644 --- a/openair2/M2AP/m2ap_eNB_handler.c +++ b/openair2/M2AP/m2ap_eNB_handler.c @@ -44,7 +44,6 @@ //#include "m2ap_MCE_interface_management.h" #include "m2ap_eNB_interface_management.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" diff --git a/openair2/M2AP/m2ap_eNB_interface_management.c b/openair2/M2AP/m2ap_eNB_interface_management.c index 486e382e69..9bab800525 100644 --- a/openair2/M2AP/m2ap_eNB_interface_management.c +++ b/openair2/M2AP/m2ap_eNB_interface_management.c @@ -44,7 +44,6 @@ #include "m2ap_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -255,15 +254,6 @@ int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms LOG_D(M2AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m2ap_eNB_data_p->ENBname); - m2ap_eNB_itti_send_sctp_data_req(instance, m2ap_enb_data_g->assoc_id, buffer, len, 0); return 0; } @@ -359,14 +349,6 @@ int eNB_send_MBMS_SESSION_START_RESPONSE(instance_t instance, m2ap_session_start LOG_D(M2AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m2ap_eNB_data_p->ENBname); m2ap_eNB_itti_send_sctp_data_req(instance, m2ap_enb_data_g->assoc_id, buffer, len, 0); return 0; @@ -531,14 +513,6 @@ int eNB_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m2ap_session_stop_r LOG_D(M2AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m2ap_eNB_data_p->ENBname); m2ap_eNB_itti_send_sctp_data_req(instance, m2ap_enb_data_g->assoc_id, buffer, len, 0); return 0; @@ -700,15 +674,6 @@ int eNB_send_M2_SETUP_REQUEST(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t* LOG_D(M2AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m2ap_eNB_data_p->ENBname); - // buffer = &bytes[0]; // len = 40; @@ -826,15 +791,6 @@ int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, //for (int i=0;i 0, "System Information %d is missing",i); - //MSC_LOG_RX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_CU, - // 0, - // 0, - // MSC_AS_TIME_FMT" eNB_handle_M2_SETUP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); - //LOG_D(M2AP, "Sending M2AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MOeNBLE_ID_TO_INSTANCE(assoc_id)); //itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p2); @@ -880,15 +836,6 @@ int eNB_handle_M2_SETUP_FAILURE(instance_t instance, //for (int i=0;i 0, "System Information %d is missing",i); - //MSC_LOG_RX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_CU, - // 0, - // 0, - // MSC_AS_TIME_FMT" eNB_handle_M2_SETUP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); - //LOG_D(M2AP, "Sending M2AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MOeNBLE_ID_TO_INSTANCE(assoc_id)); @@ -1025,15 +972,6 @@ int eNB_send_eNB_CONFIGURATION_UPDATE(instance_t instance, m2ap_enb_configuratio LOG_D(M2AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m2ap_eNB_data_p->ENBname); - // buffer = &bytes[0]; // len = 40; @@ -1086,15 +1024,6 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, //for (int i=0;i 0, "System Information %d is missing",i); - //MSC_LOG_RX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_CU, - // 0, - // 0, - // MSC_AS_TIME_FMT" eNB_handle_M2_SETUP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); - //LOG_D(M2AP, "Sending M2AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MOeNBLE_ID_TO_INSTANCE(assoc_id)); diff --git a/openair2/M2AP/m2ap_handler.c b/openair2/M2AP/m2ap_handler.c index 1221bcedb5..6d8405db14 100644 --- a/openair2/M2AP/m2ap_handler.c +++ b/openair2/M2AP/m2ap_handler.c @@ -44,7 +44,6 @@ #include "m2ap_MCE_interface_management.h" #include "m2ap_eNB_interface_management.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" diff --git a/openair2/MCE_APP/mce_config.c b/openair2/MCE_APP/mce_config.c index 439f2d2061..9d9d9028e5 100644 --- a/openair2/MCE_APP/mce_config.c +++ b/openair2/MCE_APP/mce_config.c @@ -54,8 +54,6 @@ #include "common/config/config_userapi.h" #include "RRC_config_tools.h" #include "enb_paramdef.h" -#include "proto_agent.h" - #include "m3ap_MCE.h" 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 c7b54950d7..9bce0e8843 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -30,6 +30,10 @@ * \warning */ +#include +#include +#include + #include "PHY/defs_nr_UE.h" #include "NR_IF_Module.h" #include "NR_MAC_UE/mac_proto.h" @@ -292,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; @@ -420,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; @@ -1034,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/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 3759519228..0a63acc8fb 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -43,7 +43,6 @@ #include "common/utils/LOG/log.h" #include "rrc_eNB_UE_context.h" #include "pdcp.h" -#include "msc.h" #include "common/ran_context.h" #include "intertask_interface.h" diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index f70cc68550..1993fe7de0 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -34,7 +34,6 @@ #include "common/utils/LOG/log.h" #include "rrc_eNB_UE_context.h" #include "pdcp.h" -#include "msc.h" #include "common/ran_context.h" #include "intertask_interface.h" @@ -62,16 +61,6 @@ rrc_data_req( return FALSE; } - MSC_LOG_TX_MESSAGE( - ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE, - ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE, - buffer_pP, - sdu_sizeP, - MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->rnti, - muiP, - sdu_sizeP); MessageDef *message_p; // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). uint8_t *message_buffer; diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c index 5c1800cdd4..534030864a 100644 --- a/openair2/RRC/LTE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -44,7 +44,6 @@ #include "common/utils/LOG/log.h" #include "rrc_eNB_UE_context.h" #include "pdcp.h" -#include "msc.h" #include "intertask_interface.h" @@ -274,16 +273,6 @@ rrc_data_req_ue( ) //------------------------------------------------------------------------------ { - MSC_LOG_TX_MESSAGE( - ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE, - ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE, - buffer_pP, - sdu_sizeP, - MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->rnti, - muiP, - sdu_sizeP); { MessageDef *message_p; // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). 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/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index d0b89abb51..b46bba2492 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -71,7 +71,6 @@ #include "pdcp.h" #include "plmn_data.h" -#include "msc.h" #include #include "intertask_interface.h" @@ -1390,16 +1389,6 @@ rrc_ue_process_radioResourceConfigDedicated( uint8_t *kUPenc = NULL; derive_key_up_enc(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc); - MSC_LOG_TX_MESSAGE( - MSC_RRC_UE, - MSC_PDCP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->rnti, - UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | - (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4)); // Refresh DRBs rrc_pdcp_config_asn1_req(ctxt_pP, (LTE_SRB_ToAddModList_t *)NULL, diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 260b6fceaa..ea98d3169d 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -58,7 +58,6 @@ #include "rlc.h" #include "rrc_eNB_UE_context.h" #include "platform_types.h" -#include "msc.h" #include "LTE_SL-CommConfig-r12.h" #include "LTE_PeriodicBSR-Timer-r12.h" #include "LTE_RetxBSR-Timer-r12.h" @@ -1247,16 +1246,6 @@ rrc_eNB_generate_SecurityModeCommand( size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); if (!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); @@ -1301,16 +1290,6 @@ rrc_eNB_generate_UECapabilityEnquiry( size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcUECapabilityEnquiry UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -1352,16 +1331,6 @@ rrc_eNB_generate_NR_UECapabilityEnquiry( size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcNRUECapabilityEnquiry UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -1391,15 +1360,6 @@ rrc_eNB_generate_RRCConnectionReject( (char *)(ue_p->Srb0.Tx_buffer.Payload), ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReject\n"); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReject UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -1509,14 +1469,6 @@ rrc_eNB_generate_RRCConnectionReestablishment( } // for (int cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) } // if (*SRB_configList != NULL) - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_RRC_UE, - ue_context->Srb0.Tx_buffer.Header, - ue_context->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishment UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context->rnti, - ue_context->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_context->Srb0.Tx_buffer.payload_size); @@ -2058,16 +2010,6 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration 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_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -2154,15 +2096,6 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( (char *)(ue_p->Srb0.Tx_buffer.Payload), ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRCConnectionReestablishmentReject\n"); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishmentReject UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishmentReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -2230,16 +2163,6 @@ rrc_eNB_generate_RRCConnectionRelease( size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" LTE_RRCConnectionRelease UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); pthread_mutex_lock(&rrc_release_freelist); for (release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { @@ -2525,16 +2448,6 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *co LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration 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_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -2773,16 +2686,6 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *cons LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration 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_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -2883,16 +2786,6 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration 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_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -3603,15 +3496,6 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req(ctxt_pP, DCCH, rrc_eNB_mui++, @@ -4316,15 +4200,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req(ctxt_pP, DCCH, rrc_eNB_mui++, @@ -4392,16 +4267,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( ); LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); rrc_data_req( ctxt_pP, DCCH, @@ -4996,7 +4861,6 @@ void rrc_eNB_handover_ue_context_release( //msg_release_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE); //itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_release_p); s1ap_ue_context_release(ctxt_pP->instance, ue_context_p->ue_context.eNB_ue_s1ap_id); - //MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); gtpv1u_enb_delete_tunnel_req_t delete_tunnels={0}; delete_tunnels.rnti = ue_context_p->ue_context.rnti; delete_tunnels.from_gnb = 0; @@ -6330,16 +6194,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration handover 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_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration handover UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); /* Refresh SRBs/DRBs */ rrc_pdcp_config_asn1_req(ctxt_pP, *SRB_configList2, // NULL, @@ -6535,9 +6389,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ue_context_pP->ue_context.kenb, &kRRCint); /* Refresh SRBs/DRBs */ - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti); rrc_pdcp_config_asn1_req(ctxt_pP, SRB_configList, // NULL, DRB_configList, @@ -6906,15 +6757,6 @@ rrc_eNB_generate_RRCConnectionSetup( LOG_W(RRC, "Unknown node type %d\n", RC.rrc[ctxt_pP->module_id]->node_type); } - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, // LG WARNING - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -7326,13 +7168,6 @@ rrc_eNB_decode_ccch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), Idx); - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); rrc_pdcp_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, (LTE_DRB_ToAddModList_t *) NULL, @@ -7373,15 +7208,6 @@ rrc_eNB_decode_ccch( if (ue_context_p != NULL) { // erase content rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - dec_rval.consumed, - MSC_AS_TIME_FMT" LTE_RRCConnectionRequest UE %x size %u (UE already in context)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed); } else { rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; { @@ -7467,18 +7293,6 @@ rrc_eNB_decode_ccch( } } - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.random_ue_identity); } else { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", @@ -7567,14 +7381,6 @@ rrc_eNB_decode_ccch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), Idx); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); rrc_pdcp_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, (LTE_DRB_ToAddModList_t *) NULL, @@ -7949,15 +7755,6 @@ rrc_eNB_decode_dcch( LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)(Rx_sdu),sdu_sizeP, "[MSG] RRC Connection Reconfiguration Complete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" LTE_RRCConnectionReconfigurationComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", @@ -8169,15 +7966,6 @@ rrc_eNB_decode_dcch( T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC Connection Reestablishment Complete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" LTE_RRCConnectionReestablishmentComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", @@ -8254,15 +8042,6 @@ rrc_eNB_decode_dcch( LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC Connection SetupComplete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" LTE_RRCConnectionSetupComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(RRCConnectionSetupComplete) ---> RRC_eNB\n", @@ -8308,15 +8087,6 @@ rrc_eNB_decode_dcch( LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC Security Mode Complete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -8345,15 +8115,6 @@ rrc_eNB_decode_dcch( T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC Security Mode Failure\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_W(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(securityModeFailure) ---> RRC_eNB\n", @@ -8383,15 +8144,6 @@ rrc_eNB_decode_dcch( LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC UECapablility Information\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -8569,15 +8321,6 @@ rrc_eNB_decode_dcch( LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC UL Information Transfer \n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); if (EPC_MODE_ENABLED == 1) { rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, @@ -8668,15 +8411,6 @@ rrc_eNB_decode_dcch( LOG_I(RRC,"THINH [LTE_UL_DCCH_MessageType__messageClassExtension_PR_c2]\n"); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC SidelinkUEInformation \n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" SidelinkUEInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(SidelinkUEInformation) ---> RRC_eNB\n", @@ -9572,20 +9306,6 @@ void *rrc_enb_process_itti_msg(void *notUsed) { rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance); break; - case GTPV1U_ENB_DELETE_TUNNEL_RESP: { - rrc_eNB_ue_context_t *ue = rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti); - - if (ue != NULL - && ue->ue_context.ue_release_timer_rrc > 0 - && (ue->ue_context.handover_info == NULL || - (ue->ue_context.handover_info->state != HO_RELEASE && - ue->ue_context.handover_info->state != HO_CANCEL))) { - ue->ue_context.ue_release_timer_rrc = ue->ue_context.ue_release_timer_thres_rrc; - } - - break; - } - case S1AP_PATH_SWITCH_REQ_ACK: LOG_I(RRC, "[eNB %ld] received path switch ack %s\n", instance, msg_name_p); rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK(msg_p, msg_name_p, instance); diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 3fa17bcd6b..575a38ee3d 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -32,7 +32,6 @@ # include "RRC/LTE/MESSAGES/asn1_msg.h" # include "rrc_eNB_GTPV1U.h" # include "rrc_eNB_UE_context.h" -# include "msc.h" #include "asn1_conversions.h" @@ -77,15 +76,6 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( create_tunnel_resp_pP->enb_addr.length); } - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_GTPU_ENB, - NULL,0, - MSC_AS_TIME_FMT" CREATE_TUNNEL_RESP RNTI %"PRIx16" ntuns %u ebid %u enb-s1u teid %u", - 0,0,rnti, - create_tunnel_resp_pP->num_tunnels, - ue_context_p->ue_context.enb_gtp_ebi[0], - ue_context_p->ue_context.enb_gtp_teid[0]); (void)rnti; /* avoid gcc warning "set but not used" */ return 0; } else { @@ -210,7 +200,7 @@ boolean_t gtpv_data_req_new ( GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt->frame,ctxt->subframe); itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt->module_id), msg); - return NW_GTPV1U_OK; + return 0; } /* target enb */ @@ -225,7 +215,7 @@ boolean_t gtpv_data_req_new ( gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); delete_tunnel_req.rnti = ctxt->rnti; - gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req, GTPV1U_TARGET_ENB); + gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req); return true; } else { /* data packet */ diff --git a/openair2/RRC/LTE/rrc_eNB_M2AP.c b/openair2/RRC/LTE/rrc_eNB_M2AP.c index a9c65eae1a..5516308a10 100644 --- a/openair2/RRC/LTE/rrc_eNB_M2AP.c +++ b/openair2/RRC/LTE/rrc_eNB_M2AP.c @@ -32,7 +32,6 @@ # include "RRC/LTE/MESSAGES/asn1_msg.h" # include "rrc_eNB_M2AP.h" //# include "rrc_eNB_UE_context.h" -# include "msc.h" # include "asn1_conversions.h" # include "intertask_interface.h" # include "common/ran_context.h" diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 1a5fe55c26..9b9e267828 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -36,7 +36,6 @@ #include "rrc_eNB_S1AP.h" #include "enb_config.h" #include "common/ran_context.h" -#include "gtpv1u.h" #include "s1ap_eNB.h" #include "s1ap_eNB_defs.h" @@ -48,7 +47,6 @@ #include "pdcp_primitives.h" #include "UTIL/OSA/osa_defs.h" -#include #include "LTE_UERadioAccessCapabilityInformation.h" @@ -586,17 +584,6 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( // TODO add cause when it will be integrated } } - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p), - sizeof(s1ap_initial_context_setup_resp_t), - MSC_AS_TIME_FMT" INITIAL_CONTEXT_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); } //------------------------------------------------------------------------------ @@ -804,14 +791,6 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( ue_context_pP->ue_context.ue_gummei.mnc_len = S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc_len; ue_context_pP->ue_context.ue_gummei.mme_code = S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_code; ue_context_pP->ue_context.ue_gummei.mme_group_id = S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_group_id; - MSC_LOG_TX_MESSAGE(MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)&message_p->ittiMsg.s1ap_nas_first_req, - sizeof(s1ap_nas_first_req_t), - MSC_AS_TIME_FMT" S1AP_NAS_FIRST_REQ eNB %u UE %x", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->module_id, - ctxt_pP->rnti); LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI mme_code %u mme_group_id %u ue %x\n", ctxt_pP->module_id, S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_code, @@ -852,15 +831,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( eNB_ue_s1ap_id); if (ue_context_p == NULL) { - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" DOWNLINK-NAS UE initial id %u eNB_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_initial_id, - eNB_ue_s1ap_id); /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; LOG_W(RRC, "[eNB %ld] In S1AP_DOWNLINK_NAS: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); @@ -869,15 +839,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.length = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.buffer = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer; // TODO add failure cause when defined! - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" S1AP_NAS_NON_DELIVERY_IND UE initial id %u eNB_ue_s1ap_id %u (ue ctxt !found)", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_initial_id, - eNB_ue_s1ap_id); itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { @@ -889,15 +850,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( ue_context_p->ue_context.eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id; } - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" DOWNLINK-NAS UE initial id %u eNB_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_initial_id, - S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id); /* Create message for PDCP (DLInformationTransfer_t) */ length = do_DLInformationTransfer ( instance, @@ -1195,12 +1147,6 @@ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( if (ue_context_pP == NULL) { LOG_E(RRC, "[eNB] In S1AP_UE_CONTEXT_RELEASE_REQ: invalid UE\n"); } else { - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL, - 0, - "0 S1AP_UE_CONTEXT_RELEASE_REQ eNB_ue_s1ap_id 0x%06"PRIX32" ", - ue_context_pP->ue_context.eNB_ue_s1ap_id); MessageDef *msg_context_release_req_p = NULL; msg_context_release_req_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_REQ); S1AP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; @@ -1214,9 +1160,6 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT( module_id_t enb_mod_idP, uint32_t eNB_ue_s1ap_id ) { - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_S1AP_ENB, NULL, 0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); @@ -1247,14 +1190,6 @@ rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND( LOG_W(RRC, "[eNB %ld] In S1AP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - MSC_LOG_EVENT(MSC_RRC_ENB, "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" context not found", - eNB_ue_s1ap_id); - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL, - 0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_complete_p); @@ -1432,16 +1367,6 @@ int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, if ((e_rabs_done > 0) ) { LOG_I(RRC,"S1AP_E_RAB_SETUP_RESP: sending the message: nb_of_erabs %d, total e_rabs %d, index %d\n", ue_context_pP->ue_context.nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), - sizeof(s1ap_e_rab_setup_resp_t), - MSC_AS_TIME_FMT" E_RAB_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } @@ -1667,16 +1592,6 @@ int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t *const ctxt_pP, if (e_rabs_done > 0 || e_rabs_failed > 0) { LOG_D(RRC,"S1AP_E_RAB_MODIFY_RESP: sending the message: nb_of_modify_e_rabs %d, total e_rabs %d, index %d\n", ue_context_pP->ue_context.nb_of_modify_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), - sizeof(s1ap_e_rab_setup_resp_t), - MSC_AS_TIME_FMT" E_RAB_MODIFY_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } else { itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); @@ -2067,16 +1982,6 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP, if (e_rabs_done > 0) { LOG_I(RRC,"S1AP_PATH_SWITCH_REQ: sending the message: nb_of_erabstobeswitched %d, total e_rabs %d, index %d\n", S1AP_PATH_SWITCH_REQ (msg_p).nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_PATH_SWITCH_REQ (msg_p), - sizeof(s1ap_path_switch_req_t), - MSC_AS_TIME_FMT" PATH_SWITCH_REQ UE %X eNB_ue_s1ap_id %u e_rabs:%u succ", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_PATH_SWITCH_REQ (msg_p).eNB_ue_s1ap_id, - e_rabs_done); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } else { itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); @@ -2355,16 +2260,6 @@ int rrc_eNB_send_E_RAB_Modification_Indication(const protocol_ctxt_t *const ctxt if (e_rab_modify_index > 0) { LOG_I(RRC,"S1AP_E_RAB_MODIFICATION_IND: sending the message: nb_of_erabstobemodified %d, total e_rabs %d, index %d\n", S1AP_E_RAB_MODIFICATION_IND (msg_p).nb_of_e_rabs_tobemodified, ue_context_pP->ue_context.setup_e_rabs, e_rab); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_MODIFICATION_IND (msg_p), - sizeof(s1ap_e_rab_modification_ind_t), - MSC_AS_TIME_FMT" E RAB MODIFICATION IND UE %X eNB_ue_s1ap_id %u e_rabs:%u succ", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_MODIFICATION_IND (msg_p).eNB_ue_s1ap_id, - e_rab_modify_index); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } else { itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); diff --git a/openair2/RRC/LTE/rrc_eNB_UE_context.c b/openair2/RRC/LTE/rrc_eNB_UE_context.c index 2cc89adf15..0d262064b5 100644 --- a/openair2/RRC/LTE/rrc_eNB_UE_context.c +++ b/openair2/RRC/LTE/rrc_eNB_UE_context.c @@ -35,7 +35,6 @@ #include "common/utils/LOG/log.h" #include "rrc_eNB_UE_context.h" -#include "msc.h" //------------------------------------------------------------------------------ @@ -210,10 +209,6 @@ void rrc_eNB_remove_ue_context( } RB_REMOVE(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP); - MSC_LOG_EVENT( - MSC_RRC_ENB, - "0 Removed UE %"PRIx16" ", - ue_context_pP->ue_context.rnti); rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_pP); uid_linear_allocator_free(rrc_instance_pP, ue_context_pP->local_uid); free(ue_context_pP); diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 4f54b9978d..1cf690ac0c 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -34,7 +34,6 @@ #include "nr_rrc_extern.h" #include "common/utils/LOG/log.h" #include "pdcp.h" -#include "msc.h" #include "common/ran_context.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" @@ -172,16 +171,6 @@ nr_rrc_data_req( return FALSE; } - MSC_LOG_TX_MESSAGE( - ctxt_pP->enb_flag ? MSC_RRC_GNB : MSC_RRC_UE, - ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE, - buffer_pP, - sdu_sizeP, - MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->rnti, - muiP, - sdu_sizeP); MessageDef *message_p; // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). uint8_t *message_buffer; @@ -372,10 +361,10 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, } void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) { + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { struct rrc_gNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_gNB_get_ue_context( RC.nrrrc[Mod_instP], diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 7c8ecad91f..d04ed78270 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1451,6 +1451,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, @@ -1870,6 +1894,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) //------------------------------------------------------------------------------ @@ -1906,15 +1932,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 @@ -1930,6 +1947,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 cb971acd60..7fe08704c2 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -110,6 +110,10 @@ void fill_initial_cellGroupConfig(int uid, NR_ServingCellConfigCommon_t *scc, 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); uint8_t do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, @@ -145,6 +149,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 667b5ed24a..1b2c38c835 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]; @@ -458,7 +462,6 @@ typedef struct { NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; NR_SRB_INFO SI; NR_SRB_INFO Srb0; - int initial_csi_index[MAX_NR_RRC_UE_CONTEXTS]; int p_gNB; } rrc_gNB_carrier_data_t; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 40de13dfb0..7dceb55a4b 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -76,26 +76,30 @@ 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, int minRXTXTIMEpdsch, int do_csirs, int do_srs, - int initial_csi_index, int uid); -void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int dl_antenna_ports, int do_csirs); +void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_CSI_MeasConfig_t *csi_MeasConfig, + int dl_antenna_ports, + int curr_bwp, + int do_csirs); 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, int do_srs, - int initial_csi_index, int uid); void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, @@ -112,9 +116,6 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *const ue_context_pP, const protocol_ctxt_t *const ctxt_pP ); -void apply_pdcp_config(rrc_gNB_ue_context_t *const ue_context_pP, - const protocol_ctxt_t *const ctxt_pP ); - void rrc_gNB_generate_RRCSetup( const protocol_ctxt_t *const ctxt_pP, @@ -209,3 +210,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 7e19a5313c..d6c658f01d 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -30,6 +30,10 @@ #define RRC_GNB_C #define RRC_GNB_C +#include +#include +#include + #include "nr_rrc_config.h" #include "nr_rrc_defs.h" #include "nr_rrc_extern.h" @@ -66,7 +70,6 @@ #include "rlc.h" #include "rrc_eNB_UE_context.h" #include "platform_types.h" -#include "msc.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "T.h" @@ -95,6 +98,7 @@ #include #include #include +#include #include "BIT_STRING.h" #include "assertions.h" @@ -103,27 +107,6 @@ extern RAN_CONTEXT_t RC; -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); - static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn); mui_t rrc_gNB_mui = 0; @@ -424,15 +407,6 @@ rrc_gNB_generate_RRCSetup( LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, // LG WARNING - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCSetup UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -503,15 +477,6 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( (NR_CellGroupConfig_t *)NULL ); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, // LG WARNING - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCSetup UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -553,14 +518,6 @@ rrc_gNB_generate_RRCReject( (char *)(ue_p->Srb0.Tx_buffer.Payload), ue_p->Srb0.Tx_buffer.payload_size, "[MSG] RRCReject \n"); - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, - MSC_RRC_UE, - ue_p->Srb0.Tx_buffer.Header, - ue_p->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" NR_RRCReject UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - ue_p->Srb0.Tx_buffer.payload_size); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -752,6 +709,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, @@ -762,8 +721,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); @@ -821,15 +782,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( rrc_gNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" NR_RRCReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); nr_rrc_data_req(ctxt_pP, DCCH, rrc_gNB_mui++, @@ -1032,6 +984,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"); @@ -1051,16 +1005,178 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( 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); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, + +#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, - MSC_AS_TIME_FMT" dedicated RRCReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +#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; @@ -1141,6 +1257,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( NULL, dedicatedNAS_MessageList, NULL, + NULL, + NULL, NULL); ue_context_pP->ue_context.pdu_session_release_command_flag = 1; @@ -1159,16 +1277,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( 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); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated NR_RRCReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); #ifdef ITTI_SIM MessageDef *message_p; uint8_t *message_buffer; @@ -1233,9 +1341,6 @@ rrc_gNB_process_RRCReconfigurationComplete( ue_context_pP->ue_context.kgnb, &kRRCint); /* Refresh SRBs/DRBs */ - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_PDCP_ENB, NULL, 0, MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti); #ifndef ITTI_SIM LOG_D(NR_RRC,"Configuring PDCP DRBs/SRBs for UE %x\n",ue_context_pP->ue_context.rnti); @@ -1464,14 +1569,6 @@ rrc_gNB_generate_RRCReestablishment( } } // if (*SRB_configList != NULL) - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, - MSC_RRC_UE, - ue_context->Srb0.Tx_buffer.Header, - ue_context->Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" NR_RRCReestablishment UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context->rnti, - ue_context->Srb0.Tx_buffer.payload_size); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), ue_context->Srb0.Tx_buffer.payload_size); @@ -1711,6 +1808,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"); @@ -1734,16 +1833,6 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( LOG_D(NR_RRC, "[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration 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); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" LTE_RRCConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); #ifdef ITTI_SIM MessageDef *message_p; uint8_t *message_buffer; @@ -1814,15 +1903,6 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti); if (ue_context_p != NULL) { rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p); - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - dec_rval.consumed, - MSC_AS_TIME_FMT" NR_RRCSetupRequest UE %x size %u (UE already in context)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed); } else { rrcSetupRequest = &ul_ccch_msg->message.choice.c1->choice.rrcSetupRequest->rrcSetupRequest; if (NR_InitialUE_Identity_PR_randomValue == rrcSetupRequest->ue_Identity.present) { @@ -2114,13 +2194,6 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), Idx); - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, - MSC_PDCP_GNB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); // nr_rrc_pdcp_config_asn1_req(ctxt_pP, // ue_context_p->ue_context.SRB_configList, // NULL, @@ -2195,7 +2268,6 @@ rrc_gNB_decode_dcch( asn_dec_rval_t dec_rval; NR_UL_DCCH_Message_t *ul_dcch_msg = NULL; struct rrc_gNB_ue_context_s *ue_context_p = NULL; - MessageDef *msg_delete_tunnels_p = NULL; uint8_t xid; int i; @@ -2264,15 +2336,6 @@ rrc_gNB_decode_dcch( LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)(Rx_sdu), sdu_sizeP, "[MSG] RRC Connection Reconfiguration Complete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" NR_RRCReconfigurationComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(RRCReconfigurationComplete) ---> RRC_gNB]\n", @@ -2294,28 +2357,37 @@ rrc_gNB_decode_dcch( xid = ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier; ue_context_p->ue_context.pdu_session_release_command_flag = 0; //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_GNB_DELETE_TUNNEL_REQ); - memset(>PV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - + gtpv1u_gnb_delete_tunnel_req_t req={0}; for(i = 0; i < NB_RB_MAX; i++) { if(xid == ue_context_p->ue_context.pduSession[i].xid) { - GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] = + req.pdusession_id[req.num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i]; ue_context_p->ue_context.gnb_gtp_teid[i] = 0; memset(&ue_context_p->ue_context.gnb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.gnb_gtp_addrs[i])); ue_context_p->ue_context.gnb_gtp_psi[i] = 0; } } - - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); + gtpv1u_delete_ngu_tunnel(ctxt_pP->instance, &req); //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; } } } @@ -2334,15 +2406,6 @@ rrc_gNB_decode_dcch( LOG_DUMPMSG(NR_RRC, DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC SetupComplete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" NR_RRCSetupComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(RRCSetupComplete) ---> RRC_gNB\n", @@ -2421,15 +2484,6 @@ rrc_gNB_decode_dcch( LOG_D(NR_RRC,"[MSG] RRC UL Information Transfer \n"); LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] RRC UL Information Transfer \n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); if (AMF_MODE_ENABLED == 1) { rrc_gNB_send_NGAP_UPLINK_NAS(ctxt_pP, @@ -2469,15 +2523,6 @@ rrc_gNB_decode_dcch( case NR_UL_DCCH_MessageType__c1_PR_securityModeFailure: LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] NR RRC Security Mode Failure\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_W(NR_RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(securityModeFailure) ---> RRC_gNB\n", @@ -2500,15 +2545,6 @@ rrc_gNB_decode_dcch( LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] NR_RRC UECapablility Information\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -2614,15 +2650,6 @@ rrc_gNB_decode_dcch( case NR_UL_DCCH_MessageType__c1_PR_rrcReestablishmentComplete: LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)Rx_sdu,sdu_sizeP, "[MSG] NR_RRC Connection Reestablishment Complete\n"); - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" NR_RRCConnectionReestablishmentComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); LOG_I(NR_RRC, PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " "(rrcConnectionReestablishmentComplete) ---> RRC_gNB\n", @@ -3325,51 +3352,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; @@ -3426,28 +3408,26 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(RC.nrrrc[ctxt_pP->module_id]->rrc_ue_head)) { ctxt_pP->rnti = ue_context_p->ue_id_rnti; - if (fd) { - if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) { - fprintf(fd,"NR RRC UE rnti %x: S-TMSI %x failure timer %d/8\n", + if (fd) { + if (ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.presence == TRUE) { + fprintf(fd,"NR RRC UE rnti %x: S-TMSI %x failure timer %d/8\n", ue_context_p->ue_id_rnti, ue_context_p->ue_context.Initialue_identity_5g_s_TMSI.fiveg_tmsi, ue_context_p->ue_context.ul_failure_timer); - } else { - fprintf(fd,"NR RRC UE rnti %x failure timer %d/8\n", + } else { + fprintf(fd,"NR RRC UE rnti %x failure timer %d/8\n", ue_context_p->ue_id_rnti, ue_context_p->ue_context.ul_failure_timer); - } + } - 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", + if (ue_context_p->ue_context.UE_Capability_nr) { + 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)); - } + } } if (ue_context_p->ue_context.ul_failure_timer > 0) { ue_context_p->ue_context.ul_failure_timer++; @@ -3508,6 +3488,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { if (fd) fclose(fd); + /* send a tick to x2ap */ if (is_x2ap_enabled()){ msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_SUBFRAME_PROCESS); @@ -3637,11 +3618,12 @@ void *rrc_gnb_task(void *args_p) { rrc_gNB_process_NGAP_PDUSESSION_SETUP_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); + case NGAP_PDUSESSION_MODIFY_REQ: + rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(msg_p, msg_name_p, instance); break; - case GTPV1U_GNB_DELETE_TUNNEL_RESP: + case NGAP_PDUSESSION_RELEASE_COMMAND: + rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(msg_p, msg_name_p, instance); break; /* Messages from gNB app */ @@ -3693,11 +3675,6 @@ void *rrc_gnb_task(void *args_p) { rrc_gNB_process_dc_overall_timeout(GNB_INSTANCE_TO_MODULE_ID(instance), &X2AP_ENDC_DC_OVERALL_TIMEOUT(msg_p)); break; - /* Messages from GTP */ - case GTPV1U_ENB_DELETE_TUNNEL_RESP: - /* nothing to do? */ - break; - case NGAP_UE_CONTEXT_RELEASE_REQ: rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); break; @@ -3771,16 +3748,6 @@ rrc_gNB_generate_SecurityModeCommand( size, rrc_gNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); #ifdef ITTI_SIM MessageDef *message_p; uint8_t *message_buffer; @@ -3853,16 +3820,6 @@ rrc_gNB_generate_UECapabilityEnquiry( size, rrc_gNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcNRUECapabilityEnquiry UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); #ifdef ITTI_SIM MessageDef *message_p; uint8_t *message_buffer; @@ -3922,16 +3879,6 @@ rrc_gNB_generate_RRCRelease( size, rrc_gNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" NR_RRCRelease UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_gNB_mui, - size); #ifdef ITTI_SIM MessageDef *message_p; diff --git a/openair2/RRC/NR/rrc_gNB_GTPV1U.c b/openair2/RRC/NR/rrc_gNB_GTPV1U.c index 293f9e8b9f..f7b491af14 100644 --- a/openair2/RRC/NR/rrc_gNB_GTPV1U.c +++ b/openair2/RRC/NR/rrc_gNB_GTPV1U.c @@ -32,7 +32,6 @@ # include "RRC/LTE/MESSAGES/asn1_msg.h" # include "rrc_eNB_GTPV1U.h" # include "rrc_eNB_UE_context.h" -# include "msc.h" # include "openair2/RRC/NR/rrc_gNB_UE_context.h" //# if defined(ENABLE_ITTI) @@ -77,15 +76,6 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( create_tunnel_resp_pP->enb_addr.length); } - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_GTPU_ENB, - NULL,0, - MSC_AS_TIME_FMT" CREATE_TUNNEL_RESP RNTI %"PRIx16" ntuns %u ebid %u enb-s1u teid %u", - 0,0,rnti, - create_tunnel_resp_pP->num_tunnels, - ue_context_p->ue_context.gnb_gtp_ebi[0], - ue_context_p->ue_context.gnb_gtp_teid[0]); (void)rnti; /* avoid gcc warning "set but not used" */ return 0; } else { @@ -126,15 +116,6 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( create_tunnel_resp_pP->gnb_addr.length); } - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_GTPU_GNB, - NULL,0, - MSC_AS_TIME_FMT" CREATE_TUNNEL_RESP RNTI %"PRIx16" ntuns %u psid %u enb-s1u teid %u", - 0,0,rnti, - create_tunnel_resp_pP->num_tunnels, - ue_context_p->ue_context.gnb_gtp_psi[0], - ue_context_p->ue_context.gnb_gtp_teid[0]); (void)rnti; /* avoid gcc warning "set but not used" */ return 0; } else { diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 043d136604..4286ea0d62 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -33,17 +33,15 @@ #include "rrc_eNB_S1AP.h" #include "gnb_config.h" #include "common/ran_context.h" -#include "gtpv1u.h" #include "asn1_conversions.h" #include "intertask_interface.h" #include "pdcp.h" #include "pdcp_primitives.h" -#include "msc.h" - #include "gtpv1u_eNB_task.h" #include "gtpv1u_gNB_task.h" +#include #include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "RRC/NR/rrc_gNB_GTPV1U.h" @@ -453,14 +451,6 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( ue_context_pP->ue_context.ue_guami.amf_set_id = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_set_id; ue_context_pP->ue_context.ue_guami.amf_pointer = NGAP_NAS_FIRST_REQ(message_p).ue_identity.guami.amf_pointer; - MSC_LOG_TX_MESSAGE(MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)&message_p->ittiMsg.ngap_nas_first_req, - sizeof(ngap_nas_first_req_t), - MSC_AS_TIME_FMT" NGAP_NAS_FIRST_REQ gNB %u UE %x", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->module_id, - ctxt_pP->rnti); LOG_I(NGAP, "[gNB %d] Build NGAP_NAS_FIRST_REQ adding in s_TMSI: GUAMI amf_set_id %u amf_region_id %u ue %x\n", ctxt_pP->module_id, NGAP_NAS_FIRST_REQ (message_p).ue_identity.guami.amf_set_id, @@ -636,16 +626,6 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP( } } - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_S1AP_ENB, - (const char *)&NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p), - sizeof(ngap_initial_context_setup_resp_t), - MSC_AS_TIME_FMT" INITIAL_CONTEXT_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id, - pdu_sessions_done, pdu_sessions_failed); NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions = pdu_sessions_done; NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_pdusessions_failed = pdu_sessions_failed; itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p); @@ -794,15 +774,6 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( gNB_ue_ngap_id); if (ue_context_p == NULL) { - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_NGAP_GNB, - NULL, - 0, - MSC_AS_TIME_FMT" DOWNLINK-NAS UE initial id %u gNB_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_initial_id, - gNB_ue_ngap_id); /* Can not associate this message to an UE index, send a failure to NGAP and discard it! */ MessageDef *msg_fail_p; LOG_W(NR_RRC, "[gNB %ld] In NGAP_DOWNLINK_NAS: unknown UE from NGAP ids (%d, %u)\n", instance, ue_initial_id, gNB_ue_ngap_id); @@ -811,15 +782,6 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( NGAP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.length = NGAP_DOWNLINK_NAS (msg_p).nas_pdu.length; NGAP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.buffer = NGAP_DOWNLINK_NAS (msg_p).nas_pdu.buffer; // TODO add failure cause when defined! - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_NGAP_GNB, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" NGAP_NAS_NON_DELIVERY_IND UE initial id %u gNB_ue_ngap_id %u (ue ctxt !found)", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_initial_id, - gNB_ue_ngap_id); itti_send_msg_to_task (TASK_NGAP, instance, msg_fail_p); return (-1); } else { @@ -830,15 +792,6 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS( ue_context_p->ue_context.gNB_ue_ngap_id = NGAP_DOWNLINK_NAS (msg_p).gNB_ue_ngap_id; } - MSC_LOG_RX_MESSAGE( - MSC_RRC_GNB, - MSC_NGAP_GNB, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" DOWNLINK-NAS UE initial id %u gNB_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_initial_id, - NGAP_DOWNLINK_NAS (msg_p).gNB_ue_ngap_id); /* Create message for PDCP (DLInformationTransfer_t) */ length = do_NR_DLInformationTransfer ( instance, @@ -997,16 +950,6 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP( if ((pdu_sessions_done > 0) ) { LOG_I(NR_RRC,"NGAP_PDUSESSION_SETUP_RESP: sending the message: nb_of_pdusessions %d, total pdu_sessions %d, index %d\n", ue_context_pP->ue_context.nb_of_pdusessions, ue_context_pP->ue_context.setup_pdu_sessions, pdusession); - MSC_LOG_TX_MESSAGE( - MSC_RRC_GNB, - MSC_NGAP_GNB, - (const char *)&NGAP_PDUSESSION_SETUP_RESP (msg_p), - sizeof(ngap_pdusession_setup_resp_t), - MSC_AS_TIME_FMT" PDUSESSION_SETUP_RESP UE %X gNB_ue_ngap_id %u pdu_sessions:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - NGAP_PDUSESSION_SETUP_RESP (msg_p).gNB_ue_ngap_id, - pdu_sessions_done, pdu_sessions_failed); itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p); } @@ -1115,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, @@ -1126,12 +1327,6 @@ rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ( if (ue_context_pP == NULL) { LOG_E(RRC, "[gNB] In NGAP_UE_CONTEXT_RELEASE_REQ: invalid UE\n"); } else { - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, - MSC_NGAP_GNB, - NULL, - 0, - "0 NGAP_UE_CONTEXT_RELEASE_REQ gNB_ue_ngap_id 0x%06"PRIX32" ", - ue_context_pP->ue_context.gNB_ue_ngap_id); MessageDef *msg_context_release_req_p = NULL; msg_context_release_req_p = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_REQ); NGAP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id; @@ -1204,14 +1399,6 @@ rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND( LOG_W(NR_RRC, "[gNB %ld] In NGAP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from gNB_ue_ngap_id (%u)\n", instance, gNB_ue_ngap_id); - MSC_LOG_EVENT(MSC_RRC_GNB, "0 NGAP_UE_CONTEXT_RELEASE_COMPLETE gNB_ue_ngap_id 0x%06"PRIX32" context not found", - gNB_ue_ngap_id); - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, - MSC_NGAP_GNB, - NULL, - 0, - "0 NGAP_UE_CONTEXT_RELEASE_COMPLETE gNB_ue_ngap_id 0x%06"PRIX32" ", - gNB_ue_ngap_id); msg_complete_p = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_COMPLETE); NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).gNB_ue_ngap_id = gNB_ue_ngap_id; itti_send_msg_to_task(TASK_NGAP, instance, msg_complete_p); @@ -1235,9 +1422,6 @@ rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND( void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE( instance_t instance, uint32_t gNB_ue_ngap_id) { - MSC_LOG_TX_MESSAGE(MSC_RRC_GNB, MSC_NGAP_GNB, NULL, 0, - "0 NGAP_UE_CONTEXT_RELEASE_COMPLETE gNB_ue_ngap_id 0x%06"PRIX32" ", - gNB_ue_ngap_id); MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_COMPLETE); NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg).gNB_ue_ngap_id = gNB_ue_ngap_id; itti_send_msg_to_task(TASK_NGAP, instance, msg); @@ -1395,7 +1579,6 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND( protocol_ctxt_t ctxt; pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION]; uint8_t nb_pdusessions_torelease; - MessageDef *msg_delete_tunnels_p = NULL; uint8_t xid; int i, pdusession; uint8_t b_existed,is_existed; @@ -1473,20 +1656,18 @@ rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND( } else { //gtp tunnel delete LOG_I(NR_RRC, "gtp tunnel delete \n"); - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_GNB_DELETE_TUNNEL_REQ); - memset(>PV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + gtpv1u_gnb_delete_tunnel_req_t req={0}; + req.rnti = ue_context_p->ue_context.rnti; for(i = 0; i < NB_RB_MAX; i++) { if(xid == ue_context_p->ue_context.pduSession[i].xid) { - GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).pdusession_id[GTPV1U_GNB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i]; + req.pdusession_id[req.num_pdusession++] = ue_context_p->ue_context.gnb_gtp_psi[i]; ue_context_p->ue_context.gnb_gtp_teid[i] = 0; memset(&ue_context_p->ue_context.gnb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.gnb_gtp_addrs[i])); ue_context_p->ue_context.gnb_gtp_psi[i] = 0; } } - - itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); + gtpv1u_delete_ngu_tunnel(instance, &req); //NGAP_PDUSESSION_RELEASE_RESPONSE rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); LOG_I(NR_RRC, "Send PDU Session Release Response \n"); 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_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c index ad8bd01470..b8ff19b749 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.c +++ b/openair2/RRC/NR/rrc_gNB_UE_context.c @@ -35,7 +35,6 @@ #include "common/utils/LOG/log.h" #include "rrc_gNB_UE_context.h" -#include "msc.h" //------------------------------------------------------------------------------ @@ -208,10 +207,6 @@ void rrc_gNB_remove_ue_context( } RB_REMOVE(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP); - MSC_LOG_EVENT( - MSC_RRC_ENB, - "0 Removed UE %"PRIx16" ", - ue_context_pP->ue_context.rnti); rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_pP); nr_uid_linear_allocator_free(rrc_instance_pP, ue_context_pP->local_uid); free(ue_context_pP); diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index ee8f5c7b3a..70dfebaaf7 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; @@ -177,7 +157,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ue_context_p->ue_context.reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration; NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t)); ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies; - carrier->initial_csi_index[ue_context_p->local_uid + 1] = 0; ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t)); if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){ fill_default_rbconfig(ue_context_p->ue_context.rb_config, @@ -266,22 +245,22 @@ 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, carrier->do_SRS, - carrier->initial_csi_index[ue_context_p->local_uid + 1], ue_context_p->local_uid); } else { fill_default_reconfig(carrier->servingcellconfigcommon, 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, carrier->do_SRS, - carrier->initial_csi_index[ue_context_p->local_uid + 1], ue_context_p->local_uid); } ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 3a28409aea..1de34804df 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 @@ -52,17 +53,21 @@ 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, int minRXTXTIME, int do_csirs, int do_srs, - int initial_csi_index, int uid) { + 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. @@ -336,12 +341,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; @@ -560,7 +560,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - if (dl_antenna_ports > 1)// for MIMO, we use DMRS Config Type 2 + if ((get_softmodem_params()->do_ra || + get_softmodem_params()->phy_test) && + dl_antenna_ports > 1) // for MIMO, we use DMRS Config Type 2 but only with OAI UE bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)); else bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; @@ -603,43 +605,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco 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; @@ -742,8 +708,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)); @@ -1056,7 +1022,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pdsch_servingcellconfig->pucch_Cell= NULL; pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1)); pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); - *pdsch_servingcellconfig->ext1->maxMIMO_Layers = 2; + *pdsch_servingcellconfig->ext1->maxMIMO_Layers = dl_antenna_ports; pdsch_servingcellconfig->ext1->processingType2Enabled = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=NULL; @@ -1077,7 +1043,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco imres0->csi_IM_ResourceElementPattern->choice.pattern1->symbolLocation_p1 = 6; imres0->freqBand = calloc(1,sizeof(*imres0->freqBand)); imres0->freqBand->startingRB = 0; - imres0->freqBand->nrofRBs = 108; + imres0->freqBand->nrofRBs = ((curr_bwp>>2)+(curr_bwp%4>0))<<2; imres0->periodicityAndOffset = calloc(1,sizeof(*imres0->periodicityAndOffset)); imres0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320; imres0->periodicityAndOffset->choice.slots320 = 0; @@ -1096,7 +1062,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL; - csi_MeasConfig->csi_IM_ResourceSetToAddModList = NULL; csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL; if (do_csirs) { @@ -1116,7 +1081,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL; - config_csirs(servingcellconfigcommon, csi_MeasConfig,dl_antenna_ports,do_csirs); + config_csirs(servingcellconfigcommon, csi_MeasConfig,dl_antenna_ports,curr_bwp,do_csirs); csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList)); csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL; @@ -1171,6 +1136,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_CSI_IM_ResourceSetId_t *csiim00 = calloc(1,sizeof(*csiim00)); *csiim00 = 0; ASN_SEQUENCE_ADD(&csires2->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list,csiim00); + csires2->bwp_Id = 1; + csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires2); } @@ -1315,7 +1282,11 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } -void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int dl_antenna_ports, int do_csirs) { +void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_CSI_MeasConfig_t *csi_MeasConfig, + int dl_antenna_ports, + int curr_bwp, + int do_csirs) { if (do_csirs) { csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList)); @@ -1328,17 +1299,17 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_ 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; @@ -1350,7 +1321,7 @@ void config_csirs(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_ resourceMapping.density.present = NR_CSI_RS_ResourceMapping__density_PR_one; resourceMapping.density.choice.one = (NULL_t)0; resourceMapping.freqBand.startingRB = 0; - resourceMapping.freqBand.nrofRBs = 108; + resourceMapping.freqBand.nrofRBs = ((curr_bwp>>2)+(curr_bwp%4>0))<<2; nzpcsi0->resourceMapping = resourceMapping; nzpcsi0->powerControlOffset = 0; nzpcsi0->powerControlOffsetSS=calloc(1,sizeof(*nzpcsi0->powerControlOffsetSS)); @@ -1371,11 +1342,11 @@ 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, int do_srs, - int initial_csi_index, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); @@ -1386,13 +1357,13 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon fill_default_secondaryCellGroup(servingcellconfigcommon, servingcellconfigdedicated, secondaryCellGroup, + uecap, 1, 1, dl_antenna_ports, minRXTXTIME, do_csirs, do_srs, - initial_csi_index, uid); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f910ff68d4..fa1690e450 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, @@ -2164,17 +2144,6 @@ nr_rrc_ue_establish_srb2( nr_derive_key_up_int(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm, NR_UE_rrc_inst[ctxt_pP->module_id].kgnb, &kUPint); - MSC_LOG_TX_MESSAGE( - MSC_RRC_UE, - MSC_PDCP_UE, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security %X)", - MSC_AS_TIME_ARGS(ctxt_pP), - ctxt_pP->rnti, - NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4)); - // Refresh DRBs nr_rrc_pdcp_config_asn1_req(ctxt_pP, NULL, @@ -2241,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, @@ -2254,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/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index 28de1ca3b8..a6ac444e45 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -36,8 +36,6 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include -#include "msc.h" - #include "common/ran_context.h" #include "common/config/config_userapi.h" @@ -572,9 +570,6 @@ int main( int argc, char **argv ) cpuf=get_cpu_freq_GHz(); itti_init(TASK_MAX, tasks_info); - // initialize mscgen log after ITTI - MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); - init_opt(); 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/UTIL/MATH/crc_byte.c b/openair2/UTIL/MATH/crc_byte.c deleted file mode 100644 index a3ff00fec1..0000000000 --- a/openair2/UTIL/MATH/crc_byte.c +++ /dev/null @@ -1,185 +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 - */ - -/* - May 10, 2001 - Modified in June, 2001, to include the length non multiple of 8 - crc_byte.c - Byte oriented implementation of CRC's - - */ -#include "rtos_header.h" -#include "platform_types.h" - - -/*ref 25.222 v4.0.0 , p12 */ -/* the highest degree is set by default */ -unsigned int poly24 = 0x80006100; // 1000 0000 0000 0000 0110 0001 D^24 + D^23 + D^6 + D^5 + D + 1 -unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 -unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 -unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 -/********************************************************* - -For initialization && verification purposes, - bit by bit implementation with any polynomial - -The first bit is in the MSB of each byte - -*********************************************************/ -static unsigned int -crcbit (unsigned char * inputptr, int octetlen, unsigned int poly) -{ - unsigned int i, crc = 0, c; - - while (octetlen-- > 0) { - c = (*inputptr++) << 24; - - for (i = 8; i != 0; i--) { - if ((1 << 31) & (c ^ crc)) - crc = (crc << 1) ^ poly; - else - crc <<= 1; - - c <<= 1; - } - } - - return crc; -} - -/********************************************************* - -crc table initialization - -*********************************************************/ -static unsigned int crc24Table[256]; -static unsigned short crc16Table[256]; -static unsigned short crc12Table[256]; -static unsigned char crc8Table[256]; -void -crcTableInit () -{ - unsigned char c = 0; - - do { - crc24Table[c] = crcbit (&c, 1, poly24); - crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16); - crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16); - crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24); - } while (++c); -} - -/********************************************************* - -Byte by byte implementations, -assuming initial byte is 0 padded (in MSB) if necessary - -*********************************************************/ -unsigned int -crc24 (unsigned char * inptr, int bitlen) -{ - - int octetlen, resbit; - unsigned int crc = 0; - octetlen = bitlen / 8; /* Change in octets */ - resbit = (bitlen % 8); - - while (octetlen-- > 0) { - crc = (crc << 8) ^ crc24Table[(*inptr++) ^ (crc >> 24)]; - } - - if (resbit > 0) - crc = (crc << resbit) ^ crc24Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; - - return crc; -} - -unsigned int -crc16 (unsigned char * inptr, int bitlen) -{ - int octetlen, resbit; - unsigned int crc = 0; - octetlen = bitlen / 8; /* Change in octets */ - resbit = (bitlen % 8); - - while (octetlen-- > 0) { - crc = (crc << 8) ^ (crc16Table[(*inptr++) ^ (crc >> 24)] << 16); - } - - if (resbit > 0) - crc = (crc << resbit) ^ (crc16Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); - - return crc; -} - -unsigned int -crc12 (unsigned char * inptr, int bitlen) -{ - int octetlen, resbit; - unsigned int crc = 0; - octetlen = bitlen / 8; /* Change in octets */ - resbit = (bitlen % 8); - - while (octetlen-- > 0) { - crc = (crc << 8) ^ (crc12Table[(*inptr++) ^ (crc >> 24)] << 16); - } - - if (resbit > 0) - crc = (crc << resbit) ^ (crc12Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 16); - - return crc; -} - -unsigned int -crc8 (unsigned char * inptr, int bitlen) -{ - int octetlen, resbit; - unsigned int crc = 0; - octetlen = bitlen / 8; /* Change in octets */ - resbit = (bitlen % 8); - - while (octetlen-- > 0) { - crc = crc8Table[(*inptr++) ^ (crc >> 24)] << 24; - } - - if (resbit > 0) - crc = (crc << resbit) ^ (crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24); - - return crc; -} - -/*******************************************************************/ -/** - Test code -********************************************************************/ - -/* #ifdef MAIN - #include - main() - { - unsigned char test[] = "Thebigredfox"; - crcTableInit(); - printf("%x\n", crcbit(test, sizeof(test) - 1, poly24)); - printf("%x\n", crc24(test, (sizeof(test) - 1)*8)); - printf("%x\n", crcbit(test, sizeof(test) - 1, poly8)); - printf("%x\n", crc8(test, (sizeof(test) - 1)*8)); - } - #endif */ diff --git a/openair2/UTIL/MATH/random_proto_extern.h b/openair2/UTIL/MATH/random_proto_extern.h deleted file mode 100644 index 45db565217..0000000000 --- a/openair2/UTIL/MATH/random_proto_extern.h +++ /dev/null @@ -1,30 +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 - */ - -/* - - random_proto_extern.h - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - ***************************************************************************/ -extern int uniform (void); diff --git a/openair2/UTIL/MATH/taus.c b/openair2/UTIL/MATH/taus.c deleted file mode 100644 index 6b5e03588d..0000000000 --- a/openair2/UTIL/MATH/taus.c +++ /dev/null @@ -1,116 +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 taus.c -* \brief random number generator per OAI component -* \author Navid Nikaein -* \date 2011 - 2014 -* \version 0.1 -* \email navid.nikaein@eurecom.fr -* \warning -* @ingroup util -*/ - -#include -#include -#include -#include -#include -#include "oml.h" - -unsigned int s0[MAX_NUM_COMPS], s1[MAX_NUM_COMPS], s2[MAX_NUM_COMPS], b[MAX_NUM_COMPS], r[MAX_NUM_COMPS]; - - - - -inline unsigned int taus(unsigned int comp) { - b[comp] = (((s0[comp] << 13) ^ s0[comp]) >> 19); - s0[comp] = (((s0[comp] & 0xFFFFFFFE) << 12)^ b[comp]); - b[comp] = (((s1[comp] << 2) ^ s1[comp]) >> 25); - s1[comp] = (((s1[comp] & 0xFFFFFFF8) << 4)^ b[comp]); - b[comp] = (((s2[comp] << 3) ^ s2[comp]) >> 11); - s2[comp] = (((s2[comp] & 0xFFFFFFF0) << 17)^ b[comp]); - r[comp] = s0[comp] ^ s1[comp] ^ s2[comp]; - return r[comp]; -} - -/*void set_taus_seed(unsigned int seed_type) { - unsigned int i; // i index of component - - for (i=MIN_NUM_COMPS; i < MAX_NUM_COMPS ; i ++) { - switch (seed_type) { - case 0: // use rand func - if (i == 0) srand(time(NULL)); - - s0[i] = ((unsigned int)rand()); - s1[i] = ((unsigned int)rand()); - s2[i] = ((unsigned int)rand()); - printf("Initial seeds use rand: s0[%u] = 0x%x, s1[%u] = 0x%x, s2[%u] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]); - break; - - case 1: // use rand with seed - if (i == 0) srand(0x1e23d851); - - s0[i] = ((unsigned int)rand()); - s1[i] = ((unsigned int)rand()); - s2[i] = ((unsigned int)rand()); - printf("Initial seeds use rand with seed : s0[%u] = 0x%x, s1[%u] = 0x%x, s2[%u] = 0x%x\n", i, s0[i], i, s1[i], i, s2[i]); - break; - - default: - break; - } - } -}*/ - -int get_rand (unsigned int comp) { - if ((comp > MIN_NUM_COMPS) && (comp < MAX_NUM_COMPS)) - return r[comp]; - else { - //LOG_E(RNG,"unknown component %d\n",comp); - return -1; - } -} - -unsigned int dtaus(unsigned int comp, unsigned int a, unsigned b) { - return (int) (((double)taus(comp)/(double)0xffffffff)* (double)(b-a) + (double)a); -} -/* -#ifdef STANDALONE -main() { - - unsigned int i,randomg, randphy; - - set_taus_seed(0); - printf("dtaus %d \n",dtaus(PHY, 1000, 1000000)); - - do {//for (i=0;i<10;i++){ - randphy = taus(PHY); - randomg = taus(OTG); - i++; - // printf("rand for OMG (%d,0x%x) PHY (%d,0x%x)\n",OMG, randomg, PHY, randphy); - } while (randphy != randomg); - printf("after %d run: get rand for (OMG 0x%x, PHY 0x%x)\n",i, get_rand(OTG), get_rand(PHY)); - -} -#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/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index 9724e0cc38..be5ab82740 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -40,7 +40,6 @@ #include "x2ap_eNB_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -260,8 +259,6 @@ int x2ap_eNB_generate_x2_setup_request( return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); return ret; @@ -486,8 +483,6 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN x2ap_eNB_data_p->state = X2AP_ENB_STATE_READY; - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/successfulOutcome assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); return ret; @@ -542,11 +537,6 @@ int x2ap_eNB_generate_x2_setup_failure(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, - MSC_X2AP_TARGET_ENB, NULL, 0, - "0 X2Setup/unsuccessfulOutcome assoc_id %u cause %u value %u", - assoc_id, cause_type, cause_value); - x2ap_eNB_itti_send_sctp_data_req(instance, assoc_id, buffer, len, 0); return ret; @@ -732,8 +722,6 @@ int x2ap_eNB_generate_x2_handover_request (x2ap_eNB_instance_t *instance_p, x2ap return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Handover/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 1); return ret; @@ -846,8 +834,6 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p, return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Handover/successfulOutcome assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 1); return ret; @@ -908,8 +894,6 @@ int x2ap_eNB_generate_x2_ue_context_release (x2ap_eNB_instance_t *instance_p, x2 return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2UEContextRelease/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 1); return ret; @@ -992,8 +976,6 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_ return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2HandoverCancel/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 1); return ret; @@ -1090,8 +1072,6 @@ int x2ap_eNB_generate_senb_addition_request (x2ap_eNB_instance_t *instance_p, x2 return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2SeNBAdditionRequest/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 1); return ret; @@ -1367,8 +1347,6 @@ MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); return ret; @@ -1578,8 +1556,6 @@ int x2ap_eNB_generate_ENDC_x2_setup_response( return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); return ret; @@ -1737,8 +1713,6 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( # if 0 // TODO: Sanitizer complains we are trying to access this after free. free(ie->value.choice.MeNBtoSgNBContainer.buf); #endif - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); return ret; @@ -1844,8 +1818,6 @@ int x2ap_gNB_generate_ENDC_x2_SgNB_addition_request_ACK( x2ap_eNB_instance_t *in return -1; } - MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); - x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_eNB_data_p->assoc_id, buffer, len, 0); return ret; diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index f71229f066..f70cd632aa 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -41,7 +41,6 @@ #include "x2ap_eNB_management_procedures.h" #include "x2ap_eNB_generate_messages.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" #include "X2AP_FreqBandNrItem.h" diff --git a/openair3/GTPV1-U/Makefile.am b/openair3/GTPV1-U/Makefile.am deleted file mode 100644 index 30ea61d6c1..0000000000 --- a/openair3/GTPV1-U/Makefile.am +++ /dev/null @@ -1,58 +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 -# */ - -AM_CFLAGS = @ADD_CFLAGS@ \ - -I$(top_srcdir)/COMMON \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/api/network \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/include \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/ies \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/emm/msg \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/msg \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/util \ - -I$(top_srcdir)/INTERTASK_INTERFACE \ - -I$(top_srcdir)/GTPV1-U/nw-gtpv1u/include \ - -I$(top_srcdir)/GTPV1-U/nw-gtpv1u/shared \ - -I$(top_srcdir)/UTILS \ - -I$(top_srcdir)/UTILS/HASHTABLE \ - -I$(top_srcdir)/UTILS/TIMER - -noinst_LTLIBRARIES = libgtpv1u.la - -libgtpv1u_la_LDFLAGS = -all-static - -libgtpv1u_la_SOURCES = \ - gtpv1u_task.c gtpv1u.h \ - gtpv1u_teid_pool.c \ - nw-gtpv1u/shared/NwTypes.h \ - nw-gtpv1u/shared/NwUtils.h \ - nw-gtpv1u/shared/NwGtpv1uError.h \ - nw-gtpv1u/shared/NwLog.h \ - nw-gtpv1u/shared/NwGtpv1uIe.h \ - nw-gtpv1u/shared/NwGtpv1uMsg.h \ - nw-gtpv1u/shared/NwGtpv1u.h \ - nw-gtpv1u/include/NwGtpv1uPrivate.h \ - nw-gtpv1u/include/NwGtpv1uLog.h \ - nw-gtpv1u/include/NwGtpv1uTrxn.h \ - nw-gtpv1u/include/NwGtpv1uTunnelEndPoint.h \ - nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c \ - nw-gtpv1u/src/NwGtpv1uTrxn.c \ - nw-gtpv1u/src/NwGtpv1uMsg.c \ - nw-gtpv1u/src/NwGtpv1u.c diff --git a/openair3/GTPV1-U/Makefile.eNB b/openair3/GTPV1-U/Makefile.eNB deleted file mode 100644 index b469dc756d..0000000000 --- a/openair3/GTPV1-U/Makefile.eNB +++ /dev/null @@ -1,67 +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 -# */ - -OUTDIR = . - -libgtpv1u_OBJECTS = \ - nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.o \ - nw-gtpv1u/src/NwGtpv1uTrxn.o \ - nw-gtpv1u/src/NwGtpv1uMsg.o \ - nw-gtpv1u/src/NwGtpv1u.o \ - gtpv1u_eNB.o \ - gtpv1u_teid_pool.o - -# pull in dependency info for *existing* .o files --include $(OUTDIR)/*.d - -CFLAGS = \ - -Wall \ - $(GTPV1U_CFLAGS) \ - -DENB_MODE \ - -Werror=uninitialized \ - -Werror=implicit-function-declaration - -$(OUTDIR)/%.o : %.c - @echo "Compiling $<" - @if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi; - @$(CC) -c $(CFLAGS) -o $@ $< - @$(CC) -MM $(CFLAGS) $< > $(basename $@).d - @mv -f $(basename $@).d $(basename $@).d.tmp - @sed -e 's|.*:|$@:|' < $(basename $@).d.tmp > $(basename $@).d - @sed -e 's/.*://' -e 's/\\$$//' < $(basename $@).d.tmp | fmt -1 | \ - sed -e 's/^ *//' -e 's/$$/:/' >> $(basename $@).d - @rm -f $(basename $@).d.tmp - -objsdir: - @if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi; - -$(OUTDIR)/libgtpv1u.a: $(addprefix $(OUTDIR)/,$(libgtpv1u_OBJECTS)) - @echo Creating GTPV1U archive - @$(AR) rcs $@ $(addprefix $(OUTDIR)/,$(libgtpv1u_OBJECTS)) - -clean: - @$(RM_F_V) $(OUTDIR)/nw-gtpv1u/src/*.o - @$(RM_F_V) $(OUTDIR)/nw-gtpv1u/src/*.d - @$(RM_F_V) $(OUTDIR)/*.o - @$(RM_F_V) $(OUTDIR)/*.d - @$(RM_F_V) $(OUTDIR)/libgtpv1u.a - -cleanall: clean diff --git a/openair3/GTPV1-U/gtpv1u.h b/openair3/GTPV1-U/gtpv1u.h deleted file mode 100644 index 9466f024bc..0000000000 --- a/openair3/GTPV1-U/gtpv1u.h +++ /dev/null @@ -1,55 +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 gtpv1u.h -* \brief -* \author Sebastien ROUX, Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ - -#ifndef GTPV1_U_H_ -#define GTPV1_U_H_ - -#define GTPU_STACK_ENB 0 -#define GTPU_STACK_SGW 1 - -/* When gtpv1u is compiled for eNB use MACRO from UTILS/log.h, - * otherwise use standard fprintf as logger. - */ -#if defined(ENB_MODE) -# define GTPU_DEBUG(x, args...) LOG_D(GTPU, x, ##args) -# define GTPU_INFO(x, args...) LOG_I(GTPU, x, ##args) -# define GTPU_WARNING(x, args...) LOG_W(GTPU, x, ##args) -# define GTPU_ERROR(x, args...) LOG_E(GTPU, x, ##args) -#else -# define GTPU_DEBUG(x, args...) fprintf(stdout, "[GTPU][D]"x, ##args) -# define GTPU_INFO(x, args...) fprintf(stdout, "[GTPU][I]"x, ##args) -# define GTPU_WARNING(x, args...) fprintf(stdout, "[GTPU][W]"x, ##args) -# define GTPU_ERROR(x, args...) fprintf(stderr, "[GTPU][E]"x, ##args) -#endif - -//#warning "TO BE REFINED" -# define GTPU_HEADER_OVERHEAD_MAX 64 - -uint32_t gtpv1u_new_teid(void); - -#endif /* GTPV1_U_H_ */ diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c deleted file mode 100644 index 6f5ef004b5..0000000000 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ /dev/null @@ -1,1600 +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 gtpv1u_eNB.c - * \brief - * \author Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein - * \version 1.0 - * \company Eurecom - * \email: lionel.gauthier@eurecom.fr - */ -#include -#include - -#include "mme_config.h" - -#include "assertions.h" -#include "intertask_interface.h" -#include "msc.h" - -#include "gtpv1u.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uMsg.h" -#include "NwGtpv1uPrivate.h" -#include "NwLog.h" -#include "gtpv1u_eNB_defs.h" -#include "gtpv1_u_messages_types.h" -#include "udp_eNB_task.h" -#include "common/utils/LOG/log.h" -#include "COMMON/platform_types.h" -#include "COMMON/platform_constants.h" -#include "common/utils/LOG/vcd_signal_dumper.h" -#include "common/ran_context.h" -#include "gtpv1u_eNB_defs.h" -#include "gtpv1u_eNB_task.h" -#include "rrc_eNB_GTPV1U.h" -#include - -#undef GTP_DUMP_SOCKET - -extern unsigned char NB_eNB_INST; -extern RAN_CONTEXT_t RC; - -extern struct rrc_eNB_ue_context_s * -rrc_eNB_get_ue_context( - eNB_RRC_INST *rrc_instance_pP, - rnti_t rntiP); - -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 -#include -static int gtpv1u_dump_socket_g; - -//----------------------------------------------------------------------------- -int gtpv1u_eNB_create_dump_socket(void) { - struct ifreq ifr; - int hdrincl=1; - - if ((gtpv1u_dump_socket_g = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0 ) { - LOG_E(GTPU, "Could not create dump socket %d:%s\n", errno, strerror(errno)); - return -1; - } - - if (setsockopt(gtpv1u_dump_socket_g, - IPPROTO_IP, - IP_HDRINCL, - &hdrincl, - sizeof(hdrincl))==-1) { - LOG_E(GTPU, "%s:%d set IP_HDRINCL %d:%s\n", - __FILE__, __LINE__, errno, strerror(errno)); - } - - memset(&ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "lo"); - - if (setsockopt(gtpv1u_dump_socket_g, SOL_SOCKET, SO_BINDTODEVICE, (void *)&ifr, sizeof(ifr)) < 0) { - LOG_E(GTPU, "%s:%d setsockopt SO_BINDTODEVICE %d:%s\n", - __FILE__, __LINE__, errno, strerror(errno)); - close(gtpv1u_dump_socket_g); - return -1; - } -} - -//----------------------------------------------------------------------------- -static void gtpv1u_eNB_write_dump_socket(uint8_t *buffer_pP, uint32_t buffer_lengthP) { - struct sockaddr_in sin; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_LOOPBACK; - - if (sendto(gtpv1u_dump_socket_g, buffer_pP, (size_t)buffer_lengthP, 0, (struct sockaddr *)&sin, sizeof(struct sockaddr)) < 0) { - LOG_E(GTPU, "%s:%s:%d sendto %d:%s\n", - __FILE__, __FUNCTION__, __LINE__, errno, strerror(errno)); - } -} - -#endif - -//----------------------------------------------------------------------------- -static int gtpv1u_eNB_get_msgsource(struct rrc_eNB_ue_context_s *ue_context_p, teid_t teid) { - int erab_index = 0; - - /* source enb */ - if(ue_context_p->ue_context.handover_info != NULL && ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { - return GTPV1U_MSG_FROM_SPGW; - } - - /* target enb */ - for (erab_index = 0; erab_index < ue_context_p->ue_context.nb_x2u_e_rabs; erab_index++) { - if(ue_context_p->ue_context.enb_gtp_x2u_teid[erab_index] == teid) { - return GTPV1U_MSG_FROM_SOURCE_ENB; - } - } - - return GTPV1U_MSG_FROM_SPGW; -} - -//----------------------------------------------------------------------------- -static int gtpv1u_eNB_send_init_udp(const Gtpv1uS1Req *req) { - // Create and alloc new message - MessageDef *message_p; - struct in_addr addr= {0}; - message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, UDP_INIT); - - if (message_p == NULL) { - return -1; - } - - UDP_INIT(message_p).port = req->enb_port_for_S1u_S12_S4_up; - addr.s_addr = req->enb_ip_address_for_S1u_S12_S4_up; - UDP_INIT(message_p).address = inet_ntoa(addr); - LOG_I(GTPU, "Tx UDP_INIT IP addr %s (%x)\n", UDP_INIT(message_p).address,UDP_INIT(message_p).port); - MSC_LOG_EVENT( - MSC_GTPU_ENB, - "0 UDP bind %s:%u", - UDP_INIT(message_p).address, - UDP_INIT(message_p).port); - return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p); -} - -static int gtpv1u_s1_req( - const instance_t instanceP, - const Gtpv1uS1Req *const req) { - memcpy(&RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, - &req->enb_ip_address_for_S1u_S12_S4_up, - sizeof (req->enb_ip_address_for_S1u_S12_S4_up)); - gtpv1u_eNB_send_init_udp(req); - return 0; -} - -//----------------------------------------------------------------------------- -NwGtpv1uRcT gtpv1u_eNB_log_request(NwGtpv1uLogMgrHandleT hLogMgr, - uint32_t logLevel, - NwCharT *file, - uint32_t line, - NwCharT *logStr) { - LOG_D(GTPU, "%s\n", logStr); - return NW_GTPV1U_OK; -} - -//----------------------------------------------------------------------------- -NwGtpv1uRcT gtpv1u_eNB_send_udp_msg( - NwGtpv1uUdpHandleT udpHandle, - uint8_t *buffer, - uint32_t buffer_len, - uint32_t buffer_offset, - uint32_t peerIpAddr, - uint16_t peerPort) { - // Create and alloc new message - MessageDef *message_p = NULL; - udp_data_req_t *udp_data_req_p = NULL; - message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, UDP_DATA_REQ); - - if (message_p) { -#if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_D(GTPU, "Sending UDP_DATA_REQ length %u offset %u", buffer_len, buffer_offset); -#endif - udp_data_req_p = &message_p->ittiMsg.udp_data_req; - udp_data_req_p->peer_address = peerIpAddr; - udp_data_req_p->peer_port = peerPort; - udp_data_req_p->buffer = buffer; - udp_data_req_p->buffer_length = buffer_len; - udp_data_req_p->buffer_offset = buffer_offset; - return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p); - } else { - return NW_GTPV1U_FAILURE; - } -} - - -//----------------------------------------------------------------------------- -/* Callback called when a gtpv1u message arrived on UDP interface */ -NwGtpv1uRcT gtpv1u_eNB_process_stack_req( - NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi) { - boolean_t result = FALSE; - teid_t teid = 0; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - protocol_ctxt_t ctxt; - NwGtpv1uRcT rc; - - switch(pUlpApi->apiType) { - /* Here there are two type of messages handled: - * - T-PDU - * - END-MARKER - */ - case NW_GTPV1U_ULP_API_RECV_TPDU: { - uint8_t buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE]; - uint32_t buffer_len; - struct rrc_eNB_ue_context_s *ue_context_p; - uint16_t msgType = NW_GTP_GPDU; - NwGtpv1uMsgT *pMsg = NULL; - /* Nw-gptv1u stack has processed a PDU. we can schedule it to PDCP - * for transmission. - */ - teid = pUlpApi->apiInfo.recvMsgInfo.teid; - pMsg = (NwGtpv1uMsgT *) pUlpApi->apiInfo.recvMsgInfo.hMsg; - msgType = pMsg->msgType; - - if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, - buffer, &buffer_len)) { - LOG_E(GTPU, "Error while retrieving T-PDU"); - } - - itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf); -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - gtpv1u_eNB_write_dump_socket(buffer,buffer_len); -#endif - rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, - pUlpApi->apiInfo.recvMsgInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_OK) { -#if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_D(GTPU, "Received T-PDU from gtpv1u stack teid %u size %d -> enb module id %u ue module id %u rab id %u\n", - teid, - buffer_len, - gtpv1u_teid_data_p->enb_id, - gtpv1u_teid_data_p->ue_id, - gtpv1u_teid_data_p->eps_bearer_id); -#endif - //#warning "LG eps bearer mapping to DRB id to do (offset -4)" - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->enb_id, ENB_FLAG_YES, gtpv1u_teid_data_p->ue_id, 0, 0,gtpv1u_teid_data_p->enb_id); - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_PDCP_ENB, - NULL,0, - MSC_AS_TIME_FMT" DATA-REQ rb %u size %u", - 0,0, - (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - buffer_len); - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); - - if((ue_context_p != NULL) && - (ue_context_p->ue_context.handover_info != NULL) && - (ue_context_p->ue_context.handover_info->state < HO_FORWARDING_COMPLETE)) { - if(msgType == NW_GTP_END_MARKER) { - /* in the source enb, UE in RRC_HO_EXECUTION mode */ - if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION && ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { - /* set handover state */ - //ue_context_p->ue_context.handover_info->state = HO_END_MARKER; - MessageDef *msg; - // Configure end marker - msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_REQ); - GTPV1U_ENB_END_MARKER_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + buffer_len); - memcpy(>PV1U_ENB_END_MARKER_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], buffer, buffer_len); - GTPV1U_ENB_END_MARKER_REQ(msg).length = buffer_len; - GTPV1U_ENB_END_MARKER_REQ(msg).rnti = ctxt.rnti; - GTPV1U_ENB_END_MARKER_REQ(msg).rab_id = gtpv1u_teid_data_p->eps_bearer_id; - GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; - LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt.frame,ctxt.subframe); - itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt.module_id), msg); - return NW_GTPV1U_OK; - } - } - - if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION || ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { - int msgsrc = gtpv1u_eNB_get_msgsource(ue_context_p, teid); - LOG_D(GTPU,"UE INFO.ueStatus %d, handover state %d, forwarding state %d, from %s. message type %s\n", - ue_context_p->ue_context.StatusRrc, - ue_context_p->ue_context.handover_info->state, - ue_context_p->ue_context.handover_info->forwarding_state, - msgsrc == GTPV1U_MSG_FROM_SOURCE_ENB?"Source eNB":"EPC", - msgsrc != GTPV1U_MSG_FROM_SOURCE_ENB? "UDP DATA" : - msgType == NW_GTP_END_MARKER?"END MARKER":"DATA FORWARDING"); - - /* target enb */ - if(msgType == NW_GTP_END_MARKER) { - LOG_I(GTPU, "target end receive END MARKER\n"); - ue_context_p->ue_context.handover_info->state = HO_END_MARKER; - gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; - memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); - delete_tunnel_req.rnti = ctxt.rnti; - gtpv1u_delete_x2u_tunnel(ctxt.module_id, &delete_tunnel_req, GTPV1U_TARGET_ENB); - return NW_GTPV1U_OK; - } - - /* form source eNB message */ - if(msgsrc == GTPV1U_MSG_FROM_SOURCE_ENB) { - LOG_I(GTPU, "Received a message data forwarding length %d\n", buffer_len); -#if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_T(GTPU, "forwarding data info:\n", buffer_len); - - for(int i=1; i<=buffer_len; i++) { - LOG_T(GTPU, "%02x ", buffer[i-1]); - - if(i%20 == 0)LOG_T(GTPU, "\n"); - } - - LOG_T(GTPU, "\n"); -#endif - result = gtpv_data_req( - &ctxt, - (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - 0, // mui - SDU_CONFIRM_NO, // confirm - buffer_len, - buffer, - PDCP_TRANSMISSION_MODE_DATA, - TASK_DATA_FORWARDING - ); - - if ( result == FALSE ) { - LOG_W(GTPU, "DATA FORWARDING message save failed\n"); - return NW_GTPV1U_FAILURE; - } - - ue_context_p->ue_context.handover_info->forwarding_state = FORWARDING_NO_EMPTY; - return NW_GTPV1U_OK; - } - /* from epc message */ - else { - /* in the source enb, UE in RRC_HO_EXECUTION mode */ - if (ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { - MessageDef *msg; - // Configure target - msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_REQ); - GTPV1U_ENB_DATA_FORWARDING_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + buffer_len); - memcpy(>PV1U_ENB_DATA_FORWARDING_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], buffer, buffer_len); - GTPV1U_ENB_DATA_FORWARDING_REQ(msg).length = buffer_len; - GTPV1U_ENB_DATA_FORWARDING_REQ(msg).rnti = ctxt.rnti; - GTPV1U_ENB_DATA_FORWARDING_REQ(msg).rab_id = gtpv1u_teid_data_p->eps_bearer_id; - GTPV1U_ENB_DATA_FORWARDING_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; -#if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_T(GTPU, "Send data forwarding sdu_buffer to target enb. len %d info\n", buffer); - - for(int i=1; i<=buffer_len; i++) { - LOG_T(GTPU, "%02x ", buffer[i-1]); - - if(i%20 == 0)LOG_T(GTPU, "\n"); - } - - LOG_T(GTPU, "\n"); -#endif - LOG_I(GTPU, "Send data forwarding to GTPV1-U at frame %d and subframe %d \n", ctxt.frame,ctxt.subframe); - itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt.module_id), msg); - return NW_GTPV1U_OK; - } - - /* target eNB. x2ho forwarding is processing. spgw message save to TASK_END_MARKER */ - if(ue_context_p->ue_context.handover_info->state != HO_COMPLETE && - ue_context_p->ue_context.handover_info->state != HO_END_MARKER ) { - LOG_I(GTPU, "x2ho forwarding is processing. Received a spgw message. length %d\n", buffer_len); -#if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_T(GTPU, "spgw data info:\n", buffer_len); - - for(int i=1; i<=buffer_len; i++) { - LOG_T(GTPU, "%02x ", buffer[i-1]); - - if(i%20 == 0)LOG_T(GTPU, "\n"); - } - - LOG_T(GTPU, "\n"); -#endif - result = gtpv_data_req( - &ctxt, - (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - 0, // mui - SDU_CONFIRM_NO, // confirm - buffer_len, - buffer, - PDCP_TRANSMISSION_MODE_DATA, - TASK_END_MARKER - ); - - if ( result == FALSE ) { - LOG_W(GTPU, "DATA FORWARDING message save failed\n"); - return NW_GTPV1U_FAILURE; - } - - ue_context_p->ue_context.handover_info->endmark_state = ENDMARK_NO_EMPTY; - return NW_GTPV1U_OK; - } - } - } - } - - result = pdcp_data_req( - &ctxt, - SRB_FLAG_NO, - (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - 0, // mui - SDU_CONFIRM_NO, // confirm - buffer_len, - buffer, - PDCP_TRANSMISSION_MODE_DATA,NULL, NULL - ); - - if ( result == FALSE ) { - LOG_W(GTPU, "PDCP data request failed\n"); - return NW_GTPV1U_FAILURE; - } - } else { - LOG_W(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len); - } - } - break; - - default: { - LOG_E(GTPU, "Received undefined UlpApi (%02x) from gtpv1u stack!\n", - pUlpApi->apiType); - } - } // end of switch - - return NW_GTPV1U_OK; -} - - -//----------------------------------------------------------------------------- -int data_recv_callback(uint16_t portP, - uint32_t address, - uint8_t *buffer, - uint32_t length, - void *arg_p) { - gtpv1u_data_t *gtpv1u_data_p; - - if (arg_p == NULL) { - return -1; - } - - gtpv1u_data_p = (gtpv1u_data_t *)arg_p; - return nwGtpv1uProcessUdpReq(gtpv1u_data_p->gtpv1u_stack, - buffer, - length, - portP, - address); -} - -//int -//gtpv1u_create_tunnel_endpoint( -// gtpv1u_data_t *gtpv1u_data_pP, -// uint8_t ue_idP, -// uint8_t rab_idP, -// char *sgw_ip_addr_pP, -// uint16_t portP) -//{ -// uint32_t teid; -// uint8_t max_attempt = 100; -// NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; -// NwGtpv1uUlpApiT ulp_req; -// struct gtpv1u_ue_data_s *new_ue_p = NULL; -// struct gtpv1u_bearer_s *bearer_p = NULL; -// hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;; -// -// if (rab_idP > GTPV1U_MAX_BEARERS_PER_UE) { -// LOG_E(GTPU, "Could not use rab_id %d > max %d\n", -// rab_idP, GTPV1U_MAX_BEARERS_PER_UE); -// return -1; -// } -// -// -// if ((hash_rc = hashtable_get(gtpv1u_data_pP->ue_mapping, (uint64_t)ue_idP, (void**)&new_ue_p)) == HASH_TABLE_OK) { -// /* A context for this UE already exist in the tree, use it */ -// /* We check that the tunnel is not already configured */ -// if (new_ue_p->bearers[rab_idP].state != BEARER_DOWN) { -// LOG_E(GTPU, "Cannot create new end-point over already existing tunnel\n"); -// return -1; -// } -// } else { -// /* Context doesn't exist, create it */ -// if (rab_idP != 0) { -// /* UE should first establish Default bearer before trying to setup -// * additional bearers. -// */ -// LOG_E(GTPU, "UE context is not known and rab_id != 0\n"); -// return -1; -// } -// new_ue_p = calloc(1, sizeof(struct gtpv1u_ue_data_s)); -// new_ue_p->ue_id = ue_idP; -// -// hash_rc = hashtable_insert(gtpv1u_data_pP->ue_mapping, (uint64_t)ue_idP, new_ue_p); -// -// if ((hash_rc != HASH_TABLE_OK) && (hash_rc != HASH_TABLE_INSERT_OVERWRITTEN_DATA)) { -// LOG_E(GTPU, "Failed to insert new UE context\n"); -// free(new_ue_p); -// return -1; -// } -// } -// -// bearer_p = &new_ue_p->bearers[rab_idP]; -// -// /* Configure the bearer */ -// bearer_p->state = BEARER_IN_CONFIG; -// bearer_p->sgw_ip_addr = inet_addr(sgw_ip_addr_pP); -// bearer_p->port = portP; -// -// /* Create the new stack api request */ -// memset(&ulp_req, 0, sizeof(NwGtpv1uUlpApiT)); -// ulp_req.apiType = NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT; -// -// /* Try to create new tunnel-endpoint. -// * If teid generated is already present in the stack, just peek another random -// * teid. This could be ok for small number of tunnel but more errors could be -// * thrown if we reached high number of tunnels. -// * TODO: find a solution for teid -// */ -// do { -// /* Request for a new random TEID */ -// teid = gtpv1u_new_teid(); -// ulp_req.apiInfo.createTunnelEndPointInfo.teid = teid; -// -// rc = nwGtpv1uProcessUlpReq(gtpv1u_data_pP->gtpv1u_stack, &ulp_req); -// -// if (rc == NW_GTPV1U_OK) { -//// LOG_D(GTPU, "Successfully created new tunnel endpoint for teid 0x%x\n", -//// teid); -// bearer_p->teid_eNB = teid; -//// gtpv1u_initial_req(gtpv1u_data_pP, teid, GTPV1U_UDP_PORT, -//// inet_addr("192.168.56.101")); -// LOG_I(GTPU, "Created eNB tunnel endpoint %u for ue id %u, rab id %u\n", teid, ue_idP, rab_idP); -// return 0; -// } else { -// LOG_W(GTPU, "Teid %u already in use... %s\n", -// teid, (max_attempt > 1) ? "Trying another one" : "Last chance"); -// } -// } while(max_attempt-- && rc != NW_GTPV1U_OK); -// -// bearer_p->state = BEARER_DOWN; -// LOG_I(GTPU, "Failed to created eNB tunnel endpoint %u for ue id %u, rab id %u, bearer down\n", teid, ue_idP, rab_idP); -// -// return -1; -//} - - -//----------------------------------------------------------------------------- -static NwGtpv1uRcT gtpv1u_start_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - uint32_t timeoutSec, - uint32_t timeoutUsec, - uint32_t tmrType, - void *timeoutArg, - NwGtpv1uTimerHandleT *hTmr) { - NwGtpv1uRcT rc = NW_GTPV1U_OK; - long timer_id; - - if (tmrType == NW_GTPV1U_TMR_TYPE_ONE_SHOT) { - timer_setup(timeoutSec, - timeoutUsec, - TASK_GTPV1_U, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - timeoutArg, - &timer_id); - } else { - timer_setup(timeoutSec, - timeoutUsec, - TASK_GTPV1_U, - INSTANCE_DEFAULT, - TIMER_PERIODIC, - timeoutArg, - &timer_id); - } - - return rc; -} - - -//----------------------------------------------------------------------------- -static NwGtpv1uRcT -gtpv1u_stop_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NwGtpv1uTimerHandleT hTmr) { - NwGtpv1uRcT rc = NW_GTPV1U_OK; - return rc; -} - - -//----------------------------------------------------------------------------- -int -gtpv1u_initial_req( - gtpv1u_data_t *gtpv1u_data_pP, - teid_t teidP, - tcp_udp_port_t portP, - uint32_t address) { - NwGtpv1uUlpApiT ulp_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - memset(&ulp_req, 0, sizeof(NwGtpv1uUlpApiT)); - ulp_req.apiType = NW_GTPV1U_ULP_API_INITIAL_REQ; - ulp_req.apiInfo.initialReqInfo.teid = teidP; - ulp_req.apiInfo.initialReqInfo.peerPort = portP; - ulp_req.apiInfo.initialReqInfo.peerIp = address; - rc = nwGtpv1uProcessUlpReq(gtpv1u_data_pP->gtpv1u_stack, &ulp_req); - - if (rc == NW_GTPV1U_OK) { - LOG_D(GTPU, "Successfully sent initial req for teid %u\n", teidP); - } else { - LOG_W(GTPU, "Could not send initial req for teid %u\n", teidP); - } - - return (rc == NW_GTPV1U_OK) ? 0 : -1; -} - -//----------------------------------------------------------------------------- -int -gtpv1u_new_data_req( - uint8_t enb_module_idP, - rnti_t ue_rntiP, - uint8_t rab_idP, - uint8_t *buffer_pP, - uint32_t buf_lenP, - uint32_t buf_offsetP -) { - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - struct gtpv1u_ue_data_s ue; - struct gtpv1u_ue_data_s *ue_inst_p = NULL; - struct gtpv1u_bearer_s *bearer_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;; - gtpv1u_data_t *gtpv1u_data_p = NULL; - memset(&ue, 0, sizeof(struct gtpv1u_ue_data_s)); - ue.ue_id = ue_rntiP; - AssertFatal(enb_module_idP >=0, "Bad parameter enb module id %u\n", enb_module_idP); - AssertFatal((rab_idP - GTPV1U_BEARER_OFFSET)< GTPV1U_MAX_BEARERS_ID, "Bad parameter rab id %u\n", rab_idP); - AssertFatal((rab_idP - GTPV1U_BEARER_OFFSET) >= 0, "Bad parameter rab id %u\n", rab_idP); - gtpv1u_data_p = RC.gtpv1u_data_g; - /* Check that UE context is present in ue map. */ - hash_rc = hashtable_get(gtpv1u_data_p->ue_mapping, (uint64_t)ue_rntiP, (void **)&ue_inst_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS ) { - LOG_E(GTPU, "[UE %d] Trying to send data on non-existing UE context\n", ue_rntiP); - return -1; - } - - bearer_p = &ue_inst_p->bearers[rab_idP - GTPV1U_BEARER_OFFSET]; - - /* Ensure the bearer in ready. - * TODO: handle the cases where the bearer is in HANDOVER state. - * In such case packets should be placed in FIFO. - */ - if (bearer_p->state != BEARER_UP) { - LOG_W(GTPU, "Trying to send data over bearer with state(%u) != BEARER_UP\n", - bearer_p->state); - //#warning LG: HACK WHILE WAITING FOR NAS, normally return -1 - - if (bearer_p->state != BEARER_IN_CONFIG) - return -1; - } - - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - stack_req.apiInfo.sendtoInfo.teid = bearer_p->teid_sgw; - stack_req.apiInfo.sendtoInfo.ipAddr = bearer_p->sgw_ip_addr; - LOG_D(GTPU, "TX TO TEID %u addr 0x%x\n",bearer_p->teid_sgw, bearer_p->sgw_ip_addr); - rc = nwGtpv1uGpduMsgNew(gtpv1u_data_p->gtpv1u_stack, - bearer_p->teid_sgw, - NW_FALSE, - gtpv1u_data_p->seq_num++, - buffer_pP, - buf_lenP, - buf_offsetP, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); - return -1; - } - - rc = nwGtpv1uProcessUlpReq(gtpv1u_data_p->gtpv1u_stack, - &stack_req); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); - return -1; - } - - rc = nwGtpv1uMsgDelete(gtpv1u_data_p->gtpv1u_stack, - stack_req.apiInfo.sendtoInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - return -1; - } - - LOG_D(GTPU, "%s() return code OK\n", __FUNCTION__); - return 0; -} - -//----------------------------------------------------------------------------- -int -gtpv1u_create_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP -) { - /* Create a new nw-gtpv1-u stack req using API */ - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - /* Local tunnel end-point identifier */ - teid_t x2u_teid = 0; - gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - int i; - ebi_t eps_bearer_id = 0; - MSC_LOG_RX_MESSAGE( - MSC_GTPU_ENB, - MSC_RRC_ENB, - NULL,0, - MSC_AS_TIME_FMT" CREATE_X2U_TUNNEL_REQ RNTI %"PRIx16" inst %u ntuns %u ebid %u enb-x2u teid %u", - 0,0,create_tunnel_req_pP->rnti, instanceP, - create_tunnel_req_pP->num_tunnels, create_tunnel_req_pP->eps_bearer_id[0], - create_tunnel_req_pP->tenb_X2u_teid[0]); - create_tunnel_resp_pP->rnti = create_tunnel_req_pP->rnti; - create_tunnel_resp_pP->status = 0; - create_tunnel_resp_pP->num_tunnels = 0; - - for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) { - eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i]; - LOG_D(GTPU, "Rx GTPV1U_ENB_CREATE_X2U_TUNNEL_REQ ue rnti %x eps bearer id %u\n", - create_tunnel_req_pP->rnti, eps_bearer_id); - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - stack_req.apiType = NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT; - - do { - x2u_teid = gtpv1u_new_teid(); - LOG_D(GTPU, "gtpv1u_create_x2u_tunnel() 0x%x %u(dec)\n", x2u_teid, x2u_teid); - stack_req.apiInfo.createTunnelEndPointInfo.teid = x2u_teid; - stack_req.apiInfo.createTunnelEndPointInfo.hUlpSession = 0; - stack_req.apiInfo.createTunnelEndPointInfo.hStackSession = 0; - rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - LOG_D(GTPU, ".\n"); - } while (rc != NW_GTPV1U_OK); - - memcpy(&create_tunnel_resp_pP->enb_addr.buffer, - &RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, - sizeof (in_addr_t)); - LOG_D(GTPU, "gtpv1u_create_x2u_tunnel() end addr %d.%d.%d.%d\n", - create_tunnel_resp_pP->enb_addr.buffer[0], - create_tunnel_resp_pP->enb_addr.buffer[1], - create_tunnel_resp_pP->enb_addr.buffer[2], - create_tunnel_resp_pP->enb_addr.buffer[3]); - create_tunnel_resp_pP->enb_addr.length = sizeof (in_addr_t); - create_tunnel_resp_pP->eps_bearer_id[i] = eps_bearer_id; - create_tunnel_resp_pP->num_tunnels += 1; - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - create_tunnel_resp_pP->enb_X2u_teid[i] = x2u_teid; - hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, x2u_teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - gtpv1u_teid_data_p = calloc (1, sizeof(gtpv1u_teid_data_t)); - gtpv1u_teid_data_p->enb_id = 0; // TO DO - gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_teid_data_p->eps_bearer_id = eps_bearer_id; - hash_rc = hashtable_insert(RC.gtpv1u_data_g->teid_mapping, x2u_teid, gtpv1u_teid_data_p); - AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting teid mapping in GTPV1U hashtable"); - } else { - create_tunnel_resp_pP->enb_X2u_teid[i] = 0; - create_tunnel_resp_pP->status = 0xFF; - } - } - - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_RRC_ENB, - NULL,0, - "0 GTPV1U_ENB_CREATE_TUNNEL_RESP rnti %x teid %x", - create_tunnel_resp_pP->rnti, - x2u_teid); - LOG_D(GTPU, "Tx GTPV1U_ENB_CREATE_TUNNEL_RESP ue rnti %x status %d\n", - create_tunnel_req_pP->rnti, - create_tunnel_resp_pP->status); - return 0; -} - -//----------------------------------------------------------------------------- -int gtpv1u_delete_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP, - int enbflag) { - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - int erab_index = 0; - ebi_t eps_bearer_id = 0; - struct rrc_eNB_ue_context_s *ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instanceP], req_pP->rnti); - - if(ue_context_p != NULL) { - /* in the source enb */ - if(enbflag == GTPV1U_SOURCE_ENB) { - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, req_pP->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_OK) { - for (erab_index = 0; erab_index < ue_context_p->ue_context.nb_x2u_e_rabs; erab_index++) { - eps_bearer_id = ue_context_p->ue_context.enb_gtp_x2u_ebi[erab_index]; - LOG_I(GTPU, "gtpv1u_delete_x2u_tunnel user rnti %x teNB X2U teid %u eps bearer id %ld\n", - req_pP->rnti, - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_teNB, - ue_context_p->ue_context.enb_gtp_x2u_ebi[erab_index]); - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_teNB = 0; - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].tenb_ip_addr = 0; - //gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].tenb_ip6_addr = 0; - } - - ue_context_p->ue_context.nb_x2u_e_rabs = 0; - } - } - /* in the target enb */ - else { - for (erab_index = 0; erab_index < ue_context_p->ue_context.nb_x2u_e_rabs; erab_index++) { - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - hash_rc = hashtable_remove(RC.gtpv1u_data_g->teid_mapping, ue_context_p->ue_context.enb_gtp_x2u_teid[erab_index]); - LOG_I(GTPU, "Removed user rnti %x , enb X2U teid %u\n", req_pP->rnti, ue_context_p->ue_context.enb_gtp_x2u_teid[erab_index]); - - if (hash_rc != HASH_TABLE_OK) { - LOG_D(GTPU, "Removed user rnti %x , enb X2U teid %u not found\n", req_pP->rnti, ue_context_p->ue_context.enb_gtp_x2u_teid[erab_index]); - } - } - - ue_context_p->ue_context.nb_x2u_e_rabs = 0; - } - } - - return 0; -} - -//----------------------------------------------------------------------------- -int -gtpv1u_create_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_enb_create_tunnel_resp_t *const create_tunnel_resp_pP -) { - /* Create a new nw-gtpv1-u stack req using API */ - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - /* Local tunnel end-point identifier */ - teid_t s1u_teid = 0; - gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - //MessageDef *message_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - int i; - ebi_t eps_bearer_id = 0; - // int ipv4_addr = 0; - int ip_offset = 0; - in_addr_t in_addr; - int addrs_length_in_bytes= 0; - int loop_counter = 0; - int ret = 0; - MSC_LOG_RX_MESSAGE( - MSC_GTPU_ENB, - MSC_RRC_ENB, - NULL,0, - MSC_AS_TIME_FMT" CREATE_TUNNEL_REQ RNTI %"PRIx16" inst %u ntuns %u ebid %u sgw-s1u teid %u", - 0,0,create_tunnel_req_pP->rnti, instanceP, - create_tunnel_req_pP->num_tunnels, create_tunnel_req_pP->eps_bearer_id[0], - create_tunnel_req_pP->sgw_S1u_teid[0]); - create_tunnel_resp_pP->rnti = create_tunnel_req_pP->rnti; - create_tunnel_resp_pP->status = 0; - create_tunnel_resp_pP->num_tunnels = 0; - - for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) { - ip_offset = 0; - loop_counter = 0; - eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i]; - LOG_D(GTPU, "Rx GTPV1U_ENB_CREATE_TUNNEL_REQ ue rnti %x eps bearer id %u\n", - create_tunnel_req_pP->rnti, eps_bearer_id); - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - stack_req.apiType = NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT; - - do { - s1u_teid = gtpv1u_new_teid(); - LOG_I(GTPU, "gtpv1u_data_g %p\n", RC.gtpv1u_data_g); - LOG_I(GTPU, "gtpv1u_create_s1u_tunnel() 0x%x %u(dec)\n", s1u_teid, s1u_teid); - stack_req.apiInfo.createTunnelEndPointInfo.teid = s1u_teid; - stack_req.apiInfo.createTunnelEndPointInfo.hUlpSession = 0; - stack_req.apiInfo.createTunnelEndPointInfo.hStackSession = 0; - rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - LOG_D(GTPU, ".\n"); - loop_counter++; - } while (rc != NW_GTPV1U_OK && loop_counter < 10); - - if ( rc != NW_GTPV1U_OK && loop_counter == 10 ) { - LOG_E(GTPU,"NwGtpv1uCreateTunnelEndPoint failed 10 times,start next loop\n"); - ret = -1; - continue; - } - - //----------------------- - // PDCP->GTPV1U mapping - //----------------------- - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, (void **)>pv1u_ue_data_p); - - if ((hash_rc == HASH_TABLE_KEY_NOT_EXISTS) || (hash_rc == HASH_TABLE_OK)) { - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - gtpv1u_ue_data_p = calloc (1, sizeof(gtpv1u_ue_data_t)); - hash_rc = hashtable_insert(RC.gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_p); - AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable"); - } - - gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_ue_data_p->instance_id = 0; // TO DO - memcpy(&create_tunnel_resp_pP->enb_addr.buffer, - &RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, - sizeof (in_addr_t)); - - LOG_I(GTPU,"Configured GTPu address : %x\n",RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); - create_tunnel_resp_pP->enb_addr.length = sizeof (in_addr_t); - addrs_length_in_bytes = create_tunnel_req_pP->sgw_addr[i].length / 8; - AssertFatal((addrs_length_in_bytes == 4) || - (addrs_length_in_bytes == 16) || - (addrs_length_in_bytes == 20), - "Bad transport layer address length %d (bits) %d (bytes)", - create_tunnel_req_pP->sgw_addr[i].length, addrs_length_in_bytes); - - if ((addrs_length_in_bytes == 4) || - (addrs_length_in_bytes == 20)) { - in_addr = *((in_addr_t *)create_tunnel_req_pP->sgw_addr[i].buffer); - ip_offset = 4; - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = in_addr; - } - - if ((addrs_length_in_bytes == 16) || - (addrs_length_in_bytes == 20)) { - memcpy(gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip6_addr.s6_addr, - &create_tunnel_req_pP->sgw_addr[i].buffer[ip_offset], - 16); - } - - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG; - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid; - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB_stack_session = stack_req.apiInfo.createTunnelEndPointInfo.hStackSession; - gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i]; - gtpv1u_ue_data_p->num_bearers++; - create_tunnel_resp_pP->enb_S1u_teid[i] = s1u_teid; - - LOG_I(GTPU,"Copied to create_tunnel_resp tunnel: index %d target gNB ip %d.%d.%d.%d length %d gtp teid %u\n", - i, - create_tunnel_resp_pP->enb_addr.buffer[0], - create_tunnel_resp_pP->enb_addr.buffer[1], - create_tunnel_resp_pP->enb_addr.buffer[2], - create_tunnel_resp_pP->enb_addr.buffer[3], - create_tunnel_resp_pP->enb_addr.length, - create_tunnel_resp_pP->enb_S1u_teid[i]); - } else { - create_tunnel_resp_pP->enb_S1u_teid[i] = 0; - create_tunnel_resp_pP->status = 0xFF; - } - - create_tunnel_resp_pP->eps_bearer_id[i] = eps_bearer_id; - create_tunnel_resp_pP->num_tunnels += 1; - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, s1u_teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - gtpv1u_teid_data_p = calloc (1, sizeof(gtpv1u_teid_data_t)); - gtpv1u_teid_data_p->enb_id = 0; // TO DO - gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_teid_data_p->eps_bearer_id = eps_bearer_id; - hash_rc = hashtable_insert(RC.gtpv1u_data_g->teid_mapping, s1u_teid, gtpv1u_teid_data_p); - AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting teid mapping in GTPV1U hashtable"); - } else { - create_tunnel_resp_pP->enb_S1u_teid[i] = 0; - create_tunnel_resp_pP->status = 0xFF; - } - } - - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_RRC_ENB, - NULL,0, - "0 GTPV1U_ENB_CREATE_TUNNEL_RESP rnti %x teid %x", - create_tunnel_resp_pP->rnti, - s1u_teid); - LOG_D(GTPU, "Tx GTPV1U_ENB_CREATE_TUNNEL_RESP ue rnti %x status %d\n", - create_tunnel_req_pP->rnti, - create_tunnel_resp_pP->status); - //return 0; - return ret; -} - -int gtpv1u_update_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti -) { - /* Local tunnel end-point identifier */ - teid_t s1u_teid = 0; - gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - gtpv1u_ue_data_t *gtpv1u_ue_data_new_p = NULL; - //MessageDef *message_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - int i,j; - uint8_t bearers_num = 0,bearers_total = 0; - //----------------------- - // PDCP->GTPV1U mapping - //----------------------- - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, prior_rnti, (void **)>pv1u_ue_data_p); - - if(hash_rc != HASH_TABLE_OK) { - LOG_E(GTPU,"Error get ue_mapping(rnti=%x) from GTPV1U hashtable error\n", prior_rnti); - return -1; - } - - gtpv1u_ue_data_new_p = calloc (1, sizeof(gtpv1u_ue_data_t)); - memcpy(gtpv1u_ue_data_new_p,gtpv1u_ue_data_p,sizeof(gtpv1u_ue_data_t)); - gtpv1u_ue_data_new_p->ue_id = create_tunnel_req_pP->rnti; - hash_rc = hashtable_insert(RC.gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_new_p); - - //AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable"); - if ( hash_rc != HASH_TABLE_OK ) { - LOG_E(GTPU,"Failed to insert ue_mapping(rnti=%x) in GTPV1U hashtable\n",create_tunnel_req_pP->rnti); - return -1; - } else { - LOG_I(GTPU, "inserting ue_mapping(rnti=%x) in GTPV1U hashtable\n", - create_tunnel_req_pP->rnti); - } - - hash_rc = hashtable_remove(RC.gtpv1u_data_g->ue_mapping, prior_rnti); - LOG_I(GTPU, "hashtable_remove ue_mapping(rnti=%x) in GTPV1U hashtable\n", - prior_rnti); - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - bearers_total =gtpv1u_ue_data_new_p->num_bearers; - - for(j = 0; jbearers[j].state != BEARER_IN_CONFIG) - continue; - - bearers_num++; - - for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) { - if(j == (create_tunnel_req_pP->eps_bearer_id[i]-GTPV1U_BEARER_OFFSET)) - break; - } - - if(i < create_tunnel_req_pP->num_tunnels) { - s1u_teid = gtpv1u_ue_data_new_p->bearers[j].teid_eNB; - hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, s1u_teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_OK) { - gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_teid_data_p->eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i]; - LOG_I(GTPU, "updata teid_mapping te_id %u (prior_rnti %x rnti %x) in GTPV1U hashtable\n", - s1u_teid,prior_rnti,create_tunnel_req_pP->rnti); - } else { - LOG_W(GTPU, "Error get teid mapping(s1u_teid=%u) from GTPV1U hashtable", s1u_teid); - } - } else { - s1u_teid = gtpv1u_ue_data_new_p->bearers[j].teid_eNB; - hash_rc = hashtable_remove(RC.gtpv1u_data_g->teid_mapping, s1u_teid); - - if (hash_rc != HASH_TABLE_OK) { - LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", prior_rnti, s1u_teid); - } - - gtpv1u_ue_data_new_p->bearers[j].state = BEARER_DOWN; - gtpv1u_ue_data_new_p->num_bearers--; - LOG_I(GTPU, "delete teid_mapping te_id %u (rnti%x) bearer_id %d in GTPV1U hashtable\n", - s1u_teid,prior_rnti,j+GTPV1U_BEARER_OFFSET);; - } - - if(bearers_num > bearers_total) - break; - } - - return 0; -} - -//----------------------------------------------------------------------------- -int gtpv1u_delete_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - MessageDef *message_p = NULL; - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - teid_t teid_eNB = 0; - int erab_index = 0; - message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_DELETE_TUNNEL_RESP); - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).rnti = req_pP->rnti; - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).status = 0; - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, req_pP->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_OK) { - for (erab_index = 0; erab_index < req_pP->num_erab; erab_index++) { - teid_eNB = gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].teid_eNB; - LOG_D(GTPU, "Rx GTPV1U_ENB_DELETE_TUNNEL user rnti %x eNB S1U teid %u eps bearer id %u\n", - req_pP->rnti, teid_eNB, req_pP->eps_bearer_id[erab_index]); - { - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - stack_req.apiType = NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT; - LOG_D(GTPU, "gtpv1u_delete_s1u_tunnel erab %u %u\n", - req_pP->eps_bearer_id[erab_index], - teid_eNB); - stack_req.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle = gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].teid_eNB_stack_session; - rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - LOG_D(GTPU, ".\n"); - } - - if (rc != NW_GTPV1U_OK) { - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).status |= 0xFF; - LOG_E(GTPU, "NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT failed"); - } - - //----------------------- - // PDCP->GTPV1U mapping - //----------------------- - gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].state = BEARER_DOWN; - gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].teid_eNB = 0; - gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].teid_sgw = 0; - gtpv1u_ue_data_p->bearers[req_pP->eps_bearer_id[erab_index] - GTPV1U_BEARER_OFFSET].sgw_ip_addr = 0; - gtpv1u_ue_data_p->num_bearers -= 1; - - if (gtpv1u_ue_data_p->num_bearers == 0) { - hash_rc = hashtable_remove(RC.gtpv1u_data_g->ue_mapping, req_pP->rnti); - LOG_D(GTPU, "Removed user rnti %x,no more bearers configured\n", req_pP->rnti); - } - - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - hash_rc = hashtable_remove(RC.gtpv1u_data_g->teid_mapping, teid_eNB); - - if (hash_rc != HASH_TABLE_OK) { - LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", req_pP->rnti, teid_eNB); - } - } - }// else silently do nothing - - LOG_D(GTPU, "Tx GTPV1U_ENB_DELETE_TUNNEL_RESP user rnti %x eNB S1U teid %u status %u\n", - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).rnti, - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).enb_S1u_teid, - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).status); - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_RRC_ENB, - NULL,0, - "0 GTPV1U_ENB_DELETE_TUNNEL_RESP rnti %x teid %x", - GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).rnti, - teid_eNB); - if (req_pP->from_gnb) - return itti_send_msg_to_task(TASK_RRC_GNB, instanceP, message_p); - else - return itti_send_msg_to_task(TASK_RRC_ENB, instanceP, message_p); -} - - -//----------------------------------------------------------------------------- -int gtpv1u_eNB_init(void) { - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uUlpEntityT ulp; - NwGtpv1uUdpEntityT udp; - NwGtpv1uLogMgrEntityT log; - NwGtpv1uTimerMgrEntityT tmr; - // enb_properties_p = enb_config_get()->properties[0]; - RC.gtpv1u_data_g = (gtpv1u_data_t *)calloc(sizeof(gtpv1u_data_t),1); - LOG_I(GTPU, "Initializing GTPU stack %p\n",&RC.gtpv1u_data_g); - //gtpv1u_data_g.gtpv1u_stack; - /* Initialize UE hashtable */ - RC.gtpv1u_data_g->ue_mapping = hashtable_create (32, NULL, NULL); - AssertFatal(RC.gtpv1u_data_g->ue_mapping != NULL, " ERROR Initializing TASK_GTPV1_U task interface: in hashtable_create returned %p\n", RC.gtpv1u_data_g->ue_mapping); - RC.gtpv1u_data_g->teid_mapping = hashtable_create (256, NULL, NULL); - AssertFatal(RC.gtpv1u_data_g->teid_mapping != NULL, " ERROR Initializing TASK_GTPV1_U task interface: in hashtable_create\n"); - // RC.gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up = enb_properties_p->enb_ipv4_address_for_S1U; - //gtpv1u_data_g.udp_data; - RC.gtpv1u_data_g->seq_num = 0; - RC.gtpv1u_data_g->restart_counter = 0; - RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up = 0; - /* Initializing GTPv1-U stack */ - if ((rc = nwGtpv1uInitialize(&RC.gtpv1u_data_g->gtpv1u_stack, GTPU_STACK_ENB)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "Failed to setup nwGtpv1u stack %x\n", rc); - return -1; - } - - if ((rc = nwGtpv1uSetLogLevel(RC.gtpv1u_data_g->gtpv1u_stack, - NW_LOG_LEVEL_DEBG)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "Failed to setup loglevel for stack %x\n", rc); - return -1; - } - - /* Set the ULP API callback. Called once message have been processed by the - * nw-gtpv1u stack. - */ - ulp.ulpReqCallback = gtpv1u_eNB_process_stack_req; - memset((void *)&(ulp.hUlp), 0, sizeof(NwGtpv1uUlpHandleT)); - - if ((rc = nwGtpv1uSetUlpEntity(RC.gtpv1u_data_g->gtpv1u_stack, &ulp)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetUlpEntity: %x", rc); - return -1; - } - - /* nw-gtpv1u stack requires an udp callback to send data over UDP. - * We provide a wrapper to UDP task. - */ - udp.udpDataReqCallback = gtpv1u_eNB_send_udp_msg; - memset((void *)&(udp.hUdp), 0, sizeof(NwGtpv1uUdpHandleT)); - - if ((rc = nwGtpv1uSetUdpEntity(RC.gtpv1u_data_g->gtpv1u_stack, &udp)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetUdpEntity: %x", rc); - return -1; - } - - log.logReqCallback = gtpv1u_eNB_log_request; - memset((void *)&(log.logMgrHandle), 0, sizeof(NwGtpv1uLogMgrHandleT)); - - if ((rc = nwGtpv1uSetLogMgrEntity(RC.gtpv1u_data_g->gtpv1u_stack, &log)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetLogMgrEntity: %x", rc); - return -1; - } - - /* Timer interface is more complicated as both wrappers doesn't send a message - * to the timer task but call the timer API functions start/stop timer. - */ - tmr.tmrMgrHandle = 0; - tmr.tmrStartCallback = gtpv1u_start_timer_wrapper; - tmr.tmrStopCallback = gtpv1u_stop_timer_wrapper; - - if ((rc = nwGtpv1uSetTimerMgrEntity(RC.gtpv1u_data_g->gtpv1u_stack, &tmr)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetTimerMgrEntity: %x", rc); - return -1; - } - -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - - if ((ret = gtpv1u_eNB_create_dump_socket()) < 0) { - return -1; - } - -#endif - LOG_D(GTPU, "Initializing GTPV1U interface for eNB: DONE\n"); - return 0; -} - -//----------------------------------------------------------------------------- -void *gtpv1u_eNB_process_itti_msg(void *notUsed) { - /* Trying to fetch a message from the message queue. - * If the queue is empty, this function will block till a - * message is sent to the task. - */ - instance_t instance; - MessageDef *received_message_p = NULL; - int rc = 0; - itti_receive_msg(TASK_GTPV1_U, &received_message_p); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK, VCD_FUNCTION_IN); - DevAssert(received_message_p != NULL); - instance = ITTI_MSG_DESTINATION_INSTANCE(received_message_p); - //msg_name_p = ITTI_MSG_NAME(received_message_p); - - switch (ITTI_MSG_ID(received_message_p)) { - case GTPV1U_ENB_S1_REQ: - gtpv1u_s1_req(instance, &received_message_p->ittiMsg.gtpv1uS1Req); - - case GTPV1U_ENB_DELETE_TUNNEL_REQ: { - gtpv1u_delete_s1u_tunnel(instance, &received_message_p->ittiMsg.Gtpv1uDeleteTunnelReq); - } - break; - - // DATA COMING FROM UDP - case UDP_DATA_IND: { - udp_data_ind_t *udp_data_ind_p; - udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind; - nwGtpv1uProcessUdpReq(RC.gtpv1u_data_g->gtpv1u_stack, - udp_data_ind_p->buffer, - udp_data_ind_p->buffer_length, - udp_data_ind_p->peer_port, - udp_data_ind_p->peer_address); - //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_ind_p->buffer); - } - break; - - // DATA TO BE SENT TO UDP - case GTPV1U_ENB_TUNNEL_DATA_REQ: { - gtpv1u_enb_tunnel_data_req_t *data_req_p = NULL; - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - teid_t enb_s1u_teid = 0; - teid_t sgw_s1u_teid = 0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN); - data_req_p = >PV1U_ENB_TUNNEL_DATA_REQ(received_message_p); - //ipv4_send_data(ipv4_data_p->sd, data_ind_p->buffer, data_ind_p->length); -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - gtpv1u_eNB_write_dump_socket(&data_req_p->buffer[data_req_p->offset],data_req_p->length); -#endif - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); - } else { - if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id < max_val_LTE_DRB_Identity)) { - enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB; - sgw_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_sgw; - stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - stack_req.apiInfo.sendtoInfo.teid = sgw_s1u_teid; - stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr; - rc = nwGtpv1uGpduMsgNew( - RC.gtpv1u_data_g->gtpv1u_stack, - sgw_s1u_teid, - NW_FALSE, - RC.gtpv1u_data_g->seq_num++, - data_req_p->buffer, - data_req_p->length, - data_req_p->offset, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", - enb_s1u_teid,sgw_s1u_teid,data_req_p->length); - (void)enb_s1u_teid; /* avoid gcc warning "set but not used" */ - } else { - rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", - enb_s1u_teid,sgw_s1u_teid,data_req_p->length); - } else { - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_GTPU_SGW, - NULL, - 0, - MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u", - 0,0, - enb_s1u_teid, - sgw_s1u_teid, - data_req_p->length); - } - - rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, - stack_req.apiInfo.sendtoInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); - /* Buffer still needed, do not free it */ - //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_req_p->buffer); - } - break; - - case GTPV1U_ENB_DATA_FORWARDING_REQ: { - gtpv1u_enb_data_forwarding_req_t *data_req_p = NULL; - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - teid_t enb_s1u_teid = 0; - teid_t tenb_x2u_teid = 0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN); - data_req_p = >PV1U_ENB_DATA_FORWARDING_REQ(received_message_p); - //ipv4_send_data(ipv4_data_p->sd, data_ind_p->buffer, data_ind_p->length); -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - gtpv1u_eNB_write_dump_socket(&data_req_p->buffer[data_req_p->offset],data_req_p->length); -#endif - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); - } else { - if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id <= max_val_LTE_DRB_Identity)) { - enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB; - tenb_x2u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_teNB; // target enb teid - stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - stack_req.apiInfo.sendtoInfo.teid = tenb_x2u_teid; - stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].tenb_ip_addr;// target enb ip - rc = nwGtpv1uGpduMsgNew( - RC.gtpv1u_data_g->gtpv1u_stack, - tenb_x2u_teid, - NW_FALSE, - RC.gtpv1u_data_g->seq_num++, - data_req_p->buffer, - data_req_p->length, - data_req_p->offset, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", - enb_s1u_teid,tenb_x2u_teid,data_req_p->length); - (void)enb_s1u_teid; /* avoid gcc warning "set but not used" */ - } else { - rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", - enb_s1u_teid,tenb_x2u_teid,data_req_p->length); - } else { - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_GTPU_SGW, - NULL, - 0, - MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u", - 0,0, - enb_s1u_teid, - tenb_x2u_teid, - data_req_p->length); - } - - rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, - stack_req.apiInfo.sendtoInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); - /* Buffer still needed, do not free it */ - //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_req_p->buffer) - } - break; - - case GTPV1U_ENB_END_MARKER_REQ: { - gtpv1u_enb_end_marker_req_t *data_req_p = NULL; - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - teid_t enb_s1u_teid = 0; - teid_t tenb_x2u_teid = 0; - NwGtpv1uMsgT *pMsg = NULL; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN); - data_req_p = >PV1U_ENB_END_MARKER_REQ(received_message_p); - //ipv4_send_data(ipv4_data_p->sd, data_ind_p->buffer, data_ind_p->length); -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - gtpv1u_eNB_write_dump_socket(&data_req_p->buffer[data_req_p->offset],data_req_p->length); -#endif - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); - } else { - if ((data_req_p->rab_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->rab_id <= max_val_LTE_DRB_Identity)) { - enb_s1u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_eNB; - tenb_x2u_teid = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].teid_teNB; // target enb teid - stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - stack_req.apiInfo.sendtoInfo.teid = tenb_x2u_teid; - stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].tenb_ip_addr;// target enb ip - rc = nwGtpv1uGpduMsgNew( - RC.gtpv1u_data_g->gtpv1u_stack, - tenb_x2u_teid, - NW_FALSE, - RC.gtpv1u_data_g->seq_num++, - data_req_p->buffer, - data_req_p->length, - data_req_p->offset, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", - enb_s1u_teid,tenb_x2u_teid,data_req_p->length); - (void)enb_s1u_teid; /* avoid gcc warning "set but not used" */ - } else { - pMsg = (NwGtpv1uMsgT *) stack_req.apiInfo.sendtoInfo.hMsg; - pMsg->msgType = NW_GTP_END_MARKER; - rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", - enb_s1u_teid,tenb_x2u_teid,data_req_p->length); - } else { - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_GTPU_SGW, - NULL, - 0, - MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u", - 0,0, - enb_s1u_teid, - tenb_x2u_teid, - data_req_p->length); - } - - rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, - stack_req.apiInfo.sendtoInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - - gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; - memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); - delete_tunnel_req.rnti = data_req_p->rnti; - gtpv1u_delete_x2u_tunnel(instance, &delete_tunnel_req, GTPV1U_SOURCE_ENB); - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); - } - break; - - case TERMINATE_MESSAGE: { - if (RC.gtpv1u_data_g->ue_mapping != NULL) { - hashtable_destroy (&(RC.gtpv1u_data_g->ue_mapping)); - } - - if (RC.gtpv1u_data_g->teid_mapping != NULL) { - hashtable_destroy (&(RC.gtpv1u_data_g->teid_mapping)); - } - - LOG_W(GTPU, " *** Exiting GTPU thread\n"); - itti_exit_task(); - } - break; - - case TIMER_HAS_EXPIRED: - nwGtpv1uProcessTimeout(&received_message_p->ittiMsg.timer_has_expired.arg); - break; - - default: { - LOG_E(GTPU, "Unkwnon message ID %d:%s\n", - ITTI_MSG_ID(received_message_p), - ITTI_MSG_NAME(received_message_p)); - } - break; - } - - rc = itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); - AssertFatal(rc == EXIT_SUCCESS, "Failed to free memory (%d)!\n", rc); - received_message_p = NULL; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK, VCD_FUNCTION_OUT); - return NULL; -} - -//----------------------------------------------------------------------------- -void *gtpv1u_eNB_task(void *args) { - int rc = 0; - rc = gtpv1u_eNB_init(); - AssertFatal(rc == 0, "gtpv1u_eNB_init Failed"); - itti_mark_task_ready(TASK_GTPV1_U); - MSC_START_USE(); - - while(1) { - (void) gtpv1u_eNB_process_itti_msg (NULL); - } - - return NULL; -} - diff --git a/openair3/GTPV1-U/gtpv1u_eNB_task.h b/openair3/GTPV1-U/gtpv1u_eNB_task.h deleted file mode 100644 index a6e2625941..0000000000 --- a/openair3/GTPV1-U/gtpv1u_eNB_task.h +++ /dev/null @@ -1,69 +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 gtpv1u_eNB_task.h -* \brief -* \author Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ - -#ifndef GTPV1U_ENB_TASK_H_ -#define GTPV1U_ENB_TASK_H_ - - -/* -int -gtpv1u_new_data_req( - uint8_t enb_id, - uint8_t ue_id, - uint8_t rab_id, - uint8_t *buffer, - uint32_t buf_len, - uint32_t buf_offset);*/ - -int gtpv1u_eNB_init(void); -void *gtpv1u_eNB_process_itti_msg(void*); -void *gtpv1u_eNB_task(void *args); - -int -gtpv1u_create_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_x2u_tunnel_req_t * const create_tunnel_req_pP, - gtpv1u_enb_create_x2u_tunnel_resp_t * const create_tunnel_resp_pP); - -int -gtpv1u_create_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP, - gtpv1u_enb_create_tunnel_resp_t * const create_tunnel_resp_pP); - -int -gtpv1u_update_s1u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t * const create_tunnel_req_pP, - const rnti_t prior_rnti); - -int gtpv1u_delete_x2u_tunnel( - const instance_t instanceP, - const gtpv1u_enb_delete_tunnel_req_t * const req_pP, - int enbflag); -#endif /* GTPV1U_ENB_TASK_H_ */ diff --git a/openair3/GTPV1-U/gtpv1u_gNB.c b/openair3/GTPV1-U/gtpv1u_gNB.c deleted file mode 100644 index ff7c8c0604..0000000000 --- a/openair3/GTPV1-U/gtpv1u_gNB.c +++ /dev/null @@ -1,1012 +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 gtpv1u_gNB.c - * \brief - * \author Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein, Panos MATZAKOS - * \version 1.0 - * \company Eurecom - * \email: lionel.gauthier@eurecom.fr - */ -#include -#include - -#include "mme_config.h" -#include "intertask_interface.h" -#include "msc.h" - -#include "gtpv1u.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uMsg.h" -#include "NwGtpv1uPrivate.h" -#include "NwLog.h" -#include "gtpv1u_eNB_defs.h" -#include "gtpv1u_gNB_defs.h" -#include "gtpv1_u_messages_types.h" -#include "udp_eNB_task.h" -#include "common/utils/LOG/log.h" -#include "COMMON/platform_types.h" -#include "COMMON/platform_constants.h" -#include "common/utils/LOG/vcd_signal_dumper.h" -#include "common/ran_context.h" -#include "gtpv1u_eNB_task.h" -#include "gtpv1u_gNB_task.h" -#include "rrc_eNB_GTPV1U.h" - -#undef GTP_DUMP_SOCKET - -#undef GTPV1U_BEARER_OFFSET -#define GTPV1U_BEARER_OFFSET 1 - -extern unsigned char NB_eNB_INST; - -extern RAN_CONTEXT_t RC; - -extern NwGtpv1uRcT gtpv1u_eNB_send_udp_msg( - NwGtpv1uUdpHandleT udpHandle, - uint8_t *buffer, - uint32_t buffer_len, - uint32_t buffer_offset, - uint32_t peerIpAddr, - uint16_t peerPort); - -extern NwGtpv1uRcT gtpv1u_eNB_log_request(NwGtpv1uLogMgrHandleT hLogMgr, - uint32_t logLevel, - NwCharT *file, - uint32_t line, - NwCharT *logStr); - -static NwGtpv1uRcT gtpv1u_start_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - uint32_t timeoutSec, - uint32_t timeoutUsec, - uint32_t tmrType, - void *timeoutArg, - NwGtpv1uTimerHandleT *hTmr) { - NwGtpv1uRcT rc = NW_GTPV1U_OK; - long timer_id; - - if (tmrType == NW_GTPV1U_TMR_TYPE_ONE_SHOT) { - timer_setup(timeoutSec, - timeoutUsec, - TASK_GTPV1_U, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - timeoutArg, - &timer_id); - } else { - timer_setup(timeoutSec, - timeoutUsec, - TASK_GTPV1_U, - INSTANCE_DEFAULT, - TIMER_PERIODIC, - timeoutArg, - &timer_id); - } - - return rc; -} - - -static NwGtpv1uRcT -gtpv1u_stop_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NwGtpv1uTimerHandleT hTmr) { - NwGtpv1uRcT rc = NW_GTPV1U_OK; - return rc; -} - -/* Callback called when a gtpv1u message arrived on UDP interface */ -NwGtpv1uRcT gtpv1u_gNB_process_stack_req( - NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi) { - boolean_t result = FALSE; - teid_t teid = 0; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - protocol_ctxt_t ctxt; - NwGtpv1uRcT rc; - - switch(pUlpApi->apiType) { - /* Here there are two type of messages handled: - * - T-PDU - * - END-MARKER - */ - case NW_GTPV1U_ULP_API_RECV_TPDU: { - uint8_t buffer[4096]; - uint32_t buffer_len; - //uint16_t msgType = NW_GTP_GPDU; - //NwGtpv1uMsgT *pMsg = NULL; - /* Nw-gptv1u stack has processed a PDU. we can schedule it to PDCP - * for transmission. - */ - teid = pUlpApi->apiInfo.recvMsgInfo.teid; - //pMsg = (NwGtpv1uMsgT *) pUlpApi->apiInfo.recvMsgInfo.hMsg; - //msgType = pMsg->msgType; - - if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, - buffer, &buffer_len)) { - LOG_E(GTPU, "Error while retrieving T-PDU"); - } - - itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf); -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - gtpv1u_eNB_write_dump_socket(buffer,buffer_len); -#endif - rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, - pUlpApi->apiInfo.recvMsgInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - - hash_rc = hashtable_get(RC.gtpv1u_data_g->teid_mapping, teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_OK) { -#if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_D(GTPU, "Received T-PDU from gtpv1u stack teid %u size %d -> enb module id %u ue module id %u rab id %u\n", - teid, - buffer_len, - gtpv1u_teid_data_p->enb_id, - gtpv1u_teid_data_p->ue_id, - gtpv1u_teid_data_p->eps_bearer_id); -#endif - //warning "LG eps bearer mapping to DRB id to do (offset -4)" - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->enb_id, ENB_FLAG_YES, gtpv1u_teid_data_p->ue_id, 0, 0,gtpv1u_teid_data_p->enb_id); - MSC_LOG_TX_MESSAGE( - MSC_GTPU_ENB, - MSC_PDCP_ENB, - NULL,0, - MSC_AS_TIME_FMT" DATA-REQ rb %u size %u", - 0,0, - (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - buffer_len); - - result = pdcp_data_req( - &ctxt, - SRB_FLAG_NO, - (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - 0, // mui - SDU_CONFIRM_NO, // confirm - buffer_len, - buffer, - PDCP_TRANSMISSION_MODE_DATA,NULL, NULL - ); - - if ( result == FALSE ) { - LOG_W(GTPU, "PDCP data request failed\n"); - - return NW_GTPV1U_FAILURE; - } - } else { - LOG_W(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len); - } - } - break; - - default: { - LOG_E(GTPU, "Received undefined UlpApi (%02x) from gtpv1u stack!\n", - pUlpApi->apiType); - } - } // end of switch - - return NW_GTPV1U_OK; -} - -int gtpv1u_gNB_init(void) { - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uUlpEntityT ulp; - NwGtpv1uUdpEntityT udp; - NwGtpv1uLogMgrEntityT log; - NwGtpv1uTimerMgrEntityT tmr; - // enb_properties_p = enb_config_get()->properties[0]; - RC.gtpv1u_data_g = (gtpv1u_data_t *)calloc(sizeof(gtpv1u_data_t),1); - LOG_I(GTPU, "Initializing GTPU stack %p\n",&RC.gtpv1u_data_g); - //gtpv1u_data_g.gtpv1u_stack; - /* Initialize UE hashtable */ - RC.gtpv1u_data_g->ue_mapping = hashtable_create (32, NULL, NULL); - AssertFatal(RC.gtpv1u_data_g->ue_mapping != NULL, " ERROR Initializing TASK_GTPV1_U task interface: in hashtable_create returned %p\n", RC.gtpv1u_data_g->ue_mapping); - RC.gtpv1u_data_g->teid_mapping = hashtable_create (256, NULL, NULL); - AssertFatal(RC.gtpv1u_data_g->teid_mapping != NULL, " ERROR Initializing TASK_GTPV1_U task interface: in hashtable_create\n"); - // RC.gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up = enb_properties_p->enb_ipv4_address_for_S1U; - //gtpv1u_data_g.udp_data; - RC.gtpv1u_data_g->seq_num = 0; - RC.gtpv1u_data_g->restart_counter = 0; - - /* Initializing GTPv1-U stack */ - if ((rc = nwGtpv1uInitialize(&RC.gtpv1u_data_g->gtpv1u_stack, GTPU_STACK_ENB)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "Failed to setup nwGtpv1u stack %x\n", rc); - return -1; - } - - if ((rc = nwGtpv1uSetLogLevel(RC.gtpv1u_data_g->gtpv1u_stack, - NW_LOG_LEVEL_DEBG)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "Failed to setup loglevel for stack %x\n", rc); - return -1; - } - - /* Set the ULP API callback. Called once message have been processed by the - * nw-gtpv1u stack. - */ - ulp.ulpReqCallback = gtpv1u_gNB_process_stack_req; - memset((void *)&(ulp.hUlp), 0, sizeof(NwGtpv1uUlpHandleT)); - - if ((rc = nwGtpv1uSetUlpEntity(RC.gtpv1u_data_g->gtpv1u_stack, &ulp)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetUlpEntity: %x", rc); - return -1; - } - - /* nw-gtpv1u stack requires an udp callback to send data over UDP. - * We provide a wrapper to UDP task. - */ - udp.udpDataReqCallback = gtpv1u_eNB_send_udp_msg; - memset((void *)&(udp.hUdp), 0, sizeof(NwGtpv1uUdpHandleT)); - - if ((rc = nwGtpv1uSetUdpEntity(RC.gtpv1u_data_g->gtpv1u_stack, &udp)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetUdpEntity: %x", rc); - return -1; - } - - log.logReqCallback = gtpv1u_eNB_log_request; - memset((void *)&(log.logMgrHandle), 0, sizeof(NwGtpv1uLogMgrHandleT)); - - if ((rc = nwGtpv1uSetLogMgrEntity(RC.gtpv1u_data_g->gtpv1u_stack, &log)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetLogMgrEntity: %x", rc); - return -1; - } - - /* Timer interface is more complicated as both wrappers doesn't send a message - * to the timer task but call the timer API functions start/stop timer. - */ - tmr.tmrMgrHandle = 0; - tmr.tmrStartCallback = gtpv1u_start_timer_wrapper; - tmr.tmrStopCallback = gtpv1u_stop_timer_wrapper; - - if ((rc = nwGtpv1uSetTimerMgrEntity(RC.gtpv1u_data_g->gtpv1u_stack, &tmr)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetTimerMgrEntity: %x", rc); - return -1; - } - -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - - if ((ret = gtpv1u_eNB_create_dump_socket()) < 0) { - return -1; - } - -#endif - LOG_D(GTPU, "Initializing GTPV1U interface for eNB: DONE\n"); - return 0; -} - -void *gtpv1u_gNB_task(void *args) { - int rc = 0; - rc = gtpv1u_gNB_init(); - AssertFatal(rc == 0, "gtpv1u_eNB_init Failed"); - itti_mark_task_ready(TASK_GTPV1_U); - MSC_START_USE(); - - while(1) { - (void) gtpv1u_eNB_process_itti_msg (NULL); - } - - return NULL; -} - -/* Callback called when a gtpv1u message arrived on UDP interface */ -NwGtpv1uRcT nr_gtpv1u_gNB_process_stack_req( - NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi) { - boolean_t result = FALSE; - teid_t teid = 0; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - nr_gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - protocol_ctxt_t ctxt; - NwGtpv1uRcT rc; - - switch(pUlpApi->apiType) { - /* Here there are two type of messages handled: - * - T-PDU - * - END-MARKER - */ - case NW_GTPV1U_ULP_API_RECV_TPDU: { - uint8_t buffer[4096]; - uint32_t buffer_len; - //uint16_t msgType = NW_GTP_GPDU; - //NwGtpv1uMsgT *pMsg = NULL; - /* Nw-gptv1u stack has processed a PDU. we can schedule it to PDCP - * for transmission. - */ - teid = pUlpApi->apiInfo.recvMsgInfo.teid; - //pMsg = (NwGtpv1uMsgT *) pUlpApi->apiInfo.recvMsgInfo.hMsg; - //msgType = pMsg->msgType; - - if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, - buffer, &buffer_len)) { - LOG_E(GTPU, "Error while retrieving T-PDU"); - } - - itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf); -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - gtpv1u_eNB_write_dump_socket(buffer,buffer_len); -#endif - rc = nwGtpv1uMsgDelete(RC.nr_gtpv1u_data_g->gtpv1u_stack, - pUlpApi->apiInfo.recvMsgInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->teid_mapping, teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_OK) { -// #if defined(LOG_GTPU) && LOG_GTPU > 0 - LOG_D(GTPU, "Received T-PDU from gtpv1u stack teid %u size %d -> gnb module id %u ue module id %u pdu session id %u\n", - teid, - buffer_len, - gtpv1u_teid_data_p->gnb_id, - gtpv1u_teid_data_p->ue_id, - gtpv1u_teid_data_p->pdu_session_id); -// #endif - //warning "LG eps bearer mapping to DRB id to do (offset -4)" - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->gnb_id, GNB_FLAG_YES, gtpv1u_teid_data_p->ue_id, 0, 0,gtpv1u_teid_data_p->gnb_id); - // MSC_LOG_TX_MESSAGE( - // MSC_GTPU_ENB, - // MSC_PDCP_ENB, - // NULL,0, - // MSC_AS_TIME_FMT" DATA-REQ rb %u size %u", - // 0,0, - // (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4, - // buffer_len); - - result = pdcp_data_req( - &ctxt, - SRB_FLAG_NO, - 1, - 0, // mui - SDU_CONFIRM_NO, // confirm - buffer_len, - buffer, - PDCP_TRANSMISSION_MODE_DATA,NULL, NULL - ); - - if ( result == FALSE ) { - LOG_W(GTPU, "PDCP data request failed\n"); - - return NW_GTPV1U_FAILURE; - } - } else { - LOG_W(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len); - } - } - break; - - default: { - LOG_E(GTPU, "Received undefined UlpApi (%02x) from gtpv1u stack!\n", - pUlpApi->apiType); - } - } // end of switch - - return NW_GTPV1U_OK; -} - -int nr_gtpv1u_gNB_init(void) { - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uUlpEntityT ulp; - NwGtpv1uUdpEntityT udp; - NwGtpv1uLogMgrEntityT log; - NwGtpv1uTimerMgrEntityT tmr; - // enb_properties_p = enb_config_get()->properties[0]; - RC.nr_gtpv1u_data_g = (nr_gtpv1u_data_t *)calloc(sizeof(nr_gtpv1u_data_t),1); - LOG_I(GTPU, "Initializing GTPU stack %p\n",&RC.nr_gtpv1u_data_g); - - /* Initialize UE hashtable */ - RC.nr_gtpv1u_data_g->ue_mapping = hashtable_create (32, NULL, NULL); - AssertFatal(RC.nr_gtpv1u_data_g->ue_mapping != NULL, " ERROR Initializing TASK_GTPV1_U task interface: in hashtable_create returned %p\n", RC.gtpv1u_data_g->ue_mapping); - RC.nr_gtpv1u_data_g->teid_mapping = hashtable_create (256, NULL, NULL); - AssertFatal(RC.nr_gtpv1u_data_g->teid_mapping != NULL, " ERROR Initializing TASK_GTPV1_U task interface: in hashtable_create\n"); - // RC.gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up = enb_properties_p->enb_ipv4_address_for_S1U; - //gtpv1u_data_g.udp_data; - RC.nr_gtpv1u_data_g->seq_num = 0; - RC.nr_gtpv1u_data_g->restart_counter = 0; - - /* Initializing GTPv1-U stack */ - if ((rc = nwGtpv1uInitialize(&RC.nr_gtpv1u_data_g->gtpv1u_stack, GTPU_STACK_ENB)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "Failed to setup nwGtpv1u stack %x\n", rc); - return -1; - } - - if ((rc = nwGtpv1uSetLogLevel(RC.nr_gtpv1u_data_g->gtpv1u_stack, - NW_LOG_LEVEL_DEBG)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "Failed to setup loglevel for stack %x\n", rc); - return -1; - } - - /* Set the ULP API callback. Called once message have been processed by the - * nw-gtpv1u stack. - */ - ulp.ulpReqCallback = nr_gtpv1u_gNB_process_stack_req; - memset((void *)&(ulp.hUlp), 0, sizeof(NwGtpv1uUlpHandleT)); - - if ((rc = nwGtpv1uSetUlpEntity(RC.nr_gtpv1u_data_g->gtpv1u_stack, &ulp)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetUlpEntity: %x", rc); - return -1; - } - - /* nw-gtpv1u stack requires an udp callback to send data over UDP. - * We provide a wrapper to UDP task. - */ - udp.udpDataReqCallback = gtpv1u_eNB_send_udp_msg; - memset((void *)&(udp.hUdp), 0, sizeof(NwGtpv1uUdpHandleT)); - - if ((rc = nwGtpv1uSetUdpEntity(RC.nr_gtpv1u_data_g->gtpv1u_stack, &udp)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetUdpEntity: %x", rc); - return -1; - } - - log.logReqCallback = gtpv1u_eNB_log_request; - memset((void *)&(log.logMgrHandle), 0, sizeof(NwGtpv1uLogMgrHandleT)); - - if ((rc = nwGtpv1uSetLogMgrEntity(RC.nr_gtpv1u_data_g->gtpv1u_stack, &log)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetLogMgrEntity: %x", rc); - return -1; - } - - /* Timer interface is more complicated as both wrappers doesn't send a message - * to the timer task but call the timer API functions start/stop timer. - */ - tmr.tmrMgrHandle = 0; - tmr.tmrStartCallback = gtpv1u_start_timer_wrapper; - tmr.tmrStopCallback = gtpv1u_stop_timer_wrapper; - - if ((rc = nwGtpv1uSetTimerMgrEntity(RC.nr_gtpv1u_data_g->gtpv1u_stack, &tmr)) != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uSetTimerMgrEntity: %x", rc); - return -1; - } - -#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0 - - if ((ret = gtpv1u_eNB_create_dump_socket()) < 0) { - return -1; - } - -#endif - LOG_D(GTPU, "Initializing GTPV1U interface for eNB: DONE\n"); - return 0; -} - -//----------------------------------------------------------------------------- -int -gtpv1u_create_ngu_tunnel( - const instance_t instanceP, - const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_pP) -{ - /* Create a new nw-gtpv1-u stack req using API */ - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - /* Local tunnel end-point identifier */ - teid_t ngu_teid = 0; - nr_gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - //MessageDef *message_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - int i; - pdusessionid_t pdusession_id = 0; - // int ipv4_addr = 0; - int ip_offset = 0; - in_addr_t in_addr; - int addrs_length_in_bytes= 0; - int loop_counter = 0; - int ret = 0; - MSC_LOG_RX_MESSAGE( - MSC_GTPU_GNB, - MSC_RRC_GNB, - NULL,0, - MSC_AS_TIME_FMT" CREATE_TUNNEL_REQ RNTI %"PRIx16" inst %u ntuns %u psid %u upf-ngu teid %u", - 0,0,create_tunnel_req_pP->rnti, instanceP, - create_tunnel_req_pP->num_tunnels, create_tunnel_req_pP->pdusession_id[0], - create_tunnel_req_pP->outgoing_teid[0]); - create_tunnel_resp_pP->rnti = create_tunnel_req_pP->rnti; - create_tunnel_resp_pP->status = 0; - create_tunnel_resp_pP->num_tunnels = 0; - - for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) { - ip_offset = 0; - loop_counter = 0; - pdusession_id = create_tunnel_req_pP->pdusession_id[i]; - LOG_D(GTPU, "Rx GTPV1U_GNB_CREATE_TUNNEL_REQ ue rnti %x pdu session id %u\n", - create_tunnel_req_pP->rnti, pdusession_id); - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - stack_req.apiType = NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT; - - do { - ngu_teid = gtpv1u_new_teid(); - LOG_D(GTPU, "gtpv1u_create_ngu_tunnel() 0x%x %u(dec)\n", ngu_teid, ngu_teid); - stack_req.apiInfo.createTunnelEndPointInfo.teid = ngu_teid; - stack_req.apiInfo.createTunnelEndPointInfo.hUlpSession = 0; - stack_req.apiInfo.createTunnelEndPointInfo.hStackSession = 0; - rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req); - LOG_D(GTPU, ".\n"); - loop_counter++; - } while (rc != NW_GTPV1U_OK && loop_counter < 10); - - if ( rc != NW_GTPV1U_OK && loop_counter == 10 ) { - LOG_E(GTPU,"NwGtpv1uCreateTunnelEndPoint failed 10 times,start next loop\n"); - ret = -1; - continue; - } - - //----------------------- - // PDCP->GTPV1U mapping - //----------------------- - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, (void **)>pv1u_ue_data_p); - - if ((hash_rc == HASH_TABLE_KEY_NOT_EXISTS) || (hash_rc == HASH_TABLE_OK)) { - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - gtpv1u_ue_data_p = calloc (1, sizeof(gtpv1u_ue_data_t)); - hash_rc = hashtable_insert(RC.nr_gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_p); - AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable"); - } - - gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_ue_data_p->instance_id = 0; // TO DO - memcpy(&create_tunnel_resp_pP->gnb_addr.buffer, - &RC.nr_gtpv1u_data_g->gnb_ip_address_for_NGu_up, - sizeof (in_addr_t)); - - LOG_I(GTPU,"Configured GTPu address : %x\n",RC.nr_gtpv1u_data_g->gnb_ip_address_for_NGu_up); - create_tunnel_resp_pP->gnb_addr.length = sizeof (in_addr_t); - addrs_length_in_bytes = create_tunnel_req_pP->dst_addr[i].length / 8; - AssertFatal((addrs_length_in_bytes == 4) || - (addrs_length_in_bytes == 16) || - (addrs_length_in_bytes == 20), - "Bad transport layer address length %d (bits) %d (bytes)", - create_tunnel_req_pP->dst_addr[i].length, addrs_length_in_bytes); - - if ((addrs_length_in_bytes == 4) || - (addrs_length_in_bytes == 20)) { - in_addr = *((in_addr_t *)create_tunnel_req_pP->dst_addr[i].buffer); - ip_offset = 4; - gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip_addr = in_addr; - } - - if ((addrs_length_in_bytes == 16) || - (addrs_length_in_bytes == 20)) { - memcpy(gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip6_addr.s6_addr, - &create_tunnel_req_pP->dst_addr[i].buffer[ip_offset], - 16); - } - - gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG; - gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB = ngu_teid; - gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB_stack_session = stack_req.apiInfo.createTunnelEndPointInfo.hStackSession; - gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf = create_tunnel_req_pP->outgoing_teid[i]; - gtpv1u_ue_data_p->num_bearers++; - create_tunnel_resp_pP->gnb_NGu_teid[i] = ngu_teid; - - LOG_I(GTPU,"Copied to create_tunnel_resp tunnel: index %d target gNB ip %d.%d.%d.%d length %d gtp teid %u\n", - i, - create_tunnel_resp_pP->gnb_addr.buffer[0], - create_tunnel_resp_pP->gnb_addr.buffer[1], - create_tunnel_resp_pP->gnb_addr.buffer[2], - create_tunnel_resp_pP->gnb_addr.buffer[3], - create_tunnel_resp_pP->gnb_addr.length, - create_tunnel_resp_pP->gnb_NGu_teid[i]); - } else { - create_tunnel_resp_pP->gnb_NGu_teid[i] = 0; - create_tunnel_resp_pP->status = 0xFF; - } - - create_tunnel_resp_pP->pdusession_id[i] = pdusession_id; - create_tunnel_resp_pP->num_tunnels += 1; - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->teid_mapping, ngu_teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - gtpv1u_teid_data_p = calloc (1, sizeof(nr_gtpv1u_teid_data_t)); - gtpv1u_teid_data_p->gnb_id = 0; // TO DO - gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_teid_data_p->pdu_session_id = pdusession_id; - hash_rc = hashtable_insert(RC.nr_gtpv1u_data_g->teid_mapping, ngu_teid, gtpv1u_teid_data_p); - AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting teid mapping in GTPV1U hashtable"); - } else { - create_tunnel_resp_pP->gnb_NGu_teid[i] = 0; - create_tunnel_resp_pP->status = 0xFF; - } - } - - MSC_LOG_TX_MESSAGE( - MSC_GTPU_GNB, - MSC_RRC_GNB, - NULL,0, - "0 GTPV1U_GNB_CREATE_TUNNEL_RESP rnti %x teid %x", - create_tunnel_resp_pP->rnti, - ngu_teid); - LOG_D(GTPU, "Tx GTPV1U_GNB_CREATE_TUNNEL_RESP ue rnti %x status %d\n", - create_tunnel_req_pP->rnti, - create_tunnel_resp_pP->status); - //return 0; - return ret; -} - -int gtpv1u_update_ngu_tunnel( - const instance_t instanceP, - const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, - const rnti_t prior_rnti -) { - /* Local tunnel end-point identifier */ - teid_t ngu_teid = 0; - nr_gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL; - nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - nr_gtpv1u_ue_data_t *gtpv1u_ue_data_new_p = NULL; - //MessageDef *message_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - int i,j; - uint8_t bearers_num = 0,bearers_total = 0; - //----------------------- - // PDCP->GTPV1U mapping - //----------------------- - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, prior_rnti, (void **)>pv1u_ue_data_p); - - if(hash_rc != HASH_TABLE_OK) { - LOG_E(GTPU,"Error get ue_mapping(rnti=%x) from GTPV1U hashtable error\n", prior_rnti); - return -1; - } - - gtpv1u_ue_data_new_p = calloc (1, sizeof(nr_gtpv1u_ue_data_t)); - memcpy(gtpv1u_ue_data_new_p,gtpv1u_ue_data_p,sizeof(nr_gtpv1u_ue_data_t)); - gtpv1u_ue_data_new_p->ue_id = create_tunnel_req_pP->rnti; - hash_rc = hashtable_insert(RC.nr_gtpv1u_data_g->ue_mapping, create_tunnel_req_pP->rnti, gtpv1u_ue_data_new_p); - - //AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable"); - if ( hash_rc != HASH_TABLE_OK ) { - LOG_E(GTPU,"Failed to insert ue_mapping(rnti=%x) in GTPV1U hashtable\n",create_tunnel_req_pP->rnti); - return -1; - } else { - LOG_I(GTPU, "inserting ue_mapping(rnti=%x) in GTPV1U hashtable\n", - create_tunnel_req_pP->rnti); - } - - hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->ue_mapping, prior_rnti); - LOG_I(GTPU, "hashtable_remove ue_mapping(rnti=%x) in GTPV1U hashtable\n", - prior_rnti); - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - bearers_total =gtpv1u_ue_data_new_p->num_bearers; - - for(j = 0; jbearers[j].state != BEARER_IN_CONFIG) - continue; - - bearers_num++; - - for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) { - if(j == (create_tunnel_req_pP->pdusession_id[i]-GTPV1U_BEARER_OFFSET)) - break; - } - - if(i < create_tunnel_req_pP->num_tunnels) { - ngu_teid = gtpv1u_ue_data_new_p->bearers[j].teid_gNB; - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->teid_mapping, ngu_teid, (void **)>pv1u_teid_data_p); - - if (hash_rc == HASH_TABLE_OK) { - gtpv1u_teid_data_p->ue_id = create_tunnel_req_pP->rnti; - gtpv1u_teid_data_p->pdu_session_id = create_tunnel_req_pP->pdusession_id[i]; - LOG_I(GTPU, "updata teid_mapping te_id %u (prior_rnti %x rnti %x) in GTPV1U hashtable\n", - ngu_teid,prior_rnti,create_tunnel_req_pP->rnti); - } else { - LOG_W(GTPU, "Error get teid mapping(s1u_teid=%u) from GTPV1U hashtable", ngu_teid); - } - } else { - ngu_teid = gtpv1u_ue_data_new_p->bearers[j].teid_gNB; - hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->teid_mapping, ngu_teid); - - if (hash_rc != HASH_TABLE_OK) { - LOG_D(GTPU, "Removed user rnti %x , enb S1U teid %u not found\n", prior_rnti, ngu_teid); - } - - gtpv1u_ue_data_new_p->bearers[j].state = BEARER_DOWN; - gtpv1u_ue_data_new_p->num_bearers--; - LOG_I(GTPU, "delete teid_mapping te_id %u (rnti%x) bearer_id %d in GTPV1U hashtable\n", - ngu_teid,prior_rnti,j+GTPV1U_BEARER_OFFSET);; - } - - if(bearers_num > bearers_total) - break; - } - - return 0; -} - -//----------------------------------------------------------------------------- -int gtpv1u_delete_ngu_tunnel( - const instance_t instanceP, - const gtpv1u_gnb_delete_tunnel_req_t *const req_pP) { - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - MessageDef *message_p = NULL; - nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - teid_t teid_gNB = 0; - int pdusession_index = 0; - message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_GNB_DELETE_TUNNEL_RESP); - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti = req_pP->rnti; - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status = 0; - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, req_pP->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_OK) { - for (pdusession_index = 0; pdusession_index < req_pP->num_pdusession; pdusession_index++) { - teid_gNB = gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB; - LOG_D(GTPU, "Rx GTPV1U_ENB_DELETE_TUNNEL user rnti %x eNB S1U teid %u eps bearer id %u\n", - req_pP->rnti, teid_gNB, req_pP->pdusession_id[pdusession_index]); - { - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - stack_req.apiType = NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT; - LOG_D(GTPU, "gtpv1u_delete_ngu_tunnel pdusession %u %u\n", - req_pP->pdusession_id[pdusession_index], - teid_gNB); - stack_req.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle = - gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB_stack_session; - rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req); - LOG_D(GTPU, ".\n"); - } - - if (rc != NW_GTPV1U_OK) { - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status |= 0xFF; - LOG_E(GTPU, "NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT failed"); - } - - //----------------------- - // PDCP->GTPV1U mapping - //----------------------- - gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].state = BEARER_DOWN; - gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_gNB = 0; - gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].teid_upf = 0; - gtpv1u_ue_data_p->bearers[req_pP->pdusession_id[pdusession_index] - GTPV1U_BEARER_OFFSET].upf_ip_addr = 0; - gtpv1u_ue_data_p->num_bearers -= 1; - - if (gtpv1u_ue_data_p->num_bearers == 0) { - hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->ue_mapping, req_pP->rnti); - LOG_D(GTPU, "Removed user rnti %x,no more bearers configured\n", req_pP->rnti); - } - - //----------------------- - // GTPV1U->PDCP mapping - //----------------------- - hash_rc = hashtable_remove(RC.nr_gtpv1u_data_g->teid_mapping, teid_gNB); - - if (hash_rc != HASH_TABLE_OK) { - LOG_D(GTPU, "Removed user rnti %x , gNB NGU teid %u not found\n", req_pP->rnti, teid_gNB); - } - } - }// else silently do nothing - - LOG_D(GTPU, "Tx GTPV1U_GNB_DELETE_TUNNEL_RESP user rnti %x gNB NGU teid %u status %u\n", - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti, - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).gnb_NGu_teid, - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).status); - MSC_LOG_TX_MESSAGE( - MSC_GTPU_GNB, - MSC_RRC_GNB, - NULL,0, - "0 GTPV1U_GNB_DELETE_TUNNEL_RESP rnti %x teid %x", - GTPV1U_GNB_DELETE_TUNNEL_RESP(message_p).rnti, - teid_gNB); - return itti_send_msg_to_task(TASK_RRC_GNB, instanceP, message_p); -} - -//----------------------------------------------------------------------------- -static int gtpv1u_gNB_send_init_udp(const Gtpv1uNGReq *req) { - // Create and alloc new message - MessageDef *message_p; - struct in_addr addr= {0}; - message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, UDP_INIT); - - if (message_p == NULL) { - return -1; - } - - UDP_INIT(message_p).port = req->gnb_port_for_NGu_up; - addr.s_addr = req->gnb_ip_address_for_NGu_up; - UDP_INIT(message_p).address = inet_ntoa(addr); - LOG_I(GTPU, "Tx UDP_INIT IP addr %s (%x)\n", UDP_INIT(message_p).address,UDP_INIT(message_p).port); - MSC_LOG_EVENT( - MSC_GTPU_ENB, - "0 UDP bind %s:%u", - UDP_INIT(message_p).address, - UDP_INIT(message_p).port); - return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p); -} - -static int gtpv1u_ng_req( - const instance_t instanceP, - const Gtpv1uNGReq *const req) { - memcpy(&RC.nr_gtpv1u_data_g->gnb_ip_address_for_NGu_up, - &req->gnb_ip_address_for_NGu_up, - sizeof (req->gnb_ip_address_for_NGu_up)); - gtpv1u_gNB_send_init_udp(req); - return 0; -} - -static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_data_req) { - gtpv1u_gnb_tunnel_data_req_t *data_req_p = NULL; - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; - nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; - teid_t gnb_ngu_teid = 0; - teid_t outgoing_teid = 0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN); - data_req_p = gnb_tunnel_data_req; - - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)>pv1u_ue_data_p); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti); - } else { - if ((data_req_p->pdusession_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->pdusession_id < max_val_NR_DRB_Identity)) { - gnb_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB; - outgoing_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf; - stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - stack_req.apiInfo.sendtoInfo.teid = outgoing_teid; - stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip_addr; - rc = nwGtpv1uGpduMsgNew( - RC.nr_gtpv1u_data_g->gtpv1u_stack, - outgoing_teid, - NW_FALSE, - RC.nr_gtpv1u_data_g->seq_num++, - data_req_p->buffer, - data_req_p->length, - data_req_p->offset, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u", - gnb_ngu_teid,outgoing_teid,data_req_p->length); - (void)gnb_ngu_teid; /* avoid gcc warning "set but not used" */ - } else { - rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); - MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u", - gnb_ngu_teid,outgoing_teid,data_req_p->length); - } else { - MSC_LOG_TX_MESSAGE( - MSC_GTPU_GNB, - MSC_GTPU_SGW, - NULL, - 0, - MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u", - 0,0, - gnb_ngu_teid, - outgoing_teid, - data_req_p->length); - } - - rc = nwGtpv1uMsgDelete(RC.nr_gtpv1u_data_g->gtpv1u_stack, - stack_req.apiInfo.sendtoInfo.hMsg); - - if (rc != NW_GTPV1U_OK) { - LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); - } - } - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); - /* Buffer still needed, do not free it */ - //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_req_p->buffer); - - return 0; -} - -//----------------------------------------------------------------------------- -void *gtpv1u_gNB_process_itti_msg(void *notUsed) { - /* Trying to fetch a message from the message queue. - * If the queue is empty, this function will block till a - * message is sent to the task. - */ - instance_t instance; - MessageDef *received_message_p = NULL; - int rc = 0; - itti_receive_msg(TASK_GTPV1_U, &received_message_p); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK, VCD_FUNCTION_IN); - DevAssert(received_message_p != NULL); - instance = received_message_p->ittiMsgHeader.originInstance; - - switch (ITTI_MSG_ID(received_message_p)) { - case GTPV1U_GNB_NG_REQ: - gtpv1u_ng_req(instance, &received_message_p->ittiMsg.gtpv1uNGReq); - break; - - case GTPV1U_GNB_DELETE_TUNNEL_REQ: - gtpv1u_delete_ngu_tunnel(instance, &received_message_p->ittiMsg.NRGtpv1uDeleteTunnelReq); - break; - - // DATA COMING FROM UDP - case UDP_DATA_IND: { - udp_data_ind_t *udp_data_ind_p; - udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind; - nwGtpv1uProcessUdpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, - udp_data_ind_p->buffer, - udp_data_ind_p->buffer_length, - udp_data_ind_p->peer_port, - udp_data_ind_p->peer_address); - } - break; - - // DATA TO BE SENT TO UDP - case GTPV1U_GNB_TUNNEL_DATA_REQ: - LOG_I(GTPU, "Received message %s\n", ITTI_MSG_NAME(received_message_p)); - gtpv1u_gnb_tunnel_data_req(>PV1U_GNB_TUNNEL_DATA_REQ(received_message_p)); - break; - - case TERMINATE_MESSAGE: { - if (RC.nr_gtpv1u_data_g->ue_mapping != NULL) { - hashtable_destroy (&(RC.nr_gtpv1u_data_g->ue_mapping)); - } - - if (RC.nr_gtpv1u_data_g->teid_mapping != NULL) { - hashtable_destroy (&(RC.nr_gtpv1u_data_g->teid_mapping)); - } - - LOG_W(GTPU, " *** Exiting GTPU thread\n"); - itti_exit_task(); - } - break; - - case TIMER_HAS_EXPIRED: - nwGtpv1uProcessTimeout(&received_message_p->ittiMsg.timer_has_expired.arg); - break; - - default: { - LOG_E(GTPU, "Unkwnon message ID %d:%s\n", - ITTI_MSG_ID(received_message_p), - ITTI_MSG_NAME(received_message_p)); - } - break; - } - - rc = itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); - AssertFatal(rc == EXIT_SUCCESS, "Failed to free memory (%d)!\n", rc); - received_message_p = NULL; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK, VCD_FUNCTION_OUT); - return NULL; -} - -void *nr_gtpv1u_gNB_task(void *args) { - int rc = 0; - rc = nr_gtpv1u_gNB_init(); - AssertFatal(rc == 0, "gtpv1u_gNB_init Failed"); - itti_mark_task_ready(TASK_GTPV1_U); - MSC_START_USE(); - - while(1) { - (void) gtpv1u_gNB_process_itti_msg (NULL); - } - - return NULL; -} diff --git a/openair3/GTPV1-U/gtpv1u_gNB_defs.h b/openair3/GTPV1-U/gtpv1u_gNB_defs.h deleted file mode 100644 index d4356aa3cf..0000000000 --- a/openair3/GTPV1-U/gtpv1u_gNB_defs.h +++ /dev/null @@ -1,108 +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 gtpv1u_gNB_defs.h - * \brief - * \author Yoshio INOUE, Masayuki HARADA - * \date 2020 - * \version 0.1 - * \email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com - * (yoshio.inoue%40fujitsu.com%2cmasayuki.harada%40fujitsu.com) - */ - -#include "hashtable.h" -#include "NR_asn_constant.h" - -#ifndef GTPV1U_GNB_DEFS_H_ -#define GTPV1U_GNB_DEFS_H_ - -#include "NwGtpv1u.h" - -#define GTPV1U_UDP_PORT (2152) - -#define NR_GTPV1U_MAX_BEARERS_ID (max_val_NR_DRB_Identity - 3) - -#define GTPV1U_SOURCE_GNB (0) -#define GTPV1U_TARGET_GNB (1) -#define GTPV1U_MSG_FROM_SOURCE_GNB (0) -#define GTPV1U_MSG_FROM_UPF (1) - - -typedef struct nr_gtpv1u_teid_data_s { - /* UE identifier for oaisim stack */ - module_id_t gnb_id; - rnti_t ue_id; - pdusessionid_t pdu_session_id; -} nr_gtpv1u_teid_data_t; - - -typedef struct nr_gtpv1u_bearer_s { - /* TEID used in dl and ul */ - teid_t teid_gNB; ///< gNB TEID - uintptr_t teid_gNB_stack_session; ///< gNB TEID - teid_t teid_upf; ///< Remote TEID - in_addr_t upf_ip_addr; - struct in6_addr upf_ip6_addr; - teid_t teid_tgNB; - in_addr_t tgnb_ip_addr; ///< target gNB ipv4 - struct in6_addr tgnb_ip6_addr; ///< target gNB ipv6 - tcp_udp_port_t port; - //NwGtpv1uStackSessionHandleT stack_session; - bearer_state_t state; -} nr_gtpv1u_bearer_t; - -typedef struct nr_gtpv1u_ue_data_s { - /* UE identifier for oaisim stack */ - rnti_t ue_id; - - /* Unique identifier used between PDCP and GTP-U to distinguish UEs */ - uint32_t instance_id; - int num_bearers; - /* Bearer related data. - * Note that the first LCID available for data is 3 and we fixed the maximum - * number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32). - */ - nr_gtpv1u_bearer_t bearers[NR_GTPV1U_MAX_BEARERS_ID]; - - //RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node; -} nr_gtpv1u_ue_data_t; - -typedef struct nr_gtpv1u_data_s { - /* nwgtpv1u stack internal data */ - NwGtpv1uStackHandleT gtpv1u_stack; - - /* RB tree of UEs */ - hash_table_t *ue_mapping; // PDCP->GTPV1U - hash_table_t *teid_mapping; // GTPV1U -> PDCP - - //RB_HEAD(gtpv1u_ue_map, gtpv1u_ue_data_s) gtpv1u_ue_map_head; - /* Local IP address to use */ - in_addr_t gnb_ip_address_for_NGu_up; - /* UDP internal data */ - //udp_data_t udp_data; - - uint16_t seq_num; - uint8_t restart_counter; - -} nr_gtpv1u_data_t; - - -#endif /* GTPV1U_GNB_DEFS_H_ */ diff --git a/openair3/GTPV1-U/gtpv1u_sgw_defs.h b/openair3/GTPV1-U/gtpv1u_sgw_defs.h deleted file mode 100644 index 1d62c18bf6..0000000000 --- a/openair3/GTPV1-U/gtpv1u_sgw_defs.h +++ /dev/null @@ -1,97 +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 - */ - -#ifndef GTPV1U_SGW_DEFS_H_ -#define GTPV1U_SGW_DEFS_H_ - -#include "mme_config.h" -#include "NwGtpv1u.h" -#include "gtpv1u.h" -#include "hashtable.h" -#include "common_types.h" - -#define GTPV1U_UDP_PORT (2152) - -#define MAX_BEARERS_PER_UE (11) - -typedef enum { - BEARER_DOWN = 0, - BEARER_IN_CONFIG, - BEARER_UP, - BEARER_DL_HANDOVER, - BEARER_UL_HANDOVER, - BEARER_MAX, -} bearer_state_t; - -#define BUFFER_TO_uint32_t(buf, x) \ -do { \ - x = ((uint32_t)((buf)[0]) ) | \ - ((uint32_t)((buf)[1]) << 8) | \ - ((uint32_t)((buf)[2]) << 16) | \ - ((uint32_t)((buf)[3]) << 24); \ -} while(0) - - - -typedef struct gtpv1u_teid2enb_info_s { - /* TEID used in dl and ul */ - uint32_t teid_enb; ///< Remote eNB TEID - ip_address_t enb_ip_addr; - bearer_state_t state; - uint16_t port; /// LG ??? -} gtpv1u_teid2enb_info_t; - -/*struct gtpv1u_ue_data_s { - // UE identifier for oaisim stack - uint8_t ue_id; - - // Unique identifier used between PDCP and GTP-U to distinguish UEs - uint32_t instance_id; - - // Bearer related data. - // Note that the first LCID available for data is 3 and we fixed the maximum - // number of e-rab per UE to be 11. The real rb id will 3 + rab_id (0..10). - // - struct gtpv1u_bearer_s bearers[MAX_BEARERS_PER_UE]; - - RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node; -};*/ - -typedef struct { - /* nwgtpv1u stack internal data */ - NwGtpv1uStackHandleT gtpv1u_stack; - /* RB tree of UEs */ - //RB_HEAD(gtpv1u_ue_map, gtpv1u_ue_data_s) gtpv1u_ue_map_head; - /* Local IP address to use */ - uint32_t sgw_ip_address_for_S1u_S12_S4_up; - char *ip_addr; - - uint16_t seq_num; - uint8_t restart_counter; - //gtpv1u_teid2enb_info_t* teid2enb_mapping[]; - hash_table_t *S1U_mapping; - -} gtpv1u_data_t; - - -int gtpv1u_init(const mme_config_t *mme_config); - -#endif /* GTPV1U_SGW_DEFS_H_ */ diff --git a/openair3/GTPV1-U/gtpv1u_teid_pool.c b/openair3/GTPV1-U/gtpv1u_teid_pool.c deleted file mode 100644 index ff0ac6f183..0000000000 --- a/openair3/GTPV1-U/gtpv1u_teid_pool.c +++ /dev/null @@ -1,47 +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 gtpv1u_task.c -* \brief -* \author Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ -#include -#include - -#include "gtpv1u.h" - -//#define GTPV1U_LINEAR_TEID_ALLOCATION 1 - -#ifdef GTPV1U_LINEAR_TEID_ALLOCATION -static uint32_t g_gtpv1u_teid = 0; -#endif - -uint32_t gtpv1u_new_teid(void) -{ -#ifdef GTPV1U_LINEAR_TEID_ALLOCATION - g_gtpv1u_teid = g_gtpv1u_teid + 1; - return g_gtpv1u_teid; -#else - return random() + random() % (RAND_MAX - 1) + 1; -#endif -} diff --git a/openair3/GTPV1-U/nw-gtpv1u/AUTHORS b/openair3/GTPV1-U/nw-gtpv1u/AUTHORS deleted file mode 100644 index b068a40fdd..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Amit Chawre diff --git a/openair3/GTPV1-U/nw-gtpv1u/COPYING b/openair3/GTPV1-U/nw-gtpv1u/COPYING deleted file mode 100644 index d27832d6c1..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/COPYING +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2010-2011 Amit Chawre -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products -derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/openair3/GTPV1-U/nw-gtpv1u/ChangeLog b/openair3/GTPV1-U/nw-gtpv1u/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/openair3/GTPV1-U/nw-gtpv1u/NEWS b/openair3/GTPV1-U/nw-gtpv1u/NEWS deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/openair3/GTPV1-U/nw-gtpv1u/README b/openair3/GTPV1-U/nw-gtpv1u/README deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uLog.h b/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uLog.h deleted file mode 100644 index 3fb5c8dd05..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uLog.h +++ /dev/null @@ -1,83 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#ifndef __NW_GTPV1U_LOG_H__ -#define __NW_GTPV1U_LOG_H__ - -#include -#include "NwLog.h" - -/** - * @file NwGtpv1uLog.h - * @brief This header contains logging related definitions. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------- - * Log Macro Definition - *--------------------------------------------------------------------------*/ - -#define NW_LOG(_gtpv1uHandle, _logLevel, ...) \ - do { \ - if(((NwGtpv1uStackT*)(_gtpv1uHandle))->logLevel >= _logLevel) \ - { \ - char _logBuf[1024]; \ - snprintf(_logBuf, 1024, __VA_ARGS__); \ - ((NwGtpv1uStackT*)(_gtpv1uHandle))->logMgr.logReqCallback(((NwGtpv1uStackT*)_gtpv1uHandle)->logMgr.logMgrHandle, _logLevel, __FILE__, __LINE__, _logBuf);\ - } \ - } while(0) - -#define NW_ENTER(_gtpv1uHandle) \ - do { \ - NW_LOG(_gtpv1uHandle, NW_LOG_LEVEL_DEBG, "Entering '%s'", __func__);\ - } while(0) - -#define NW_LEAVE(_gtpv1uHandle) \ - do { \ - NW_LOG(_gtpv1uHandle, NW_LOG_LEVEL_DEBG, "Leaving '%s'", __func__);\ - } while(0) - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_TYPES_H__ */ - - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h b/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h deleted file mode 100644 index 59ffb1e174..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uPrivate.h +++ /dev/null @@ -1,227 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#ifndef __NW_GTPV1U_PRIVATE_H__ -#define __NW_GTPV1U_PRIVATE_H__ - -#include "tree.h" -#include "queue.h" - -#include "NwTypes.h" -#include "NwGtpv1uError.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uMsg.h" - - -/** - * @file NwGtpv1uPrivate.h - * @brief This header file contains nw-gtpv1u private definitions not to be - * exposed to user application. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define NW_GTPV1U_MALLOC(_stack, _size, _mem, _type) \ - do { \ - if(((NwGtpv1uStackT*)(_stack))->memMgr.memAlloc && ((NwGtpv1uStackT*)(_stack))->memMgr.memFree )\ - { \ - _mem = (_type) ((NwGtpv1uStackT*) (_stack))->memMgr.memAlloc(((NwGtpv1uStackT*) (_stack))->memMgr.hMemMgr, _size, __FILE__, __LINE__);\ - } \ - else \ - { \ - _mem = (_type) malloc (_size); \ - } \ - } while (0) - -/*--------------------------------------------------------------------------* - * G T P U S T A C K O B J E C T T Y P E D E F I N I T I O N * - *--------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------* - * GRPS Tunneling Protocol Stack Class Definition - *--------------------------------------------------------------------------*/ - -/** - * gtpv1u stack class definition - */ - -typedef struct NwGtpv1uStack { - uint32_t stackType;/**< GTPU_STACK_ENB or GTPU_STACK_SGW */ - NwPtrT id; - uint32_t seq; - NwGtpv1uUlpEntityT ulp; - NwGtpv1uUdpEntityT udp; - NwGtpv1uMemMgrEntityT memMgr; - NwGtpv1uTimerMgrEntityT tmrMgr; - NwGtpv1uLogMgrEntityT logMgr; - uint32_t logLevel; - RB_HEAD( NwGtpv1uOutstandingTxSeqNumTrxnMap, NwGtpv1uTrxn) outstandingTxSeqNumMap; - RB_HEAD( NwGtpv1uOutstandingRxSeqNumTrxnMap, NwGtpv1uTrxn) outstandingRxSeqNumMap; - RB_HEAD(NwGtpv1uTunnelEndPointTMap, NwGtpv1uTunnelEndPoint) sessionMap; - RB_HEAD(NwGtpv1uTunnelEndPointIdentifierMap, NwGtpv1uTunnelEndPoint) teidMap; -} NwGtpv1uStackT; - -/** - * GTP Tunnel End Point class definition - */ - -typedef struct NwGtpv1uTunnelEndPoint { - uint32_t teid; /**< Gtpu Tunnel End Point Identifier */ - uint32_t peerAddr; /**< Peer IP address for the session */ - NwGtpv1uStackT* pStack; /**< Pointer to the parent stack */ - NwGtpv1uUlpSessionHandleT hUlpSession; /**< ULP session handle for the session */ - RB_ENTRY (NwGtpv1uTunnelEndPoint) sessionMapRbtNode; /**< RB Tree Data Structure Node */ - struct NwGtpv1uTunnelEndPoint *next; -} NwGtpv1uTunnelEndPointT; - - -/*--------------------------------------------------------------------------* - * Timeout Info Type Definition - *--------------------------------------------------------------------------*/ - -/** - * gtpv1u timeout info - */ - -typedef struct NwGtpv1uTimeoutInfo { - NwGtpv1uStackHandleT hStack; - void* timeoutArg; - NwGtpv1uRcT (*timeoutCallbackFunc)(void*); -} NwGtpv1uTimeoutInfoT; - -/** - * Start a transaction response timer - * - * @param[in] thiz Pointer to stack instance - * @param[in] timeoutArg Arg to timeout function. - * @param[out] phTmr Pointer to timer handle. - * @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpStartTrxnPeerRspTimer(NwGtpv1uStackT* thiz, NwGtpv1uTimeoutInfoT* timeoutInfo, NwGtpv1uTimerHandleT* phTmr); - -/** - * Stop a transaction response timer - * - * @param[in] thiz Pointer to stack instance - * @param[out] phTmr Pointer to timer handle. - * @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpStopTrxnPeerRspTimer(NwGtpv1uStackT* thiz, NwGtpv1uTimerHandleT* phTmr); - - -#define NW_GTPV1U_MAX_MSG_LEN (4096) /**< Maximum supported gtpv1u packet length including header */ - -/** - * NwGtpv1uMsgT holds gtpv1u messages to/from the peer. - */ -typedef struct NwGtpv1uMsg { - uint8_t version; - uint8_t protocolType; - uint8_t extHdrFlag; - uint8_t seqNumFlag; - uint16_t npduNumFlag; - uint32_t msgType; - uint16_t msgLen; - uint32_t teid; - uint16_t seqNum; - uint8_t npduNum; - uint8_t nextExtHdrType; - uint8_t* msgBuf; - uint32_t msgBufLen; - uint32_t msgBufOffset; - struct NwGtpv1uMsg* next; -} NwGtpv1uMsgT; - - -/*--------------------------------------------------------------------------* - * R6/R4 Transaction Context Type Definition - *--------------------------------------------------------------------------*/ - -/** - * Transaction structure - */ - -typedef struct NwGtpv1uTrxn { - uint32_t seqNum; - uint32_t peerIp; - uint32_t peerPort; - uint8_t maxRetries; - uint8_t t3Timer; - NwGtpv1uTimerHandleT hRspTmr; - NwGtpv1uTimeoutInfoT peerRspTimeoutInfo; - NwGtpv1uStackT* pStack; - NwGtpv1uTunnelEndPointT* pSession; - uint32_t hUlpTrxn; - NwGtpv1uMsgT* pMsg; - RB_ENTRY (NwGtpv1uTrxn) outstandingTxSeqNumMapRbtNode; /**< RB Tree Data Structure Node */ - RB_ENTRY (NwGtpv1uTrxn) outstandingRxSeqNumMapRbtNode; /**< RB Tree Data Structure Node */ - struct NwGtpv1uTrxn* next; -} NwGtpv1uTrxnT; - - -/** - * GTPv2 message header structure - */ - -#pragma pack(1) - -typedef struct NwGtpv1uMsgHeader { - uint8_t PN:1; - uint8_t S:1; - uint8_t E:1; - uint8_t spare:1; - uint8_t PT:1; - uint8_t version:3; - uint8_t msgType; - uint16_t msgLength; - uint32_t teid; -} NwGtpv1uMsgHeaderT; - -#pragma pack() - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_GTPV1U_PRIVATE_H__ */ -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h b/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h deleted file mode 100644 index 76228416a9..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTrxn.h +++ /dev/null @@ -1,88 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -/** - * @file NwGtpv1uTrxn.h - * @author Amit Chawre - * @brief - * - * This header file contains required definitions and functions - * prototypes used by gtpv1u transactions. - * - **/ - - -#ifndef __NW_GTPV1U_TRXN_H__ -#define __NW_GTPV1U_TRXN_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -NwGtpv1uRcT -nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT* thiz, - NW_OUT NwGtpv1uTrxnT **ppTrxn); - - -NwGtpv1uRcT -nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT* thiz, - NW_IN uint32_t seqNum, - NW_OUT NwGtpv1uTrxnT **ppTrxn); - -NwGtpv1uRcT -nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **ppTrxn); - -NwGtpv1uRcT -nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT* thiz, - NW_OUT NwGtpv1uTrxnT **ppTrxn); - -NwGtpv1uRcT -nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **pthiz); - -NwGtpv1uRcT -nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT* thiz, - NW_IN NwGtpv1uTrxnT *pTrxn, - NW_IN uint32_t peerIp, - NW_IN uint32_t peerPort, - NW_IN NwGtpv1uMsgT *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_GTPV1U_TRXN_H__ */ - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTunnelEndPoint.h b/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTunnelEndPoint.h deleted file mode 100644 index dc4fbab264..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/include/NwGtpv1uTunnelEndPoint.h +++ /dev/null @@ -1,85 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#include -#include -#include - -#include "NwTypes.h" -#include "NwUtils.h" -#include "NwGtpv1uError.h" -#include "NwGtpv1uPrivate.h" -#include "NwGtpv1uMsg.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uLog.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifndef __NW_GTPV1U_CONNECTION_H__ -#define __NW_GTPV1U_CONNECTION_H__ - -/** - Constructor - - @return Pointer to session on success, NULL n failure. - */ - -NwGtpv1uTunnelEndPointT* -nwGtpTunnelEndPointNew(struct NwGtpv1uStack* pStack); - -/** - Destructor - - @param[in] thiz: Pointer to session - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpTunnelEndPointDestroy(struct NwGtpv1uStack* pStack, NwGtpv1uTunnelEndPointT* thiz); - -NwGtpv1uRcT -nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT* thiz, - NwGtpv1uMsgT *pMsg); - -#ifdef __cplusplus -} -#endif - -#endif -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h deleted file mode 100644 index c6f7c3d6fa..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h +++ /dev/null @@ -1,562 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#ifndef __NW_GTPV1U_H__ -#define __NW_GTPV1U_H__ - -#include -#include -#include -#include "NwTypes.h" -#include "NwGtpv1uError.h" - - -/** - * @file NwGtpv1u.h - * @author Amit Chawre - * @brief - * - * This header file contains all required definitions and functions - * prototypes for using nw-gtpv1u library. - * - **/ - -#define NW_GTPU_VERSION (0x01) -#define NW_GTP_PROTOCOL_TYPE_GTP (0x01) -#define NW_GTP_PROTOCOL_TYPE_GTP_PRIME (0x00) - -/*--------------------------------------------------------------------------* - * S H A R E D A P I M A C R O S * - *--------------------------------------------------------------------------*/ - -#define NW_GTP_ECHO_REQ (1) -#define NW_GTP_ECHO_RSP (2) -#define NW_GTP_ERROR_INDICATION (26) -#define NW_GTP_SUPPORTED_EXTENSION_HEADER_INDICATION (31) -#define NW_GTP_END_MARKER (254) -#define NW_GTP_GPDU (255) - -/*--------------------------------------------------------------------------- - * Opaque Gtpv2 Stack Handles - *--------------------------------------------------------------------------*/ - -typedef NwPtrT NwGtpv1uStackHandleT; /**< Gtpv2 Stack Handle */ -typedef NwPtrT NwGtpv1uUlpHandleT; /**< Gtpv2 Stack Ulp Entity Handle */ -typedef NwPtrT NwGtpv1uUdpHandleT; /**< Gtpv2 Stack Udp Entity Handle */ -typedef NwPtrT NwGtpv1uMemMgrHandleT; /**< Gtpv2 Stack Mem Manager Handle */ -typedef NwPtrT NwGtpv1uTimerMgrHandleT; /**< Gtpv2 Stack Timer Manager Handle */ -typedef NwPtrT NwGtpv1uLogMgrHandleT; /**< Gtpv2 Stack Log Mnagaer Handle */ -typedef NwPtrT NwGtpv1uTimerHandleT; /**< Gtpv2 Stack Timer Handle */ -typedef NwPtrT NwGtpv1uMsgHandleT; /**< Gtpv2 Msg Handle */ - -typedef struct NwGtpv1uStackConfig { - uint16_t udpSrcPort; -} NwGtpv1uStackConfigT; - -/*--------------------------------------------------------------------------* - * S T A C K A P I D E F I N I T I O N S * - *--------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- - * Gtpv2 Stack ULP API type definitions - *--------------------------------------------------------------------------*/ - -/** - * APIs types between ULP and Stack - */ - -typedef enum { - /* APIs from ULP to stack */ - - NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT = 0x00000000, /**< Create a local teid context on stack */ - NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT, /**< Delete a local teid context on stack */ - NW_GTPV1U_ULP_API_INITIAL_REQ, /**< Send a Initial Request over a session */ - NW_GTPV1U_ULP_API_TRIGGERED_REQ, /**< Send a Initial Request over a session */ - NW_GTPV1U_ULP_API_TRIGGERED_RSP, /**< Send a Trigger Response over a session */ - NW_GTPV1U_ULP_API_SEND_TPDU, /**< Send a T-PDU message over teid context */ - - /* APIs from stack to ULP */ - - NW_GTPV1U_ULP_API_RECV_TPDU, /**< Receive a gtpv1u T-PDU from stack */ - NW_GTPV1U_ULP_API_RECV_MSG, /**< Receive a gtpv1u message from stack */ - NW_GTPV1U_ULP_API_RSP_FAILURE, /**< Rsp failure for gtpv2 message from stack */ - - /* Do not add below this */ - - NW_GTPV1U_ULP_API_END = 0xFFFFFFFF, -} NwGtpv1uUlpApiTypeT; - -/*--------------------------------------------------------------------------- - * Gtpv2 Stack API information elements definitions - *--------------------------------------------------------------------------*/ - -typedef NwPtrT NwGtpv1uStackSessionHandleT;/**< Gtpv2 Stack session Handle */ -typedef uint8_t NwGtpv1uMsgTypeT; /**< Gtpv2 Msg Type */ -typedef NwPtrT NwGtpv1uTrxnHandleT; /**< Gtpv2 Transaction Handle */ -typedef NwPtrT NwGtpv1uUlpTrxnHandleT; /**< Gtpv2 Ulp Transaction Handle */ -typedef NwPtrT NwGtpv1uUlpSessionHandleT; /**< Gtpv2 Ulp session Handle */ - -/** - * API information elements between ULP and Stack for - * creating a session. - */ - -typedef struct { - NW_IN uint32_t teid; - NW_IN NwGtpv1uUlpSessionHandleT hUlpSession; - NW_OUT NwGtpv1uStackSessionHandleT hStackSession; -} NwGtpv1uCreateTunnelEndPointT; - -/** - * API information elements between ULP and Stack for - * destroying a session. - */ - -typedef struct { - NW_IN NwGtpv1uStackSessionHandleT hStackSessionHandle; -} NwGtpv1uDestroyTunnelEndPointT; - -/** - * API information elements between ULP and Stack for - * sending a Gtpv1u initial message. - */ - -typedef struct { - NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn; - NW_IN uint32_t peerIp; - NW_IN uint32_t peerPort; - NW_IN uint8_t flags; - NW_IN uint32_t teid; -} NwGtpv1uInitialReqInfoT; - -/** - * API information elements between ULP and Stack for - * sending a Gtpv1u triggered response message. - */ - -typedef struct { - NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn; - NW_IN uint32_t peerIp; - NW_IN uint32_t peerPort; - NW_IN uint8_t flags; - NW_IN uint32_t teid; - NW_IN uint32_t seqNum; - NW_IN NwGtpv1uMsgHandleT hMsg; -} NwGtpv1uTriggeredRspInfoT; - -/** - * API information elements between ULP and Stack for - * sending a Gtpv1u triggered request message. - */ - -typedef struct { - NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn; - NW_IN uint32_t peerIp; - NW_IN uint32_t peerPort; - NW_IN uint8_t flags; - NW_IN uint32_t teid; - NW_IN uint32_t seqNum; - NW_IN NwGtpv1uMsgHandleT hMsg; -} NwGtpv1uTriggeredReqInfoT; - - -/** - * API information elements between ULP and Stack for - * sending a Gtpv2 message over a session. - */ - -typedef struct { - NW_IN uint32_t teid; - NW_IN uint32_t ipAddr; - NW_IN uint8_t flags; - NW_IN NwGtpv1uMsgHandleT hMsg; -} NwGtpv1uSendtoInfoT; - - -/** - * API information elements between ULP and Stack for - * sending a Gtpv2 message over a session. - */ - -typedef struct { - NW_OUT NwGtpv1uStackSessionHandleT hStackSessionHandle; - NW_INOUT NwGtpv1uTrxnHandleT hTrxn; - NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn; - NW_IN NwGtpv1uMsgTypeT msgType; - NW_IN uint8_t flags; - NW_IN NwGtpv1uMsgHandleT hMsg; -} NwGtpv1uSendMsgInfoT; - -/** - * API information elements between ULP and Stack for - * receiving a Gtpv2 message over a session from stack. - */ - -typedef struct { - NW_IN NwGtpv1uUlpSessionHandleT hUlpSession; - NW_IN NwGtpv1uUlpTrxnHandleT hUlpTrxn; - NW_IN uint32_t teid; - NW_IN uint32_t peerIp; - NW_IN uint32_t peerPort; - NW_IN uint32_t msgType; /**< Message type */ - NW_IN NwGtpv1uMsgHandleT hMsg; /**< Gtp Message handle */ -} NwGtpv1uRecvMsgInfoT; - -/** - * API information elements between ULP and Stack for - * receiving a Gtpv2 message over a session from stack. - */ - -typedef struct { - NW_IN NwGtpv1uUlpSessionHandleT hUlpSession; - NW_IN NwGtpv1uTrxnHandleT hTrxn; -} NwGtpv1uNackInfoT; - -/*--------------------------------------------------------------------------- - * Gtpv2 Stack API structure definition - *--------------------------------------------------------------------------*/ - -/** - * API structure between ULP and Stack - */ - -typedef struct { - NwGtpv1uUlpApiTypeT apiType; - NwGtpv1uMsgHandleT hMsg; - union { - NwGtpv1uCreateTunnelEndPointT createTunnelEndPointInfo; - NwGtpv1uDestroyTunnelEndPointT destroyTunnelEndPointInfo; - NwGtpv1uInitialReqInfoT initialReqInfo; - NwGtpv1uTriggeredRspInfoT triggeredRspInfo; - NwGtpv1uTriggeredReqInfoT triggeredReqInfo; - NwGtpv1uSendtoInfoT sendtoInfo; - NwGtpv1uSendMsgInfoT sendMsgInfo; - NwGtpv1uRecvMsgInfoT recvMsgInfo; - NwGtpv1uNackInfoT nackMsgInfo; - } apiInfo; -} NwGtpv1uUlpApiT; - - -/*--------------------------------------------------------------------------* - * S T A C K E N T I T I E S D E F I N I T I O N S * - *--------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- - * ULP Entity Definitions - *--------------------------------------------------------------------------*/ - -/** - * Gtpv2 ULP entity definition - */ - -typedef struct { - NwGtpv1uUlpHandleT hUlp; - NwGtpv1uRcT (*ulpReqCallback) ( NW_IN NwGtpv1uUlpHandleT hUlp, - NW_IN NwGtpv1uUlpApiT *pUlpApi); -} NwGtpv1uUlpEntityT; - - -/*--------------------------------------------------------------------------- - * UDP Entity Definitions - *--------------------------------------------------------------------------*/ - -/** - * Gtpv2 UDP entity definition - */ - -typedef struct { - NwGtpv1uUdpHandleT hUdp; - NwGtpv1uRcT (*udpDataReqCallback) ( NW_IN NwGtpv1uUdpHandleT udpHandle, - NW_IN uint8_t* dataBuf, - NW_IN uint32_t dataSize, - NW_IN uint32_t dataOffset, - NW_IN uint32_t peerIP, - NW_IN uint16_t peerPort); -} NwGtpv1uUdpEntityT; - -/** - * Gtpv1u Memory Manager entity definition - */ - -typedef struct { - NwGtpv1uMemMgrHandleT hMemMgr; - void* (*memAlloc)( NW_IN NwGtpv1uMemMgrHandleT hMemMgr, - NW_IN uint32_t memSize, - NW_IN NwCharT* fileName, - NW_IN uint32_t lineNumber); - - void (*memFree) ( NW_IN NwGtpv1uMemMgrHandleT hMemMgr, - NW_IN void* hMem, - NW_IN NwCharT* fileName, - NW_IN uint32_t lineNumber); -} NwGtpv1uMemMgrEntityT; - - -/*--------------------------------------------------------------------------- - * Timer Entity Definitions - *--------------------------------------------------------------------------*/ - -#define NW_GTPV1U_TMR_TYPE_ONE_SHOT (0) -#define NW_GTPV1U_TMR_TYPE_REPETITIVE (1) - -/** - * Gtpv2 Timer Manager entity definition - */ - -typedef struct { - NwGtpv1uTimerMgrHandleT tmrMgrHandle; - NwGtpv1uRcT (*tmrStartCallback)( NW_IN NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NW_IN uint32_t timeoutSecs, - NW_IN uint32_t timeoutUsec, - NW_IN uint32_t tmrType, - NW_IN void* tmrArg, - NW_OUT NwGtpv1uTimerHandleT* tmrHandle); - - NwGtpv1uRcT (*tmrStopCallback) ( NW_IN NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NW_IN NwGtpv1uTimerHandleT tmrHandle); -} NwGtpv1uTimerMgrEntityT; - - -/*--------------------------------------------------------------------------- - * Log Entity Definitions - *--------------------------------------------------------------------------*/ - -/** - * Gtpv2 Log manager entity definition - */ - -typedef struct { - NwGtpv1uLogMgrHandleT logMgrHandle; - NwGtpv1uRcT (*logReqCallback) (NW_IN NwGtpv1uLogMgrHandleT logMgrHandle, - NW_IN uint32_t logLevel, - NW_IN NwCharT* file, - NW_IN uint32_t line, - NW_IN NwCharT* logStr); -} NwGtpv1uLogMgrEntityT; - - -/*--------------------------------------------------------------------------* - * P U B L I C F U N C T I O N S * - *--------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------- - * Constructor - *--------------------------------------------------------------------------*/ - -/** - Initialize the nw-gtpv1u stack. - - @param[in,out] phGtpv1uStackHandle : Pointer to stack handle - @param[in] stackType : GTPU_STACK_ENB or GTPU_STACK_SGW - */ - -NwGtpv1uRcT -nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT* phGtpv1uStackHandle, uint32_t stackType); - -/*--------------------------------------------------------------------------- - * Destructor - *--------------------------------------------------------------------------*/ - -/** - Destroy the nw-gtpv1u stack. - - @param[in] hGtpv1uStackHandle : Stack handle - */ - -NwGtpv1uRcT -nwGtpv1uFinalize( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle); - -/*--------------------------------------------------------------------------- - * Configuration Get/Set Operations - *--------------------------------------------------------------------------*/ - -/** - Set Configuration for the nw-gtpv1u stack. - - @param[in,out] phGtpv1uStackHandle : Pointer to stack handle - */ - -NwGtpv1uRcT -NwGtpv1uConfigSet( NW_IN NwGtpv1uStackHandleT* phGtpv1uStackHandle, NW_IN NwGtpv1uStackConfigT* pConfig); - -/** - Get Configuration for the nw-gtpv1u stack. - - @param[in,out] phGtpv1uStackHandle : Pointer to stack handle - */ - -NwGtpv1uRcT -NwGtpv1uConfigGet( NW_IN NwGtpv1uStackHandleT* phGtpv1uStackHandle, NW_OUT NwGtpv1uStackConfigT* pConfig); - -/** - Set ULP entity for the stack. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] pUlpEntity : Pointer to ULP entity. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uSetUlpEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN NwGtpv1uUlpEntityT* pUlpEntity); - -/** - Set UDP entity for the stack. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] pUdpEntity : Pointer to UDP entity. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uSetUdpEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN NwGtpv1uUdpEntityT* pUdpEntity); - -/** - Set MemMgr entity for the stack. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] pMemMgr : Pointer to Memory Manager. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uSetMemMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN NwGtpv1uMemMgrEntityT* pMemMgr); - - -/** - Set TmrMgr entity for the stack. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] pTmrMgr : Pointer to Timer Manager. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uSetTimerMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN NwGtpv1uTimerMgrEntityT* pTmrMgr); - -/** - Set LogMgr entity for the stack. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] pLogMgr : Pointer to Log Manager. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uSetLogMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN NwGtpv1uLogMgrEntityT* pLogMgr); - -/** - Set log level for the stack. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] logLevel : Log level. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint32_t logLevel); -/*--------------------------------------------------------------------------- - * Process Request from Udp Layer - *--------------------------------------------------------------------------*/ - -/** - Process Data Request from UDP entity. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] udpData : Pointer to received UDP data. - @param[in] udpDataLen : Received data length. - @param[in] dstPort : Received on port. - @param[in] from : Received from peer information. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN uint8_t* udpData, - NW_IN uint32_t udpDataLen, - NW_IN uint16_t peerPort, - NW_IN uint32_t peerIP); - -/*--------------------------------------------------------------------------- - * Process Request from Upper Layer - *--------------------------------------------------------------------------*/ - -/** - Process Request from ULP entity. - - @param[in] hGtpv1uStackHandle : Stack handle - @param[in] pLogMgr : Pointer to Ulp Req. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpv1uStackHandle, - NW_IN NwGtpv1uUlpApiT *ulpReq); - - -/*--------------------------------------------------------------------------- - * Process Timer timeout Request from Timer Manager - *--------------------------------------------------------------------------*/ - -/** - Process Timer timeout Request from Timer Manager - - @param[in] pLogMgr : Pointer timeout arguments. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpv1uProcessTimeout( NW_IN void* timeoutArg); - -NwGtpv1uRcT -nwGtpv1uPeerRspTimeout(void* arg); - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_GTPV1U_H__ */ - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uError.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uError.h deleted file mode 100644 index 6da3b80dfa..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uError.h +++ /dev/null @@ -1,63 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 c * - * G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - - -#ifndef __NW_GTPV1U_ERROR_H__ -#define __NW_GTPV1U_ERROR_H__ - -/** - * @file NwGtpv1uError.h - * @brief This header file contains return error code type definitions. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - - NW_GTPV1U_OK = 0x00000000, - NW_GTPV1U_MANDATORY_IE_DUPLICATE, - NW_GTPV1U_MANDATORY_IE_MISSING, - NW_GTPV1U_MSG_MALFORMED, - NW_GTPV1U_FAILURE = 0xFFFFFFFE -} -NwGtpv1uRcT; - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_GTPV1U_ERROR_H__*/ - - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uIe.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uIe.h deleted file mode 100644 index 7bb51dcda0..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uIe.h +++ /dev/null @@ -1,66 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -/** - * @file NwGtpv1uIe.h - * @brief This header file contains Information Element definitions for GTPv1u - * as per 3GPP TS 29281-930. -*/ - -#ifndef __NW_GTPV1U_IE_H__ -#define __NW_GTPV1U_IE_H__ - -/*--------------------------------------------------------------------------* - * G T P V 2 U I E T Y P E M A C R O D E F I N I T I O N S * - *--------------------------------------------------------------------------*/ - -#define NW_GTPV1U_IE_RECOVERY (14) -#define NW_GTPV1U_IE_TEID_DATA_I (15) -#define NW_GTPV1U_IE_GSN_ADDRESS (133) -#define NW_GTPV1U_IE_EXT_HDR_TYPE_LIST (141) -#define NW_GTPV1U_IE_PRIVATE_EXTENSION (255) - - -/*--------------------------------------------------------------------------* - * G T P V 2 U C A U S E V A L U E D E F I N I T I O N S * - *--------------------------------------------------------------------------*/ - -#define NW_GTPV1U_CAUSE_REQUEST_ACCEPTED (16) -#define NW_GTPV1U_CAUSE_MANDATORY_IE_MISSING (70) - -#endif /* __NW_GTPV1U_IE_H__ */ - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h deleted file mode 100644 index f6bc0415f2..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwGtpv1uMsg.h +++ /dev/null @@ -1,317 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#ifndef __NW_GTPV1U_MSG_H__ -#define __NW_GTPV1U_MSG_H__ - -#include "NwTypes.h" -#include "NwGtpv1u.h" - -/** - * @file NwGtpv1uMsg.h - * @brief This file defines APIs for to build new outgoing gtpv1u messages and to parse incoming messages. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------* - * G T P V 2 C I E D A T A - T Y P E D E F I N I T I O N S * - *--------------------------------------------------------------------------*/ - -#pragma pack(1) - -typedef struct NwGtpv1uIeTv1 { - uint8_t t; - uint8_t v; -} NwGtpv1uIeTv1T; - -typedef struct NwGtpv1uIeTv2 { - uint8_t t; - uint8_t v; -} NwGtpv1uIeTv2T; - -typedef struct NwGtpv1uIeTv4 { - uint8_t t; - uint32_t v; -} NwGtpv1uIeTv4T; - -typedef struct NwGtpv1uIeTlv { - uint8_t t; - uint16_t l; -} NwGtpv1uIeTlvT; - -#pragma pack() - - -/** - * Allocate a GPDU gtpv1u message. - * - * @param[in] hGtpuStackHandle : gtpv1u stack handle. - * @param[in] teidPresent : TEID is present flag. - * @param[in] teid : TEID for this message. - * @param[in] seqNum : Sequence number for this message. - * @param[out] phMsg : Pointer to message handle. - */ - -NwGtpv1uRcT -nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint8_t seqNumFlag, - NW_IN uint8_t npduNumFlag, - NW_IN uint8_t extHdrFlag, - NW_IN uint8_t msgType, - NW_IN uint8_t teid, - NW_IN uint16_t seqNum, - NW_IN uint8_t npduNum, - NW_IN uint8_t nextExtHeader, - NW_OUT NwGtpv1uMsgHandleT *phMsg); - - -/** - * Allocate a gtpv1u message. - * - * @param[in] hGtpuStackHandle : gtpv1u stack handle. - * @param[in] teid : TEID for this message. - * @param[in] seqNumFlag : Sequence number flag for this message. - * @param[in] seqNum : Sequence number for this message. - * @param[in] pTpdu: T-PDU for this message. - * @param[in] tpduLength: T-PDU length for this message. - * @param[out] phMsg : Pointer to message handle. - */ - -NwGtpv1uRcT -nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint32_t teid, - NW_IN uint8_t seqNumFlag, - NW_IN uint16_t seqNum, - NW_IN uint8_t* tpdu, - NW_IN uint16_t tpduLength, - NW_IN uint32_t tpduOffset, - NW_OUT NwGtpv1uMsgHandleT *phMsg); - -/** - * Allocate a gtpv1u message from another gtpv1u message. - * - * @param[in] hGtpuStackHandle : gtpv1u stack handle. - * @param[out] hMsg : Handle to input message. - * @param[out] phMsg : Pointer to message handle. - */ - -NwGtpv1uRcT -nwGtpv1uMsgFromMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uMsgHandleT hMsg, - NW_OUT NwGtpv1uMsgHandleT *phMsg); -/** - * Allocate a gtpv1u message from data buffer. - * - * @param[in] hGtpuStackHandle : gtpv1u stack handle. - * @param[in] pBuf: Buffer to be copied in this message. - * @param[in] bufLen: Buffer length to be copied in this message. - * @param[out] phMsg : Pointer to message handle. - */ - -NwGtpv1uRcT -nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint8_t* pBuf, - NW_IN uint32_t bufLen, - NW_OUT NwGtpv1uMsgHandleT *phMsg); - -/** - * Free a gtpv1u message. - * - * @param[in] hGtpuStackHandle : gtpv1u stack handle. - * @param[in] hMsg : Message handle. - */ - -NwGtpv1uRcT -nwGtpv1uMsgDelete( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uMsgHandleT hMsg); - -/** - * Set TEID for gtpv1u message. - * - * @param[in] hMsg : Message handle. - * @param[in] teid: TEID value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t teid); - -/** - * Set TEID present flag for gtpv1u message. - * - * @param[in] hMsg : Message handle. - * @param[in] teidPesent: Flag boolean value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgSetTeidPresent(NW_IN NwGtpv1uMsgHandleT hMsg, NwBoolT teidPresent); - -/** - * Set sequence for gtpv1u message. - * - * @param[in] hMsg : Message handle. - * @param[in] seqNum: Flag boolean value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t seqNum); - -/** - * Get TEID present for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -uint32_t -nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg); - -/** - * Get TEID present for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -NwBoolT -nwGtpv1uMsgGetTeidPresent(NW_IN NwGtpv1uMsgHandleT hMsg); - -/** - * Get sequence number for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -uint32_t -nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg); - -/** - * Get tpdu for gtpv1u message. - * - * @param[in] hMsg : Message handle. - * @param[inout] pTpduBuf : Buffer to copy the T-PDU. - * @param[out] hMsg : T-PDU length. - */ - -uint32_t -nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, uint8_t* pTpduBuf, uint32_t* pTpduLength); - -uint8_t* -nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg); - -uint32_t -nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg); - -/** - * Add a gtpv1u information element of length 1 to gtpv1u mesasge. - * - * @param[in] hMsg : Handle to gtpv1u message. - * @param[in] type : IE type. - * @param[in] value : IE value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint8_t value); - - -/** - * Add a gtpv1u information element of length 2 to gtpv1u mesasge. - * - * @param[in] hMsg : Handle to gtpv1u message. - * @param[in] type : IE type. - * @param[in] value : IE value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint16_t length, - NW_IN uint16_t value); - - -/** - * Add a gtpv1u information element of length 4 to gtpv1u mesasge. - * - * @param[in] hMsg : Handle to gtpv1u message. - * @param[in] type : IE type. - * @param[in] value : IE value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint16_t length, - NW_IN uint32_t value); - - -/** - * Add a gtpv1u information element of variable length to gtpv1u mesasge. - * - * @param[in] hMsg : Handle to gtpv1u message. - * @param[in] type : IE type. - * @param[in] length : IE length. - * @param[in] value : IE value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint16_t length, - NW_IN uint8_t* pVal); - -/** - * Dump the contents of gtpv1u mesasge. - * - * @param[in] hMsg : Handle to gtpv1u message. - * @param[in] fp: Pointer to output file. - */ - -NwGtpv1uRcT -nwGtpv1uMsgHexDump(NwGtpv1uMsgHandleT hMsg, FILE* fp); - -uint32_t -nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg); - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_TYPES_H__ */ - - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwLog.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwLog.h deleted file mode 100644 index 7215216e68..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwLog.h +++ /dev/null @@ -1,88 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 c * - * G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - - -#ifndef __NW_LOG_H__ -#define __NW_LOG_H__ - -#include - -#include "NwTypes.h" - -/** - * @file NwLog.h - * @brief This header file contains global shared logging definitions. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------- - * Log Level Definitions - *--------------------------------------------------------------------------*/ - -#define NW_LOG_LEVEL_EMER (0) /**< system is unusable */ -#define NW_LOG_LEVEL_ALER (1) /**< action must be taken immediately*/ -#define NW_LOG_LEVEL_CRIT (2) /**< critical conditions */ -#define NW_LOG_LEVEL_ERRO (3) /**< error conditions */ -#define NW_LOG_LEVEL_WARN (4) /**< warning conditions */ -#define NW_LOG_LEVEL_NOTI (5) /**< normal but signification condition */ -#define NW_LOG_LEVEL_INFO (6) /**< informational */ -#define NW_LOG_LEVEL_DEBG (7) /**< debug-level messages */ - -// static -// NwCharT* gLogLevelStr[] = {"EMER", "ALER", "CRIT", "ERRO", "WARN", "NOTI", "INFO", "DEBG"}; - -/*--------------------------------------------------------------------------- - * IPv4 logging macros - *--------------------------------------------------------------------------*/ -#define NW_IPV4_ADDR "%u.%u.%u.%u" -#define NW_IPV4_ADDR_FORMAT(__addr) (uint8_t)((__addr) & 0x000000ff), \ - (uint8_t)(((__addr) & 0x0000ff00) >> 8 ), \ - (uint8_t)(((__addr) & 0x00ff0000) >> 16), \ - (uint8_t)(((__addr) & 0xff000000) >> 24) - -#define NW_IPV4_ADDR_FORMATP(__paddr) (uint8_t)(*((uint8_t*)(__paddr)) & 0x000000ff), \ - (uint8_t)(*((uint8_t*)(__paddr + 1)) & 0x000000ff), \ - (uint8_t)(*((uint8_t*)(__paddr + 2)) & 0x000000ff), \ - (uint8_t)(*((uint8_t*)(__paddr + 3)) & 0x000000ff) - - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_LOG_H__ */ - - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwTypes.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwTypes.h deleted file mode 100644 index aae5c8a95b..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwTypes.h +++ /dev/null @@ -1,78 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 c * - * G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - - -#include -#include - -#ifndef __NW_TYPES_H__ -#define __NW_TYPES_H__ - -/** - * @file NwTypes.h - * @brief This header file contains basic type definitions. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define NW_IN /**< An input argument */ -#define NW_OUT /**< An output argumnet */ -#define NW_INOUT /**< An input and output argument */ - -#define NW_TRUE (1) /**< Truth value */ -#define NW_FALSE (0) /**< False value */ - -typedef signed char NwS8T; /**< Signed 1 byte */ -typedef signed short NwS16T; /**< Signed 2 byte */ -typedef signed int NwS32T; /**< Signed 4 byte */ -typedef signed long long NwS64T; /**< Signed 8 byte */ - -typedef uintptr_t NwPtrT; /**< Use this for generic pointers */ -typedef unsigned int NwHandleT; /**< Use this for generic handles */ - -typedef char NwBoolT; /**< Use this for booleans */ - -typedef char NwCharT; /**< Use this for strings */ - -typedef signed int NwFdT; /**< Use this for file descriptor */ - - -#ifdef __cplusplus -} -#endif - -#endif /* __NW_TYPES_H__ */ - - diff --git a/openair3/GTPV1-U/nw-gtpv1u/shared/NwUtils.h b/openair3/GTPV1-U/nw-gtpv1u/shared/NwUtils.h deleted file mode 100644 index c197ab323e..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/shared/NwUtils.h +++ /dev/null @@ -1,68 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 c * - * G P R S T u n n e l i n g P r o t o c o l v 2 c S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#include - -#ifndef __NW_UTILS_H__ -#define __NW_UTILS_H__ - - -/** - * @file NwUtils.h - * @brief This header file contains utility macro and function definitions. -*/ - -#define NW_ASSERT assert /**< Assertion */ - -#define NW_CHK_NULL_PTR(_ptr) NW_ASSERT(_ptr != NULL) /**< Null pointer check */ - -#define NW_HTONS(x) ( ( ((x) & 0xff00) >> 8 ) | ( ((x) & 0x00ff) << 8 ) ) - -#define NW_HTONL(x) ( ( ((x) & 0xff000000) >> 24 ) | ( ( (x) & 0x00ff0000 ) >> 8 ) | \ - ( ( (x) & 0x0000ff00 ) << 8 ) | ( ( (x) & 0x000000ff) << 24 ) ) - -#define NW_HTONLL(x) ( \ - ( ( ((uint64_t)x) & 0xff00000000000000ULL ) >> 56 ) | ( ( ((uint64_t)x) & 0x00ff000000000000ULL ) >> 40 ) | \ - ( ( ((uint64_t)x) & 0x0000ff0000000000ULL ) >> 24 ) | ( ( ((uint64_t)x) & 0x000000ff00000000ULL ) >> 8 ) | \ - ( ( ((uint64_t)x) & 0x000000000000ff00ULL ) << 40 ) | ( ( ((uint64_t)x) & 0x00000000000000ffULL ) << 56 ) | \ - ( ( ((uint64_t)x) & 0x0000000000ff0000ULL ) << 24 ) | ( ( ((uint64_t)x) & 0x00000000ff000000ULL ) << 8 ) \ - ) - -#define NW_NTOHS NW_HTONS -#define NW_NTOHL NW_HTONL -#define NW_NTOHLL NW_HTONLL - - -#endif /* __NW_UTILS_H__ */ - - diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c deleted file mode 100644 index 0d962cad7d..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c +++ /dev/null @@ -1,1025 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#include -#include -#include - -#include "NwTypes.h" -#include "NwUtils.h" -#include "NwGtpv1uError.h" -#include "NwGtpv1uPrivate.h" -#include "NwGtpv1uTunnelEndPoint.h" -#include "NwGtpv1uTrxn.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uIe.h" -#include "NwGtpv1uLog.h" - -#include "assertions.h" -#include "intertask_interface.h" -#include "msc.h" - -#include "gtpv1u.h" -#if defined(ENB_MODE) -#include "common/utils/LOG/log.h" -#include "common/utils/LOG/vcd_signal_dumper.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -//#define LOG_GTPU 1 -/*--------------------------------------------------------------------------* - * P R I V A T E F U N C T I O N S * - *--------------------------------------------------------------------------*/ - -#define NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE (12) /**< Size of GTPv1u EPC specific header */ -#define NW_GTPV1U_EPC_MIN_HEADER_SIZE (8) - - -void -nwGtpv1uDisplayBanner(void) -{ - printf(" *----------------------------------------------------------------------------*\n"); - printf(" * *\n"); - printf(" * n w - g t p v 2 u *\n"); - printf(" * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k *\n"); - printf(" * *\n"); - printf(" * *\n"); - printf(" * Copyright (c) 2010-2011 Amit Chawre *\n"); - printf(" * All rights reserved. *\n"); - printf(" * *\n"); - printf(" * Redistribution and use in source and binary forms, with or without *\n"); - printf(" * modification, are permitted provided that the following conditions *\n"); - printf(" * are met: *\n"); - printf(" * *\n"); - printf(" * 1. Redistributions of source code must retain the above copyright *\n"); - printf(" * notice, this list of conditions and the following disclaimer. *\n"); - printf(" * 2. Redistributions in binary form must reproduce the above copyright *\n"); - printf(" * notice, this list of conditions and the following disclaimer in the *\n"); - printf(" * documentation and/or other materials provided with the distribution. *\n"); - printf(" * 3. The name of the author may not be used to endorse or promote products *\n"); - printf(" * derived from this software without specific prior written permission. *\n"); - printf(" * *\n"); - printf(" * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *\n"); - printf(" * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *\n"); - printf(" * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *\n"); - printf(" * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *\n"); - printf(" * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *\n"); - printf(" * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *\n"); - printf(" * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *\n"); - printf(" * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *\n"); - printf(" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *\n"); - printf(" * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *\n"); - printf(" *----------------------------------------------------------------------------*\n\n"); - -} -/*--------------------------------------------------------------------------- - * RBTree Search Functions - *--------------------------------------------------------------------------*/ - -static inline NwS32T -nwGtpv1uCompareTeid(struct NwGtpv1uTunnelEndPoint *a, - struct NwGtpv1uTunnelEndPoint *b); - -static inline NwS32T -nwGtpv1uCompareSeqNum(struct NwGtpv1uTrxn *a, struct NwGtpv1uTrxn *b); - -RB_PROTOTYPE(NwGtpv1uOutstandingTxSeqNumTrxnMap, NwGtpv1uTrxn, - outstandingTxSeqNumMapRbtNode, nwGtpv1uCompareSeqNum) -RB_PROTOTYPE(NwGtpv1uOutstandingRxSeqNumTrxnMap, NwGtpv1uTrxn, - outstandingRxSeqNumMapRbtNode, nwGtpv1uCompareSeqNum) -RB_PROTOTYPE(NwGtpv1uTunnelEndPointTMap, NwGtpv1uTunnelEndPoint, - sessionMapRbtNode, nwGtpv1uCompareTeid) -RB_PROTOTYPE(NwGtpv1uTunnelEndPointIdentifierMap, NwGtpv1uTunnelEndPoint, - sessionMapRbtNode, nwGtpv1uCompareTeid) - -RB_GENERATE(NwGtpv1uOutstandingTxSeqNumTrxnMap, NwGtpv1uTrxn, - outstandingTxSeqNumMapRbtNode, nwGtpv1uCompareSeqNum) -RB_GENERATE(NwGtpv1uOutstandingRxSeqNumTrxnMap, NwGtpv1uTrxn, - outstandingRxSeqNumMapRbtNode, nwGtpv1uCompareSeqNum) -RB_GENERATE(NwGtpv1uTunnelEndPointTMap, NwGtpv1uTunnelEndPoint, - sessionMapRbtNode, nwGtpv1uCompareTeid) -RB_GENERATE(NwGtpv1uTunnelEndPointIdentifierMap, NwGtpv1uTunnelEndPoint, - sessionMapRbtNode, nwGtpv1uCompareTeid) - -/** - Comparator funtion for comparing two sessions. - - @param[in] a: Pointer to session a. - @param[in] b: Pointer to session b. - @return An integer greater than, equal to or less than zero according to whether the - object pointed to by a is greater than, equal to or less than the object pointed to by b. - */ - -static inline NwS32T -nwGtpv1uCompareTeid(struct NwGtpv1uTunnelEndPoint *a, - struct NwGtpv1uTunnelEndPoint *b) -{ - if(a->teid > b->teid) { - return 1; - } - - if(a->teid < b->teid) { - return -1; - } - - return 0; -} - -/** - Comparator funtion for comparing two sequence number transactions. - - @param[in] a: Pointer to session a. - @param[in] b: Pointer to session b. - @return An integer greater than, equal to or less than zero according to whether the - object pointed to by a is greater than, equal to or less than the object pointed to by b. - */ - -static inline NwS32T -nwGtpv1uCompareSeqNum(struct NwGtpv1uTrxn *a, struct NwGtpv1uTrxn *b) -{ - if(a->seqNum > b->seqNum) { - return 1; - } - - if(a->seqNum < b->seqNum) { - return -1; - } - - if(a->peerIp > b->peerIp) { - return 1; - } - - if(a->peerIp < b->peerIp) { - return -1; - } - - return 0; -} - -/** - Create and Send GTPU message. - - @param[in] thiz: Stack handle - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, uint32_t peerIp, uint16_t peerPort, - NwGtpv1uMsgT *pMsg) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - uint8_t *msgHdr; - - NW_ASSERT(thiz); - NW_ASSERT(pMsg); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - - msgHdr = &pMsg->msgBuf[pMsg->msgBufOffset]; - NW_ASSERT(msgHdr != NULL); - - *(msgHdr++) = (pMsg->version << 5) | - (pMsg->protocolType << 4) | - (pMsg->extHdrFlag << 2) | - (pMsg->seqNumFlag << 1) | - (pMsg->npduNumFlag); - - *(msgHdr++) = (pMsg->msgType); - *((uint16_t *) msgHdr) = htons(pMsg->msgLen); - msgHdr += 2; - - *((uint32_t *) msgHdr) = htonl(pMsg->teid); - msgHdr += 4; -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("nwGtpv1uCreateAndSendMsg to teid %u length %d offset %d\n", - pMsg->teid, - pMsg->msgLen, - pMsg->msgBufOffset); -#endif - - if(pMsg->seqNumFlag || pMsg->extHdrFlag || pMsg->npduNumFlag) { - *((uint16_t *) msgHdr) = (pMsg->seqNumFlag ? htons(pMsg->seqNum) : 0x0000); - msgHdr += 2; - - *((uint8_t *) msgHdr) = (pMsg->npduNumFlag ? htons(pMsg->npduNum) : 0x00); - msgHdr++; - - *((uint8_t *) msgHdr) = (pMsg->extHdrFlag ? htons(pMsg->nextExtHdrType) : 0x00); - msgHdr++; - } - - rc = thiz->udp.udpDataReqCallback(thiz->udp.hUdp, - pMsg->msgBuf, - pMsg->msgBufLen, - pMsg->msgBufOffset, - peerIp, - peerPort); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -/** - * Send GTPv1u Message Indication to ULP entity. - * - * @param[in] hGtpuStackHandle : Stack handle - * @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uSendUlpMessageIndication( NW_IN NwGtpv1uStackT *thiz, - NW_IN uint32_t hUlpTrxn, - NW_IN uint32_t apiType, - NW_IN uint32_t msgType, - NW_IN uint32_t peerIp, - NW_IN uint16_t peerPort, - NW_IN uint8_t *pMsgBuf, - NW_IN uint16_t msgLength) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uUlpApiT ulpApi; - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - - ulpApi.apiType = apiType; - ulpApi.apiInfo.recvMsgInfo.msgType = msgType; - ulpApi.apiInfo.recvMsgInfo.hUlpTrxn = hUlpTrxn; - ulpApi.apiInfo.recvMsgInfo.peerIp = peerIp; - ulpApi.apiInfo.recvMsgInfo.peerPort = peerPort; - - if(pMsgBuf && msgLength) { - rc = nwGtpv1uMsgFromBufferNew((NwGtpv1uStackHandleT)thiz, pMsgBuf, msgLength, - &(ulpApi.apiInfo.recvMsgInfo.hMsg)); - NW_ASSERT(rc == NW_GTPV1U_OK); - } - - rc = thiz->ulp.ulpReqCallback(thiz->ulp.hUlp, &ulpApi); - NW_ASSERT(rc == NW_GTPV1U_OK); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - - return rc; -} - -NwGtpv1uRcT -nwGtpv1uPeerRspTimeout(void *arg) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uTrxnT *thiz; - NwGtpv1uTimeoutInfoT *timeoutInfo = arg; - - GTPU_WARNING( "Retransmission timer expired\n"); - - thiz = ((NwGtpv1uTrxnT *)timeoutInfo->timeoutArg); - rc = thiz->pStack->udp.udpDataReqCallback(thiz->pStack->udp.hUdp, - thiz->pMsg->msgBuf, - thiz->pMsg->msgLen, - thiz->pMsg->msgBufOffset, - thiz->peerIp, - thiz->peerPort); - - if(thiz->maxRetries) { - rc = thiz->pStack->tmrMgr.tmrStartCallback(thiz->pStack->tmrMgr.tmrMgrHandle, - 5, 0, NW_GTPV1U_TMR_TYPE_ONE_SHOT, (void *)timeoutInfo, &thiz->hRspTmr); - thiz->maxRetries--; - } else { - /* Inform session layer about path fialure */ - GTPU_WARNING("Max retries over!\n"); - } - - return rc; -} - -/*--------------------------------------------------------------------------- - * ULP API Processing Functions - *--------------------------------------------------------------------------*/ - -/** - Process NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT Request from ULP entity. - - @param[in] hGtpuStackHandle : Stack handle - @param[in] pUlpReq : Pointer to Ulp Req. - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -NwGtpv1uCreateTunnelEndPoint( NW_IN NwGtpv1uStackT *thiz, - NW_IN uint32_t teid, - NW_IN NwGtpv1uUlpSessionHandleT hUlpSession, - NW_OUT NwGtpv1uStackSessionHandleT *phStackSession ) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uTunnelEndPointT *pTunnelEndPoint; - NwGtpv1uTunnelEndPointT *pCollision; - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - pTunnelEndPoint = nwGtpTunnelEndPointNew(thiz); - - if(pTunnelEndPoint) { - - pTunnelEndPoint->teid = teid; - pTunnelEndPoint->pStack = thiz; - pTunnelEndPoint->hUlpSession = hUlpSession; - - pCollision = RB_INSERT(NwGtpv1uTunnelEndPointIdentifierMap, &(thiz->teidMap), - pTunnelEndPoint); - - if(pCollision) { - GTPU_ERROR("Tunnel end-point cannot be created for teid 0x%x. " - "Tunnel already exists", teid); - rc = nwGtpTunnelEndPointDestroy(thiz, pTunnelEndPoint); - NW_ASSERT(rc == NW_GTPV1U_OK); - *phStackSession = (NwGtpv1uStackSessionHandleT) NULL; - NW_ASSERT(0); - rc = NW_GTPV1U_FAILURE; - } else { - *phStackSession = (NwGtpv1uStackSessionHandleT) pTunnelEndPoint; - pTunnelEndPoint = RB_FIND(NwGtpv1uTunnelEndPointIdentifierMap, - &(thiz->teidMap), pTunnelEndPoint); - //NW_ASSERT(pTunnelEndPoint); - if (!pTunnelEndPoint) { - GTPU_ERROR("Tunnel end-point cannot be NULL"); - rc = NW_GTPV1U_FAILURE; - } else { - GTPU_DEBUG("Tunnel end-point 0x%p creation successful for teid 0x%x %u(dec)", - pTunnelEndPoint, (unsigned int)teid, (unsigned int)teid); - } - } - - } else { - *phStackSession = (NwGtpv1uStackSessionHandleT) NULL; - rc = NW_GTPV1U_FAILURE; - } - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -/** - Process NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT Request from ULP entity. - - @param[in] hGtpuStackHandle : Stack handle - @param[in] pUlpReq : Pointer to Ulp Req. - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uDestroyTunnelEndPoint( NwGtpv1uStackT *thiz, - NW_IN NwGtpv1uUlpApiT *pUlpReq) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uTunnelEndPointT *pRemovedTeid; - - if(pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle) { - GTPU_DEBUG( "Destroying Tunnel end-point '%lx'", - pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle); - pRemovedTeid = RB_REMOVE(NwGtpv1uTunnelEndPointIdentifierMap, &(thiz->teidMap), - (NwGtpv1uTunnelEndPointT *)( - pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle)); - - NW_ASSERT(pRemovedTeid == (NwGtpv1uTunnelEndPointT *)( - pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle)); - - rc = nwGtpTunnelEndPointDestroy(thiz, - (NwGtpv1uTunnelEndPointT *) - pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle); - } else { - GTPU_WARNING("Non-existent Tunnel end-point handle '%lx'", - pUlpReq->apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle); - } - - return rc; -} - -/** - Process NW_GTPV1U_ULP_API_INITIAL_REQ Request from ULP entity. - - @param[in] hGtpuStackHandle : Stack handle - @param[in] pUlpReq : Pointer to Ulp Req. - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uInitialReq( NW_IN NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uTrxnT *pTrxn; - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - /* Create New Transaction */ - rc = nwGtpv1uTrxnNew(thiz, &pTrxn); - - if(pTrxn) { - rc = nwGtpv1uTrxnCreateAndSendMsg(thiz, - pTrxn, - pUlpReq->apiInfo.initialReqInfo.peerIp, - pUlpReq->apiInfo.initialReqInfo.peerPort, - (NwGtpv1uMsgT *) pUlpReq->hMsg); - - if(rc == NW_GTPV1U_OK) { - /* Insert into search tree */ - RB_INSERT(NwGtpv1uOutstandingTxSeqNumTrxnMap, &(thiz->outstandingTxSeqNumMap), - pTrxn); - } else { - rc = nwGtpv1uTrxnDelete(&pTrxn); - NW_ASSERT(rc == NW_GTPV1U_OK); - } - } - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -/** - Process NW_GTPV1U_ULP_API_SEND_TPDU Request from ULP entity. - - @param[in] thiz: Stack handle - @param[in] pUlpReq : Pointer to Ulp Req. - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uSendto( NwGtpv1uStackT *thiz, NW_IN NwGtpv1uUlpApiT *pUlpReq) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - - NW_ASSERT(thiz); -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - - (void) nwGtpv1uMsgSetTeid(pUlpReq->apiInfo.sendtoInfo.hMsg, - pUlpReq->apiInfo.sendtoInfo.teid); - - rc = nwGtpv1uCreateAndSendMsg(thiz, - pUlpReq->apiInfo.sendtoInfo.ipAddr, - 2152, - (NwGtpv1uMsgT *) (NwGtpv1uMsgT *) pUlpReq->apiInfo.sendtoInfo.hMsg); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -/** - Process GPDU from UDP entity. - - @param[in] thiz: Stack handle - @param[in] pUlpReq : Pointer to Ulp Req. - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, - NW_IN uint8_t *gpdu, - NW_IN uint32_t gpduLen, - NW_IN uint32_t peerIp) - -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uMsgHeaderT *msgHdr = NULL; - NwGtpv1uTunnelEndPointT *pTunnelEndPoint = NULL; - NwGtpv1uTunnelEndPointT tunnelEndPointKey; - // uint16_t hdr_len = 0; - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - - // no buffer offset - msgHdr = (NwGtpv1uMsgHeaderT *) gpdu; - - tunnelEndPointKey.teid = ntohl(msgHdr->teid); - - pTunnelEndPoint = RB_FIND(NwGtpv1uTunnelEndPointIdentifierMap, - &(thiz->teidMap), &tunnelEndPointKey); - - if(pTunnelEndPoint) { - NwGtpv1uMsgHandleT hMsg; - - rc = nwGtpv1uMsgFromBufferNew( (NwGtpv1uStackHandleT)thiz, - (uint8_t *)gpdu, - gpduLen, - &hMsg); - - /* - uint8_t* msgBuf; - uint32_t msgBufLen; - uint32_t msgBufOffset; - */ - if(NW_GTPV1U_OK == rc) { - NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("Received T-PDU over tunnel end-point '%x' of size %u (%u) (decapsulated %u)from "NW_IPV4_ADDR"\n", - ntohl(msgHdr->teid), gpduLen, pMsg->msgLen, pMsg->msgBufLen, NW_IPV4_ADDR_FORMAT((peerIp))); -#endif - MSC_LOG_RX_MESSAGE( - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, - NULL, - 0, - " G-PDU ltid %u size %u", - tunnelEndPointKey.teid, - gpduLen); - - rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg); - } - } else { - MSC_LOG_RX_DISCARDED_MESSAGE( - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, - NULL, - 0, - " G-PDU ltid %u size %u", - tunnelEndPointKey.teid, - gpduLen); - GTPU_DEBUG("Received T-PDU over non-existent tunnel end-point '%x' from "NW_IPV4_ADDR"\n", - ntohl(msgHdr->teid), NW_IPV4_ADDR_FORMAT((peerIp))); - } - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -/** - Handle Echo Request from Peer Entity. - - @param[in] thiz : Stack context - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz, - NW_IN uint8_t *msgBuf, - NW_IN uint32_t msgBufLen, - NW_IN uint16_t peerPort, - NW_IN uint32_t peerIp) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - uint16_t seqNum = 0; - NwGtpv1uMsgHandleT hMsg = 0; - int bufLen = 0; - - seqNum = ntohs(*(uint16_t *) (msgBuf + (((*msgBuf) & 0x02) ? 8 : 4))); - - MSC_LOG_RX_MESSAGE( - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" ECHO-REQ seq %u size %u", - 0,0,seqNum, msgBufLen); - /* Send Echo Response */ - - rc = nwGtpv1uMsgNew( (NwGtpv1uStackHandleT)thiz, - NW_TRUE, /* SeqNum flag */ - NW_FALSE, - NW_FALSE, - NW_GTP_ECHO_RSP, /* Msg Type */ - 0x00000000U, /* TEID */ - seqNum, /* Seq Number */ - 0, - 0, - (&hMsg)); - - bufLen = sizeof(NwGtpv1uIeTv1T)+ ((NwGtpv1uMsgT*)hMsg)->msgLen; - -//#warning CROUX DIRTY +16, TO BE FIXED!!! - /* the +16 is there because by analyzing memory allocation with some external - * tool, I saw that there were 6 bytes accessed after bufLen in nwGtpv1uCreateAndSendMsg - * the value "16" has been chosen arbitrarily, just bigger than 6 - */ - ((NwGtpv1uMsgT*)hMsg)->msgBuf = itti_malloc( - TASK_GTPV1_U, - TASK_UDP, - bufLen + 16 /* CROUX - dirty +16, to be fixed! */); - ((NwGtpv1uMsgT*)hMsg)->msgBufLen = bufLen; - NW_ASSERT(NW_GTPV1U_OK == rc); - - /* - * The Restart Counter value in the Recovery information element shall - * not be used, i.e. it shall be set to zero by the sender and shall be - * ignored by the receiver. - */ - rc = nwGtpv1uMsgAddIeTV1(hMsg, NW_GTPV1U_IE_RECOVERY, 0x00); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_INFO("Sending NW_GTP_ECHO_RSP message to %x:%x with seq %u\n", - peerIp, - peerPort, - seqNum); -#endif - MSC_LOG_TX_MESSAGE( - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_ENB:MSC_GTPU_SGW, - (thiz->stackType == GTPU_STACK_ENB) ? MSC_GTPU_SGW:MSC_GTPU_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" ECHO-RSP seq %u", - 0,0,seqNum); - rc = nwGtpv1uCreateAndSendMsg( - thiz, - peerIp, - peerPort, - (NwGtpv1uMsgT *) hMsg); - - rc = nwGtpv1uMsgDelete((NwGtpv1uStackHandleT)thiz, hMsg); - NW_ASSERT(NW_GTPV1U_OK == rc); - - return rc; -} - -/*--------------------------------------------------------------------------* - * P U B L I C F U N C T I O N S * - *--------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- - * Constructor - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle, uint32_t stackType) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz; - - thiz = (NwGtpv1uStackT *) malloc( sizeof(NwGtpv1uStackT)); - - if(thiz) { - memset(thiz, 0, sizeof(NwGtpv1uStackT)); - thiz->id = (NwPtrT)thiz; - thiz->stackType = stackType; - thiz->seq = (uint16_t) ((uintptr_t)thiz) ; // FIXME interesting casts... don't know what this is good for... - RB_INIT(&(thiz->outstandingTxSeqNumMap)); - RB_INIT(&(thiz->outstandingRxSeqNumMap)); - RB_INIT(&(thiz->sessionMap)); - RB_INIT(&(thiz->teidMap)); - - if (0 == 1) { - nwGtpv1uDisplayBanner(); - } - - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - - *hGtpuStackHandle = (NwGtpv1uStackHandleT) thiz; - return rc; -} - - -/*--------------------------------------------------------------------------- - * Destructor - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwGtpv1uFinalize( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - - if(hGtpuStackHandle) { - free((void *)hGtpuStackHandle); - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - return rc; -} - - -/*--------------------------------------------------------------------------- - * Configuration Get/Set - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwGtpv1uSetUlpEntity( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uUlpEntityT *pUlpEntity) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - if(pUlpEntity) { - thiz->ulp = *(pUlpEntity); - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - return rc; -} - - -NwGtpv1uRcT -nwGtpv1uSetUdpEntity( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uUdpEntityT *pUdpEntity) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - if(pUdpEntity) { - thiz->udp = *(pUdpEntity); - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - return rc; -} - -NwGtpv1uRcT -nwGtpv1uSetMemMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uMemMgrEntityT *pMemMgrEntity) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - if(pMemMgrEntity) { - thiz->memMgr = *(pMemMgrEntity); - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - return rc; -} - - -NwGtpv1uRcT -nwGtpv1uSetTimerMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uTimerMgrEntityT *pTmrMgrEntity) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - if(pTmrMgrEntity) { - thiz->tmrMgr = *(pTmrMgrEntity); - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - return rc; -} - - -NwGtpv1uRcT -nwGtpv1uSetLogMgrEntity( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uLogMgrEntityT *pLogMgrEntity) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - if(pLogMgrEntity) { - thiz->logMgr = *(pLogMgrEntity); - rc = NW_GTPV1U_OK; - } else { - rc = NW_GTPV1U_FAILURE; - } - - return rc; -} - -NwGtpv1uRcT -nwGtpv1uSetLogLevel( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint32_t logLevel) -{ - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - thiz->logLevel = logLevel; - return NW_GTPV1U_OK; -} - -/*--------------------------------------------------------------------------- - * Process Request from Udp Layer - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint8_t *udpData, - NW_IN uint32_t udpDataLen, - NW_IN uint16_t peerPort, - NW_IN uint32_t peerIp) -{ - NwGtpv1uRcT ret = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz; - uint16_t msgType; - -#if defined(ENB_MODE) - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_UDP_REQ, VCD_FUNCTION_IN); -#endif - thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - NW_ASSERT(thiz); - - msgType = *((uint8_t *)(udpData + 1)); - - switch(msgType) { - case NW_GTP_ECHO_REQ: - GTPU_DEBUG("NW_GTP_ECHO_REQ\n"); - ret = nwGtpv1uHandleEchoReq( thiz, udpData, udpDataLen, peerPort, peerIp); - break; - - case NW_GTP_ERROR_INDICATION: - GTPU_DEBUG("NW_GTP_ERROR_INDICATION\n"); - ret = nwGtpv1uSendUlpMessageIndication( thiz, - 0, - NW_GTPV1U_ULP_API_RECV_MSG, - msgType, - peerIp, - peerPort, - udpData, - udpDataLen); - - NW_ASSERT(ret == NW_GTPV1U_OK); - break; - - case NW_GTP_ECHO_RSP: - GTPU_DEBUG("NW_GTP_ECHO_RSP\n"); - ret = NW_GTPV1U_OK; - break; - - case NW_GTP_GPDU: -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("NW_GTP_GPDU: DATA COMING FROM UDP\n"); -#endif - ret = nwGtpv1uProcessGpdu(thiz, udpData, udpDataLen, peerIp); - break; - - case NW_GTP_END_MARKER: -#if defined(LOG_GTPU) && LOG_GTPU > 0 - for(int i =1; i<= udpDataLen; i++){ - printf("%02x ", (uint8_t)udpData[i-1]); - if(i % 20 == 0)printf("\n"); - } -#endif - GTPU_INFO("NW_GTP_END_MARKER\n"); - ret = nwGtpv1uProcessGpdu(thiz, udpData, udpDataLen, peerIp); - break; - - default: - ret = NW_GTPV1U_FAILURE; - NW_ASSERT(0); - break; - } - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif -#if defined(ENB_MODE) - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_UDP_REQ, VCD_FUNCTION_OUT); -#endif - return ret; -} - - -/*--------------------------------------------------------------------------- - * Process Request from Upper Layer - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uUlpApiT *pUlpReq) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz = (NwGtpv1uStackT *) hGtpuStackHandle; - - NW_ASSERT(thiz); - NW_ASSERT(pUlpReq != NULL); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - - switch(pUlpReq->apiType) { - case NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT: { - GTPU_DEBUG("Received NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT from ulp\n"); - rc = NwGtpv1uCreateTunnelEndPoint(thiz, - pUlpReq->apiInfo.createTunnelEndPointInfo.teid, - pUlpReq->apiInfo.createTunnelEndPointInfo.hUlpSession, - &(pUlpReq->apiInfo.createTunnelEndPointInfo.hStackSession)); - } - break; - - case NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT: { - GTPU_DEBUG("Received destroy session req from ulp\n"); - rc = nwGtpv1uDestroyTunnelEndPoint(thiz, pUlpReq); - } - break; - - case NW_GTPV1U_ULP_API_INITIAL_REQ: { - GTPU_DEBUG("Received initial req from ulp\n"); - rc = nwGtpv1uInitialReq(thiz, pUlpReq); - } - break; - - case NW_GTPV1U_ULP_API_SEND_TPDU: { -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("Received send tpdu req from ulp\n"); -#endif - rc = nwGtpv1uSendto(thiz, pUlpReq); - } - break; - - default: - GTPU_DEBUG("Unsupported API received from ulp\n"); - rc = NW_GTPV1U_FAILURE; - break; - } - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -/*--------------------------------------------------------------------------- - * Process Timer timeout Request from Timer Manager - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwGtpv1uProcessTimeout(void *timeoutInfo) -{ - NwGtpv1uRcT rc = NW_GTPV1U_FAILURE; - NwGtpv1uStackT *thiz; - - NW_ASSERT(timeoutInfo != NULL); - - thiz = (NwGtpv1uStackT *) (((NwGtpv1uTimeoutInfoT *) timeoutInfo)->hStack); - - NW_ASSERT(thiz != NULL); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_ENTER(thiz); -#endif - GTPU_DEBUG("Received timeout event from ULP with timeoutInfo 0x%p!\n", - timeoutInfo); - - rc = (((NwGtpv1uTimeoutInfoT *) timeoutInfo)->timeoutCallbackFunc) (timeoutInfo); - -#if defined(LOG_GTPU) && LOG_GTPU > 0 - NW_LEAVE(thiz); -#endif - return rc; -} - -#ifdef __cplusplus -} -#endif - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ - diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c deleted file mode 100644 index 365d6d23a5..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c +++ /dev/null @@ -1,558 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#include -#include -#include - -#include "NwTypes.h" -#include "NwLog.h" -#include "NwUtils.h" -#include "NwGtpv1uLog.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uPrivate.h" -#include "NwGtpv1uMsg.h" -#include "assertions.h" - -#include "gtpv1u.h" -#if defined(ENB_MODE) -#include "common/utils/LOG/log.h" -#endif - -#define NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE (12) /**< Size of GTPv1u EPC specific header */ -#define NW_GTPV1U_EPC_MIN_HEADER_SIZE (8) - -#ifdef __cplusplus -extern "C" { -#endif - -static NwGtpv1uMsgT *gpGtpv1uMsgPool = NULL; - -NwGtpv1uRcT -nwGtpv1uMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint8_t seqNumFlag, - NW_IN uint8_t npduNumFlag, - NW_IN uint8_t extHdrFlag, - NW_IN uint8_t msgType, - NW_IN uint8_t teid, - NW_IN uint16_t seqNum, - NW_IN uint8_t npduNum, - NW_IN uint8_t nextExtHeader, - NW_OUT NwGtpv1uMsgHandleT *phMsg) -{ - NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle; - NwGtpv1uMsgT *pMsg; - - if(gpGtpv1uMsgPool) { - pMsg = gpGtpv1uMsgPool; - gpGtpv1uMsgPool = gpGtpv1uMsgPool->next; - } else { - NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *); - } - - - if(pMsg) { - pMsg->version = NW_GTPU_VERSION; - pMsg->protocolType = NW_GTP_PROTOCOL_TYPE_GTP; - pMsg->seqNumFlag = seqNumFlag; - pMsg->npduNumFlag = npduNumFlag; - pMsg->extHdrFlag = extHdrFlag; - pMsg->msgType = msgType; - - if(seqNumFlag) { - pMsg->seqNum = seqNum; - } - - if(npduNumFlag) { - pMsg->npduNum = npduNum; - } - - if(extHdrFlag) { - pMsg->nextExtHdrType = nextExtHeader; - } - - pMsg->msgLen = ((pMsg->seqNumFlag || pMsg->npduNumFlag - || pMsg->extHdrFlag) ? - 4 : 0); - //NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE : (NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE - 4)); - - pMsg->msgBuf = NULL; - pMsg->msgBufLen = 0; - pMsg->msgBufOffset = 0; - *phMsg = (NwGtpv1uMsgHandleT) pMsg; - return NW_GTPV1U_OK; - } - - return NW_GTPV1U_FAILURE; -} - -NwGtpv1uRcT -nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint32_t teid, - NW_IN uint8_t seqNumFlag, - NW_IN uint16_t seqNum, - NW_IN uint8_t *tpdu, - NW_IN uint16_t tpduLength, - NW_IN uint32_t tpduOffset, - NW_OUT NwGtpv1uMsgHandleT *phMsg) -{ - NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle; - NwGtpv1uMsgT *pMsg; - //uint32_t header_len = 0; - uint32_t msgExtraLen = 0; - - if(gpGtpv1uMsgPool) { - pMsg = gpGtpv1uMsgPool; - gpGtpv1uMsgPool = gpGtpv1uMsgPool->next; - } else { - NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *); - } - - if(pMsg) { - msgExtraLen = (((seqNumFlag) || (NW_FALSE) || (NW_FALSE) ) ? - (NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE - NW_GTPV1U_EPC_MIN_HEADER_SIZE) : 0); - AssertFatal((msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE) <= tpduOffset, - "Mismatch GTPU len, msgExtraLen %u tpduOffset %u", - msgExtraLen, - (uint32_t) tpduOffset); - pMsg->msgBuf = tpdu; - pMsg->msgBufLen = tpduLength + msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE; - pMsg->msgBufOffset = tpduOffset - (msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE); -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("MSG length %u, offset %u -> length %u offset %u\n", - tpduLength, tpduOffset, - pMsg->msgBufLen, pMsg->msgBufOffset); -#endif - - // Version field: This field is used to determine the version of the GTP-U protocol. - // The version number shall be set to '1'. - pMsg->version = NW_GTPU_VERSION; - // Protocol Type (PT): This bit is used as a protocol discriminator between GTP (when PT is '1') - // and GTP' (when PT is '0'). GTP is described in this document and the GTP' protocol in 3GPP TS 32.295 [8]. - // Note that the interpretation of the header fields may be different in GTP' than in GTP. - pMsg->protocolType = NW_GTP_PROTOCOL_TYPE_GTP; - // Extension Header flag (E): This flag indicates the presence of a meaningful value of the Next Extension - // Header field. When it is set to '0', the Next Extension Header field either is not present or, if present, - // shall not be interpreted. - pMsg->extHdrFlag = NW_FALSE; - // Sequence number flag (S): This flag indicates the presence of a meaningful value of the Sequence Number field. - // When it is set to '0', the Sequence Number field either is not present or, if present, shall not be interpreted. - // When it is set to '1', the Sequence Number field is present, and shall be interpreted, as described below in - // this section. - // For the Echo Request, Echo Response, Error Indication and Supported Extension Headers Notification - // messages, the S flag shall be set to '1'. Since the use of Sequence Numbers is optional for G-PDUs, the PGW, - // SGW, ePDG and eNodeB should set the flag to '0'. However, when a G-PDU (T-PDU+header) is being relayed - // by the Indirect Data Forwarding for Inter RAT HO procedure, then if the received G-PDU has the S flag set to - // '1', then the relaying entity shall set S flag to '1' and forward the G-PDU (T-PDU+header). In an End marker - // message the S flag shall be set to '0'. - pMsg->seqNumFlag = (seqNumFlag? NW_TRUE : NW_FALSE); - pMsg->seqNum = seqNum; - // N-PDU Number flag (PN): This flag indicates the presence of a meaningful value of the N-PDU Number field. - // When it is set to '0', the N-PDU Number field either is not present, or, if present, shall not be interpreted. - // When it is set to '1', the N-PDU Number field is present, and shall be interpreted. - pMsg->npduNumFlag = NW_FALSE; - pMsg->npduNum = 0x00; - // Message Type: This field indicates the type of GTP-U message. - pMsg->msgType = NW_GTP_GPDU; - // Length: This field indicates the length in octets of the payload, i.e. the rest of the packet following the - // mandatory part of the GTP header (that is the first 8 octets). - // The Sequence Number, the N-PDU Number or any Extension headers shall be considered to be part of the payload, - // i.e. included in the length count. - //header_len = ((pMsg->seqNumFlag || pMsg->npduNumFlag || pMsg->extHdrFlag ) ? - // NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE : NW_GTPV1U_EPC_MIN_HEADER_SIZE); - pMsg->msgLen = msgExtraLen + tpduLength; - - // Tunnel Endpoint Identifier (TEID): This field unambiguously identifies a tunnel endpoint in the receiving - // GTP-U protocol entity. The receiving end side of a GTP tunnel locally assigns the TEID value the transmitting - // side has to use. The TEID shall be used by the receiving entity to find the PDP context, except for the - // following cases: - // - The Echo Request/Response and Supported Extension Headers notification messages, where the Tunnel - // Endpoint Identifier shall be set to all zeroes. - // - The Error Indication message where the Tunnel Endpoint Identifier shall be set to all zeros. - pMsg->teid = teid; - pMsg->nextExtHdrType= 0x00; - - //memcpy(pMsg->msgBuf + header_len, tpdu, tpduLength); - *phMsg = (NwGtpv1uMsgHandleT) pMsg; - return NW_GTPV1U_OK; - } - - return NW_GTPV1U_FAILURE; -} - -NwGtpv1uRcT -nwGtpv1uMsgFromMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uMsgHandleT hMsg, - NW_OUT NwGtpv1uMsgHandleT *phMsg) -{ - NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle; - NwGtpv1uMsgT *pMsg; - - if(gpGtpv1uMsgPool) { - pMsg = gpGtpv1uMsgPool; - gpGtpv1uMsgPool = gpGtpv1uMsgPool->next; - } else { - NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *); - } - - - if(pMsg) { - memcpy(pMsg, (NwGtpv1uMsgT *)hMsg, sizeof(NwGtpv1uMsgT)); - *phMsg = (NwGtpv1uMsgHandleT) pMsg; - return NW_GTPV1U_OK; - } - - return NW_GTPV1U_FAILURE; -} - -NwGtpv1uRcT -nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN uint8_t *pBuf, - NW_IN uint32_t bufLen, - NW_OUT NwGtpv1uMsgHandleT *phMsg) -{ - NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle; - NwGtpv1uMsgT *pMsg; - - if(gpGtpv1uMsgPool) { - pMsg = gpGtpv1uMsgPool; - gpGtpv1uMsgPool = gpGtpv1uMsgPool->next; - } else { - NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *); - } - - - if(pMsg) { - pMsg->msgBuf = pBuf; - - pMsg->version = ((*pBuf) & 0xE0) >> 5; - pMsg->protocolType = ((*pBuf) & 0x10) >> 4; - pMsg->extHdrFlag = ((*pBuf) & 0x04) >> 2; - pMsg->seqNumFlag = ((*pBuf) & 0x02) >> 1; - pMsg->npduNumFlag = ((*pBuf) & 0x01); - pBuf++; - - pMsg->msgType = *(pBuf); - pBuf++; - - pBuf += 2; - - pMsg->teid = ntohl(*((uint32_t *)pBuf)); - pBuf += 4; - - if(pMsg->extHdrFlag || pMsg->seqNumFlag || pMsg->npduNumFlag) { - pMsg->seqNum = ntohs(*(((uint16_t *)pBuf))); - pBuf += 2; - pMsg->npduNum = *(pBuf++); - pMsg->nextExtHdrType = *(pBuf++); - } - - pMsg->msgBufOffset = (uint32_t)(pBuf - pMsg->msgBuf); - pMsg->msgBufLen = bufLen - pMsg->msgBufOffset; - pMsg->msgLen = bufLen; -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("nwGtpv1uMsgFromBufferNew() msgLen %u msgBufLen %u msgBufOffset %u ", - pMsg->msgLen, pMsg->msgBufLen, pMsg->msgBufOffset); -#endif - *phMsg = (NwGtpv1uMsgHandleT) pMsg; - return NW_GTPV1U_OK; - } - - return NW_GTPV1U_FAILURE; -} - -NwGtpv1uRcT -nwGtpv1uMsgDelete( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, - NW_IN NwGtpv1uMsgHandleT hMsg) -{ - ((NwGtpv1uMsgT *)hMsg)->next = gpGtpv1uMsgPool; - gpGtpv1uMsgPool = (NwGtpv1uMsgT *) hMsg; - return NW_GTPV1U_OK; -} - -/** - * Set TEID for gtpv1u message. - * - * @param[in] hMsg : Message handle. - * @param[in] teid: TEID value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgSetTeid(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t teid) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - thiz->teid = teid; -#if defined(LOG_GTPU) && LOG_GTPU > 0 - GTPU_DEBUG("nwGtpv1uMsgSetTeid() teid %u", teid); -#endif - return NW_GTPV1U_OK; -} - -/** - * Set sequence for gtpv1u message. - * - * @param[in] hMsg : Message handle. - * @param[in] seqNum: Flag boolean value. - */ - -NwGtpv1uRcT -nwGtpv1uMsgSetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg, uint32_t seqNum) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - thiz->seqNum = seqNum; - return NW_GTPV1U_OK; -} - -/** - * Get TEID present for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -uint32_t -nwGtpv1uMsgGetTeid(NW_IN NwGtpv1uMsgHandleT hMsg) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - return (thiz->teid); -} - - -/** - * Get sequence number for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -uint32_t -nwGtpv1uMsgGetSeqNumber(NW_IN NwGtpv1uMsgHandleT hMsg) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - return (thiz->seqNum); -} - -/** - * Get msg type for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -uint32_t -nwGtpv1uMsgGetMsgType(NW_IN NwGtpv1uMsgHandleT hMsg) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - return (thiz->msgType); -} - -/** - * Get tpdu for gtpv1u message. - * - * @param[in] hMsg : Message handle. - */ - -NwGtpv1uRcT -nwGtpv1uMsgGetTpdu(NW_IN NwGtpv1uMsgHandleT hMsg, uint8_t *pTpduBuf, - uint32_t *pTpduLength) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - uint8_t headerLength = ((thiz->seqNumFlag || thiz->extHdrFlag - || thiz->npduNumFlag) ? 12 : 8); - - *pTpduLength = thiz->msgLen - headerLength; - memcpy(pTpduBuf, thiz->msgBuf + headerLength, *pTpduLength); - return NW_GTPV1U_OK; -} - -uint8_t * -nwGtpv1uMsgGetTpduHandle(NW_IN NwGtpv1uMsgHandleT hMsg) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - return (thiz->msgBuf + ((thiz->seqNumFlag || thiz->extHdrFlag - || thiz->npduNumFlag) ? 12 : 8)); -} - -uint32_t -nwGtpv1uMsgGetTpduLength(NW_IN NwGtpv1uMsgHandleT hMsg) -{ - NwGtpv1uMsgT *thiz = (NwGtpv1uMsgT *) hMsg; - return (thiz->msgLen - ((thiz->seqNumFlag || thiz->extHdrFlag - || thiz->npduNumFlag) ? 12 : 8)); -} - -NwGtpv1uRcT -nwGtpv1uMsgAddIeTV1(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint8_t value) -{ - NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; - NwGtpv1uIeTv1T *pIe; - - pIe = (NwGtpv1uIeTv1T *) (pMsg->msgBuf + pMsg->msgLen); - - pIe->t = type; - pIe->v = value; - - pMsg->msgLen += sizeof(NwGtpv1uIeTv1T); - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwGtpv1uMsgAddIeTV2(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint16_t length, - NW_IN uint16_t value) -{ - NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; - NwGtpv1uIeTv2T *pIe; - - pIe = (NwGtpv1uIeTv2T *) (pMsg->msgBuf + pMsg->msgLen); - - pIe->t = type; - pIe->v = htons(value); - - pMsg->msgLen += sizeof(NwGtpv1uIeTv2T); - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwGtpv1uMsgAddIeTV4(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint16_t length, - NW_IN uint32_t value) -{ - NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; - NwGtpv1uIeTv4T *pIe; - - pIe = (NwGtpv1uIeTv4T *) (pMsg->msgBuf + pMsg->msgLen); - - pIe->t = type; - pIe->v = htonl(value); - - pMsg->msgLen += sizeof(NwGtpv1uIeTv4T); - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwGtpv1uMsgAddIe(NW_IN NwGtpv1uMsgHandleT hMsg, - NW_IN uint8_t type, - NW_IN uint16_t length, - NW_IN uint8_t *pVal) -{ - NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; - NwGtpv1uIeTlvT *pIe; - - pIe = (NwGtpv1uIeTlvT *) (pMsg->msgBuf + pMsg->msgLen); - - pIe->t = type; - pIe->l = htons(length); - - memcpy(pIe + 4, pVal, length); - pMsg->msgLen += (4 + length); - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwGtpv1uMsgHexDump(NwGtpv1uMsgHandleT hMsg, FILE *fp) -{ - - NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg; - uint8_t *data = pMsg->msgBuf; - uint32_t size = pMsg->msgLen; - - unsigned char *p = (unsigned char *)data; - unsigned char c; - int n; - char bytestr[4] = {0}; - char addrstr[10] = {0}; - char hexstr[ 16*3 + 5] = {0}; - char charstr[16*1 + 5] = {0}; - fprintf((FILE *)fp, "\n"); - - for(n=1; n<=size; n++) { - if (n%16 == 1) { - /* store address for this line */ - snprintf(addrstr, sizeof(addrstr), "%.4lx", - (p-data) ); - } - - c = *p; - - if (isalnum(c) == 0) { - c = '.'; - } - - /* store hex str (for left side) */ - snprintf(bytestr, sizeof(bytestr), "%02X ", *p); - strncat(hexstr, bytestr, sizeof(hexstr)-strlen(hexstr)-1); - - /* store char str (for right side) */ - snprintf(bytestr, sizeof(bytestr), "%c", c); - strncat(charstr, bytestr, sizeof(charstr)-strlen(charstr)-1); - - if(n%16 == 0) { - /* line completed */ - fprintf((FILE *)fp, "[%4.4s] %-50.50s %s\n", addrstr, hexstr, charstr); - hexstr[0] = 0; - charstr[0] = 0; - } else if(n%8 == 0) { - /* half line: add whitespaces */ - strncat(hexstr, " ", sizeof(hexstr)-strlen(hexstr)-1); - strncat(charstr, " ", sizeof(charstr)-strlen(charstr)-1); - } - - p++; /* next byte */ - } - - if (strlen(hexstr) > 0) { - /* print rest of buffer if not empty */ - fprintf((FILE *)fp, "[%4.4s] %-50.50s %s\n", addrstr, hexstr, charstr); - - } - - fprintf((FILE *)fp, "\n"); - - return NW_GTPV1U_OK; -} - -#ifdef __cplusplus -} -#endif - - - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c deleted file mode 100644 index 27cb59050f..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c +++ /dev/null @@ -1,399 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#include -#include -#include - -#include "NwTypes.h" -#include "NwLog.h" -#include "NwUtils.h" -#include "NwGtpv1uLog.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uPrivate.h" -#include "NwGtpv1uTrxn.h" - -/*--------------------------------------------------------------------------* - * P R I V A T E D E C L A R A T I O N S * - *--------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -static NwGtpv1uTrxnT *gpGtpv1uTrxnPool = NULL; - -/*--------------------------------------------------------------------------* - * P R I V A T E F U N C T I O N S * - *--------------------------------------------------------------------------*/ - -/*--------------------------------------------------------------------------- - * Send msg retransmission to peer via data request to UDP Entity - *--------------------------------------------------------------------------*/ - -static NwGtpv1uRcT -nwGtpv1uTrxnSendMsgRetransmission(NwGtpv1uTrxnT *thiz) -{ - NwGtpv1uRcT rc; - - NW_ASSERT(thiz); - NW_ASSERT(thiz->pMsg); - - rc = thiz->pStack->udp.udpDataReqCallback(thiz->pStack->udp.hUdp, - thiz->pMsg->msgBuf, - thiz->pMsg->msgLen, - thiz->pMsg->msgBufOffset, - thiz->peerIp, - thiz->peerPort); - - return rc; -} - -static NwGtpv1uRcT -nwGtpv1uTrxnPeerRspTimeout(void *arg) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uTrxnT *thiz; - NwGtpv1uStackT *pStack; - NwGtpv1uTimeoutInfoT *timeoutInfo = arg; - - thiz = ((NwGtpv1uTrxnT *)timeoutInfo->timeoutArg); - pStack = thiz->pStack; - - NW_ASSERT(pStack); - - NW_LOG(pStack, NW_LOG_LEVEL_WARN, "T3 timer expired for transaction 0x%p", - thiz); - - rc = nwGtpv1uTrxnSendMsgRetransmission(thiz); - - if(thiz->maxRetries) { - rc = pStack->tmrMgr.tmrStartCallback(pStack->tmrMgr.tmrMgrHandle, - thiz->t3Timer, 0, NW_GTPV1U_TMR_TYPE_ONE_SHOT, (void *)timeoutInfo, - &thiz->hRspTmr); - thiz->maxRetries--; - } else { - NwGtpv1uUlpApiT ulpApi; - ulpApi.apiType = NW_GTPV1U_ULP_API_RSP_FAILURE; - ulpApi.apiInfo.recvMsgInfo.msgType = nwGtpv1uMsgGetMsgType(( - NwGtpv1uMsgHandleT)thiz->pMsg); - ulpApi.apiInfo.recvMsgInfo.hUlpTrxn = thiz->hUlpTrxn; - ulpApi.apiInfo.recvMsgInfo.peerIp = thiz->peerIp; - ulpApi.apiInfo.recvMsgInfo.peerPort = thiz->peerPort; - thiz->hRspTmr = 0; - - rc = nwGtpv1uTrxnDelete(&thiz); - NW_ASSERT(rc == NW_GTPV1U_OK); - - rc = pStack->ulp.ulpReqCallback(pStack->ulp.hUlp, &ulpApi); - NW_ASSERT(rc == NW_GTPV1U_OK); - } - - return rc; -} - -/** - Send timer start request to TmrMgr Entity. - - @param[in] thiz : Pointer to transaction - @param[in] timeoutCallbackFunc : Timeout handler callback function. - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uTrxnStartPeerRspTimer(NwGtpv1uTrxnT *thiz, - NwGtpv1uRcT (*timeoutCallbackFunc)(void *)) -{ - NwGtpv1uRcT rc; - NwGtpv1uTimeoutInfoT *timeoutInfo; - - NW_ASSERT(thiz->pStack->tmrMgr.tmrStartCallback != NULL); - - timeoutInfo = &thiz->peerRspTimeoutInfo; - timeoutInfo->timeoutArg = thiz; - timeoutInfo->timeoutCallbackFunc = timeoutCallbackFunc; - timeoutInfo->hStack = (NwGtpv1uStackHandleT)thiz->pStack; - - rc = thiz->pStack->tmrMgr.tmrStartCallback(thiz->pStack->tmrMgr.tmrMgrHandle, - thiz->t3Timer, 0, NW_GTPV1U_TMR_TYPE_ONE_SHOT, (void *)timeoutInfo, - &thiz->hRspTmr); - - return rc; -} - -/** - Send timer stop request to TmrMgr Entity. - - @param[in] thiz : Pointer to transaction - @return NW_GTPV1U_OK on success. - */ - -static NwGtpv1uRcT -nwGtpv1uTrxnStopPeerRspTimer(NwGtpv1uTrxnT *thiz) -{ - NwGtpv1uRcT rc; - - NW_ASSERT(thiz->pStack->tmrMgr.tmrStopCallback != NULL); - - rc = thiz->pStack->tmrMgr.tmrStopCallback(thiz->pStack->tmrMgr.tmrMgrHandle, - thiz->hRspTmr); - - thiz->hRspTmr = 0; - - return rc; -} - -/*--------------------------------------------------------------------------* - * P U B L I C F U N C T I O N S * - *--------------------------------------------------------------------------*/ - -/** - * Constructor - * - * @param[in] thiz : Pointer to stack - * @param[out] ppTrxn : Pointer to pointer to Trxn object. - * @return NW_GTPV1U_OK on success. - */ -NwGtpv1uRcT -nwGtpv1uTrxnNew( NW_IN NwGtpv1uStackT *thiz, - NW_OUT NwGtpv1uTrxnT **ppTrxn) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uTrxnT *pTrxn; - - if(gpGtpv1uTrxnPool) { - pTrxn = gpGtpv1uTrxnPool; - gpGtpv1uTrxnPool = gpGtpv1uTrxnPool->next; - } else { - NW_GTPV1U_MALLOC(thiz, sizeof(NwGtpv1uTrxnT), pTrxn, NwGtpv1uTrxnT *); - } - - if (pTrxn) { - pTrxn->maxRetries = 2; - pTrxn->pStack = thiz; - pTrxn->t3Timer = 2; - pTrxn->seqNum = thiz->seq; - - /* Increment sequence number */ - thiz->seq++; - - if(thiz->seq == 0x800000) { - thiz->seq = 0; - } - - } else { - rc = NW_GTPV1U_FAILURE; - } - - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Created transaction 0x%p", pTrxn); - - *ppTrxn = pTrxn; - - return rc; -} - -/** - * Overloaded Constructor - * - * @param[in] thiz : Pointer to stack. - * @param[in] seqNum : Sequence number for this transaction. - * @param[out] ppTrxn : Pointer to pointer to Trxn object. - * @return NW_GTPV1U_OK on success. - */ -NwGtpv1uRcT -nwGtpv1uTrxnWithSeqNew( NW_IN NwGtpv1uStackT *thiz, - NW_IN uint32_t seqNum, - NW_OUT NwGtpv1uTrxnT **ppTrxn) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uTrxnT *pTrxn; - - if(gpGtpv1uTrxnPool) { - pTrxn = gpGtpv1uTrxnPool; - gpGtpv1uTrxnPool = gpGtpv1uTrxnPool->next; - } else { - NW_GTPV1U_MALLOC(thiz, sizeof(NwGtpv1uTrxnT), pTrxn, NwGtpv1uTrxnT *); - } - - - if (pTrxn) { - pTrxn->maxRetries = 2; - pTrxn->pStack = thiz; - pTrxn->t3Timer = 2; - pTrxn->seqNum = seqNum; - pTrxn->pMsg = NULL; - } else { - rc = NW_GTPV1U_FAILURE; - } - - NW_LOG(thiz, NW_LOG_LEVEL_DEBG, "Created transaction 0x%p", pTrxn); - - *ppTrxn = pTrxn; - - return rc; -} - -/** - * Destructor - * - * @param[out] pthiz : Pointer to pointer to Trxn object. - * @return NW_GTPV1U_OK on success. - */ -NwGtpv1uRcT -nwGtpv1uTrxnDelete( NW_INOUT NwGtpv1uTrxnT **pthiz) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uStackT *pStack; - NwGtpv1uTrxnT *thiz = *pthiz; - - pStack = thiz->pStack; - - if(thiz->hRspTmr) { - rc = nwGtpv1uTrxnStopPeerRspTimer(thiz); - NW_ASSERT(rc == NW_GTPV1U_OK); - } - - if(thiz->pMsg) { - rc = nwGtpv1uMsgDelete((NwGtpv1uStackHandleT)pStack, - (NwGtpv1uMsgHandleT)thiz->pMsg); - NW_ASSERT(rc == NW_GTPV1U_OK); - } - - thiz->next = gpGtpv1uTrxnPool; - gpGtpv1uTrxnPool = thiz; - - NW_LOG(pStack, NW_LOG_LEVEL_DEBG, "Purged transaction 0x%p", thiz); - - *pthiz = NULL; - return rc; -} - - -#if 1 -/** - * Send msg to peer via data request to UDP Entity - * - * @param[in] thiz : Pointer to stack. - * @param[in] pTrxn : Pointer to Trxn object. - * @param[in] peerIp : Peer Ip address. - * @param[in] peerPort : Peer Ip port. - * @param[in] pMsg : Message to be sent. - * @return NW_GTPV1U_OK on success. - */ -NwGtpv1uRcT -nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT *thiz, - NW_IN NwGtpv1uTrxnT *pTrxn, - NW_IN uint32_t peerIp, - NW_IN uint32_t peerPort, - NW_IN NwGtpv1uMsgT *pMsg) -{ - NwGtpv1uRcT rc; - uint8_t *msgHdr; - - NW_ASSERT(thiz); - NW_ASSERT(pMsg); - - msgHdr = &pMsg->msgBuf[pMsg->msgBufOffset]; - - NW_ASSERT(msgHdr != NULL); - - *(msgHdr++) = (pMsg->version << 5) | - (pMsg->protocolType << 4) | - (pMsg->extHdrFlag << 2) | - (pMsg->seqNumFlag << 1) | - (pMsg->npduNumFlag); - - *(msgHdr++) = (pMsg->msgType); - *((uint16_t *) msgHdr) = htons(pMsg->msgLen); - msgHdr += 2; - - *((uint32_t *) msgHdr) = htonl(pMsg->teid); - msgHdr += 4; - - if(pMsg->seqNumFlag | pMsg->extHdrFlag | pMsg->npduNumFlag) { - if(pMsg->seqNumFlag) { - *((uint16_t *) msgHdr) = htons((pTrxn ? pTrxn->seqNum : pMsg->seqNum)); - } else { - *((uint16_t *) msgHdr) = 0x0000; - } - - msgHdr += 2; - - if(pMsg->npduNumFlag) { - *((uint8_t *) msgHdr) = pMsg->npduNumFlag; - } else { - *((uint8_t *) msgHdr) = 0x00; - } - - msgHdr++; - - if(pMsg->extHdrFlag) { - *((uint8_t *) msgHdr) = pMsg->extHdrFlag; - } else { - *((uint8_t *) msgHdr) = 0x00; - } - - msgHdr++; - } - - NW_ASSERT(thiz->udp.udpDataReqCallback != NULL); - - rc = thiz->udp.udpDataReqCallback(thiz->udp.hUdp, - pMsg->msgBuf, - pMsg->msgLen, - pMsg->msgBufOffset, - peerIp, - peerPort); - - /* Save the message for retransmission */ - if(rc == NW_GTPV1U_OK && pTrxn) { - pTrxn->pMsg = pMsg; - pTrxn->peerIp = peerIp; - pTrxn->peerPort = peerPort; - - rc = nwGtpv1uTrxnStartPeerRspTimer(pTrxn, nwGtpv1uTrxnPeerRspTimeout); - NW_ASSERT(rc == NW_GTPV1U_OK); - } - - return rc; -} -#endif - - -#ifdef __cplusplus -} -#endif - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ diff --git a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c b/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c deleted file mode 100644 index c62f60edc2..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c +++ /dev/null @@ -1,135 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#include -#include -#include - -#include "NwTypes.h" -#include "NwUtils.h" -#include "NwGtpv1uError.h" -#include "NwGtpv1uPrivate.h" -#include "NwGtpv1uMsg.h" -#include "NwGtpv1uTunnelEndPoint.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uLog.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------* - * P R I V A T E D E C L A R A T I O N S * - *--------------------------------------------------------------------------*/ - -static NwGtpv1uTunnelEndPointT *gpTunnelEndPointPool = NULL; - -/*--------------------------------------------------------------------------* - * P U B L I C F U N C T I O N S * - *--------------------------------------------------------------------------*/ - -/** - Constructor - - @param[in] msid: MSID - @param[in] peerAddr: Address of the peer. - @return Pointer to Session on success, NULL on failure. - */ - - -NwGtpv1uTunnelEndPointT * -nwGtpTunnelEndPointNew(struct NwGtpv1uStack *pStack) -{ - NwGtpv1uTunnelEndPointT *thiz; - - if(gpTunnelEndPointPool) { - thiz = gpTunnelEndPointPool; - gpTunnelEndPointPool = gpTunnelEndPointPool->next; - } else { - NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uTunnelEndPointT), thiz, - NwGtpv1uTunnelEndPointT *); - } - - return thiz; -} - -/** - Destructor - - @param[in] thiz: Pointer to session - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpTunnelEndPointDestroy(struct NwGtpv1uStack *pStack, - NwGtpv1uTunnelEndPointT *thiz) -{ - thiz->next = gpTunnelEndPointPool; - gpTunnelEndPointPool = thiz; - return NW_GTPV1U_OK; -} - -/** - Purge a Transaction for a Session. - - @param[in] thiz: Pointer to session - @param[in,out] pTrxn: Pointer to the trxn. - @return NW_GTPV1U_OK on success. - */ - -NwGtpv1uRcT -nwGtpSessionSendMsgApiToUlpEntity(NwGtpv1uTunnelEndPointT *thiz, - NwGtpv1uMsgT *pMsg) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwGtpv1uUlpApiT api; - - api.apiType = NW_GTPV1U_ULP_API_RECV_TPDU; - api.apiInfo.recvMsgInfo.hUlpSession = thiz->hUlpSession; - api.apiInfo.recvMsgInfo.teid = thiz->teid; - api.apiInfo.recvMsgInfo.hMsg = (NwGtpv1uMsgHandleT)pMsg; - - NW_ASSERT(thiz->pStack->ulp.ulpReqCallback != NULL); - - thiz->pStack->ulp.ulpReqCallback(thiz->pStack->ulp.hUlp, &api); - - return rc; -} - -#ifdef __cplusplus -} -#endif - -/*--------------------------------------------------------------------------* - * E N D O F F I L E * - *--------------------------------------------------------------------------*/ diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/Makefile.am b/openair3/GTPV1-U/nw-gtpv1u/test-app/Makefile.am deleted file mode 100644 index 69b8e698e9..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# this is example-file: Makefile.am - -# the subdirectories of the project to go into -SUBDIRS = \ - nw-helloworld diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/Makefile.in b/openair3/GTPV1-U/nw-gtpv1u/test-app/Makefile.in deleted file mode 100644 index 46928b9e3c..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/Makefile.in +++ /dev/null @@ -1,461 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# this is example-file: Makefile.am -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = nw-gtpv1u/test-app -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_CFLAGS = @AM_CFLAGS@ -AM_LDFLAGS = @AM_LDFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# the subdirectories of the project to go into -SUBDIRS = \ - nw-helloworld - -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu nw-gtpv1u/test-app/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu nw-gtpv1u/test-app/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic ctags \ - ctags-recursive distclean distclean-generic distclean-tags \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ - tags-recursive uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/Makefile.am b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/Makefile.am deleted file mode 100644 index f60cd93f55..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -bin_PROGRAMS = helloworld - -AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@ - -helloworld_SOURCES = \ - NwEvt.h\ - NwMiniLogMgrEntity.h\ - NwMiniTmrMgrEntity.h\ - NwMiniUlpEntity.h\ - NwMiniUdpEntity.h\ - NwMiniLogMgrEntity.c\ - NwMiniTmrMgrEntity.c\ - NwMiniUlpEntity.c\ - NwMiniUdpEntity.c\ - helloworld.c - -helloworld_LDADD = ../../src/libNwGtpv1u.a -levent $(AM_LDFLAGS) diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/Makefile.in b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/Makefile.in deleted file mode 100644 index 769d75c16b..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/Makefile.in +++ /dev/null @@ -1,433 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -bin_PROGRAMS = helloworld$(EXEEXT) -subdir = nw-gtpv1u/test-app/nw-helloworld -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_helloworld_OBJECTS = NwMiniLogMgrEntity.$(OBJEXT) \ - NwMiniTmrMgrEntity.$(OBJEXT) NwMiniUlpEntity.$(OBJEXT) \ - NwMiniUdpEntity.$(OBJEXT) helloworld.$(OBJEXT) -helloworld_OBJECTS = $(am_helloworld_OBJECTS) -am__DEPENDENCIES_1 = -helloworld_DEPENDENCIES = ../../src/libNwGtpv1u.a \ - $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(helloworld_SOURCES) -DIST_SOURCES = $(helloworld_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_CFLAGS = -D__WITH_LIBEVENT__ -I../../shared -I../../include -I../../test-app/nw-udp -I../../test-app/nw-log @AM_CFLAGS@ -AM_LDFLAGS = @AM_LDFLAGS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -helloworld_SOURCES = \ - NwEvt.h\ - NwMiniLogMgrEntity.h\ - NwMiniTmrMgrEntity.h\ - NwMiniUlpEntity.h\ - NwMiniUdpEntity.h\ - NwMiniLogMgrEntity.c\ - NwMiniTmrMgrEntity.c\ - NwMiniUlpEntity.c\ - NwMiniUdpEntity.c\ - helloworld.c - -helloworld_LDADD = ../../src/libNwGtpv1u.a -levent $(AM_LDFLAGS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu nw-gtpv1u/test-app/nw-helloworld/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu nw-gtpv1u/test-app/nw-helloworld/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -helloworld$(EXEEXT): $(helloworld_OBJECTS) $(helloworld_DEPENDENCIES) - @rm -f helloworld$(EXEEXT) - $(LINK) $(helloworld_OBJECTS) $(helloworld_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniLogMgrEntity.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniTmrMgrEntity.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniUdpEntity.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NwMiniUlpEntity.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwEvt.h b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwEvt.h deleted file mode 100644 index 6df5794a5f..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwEvt.h +++ /dev/null @@ -1,80 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * Copyright (c) 2010-2011 Amit Chawre * - * All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright * - * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. The name of the author may not be used to endorse or promote products * - * derived from this software without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - *----------------------------------------------------------------------------*/ - -#ifndef __NW_EVT_H__ -#define __NW_EVT_H__ -/** - * @file NwEvt.h - * @brief -*/ - -#ifdef __WITH_LIBEVENT__ - -#include - -typedef struct event NwEventT; - -#define NW_EVT_READ (EV_READ) -#define NW_EVT_PERSIST (EV_PERSIST) -#define NW_EVT_CALLBACK(__cbFunc) __cbFunc(int fd, short event, void *arg) -#define NW_TMR_CALLBACK(__cbFunc) __cbFunc(int fd, short event, void *arg) - -#define NW_EVT_INIT event_init -#define NW_EVT_LOOP event_dispatch - -#define NW_EVENT_ADD(__ev, __evSelObj, __evCallback, __evCallbackArg, __evFlags) \ - do { \ - event_set(&(__ev), __evSelObj, __evFlags, __evCallback, __evCallbackArg); \ - event_add(&(__ev), NULL); \ - } while(0) - -#else - -#warning "Event library not defined!" - -/* HACK : Defining dummy values for compilation!*/ - -typedef struct { - int __tbd; -} NwEventT; - -#define NW_EVT_READ (0) -#define NW_EVT_PERSIST (1) -#define NW_EVT_CALLBACK(__cbFunc) __cbFunc(void *arg) -#define NW_TMR_CALLBACK(__cbFunc) __cbFunc(void *arg) - - -#define NW_EVT_INIT() do { printf("error: Event library not defined!\n"); exit (0); } while(0) -#define NW_EVT_LOOP() do { printf("error: Event library not defined!\n"); exit (0); } while(0) -#define NW_EVENT_ADD(...) do { printf("error: Event library not defined!\n"); exit (0); } while(0) - - -#endif - -#endif /* __NW_EVT_H__ */ diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c deleted file mode 100644 index c50e6a17db..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.c +++ /dev/null @@ -1,62 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C L O G M G R E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - -/** - * @file hello-world.c - * @brief This file contains example of a minimalistic log manager entity. -*/ - -#include -#include -#include "NwLog.h" -#include "NwEvt.h" -#include "NwGtpv1u.h" - -#include "NwMiniLogMgrEntity.h" - -#ifdef __cplusplus -extern "C" { -#endif - -uint32_t g_log_level = NW_LOG_LEVEL_INFO; - -/*--------------------------------------------------------------------------- - * Public functions - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT nwMiniLogMgrInit(NwMiniLogMgrT *thiz, uint32_t logLevel ) -{ - thiz->logLevel = logLevel; - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT *thiz, uint32_t logLevel) -{ - thiz->logLevel = logLevel; -} - -NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT hLogMgr, - uint32_t logLevel, - NwCharT *file, - uint32_t line, - NwCharT *logStr) -{ - NwMiniLogMgrT *thiz = (NwMiniLogMgrT *) hLogMgr; - - if(thiz->logLevel >= logLevel) { - printf("NWGTPv2U-STK %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr, - basename(file), line); - } - - return NW_GTPV1U_OK; -} - -#ifdef __cplusplus -} -#endif - diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h deleted file mode 100644 index 18b60aa611..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniLogMgrEntity.h +++ /dev/null @@ -1,57 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C L O G M G R E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - -/** - * @file hello-world.c - * @brief This file contains example of a minimalistic log manager entity. -*/ - -#include -#include -#include "NwEvt.h" -#include "NwLog.h" - -#ifndef __NW_MINI_LOG_MGR_H__ -#define __NW_MINI_LOG_MGR_H__ - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -extern uint32_t g_log_level; - - -#define NW_LOG( _logLevel, ...) \ - do { \ - if(g_log_level >= _logLevel) \ - { \ - char _logStr[1024]; \ - snprintf(_logStr, 1024, __VA_ARGS__); \ - printf("NWGTPv2U-APP %s - %s <%s,%d>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\ - } \ - } while(0) - -typedef struct { - uint8_t logLevel; -} NwMiniLogMgrT; - -#ifdef __cplusplus -extern "C" { -#endif - -NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT logMgrHandle, - uint32_t logLevel, - NwCharT* file, - uint32_t line, - NwCharT* logStr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c deleted file mode 100644 index 63ad59b23f..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.c +++ /dev/null @@ -1,101 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C T M R M G R E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - -/** - * @file NwMiniTmrMgrEntity.c - * @brief This file ontains example of a minimalistic timer manager entity. -*/ - -#include -#include -#include "NwEvt.h" -#include "NwGtpv1u.h" -#include "NwMiniLogMgrEntity.h" -#include "NwMiniTmrMgrEntity.h" - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------- - * Private functions - *--------------------------------------------------------------------------*/ - -static void -NW_TMR_CALLBACK(nwMiniTmrMgrHandleTimeout) -{ - NwGtpv1uRcT rc; - NwMiniTmrMgrEntityT *pTmr = (NwMiniTmrMgrEntityT *) arg; - - /*--------------------------------------------------------------------------- - * Send Timeout Request to GTPv1u Stack Instance - *--------------------------------------------------------------------------*/ - - rc = nwGtpv1uProcessTimeout(pTmr->timeoutArg); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - free(pTmr); - - return; -} - -/*--------------------------------------------------------------------------- - * Public functions - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle, - uint32_t timeoutSec, - uint32_t timeoutUsec, - uint32_t tmrType, - void *timeoutArg, - NwGtpv1uTimerHandleT *hTmr) -{ - NwGtpv1uRcT rc = NW_GTPV1U_OK; - NwMiniTmrMgrEntityT *pTmr; - struct timeval tv; - - NW_LOG(NW_LOG_LEVEL_INFO, - "Received start timer request from stack with timer type %d , arg %x, for %d sec and %d usec", - tmrType, (unsigned int)timeoutArg, timeoutSec, timeoutUsec); - - pTmr = (NwMiniTmrMgrEntityT *) malloc (sizeof(NwMiniTmrMgrEntityT)); - - /* set the timevalues*/ - timerclear(&tv); - tv.tv_sec = timeoutSec; - tv.tv_usec = timeoutUsec; - - pTmr->timeoutArg = timeoutArg; - evtimer_set(&pTmr->ev, nwMiniTmrMgrHandleTimeout, pTmr); - - /*add event*/ - - event_add(&(pTmr->ev), &tv); - - *hTmr = (NwGtpv1uTimerHandleT)pTmr; - - return rc; -} - -NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NwGtpv1uTimerHandleT hTmr) -{ - NW_LOG(NW_LOG_LEVEL_INFO, - "Received stop timer request from stack for timer handle %d", hTmr); - evtimer_del(&(((NwMiniTmrMgrEntityT *)hTmr)->ev)); - free((void *)hTmr); - return NW_GTPV1U_OK; -} - -#ifdef __cplusplus -} -#endif diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h deleted file mode 100644 index a1f16ff89b..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniTmrMgrEntity.h +++ /dev/null @@ -1,53 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C T M R M G R E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - - -/** - * @file NwMiniTmrMgrEntity.c - * @brief This file ontains example of a minimalistic timer manager entity. -*/ - -#include -#include -#include "NwEvt.h" -#include "NwLog.h" - -#ifndef __NW_MINI_TMR_MGR_H__ -#define __NW_MINI_TMR_MGR_H__ - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -typedef struct { - NwEventT ev; - void* timeoutArg; -} NwMiniTmrMgrEntityT; - - -#ifdef __cplusplus -extern "C" { -#endif - -NwGtpv1uRcT nwTimerStart( NwGtpv1uTimerMgrHandleT tmrMgrHandle, - uint32_t timeoutSec, - uint32_t timeoutUsec, - uint32_t tmrType, - void* timeoutArg, - NwGtpv1uTimerHandleT* hTmr); - - -NwGtpv1uRcT nwTimerStop( NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NwGtpv1uTimerHandleT hTmr); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c deleted file mode 100644 index a63b02985c..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.c +++ /dev/null @@ -1,157 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C U D P E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - - -/** - * @file NwMiniUdpEntity.c - * @brief This file contains example of a minimalistic ULP entity. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "NwEvt.h" -#include "NwGtpv1u.h" -#include "NwMiniLogMgrEntity.h" -#include "NwMiniUdpEntity.h" - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -#define MAX_UDP_PAYLOAD_LEN (4096) - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------- - * Private functions - *--------------------------------------------------------------------------*/ - -static -void NW_TMR_CALLBACK(nwUdpDataIndicationCallbackData) -{ - NwGtpv1uRcT rc; - uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN]; - NwS32T bytesRead; - uint32_t peerLen; - struct sockaddr_in peer; - NwMiniUdpEntityT *thiz = (NwMiniUdpEntityT *) arg; - - peerLen = sizeof(peer); - - bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_UDP_PAYLOAD_LEN , 0, - (struct sockaddr *) &peer,(socklen_t *) &peerLen); - - if(bytesRead) { - NW_LOG(NW_LOG_LEVEL_DEBG, "Received UDP message of length %u from %X:%u", - bytesRead, ntohl(peer.sin_addr.s_addr), ntohs(peer.sin_port)); - rc = nwGtpv1uProcessUdpReq(thiz->hGtpv1uStack, udpBuf, bytesRead, - peer.sin_port, peer.sin_addr.s_addr); - } else { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - } -} - - -/*--------------------------------------------------------------------------- - * Public functions - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT *thiz, - NwGtpv1uStackHandleT hGtpv1uStack, uint8_t *ipAddr) -{ - int sd; - struct sockaddr_in addr; - - sd = socket(AF_INET, SOCK_DGRAM, 0); - - if (sd < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - NW_ASSERT(0); - } - - addr.sin_family = AF_INET; - addr.sin_port = htons(2152); - addr.sin_addr.s_addr = inet_addr(ipAddr); - memset(addr.sin_zero, '\0', sizeof (addr.sin_zero)); - - if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - NW_ASSERT(0); - } - - event_set(&(thiz->ev), sd, EV_READ|EV_PERSIST, nwUdpDataIndicationCallbackData, - thiz); - event_add(&(thiz->ev), NULL); - - thiz->hSocket = sd; - thiz->hGtpv1uStack = hGtpv1uStack; - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT *thiz) -{ - close(thiz->hSocket); -} - -NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle, - uint8_t *dataBuf, - uint32_t dataSize, - uint32_t peerIpAddr, - uint32_t peerPort) -{ - struct sockaddr_in peerAddr; - NwS32T bytesSent; - NwMiniUdpEntityT *thiz = (NwMiniUdpEntityT *) udpHandle; - - peerAddr.sin_family = AF_INET; - peerAddr.sin_port = htons(peerPort); - peerAddr.sin_addr.s_addr = (peerIpAddr); - memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero)); - - NW_LOG(NW_LOG_LEVEL_DEBG, - "Sending %u bytes on handle 0x%x to peer %u.%u.%u.%u:%u", dataSize, udpHandle, - (peerIpAddr & 0x000000ff), - (peerIpAddr & 0x0000ff00) >> 8, - (peerIpAddr & 0x00ff0000) >> 16, - (peerIpAddr & 0xff000000) >> 24, - peerPort); - - bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0, - (struct sockaddr *) &peerAddr, sizeof(peerAddr)); - - if(bytesSent < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - } else { - NW_LOG(NW_LOG_LEVEL_DEBG, "Sent %u bytes on handle 0x%x to peer %u.%u.%u.%u", - dataSize, udpHandle, - (peerIpAddr & 0x000000ff), - (peerIpAddr & 0x0000ff00) >> 8, - (peerIpAddr & 0x00ff0000) >> 16, - (peerIpAddr & 0xff000000) >> 24); - - } - - return NW_GTPV1U_OK; -} - - - -#ifdef __cplusplus -} -#endif - diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h deleted file mode 100644 index 568c5b0796..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUdpEntity.h +++ /dev/null @@ -1,51 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C U D P E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - - -/** - * @file NwMiniUdpEntity.h - * @brief This file contains example of a minimalistic ULP entity. -*/ - -#include -#include -#include "NwEvt.h" -#include "NwLog.h" - -#ifndef __NW_MINI_UDP_ENTITY_H__ -#define __NW_MINI_UDP_ENTITY_H__ - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -typedef struct { - uint32_t hSocket; - NwEventT ev; - NwGtpv1uStackHandleT hGtpv1uStack; -} NwMiniUdpEntityT; - -#ifdef __cplusplus -extern "C" { -#endif - -NwGtpv1uRcT nwMiniUdpInit(NwMiniUdpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack, uint8_t* ipAddr); - -NwGtpv1uRcT nwMiniUdpDestroy(NwMiniUdpEntityT* thiz); - -NwGtpv1uRcT nwMiniUdpDataReq(NwGtpv1uUdpHandleT udpHandle, - uint8_t* dataBuf, - uint32_t dataSize, - uint32_t peerAddr, - uint32_t peerPort); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c deleted file mode 100644 index e2f505b4eb..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.c +++ /dev/null @@ -1,309 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C U L P E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - -/** - * @file NwMiniUlpEntity.c - * @brief This file contains example of a minimalistic ULP entity. -*/ - -#include -#include -#include -#include -#include "NwEvt.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uIe.h" -#include "NwMiniLogMgrEntity.h" -#include "NwMiniUlpEntity.h" - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/*--------------------------------------------------------------------------- - * Private Functions - *--------------------------------------------------------------------------*/ - -#define MAX_UDP_PAYLOAD_LEN (4096) - -NwGtpv1uRcT -nwMiniUlpSendEchoRequestToPeer(NwMiniUlpEntityT *thiz, uint32_t peerIp) -{ - NwGtpv1uRcT rc; - NwGtpv1uUlpApiT ulpReq; - - /* - * Send Message Request to Gtpv1u Stack Instance - */ - - ulpReq.apiType = NW_GTPV1U_ULP_API_INITIAL_REQ; - - ulpReq.apiInfo.initialReqInfo.hUlpTrxn = (NwGtpv1uUlpTrxnHandleT)thiz; - ulpReq.apiInfo.initialReqInfo.teid = 0x00; - ulpReq.apiInfo.initialReqInfo.peerIp = (peerIp); - ulpReq.apiInfo.initialReqInfo.peerPort = 2152; - - /* Send Echo Request*/ - - rc = nwGtpv1uMsgNew( thiz->hGtpv1uStack, - NW_TRUE, /* SeqNum flag */ - NW_FALSE, - NW_FALSE, - NW_GTP_ECHO_REQ, /* Msg Type */ - 0x00000000UL, /* TEID */ - 0x5678, /* Seq Number */ - 0, - 0, - (&ulpReq.hMsg)); - - NW_ASSERT( rc == NW_GTPV1U_OK ); - - rc = nwGtpv1uMsgAddIeTV1((ulpReq.hMsg), NW_GTPV1U_IE_RECOVERY, - thiz->restartCounter); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - return NW_GTPV1U_OK; -} - -static -void NW_EVT_CALLBACK(nwMiniUlpDataIndicationCallbackData) -{ - NwMiniUlpEntityT *thiz = (NwMiniUlpEntityT *) arg; - NwGtpv1uRcT rc; - uint8_t udpBuf[MAX_UDP_PAYLOAD_LEN]; - NwS32T bytesRead; - uint32_t peerLen; - struct sockaddr_in peer; - - peerLen = sizeof(peer); - - bytesRead = recvfrom(thiz->hSocket, udpBuf, MAX_UDP_PAYLOAD_LEN , 0, - (struct sockaddr *) &peer,(socklen_t *) &peerLen); - - if(bytesRead) { - NW_LOG(NW_LOG_LEVEL_DEBG, "Received UDP message of length %u from %X:%u", - bytesRead, ntohl(peer.sin_addr.s_addr), ntohs(peer.sin_port)); - rc = nwMiniUlpTpduSend(thiz, udpBuf, bytesRead, thiz->localPort[fd]); - } else { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - } -} - -/*--------------------------------------------------------------------------- - * Public Functions - *--------------------------------------------------------------------------*/ - -NwGtpv1uRcT -nwMiniUlpInit(NwMiniUlpEntityT *thiz, NwGtpv1uStackHandleT hGtpv1uStack) -{ - NwGtpv1uRcT rc; - thiz->hGtpv1uStack = hGtpv1uStack; - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwMiniUlpDestroy(NwMiniUlpEntityT *thiz) -{ - NW_ASSERT(thiz); - memset(thiz, 0, sizeof(NwMiniUlpEntityT)); - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwMiniUlpCreateConn(NwMiniUlpEntityT *thiz, char *localIpStr, uint16_t localport, - char *peerIpStr) -{ - NwGtpv1uRcT rc; - int sd; - struct sockaddr_in addr; - NwGtpv1uUlpApiT ulpReq; - - strcpy(thiz->peerIpStr, peerIpStr); - - /* - * Create local tunnel endpoint - */ - - NW_LOG(NW_LOG_LEVEL_NOTI, "Creating tunnel endpoint with teid %d", localport); - ulpReq.apiType = - NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT; - ulpReq.apiInfo.createTunnelEndPointInfo.teid = localport; - ulpReq.apiInfo.createTunnelEndPointInfo.hUlpSession = - (NwGtpv1uUlpSessionHandleT)thiz; - - rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - thiz->hGtpv1uConn = ulpReq.apiInfo.createTunnelEndPointInfo.hStackSession; - - /* - * Create local udp listening endpoint - */ - - sd = socket(AF_INET, SOCK_DGRAM, 0); - - if (sd < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - NW_ASSERT(0); - } - - addr.sin_family = AF_INET; - addr.sin_port = htons(localport); - addr.sin_addr.s_addr = inet_addr(localIpStr); - memset(addr.sin_zero, '\0', sizeof (addr.sin_zero)); - - if(bind(sd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - NW_ASSERT(0); - } - - event_set(&(thiz->ev[sd]), sd, EV_READ|EV_PERSIST, - nwMiniUlpDataIndicationCallbackData, thiz); - event_add(&(thiz->ev[sd]), NULL); - - thiz->localPort[sd] = localport; - - /* - * Create local udp for sendign data - */ - - sd = socket(AF_INET, SOCK_DGRAM, 0); - - if (sd < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - NW_ASSERT(0); - } - - - thiz->hSocket = sd; - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwMiniUlpDestroyConn(NwMiniUlpEntityT *thiz) -{ - NwGtpv1uRcT rc; - NwGtpv1uUlpApiT ulpReq; - /*--------------------------------------------------------------------------- - * Send Destroy Session Request to GTPv1u Stack Instance - *--------------------------------------------------------------------------*/ - - ulpReq.apiType = NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT; - ulpReq.apiInfo.destroyTunnelEndPointInfo.hStackSessionHandle = thiz->hGtpv1uConn; - - rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - thiz->hGtpv1uConn = 0; - - return NW_GTPV1U_OK; -} - - -NwGtpv1uRcT -nwMiniUlpTpduSend(NwMiniUlpEntityT *thiz, uint8_t *tpduBuf, uint32_t tpduLen , - uint16_t fromPort) -{ - NwGtpv1uRcT rc; - NwGtpv1uUlpApiT ulpReq; - - /* - * Send Message Request to GTPv1u Stack Instance - */ - - ulpReq.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - ulpReq.apiInfo.sendtoInfo.teid = fromPort; - ulpReq.apiInfo.sendtoInfo.ipAddr = inet_addr(thiz->peerIpStr); - - rc = nwGtpv1uGpduMsgNew( thiz->hGtpv1uStack, - fromPort, - NW_FALSE, - thiz->seqNum++, - tpduBuf, - tpduLen, - &(ulpReq.apiInfo.sendtoInfo.hMsg)); - - NW_ASSERT( rc == NW_GTPV1U_OK ); - - rc = nwGtpv1uProcessUlpReq(thiz->hGtpv1uStack, &ulpReq); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - rc = nwGtpv1uMsgDelete(thiz->hGtpv1uStack, (ulpReq.apiInfo.sendtoInfo.hMsg)); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT -nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi) -{ - NwMiniUlpEntityT *thiz; - NW_ASSERT(pUlpApi != NULL); - - thiz = (NwMiniUlpEntityT *) hUlp; - - switch(pUlpApi->apiType) { - case NW_GTPV1U_ULP_API_RECV_TPDU: { - struct sockaddr_in peerAddr; - NwS32T bytesSent; - uint8_t dataBuf[4096]; - uint32_t dataSize; - uint32_t peerIpAddr = (inet_addr(thiz->peerIpStr)); - - NW_ASSERT( NW_GTPV1U_OK == nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, - dataBuf, &dataSize) ); - - NW_LOG(NW_LOG_LEVEL_DEBG, "Received TPDU from gtpv1u stack %u!", - pUlpApi->apiInfo.recvMsgInfo.teid); - - peerAddr.sin_family = AF_INET; - peerAddr.sin_port = htons(pUlpApi->apiInfo.recvMsgInfo.teid); - peerAddr.sin_addr.s_addr = (peerIpAddr); - memset(peerAddr.sin_zero, '\0', sizeof (peerAddr.sin_zero)); - - bytesSent = sendto (thiz->hSocket, dataBuf, dataSize, 0, - (struct sockaddr *) &peerAddr, sizeof(peerAddr)); - - if(bytesSent < 0) { - NW_LOG(NW_LOG_LEVEL_ERRO, "%s", strerror(errno)); - NW_ASSERT(0); - } else { - NW_LOG(NW_LOG_LEVEL_DEBG, "Sent %u bytes to peer %u.%u.%u.%u", dataSize, - (peerIpAddr & 0x000000ff), - (peerIpAddr & 0x0000ff00) >> 8, - (peerIpAddr & 0x00ff0000) >> 16, - (peerIpAddr & 0xff000000) >> 24); - } - - NW_ASSERT(nwGtpv1uMsgDelete(thiz->hGtpv1uStack, - (pUlpApi->apiInfo.recvMsgInfo.hMsg)) == NW_GTPV1U_OK); - - } - break; - - default: - NW_LOG(NW_LOG_LEVEL_WARN, "Received undefined UlpApi (%d) from gtpv1u stack!", - pUlpApi->apiType); - } - - return NW_GTPV1U_OK; -} - -#ifdef __cplusplus -} -#endif - diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h deleted file mode 100644 index dd55e8ed7c..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/NwMiniUlpEntity.h +++ /dev/null @@ -1,64 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * M I N I M A L I S T I C U L P E N T I T Y * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - -/** - * @file NwMiniUlpEntity.h - * @brief This file contains example of a minimalistic ULP entity. -*/ - -#include -#include -#include "NwEvt.h" -#include "NwLog.h" - -#ifndef __NW_MINI_ULP_H__ -#define __NW_MINI_ULP_H__ - -typedef struct { - int hSocket; - uint16_t seqNum; - uint8_t restartCounter; - uint8_t localIpStr[16]; - uint8_t peerIpStr[16]; - uint32_t localPort[1025]; - NwEventT ev[1025]; - NwGtpv1uStackHandleT hGtpv1uStack; - NwGtpv1uStackSessionHandleT hGtpv1uConn; -} NwMiniUlpEntityT; - -#ifdef __cplusplus -extern "C" { -#endif - -NwGtpv1uRcT -nwMiniUlpInit(NwMiniUlpEntityT* thiz, NwGtpv1uStackHandleT hGtpv1uStack); - -NwGtpv1uRcT -nwMiniUlpDestroy(NwMiniUlpEntityT* thiz); - -NwGtpv1uRcT -nwMiniUlpCreateConn(NwMiniUlpEntityT* thiz, char* localIpStr, uint16_t localPort, char* peerIpStr); - -NwGtpv1uRcT -nwMiniUlpDestroyConn(NwMiniUlpEntityT* thiz); - -NwGtpv1uRcT -nwMiniUlpSendMsg(NwMiniUlpEntityT* thiz); - -NwGtpv1uRcT -nwMiniUlpTpduSend(NwMiniUlpEntityT* thiz, uint8_t* tpduBuf, uint32_t tpduLen , uint16_t fromPort); - -NwGtpv1uRcT -nwMiniUlpProcessStackReqCallback (NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c b/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c deleted file mode 100644 index 2f618ad642..0000000000 --- a/openair3/GTPV1-U/nw-gtpv1u/test-app/nw-helloworld/helloworld.c +++ /dev/null @@ -1,207 +0,0 @@ -/*----------------------------------------------------------------------------* - * * - * n w - g t p v 2 u * - * G P R S T u n n e l i n g P r o t o c o l v 2 u S t a c k * - * * - * M I N I M A L I S T I C D E M O N S T R A T I O N * - * * - * Copyright (C) 2010 Amit Chawre. * - * * - *----------------------------------------------------------------------------*/ - - -/** - * @file hello-world.c - * @brief This is a test program demostrating usage of nw-gtpv2 library. -*/ - -#include -#include -#include "NwEvt.h" -#include "NwGtpv1u.h" - -#include "NwMiniLogMgrEntity.h" -#include "NwMiniTmrMgrEntity.h" -#include "NwMiniUdpEntity.h" -#include "NwMiniUlpEntity.h" - -#ifndef NW_ASSERT -#define NW_ASSERT assert -#endif - -/*--------------------------------------------------------------------------- - * T H E M A I N F U N C T I O N - *--------------------------------------------------------------------------*/ - -int main(int argc, char *argv[]) -{ - NwGtpv1uRcT rc; - char *logLevelStr; - uint32_t logLevel; - uint32_t num_of_connections; - - NwGtpv1uStackHandleT hGtpv1uStack = 0; - NwMiniUlpEntityT ulpObj; - NwMiniUdpEntityT udpObj; - NwMiniLogMgrT logObj; - NwGtpv1uUlpEntityT ulp; - NwGtpv1uUdpEntityT udp; - NwGtpv1uTimerMgrEntityT tmrMgr; - NwGtpv1uLogMgrEntityT logMgr; - - if(argc != 4) { - printf("Usage: %s \n", argv[0]); - exit(0); - } - - - logLevelStr = getenv ("NW_LOG_LEVEL"); - - if(logLevelStr == NULL) { - logLevel = NW_LOG_LEVEL_INFO; - } else { - if(strncmp(logLevelStr, "EMER",4) == 0) { - logLevel = NW_LOG_LEVEL_EMER; - } else if(strncmp(logLevelStr, "ALER",4) == 0) { - logLevel = NW_LOG_LEVEL_ALER; - } else if(strncmp(logLevelStr, "CRIT",4) == 0) { - logLevel = NW_LOG_LEVEL_CRIT; - } else if(strncmp(logLevelStr, "ERRO",4) == 0) { - logLevel = NW_LOG_LEVEL_ERRO ; - } else if(strncmp(logLevelStr, "WARN",4) == 0) { - logLevel = NW_LOG_LEVEL_WARN; - } else if(strncmp(logLevelStr, "NOTI",4) == 0) { - logLevel = NW_LOG_LEVEL_NOTI; - } else if(strncmp(logLevelStr, "INFO",4) == 0) { - logLevel = NW_LOG_LEVEL_INFO; - } else if(strncmp(logLevelStr, "DEBG",4) == 0) { - logLevel = NW_LOG_LEVEL_DEBG; - } - } - - /*--------------------------------------------------------------------------- - * Initialize event library - *--------------------------------------------------------------------------*/ - - NW_EVT_INIT(); - - /*--------------------------------------------------------------------------- - * Initialize Log Manager - *--------------------------------------------------------------------------*/ - - nwMiniLogMgrInit(&logObj, logLevel); - - /*--------------------------------------------------------------------------- - * Create GTPv1u Stack Instance - *--------------------------------------------------------------------------*/ - - rc = nwGtpv1uInitialize(&hGtpv1uStack, GTPU_STACK_ENB); - - if(rc != NW_GTPV1U_OK) { - NW_LOG(NW_LOG_LEVEL_ERRO, - "Failed to create gtpv1u stack instance. Error '%u' occured", rc); - exit(1); - } - - NW_LOG(NW_LOG_LEVEL_INFO, "Gtpv1u Stack Handle '%X' Creation Successful!", - hGtpv1uStack); - - /*--------------------------------------------------------------------------- - * Set up Ulp Entity - *--------------------------------------------------------------------------*/ - - rc = nwMiniUlpInit(&ulpObj, hGtpv1uStack); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - ulp.hUlp = (NwGtpv1uUlpHandleT) &ulpObj; - ulp.ulpReqCallback = nwMiniUlpProcessStackReqCallback; - - rc = nwGtpv1uSetUlpEntity(hGtpv1uStack, &ulp); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - - /*--------------------------------------------------------------------------- - * Set up Udp Entity - *--------------------------------------------------------------------------*/ - - rc = nwMiniUdpInit(&udpObj, hGtpv1uStack, (argv[2])); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - udp.hUdp = (NwGtpv1uUdpHandleT) &udpObj; - udp.udpDataReqCallback = nwMiniUdpDataReq; - - rc = nwGtpv1uSetUdpEntity(hGtpv1uStack, &udp); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - /*--------------------------------------------------------------------------- - * Set up Log Entity - *--------------------------------------------------------------------------*/ - - tmrMgr.tmrMgrHandle = 0; - tmrMgr.tmrStartCallback = nwTimerStart; - tmrMgr.tmrStopCallback = nwTimerStop; - - rc = nwGtpv1uSetTimerMgrEntity(hGtpv1uStack, &tmrMgr); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - /*--------------------------------------------------------------------------- - * Set up Log Entity - *--------------------------------------------------------------------------*/ - - logMgr.logMgrHandle = (NwGtpv1uLogMgrHandleT) &logObj; - logMgr.logReqCallback = nwMiniLogMgrLogRequest; - - rc = nwGtpv1uSetLogMgrEntity(hGtpv1uStack, &logMgr); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - /*--------------------------------------------------------------------------- - * Set GTPv1u log level - *--------------------------------------------------------------------------*/ - - rc = nwGtpv1uSetLogLevel(hGtpv1uStack, logLevel); - - /*--------------------------------------------------------------------------- - * Send Create Session Request to GTPv1u Stack Instance - *--------------------------------------------------------------------------*/ - - num_of_connections = atoi(argv[1]); - - while ( num_of_connections-- ) { - //rc = nwMiniUlpCreateConn(&ulpObj, argv[2], 1234 + num_of_connections, argv[3]); - rc = nwMiniUlpSendEchoRequestToPeer(&ulpObj, inet_addr(argv[3])); - NW_ASSERT( rc == NW_GTPV1U_OK ); - } - - /*--------------------------------------------------------------------------- - * Event loop - *--------------------------------------------------------------------------*/ - - NW_EVT_LOOP(); - - NW_LOG(NW_LOG_LEVEL_ERRO, "Exit from eventloop, no events to process!"); - - /*--------------------------------------------------------------------------- - * Send Destroy Session Request to GTPv1u Stack Instance - *--------------------------------------------------------------------------*/ - - rc = nwMiniUlpDestroyConn(&ulpObj); - NW_ASSERT( rc == NW_GTPV1U_OK ); - - - /*--------------------------------------------------------------------------- - * Destroy GTPv1u Stack Instance - *--------------------------------------------------------------------------*/ - - rc = nwGtpv1uFinalize(hGtpv1uStack); - - if(rc != NW_GTPV1U_OK) { - NW_LOG(NW_LOG_LEVEL_ERRO, - "Failed to finalize gtpv1u stack instance. Error '%u' occured", rc); - } else { - NW_LOG(NW_LOG_LEVEL_INFO, "Gtpv1u Stack Handle '%X' Finalize Successful!", - hGtpv1uStack); - } - - - return rc; -} diff --git a/openair3/M3AP/m3ap_MCE_generate_messsages.c b/openair3/M3AP/m3ap_MCE_generate_messsages.c index 8d8c7f3853..4822a09db9 100644 --- a/openair3/M3AP/m3ap_MCE_generate_messsages.c +++ b/openair3/M3AP/m3ap_MCE_generate_messsages.c @@ -39,7 +39,6 @@ #include "m2ap_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -169,14 +168,6 @@ int m2ap_eNB_generate_m2_setup_request( LOG_W(M2AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M2AP_eNB, - // MSC_M2AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M2_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m2ap_eNB_data_p->ENBname); m2ap_eNB_itti_send_sctp_data_req(instance_p, m2ap_eNB_data_p->assoc_id, buffer, len, 0); @@ -315,8 +306,6 @@ int m2ap_eNB_generate_m2_setup_request( // // m2ap_eNB_data_p->state = M2AP_ENB_STATE_READY; // -// //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 M2Setup/successfulOutcome assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 0); // // return ret; @@ -371,11 +360,6 @@ int m2ap_eNB_generate_m2_setup_request( // return -1; // } // -// //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, -// // MSC_M2AP_TARGET_ENB, NULL, 0, -// // "0 M2Setup/unsuccessfulOutcome assoc_id %u cause %u value %u", -// // assoc_id, cause_type, cause_value); -// // m2ap_eNB_itti_send_sctp_data_req(instance, assoc_id, buffer, len, 0); // // return ret; @@ -561,8 +545,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2Handover/initiatingMessage assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -654,8 +636,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2Handover/successfulOutcome assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -716,8 +696,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2UEContextRelease/initiatingMessage assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -800,8 +778,6 @@ int m2ap_eNB_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_ENB, MSC_M2AP_TARGET_ENB, NULL, 0, "0 X2HandoverCancel/initiatingMessage assoc_id %u", m2ap_eNB_data_p->assoc_id); -// // m2ap_eNB_itti_send_sctp_data_req(instance_p->instance, m2ap_eNB_data_p->assoc_id, buffer, len, 1); // // return ret; diff --git a/openair3/M3AP/m3ap_MCE_handler.c b/openair3/M3AP/m3ap_MCE_handler.c index 21d10d1b04..3da0c00145 100644 --- a/openair3/M3AP/m3ap_MCE_handler.c +++ b/openair3/M3AP/m3ap_MCE_handler.c @@ -44,7 +44,6 @@ //#include "m3ap_MME_interface_management.h" #include "m3ap_MCE_interface_management.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" diff --git a/openair3/M3AP/m3ap_MCE_interface_management.c b/openair3/M3AP/m3ap_MCE_interface_management.c index fb54579258..ef26312245 100644 --- a/openair3/M3AP/m3ap_MCE_interface_management.c +++ b/openair3/M3AP/m3ap_MCE_interface_management.c @@ -44,7 +44,6 @@ #include "m3ap_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -149,15 +148,7 @@ int MCE_send_MBMS_SESSION_START_RESPONSE(instance_t instance, m3ap_session_start // // // LOG_W(M3AP,"pdu.present %d\n",pdu.present); -// // MSC_LOG_TX_MESSAGE( -// // MSC_M3AP_MCE, -// // MSC_M3AP_MCE, -// // (const char *)buffer, -// // len, -// // MSC_AS_TIME_FMT" M3_SETUP_REQUEST initiatingMessage MCEname %s", -// // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -// // m3ap_MCE_data_p->MCEname); -// + m3ap_MCE_itti_send_sctp_data_req(instance, m3ap_mce_data_g->assoc_id, buffer, len, 0); return 0; } @@ -318,14 +309,6 @@ int MCE_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m3ap_session_start_ LOG_D(M3AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M3AP_MCE, - // MSC_M3AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M3_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m3ap_MCE_data_p->MCEname); m3ap_MCE_itti_send_sctp_data_req(instance, m3ap_mce_data_g->assoc_id, buffer, len, 0); return 0; @@ -425,14 +408,6 @@ int MCE_send_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, m3ap_mbms_session LOG_D(M3AP,"pdu.present %d\n",pdu.present); - // MSC_LOG_TX_MESSAGE( - // MSC_M3AP_MCE, - // MSC_M3AP_MCE, - // (const char *)buffer, - // len, - // MSC_AS_TIME_FMT" M3_SETUP_REQUEST initiatingMessage MCEname %s", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // m3ap_MCE_data_p->MCEname); m3ap_MCE_itti_send_sctp_data_req(instance, m3ap_mce_data_g->assoc_id, buffer, len, 0); return 0; @@ -646,14 +621,6 @@ int MCE_send_M3_SETUP_REQUEST(m3ap_MCE_instance_t *instance_p, m3ap_MCE_data_t * // // // LOG_W(M3AP,"pdu.present %d\n",pdu.present); -// // MSC_LOG_TX_MESSAGE( -// // MSC_M3AP_MCE, -// // MSC_M3AP_MCE, -// // (const char *)buffer, -// // len, -// // MSC_AS_TIME_FMT" M3_SETUP_REQUEST initiatingMessage MCEname %s", -// // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -// // m3ap_MCE_data_p->MCEname); // // //// buffer = &bytes[0]; @@ -725,15 +692,6 @@ int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, //for (int i=0;i 0, "System Information %d is missing",i); - //MSC_LOG_RX_MESSAGE( - // MSC_M3AP_MCE, - // MSC_M3AP_CU, - // 0, - // 0, - // MSC_AS_TIME_FMT" MCE_handle_M3_SETUP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); - //LOG_D(M3AP, "Sending M3AP_SETUP_RESP ITTI message to MCE_APP with assoc_id (%d->%d)\n", // assoc_id,MCE_MOMCELE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); diff --git a/openair3/M3AP/m3ap_MME_generate_messages.c b/openair3/M3AP/m3ap_MME_generate_messages.c index a28097cf1a..969863b445 100644 --- a/openair3/M3AP/m3ap_MME_generate_messages.c +++ b/openair3/M3AP/m3ap_MME_generate_messages.c @@ -39,7 +39,6 @@ #include "m2ap_itti_messaging.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -174,8 +173,6 @@ int m2ap_MCE_generate_m2_setup_request( return -1; } - //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 M2Setup/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); - m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 0); return ret; @@ -311,8 +308,6 @@ int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MC m2ap_MCE_data_p->state = M2AP_MCE_STATE_READY; - //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 M2Setup/successfulOutcome assoc_id %u", m2ap_MCE_data_p->assoc_id); - m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 0); return ret; @@ -367,11 +362,6 @@ int m2ap_MCE_generate_m2_setup_failure(instance_t instance, return -1; } - //MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, - // MSC_M2AP_TARGET_MCE, NULL, 0, - // "0 M2Setup/unsuccessfulOutcome assoc_id %u cause %u value %u", - // assoc_id, cause_type, cause_value); - m2ap_MCE_itti_send_sctp_data_req(instance, assoc_id, buffer, len, 0); return ret; @@ -557,8 +547,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2Handover/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -650,8 +638,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2Handover/successfulOutcome assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -712,8 +698,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2UEContextRelease/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; @@ -796,8 +780,6 @@ int m2ap_MCE_set_cause (M2AP_Cause_t * cause_p, // return -1; // } // -// MSC_LOG_TX_MESSAGE (MSC_M2AP_SRC_MCE, MSC_M2AP_TARGET_MCE, NULL, 0, "0 X2HandoverCancel/initiatingMessage assoc_id %u", m2ap_MCE_data_p->assoc_id); -// // m2ap_MCE_itti_send_sctp_data_req(instance_p->instance, m2ap_MCE_data_p->assoc_id, buffer, len, 1); // // return ret; diff --git a/openair3/M3AP/m3ap_MME_handler.c b/openair3/M3AP/m3ap_MME_handler.c index 688e3937e1..eaba0e8ef1 100644 --- a/openair3/M3AP/m3ap_MME_handler.c +++ b/openair3/M3AP/m3ap_MME_handler.c @@ -43,7 +43,6 @@ #include "m3ap_MME_interface_management.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" diff --git a/openair3/M3AP/m3ap_MME_interface_management.c b/openair3/M3AP/m3ap_MME_interface_management.c index ccdfa4fc5e..fd50e80618 100644 --- a/openair3/M3AP/m3ap_MME_interface_management.c +++ b/openair3/M3AP/m3ap_MME_interface_management.c @@ -296,16 +296,6 @@ int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, //AssertFatal(MME_MBMS_M3AP_ID!=-1,"MME_MBMS_M3AP_ID was not sent\n"); //AssertFatal(MCE_MBMS_M3AP_ID!=-1,"MCE_MBMS_M3AP_ID was not sent\n"); ////M3AP_SESSION_START_RESP(msg_p). -//// MSC_LOG_RX_MESSAGE( -//// MSC_M3AP_MME, -//// MSC_M3AP_MCE, - // //return 0; -//// 0, -//// 0, -//// MSC_AS_TIME_FMT" MME_handle_M2_SESSION_START_RESPONSE successfulOutcome assoc_id %d", -//// 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -//// assoc_id); -//// // LOG_W(M3AP, "Sending M3AP_SESSION_START_RESP ITTI message to MCE_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MME_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); @@ -434,14 +424,6 @@ int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, //AssertFatal(MME_MBMS_M3AP_ID!=-1,"MME_MBMS_M3AP_ID was not sent\n"); //AssertFatal(MCE_MBMS_M3AP_ID!=-1,"MCE_MBMS_M3AP_ID was not sent\n"); // M3AP_SESSION_STOP_RESP(msg_p). - // MSC_LOG_RX_MESSAGE( - // MSC_M3AP_MME, - // MSC_M3AP_MCE, - // 0, - // 0, - // MSC_AS_TIME_FMT" MME_handle_M2_SESSION_STOP_RESPONSE successfulOutcome assoc_id %d", - // 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - // assoc_id); // LOG_D(M3AP, "Sending M3AP_SESSION_START_RESP ITTI message to MCE_APP with assoc_id (%d->%d)\n", // assoc_id,MCE_MODULE_ID_TO_INSTANCE(assoc_id)); @@ -628,15 +610,6 @@ int MME_handle_M3_SETUP_REQUEST(instance_t instance, *m3ap_mme_data_from_mce = M3AP_SETUP_REQ(message_p); //printf("m3ap_mme_data_from_mce->assoc_id %d %d\n",m3ap_mme_data_from_mce->assoc_id,assoc_id); // -//// MSC_LOG_TX_MESSAGE( -//// MSC_M3AP_MME, -//// MSC_RRC_MCE, -//// 0, -//// 0, -//// MSC_AS_TIME_FMT" MME_handle_M3_SETUP_REQUEST", -//// 0,0//MSC_AS_TIME_ARGS(ctxt_pP), -//// ); -//// itti_send_msg_to_task(TASK_MME_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); // if (num_mbms_available > 0) { // itti_send_msg_to_task(TASK_MME_APP, MCE_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -1086,16 +1059,6 @@ int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, //AssertFatal(MME_MBMS_M3AP_ID!=-1,"MME_MBMS_M3AP_ID was not sent\n"); //AssertFatal(MCE_MBMS_M3AP_ID!=-1,"MCE_MBMS_M3AP_ID was not sent\n"); ////M3AP_SESSION_START_RESP(msg_p). -//// MSC_LOG_RX_MESSAGE( -//// MSC_M3AP_MME, -//// MSC_M3AP_MCE, - // //return 0; -//// 0, -//// 0, -//// MSC_AS_TIME_FMT" MME_handle_M2_SESSION_START_RESPONSE successfulOutcome assoc_id %d", -//// 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), -//// assoc_id); -//// // LOG_W(M3AP, "Sending M3AP_SESSION_START_RESP ITTI message to MCE_APP with assoc_id (%d->%d)\n", // assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MME_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); diff --git a/openair3/M3AP/m3ap_handler.c b/openair3/M3AP/m3ap_handler.c index 832aa0dbac..583552528b 100644 --- a/openair3/M3AP/m3ap_handler.c +++ b/openair3/M3AP/m3ap_handler.c @@ -44,7 +44,6 @@ #include "m3ap_MME_interface_management.h" #include "m3ap_MCE_interface_management.h" -#include "msc.h" #include "assertions.h" #include "conversions.h" diff --git a/openair3/MME_APP/mme_config.c b/openair3/MME_APP/mme_config.c index 3b4074f553..8005b85fd4 100644 --- a/openair3/MME_APP/mme_config.c +++ b/openair3/MME_APP/mme_config.c @@ -54,7 +54,6 @@ #include "common/config/config_userapi.h" #include "RRC_config_tools.h" #include "enb_paramdef.h" -#include "proto_agent.h" int RCconfig_MME(void ) { //int num_enbs = 0; 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/NAS/COMMON/UTIL/nas_timer.c b/openair3/NAS/COMMON/UTIL/nas_timer.c index 9ccca12520..8448d9a78c 100644 --- a/openair3/NAS/COMMON/UTIL/nas_timer.c +++ b/openair3/NAS/COMMON/UTIL/nas_timer.c @@ -46,7 +46,6 @@ Description Timer utilities #include "intertask_interface.h" #include "nas_timer.h" #include "commonDef.h" -#include "msc.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 7cf1378d8b..283f3b7311 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -812,7 +812,6 @@ void *nas_nrue_task(void *args_p) ue_security_key=(ue_sa_security_key_t **)calloc(1,sizeof(ue_sa_security_key_t*)*NB_UE_INST); itti_mark_task_ready (TASK_NAS_NRUE); - MSC_START_USE(); while(1) { // Wait for a message or an event diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_data.h b/openair3/NAS/TEST/AS_SIMULATOR/as_data.h index 24c6473730..9888db69ac 100644 --- a/openair3/NAS/TEST/AS_SIMULATOR/as_data.h +++ b/openair3/NAS/TEST/AS_SIMULATOR/as_data.h @@ -47,14 +47,6 @@ Description Defines constants and functions used by the AS simulator /********************* G L O B A L C O N S T A N T S *******************/ /****************************************************************************/ -/* - * Constansts used for MSCGEN (Message Sequence Chart Generator) - */ -#define MSCGEN(args...) fprintf(stderr, ##args); -#define _ue_id "UE" -#define _mme_id "MME" -#define _as_id "AS" - /****************************************************************************/ /************************ G L O B A L T Y P E S ************************/ /****************************************************************************/ diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_process.c b/openair3/NAS/TEST/AS_SIMULATOR/as_process.c index 21e484e40a..9a9b4da5bb 100644 --- a/openair3/NAS/TEST/AS_SIMULATOR/as_process.c +++ b/openair3/NAS/TEST/AS_SIMULATOR/as_process.c @@ -102,7 +102,7 @@ int process_cell_info_req(int msg_id, const cell_info_req_t* req, index += _process_plmn(_mscgen_buffer, &req->plmnID, MSCGEN_BUFFER_SIZE); snprintf(_mscgen_buffer + index, MSCGEN_BUFFER_SIZE - index, ", rat = 0x%x%c", req->rat, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- Cell Information Request (0x%.4x)\\n%s --->][%s]\n", + printf("[%s][%s][--- Cell Information Request (0x%.4x)\\n%s --->][%s]\n", getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id); /* Setup cell information confirm message */ @@ -116,7 +116,7 @@ int process_cell_info_req(int msg_id, const cell_info_req_t* req, snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE, "tac = 0x%.4x, cellID = 0x%.8x, rat = 0x%x, RSRQ = %u, RSRP = %u%c", cnf->tac, cnf->cellID, cnf->rat, cnf->rsrq, cnf->rsrp, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- Cell Information Confirm (0x%.4x)\\n%s --->][%s]\n", + printf("[%s][%s][--- Cell Information Confirm (0x%.4x)\\n%s --->][%s]\n", getTime(), _as_id, AS_CELL_INFO_CNF, _mscgen_buffer, _ue_id); printf("INFO\t: %s - Send cell informtion confirm\n", __FUNCTION__); @@ -146,13 +146,13 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req, "cause = %s, type = %s, tmsi = {MMEcode = %d, m_tmsi = %u}%c", rrcCause(req->cause), rrcType(req->type), req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment Request " + printf("[%s][%s][--- NAS Signalling Connection Establishment Request " "(0x%.4x)\\n%s --->][%s]\n", getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id); _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, (char*)req->initialNasMsg.data, req->initialNasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer); + printf("[%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer); /* Process initial NAS message */ bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, @@ -160,7 +160,7 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req, req->initialNasMsg.length); if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " + printf("[%s][%s][--- NAS Signalling Connection Establishment " "Indication (0x%.4x)\\ntac = 0x%.4x\\n%s ---x][%s]\n", getTime(), _as_id, AS_NAS_ESTABLISH_IND, ind->tac, _mscgen_buffer, _mme_id); /* Setup NAS signalling connection establishment confirmation message */ @@ -190,7 +190,7 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req, // Transmission failure of Attach Request message //cnf->errCode = AS_FAILURE; // UE DEBUG - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment Indication " + printf("[%s][%s][--- NAS Signalling Connection Establishment Indication " "(0x%.4x)\\nUEid = %u, tac = 0x%.4x\\n%s --->][%s]\n", getTime(), _as_id, AS_NAS_ESTABLISH_IND, ind->UEid, ind->tac, _mscgen_buffer, _mme_id); @@ -224,13 +224,13 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req, snprintf(_mscgen_buffer, MSCGEN_BUFFER_SIZE, "tmsi = {MMEcode = %d, m_tmsi = %u}%c", req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, '\0'); - MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Request " + printf("[%s][%s][--- Uplink Information Request " "(0x%.4x)\\n%s --->][%s]\n", getTime(), _ue_id, msg_id, _mscgen_buffer, _as_id); _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, (char*)req->nasMsg.data, req->nasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer); + printf("[%s][%s][%s]\n", _ue_id, _as_id, _mscgen_buffer); /* Process NAS message */ bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, @@ -238,7 +238,7 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req, req->nasMsg.length); if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Indication " + printf("[%s][%s][--- Uplink Information Indication " "(0x%.4x)\\n%s ---x][%s]\n", getTime(), _as_id, AS_UL_INFO_TRANSFER_IND, _mscgen_buffer, _mme_id); /* Setup uplink information confirmation message */ @@ -279,7 +279,7 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req, // cnf->errCode = AS_FAILURE; // UE DEBUG //} - MSCGEN("[MSC_MSG][%s][%s][--- Uplink Information Indication " + printf("[%s][%s][--- Uplink Information Indication " "(0x%.4x), UEid = %u\\n%s --->][%s]\n", getTime(), _as_id, AS_UL_INFO_TRANSFER_IND, ind->UEid, _mscgen_buffer, _mme_id); @@ -297,7 +297,7 @@ int process_nas_release_req(int msg_id, const nas_release_req_t* req) printf("INFO\t: %s - Process NAS signalling connection release request\n", __FUNCTION__); - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Release Request " + printf("[%s][%s][--- NAS Signalling Release Request " "(0x%.4x), tmsi = {MMEcode = %d, m_tmsi = %u}, " "cause = %s (%u) --->][%s]\n", getTime(), _ue_id, msg_id, req->s_tmsi.MMEcode, req->s_tmsi.m_tmsi, @@ -332,14 +332,14 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp, //rsp->nasMsg.data[21] = 0xc4; // MME DEBUG (Send ESM status) //} - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " + printf("[%s][%s][--- NAS Signalling Connection Establishment " "Response (0x%.4x)\\nerrCode = %s, UEid = %u --->][%s]\n", getTime(), _mme_id, msg_id, rrcErrCode(rsp->errCode), rsp->UEid, _as_id); _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, (char*)rsp->nasMsg.data, rsp->nasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer); + printf("[%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer); // Discard Attach Accept message //return (0); // UE DEBUG @@ -350,7 +350,7 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp, rsp->nasMsg.length); if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " + printf("[%s][%s][--- NAS Signalling Connection Establishment " "Confirm (0x%.4x)\\n%s ---x][%s]\n", getTime(), _as_id, AS_NAS_ESTABLISH_CNF, _mscgen_buffer, _ue_id); return (0); @@ -369,7 +369,7 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp, } } - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Establishment " + printf("[%s][%s][--- NAS Signalling Connection Establishment " "Confirm (0x%.4x)\\n%s --->][%s]\n", getTime(), _as_id, AS_NAS_ESTABLISH_CNF, _mscgen_buffer, _ue_id); @@ -401,13 +401,13 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req, // req->nasMsg.data[6] = 0x02; // UE DEBUG //} - MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Request " + printf("[%s][%s][--- Downlink Information Request " "(0x%.4x), UEid = %u --->][%s]\n", getTime(), _mme_id, msg_id, req->UEid, _as_id); _process_dump(_mscgen_buffer, MSCGEN_BUFFER_SIZE, (char*)req->nasMsg.data, req->nasMsg.length); - MSCGEN("[MSC_RBOX][%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer); + printf("[%s][%s][%s]\n", _mme_id, _as_id, _mscgen_buffer); /* Process NAS message */ bytes = nas_process(_mscgen_buffer, MSCGEN_BUFFER_SIZE, @@ -415,7 +415,7 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req, req->nasMsg.length); if (bytes < 0) { - MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Indication " + printf("[%s][%s][--- Downlink Information Indication " "(0x%.4x)\\n%s ---x][%s]\n", getTime(), _as_id, AS_DL_INFO_TRANSFER_IND, _mscgen_buffer, _ue_id); /* Setup downlink information confirmation message */ @@ -445,7 +445,7 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req, // return (0); // MME DEBUG //} - MSCGEN("[MSC_MSG][%s][%s][--- Downlink Information Indication " + printf("[%s][%s][--- Downlink Information Indication " "(0x%.4x)\\n%s --->][%s]\n", getTime(), _as_id, AS_DL_INFO_TRANSFER_IND, _mscgen_buffer, _ue_id); @@ -464,14 +464,14 @@ int process_nas_release_ind(int msg_id, const nas_release_req_t* req, printf("INFO\t: %s - Process NAS signalling connection release request\n", __FUNCTION__); - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Release Request " + printf("[%s][%s][--- NAS Signalling Connection Release Request " "(0x%.4x), UEid = %u, cause = %s (%u) --->][%s]\n", getTime(), _mme_id, msg_id, req->UEid, rrcReleaseCause(req->cause), req->cause, _as_id); /* Forward NAS release indication to the UE */ ind->cause = req->cause; - MSCGEN("[MSC_MSG][%s][%s][--- NAS Signalling Connection Release Indication " + printf("[%s][%s][--- NAS Signalling Connection Release Indication " "(0x%.4x), cause = %s (%u) --->][%s]\n", getTime(), _as_id, msg_id, rrcReleaseCause(req->cause), ind->cause, _ue_id); diff --git a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c index efe2c1af72..bbc37d18a3 100644 --- a/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c +++ b/openair3/NAS/TEST/AS_SIMULATOR/as_simulator.c @@ -193,7 +193,7 @@ int main (int argc, const char* argv[]) printf("INFO\t: %s - The RRC Simulator is now connected to %s/%s (%d)\n", __FUNCTION__, mhost, mport, socket_get_fd(_as_simulator_mme_sid)); - MSCGEN("[MSC_NEW][%s][AS=%s]\n", getTime(), _as_id); + printf("[%s][AS=%s]\n", getTime(), _as_id); /* * Set up signal handler @@ -325,7 +325,7 @@ static void* _as_simulator_ue_mngr(void* args) printf("INFO\t: %s - UE connection manager started\n", __FUNCTION__); - MSCGEN("[MSC_NEW][%s][NAS-UE=%s]\n", getTime(), _ue_id); + printf("[%s][NAS-UE=%s]\n", getTime(), _ue_id); /* Receiving loop */ while (_as_simulator_ue_is_running) { @@ -407,7 +407,7 @@ static void* _as_simulator_mme_mngr(void* args) printf("INFO\t: %s - MME connection manager started\n", __FUNCTION__); - MSCGEN("[MSC_NEW][%s][NAS-MME=%s]\n", getTime(), _mme_id); + printf("[%s][NAS-MME=%s]\n", getTime(), _mme_id); /* Receiving loop */ while (_as_simulator_mme_is_running) { diff --git a/openair3/NAS/TEST/MSC/ActivatePDN.png b/openair3/NAS/TEST/MSC/ActivatePDN.png deleted file mode 100644 index 7bdfb63d69..0000000000 Binary files a/openair3/NAS/TEST/MSC/ActivatePDN.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/AuthenticationReject.png b/openair3/NAS/TEST/MSC/AuthenticationReject.png deleted file mode 100644 index de5d3ead9d..0000000000 Binary files a/openair3/NAS/TEST/MSC/AuthenticationReject.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/DeactivatePDN.png b/openair3/NAS/TEST/MSC/DeactivatePDN.png deleted file mode 100644 index 28401eadea..0000000000 Binary files a/openair3/NAS/TEST/MSC/DeactivatePDN.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/InitialAttach.png b/openair3/NAS/TEST/MSC/InitialAttach.png deleted file mode 100644 index 35723a48fe..0000000000 Binary files a/openair3/NAS/TEST/MSC/InitialAttach.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/InitialAttachReject.png b/openair3/NAS/TEST/MSC/InitialAttachReject.png deleted file mode 100644 index efe658694f..0000000000 Binary files a/openair3/NAS/TEST/MSC/InitialAttachReject.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/NomalDetach.png b/openair3/NAS/TEST/MSC/NomalDetach.png deleted file mode 100644 index e5ca319ada..0000000000 Binary files a/openair3/NAS/TEST/MSC/NomalDetach.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/README b/openair3/NAS/TEST/MSC/README deleted file mode 100644 index b78a7b3e74..0000000000 --- a/openair3/NAS/TEST/MSC/README +++ /dev/null @@ -1,34 +0,0 @@ -================================================================================ - Message Sequence Chart generation -================================================================================ - -Message Sequence Charts (MSCs) are a way of representing entities and -interactions to demonstrate how protocols operate between network elements. - -The Access Stratum simulator generates MSC description file that can be -processed by the Python script msc_gen.py to generate a PNG (Portable -Network Graphic) file. - -msc_gen.py use mscgen utility that is fully discribed at -http://www.mcternan.me.uk/mscgen/ - --------------------------------------------------------------------------------- - How to generate MSC description file ? --------------------------------------------------------------------------------- - -Redirect stderr stream to a file that will be used as input by the Python -script msc_gen.py: - -ASprocess 2> ASprocess.msc - --------------------------------------------------------------------------------- - How to generate PNG file ? --------------------------------------------------------------------------------- - -Parse the MSC description file using the Python script msc_gen.py: - -./msc_gen.py ASprocess.msc - -Warning: msc_gen.py needs mscgen utility to be installed. mscgen is a C -program that uses the GD graphics library for PNG output. - diff --git a/openair3/NAS/TEST/MSC/SwitchOffDetach.png b/openair3/NAS/TEST/MSC/SwitchOffDetach.png deleted file mode 100644 index 77b28c11a5..0000000000 Binary files a/openair3/NAS/TEST/MSC/SwitchOffDetach.png and /dev/null differ diff --git a/openair3/NAS/TEST/MSC/msc_gen.py b/openair3/NAS/TEST/MSC/msc_gen.py deleted file mode 100755 index 2857cddc33..0000000000 --- a/openair3/NAS/TEST/MSC/msc_gen.py +++ /dev/null @@ -1,354 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -# Lionel GAUTHIER -# This script is a downgrade of a python script written for the openair stack, generating sequence diagrams charts, displaying -# messages exchanged between LTE access stratum protocol entities. -# This script needs mscgen tool (http://www.mcternan.me.uk/mscgen/). -# -# The aim of this script is to collect some traces from oaisim stack and generate a mscgen script, then generate a sequence diagram -# image (png or jpeg) based on the scripts generated. -# An example of how it can be invoqued: msc_gen.py /tmp/msc_log.txt /tmp/msc_log2.txt msc_logx.txt are input text files, -# They/It are/is generated by the execution of executables in linux user space. May be it is better to operate on log files 'grepped' with MSC: -# ./my_exe.exe | grep \[MSC > /tmp/msc_log1.txt - - -# Now, examples of how to generate a mscgen trace in a C executable: -# -First you have to declare the instance(s) of the protocol(s) that will send or receive messages. -# This is done with the following line: -# [MSC_NEW][system time][protocol_name=instance_name] -# examples: -# printf("[MSC_NEW][%s][MIH-F=%s]\n", getTimeStamp4Log(), g_mihf_id); for declaring a new instance of a protocol entity of type MIH-F -# with an instance name g_mihf_id (of type char*) -# printf("[MSC_NEW][%s][NAS=%s]\n", getTimeStamp4Log(), "nas"); other example. -# This declaration of instances of protocols is mandatory to for this script to work. -# -# -Then for tracing a message you have to log a line following this format: -# [MSC_MSG][system time][source instance_name][--- message_name --->][destination instance_name] -# Note: -# ---> means a message that has been received correctly by destination -# ---x means a message lost by destination -# example -# NOTICE("[MSC_MSG][%s][%s][--- Link_Register.indication\\n%s ---x][%s]\n",getTimeStamp4Log(),g_link_id,g_msc_gen_buf,g_mihf_id); -# - - - - -import sys -import subprocess -import re -import socket -import datetime -import os.path -from datetime import date - -MSCGEN_OUTPUT_TYPE = "png" -MAX_MESSAGES_PER_PAGE = 36 - -SYSTEM_FRAME_NUMBER_STR = 'FRAME' -MODULE_STR = 'MOD' -RADIO_BEARER_STR = 'RB' -MSC_NEW_STR = '[MSC_NEW]' -MSC_MSG_STR = '[MSC_MSG]' -MSC_NBOX_STR = '[MSC_NBOX]' -MSC_BOX_STR = '[MSC_BOX]' -MSC_ABOX_STR = '[MSC_ABOX]' -MSC_RBOX_STR = '[MSC_RBOX]' - -# This dic is filled as follow : g_entities_dic[protocol_instance_name].append(protocol_name) -# where protocol_name can be any of the following MI-USER, MIH-F, RAL, LINK-SAP -g_entities_dic = {} -g_reverse_entities_dic = {} - - -# g_messages is filled with dictionnaries: -# message_dic['entity_src'] = protocol_entity_src -# message_dic['entity_dst'] = protocol_entity_dest -# message_dic['msg'] = message -# message_dic['line_color'] = g_display_color[entity_name] -# message_dic['text_color'] = g_display_color[entity_name] -# message_dic['time'] = system_frame_number -# message_dic['seq_no'] = sequence_number_generator() -# g_messages.append(message_dic) -g_messages = [] -g_messages_dic = {} - - -# g_display_order_dic is a dictionnary where the order of the display of entities sharing the same module identifier is hardcoded -#MAC and PHY valus have to be above num max radio bearer value -#g_display_order_dic = {'MIH-USER': 0, 'MIH-F': 1, 'RAL': 3, 'NAS': 4} -g_display_order_dic = {'NAS-UE': 0, 'AS': 1, 'NAS-MME': 3} - -# Display color of messages of sending entities -g_display_color = {'IP': '\"teal\"', - 'RRC_UE': '\"red\"', - 'MIH-USER': '\"black\"', - 'MIH-F': '\"black\"', - 'RAL': '\"black\"', - 'RAL_M': '\"black\"', - 'RLC_UM': '\"navy\"', - 'RLC_TM': '\"navy\"', - 'NAS': '\"black\"', - 'MAC_eNB': '\"indigo\"', - 'PHY': '\"purple\"', - 'NAS-UE': '\"black\"', - 'NAS-MME': '\"black\"', - 'AS': '\"black\"'} - - -g_final_display_order_list = [] -g_sequence_generator = 0 - -def sequence_number_generator(): - global g_sequence_generator - l_seq = g_sequence_generator - g_sequence_generator = g_sequence_generator + 1 - return l_seq - -def parse_log_file_for_discovering_protocol_entities(filename): - global g_entities_dic - global g_entities - global g_messages - global g_final_display_order_list - #open TXT file that contain OAI filtered traces for mscgen - - fhandle = open(filename, 'r') - fcontent = fhandle.read() - fhandle.close() - - # split file content in lines - lines = fcontent.splitlines() - for line in lines: - system_time = 'unknown' - - # if line is a trace of the creation of a new protocol instance - if MSC_NEW_STR in line: - partition = line.rpartition(MSC_NEW_STR) - msc_log_string = partition[2] - #print (" %s " % msc_log_string) - partition = msc_log_string.split('[') - print ("\n\n %s \n" % partition) - #if len(partition) == 2: - - item = partition[1] - item = item.strip() - item = item.strip(']') - system_time = item.split(' ')[-1] - print ("NEW system_time %s " % system_time) - - item = partition[2] - item = item.strip() - item = item.strip(']') - protocol_entity_type = item.split('=')[0] - protocol_entity_name = item.split('=')[-1] - print ("NEW protocol_entity_type %s " % protocol_entity_type) - print ("NEW protocol_entity_name %s " % protocol_entity_name) - - if protocol_entity_name not in g_entities_dic: - g_entities_dic[protocol_entity_name] = protocol_entity_type - - if protocol_entity_type not in g_reverse_entities_dic: - g_reverse_entities_dic[protocol_entity_type] = protocol_entity_name - else: - entity_name_list = g_reverse_entities_dic[protocol_entity_type] - entity_name_list.append(protocol_entity_name) - g_reverse_entities_dic[protocol_entity_type] = entity_name_list - #print (" g_entities_dic[%d][%d].append(%s)" % (module_id_int, radio_bearer_id_int, entity_name_src)) - print (" g_entities_dic= %s\n\n" % (g_entities_dic)) - print (" g_reverse_entities_dic= %s\n\n" % (g_reverse_entities_dic)) - - #g_entities.append(protocol_entity_type) - #print (" %s \n" % protocol_entity) - - - - - -def parse_log_file(filename): - global g_entities_dic - global g_entities - global g_messages - global g_final_display_order_list - #open TXT file that contain OAI filtered traces for mscgen - fhandle = open(filename, 'r') - fcontent = fhandle.read() - fhandle.close() - - # split file content in lines - lines = fcontent.splitlines() - for line in lines: - system_time = 'unknown' - message = 'unknown' - entity_name_src = 'unknown' - entity_name_dest = 'unknown' - - - # if line is a trace of the creation of a new protocol instance - if MSC_MSG_STR in line: - partition = line.strip().rpartition(MSC_MSG_STR) - msc_log_string = partition[2].strip() - print (" ++++ %s " % msc_log_string) - partition = msc_log_string.split('[') - print (" ++++ %s " % partition) - - #if len(partition) == 9: - message_dic = {} - - system_time = partition[1].strip().split(' ')[-1].strip(']') - message_dic['display_time'] = system_time - seconds_int = int(system_time.split(':')[0]) - micro_seconds_int = int(system_time.split(':')[-1]) - system_time_int = seconds_int*1000000 + micro_seconds_int - system_time=str(system_time_int) - print ('system_time %s' % system_time) - - entity_name_src = partition[2].strip().split(' ')[-1].strip(']') - print ('entity_name_src %s' % entity_name_src) - - message = partition[3].strip().strip(']').strip() - if (message[-1] == 'x') or (message[-1] == 'X'): - message_dic['arc'] = '-x' - elif message[-1] == '>': - message_dic['arc'] = '=>' - message = message.strip('<').strip('>').strip('x').strip('X').strip('-').strip('=').strip() - print ('message %s' % message) - - entity_name_dest = partition[4].strip().split(' ')[-1].strip(']') - print ('entity_name_dest %s' % entity_name_dest) - message_dic['entity_src'] = entity_name_src - message_dic['entity_dst'] = entity_name_dest - message_dic['msg'] = message - message_dic['line_color'] = g_display_color[g_entities_dic[entity_name_src]] - message_dic['text_color'] = g_display_color[g_entities_dic[entity_name_src]] - message_dic['time'] = system_time - #message_dic['seq_no'] = sequence_number_generator() - print ('%s\n\n' % message_dic) - g_messages_dic[system_time_int] = message_dic - #g_messages.append(message_dic) - -#TODO !!! - if MSC_RBOX_STR in line: - partition = line.strip().rpartition(MSC_RBOX_STR) - msc_log_string = partition[2].strip() - print (" ==== %s " % msc_log_string) - partition = msc_log_string.split('[') - print (" ==== %s " % partition) -#TODO !!! - -def generate_sorted_message_list(): - first_time_stamp = 0 - for system_time_int in sorted(g_messages_dic.iterkeys()): - if first_time_stamp == 0: - first_time_stamp = system_time_int - message_dic = g_messages_dic[system_time_int] - message_dic['seq_no'] = sequence_number_generator() - message_dic['display_time'] = str(system_time_int - first_time_stamp) - g_messages.append(message_dic) - -def generate_sorted_entity_display_list(): - module_display_order_dic = {} - for entity_name in sorted(g_entities_dic.iterkeys()): - module_display_order_dic[g_display_order_dic[g_entities_dic[entity_name]]] = entity_name - - - print("------------------------------------") - print(" %s " % (module_display_order_dic)) - - for display_priority in sorted(module_display_order_dic.iterkeys()): - g_final_display_order_list.append(module_display_order_dic[display_priority]) - -def msc_chart_write_header(fileP): - global g_final_display_order_list - fileP.write("msc {\n") - fileP.write("width = \"2048\";\n") - - entity_line_list_str = '' - for entity in g_final_display_order_list: - entity_line_list_str = entity_line_list_str + ' ' + entity + ',' - - entity_line_list_str = entity_line_list_str.rstrip().strip(',') - fileP.write(" %s;" % (entity_line_list_str)) - - -def msc_chart_write_footer(fileP): - fileP.write("\n}\n") - -def msc_chart_generate(file_nameP): - global MSCGEN_OUTPUT_TYPE - command_line = "mscgen -T " + MSCGEN_OUTPUT_TYPE + " -i " + file_nameP + "; chmod 777 " +file_nameP + ";" - - print("Command Line: %s " % (command_line)) - fi,fo,fe=os.popen3(command_line) - for i in fe.readlines(): - print "error:",i - -def get_nem_file_descriptor(): - global g_base_file_name - global g_page_index - l_file_name = g_base_file_name + str(g_page_index)+'.txt' - l_file = open(l_file_name, "w", 0777) - return l_file - - -###### MAIN START HERE ################# -num_args = len(sys.argv) -if num_args < 2: # the program name and the arguments - # stop the program and print an error message - sys.exit("Must provide at least one file to parse") - -for i in range(1,num_args): - print sys.argv[i] - -for i in range(1,num_args): - parse_log_file_for_discovering_protocol_entities(sys.argv[i]) - -for i in range(1,num_args): - parse_log_file(sys.argv[i]) - -generate_sorted_message_list() -generate_sorted_entity_display_list() - -g_page_index = 0 -g_message_index = 0 -g_message_index_in_current_page = 0 -g_now = datetime.datetime.now() -g_now_formated = g_now.strftime("%Y-%m-%d_%H.%M.%S") -g_currentdir = os.curdir -g_resultdir = os.path.join(g_currentdir, g_now_formated) -os.mkdir(g_resultdir, 0777) -os.chdir(g_resultdir) - -g_base_file_name = 'mih_mscgen_page_' - -g_file = get_nem_file_descriptor() -msc_chart_write_header(g_file) - -for message in g_messages: - - if 'msg' in message: - print ('message %s' % message) - g_file.write(" %s%s%s [ label = \"(%d) T%s %s\", linecolour=%s , textcolour=%s ] ;\n" % (message['entity_src'], message['arc'], message['entity_dst'], message['seq_no'], message['display_time'], message['msg'], message['line_color'], message['text_color'])) - elif 'box' in message: - g_file.write(" %s %s %s [ label = \"%s\", textbgcolour=%s , textcolour=%s ] ;\n" % (message['entity_src'], message['box_type'], message['entity_dst'], message['box'], message['textbg_color'], message['text_color'])) - - g_message_index = g_message_index + 1 - g_message_index_in_current_page = g_message_index_in_current_page + 1 - - if (g_message_index_in_current_page == MAX_MESSAGES_PER_PAGE): - msc_chart_write_footer(g_file) - g_file.close() - msc_chart_generate(g_file.name) - g_page_index = g_page_index + 1 - g_message_index_in_current_page = 0 - - g_file = get_nem_file_descriptor() - msc_chart_write_header(g_file) - - -msc_chart_write_footer(g_file) -g_file.close() -if g_message_index_in_current_page >= 1: - msc_chart_generate(g_file.name) -else: - print("Removing empty seq diagram file: %s " % (g_file.name)) - os.remove(g_file.name) diff --git a/openair3/NAS/UE/EMM/Detach.c b/openair3/NAS/UE/EMM/Detach.c index 719e18dd05..b61bcdc14d 100644 --- a/openair3/NAS/UE/EMM/Detach.c +++ b/openair3/NAS/UE/EMM/Detach.c @@ -53,7 +53,6 @@ Description Defines the detach related EMM procedure executed by the #include "emm_sap.h" #include "esm_sap.h" -#include "msc.h" #include // free diff --git a/openair3/NAS/UE/EMM/Identification.c b/openair3/NAS/UE/EMM/Identification.c index b5807973a2..0364c6d22f 100644 --- a/openair3/NAS/UE/EMM/Identification.c +++ b/openair3/NAS/UE/EMM/Identification.c @@ -48,7 +48,6 @@ Description Defines the identification EMM procedure executed by the #include "emmData.h" #include "emm_sap.h" -#include "msc.h" #include "user_defs.h" #include // malloc, free diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c index 6b226be380..ea4eefadeb 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_as.c +++ b/openair3/NAS/UE/EMM/SAP/emm_as.c @@ -61,7 +61,6 @@ Description Defines the EMMAS Service Access Point that provides #if defined(NAS_BUILT_IN_UE) # include "nas_itti_messaging.h" #endif -#include "msc.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index b27270fadc..f9a02b1a70 100644 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -63,7 +63,6 @@ Description Defines the security mode control EMM procedure executed by the # include "assertions.h" #include "secu_defs.h" -#include "msc.h" #include "SecurityModeControl.h" #if defined(NAS_BUILT_IN_UE) diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index 8016e0d791..c6762a7128 100644 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -23,7 +23,6 @@ #include "intertask_interface.h" #include "nas_itti_messaging.h" -#include "msc.h" # define TASK_ORIGIN TASK_NAS_UE @@ -104,27 +103,6 @@ int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_KENB_REFRESH_REQ); memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb)); - MSC_LOG_TX_MESSAGE( - MSC_NAS_UE, - MSC_RRC_UE, - NULL,0, - "0 NAS_KENB_REFRESH_REQ KeNB " - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x", - kenb[0], kenb[1], kenb[2], kenb[3], - kenb[4], kenb[5], kenb[6], kenb[7], - kenb[8], kenb[9], kenb[10], kenb[11], - kenb[12], kenb[13], kenb[14], kenb[15], - kenb[16], kenb[17], kenb[18], kenb[19], - kenb[20], kenb[21], kenb[22], kenb[23], - kenb[24], kenb[25], kenb[26], kenb[27], - kenb[28], kenb[29], kenb[30], kenb[31]); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } @@ -133,13 +111,6 @@ int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) { message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_CELL_SELECTION_REQ); NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID; NAS_CELL_SELECTION_REQ(message_p).rat = rat; - MSC_LOG_TX_MESSAGE( - MSC_NAS_UE, - MSC_RRC_UE, - NULL,0, - "0 NAS_CELL_SELECTION_REQ PLMN %X%X%X.%X%X%X", - plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3, - plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } @@ -152,14 +123,6 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID; NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data; NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length; - MSC_LOG_TX_MESSAGE( - MSC_NAS_UE, - MSC_RRC_UE, - NULL,0, - "0 NAS_CONN_ESTABLI_REQ MME code %u m-TMSI %u PLMN %X%X%X.%X%X%X", - s_tmsi.MMEcode, s_tmsi.m_tmsi, - plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3, - plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } @@ -178,11 +141,5 @@ int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, NAS_RAB_ESTABLI_RSP(message_p).s_tmsi = s_tmsi; NAS_RAB_ESTABLI_RSP(message_p).rabID = rabID; NAS_RAB_ESTABLI_RSP(message_p).errCode = errCode; - MSC_LOG_TX_MESSAGE( - MSC_NAS_UE, - MSC_RRC_UE, - NULL,0, - "0 NAS_RAB_ESTABLI_RSP MME code %u m-TMSI %u rb id %u status %u", - s_tmsi.MMEcode, s_tmsi.m_tmsi,rabID, errCode ); return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p); } diff --git a/openair3/NAS/UE/nas_itti_messaging.h b/openair3/NAS/UE/nas_itti_messaging.h index 967bbb3059..79b70394f0 100644 --- a/openair3/NAS/UE/nas_itti_messaging.h +++ b/openair3/NAS/UE/nas_itti_messaging.h @@ -26,7 +26,6 @@ #include "assertions.h" #include "intertask_interface.h" #include "esm_proc.h" -#include "msc.h" #ifndef NAS_ITTI_MESSAGING_H_ #define NAS_ITTI_MESSAGING_H_ diff --git a/openair3/NAS/UE/nas_proc.c b/openair3/NAS/UE/nas_proc.c index 6312a7dc97..9350590788 100644 --- a/openair3/NAS/UE/nas_proc.c +++ b/openair3/NAS/UE/nas_proc.c @@ -46,7 +46,6 @@ Description NAS procedure call manager #include "esm_main.h" #include "esm_sap.h" -#include "msc.h" #include // sprintf diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 88938c3c37..a94445349c 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -29,12 +29,9 @@ # include "user_api.h" # include "nas_parser.h" # include "nas_proc.h" -# include "msc.h" # include "memory.h" #include "nas_user.h" -#include - // FIXME make command line option for NAS_UE_AUTOSTART # define NAS_UE_AUTOSTART 1 @@ -97,7 +94,6 @@ void *nas_ue_task(void *args_p) nas_user_container_t *users=args_p; itti_mark_task_ready (TASK_NAS_UE); - MSC_START_USE(); LOG_I(NAS, "ue_idx_standalone val:: %u\n", ue_idx_standalone); /* Initialize UE NAS (EURECOM-NAS) */ // Intead of for loop for standalone mode 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.c b/openair3/NGAP/ngap_gNB.c index a5dfc88b35..9d6bd7f07f 100644 --- a/openair3/NGAP/ngap_gNB.c +++ b/openair3/NGAP/ngap_gNB.c @@ -57,7 +57,6 @@ #include "ngap_gNB_itti_messaging.h" #include "ngap_gNB_ue_context.h" // test, to be removed -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -273,7 +272,6 @@ void ngap_gNB_init(void) { NGAP_DEBUG("Starting NGAP layer\n"); ngap_gNB_prepare_internal_data(); itti_mark_task_ready(TASK_NGAP); - MSC_START_USE(); } void *ngap_gNB_process_itti_msg(void *notUsed) { diff --git a/openair3/NGAP/ngap_gNB_context_management_procedures.c b/openair3/NGAP/ngap_gNB_context_management_procedures.c index 73e4498f19..ea22c91bc2 100644 --- a/openair3/NGAP/ngap_gNB_context_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_context_management_procedures.c @@ -50,7 +50,6 @@ #include "ngap_gNB_management_procedures.h" #include "ngap_gNB_context_management_procedures.h" #include "NGAP_PDUSessionResourceItemCxtRelReq.h" -#include "msc.h" int ngap_ue_context_release_complete(instance_t instance, @@ -116,16 +115,6 @@ int ngap_ue_context_release_complete(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - buffer, - length, - MSC_AS_TIME_FMT" UEContextRelease successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %lu", - 0,0, //MSC_AS_TIME_ARGS(ctxt_pP), - ue_release_complete_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); - /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, @@ -267,16 +256,6 @@ int ngap_ue_context_release_req(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - buffer, - length, - MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %lu", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_release_req_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); - /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 2b0e8aab7c..35b152f129 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -48,7 +48,6 @@ #include "assertions.h" #include "conversions.h" -#include "msc.h" #include "NGAP_NonDynamic5QIDescriptor.h" static @@ -1208,14 +1207,6 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, case NGAP_UE_NGAP_IDs_PR_uE_NGAP_ID_pair: gnb_ue_ngap_id = ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID; asn_INTEGER2ulong(&(ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID), &amf_ue_ngap_id); - MSC_LOG_RX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - NULL,0, - "0 UEContextRelease/%s gNB_ue_ngap_id "NGAP_UE_ID_FMT" amf_ue_ngap_id "NGAP_UE_ID_FMT" len %u", - ngap_direction2String(pdu->present - 1), - gnb_ue_ngap_id, - amf_ue_ngap_id); if ((ue_desc_p = ngap_gNB_get_ue_context(amf_desc_p->ngap_gNB_instance, gnb_ue_ngap_id)) == NULL) { @@ -1225,12 +1216,6 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, gnb_ue_ngap_id); return -1; } else { - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_RRC_GNB, - NULL,0, - "0 NGAP_UE_CONTEXT_RELEASE_COMMAND/%d gNB_ue_ngap_id "NGAP_UE_ID_FMT" ", - gnb_ue_ngap_id); message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_UE_CONTEXT_RELEASE_COMMAND); if (ue_desc_p->amf_ue_ngap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode @@ -1629,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) { @@ -1717,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 */ @@ -1744,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 = @@ -1757,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 6686f8c19e..3f4b7d1aa1 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -48,7 +48,6 @@ #include "ngap_gNB_ue_context.h" #include "ngap_gNB_nas_procedures.h" #include "ngap_gNB_management_procedures.h" -#include "msc.h" //------------------------------------------------------------------------------ int ngap_gNB_handle_nas_first_req( @@ -312,14 +311,6 @@ int ngap_gNB_handle_nas_first_req( } ue_desc_p->tx_stream = amf_desc_p->nextstream; - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" initialUEMessage initiatingMessage gNB_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_desc_p->gNB_ue_ngap_id); /* Send encoded message over sctp */ ngap_gNB_itti_send_sctp_data_req(instance_p->instance, amf_desc_p->assoc_id, buffer, length, ue_desc_p->tx_stream); @@ -371,14 +362,6 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, if ((ue_desc_p = ngap_gNB_get_ue_context(ngap_gNB_instance, gnb_ue_ngap_id)) == NULL) { - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - NULL, - 0, - MSC_AS_TIME_FMT" downlinkNASTransport gNB_ue_ngap_id %u amf_ue_ngap_id %u", - gnb_ue_ngap_id, - amf_ue_ngap_id); NGAP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context gNB_UE_NGAP_ID: 0x%lx\n", assoc_id, gnb_ue_ngap_id); @@ -410,15 +393,6 @@ int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, } } - MSC_LOG_RX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - NULL, - 0, - MSC_AS_TIME_FMT" downlinkNASTransport gNB_ue_ngap_id %u amf_ue_ngap_id %u", - assoc_id, - amf_ue_ngap_id); - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_DownlinkNASTransport_IEs_t, ie, container, NGAP_ProtocolIE_ID_id_NAS_PDU, true); /* Forward the NAS PDU to NR-RRC */ @@ -532,15 +506,6 @@ int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_ return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" uplinkNASTransport initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, @@ -571,10 +536,6 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: %08x\n", ngap_nas_non_delivery_ind->gNB_ue_ngap_id); - MSC_LOG_EVENT( - MSC_NGAP_GNB, - MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to AMF failed, no context for gNB_ue_ngap_id %08x", - ngap_nas_non_delivery_ind->gNB_ue_ngap_id); return -1; } @@ -621,21 +582,9 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { NGAP_ERROR("Failed to encode NAS NON delivery indication\n"); /* Encode procedure has failed... */ - MSC_LOG_EVENT( - MSC_NGAP_GNB, - MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to AMF failed (encoding)"); return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" NASNonDeliveryIndication initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %lu", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, @@ -868,15 +817,6 @@ int ngap_gNB_initial_ctxt_resp( return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" InitialContextSetup successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - initial_ctxt_resp_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ LOG_I(NR_RRC,"Send message to sctp: NGAP_InitialContextSetupResponse\n"); ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, @@ -961,15 +901,6 @@ int ngap_gNB_ue_capabilities(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" UECapabilityInfoIndication initiatingMessage gNB_ue_ngap_id %u amf_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_cap_info_ind_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, @@ -1179,15 +1110,6 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" PduSession Setup successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - pdusession_setup_resp_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, @@ -1257,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; @@ -1265,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); @@ -1353,15 +1294,6 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" E_RAN Modify successful Outcome gNB_ue_ngap_id %u amf_ue_ngap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - pdusession_modify_resp_p->gNB_ue_ngap_id, - ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, @@ -1464,15 +1396,6 @@ int ngap_gNB_pdusession_release_resp(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_NGAP_GNB, - MSC_NGAP_AMF, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" E_RAN Release successfulOutcome gNB_ue_ngap_id %u amf_ue_ngap_id %lu", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - pdusession_release_resp_p->gNB_ue_ngap_id, - (uint64_t)ue_context_p->amf_ue_ngap_id); /* UE associated signalling -> use the allocated stream */ ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index e528c9e53e..5f30386bb3 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -56,7 +56,6 @@ #include "s1ap_eNB_itti_messaging.h" #include "s1ap_eNB_ue_context.h" // test, to be removed -#include "msc.h" #include "assertions.h" #include "conversions.h" @@ -507,7 +506,6 @@ void s1ap_eNB_init(void) { S1AP_DEBUG("Starting S1AP layer\n"); s1ap_eNB_prepare_internal_data(); itti_mark_task_ready(TASK_S1AP); - MSC_START_USE(); } void *s1ap_eNB_process_itti_msg(void *notUsed) { diff --git a/openair3/S1AP/s1ap_eNB_context_management_procedures.c b/openair3/S1AP/s1ap_eNB_context_management_procedures.c index 374da7272f..6255abb14d 100644 --- a/openair3/S1AP/s1ap_eNB_context_management_procedures.c +++ b/openair3/S1AP/s1ap_eNB_context_management_procedures.c @@ -47,7 +47,6 @@ #include "s1ap_eNB_nas_procedures.h" #include "s1ap_eNB_management_procedures.h" #include "s1ap_eNB_context_management_procedures.h" -#include "msc.h" int s1ap_ue_context_release_complete(instance_t instance, @@ -111,16 +110,6 @@ int s1ap_ue_context_release_complete(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - buffer, - length, - MSC_AS_TIME_FMT" UEContextRelease successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0, //MSC_AS_TIME_ARGS(ctxt_pP), - ue_release_complete_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -246,16 +235,6 @@ int s1ap_ue_context_release_req(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - buffer, - length, - MSC_AS_TIME_FMT" UEContextReleaseRequest initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_release_req_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 9ee3287b94..b3b38e7017 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -51,7 +51,6 @@ #include "assertions.h" #include "conversions.h" -#include "msc.h" static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, @@ -1025,14 +1024,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, case S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair: enb_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID; mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; - MSC_LOG_RX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - NULL,0, - "0 UEContextRelease/%s eNB_ue_s1ap_id "S1AP_UE_ID_FMT" mme_ue_s1ap_id "S1AP_UE_ID_FMT" len %u", - s1ap_direction2String(pdu->present - 1), - enb_ue_s1ap_id, - mme_ue_s1ap_id); if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, enb_ue_s1ap_id)) == NULL) { @@ -1042,12 +1033,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, enb_ue_s1ap_id); return -1; } else { - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_RRC_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_s1ap_id "S1AP_UE_ID_FMT" ", - enb_ue_s1ap_id); message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_UE_CONTEXT_RELEASE_COMMAND); if (ue_desc_p->mme_ue_s1ap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index b55bc06e11..0b56d31211 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -46,7 +46,6 @@ #include "s1ap_eNB_ue_context.h" #include "s1ap_eNB_nas_procedures.h" #include "s1ap_eNB_management_procedures.h" -#include "msc.h" //------------------------------------------------------------------------------ int s1ap_eNB_handle_nas_first_req( @@ -310,14 +309,6 @@ int s1ap_eNB_handle_nas_first_req( } ue_desc_p->tx_stream = mme_desc_p->nextstream; - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" initialUEMessage initiatingMessage eNB_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_desc_p->eNB_ue_s1ap_id); /* Send encoded message over sctp */ s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id, buffer, length, ue_desc_p->tx_stream); @@ -374,14 +365,6 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance, enb_ue_s1ap_id)) == NULL) { - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - NULL, - 0, - MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - enb_ue_s1ap_id, - mme_ue_s1ap_id); S1AP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context eNB_UE_S1AP_ID: 0x%lx\n", assoc_id, enb_ue_s1ap_id); @@ -413,15 +396,6 @@ int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, } } - MSC_LOG_RX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - NULL, - 0, - MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - assoc_id, - mme_ue_s1ap_id); - S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, S1AP_ProtocolIE_ID_id_NAS_PDU, true); if(ie == NULL) @@ -536,15 +510,6 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)NULL, - 0, - MSC_AS_TIME_FMT" uplinkNASTransport initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -574,10 +539,6 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: %06x\n", s1ap_nas_non_delivery_ind->eNB_ue_s1ap_id); - MSC_LOG_EVENT( - MSC_S1AP_ENB, - MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to MME failed, no context for eNB_ue_s1ap_id %06x", - s1ap_nas_non_delivery_ind->eNB_ue_s1ap_id); return -1; } @@ -623,21 +584,9 @@ int s1ap_eNB_nas_non_delivery_ind(instance_t instance, if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode NAS NON delivery indication\n"); /* Encode procedure has failed... */ - MSC_LOG_EVENT( - MSC_S1AP_ENB, - MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to MME failed (encoding)"); return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" NASNonDeliveryIndication initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -802,15 +751,6 @@ int s1ap_eNB_initial_ctxt_resp( return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" InitialContextSetup successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - initial_ctxt_resp_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -891,15 +831,6 @@ int s1ap_eNB_ue_capabilities(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" UECapabilityInfoIndication initiatingMessage eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_cap_info_ind_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -1075,15 +1006,6 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - e_rab_setup_resp_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -1238,15 +1160,6 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" E_RAN Modify successful Outcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - e_rab_modify_resp_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -1378,15 +1291,6 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, return -1; } - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" E_RAN Release successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - e_rab_release_resp_p->eNB_ue_s1ap_id, - ue_context_p->mme_ue_s1ap_id); /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, @@ -1615,16 +1519,6 @@ int s1ap_eNB_path_switch_req(instance_t instance, ue_context_p->tx_stream = mme_desc_p->nextstream; - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - (const char *)buffer, - length, - MSC_AS_TIME_FMT" E_RAN Setup successfulOutcome eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->eNB_ue_s1ap_id, - path_switch_req_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, mme_desc_p->assoc_id, buffer, diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 8d0166f805..ab49125856 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -48,7 +48,6 @@ #include "sctp_default_values.h" #include "sctp_common.h" #include "sctp_eNB_itti_messaging.h" -#include "msc.h" /* Used to format an uint32_t containing an ipv4 address */ #define IPV4_ADDR "%u.%u.%u.%u" @@ -1097,8 +1096,6 @@ void sctp_eNB_init(void) STAILQ_INIT(&sctp_cnx_list); itti_mark_task_ready(TASK_SCTP); - MSC_START_USE(); - } //------------------------------------------------------------------------------ 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 85cee4dda0..0000000000 --- a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb.band7.tm1.usrpb210.epc.local.conf +++ /dev/null @@ -1,171 +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"; - 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"; - gtpu_log_level ="info"; - gtpu_log_verbosity ="medium"; - udp_log_level ="info"; - udp_log_verbosity ="medium"; - }; - - } -); 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 df06231e4a..0000000000 --- a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb1.conf +++ /dev/null @@ -1,167 +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"; - 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"; - }; - - } -); 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 -#include - -#include "commonDef.h" -#include "platform_types.h" -#include "platform_constants.h" -#include "s1ap_messages_types.h" -#include "SystemInformationBlockType2.h" - -#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\ - struct in_addr inp;\ - if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\ - AssertFatal (0, MeSsAgE);\ - } else {\ - NwBo = inp.s_addr;\ - }\ - } while (0); - -/** @defgroup _enb_app ENB APP - * @ingroup _oai2 - * @{ - */ - -// Hard to find a defined value for max enb... -#define EPC_TEST_SCENARIO_MAX_ENB 4 - - -typedef struct mme_ip_address_s { - unsigned ipv4:1; - unsigned ipv6:1; - unsigned active:1; - char *ipv4_address; - char *ipv6_address; -} mme_ip_address_t; - -typedef struct Enb_properties_s { - /* Unique eNB_id to identify the eNB within EPC. - * For macro eNB ids this field should be 20 bits long. - * For home eNB ids this field should be 28 bits long. - */ - uint32_t eNB_id; - - /* The type of the cell */ - enum cell_type_e cell_type; - - /* Optional name for the cell - * NOTE: the name can be NULL (i.e no name) and will be cropped to 150 - * characters. - */ - char *eNB_name; - - /* Tracking area code */ - uint16_t tac; - - /* Mobile Country Code - * Mobile Network Code - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - - /* Nb of MME to connect to */ - uint8_t nb_mme; - /* List of MME to connect to */ - mme_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS]; - - int sctp_in_streams; - int sctp_out_streams; - - char *enb_interface_name_for_S1U; - in_addr_t enb_ipv4_address_for_S1U; - tcp_udp_port_t enb_port_for_S1U; - - char *enb_interface_name_for_S1_MME; - in_addr_t enb_ipv4_address_for_S1_MME; - -} Enb_properties_t; - -typedef struct Enb_properties_array_s { - int number; - Enb_properties_t *properties[EPC_TEST_SCENARIO_MAX_ENB]; -} Enb_properties_array_t; - -void enb_config_init(const char const * lib_config_file_name_pP); - -#endif /* ENB_CONFIG_H_ */ -/** @} */ diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c deleted file mode 100644 index ebaffdb39e..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario.c +++ /dev/null @@ -1,1240 +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 - */ - -/* - play_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 "assertions.h" -#include "s1ap_common.h" -#include "intertask_interface.h" -#include "play_scenario.h" -#include "sctp_eNB_task.h" -#include "sctp_default_values.h" -#include "log.h" -//------------------------------------------------------------------------------ -#define PLAY_SCENARIO 1 -#define GS_IS_FILE 1 -#define GS_IS_DIR 2 -//------------------------------------------------------------------------------ -Enb_properties_array_t g_enb_properties; -int g_max_speed = 0; -//------------------------------------------------------------------------------ -extern et_scenario_t *g_scenario; -extern int xmlLoadExtDtdDefaultValue; -extern int asn_debug; -extern int asn1_xer_print; -extern pthread_mutex_t g_fsm_lock; - -//------------------------------------------------------------------------------ -// MEMO: -// Scenario with several eNBs: We may have to create ethx.y interfaces -// - - - -//------------------------------------------------------------------------------ -// 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 et_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 -void et_get_shift_arg( char * line_argument, shift_packet_t * const shift) -{ - int len = strlen(line_argument); - int i = 0; - int j = 0; - int num_milli = 0; - char my_num[64]; - int negative = 0; - - - while ((line_argument[i] != ':') && (i < len)) { - if (isdigit(line_argument[i])) { // may occur '\"' - my_num[j++] = line_argument[i]; - } - i += 1; - } - AssertFatal(':' == line_argument[i], "Bad format"); - i += 1; // ':' - my_num[j++] = '\0'; - shift->frame_number = atoi(my_num); - AssertFatal(ishift_seconds = atoi(my_num); - // may omit .mmm, accept .m or .mm or .mmm or ... - while ((i < len) && (num_milli++ < 3)){ - my_num[j++] = line_argument[i++]; - } - while (num_milli++ < 6){ - my_num[j++] = '0'; - } - my_num[j] = '\0'; - shift->shift_microseconds = atoi(my_num); - if (negative == 1) { - shift->shift_seconds = - shift->shift_seconds; - shift->shift_microseconds = - shift->shift_microseconds; - } -} -//------------------------------------------------------------------------------ -// 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; -} -//------------------------------------------------------------------------------ -void et_free_packet(et_packet_t* packet) -{ - if (packet) { - switch (packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA: - et_free_pointer(packet->sctp_hdr.u.data_hdr.payload.binary_stream); - break; - default: - ; - } - et_free_pointer(packet); - } -} - -//------------------------------------------------------------------------------ -void et_free_scenario(et_scenario_t* scenario) -{ - et_packet_t *packet = NULL; - et_packet_t *next_packet = NULL; - if (scenario) { - packet = scenario->list_packet; - while (packet) { - next_packet = packet->next; - et_free_packet(packet); - packet = next_packet->next; - } - et_free_pointer(scenario); - pthread_mutex_destroy(&g_fsm_lock); - } -} - -//------------------------------------------------------------------------------ -char * et_ip2ip_str(const et_ip_t * const ip) -{ - static char str[INET6_ADDRSTRLEN]; - - sprintf(str, "ERROR"); - switch (ip->address_family) { - case AF_INET6: - inet_ntop(AF_INET6, &(ip->address.ipv6), str, INET6_ADDRSTRLEN); - break; - case AF_INET: - inet_ntop(AF_INET, &(ip->address.ipv4), str, INET_ADDRSTRLEN); - break; - default: - ; - } - return str; -} -//------------------------------------------------------------------------------ -//convert hexstring to len bytes of data -//returns 0 on success, negative on error -//data is a buffer of at least len bytes -//hexstring is upper or lower case hexadecimal, NOT prepended with "0x" -int et_hex2data(unsigned char * const data, const unsigned char * const hexstring, const unsigned int len) -{ - unsigned const char *pos = hexstring; - char *endptr = NULL; - size_t count = 0; - - fprintf(stdout, "%s(%s,%u)\n", __FUNCTION__, hexstring, len); - - if ((len > 1) && (strlen((const char*)hexstring) % 2)) { - //or hexstring has an odd length - return -3; - } - - if (len == 1) { - char buf[5] = {'0', 'x', 0, pos[0], '\0'}; - data[0] = strtol(buf, &endptr, 16); - /* Check for various possible errors */ - AssertFatal ((errno == 0) || (data[0] != 0), "ERROR %s() strtol: %s\n", __FUNCTION__, strerror(errno)); - AssertFatal (endptr != buf, "ERROR %s() No digits were found\n", __FUNCTION__); - return 0; - } - - for(count = 0; count < len/2; count++) { - char buf[5] = {'0', 'x', pos[0], pos[1], 0}; - data[count] = strtol(buf, &endptr, 16); - pos += 2 * sizeof(char); - AssertFatal (endptr[0] == '\0', "ERROR %s() non-hexadecimal character encountered buf %p endptr %p buf %s count %zu pos %p\n", __FUNCTION__, buf, endptr, buf, count, pos); - AssertFatal (endptr != buf, "ERROR %s() No digits were found\n", __FUNCTION__); - } - return 0; -} -//------------------------------------------------------------------------------ -sctp_cid_t et_chunk_type_str2cid(const xmlChar * const chunk_type_str) -{ - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"DATA"))) { return SCTP_CID_DATA;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"INIT"))) { return SCTP_CID_INIT;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"INIT_ACK"))) { return SCTP_CID_INIT_ACK;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"SACK"))) { return SCTP_CID_SACK;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"HEARTBEAT"))) { return SCTP_CID_HEARTBEAT;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"HEARTBEAT_ACK"))) { return SCTP_CID_HEARTBEAT_ACK;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"ABORT"))) { return SCTP_CID_ABORT;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"SHUTDOWN"))) { return SCTP_CID_SHUTDOWN;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"SHUTDOWN_ACK"))) { return SCTP_CID_SHUTDOWN_ACK;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"ERROR"))) { return SCTP_CID_ERROR;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"COOKIE_ECHO"))) { return SCTP_CID_COOKIE_ECHO;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"COOKIE_ACK"))) { return SCTP_CID_COOKIE_ACK;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"ECN_ECNE"))) { return SCTP_CID_ECN_ECNE;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"ECN_CWR"))) { return SCTP_CID_ECN_CWR;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"SHUTDOWN_COMPLETE"))) { return SCTP_CID_SHUTDOWN_COMPLETE;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"AUTH"))) { return SCTP_CID_AUTH;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"FWD_TSN"))) { return SCTP_CID_FWD_TSN;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"ASCONF"))) { return SCTP_CID_ASCONF;} - if ((!xmlStrcmp(chunk_type_str, (const xmlChar *)"ASCONF_ACK"))) { return SCTP_CID_ASCONF_ACK;} - AssertFatal (0, "ERROR: %s() cannot convert: %s\n", __FUNCTION__, chunk_type_str); -} -//------------------------------------------------------------------------------ -const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type) -{ - switch (chunk_type) { - case SCTP_CID_DATA: return "DATA"; break; - case SCTP_CID_INIT: return "INIT"; break; - case SCTP_CID_INIT_ACK: return "INIT_ACK"; break; - case SCTP_CID_SACK: return "SACK"; break; - case SCTP_CID_HEARTBEAT: return "HEARTBEAT"; break; - case SCTP_CID_HEARTBEAT_ACK: return "HEARTBEAT_ACK"; break; - case SCTP_CID_ABORT: return "ABORT"; break; - case SCTP_CID_SHUTDOWN: return "SHUTDOWN"; break; - case SCTP_CID_SHUTDOWN_ACK: return "SHUTDOWN_ACK"; break; - case SCTP_CID_ERROR: return "ERROR"; break; - case SCTP_CID_COOKIE_ECHO: return "COOKIE_ECHO"; break; - case SCTP_CID_COOKIE_ACK: return "COOKIE_ACK"; break; - case SCTP_CID_ECN_ECNE: return "ECN_ECNE"; break; - case SCTP_CID_ECN_CWR: return "ECN_CWR"; break; - case SCTP_CID_SHUTDOWN_COMPLETE: return "SHUTDOWN_COMPLETE"; break; - case SCTP_CID_AUTH: return "AUTH"; break; - case SCTP_CID_FWD_TSN: return "FWD_TSN"; break; - case SCTP_CID_ASCONF: return "ASCONF"; break; - case SCTP_CID_ASCONF_ACK: return "ASCONF_ACK"; break; - default: - AssertFatal (0, "ERROR: Unknown chunk_type %d!\n", chunk_type); - } -} -//------------------------------------------------------------------------------ -const char * const et_error_match2str(const int err) -{ - switch (err) { - // from asn_compare.h - case COMPARE_ERR_CODE_NO_MATCH: return "CODE_NO_MATCH"; break; - case COMPARE_ERR_CODE_TYPE_MISMATCH: return "TYPE_MISMATCH"; break; - case COMPARE_ERR_CODE_TYPE_ARG_NULL: return "TYPE_ARG_NULL"; break; - case COMPARE_ERR_CODE_VALUE_NULL: return "VALUE_NULL"; break; - case COMPARE_ERR_CODE_VALUE_ARG_NULL: return "VALUE_ARG_NULL"; break; - case COMPARE_ERR_CODE_CHOICE_NUM: return "CHOICE_NUM"; break; - case COMPARE_ERR_CODE_CHOICE_PRESENT: return "CHOICE_PRESENT"; break; - case COMPARE_ERR_CODE_CHOICE_MALFORMED: return "CHOICE_MALFORMED"; break; - case COMPARE_ERR_CODE_SET_MALFORMED: return "SET_MALFORMED"; break; - case COMPARE_ERR_CODE_COLLECTION_NUM_ELEMENTS: return "COLLECTION_NUM_ELEMENTS"; break; - // from play_scenario.h - case ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE: return "SCTP_CHUNK_TYPE"; break; - case ET_ERROR_MATCH_PACKET_SCTP_PPID: return "SCTP_PPID"; break; - case ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID: return "SCTP_ASSOC_ID"; break; - case ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID: return "SCTP_STREAM_ID"; break; - case ET_ERROR_MATCH_PACKET_SCTP_SSN: return "SCTP_SSN"; break; - case ET_ERROR_MATCH_PACKET_S1AP_PRESENT: return "S1AP_PRESENT"; break; - case ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE: return "S1AP_PROCEDURE_CODE"; break; - case ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY: return "S1AP_CRITICALITY"; break; - default: - AssertFatal (0, "ERROR: Unknown match error %d!(TODO handle an1c error codes)\n", err); - } -} -//------------------------------------------------------------------------------ -et_packet_action_t et_action_str2et_action_t(const xmlChar * const action) -{ - if ((!xmlStrcmp(action, (const xmlChar *)"SEND"))) { return ET_PACKET_ACTION_S1C_SEND;} - if ((!xmlStrcmp(action, (const xmlChar *)"RECEIVE"))) { return ET_PACKET_ACTION_S1C_RECEIVE;} - AssertFatal (0, "ERROR: cannot convert: %s\n", action); - //if (NULL == action) {return ACTION_S1C_NULL;} -} -//------------------------------------------------------------------------------ -void et_ip_str2et_ip(const xmlChar * const ip_str, et_ip_t * const ip) -{ - AssertFatal (NULL != ip_str, "ERROR Cannot convert null string to ip address!\n"); - AssertFatal (NULL != ip, "ERROR out parameter pointer is NULL!\n"); - // store this IP address in sa: - if (inet_pton(AF_INET, (const char*)ip_str, (void*)&(ip->address.ipv4)) > 0) { - ip->address_family = AF_INET; - strncpy((char *)ip->str, (const char *)ip_str, INET_ADDRSTRLEN+1); - } else if (inet_pton(AF_INET6, (const char*)ip_str, (void*)&(ip->address.ipv6)) > 0) { - ip->address_family = AF_INET6; - strncpy((char *)ip->str, (const char *)ip_str, INET6_ADDRSTRLEN+1); - } else { - ip->address_family = AF_UNSPEC; - AssertFatal (0, "ERROR %s() Could not parse ip address %s!\n", __FUNCTION__, ip_str); - } -} -//------------------------------------------------------------------------------ -int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_address_t * const net_ip) -{ - AssertFatal (NULL != ip, "ERROR ip parameter\n"); - AssertFatal (NULL != net_ip, "ERROR net_ip parameter\n"); - switch (ip->address_family) { - case AF_INET: - if (net_ip->ipv4) { - //S1AP_DEBUG("%s(%s,%s)=%d\n",__FUNCTION__,ip->str, net_ip->ipv4_address, strcmp(ip->str, net_ip->ipv4_address)); - return strcmp(ip->str, net_ip->ipv4_address); - } - //S1AP_DEBUG("%s(%s,%s)=-1 (IP version (4) not matching)\n",__FUNCTION__,ip->str, net_ip->ipv4_address); - return -1; - break; - case AF_INET6: - if (net_ip->ipv6) { - //S1AP_DEBUG("%s(%s,%s)=%d\n",__FUNCTION__,ip->str, net_ip->ipv4_address, strcmp(ip->str, net_ip->ipv6_address)); - return strcmp(ip->str, net_ip->ipv6_address); - } - //S1AP_DEBUG("%s(%s,%s)=-1 (IP version (6) not matching)\n",__FUNCTION__,ip->str, net_ip->ipv6_address); - return -1; - break; - default: - S1AP_DEBUG("%s(%s,...)=-1 (unknown IP version)\n",__FUNCTION__,ip->str); - return -1; - } -} - -#ifdef LIBCONFIG_LONG -#define libconfig_int long -#else -#define libconfig_int int -#endif -//------------------------------------------------------------------------------ -void et_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; - libconfig_int my_int; - 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[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 , 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 = et_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; - } - } - // SCTP SETTING - g_enb_properties.properties[enb_properties_index]->sctp_out_streams = SCTP_OUT_STREAMS; - g_enb_properties.properties[enb_properties_index]->sctp_in_streams = SCTP_IN_STREAMS; - subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_SCTP_CONFIG); - - if (subsetting != NULL) { - if ( (config_setting_lookup_int( subsetting, ENB_CONFIG_STRING_SCTP_INSTREAMS, &my_int) )) { - g_enb_properties.properties[enb_properties_index]->sctp_in_streams = (uint16_t)my_int; - } - - if ( (config_setting_lookup_int( subsetting, ENB_CONFIG_STRING_SCTP_OUTSTREAMS, &my_int) )) { - g_enb_properties.properties[enb_properties_index]->sctp_out_streams = (uint16_t)my_int; - } - } - - - // 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" : ""); -} -/*------------------------------------------------------------------------------*/ -const Enb_properties_array_t *et_enb_config_get(void) -{ - return &g_enb_properties; -} -/*------------------------------------------------------------------------------*/ -void et_eNB_app_register(const Enb_properties_array_t *enb_properties) -{ - uint32_t enb_id = 0; - uint32_t mme_id = 0; - MessageDef *msg_p = NULL; - char *str = NULL; - struct in_addr addr = {.s_addr = 0}; - - - g_scenario->register_enb_pending = 0; - for (enb_id = 0; (enb_id < enb_properties->number) ; enb_id++) { - { - s1ap_register_enb_req_t *s1ap_register_eNB = NULL; - - /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); - - s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p); - - /* Some default/random parameters */ - s1ap_register_eNB->eNB_id = enb_properties->properties[enb_id]->eNB_id; - s1ap_register_eNB->cell_type = enb_properties->properties[enb_id]->cell_type; - s1ap_register_eNB->eNB_name = enb_properties->properties[enb_id]->eNB_name; - s1ap_register_eNB->tac = enb_properties->properties[enb_id]->tac; - s1ap_register_eNB->mcc = enb_properties->properties[enb_id]->mcc; - s1ap_register_eNB->mnc = enb_properties->properties[enb_id]->mnc; - s1ap_register_eNB->mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length; - - s1ap_register_eNB->nb_mme = enb_properties->properties[enb_id]->nb_mme; - AssertFatal (s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, "Too many MME for eNB %d (%d/%d)!", enb_id, s1ap_register_eNB->nb_mme, - S1AP_MAX_NB_MME_IP_ADDRESS); - - for (mme_id = 0; mme_id < s1ap_register_eNB->nb_mme; mme_id++) { - s1ap_register_eNB->mme_ip_address[mme_id].ipv4 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4; - s1ap_register_eNB->mme_ip_address[mme_id].ipv6 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6; - strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv4_address, - enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4_address, - sizeof(s1ap_register_eNB->mme_ip_address[0].ipv4_address)); - strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv6_address, - enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6_address, - sizeof(s1ap_register_eNB->mme_ip_address[0].ipv6_address)); - } - - s1ap_register_eNB->sctp_in_streams = enb_properties->properties[enb_id]->sctp_in_streams; - s1ap_register_eNB->sctp_out_streams = enb_properties->properties[enb_id]->sctp_out_streams; - - - s1ap_register_eNB->enb_ip_address.ipv6 = 0; - s1ap_register_eNB->enb_ip_address.ipv4 = 1; - addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_S1_MME; - str = inet_ntoa(addr); - strcpy(s1ap_register_eNB->enb_ip_address.ipv4_address, str); - - g_scenario->register_enb_pending++; - itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - } - } -} -/*------------------------------------------------------------------------------*/ -void *et_eNB_app_task(void *args_p) -{ - et_scenario_t *scenario = (et_scenario_t*)args_p; - MessageDef *msg_p = NULL; - const char *msg_name = NULL; - instance_t instance = 0; - int result = 0; - - itti_mark_task_ready (TASK_ENB_APP); - - do { - // Wait for a message - itti_receive_msg (TASK_ENB_APP, &msg_p); - - msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); - - switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - itti_exit_task (); - break; - - case S1AP_REGISTER_ENB_CNF: - LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, - S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); - - DevAssert(scenario->register_enb_pending > 0); - scenario->register_enb_pending--; - - /* Check if at least eNB is registered with one MME */ - if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) { - scenario->registered_enb++; - } - - /* Check if all register eNB requests have been processed */ - if (scenario->register_enb_pending == 0) { - timer_remove(scenario->enb_register_retry_timer_id); - if (scenario->registered_enb == scenario->enb_properties->number) { - /* If all eNB are registered, start scenario */ - LOG_D(ENB_APP, " All eNB are now associated with a MME\n"); - et_event_t event; - event.code = ET_EVENT_S1C_CONNECTED; - et_scenario_fsm_notify_event(event); - } else { - uint32_t not_associated = scenario->enb_properties->number - scenario->registered_enb; - - LOG_W(ENB_APP, " %d eNB %s not associated with a MME, retrying registration in %d seconds ...\n", - not_associated, not_associated > 1 ? "are" : "is", ET_ENB_REGISTER_RETRY_DELAY); - - /* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */ - if (timer_setup (ET_ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - NULL, &scenario->enb_register_retry_timer_id) < 0) { - LOG_E(ENB_APP, " Can not start eNB register retry timer, use \"sleep\" instead!\n"); - - sleep(ET_ENB_REGISTER_RETRY_DELAY); - /* Restart the registration process */ - scenario->registered_enb = 0; - et_eNB_app_register (scenario->enb_properties); - } - } - } - - break; - - case S1AP_DEREGISTERED_ENB_IND: - LOG_W(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, - S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); - - /* TODO handle recovering of registration */ - break; - - case TIMER_HAS_EXPIRED: - LOG_I(ENB_APP, " Received %s: timer_id %d\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id); - - if (TIMER_HAS_EXPIRED (msg_p).timer_id == scenario->enb_register_retry_timer_id) { - /* Restart the registration process */ - scenario->registered_enb = 0; - et_eNB_app_register (scenario->enb_properties); - } - break; - - default: - LOG_E(ENB_APP, "Received unexpected message %s\n", msg_name); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } while (1); - return NULL; -} - -//------------------------------------------------------------------------------ -int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s *shifts) -{ - et_event_t event; - struct shift_packet_s *shift = shifts; - et_packet_t *packet = NULL; - et_packet_t *next_packet = NULL; - struct timeval shift_all_packets = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval relative_last_sent_packet = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval relative_last_received_packet = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval initial_time = { .tv_sec = 0, .tv_usec = 0 }; - char first_packet = 1; - char first_sent_packet = 1; - char first_received_packet = 1; - - // first apply timing shifts if requested - while (shift) { - packet = scenario->list_packet; - while (packet) { - //fprintf(stdout, "*shift: %p\n", shift); - //fprintf(stdout, "\tframe_number: %d\n", shift->frame_number); - //fprintf(stdout, "\tshift_seconds: %ld\n", shift->shift_seconds); - //fprintf(stdout, "\tshift_microseconds: %ld\n", shift->shift_microseconds); - //fprintf(stdout, "\tsingle: %d\n\n", shift->single); - //fprintf(stdout, "\tshift_all_packets_seconds: %ld\n", shift_all_packets.tv_sec); - //fprintf(stdout, "\tshift_all_packets_microseconds: %ld\n", shift_all_packets.tv_usec); - - AssertFatal((packet->time_relative_to_first_packet.tv_sec >= 0) && (packet->time_relative_to_first_packet.tv_usec >= 0), - "Bad timing result time_relative_to_first_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_first_packet.tv_sec, - packet->time_relative_to_first_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); - AssertFatal((packet->time_relative_to_last_received_packet.tv_sec >= 0) && (packet->time_relative_to_last_received_packet.tv_usec >= 0), - "Bad timing result time_relative_to_last_received_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_last_received_packet.tv_sec, - packet->time_relative_to_last_received_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); - AssertFatal((packet->time_relative_to_last_sent_packet.tv_sec >= 0) && (packet->time_relative_to_last_sent_packet.tv_usec >= 0), - "Bad timing result time_relative_to_last_sent_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_last_sent_packet.tv_sec, - packet->time_relative_to_last_sent_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); -// fprintf(stdout, "\tpacket num %u, original frame number %u time_relative_to_first_packet=%d.%d\n", -// packet->packet_number, -// packet->original_frame_number, -// packet->time_relative_to_first_packet.tv_sec, -// packet->time_relative_to_first_packet.tv_usec); -// fprintf(stdout, "\tpacket num %u, original frame number %u time_relative_to_last_received_packet=%d.%d\n", -// packet->packet_number, -// packet->original_frame_number, -// packet->time_relative_to_last_received_packet.tv_sec, -// packet->time_relative_to_last_received_packet.tv_usec); -// fprintf(stdout, "\tpacket num %u, original frame number %u time_relative_to_last_sent_packet=%d.%d\n", -// packet->packet_number, -// packet->original_frame_number, -// packet->time_relative_to_last_sent_packet.tv_sec, -// packet->time_relative_to_last_sent_packet.tv_usec); - - if ((shift->single) && (shift->frame_number == packet->original_frame_number)) { - struct timeval t_offset = { .tv_sec = shift->shift_seconds, .tv_usec = shift->shift_microseconds }; - et_packet_shift_timing(packet, &t_offset); - next_packet = packet->next; - if (next_packet) { - t_offset.tv_sec = -t_offset.tv_sec; - t_offset.tv_usec = -t_offset.tv_usec; - - if (packet->action == ET_PACKET_ACTION_S1C_SEND) { - timeval_add(&next_packet->time_relative_to_last_sent_packet, &next_packet->time_relative_to_last_sent_packet, &t_offset); - } else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - timeval_add(&next_packet->time_relative_to_last_received_packet, &next_packet->time_relative_to_last_received_packet, &t_offset); - } - } - } - if ((0 == shift->single) && (shift->frame_number == packet->original_frame_number)) { - shift_all_packets.tv_sec = shift->shift_seconds; - shift_all_packets.tv_usec = shift->shift_microseconds; - timeval_add(&packet->time_relative_to_first_packet, &packet->time_relative_to_first_packet, &shift_all_packets); - fprintf(stdout, "\tpacket num %u, now original frame number %u time_relative_to_first_packet=%d.%d\n", - packet->packet_number, - packet->original_frame_number, - packet->time_relative_to_first_packet.tv_sec, - packet->time_relative_to_first_packet.tv_usec); - AssertFatal((packet->time_relative_to_first_packet.tv_sec >= 0) && (packet->time_relative_to_first_packet.tv_usec >= 0), - "Bad timing result time_relative_to_first_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_first_packet.tv_sec, - packet->time_relative_to_first_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); - } else if ((0 == shift->single) && (shift->frame_number < packet->original_frame_number)) { - timeval_add(&packet->time_relative_to_first_packet, &packet->time_relative_to_first_packet, &shift_all_packets); - fprintf(stdout, "\tpacket num %u, now original frame number %u time_relative_to_first_packet=%d.%d\n", - packet->packet_number, - packet->original_frame_number, - packet->time_relative_to_first_packet.tv_sec, - packet->time_relative_to_first_packet.tv_usec); - AssertFatal((packet->time_relative_to_first_packet.tv_sec >= 0) && (packet->time_relative_to_first_packet.tv_usec >= 0), - "Bad timing result time_relative_to_first_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_first_packet.tv_sec, - packet->time_relative_to_first_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); - } - packet = packet->next; - } - shift = shift->next; - } - // now recompute time_relative_to_last_received_packet, time_relative_to_last_sent_packet - packet = scenario->list_packet; - while (packet) { - if (first_packet > 0) { - initial_time = packet->time_relative_to_first_packet; - packet->time_relative_to_first_packet.tv_sec = 0; - packet->time_relative_to_first_packet.tv_usec = 0; - first_packet = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &initial_time, - &packet->time_relative_to_first_packet); - } - if (packet->action == ET_PACKET_ACTION_S1C_SEND) { - if (first_sent_packet > 0) { - relative_last_sent_packet = packet->time_relative_to_first_packet; - packet->time_relative_to_last_sent_packet.tv_sec = 0; - packet->time_relative_to_last_sent_packet.tv_usec = 0; - first_sent_packet = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_sent_packet, - &packet->time_relative_to_last_sent_packet); - relative_last_sent_packet = packet->time_relative_to_first_packet; - } - if (first_received_packet > 0) { - packet->time_relative_to_last_received_packet.tv_sec = 0; - packet->time_relative_to_last_received_packet.tv_usec = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_received_packet, - &packet->time_relative_to_last_received_packet); - } - } else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - if (first_received_packet > 0) { - relative_last_received_packet.tv_sec = packet->time_relative_to_first_packet.tv_sec; - relative_last_received_packet.tv_usec = packet->time_relative_to_first_packet.tv_usec; - packet->time_relative_to_last_received_packet.tv_sec = 0; - packet->time_relative_to_last_received_packet.tv_usec = 0; - first_received_packet = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_received_packet, - &packet->time_relative_to_last_received_packet); - relative_last_received_packet = packet->time_relative_to_first_packet; - } - if (first_sent_packet > 0) { - packet->time_relative_to_last_sent_packet.tv_sec = 0; - packet->time_relative_to_last_sent_packet.tv_usec = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_sent_packet, - &packet->time_relative_to_last_sent_packet); - } - } - packet = packet->next; - } - //et_display_scenario(scenario); - - // create SCTP ITTI task: same as eNB code - if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; - } - - // create S1AP ITTI task: not as same as eNB code - if (itti_create_task (TASK_S1AP, et_s1ap_eNB_task, NULL) < 0) { - LOG_E(S1AP, "Create task for S1AP failed\n"); - return -1; - } - - // create ENB_APP ITTI task: not as same as eNB code - if (itti_create_task (TASK_ENB_APP, et_eNB_app_task, scenario) < 0) { - LOG_E(ENB_APP, "Create task for ENB_APP failed\n"); - return -1; - } - - event.code = ET_EVENT_INIT; - event.u.init.scenario = scenario; - et_scenario_fsm_notify_event(event); - - - return 0; -} - -//------------------------------------------------------------------------------ -static void et_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, "\t-d | --test-dir Directory where a set of files related to a particular test are located\n"); - fprintf (stdout, "\t-c | --enb-conf-file Provide an eNB config file, valid for the testbed\n"); - fprintf (stdout, "\t-D | --delay-on-exit Wait delay-in-sec before exiting\n"); - fprintf (stdout, "\t-f | --shift-packet Shift the timing of a packet'\n"); - fprintf (stdout, "\t-F | --shift-packets Shift the timing of packets starting at frame 'frame' included\n"); - fprintf (stdout, "\t-m | --max-speed Play scenario as fast as possible without respecting frame timings\n"); - fprintf (stdout, "\t-s | --scenario File name (with no path) of a test scenario that has to be replayed ()\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"); -} - -//------------------------------------------------------------------------------ -int -et_config_parse_opt_line ( - int argc, - char *argv[], - char **et_dir_name, - char **scenario_file_name, - char **enb_config_file_name, - shift_packet_t **shifts, - int *delay_on_exit) -//------------------------------------------------------------------------------ -{ - int option = 0; - int rv = 0; - shift_packet_t *shift = NULL; - - enum long_option_e { - LONG_OPTION_START = 0x100, /* Start after regular single char options */ - LONG_OPTION_ENB_CONF_FILE, - LONG_OPTION_SCENARIO_FILE, - LONG_OPTION_MAX_SPEED, - LONG_OPTION_TEST_DIR, - LONG_OPTION_DELAY_EXIT, - LONG_OPTION_SHIFT_PACKET, - LONG_OPTION_SHIFT_PACKETS, - LONG_OPTION_HELP, - LONG_OPTION_VERSION - }; - - static struct option long_options[] = { - {"enb-conf-file", required_argument, 0, LONG_OPTION_ENB_CONF_FILE}, - {"scenario ", required_argument, 0, LONG_OPTION_SCENARIO_FILE}, - {"max-speed ", no_argument, 0, LONG_OPTION_MAX_SPEED}, - {"test-dir", required_argument, 0, LONG_OPTION_TEST_DIR}, - {"delay-on-exit", required_argument, 0, LONG_OPTION_DELAY_EXIT}, - {"shift-packet", required_argument, 0, LONG_OPTION_SHIFT_PACKET}, - {"shift-packets", required_argument, 0, LONG_OPTION_SHIFT_PACKETS}, - {"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, "vhmc:s:d:f:F", long_options, NULL)) != -1) { - switch (option) { - case LONG_OPTION_ENB_CONF_FILE: - case 'c': - if (optarg) { - *enb_config_file_name = strdup(optarg); - printf("eNB config file name is %s\n", *enb_config_file_name); - rv |= PLAY_SCENARIO; - } - break; - - case LONG_OPTION_SCENARIO_FILE: - case 's': - if (optarg) { - *scenario_file_name = strdup(optarg); - printf("Scenario file name is %s\n", *scenario_file_name); - rv |= PLAY_SCENARIO; - } - break; - - case LONG_OPTION_TEST_DIR: - case 'd': - if (optarg) { - *et_dir_name = strdup(optarg); - if (is_file_exists(*et_dir_name, "test dirname") != GS_IS_DIR) { - fprintf(stderr, "Please provide a valid test dirname, %s is not a valid directory name\n", *et_dir_name); - exit(1); - } - printf("Test dir name is %s\n", *et_dir_name); - } - break; - - case LONG_OPTION_DELAY_EXIT: - case 'D': - if (optarg) { - delay_on_exit = atoi(optarg); - if (0 > delay_on_exit) { - fprintf(stderr, "Please provide a valid -D/--delay-on-exit argument, %s is not a valid value\n", delay_on_exit); - exit(1); - } - printf("Delay on exit is %d\n", (int) delay_on_exit); - } - break; - - - case LONG_OPTION_SHIFT_PACKET: - case 'f': - if (optarg) { - if (NULL == *shifts) { - shift = calloc(1, sizeof (*shift)); - *shifts = shift; - } else { - shift->next = calloc(1, sizeof (*shift)); - shift = shift->next; - } - shift->single = 1; - printf("Arg Shift packet %s\n", optarg); - et_get_shift_arg(optarg, shift); - } - break; - - case LONG_OPTION_SHIFT_PACKETS: - case 'F': - if (optarg) { - if (NULL == *shifts) { - shift = calloc(1, sizeof (*shift)); - *shifts = shift; - } else { - shift->next = calloc(1, sizeof (*shift)); - shift = shift->next; - } - et_get_shift_arg(optarg, shift); - printf("Arg Shift packets %s\n", optarg); - } - break; - - case LONG_OPTION_MAX_SPEED: - case 'm': - g_max_speed = 1; - break; - - case LONG_OPTION_VERSION: - case 'v': - printf("Version %s\n", PACKAGE_VERSION); - exit (0); - break; - - case LONG_OPTION_HELP: - case 'h': - default: - et_usage (argc, argv); - exit (0); - } - } - if (NULL == *et_dir_name) { - fprintf(stderr, "Please provide a valid test dirname\n"); - exit(1); - } - if (chdir(*et_dir_name) != 0) { - fprintf(stderr, "ERROR: chdir %s returned %s\n", *et_dir_name, strerror(errno)); - exit(1); - } - if (rv & PLAY_SCENARIO) { - if (NULL == *enb_config_file_name) { - fprintf(stderr, "ERROR: please provide the original eNB config file name that should be in %s\n", *et_dir_name); - } - if (is_file_exists(*enb_config_file_name, "eNB config file") != GS_IS_FILE) { - fprintf(stderr, "ERROR: original eNB config file name %s is not found in dir %s\n", *enb_config_file_name, *et_dir_name); - } - et_enb_config_init(*enb_config_file_name); - - if (NULL == *scenario_file_name) { - fprintf(stderr, "ERROR: please provide the scenario file name that should be in %s\n", *et_dir_name); - } - if (is_file_exists(*scenario_file_name, "Scenario file") != GS_IS_FILE) { - fprintf(stderr, "ERROR: Scenario file name %s is not found in dir %s\n", *scenario_file_name, *et_dir_name); - } - } - return rv; -} - -//------------------------------------------------------------------------------ -int main( int argc, char **argv ) -//------------------------------------------------------------------------------ -{ - int actions = 0; - char *et_dir_name = NULL; - char *scenario_file_name = NULL; - char *enb_config_file_name = NULL; - struct shift_packet_s *shifts = NULL; - int ret = 0; - int delay_on_exit = 0; - et_scenario_t *scenario = NULL; - char play_scenario_filename[NAME_MAX]; - - memset(play_scenario_filename, 0, sizeof(play_scenario_filename)); - - // logging - logInit(); - set_glog(LOG_TRACE, LOG_MED); - - itti_init(TASK_MAX, tasks_info); - - set_comp_log(ENB_APP, LOG_TRACE, LOG_MED, 1); - set_comp_log(S1AP, LOG_TRACE, LOG_MED, 1); - set_comp_log(SCTP, LOG_TRACE, LOG_FULL, 1); - asn_debug = 0; - asn1_xer_print = 1; - - //parameters - actions = et_config_parse_opt_line (argc, argv, &et_dir_name, &scenario_file_name, &enb_config_file_name, &shifts, &delay_on_exit); //Command-line options - if (actions & PLAY_SCENARIO) { - if (et_generate_xml_scenario(et_dir_name, scenario_file_name,enb_config_file_name, play_scenario_filename) == 0) { - if (NULL != (scenario = et_generate_scenario(play_scenario_filename))) { - ret = et_play_scenario(scenario, shifts); - } else { - fprintf(stderr, "ERROR: Could not generate scenario from tsml file\n"); - ret = -1; - } - } else { - fprintf(stderr, "ERROR: Could not generate tsml scenario from xml file\n"); - ret = -1; - } - et_free_pointer(et_dir_name); - et_free_pointer(scenario_file_name); - et_free_pointer(enb_config_file_name); - } - itti_wait_tasks_end(); - if (0 < delay_on_exit) { - sleep(delay_on_exit); - } - return ret; -} - - diff --git a/openair3/TEST/EPC_TEST/play_scenario.h b/openair3/TEST/EPC_TEST/play_scenario.h deleted file mode 100644 index 6a2264f8ba..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario.h +++ /dev/null @@ -1,499 +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 - */ - -/* - play_scenario.h - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr -*/ - -#ifndef PLAY_SCENARIO_H_ -#define PLAY_SCENARIO_H_ -# include -# include -# include -# include -# include - -#include "S1AP-PDU.h" -#include "s1ap_ies_defs.h" -#include "play_scenario_s1ap_eNB_defs.h" -#include "hashtable.h" -#include "asn_compare.h" - -#define ET_XPATH_EXPRESSION_MAX_LENGTH 400 - - -// powers of 2 -#define ET_BIT_MASK_MATCH_SCTP_STREAM 1 -#define ET_BIT_MASK_MATCH_SCTP_SSN 2 -//#define ET_BIT_MASK_MATCH_S1AP_ 2 - -#define MAX_ENB 16 - -#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" - - -typedef struct shift_packet_s { - unsigned int frame_number; // original frame number - int shift_seconds; - int shift_microseconds; - int single; // shift timing only for this packet (not also following packets) - struct shift_packet_s *next; -} shift_packet_t; - - -typedef struct mme_ip_address_s { - unsigned ipv4:1; - unsigned ipv6:1; - unsigned active:1; - char *ipv4_address; - char *ipv6_address; -} mme_ip_address_t; - -#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\ - struct in_addr inp;\ - if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\ - AssertFatal (0, MeSsAgE);\ - } else {\ - NwBo = inp.s_addr;\ - }\ - } while (0); - - -typedef struct Enb_properties_s { - /* Unique eNB_id to identify the eNB within EPC. - * For macro eNB ids this field should be 20 bits long. - * For home eNB ids this field should be 28 bits long. - */ - uint32_t eNB_id; - - /* The type of the cell */ - enum cell_type_e cell_type; - - /* Optional name for the cell - * NOTE: the name can be NULL (i.e no name) and will be cropped to 150 - * characters. - */ - char *eNB_name; - - /* Tracking area code */ - uint16_t tac; - - /* Mobile Country Code - * Mobile Network Code - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - - - - /* Physical parameters */ - - int16_t Nid_cell[1+MAX_NUM_CCs];// for testing, change later - /* Nb of MME to connect to */ - uint8_t nb_mme; - /* List of MME to connect to */ - mme_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS]; - - int sctp_in_streams; - int sctp_out_streams; - - char *enb_interface_name_for_S1U; - in_addr_t enb_ipv4_address_for_S1U; - tcp_udp_port_t enb_port_for_S1U; - - char *enb_interface_name_for_S1_MME; - in_addr_t enb_ipv4_address_for_S1_MME; - -} Enb_properties_t; - -typedef struct Enb_properties_array_s { - int number; - Enb_properties_t *properties[MAX_ENB]; -} Enb_properties_array_t; - -# define ET_ENB_REGISTER_RETRY_DELAY 3 -# define ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC 15 - -typedef enum { - ET_PACKET_STATUS_START = 0, - ET_PACKET_STATUS_NONE = ET_PACKET_STATUS_START, - ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT, - ET_PACKET_STATUS_SCHEDULED_FOR_SENDING, - ET_PACKET_STATUS_SENT, - ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING, - ET_PACKET_STATUS_RECEIVED, - ET_PACKET_STATUS_END -} et_packet_status_t; - -typedef enum { - ET_FSM_STATE_START = 0, - ET_FSM_STATE_NULL = ET_FSM_STATE_START, - ET_FSM_STATE_CONNECTING_S1C, - ET_FSM_STATE_WAITING_RX_EVENT, - ET_FSM_STATE_WAITING_TX_EVENT, - ET_FSM_STATE_RUNNING, - ET_FSM_STATE_END -} et_fsm_state_t; - -enum COMPARE_ERR_CODE_e; - -typedef enum { - ET_ERROR_MATCH_START = COMPARE_ERR_CODE_END, - ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE = ET_ERROR_MATCH_START, - ET_ERROR_MATCH_PACKET_SCTP_PPID, - ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID, - ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID, - ET_ERROR_MATCH_PACKET_SCTP_SSN, - ET_ERROR_MATCH_PACKET_S1AP_PRESENT, - ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE, - ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY, - ET_ERROR_MATCH_END -} et_error_match_code_t; - - - - -typedef enum { - ET_PACKET_ACTION_S1C_START = 0, - ET_PACKET_ACTION_S1C_NULL = ET_PACKET_ACTION_S1C_START, - ET_PACKET_ACTION_S1C_SEND, - ET_PACKET_ACTION_S1C_RECEIVE, - ET_PACKET_ACTION_S1C_END -} et_packet_action_t; - -// from kernel source file 3.19/include/linux/sctp.h -typedef enum { - SCTP_CID_DATA = 0, - SCTP_CID_INIT = 1, - SCTP_CID_INIT_ACK = 2, - SCTP_CID_SACK = 3, - SCTP_CID_HEARTBEAT = 4, - SCTP_CID_HEARTBEAT_ACK = 5, - SCTP_CID_ABORT = 6, - SCTP_CID_SHUTDOWN = 7, - SCTP_CID_SHUTDOWN_ACK = 8, - SCTP_CID_ERROR = 9, - SCTP_CID_COOKIE_ECHO = 10, - SCTP_CID_COOKIE_ACK = 11, - SCTP_CID_ECN_ECNE = 12, - SCTP_CID_ECN_CWR = 13, - SCTP_CID_SHUTDOWN_COMPLETE = 14, - - /* AUTH Extension Section 4.1 */ - SCTP_CID_AUTH = 0x0F, - - /* PR-SCTP Sec 3.2 */ - SCTP_CID_FWD_TSN = 0xC0, - - /* Use hex, as defined in ADDIP sec. 3.1 */ - SCTP_CID_ASCONF = 0xC1, - SCTP_CID_ASCONF_ACK = 0x80, -} sctp_cid_t; /* enum */ - -typedef enum { - TEST_S1AP_PDU_TYPE_START = 0, - TEST_S1AP_PDU_TYPE_UNKNOWN = TEST_S1AP_PDU_TYPE_START, - TEST_S1AP_PDU_TYPE_INITIATING, - TEST_S1AP_PDU_TYPE_SUCCESSFUL_OUTCOME, - TEST_S1AP_PDU_TYPE_UNSUCCESSFUL_OUTCOME, - TEST_S1AP_PDU_TYPE_END -} et_s1ap_pdu_type_t; - - -typedef struct et_s1ap_s { - //et_s1ap_pdu_type_t pdu_type; - S1AP_S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome - uint16_t xml_stream_pos_offset; - uint16_t binary_stream_pos; - uint16_t binary_stream_allocated_size; - uint8_t *binary_stream; - xmlDocPtr doc; // XML representation of the S1AP PDU -} et_s1ap_t; - - -// from kernel source file 3.19/include/linux/sctp.h, Big Endians -typedef struct sctp_datahdr_s { - uint32_t tsn; - uint16_t stream; - uint16_t ssn; - uint32_t ppid; - uint32_t assoc_id; // filled when running scenario - et_s1ap_t payload; -} sctp_datahdr_t; - -// from kernel source file 3.19/include/linux/sctp.h, Big Endians -typedef struct sctp_inithdr { - uint32_t init_tag; - uint32_t a_rwnd; - uint16_t num_outbound_streams; - uint16_t num_inbound_streams; - uint32_t initial_tsn; - uint8_t params[0]; -} sctp_inithdr_t; - -typedef sctp_inithdr_t sctp_initackhdr_t; - -typedef struct et_sctp_hdr_s { - unsigned int src_port; - unsigned int dst_port; - sctp_cid_t chunk_type; - union { - sctp_datahdr_t data_hdr; - sctp_inithdr_t init_hdr; - sctp_initackhdr_t init_ack_hdr; - } u; -} et_sctp_hdr_t; - -typedef struct et_ip_s { - unsigned int address_family; // AF_INET, AF_INET6 - union { - struct in6_addr ipv6; - in_addr_t ipv4; - } address; - char str[INET6_ADDRSTRLEN+1]; -} et_ip_t; - -typedef struct et_ip_hdr_s { - et_ip_t src; - et_ip_t dst; -} et_ip_hdr_t; - -typedef struct et_packet_s { - et_packet_action_t action; - struct timeval time_relative_to_first_packet; - struct timeval time_relative_to_last_sent_packet; - struct timeval time_relative_to_last_received_packet; - unsigned int original_frame_number; - unsigned int packet_number; - instance_t enb_instance; - et_ip_hdr_t ip_hdr; - et_sctp_hdr_t sctp_hdr; - struct et_packet_s *next; - - //scenario running vars - et_packet_status_t status; - long timer_id; // ITTI timer id for waiting rx packets - struct timeval timestamp_packet; // timestamp when rx or tx packet -} et_packet_t; - - -typedef struct sctp_epoll_s { - /* Array of events monitored by the task. - * By default only one fd is monitored (the one used to received messages - * from other tasks). - * More events can be suscribed later by the task itself. - */ - struct epoll_event *events; - - int epoll_nb_events; - -} thread_desc_t; - -typedef struct et_scenario_s { - xmlChar *name; - et_packet_t *list_packet; - //-------------------------- - // playing scenario - //-------------------------- - Enb_properties_array_t *enb_properties; - uint32_t register_enb_pending; - uint32_t registered_enb; - long enb_register_retry_timer_id; - - - hash_table_t *hash_mme2association_id; - hash_table_t *hash_old_ue_mme_id2ue_mme_id; - struct timeval time_last_tx_packet; // Time last sent packet - struct timeval time_last_rx_packet; // Time last packet received with all previous scenario RX packet received. - et_packet_t *last_rx_packet; // Last packet received with all previous scenario RX packet received. - et_packet_t *last_tx_packet; // Last sent packet - et_packet_t *next_packet; // Next packet to be handled in the scenario (RX or TX packet) - - int timer_count; -} et_scenario_t; - - -typedef enum { - ET_EVENT_START = 0, - ET_EVENT_INIT = ET_EVENT_START, - ET_EVENT_S1C_CONNECTED, - ET_EVENT_RX_SCTP_EVENT, - ET_EVENT_RX_S1AP, - ET_EVENT_RX_PACKET_TIME_OUT, - ET_EVENT_TX_TIMED_PACKET, - ET_EVENT_TICK, - ET_EVENT_END -} et_event_code_t; - -typedef struct et_event_init_s { - et_scenario_t *scenario; -} et_event_init_t; - -typedef struct et_event_s1ap_data_ind_s { - sctp_datahdr_t sctp_datahdr; -} et_event_s1ap_data_ind_t; - -typedef struct et_event_s1ap_data_req_s { - -} et_event_s1ap_data_req_t; - -typedef struct et_event_s { - et_event_code_t code; - union { - et_event_init_t init; - et_event_s1ap_data_ind_t s1ap_data_ind; - et_packet_t *tx_timed_packet; - et_packet_t *rx_packet_time_out; - } u; -} et_event_t; - -inline void et_free_pointer(void *p) {if (NULL != p) {free(p);}}; - -//------------------------- -void et_free_packet(et_packet_t *packet); -void et_free_scenario(et_scenario_t *scenario); -//------------------------- -void et_display_packet_s1ap_data(const et_s1ap_t *const s1ap); -void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp); -void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp); -void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp); -void et_display_packet_sctp(const et_sctp_hdr_t *const sctp); -void et_display_packet_ip(const et_ip_hdr_t *const ip); -void et_display_packet(const et_packet_t *const packet); -void et_display_scenario(const et_scenario_t *const scenario); -//------------------------- -int et_s1ap_decode_initiating_message(s1ap_message *message, S1AP_InitiatingMessage_t *initiating_p); -int et_s1ap_decode_successful_outcome(s1ap_message *message, S1AP_SuccessfulOutcome_t *successfullOutcome_p); -int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1AP_UnsuccessfulOutcome_t *unSuccessfullOutcome_p); -int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, s1ap_message *const message, const uint8_t *const buffer, const uint32_t length); -void et_decode_s1ap(et_s1ap_t *const s1ap); -//------------------------- -int et_s1ap_eNB_compare_assoc_id( struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2); -uint32_t et_s1ap_generate_eNB_id(void); -uint16_t et_s1ap_eNB_fetch_add_global_cnx_id(void); -void et_s1ap_eNB_prepare_internal_data(void); -void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p); -struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id); -s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance); -void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream); -int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t *const spacket, et_packet_t *const rx_packet); -asn_comp_rval_t *et_s1ap_is_matching(et_s1ap_t *const s1ap1, et_s1ap_t *const s1ap2, const uint32_t constraints); -et_packet_t *et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t *const s1ap_data_ind); -int et_scenario_set_packet_received(et_packet_t *const packet); -int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t *const sctp_data_ind); -void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *const sctp_data_ind); -void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr, - uint16_t in_streams, - uint16_t out_streams); -void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); -void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB); -void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -void *et_s1ap_eNB_task(void *arg); -//------------------------- -int et_generate_xml_scenario( - const char const *xml_in_dir_name, - const char const *xml_in_scenario_filename, - const char const *enb_config_filename, - char const *tsml_out_scenario_filename); -//------------------------- -void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b); -int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b); -void et_scenario_wait_rx_packet(et_packet_t *const packet); -void et_scenario_schedule_tx_packet(et_packet_t *packet); -et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event); -et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event); -et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event); -et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event); -et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event); -et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event); -//------------------------- -void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t *const s1ap); -void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t *const sctp_hdr); -void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t *const sctp_hdr); -void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t *const sctp_hdr); -void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t *const sctp_hdr); -et_packet_t *et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node); -et_scenario_t *et_generate_scenario(const char *const et_scenario_filename); -//------------------------- -asn_comp_rval_t *et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message *const m1, s1ap_message *const m2, const uint32_t constraints); -void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id); -void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id); -int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id); -//------------------------- -asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints); -asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints); -//------------------------------------------------------------------------------ -void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num); -int et_is_file_exists ( const char const *file_nameP, const char const *file_roleP); -int et_strip_extension( char *in_filename); -void et_get_shift_arg( char *line_argument, shift_packet_t *const shift); -int et_split_path ( char *pathP, char *** resP); -void et_display_node ( xmlNodePtr node, unsigned int indent); -void et_display_tree ( xmlNodePtr node, unsigned int indent); -char *et_ip2ip_str(const et_ip_t *const ip); -int et_compare_et_ip_to_net_ip_address(const et_ip_t *const ip, const net_ip_address_t *const net_ip); -int et_hex2data(unsigned char *const data, const unsigned char *const hexstring, const unsigned int len); -sctp_cid_t et_chunk_type_str2cid(const xmlChar *const chunk_type_str); -const char *const et_chunk_type_cid2str(const sctp_cid_t chunk_type); -const char *const et_error_match2str(const int err); -et_packet_action_t et_action_str2et_action_t(const xmlChar *const action); -void et_ip_str2et_ip(const xmlChar *const ip_str, et_ip_t *const ip); -void et_enb_config_init(const char const *lib_config_file_name_pP); -const Enb_properties_array_t *et_enb_config_get(void); -void et_eNB_app_register(const Enb_properties_array_t *enb_properties); -void *et_eNB_app_task(void *args_p); -int et_play_scenario(et_scenario_t *const scenario, const struct shift_packet_s *shifts); - -#endif /* PLAY_SCENARIO_H_ */ diff --git a/openair3/TEST/EPC_TEST/play_scenario_decode.c b/openair3/TEST/EPC_TEST/play_scenario_decode.c deleted file mode 100644 index f6b983bf73..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_decode.c +++ /dev/null @@ -1,68 +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 - */ - -/* - play_scenario_decode.c - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - */ - -#include "intertask_interface.h" -#include "platform_types.h" -#include "s1ap_eNB_decoder.h" -#include "assertions.h" -#include "play_scenario.h" - -//------------------------------------------------------------------------------ -int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, const uint8_t *const buffer, const uint32_t length) -{ - asn_dec_rval_t dec_ret; - - DevAssert(buffer != NULL); - - memset((void *)pdu, 0, sizeof(S1AP_S1AP_PDU_t)); - dec_ret = aper_decode(NULL, - &asn_DEF_S1AP_S1AP_PDU, - (void **)&pdu, - buffer, - length, - 0, - 0); - - if (dec_ret.code != RC_OK) { - S1AP_ERROR("Failed to decode pdu\n"); - return -1; - } - - return dec_ret.code; -} - -//------------------------------------------------------------------------------ -void et_decode_s1ap(et_s1ap_t *const s1ap) -{ - if (NULL != s1ap) { - if (et_s1ap_decode_pdu(&s1ap->pdu, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) { - AssertFatal (0, "ERROR %s() Cannot decode S1AP message!\n", __FUNCTION__); - } - } -} diff --git a/openair3/TEST/EPC_TEST/play_scenario_display.c b/openair3/TEST/EPC_TEST/play_scenario_display.c deleted file mode 100644 index b29c0758c4..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_display.c +++ /dev/null @@ -1,348 +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 - */ - -/* - play_scenario_display.c - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - */ -#include -#include - -#include "intertask_interface.h" -#include "platform_types.h" -#include "assertions.h" -#include "s1ap_eNB_decoder.h" -#include "play_scenario.h" -//----------------------------------------------------------------------------- -void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num) -{ - unsigned long octet_index = 0; - - if (byte_stream == NULL) { - return; - } - - fprintf(stdout, "+-----+-------------------------------------------------+\n"); - fprintf(stdout, "| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n"); - fprintf(stdout, "+-----+-------------------------------------------------+\n"); - - for (octet_index = 0; octet_index < num; octet_index++) { - if ((octet_index % 16) == 0) { - if (octet_index != 0) { - fprintf(stdout, " |\n"); - } - - fprintf(stdout, " %04lu |", octet_index); - } - - /* - * Print every single octet in hexadecimal form - */ - fprintf(stdout, " %02x", byte_stream[octet_index]); - /* - * Align newline and pipes according to the octets in groups of 2 - */ - } - - /* - * Append enough spaces and put final pipe - */ - unsigned char index; - - for (index = octet_index; index < 16; ++index) { - fprintf(stdout, " "); - } - - fprintf(stdout, " |\n"); -} - -//------------------------------------------------------------------------------ -void et_display_node(xmlNodePtr node, unsigned int indent) -{ - int i = 0; - - if (node->type == XML_ELEMENT_NODE) { - xmlChar *path = xmlGetNodePath(node); - - for (i=0; ichildren != NULL && node->children->type == XML_TEXT_NODE) { - xmlChar *content = xmlNodeGetContent(node); - printf("%s -> %s\n", path, content); - xmlFree(content); - } else { - printf("%s\n", path); - } - - xmlFree(path); - } -} -//------------------------------------------------------------------------------ -void et_display_tree(xmlNodePtr node, unsigned int indent) -{ - xmlNode *cur_node = NULL; - - for (cur_node = node; cur_node; cur_node = cur_node->next) { - if (cur_node->type == XML_ELEMENT_NODE) { - et_display_node(cur_node, indent); - } - - et_display_tree(cur_node->children, indent++); - } -} -//------------------------------------------------------------------------------ -void et_display_packet_S1AP_data(const et_S1AP_t *const s1ap) -{ - char *message_string = NULL; - - if (s1ap) { - message_string = calloc(20000, sizeof(char)); - AssertFatal (NULL != message_string, "ERROR malloc()failed!\n"); - - switch(s1ap->pdu.present) { - case S1AP_S1AP_PDU_PR_initiatingMessage: - switch(s1ap->pdu.choice.initiatingMessage.procedureCode) { - case S1AP_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - default: - AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", - (int)s1ap->pdu.choice.initiatingMessage.procedureCode); - } - - break; - - case S1AP_S1AP_PDU_PR_successfulOutcome: - switch(s1ap->pdu.choice.successfulOutcome.procedureCode) { - case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - default: - AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n", - (int)s1ap->pdu.choice.successfulOutcome.procedureCode); - } - - break; - - case S1AP_S1AP_PDU_PR_unsuccessfulOutcome: - switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) { - case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; - - default: - et_free_pointer(message_string); - AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode); - break; - } - - break; - - default: - AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present); - break; - } - - fprintf(stdout, "\t\tSCTP.data XML dump:\n%s\n", message_string); - et_free_pointer(message_string); - } -} -//------------------------------------------------------------------------------ -void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp) -{ - if (sctp) { - fprintf(stdout, "\t\tSCTP.init.init_tag : %u\n", sctp->init_tag); - fprintf(stdout, "\t\tSCTP.init.a_rwnd : %u\n", sctp->a_rwnd); - fprintf(stdout, "\t\tSCTP.init.num_inbound_streams : %u\n", sctp->num_inbound_streams); - fprintf(stdout, "\t\tSCTP.init.num_outbound_streams : %u\n", sctp->num_outbound_streams); - fprintf(stdout, "\t\tSCTP.init.initial_tsn : %u\n", sctp->initial_tsn); - } -} -//------------------------------------------------------------------------------ -void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp) -{ - if (sctp) { - fprintf(stdout, "\t\tSCTP.initack.init_tag : %u\n", sctp->init_tag); - fprintf(stdout, "\t\tSCTP.initack.a_rwnd : %u\n", sctp->a_rwnd); - fprintf(stdout, "\t\tSCTP.initack.num_inbound_streams : %u\n", sctp->num_inbound_streams); - fprintf(stdout, "\t\tSCTP.initack.num_outbound_streams : %u\n", sctp->num_outbound_streams); - fprintf(stdout, "\t\tSCTP.initack.initial_tsn : %u\n", sctp->initial_tsn); - } -} -//------------------------------------------------------------------------------ -void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp) -{ - if (sctp) { - fprintf(stdout, "\t\tSCTP.data.tsn : %u\n", sctp->tsn); - fprintf(stdout, "\t\tSCTP.data.stream : %u\n", sctp->stream); - fprintf(stdout, "\t\tSCTP.data.ssn : %u\n", sctp->ssn); - fprintf(stdout, "\t\tSCTP.data.ppid : %u\n", sctp->ppid); - - if (sctp->ppid == 18) { - et_display_packet_s1ap_data(&sctp->payload); - } - - fprintf(stdout, "\t\tSCTP.data.binary_stream_allocated_size : %u\n", sctp->payload.binary_stream_allocated_size); - - if (NULL != sctp->payload.binary_stream) { - fprintf(stdout, "\t\tSCTP.data.binary_stream :\n"); - et_print_hex_octets(sctp->payload.binary_stream, sctp->payload.binary_stream_allocated_size); - } else { - fprintf(stdout, "\t\tSCTP.data.binary_stream : NULL\n"); - } - } -} - -//------------------------------------------------------------------------------ -void et_display_packet_sctp(const et_sctp_hdr_t *const sctp) -{ - if (sctp) { - fprintf(stdout, "\t\tSCTP.src_port : %u\n", sctp->src_port); - fprintf(stdout, "\t\tSCTP.dst_port : %u\n", sctp->dst_port); - fprintf(stdout, "\t\tSCTP.chunk_type : %s\n", et_chunk_type_cid2str(sctp->chunk_type)); - - switch (sctp->chunk_type) { - case SCTP_CID_DATA: - et_display_packet_sctp_data(&sctp->u.data_hdr); - break; - - case SCTP_CID_INIT: - et_display_packet_sctp_initack(&sctp->u.init_hdr); - break; - - case SCTP_CID_INIT_ACK: - et_display_packet_sctp_initack(&sctp->u.init_ack_hdr); - break; - - default: - ; - } - } -} -//------------------------------------------------------------------------------ -void et_display_packet_ip(const et_ip_hdr_t *const ip) -{ - if (ip) { - fprintf(stdout, "\t\tSource address : %s\n", et_ip2ip_str(&ip->src)); - fprintf(stdout, "\t\tDestination address : %s\n", et_ip2ip_str(&ip->dst)); - } -} - -//------------------------------------------------------------------------------ -void et_display_packet(const et_packet_t *const packet) -{ - if (packet) { - fprintf(stdout, "-------------------------------------------------------------------------------\n"); - fprintf(stdout, "\tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); - fprintf(stdout, "\tPacket:\ttime relative to 1st packet %ld.%06lu\n", - packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec); - fprintf(stdout, "\tPacket:\ttime relative to last tx packet %ld.%06lu\n", - packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec); - fprintf(stdout, "\tPacket:\ttime relative to last_received packet %ld.%06lu\n", - packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec); - - switch(packet->action) { - case ET_PACKET_ACTION_S1C_SEND: - fprintf(stdout, "\tPacket:\tAction SEND\n"); - break; - - case ET_PACKET_ACTION_S1C_RECEIVE: - fprintf(stdout, "\tPacket:\tAction RECEIVE\n"); - break; - - default: - fprintf(stdout, "\tPacket:\tAction UNKNOWN\n"); - } - - switch(packet->status) { - case ET_PACKET_STATUS_NONE: - fprintf(stdout, "\tPacket:\tStatus NONE\n"); - break; - - case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT: - fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n"); - break; - - case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING: - fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n"); - break; - - case ET_PACKET_STATUS_SENT: - fprintf(stdout, "\tPacket:\tStatus SENT\n"); - break; - - case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING: - fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n"); - break; - - case ET_PACKET_STATUS_RECEIVED: - fprintf(stdout, "\tPacket:\tStatus RECEIVED\n"); - break; - - default: - fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n"); - } - - et_display_packet_ip(&packet->ip_hdr); - et_display_packet_sctp(&packet->sctp_hdr); - } -} -//------------------------------------------------------------------------------ -void et_display_scenario(const et_scenario_t *const scenario) -{ - et_packet_t *packet = NULL; - - if (scenario) { - fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char *)scenario->name:"UNKNOWN NAME"); - packet = scenario->list_packet; - - while (packet) { - et_display_packet(packet); - packet = packet->next; - } - } -} diff --git a/openair3/TEST/EPC_TEST/play_scenario_fsm.c b/openair3/TEST/EPC_TEST/play_scenario_fsm.c deleted file mode 100644 index 0459f4d5dd..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_fsm.c +++ /dev/null @@ -1,586 +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 - */ - -/* - play_scenario_fsm.c - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - */ -#include -#include -#include - -#include "intertask_interface.h" -#include "platform_types.h" -#include "assertions.h" -#include "play_scenario.h" -#include "play_scenario_s1ap_eNB_defs.h" - -//------------------------------------------------------------------------------ -extern int g_max_speed; -//------------------------------------------------------------------------------ -et_scenario_t *g_scenario = NULL; -pthread_mutex_t g_fsm_lock = PTHREAD_MUTEX_INITIALIZER; -et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL; -uint32_t g_constraints = ET_BIT_MASK_MATCH_SCTP_STREAM | ET_BIT_MASK_MATCH_SCTP_SSN; -//------------------------------------------------------------------------------ -// it is assumed that if a time is negative tv_sec and tv_usec are both negative -void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b) -{ - AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n"); - AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n"); - // may happen overflows but were are not dealing with very large timings - long long int r = a->tv_usec + b->tv_usec + (a->tv_sec + b->tv_sec) * 1000000; - result->tv_sec = r / (long long int)1000000; - result->tv_usec = r % (long long int)1000000; - - if ((result != a) && (result != b)) { - LOG_D(ENB_APP, "timeval_add(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec); - } -} - -//------------------------------------------------------------------------------ -// it is assumed that if a time is negative tv_sec and tv_usec are both negative -// return true if result is positive -int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b) -{ - AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n"); - AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n"); - // may happen overflows but were are not dealing with very large timings - long long int r = a->tv_usec - b->tv_usec + (a->tv_sec - b->tv_sec) * 1000000; - result->tv_sec = r / (long long int)1000000; - result->tv_usec = r % (long long int)1000000; - - if ((result != a) && (result != b)) { - LOG_D(ENB_APP, "timeval_subtract(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec); - } - - return (result->tv_sec >= 0) && (result->tv_usec >= 0); -} - -//------------------------------------------------------------------------------ -void et_scenario_wait_rx_packet(et_packet_t *const packet) -{ - packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING; - g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT; - - if (timer_setup (ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC, 0, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - packet, &packet->timer_id) < 0) { - AssertFatal(0, " Can not start waiting RX event timer\n"); - } - - g_scenario->timer_count++; - LOG_D(ENB_APP, "Waiting RX packet num %d original frame number %u\n", packet->packet_number, packet->original_frame_number); -} -//------------------------------------------------------------------------------ -void et_scenario_schedule_tx_packet(et_packet_t *packet) -{ - s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; - struct timeval now = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval offset_last_tx_packet = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval offset_last_rx_packet = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval offset_tx_rx = { .tv_sec = 0, .tv_usec = 0 }; - struct timeval offset = { .tv_sec = 0, .tv_usec = 0 }; - int last_packet_was_rx = 0; - int we_are_too_late = 0; - int original_frame_number = -1; - AssertFatal(NULL != packet, "packet argument is NULL"); - s1ap_eNB_instance = et_s1ap_eNB_get_instance(packet->enb_instance); - AssertFatal(NULL != s1ap_eNB_instance, "Cannot get s1ap_eNB_instance_t for eNB instance %d", packet->enb_instance); - LOG_D(ENB_APP, "%s\n", __FUNCTION__); - g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT; - - switch (packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA: - // check if we can send it now - // TODO: BUG we have to discard in scenario all packets that cannot be processed (SACK, COOKIEs, etc) - AssertFatal(gettimeofday(&now, NULL) == 0, "gettimeofday failed"); - timeval_subtract(&offset_last_tx_packet,&now,&g_scenario->time_last_tx_packet); - timeval_subtract(&offset_last_rx_packet,&now,&g_scenario->time_last_rx_packet); - LOG_D(ENB_APP, "offset_last_tx_packet=%ld.%06d\n", offset_last_tx_packet.tv_sec, offset_last_tx_packet.tv_usec); - LOG_D(ENB_APP, "offset_last_rx_packet=%ld.%06d\n", offset_last_rx_packet.tv_sec, offset_last_rx_packet.tv_usec); - last_packet_was_rx = timeval_subtract(&offset_tx_rx,&offset_last_tx_packet,&offset_last_rx_packet); - - if (last_packet_was_rx) { - LOG_D(ENB_APP, "last_packet_was_rx\n"); - we_are_too_late = timeval_subtract(&offset,&offset_last_rx_packet,&packet->time_relative_to_last_received_packet); - LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec); - } else { - LOG_D(ENB_APP, "last_packet_was_tx\n"); - we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet); - LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec); - } - - if ((0 == we_are_too_late) && (0 == g_max_speed)) { - // set timer - if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)) { - offset.tv_sec = -offset.tv_sec; - offset.tv_usec = -offset.tv_usec; - } - - LOG_D(ENB_APP, "Send packet num %u original frame number %u in %ld.%06d sec\n", - packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec); - packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_SENDING; - - if (timer_setup (offset.tv_sec, offset.tv_usec, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,packet, &packet->timer_id) < 0) { - AssertFatal(0, " Can not start TX event timer\n"); - } - - g_scenario->timer_count++; - // Done g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT; - } else { - // send immediately - AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed"); - original_frame_number = packet->original_frame_number; - - do { - g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec; - g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec; - LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number); - et_s1ap_eNB_itti_send_sctp_data_req( - packet->enb_instance, - packet->sctp_hdr.u.data_hdr.assoc_id, - packet->sctp_hdr.u.data_hdr.payload.binary_stream, - packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size, - packet->sctp_hdr.u.data_hdr.stream); - packet->status = ET_PACKET_STATUS_SENT; - g_scenario->next_packet = g_scenario->next_packet->next; - packet = packet->next; - } while ((NULL != packet) && (packet->original_frame_number == original_frame_number)); - - g_fsm_state = ET_FSM_STATE_RUNNING; - } - - break; - - case SCTP_CID_INIT: - case SCTP_CID_INIT_ACK: - AssertFatal(0, "Invalid case TX packet SCTP_CID_INIT or SCTP_CID_INIT_ACK"); - break; - - default: - AssertFatal(0, "Invalid case TX packet SCTP_CID %d", packet->sctp_hdr.chunk_type); - } -} -//------------------------------------------------------------------------------ -et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) -{ - switch (event.code) { - case ET_EVENT_TICK: - while (NULL != g_scenario->next_packet) { - LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d original frame number %u\n", g_scenario->next_packet->packet_number, g_scenario->next_packet->original_frame_number); - - switch (g_scenario->next_packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA : - - // no init in this scenario, may be sub-scenario - if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) { - if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { - et_scenario_schedule_tx_packet(g_scenario->next_packet); - pthread_mutex_unlock(&g_fsm_lock); - et_event_t continue_event; - continue_event.code = ET_EVENT_TICK; - et_scenario_fsm_notify_event(continue_event); - return g_fsm_state; - } else if (g_scenario->next_packet->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) { - AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status); - } - } else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) { - g_scenario->next_packet = g_scenario->next_packet->next; - } else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { - et_scenario_wait_rx_packet(g_scenario->next_packet); - pthread_mutex_unlock(&g_fsm_lock); - return g_fsm_state; - } else { - AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status); - } - } else { - AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action); - } - - break; - - case SCTP_CID_INIT: - case SCTP_CID_INIT_ACK: - case SCTP_CID_HEARTBEAT: - case SCTP_CID_HEARTBEAT_ACK: - case SCTP_CID_COOKIE_ECHO: - case SCTP_CID_COOKIE_ACK: - case SCTP_CID_ECN_ECNE: - case SCTP_CID_ECN_CWR: - LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n", - g_scenario->next_packet->packet_number, - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); - g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; - g_scenario->next_packet = g_scenario->next_packet->next; - break; - - case SCTP_CID_ABORT: - case SCTP_CID_SHUTDOWN: - case SCTP_CID_SHUTDOWN_ACK: - case SCTP_CID_ERROR: - case SCTP_CID_SHUTDOWN_COMPLETE: - AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)", - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); - break; - - default: - LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n", - g_scenario->next_packet->packet_number, - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); - g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; - g_scenario->next_packet = g_scenario->next_packet->next; - } - } - - fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name); - g_fsm_state = ET_FSM_STATE_NULL; - pthread_mutex_unlock(&g_fsm_lock); - - if (0 == g_scenario->timer_count) { - fprintf(stderr, "End of scenario: %s\n", g_scenario->name); - fflush(stderr); - fflush(stdout); - return 0; - //exit(0); - } - - fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count); - return g_fsm_state; - break; - - case ET_EVENT_RX_PACKET_TIME_OUT: - AssertFatal(0, "Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING"); - break; - - case ET_EVENT_TX_TIMED_PACKET: - AssertFatal(0, "Event ET_EVENT_TX_TIMED_PACKET not handled in FSM state ET_FSM_STATE_RUNNING"); - break; - - case ET_EVENT_RX_S1AP: - et_s1ap_process_rx_packet(&event.u.s1ap_data_ind); - break; - - default: - AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_RUNNING", event.code); - } - - pthread_mutex_unlock(&g_fsm_lock); - return 0; -} - -//------------------------------------------------------------------------------ -et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event) -{ - int rv = 0; - int original_frame_number = -1; - et_packet_t *packet = NULL; - - switch (event.code) { - case ET_EVENT_TICK: - fprintf(stdout, "EVENT_TICK: waiting for tx event\n"); - break; - - case ET_EVENT_RX_S1AP: - rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind); - break; - - case ET_EVENT_TX_TIMED_PACKET: - // send immediately - packet = event.u.tx_timed_packet; - AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed"); - original_frame_number = packet->original_frame_number; - - do { - g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec; - g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec; - LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number); - et_s1ap_eNB_itti_send_sctp_data_req( - packet->enb_instance, - packet->sctp_hdr.u.data_hdr.assoc_id, - packet->sctp_hdr.u.data_hdr.payload.binary_stream, - packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size, - packet->sctp_hdr.u.data_hdr.stream); - packet->status = ET_PACKET_STATUS_SENT; - packet = packet->next; - g_scenario->next_packet = packet; - } while ( (NULL != packet) && (packet->original_frame_number == original_frame_number)); - - g_fsm_state = ET_FSM_STATE_RUNNING; - break; - - case ET_EVENT_RX_PACKET_TIME_OUT: - default: - AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_TX", event.code); - } - - pthread_mutex_unlock(&g_fsm_lock); - return 0; -} - -//------------------------------------------------------------------------------ -et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event) -{ - int rv = 0; - - switch (event.code) { - case ET_EVENT_TICK: - fprintf(stdout, "EVENT_TICK: waiting for rx event\n"); - break; - - case ET_EVENT_RX_PACKET_TIME_OUT: - fprintf(stderr, "Error The following packet is not received:\n"); - //et_display_packet(event.u.rx_packet_time_out); - AssertFatal(0, "Waited packet not received"); - break; - - case ET_EVENT_RX_S1AP: - rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind); - - // waited packet - if (rv == 0) { - g_fsm_state = ET_FSM_STATE_RUNNING; - } - - break; - - case ET_EVENT_TX_TIMED_PACKET: - default: - AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_RX", event.code); - } - - pthread_mutex_unlock(&g_fsm_lock); - return 0; -} - -//------------------------------------------------------------------------------ -et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event) -{ - switch (event.code) { - case ET_EVENT_TICK: - break; - - case ET_EVENT_S1C_CONNECTED: - // hack simulate we have been able to get the right timing values for STCP connect - AssertFatal(gettimeofday(&g_scenario->time_last_rx_packet, NULL) == 0, "gettimeofday failed"); - - while (NULL != g_scenario->next_packet) { - switch (g_scenario->next_packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA : - - // no init in this scenario, may be sub-scenario - if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) { - et_scenario_schedule_tx_packet(g_scenario->next_packet); - pthread_mutex_unlock(&g_fsm_lock); - et_event_t continue_event; - continue_event.code = ET_EVENT_TICK; - et_scenario_fsm_notify_event(continue_event); - return g_fsm_state; - } else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) { - g_scenario->last_rx_packet = g_scenario->next_packet; - g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet; - g_scenario->next_packet = g_scenario->next_packet->next; - } else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { - et_scenario_wait_rx_packet(g_scenario->next_packet); - pthread_mutex_unlock(&g_fsm_lock); - return g_fsm_state; - } else { - AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status); - } - } else { - AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action); - } - - break; - - case SCTP_CID_INIT: - case SCTP_CID_INIT_ACK: - case SCTP_CID_HEARTBEAT: - case SCTP_CID_HEARTBEAT_ACK: - case SCTP_CID_COOKIE_ECHO: - case SCTP_CID_COOKIE_ACK: - case SCTP_CID_ECN_ECNE: - case SCTP_CID_ECN_CWR: - g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; - g_scenario->next_packet = g_scenario->next_packet->next; - break; - - case SCTP_CID_ABORT: - case SCTP_CID_SHUTDOWN: - case SCTP_CID_SHUTDOWN_ACK: - case SCTP_CID_ERROR: - case SCTP_CID_SHUTDOWN_COMPLETE: - AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)", - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); - break; - - default: - g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; - g_scenario->next_packet = g_scenario->next_packet->next; - } - } - - fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name); - g_fsm_state = ET_FSM_STATE_NULL; - pthread_mutex_unlock(&g_fsm_lock); - - if (0 == g_scenario->timer_count) { - fprintf(stderr, "End of scenario: %s\n", g_scenario->name); - fflush(stderr); - fflush(stdout); - exit(0); - } - - fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count); - return g_fsm_state; - break; - - default: - AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_CONNECTING_S1C", event.code); - } - - pthread_mutex_unlock(&g_fsm_lock); - return 0; -} -//------------------------------------------------------------------------------ -et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) -{ - switch (event.code) { - case ET_EVENT_TICK: - break; - - case ET_EVENT_INIT: - AssertFatal(NULL == g_scenario, "Current scenario not ended"); - g_scenario = event.u.init.scenario; - g_scenario->next_packet = g_scenario->list_packet; - g_scenario->last_rx_packet = NULL; - g_scenario->last_tx_packet = NULL; - - while (NULL != g_scenario->next_packet) { - switch (g_scenario->next_packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA : - - // no init in this scenario, may be sub-scenario, ... - if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) { - et_scenario_schedule_tx_packet(g_scenario->next_packet); - pthread_mutex_unlock(&g_fsm_lock); - et_event_t continue_event; - continue_event.code = ET_EVENT_TICK; - et_scenario_fsm_notify_event(continue_event); - return g_fsm_state; - } else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) { - g_scenario->last_rx_packet = g_scenario->next_packet; - g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet; - g_scenario->next_packet = g_scenario->next_packet->next; - } else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { - et_scenario_wait_rx_packet(g_scenario->next_packet); - pthread_mutex_unlock(&g_fsm_lock); - return g_fsm_state; - } else { - AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status); - } - } else { - AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action); - } - - break; - - case SCTP_CID_INIT: - case SCTP_CID_INIT_ACK: - g_scenario->enb_properties = (Enb_properties_array_t *)et_enb_config_get(); - g_scenario->hash_old_ue_mme_id2ue_mme_id = hashtable_create (256,NULL,NULL); - g_scenario->hash_mme2association_id = hashtable_create (256,NULL,NULL); - // Try to register each eNB - g_scenario->registered_enb = 0; - g_fsm_state = ET_FSM_STATE_CONNECTING_S1C; - AssertFatal(gettimeofday(&g_scenario->time_last_tx_packet, NULL) == 0, "gettimeofday failed"); - et_eNB_app_register (g_scenario->enb_properties); - pthread_mutex_unlock(&g_fsm_lock); - return g_fsm_state; - break; - - case SCTP_CID_HEARTBEAT: - case SCTP_CID_HEARTBEAT_ACK: - case SCTP_CID_COOKIE_ECHO: - case SCTP_CID_COOKIE_ACK: - case SCTP_CID_ECN_ECNE: - case SCTP_CID_ECN_CWR: - g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; - g_scenario->next_packet = g_scenario->next_packet->next; - break; - - case SCTP_CID_ABORT: - case SCTP_CID_SHUTDOWN: - case SCTP_CID_SHUTDOWN_ACK: - case SCTP_CID_ERROR: - case SCTP_CID_SHUTDOWN_COMPLETE: - AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)", - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); - break; - - default: - g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; - g_scenario->next_packet = g_scenario->next_packet->next; - } - } - - fprintf(stderr, "No Useful packet found in this scenario: %s\n", g_scenario->name); - g_fsm_state = ET_FSM_STATE_NULL; - pthread_mutex_unlock(&g_fsm_lock); - return g_fsm_state; - break; - - default: - AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_NULL", event.code); - } - - return 0; -} - -//------------------------------------------------------------------------------ -et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event) -{ - AssertFatal((event.code >= ET_EVENT_START) && (event.code < ET_EVENT_END), "Unknown et_event_t.code %d", event.code); - pthread_mutex_lock(&g_fsm_lock); - - switch (g_fsm_state) { - case ET_FSM_STATE_NULL: return et_scenario_fsm_notify_event_state_null(event); break; - - case ET_FSM_STATE_CONNECTING_S1C: return et_scenario_fsm_notify_event_state_connecting_s1c(event); break; - - case ET_FSM_STATE_WAITING_TX_EVENT: return et_scenario_fsm_notify_event_state_waiting_tx(event); break; - - case ET_FSM_STATE_WAITING_RX_EVENT: return et_scenario_fsm_notify_event_state_waiting_rx(event); break; - - case ET_FSM_STATE_RUNNING: return et_scenario_fsm_notify_event_state_running(event); break; - - default: - AssertFatal(0, "Case fsm_state %d not handled", g_fsm_state); - } - - pthread_mutex_unlock(&g_fsm_lock); - return g_fsm_state; -} diff --git a/openair3/TEST/EPC_TEST/play_scenario_parse.c b/openair3/TEST/EPC_TEST/play_scenario_parse.c deleted file mode 100644 index 607ec34dfc..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_parse.c +++ /dev/null @@ -1,592 +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 - */ - -/* - play_scenario_parse.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 "intertask_interface.h" -#include "platform_types.h" -#include "assertions.h" -#include "play_scenario.h" -//------------------------------------------------------------------------------ -#define ENB_CONFIG_MAX_XSLT_PARAMS 32 -//------------------------------------------------------------------------------ -extern Enb_properties_array_t g_enb_properties; -//------------------------------------------------------------------------------ -void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap) -{ - xmlNodePtr cur_node = NULL; - xmlChar *xml_char = NULL; - xmlChar *xml_char2 = NULL; - unsigned int size = 0; - int rc = 0; - unsigned int go_deeper_in_tree = 1; - - if ((NULL != s1ap_node) && (NULL != s1ap)) { - // see http://www.xmlsoft.org/html/libxml-tree.html#xmlCopyNode - if (NULL == s1ap->doc) { - xmlUnlinkNode(s1ap_node); - //cur_node = xmlCopyNodeList(s1ap_node); - // arg2: if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) - //cur_node = xmlCopyNode(s1ap_node, 1); - //AssertFatal(NULL != cur_node, "xmlCopyNode Failed"); - s1ap->doc = xmlNewDoc(BAD_CAST "1.0"); - xmlDocSetRootElement(s1ap->doc, s1ap_node); - } - - for (cur_node = (xmlNode *)s1ap_node; cur_node; cur_node = cur_node->next) { - go_deeper_in_tree = 1; - if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) { - // do not get hidden fields - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) { - go_deeper_in_tree = 0; - } - xmlFree(xml_char); - } - if (0 < go_deeper_in_tree) { - // first get size - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size"); - if (NULL != xml_char) { - size = strtoul((const char *)xml_char, NULL, 0); - xmlFree(xml_char); - // second: try to get value (always hex) - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value"); - if (NULL != xml_char) { - xml_char2 = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"name"); - fprintf(stdout, "s1ap %p field name %s size %u value %s\n",s1ap, xml_char2, size, xml_char); - xmlFree(xml_char2); - // if success to get value, do not parse children - //AssertFatal ((xmlStrlen(xml_char) == size), "ERROR %s() mismatch in size %d and strlen %d\n", __FUNCTION__, size, xmlStrlen(xml_char)); - //if (xmlStrlen(xml_char) == size) { - AssertFatal ((s1ap->binary_stream_pos+xmlStrlen(xml_char)/2) <= s1ap->binary_stream_allocated_size, - "ERROR in buffer size: binary_stream_pos %d xmlStrlen(xml_char)/2=%d\n", s1ap->binary_stream_pos, xmlStrlen(xml_char)/2); - rc = et_hex2data( &s1ap->binary_stream[s1ap->binary_stream_pos], xml_char, xmlStrlen(xml_char)); - s1ap->binary_stream_pos += xmlStrlen(xml_char)/2; - //et_display_node(cur_node, 0); - AssertFatal (rc >= 0, "ERROR in converting hex string %s len %d size %u rc %d\n", xml_char, xmlStrlen(xml_char), size, rc); - go_deeper_in_tree = 0; - //} - xmlFree(xml_char); - } - } - } - } - if (0 < go_deeper_in_tree) { - et_parse_s1ap(doc, cur_node->children, s1ap); - } - } - } -} - -//------------------------------------------------------------------------------ -void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr) -{ - xmlNode *cur_node = NULL; - xmlChar *xml_char = NULL; - xmlChar *xml_char2 = NULL; - - if ((NULL != sctp_node) && (NULL != sctp_hdr)) { - xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_payload_proto_id"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->ppid = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_sid"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->stream = strtoul((const char *)xml_char2, NULL, 16); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_tsn"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->tsn = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.data_ssn"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->ssn = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } - xmlFree(xml_char); - } - for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) { - et_parse_sctp_data_chunk(doc, cur_node, sctp_hdr); - } - } - -} -//------------------------------------------------------------------------------ -void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr) -{ - xmlNode *cur_node = NULL; - xmlChar *xml_char = NULL; - xmlChar *xml_char2 = NULL; - - if ((NULL != sctp_node) && (NULL != sctp_hdr)) { - xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_nr_out_streams"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->num_outbound_streams = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_nr_in_streams"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->num_inbound_streams = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_credit"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->a_rwnd = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_initial_tsn"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->initial_tsn = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.init_initiate_tag"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->init_tag = strtoul((const char *)xml_char2, NULL, 16); - xmlFree(xml_char2); - } - } - xmlFree(xml_char); - } - for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) { - et_parse_sctp_init_chunk(doc, cur_node, sctp_hdr); - } - } -} -//------------------------------------------------------------------------------ -void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr) -{ - xmlNode *cur_node = NULL; - xmlChar *xml_char = NULL; - xmlChar *xml_char2 = NULL; - - if ((NULL != sctp_node) && (NULL != sctp_hdr)) { - xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_nr_out_streams"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->num_outbound_streams = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_nr_in_streams"))) { - xml_char2 = xmlGetProp((xmlNode *)(xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->num_inbound_streams = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_credit"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->a_rwnd = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_initial_tsn"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->initial_tsn = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.initack_initiate_tag"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"show"); - if (NULL != xml_char2) { - sctp_hdr->init_tag = strtoul((const char *)xml_char2, NULL, 16); - xmlFree(xml_char2); - } - } - xmlFree(xml_char); - } - for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) { - et_parse_sctp_init_ack_chunk(doc, cur_node, sctp_hdr); - } - } -} -//------------------------------------------------------------------------------ -void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr) -{ - xmlNode *cur_node = NULL; - xmlChar *xml_char = NULL; - xmlChar *xml_char2 = NULL; - - if ((NULL != sctp_node) && (NULL != sctp_hdr)) { - if ((!xmlStrcmp(sctp_node->name, (const xmlChar *)"proto"))) { - xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"s1ap"))) { - xmlFree(xml_char); - xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"pos"); - if (NULL != xml_char) { - sctp_hdr->u.data_hdr.payload.xml_stream_pos_offset = strtoul((const char *)xml_char, NULL, 0); - xmlFree(xml_char); - - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"size"); - if (NULL != xml_char2) { - sctp_hdr->u.data_hdr.payload.binary_stream_allocated_size = strtoul((const char *)xml_char2, NULL, 0); - sctp_hdr->u.data_hdr.payload.binary_stream = calloc(1, sctp_hdr->u.data_hdr.payload.binary_stream_allocated_size); - sctp_hdr->u.data_hdr.payload.binary_stream_pos = 0; - fprintf(stdout, "Allocating payload of sctp_hdr %p %u bytes\n", sctp_hdr, sctp_hdr->u.data_hdr.payload.binary_stream_allocated_size); - xmlFree(xml_char2); - } - et_parse_s1ap(doc, sctp_node, &sctp_hdr->u.data_hdr.payload); - et_decode_s1ap(&sctp_hdr->u.data_hdr.payload); - return; - } - } - xmlFree(xml_char); - } - } - //if ((cur_node->type == XML_ATTRIBUTE_NODE) || (cur_node->type == XML_ELEMENT_NODE)) { - xml_char = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"name"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.srcport"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->src_port = strtoul((const char *)xml_char2, NULL, 16); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.dstport"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->dst_port = strtoul((const char *)xml_char2, NULL, 16); - xmlFree(xml_char2); - } - } else if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp.chunk_type"))) { - xml_char2 = xmlGetProp((xmlNode *)sctp_node, (const xmlChar *)"value"); - if (NULL != xml_char2) { - sctp_hdr->chunk_type = strtoul((const char *)xml_char2, NULL, 0); - xmlFree(xml_char2); - switch (sctp_hdr->chunk_type) { - case SCTP_CID_DATA: - et_parse_sctp_data_chunk(doc, sctp_node->parent, &sctp_hdr->u.data_hdr); - break; - case SCTP_CID_INIT: - et_parse_sctp_init_chunk(doc, sctp_node->parent, &sctp_hdr->u.init_hdr); - break; - case SCTP_CID_INIT_ACK: - et_parse_sctp_init_ack_chunk(doc, sctp_node->parent, &sctp_hdr->u.init_ack_hdr); - break; - default: - ; - } - } - } - } - for (cur_node = sctp_node->children; cur_node; cur_node = cur_node->next) { - et_parse_sctp(doc, cur_node, sctp_hdr); - } - } -} -//------------------------------------------------------------------------------ -void et_packet_shift_timing(et_packet_t * const packet, const struct timeval * const shift) -{ - timeval_add(&packet->time_relative_to_first_packet, &packet->time_relative_to_first_packet, shift); - AssertFatal((packet->time_relative_to_first_packet.tv_sec >= 0) && (packet->time_relative_to_first_packet.tv_usec >= 0), - "Bad timing result time_relative_to_first_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_first_packet.tv_sec, - packet->time_relative_to_first_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); - - timeval_add(&packet->time_relative_to_last_received_packet, &packet->time_relative_to_last_received_packet, shift); - AssertFatal((packet->time_relative_to_last_received_packet.tv_sec >= 0) && (packet->time_relative_to_last_received_packet.tv_usec >= 0), - "Bad timing result time_relative_to_last_received_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_last_received_packet.tv_sec, - packet->time_relative_to_last_received_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); - - timeval_add(&packet->time_relative_to_last_sent_packet, &packet->time_relative_to_last_sent_packet, shift); - AssertFatal((packet->time_relative_to_last_sent_packet.tv_sec >= 0) && (packet->time_relative_to_last_sent_packet.tv_usec >= 0), - "Bad timing result time_relative_to_last_sent_packet=%d.%d packet num %u, original frame number %u", - packet->time_relative_to_last_sent_packet.tv_sec, - packet->time_relative_to_last_sent_packet.tv_usec, - packet->packet_number, - packet->original_frame_number); -} - -//------------------------------------------------------------------------------ -et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node) -{ - - et_packet_t *packet = NULL; - xmlNode *cur_node = NULL; - xmlChar *xml_char = NULL; - float afloat = (float)0.0; - static struct timeval initial_time = { .tv_sec = 0, .tv_usec = 0 }; - static struct timeval relative_last_sent_packet = { .tv_sec = 0, .tv_usec = 0 }; - static struct timeval relative_last_received_packet = { .tv_sec = 0, .tv_usec = 0 }; - static char first_packet = 1; - static char first_sent_packet = 1; - static char first_received_packet = 1; - static unsigned int packet_number = 1; - - - if (NULL != node) { - packet = calloc(1, sizeof(*packet)); - - xml_char = xmlGetProp(node, (const xmlChar *)"action"); - packet->action = et_action_str2et_action_t(xml_char); - packet->status = ET_PACKET_STATUS_NONE; - xmlFree(xml_char); - packet->packet_number = packet_number++; - - for (cur_node = node->children; cur_node; cur_node = cur_node->next) { - //if (cur_node->type == XML_ELEMENT_NODE) { - if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"frame.time_relative"))) { - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value"); - afloat = atof((const char*)xml_char); - xmlFree(xml_char); - fprintf(stdout, "Parsing packet frame.time_relative: %f\n", afloat); - packet->time_relative_to_first_packet.tv_sec = (int)afloat; - packet->time_relative_to_first_packet.tv_usec = (int)((afloat - packet->time_relative_to_first_packet.tv_sec)*1000000.0); - - if (first_packet > 0) { - initial_time = packet->time_relative_to_first_packet; - packet->time_relative_to_first_packet.tv_sec = 0; - packet->time_relative_to_first_packet.tv_usec = 0; - first_packet = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &initial_time, - &packet->time_relative_to_first_packet); - } - } else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"frame.number"))) { - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value"); - packet->original_frame_number = strtoul((const char *)xml_char, NULL, 0); - fprintf(stdout, "Parsing packet frame.number: %u\n", packet->original_frame_number); - xmlFree(xml_char); - } else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"ip.src"))) { - xml_char = xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1); - et_ip_str2et_ip(xml_char, &packet->ip_hdr.src); - xmlFree(xml_char); - } else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"ip.dst"))) { - xml_char = xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1); - et_ip_str2et_ip(xml_char, &packet->ip_hdr.dst); - xmlFree(xml_char); - } else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"proto"))) { - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"name"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"sctp"))) { - et_parse_sctp(doc, cur_node, &packet->sctp_hdr); - } - xmlFree(xml_char); - } - } else if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"eNB.instance"))) { - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"value"); - packet->enb_instance = strtoul((const char *)xml_char, NULL, 0); - xmlFree(xml_char); - } - //} - } - } - return packet; -} -//------------------------------------------------------------------------------ -et_scenario_t* et_generate_scenario( - const char * const tsml_out_scenario_filename) -{ - xmlDocPtr doc = NULL; - xmlNodePtr root = NULL; - xmlNodePtr node = NULL; - xmlChar *xml_char = NULL; - et_scenario_t *scenario = NULL; - et_packet_t *last_packet = NULL; - et_packet_t *packet = NULL; - et_packet_t **next_packet = NULL; - - doc = xmlParseFile(tsml_out_scenario_filename); - if (NULL == doc) { - AssertFatal (0, "Could not parse scenario xml file %s!\n", tsml_out_scenario_filename); - } else { - fprintf(stdout, "Test scenario file to play: %s\n", tsml_out_scenario_filename); - //xmlDebugDumpDocument(NULL, doc); - } - - // Get root - root = xmlDocGetRootElement(doc); - if (NULL != root) { - if ((!xmlStrcmp(root->name, (const xmlChar *)"scenario"))) { - xml_char = xmlGetProp(root, (const xmlChar *)"name"); - printf("scenario name: %s\n", xml_char); - scenario = calloc(1, sizeof(*scenario)); - scenario->name = xml_char; // nodup nofree - - next_packet = &scenario->list_packet; - for (node = root->children; node != NULL; node = node->next) { - if ((!xmlStrcmp(node->name, (const xmlChar *)"packet"))) { - packet = et_parse_xml_packet(doc, node); - if (NULL != packet) { - // special case: S1AP same frame for 2 packets - if (NULL != last_packet) { - if (last_packet->original_frame_number == packet->original_frame_number) { - // updating because these informations are not in 2nd sctp header (same IP packet) - packet->sctp_hdr.dst_port = last_packet->sctp_hdr.dst_port; - packet->sctp_hdr.src_port = last_packet->sctp_hdr.src_port; - } - } - *next_packet = packet; - next_packet = &packet->next; - } else { - fprintf(stdout, "WARNING omitted packet\n"); - } - } - last_packet = packet; - } - } - } else { - fprintf(stderr, "Empty xml document\n"); - } - xmlFreeDoc(doc); - xmlCleanupParser(); - return scenario; -} -//------------------------------------------------------------------------------ -int et_generate_xml_scenario( - const char const * xml_in_dir_name, - const char const * xml_in_scenario_filename, - const char const * enb_config_filename, - char const * tsml_out_scenario_filename) -//------------------------------------------------------------------------------ -{ - //int fd_pdml_in; - xsltStylesheetPtr cur = NULL; - xmlDocPtr doc, res; - FILE *play_scenario_file = NULL; - const char *params[2*ENB_CONFIG_MAX_XSLT_PARAMS]; - int nb_params = 0; - int i,j; - char astring[1024]; - struct in_addr addr; - int ret = 0; - - 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((const xmlChar *)"/usr/share/oai/xsl/play_scenario.xsl"); - if (NULL == cur) { - AssertFatal (0, "Could not parse stylesheet file /usr/share/oai/xsl/play_scenario.xsl!\n"); - } else { - fprintf(stdout, "XSLT style sheet: /usr/share/oai/xsl/play_scenario.xsl\n"); - } - - doc = xmlParseFile(xml_in_scenario_filename); - if (NULL == doc) { - AssertFatal (0, "Could not parse scenario xml file %s!\n", xml_in_scenario_filename); - } else { - fprintf(stdout, "Test scenario file: %s\n", xml_in_scenario_filename); - } - - 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) { - sprintf((char *)tsml_out_scenario_filename,"%s",xml_in_scenario_filename); - if (et_strip_extension((char *)tsml_out_scenario_filename) > 0) { - strcat((char *)tsml_out_scenario_filename, ".tsml"); - play_scenario_file = fopen( tsml_out_scenario_filename, "w+"); - if (NULL != play_scenario_file) { - xsltSaveResultToFile(play_scenario_file, res, cur); - fclose(play_scenario_file); - fprintf(stdout, "Wrote test scenario to %s\n", tsml_out_scenario_filename); - } else { - fprintf(stderr, "ERROR in fopen(%s)\n", tsml_out_scenario_filename); - ret = -1; - } - } else { - fprintf(stderr, "ERROR in strip_extension()\n"); - ret = -1; - } - } else { - fprintf(stderr, "ERROR in xsltApplyStylesheet()\n"); - ret = -1; - } - xsltFreeStylesheet(cur); - xmlFreeDoc(doc); - xmlFreeDoc(res); - - xsltCleanupGlobals(); - xmlCleanupParser(); - return ret; -} - diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c deleted file mode 100644 index c4674e8901..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c +++ /dev/null @@ -1,1170 +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 - */ - -/* - play_scenario_s1ap.c - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - */ -#include -#include -#include -#include -#include -#include -#include -#include "tree.h" -#include "queue.h" - - -#include "intertask_interface.h" -#include "platform_types.h" -#include "assertions.h" -#include "conversions.h" -#include "s1ap_common.h" -#include "play_scenario_s1ap_eNB_defs.h" -#include "play_scenario.h" -#include "msc.h" -//------------------------------------------------------------------------------ -s1ap_eNB_internal_data_t s1ap_eNB_internal_data; -RB_GENERATE(s1ap_mme_map, s1ap_eNB_mme_data_s, entry, et_s1ap_eNB_compare_assoc_id); -//------------------------------------------------------------------------------ -extern et_scenario_t *g_scenario; -extern uint32_t g_constraints; -//------------------------------------------------------------------------------ -int et_s1ap_eNB_compare_assoc_id( - struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2) -{ - if (p1->assoc_id == -1) { - if (p1->cnx_id < p2->cnx_id) { - return -1; - } - if (p1->cnx_id > p2->cnx_id) { - return 1; - } - } else { - if (p1->assoc_id < p2->assoc_id) { - return -1; - } - if (p1->assoc_id > p2->assoc_id) { - return 1; - } - } - - /* Matching reference */ - return 0; -} -//------------------------------------------------------------------------------ -uint32_t et_s1ap_generate_eNB_id(void) -{ - char *out; - char hostname[50]; - int ret; - uint32_t eNB_id; - - /* Retrieve the host name */ - ret = gethostname(hostname, sizeof(hostname)); - DevAssert(ret == 0); - - out = crypt(hostname, "eurecom"); - DevAssert(out != NULL); - - eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]); - - return eNB_id; -} -//------------------------------------------------------------------------------ -uint16_t et_s1ap_eNB_fetch_add_global_cnx_id(void) -{ - return ++s1ap_eNB_internal_data.global_cnx_id; -} - -//------------------------------------------------------------------------------ -void et_s1ap_eNB_prepare_internal_data(void) -{ - memset(&s1ap_eNB_internal_data, 0, sizeof(s1ap_eNB_internal_data)); - STAILQ_INIT(&s1ap_eNB_internal_data.s1ap_eNB_instances_head); -} - -//------------------------------------------------------------------------------ -void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p) -{ - DevAssert(new_instance_p != NULL); - - STAILQ_INSERT_TAIL(&s1ap_eNB_internal_data.s1ap_eNB_instances_head, - new_instance_p, s1ap_eNB_entries); -} - -//------------------------------------------------------------------------------ -struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME( - s1ap_eNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id) -{ - struct s1ap_eNB_mme_data_s temp; - struct s1ap_eNB_mme_data_s *found; - - memset(&temp, 0, sizeof(struct s1ap_eNB_mme_data_s)); - - temp.assoc_id = assoc_id; - temp.cnx_id = cnx_id; - - if (instance_p == NULL) { - STAILQ_FOREACH(instance_p, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, - s1ap_eNB_entries) { - found = RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); - - if (found != NULL) { - return found; - } - } - } else { - return RB_FIND(s1ap_mme_map, &instance_p->s1ap_mme_head, &temp); - } - - return NULL; -} - -//------------------------------------------------------------------------------ -s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance) -{ - s1ap_eNB_instance_t *temp = NULL; - - STAILQ_FOREACH(temp, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, - s1ap_eNB_entries) { - if (temp->instance == instance) { - /* Matching occurence */ - return temp; - } - } - - return NULL; -} -//------------------------------------------------------------------------------ -void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) -{ - MessageDef *message_p; - sctp_data_req_t *sctp_data_req; - - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ); - - sctp_data_req = &message_p->ittiMsg.sctp_data_req; - - sctp_data_req->assoc_id = assoc_id; - sctp_data_req->buffer = buffer; - sctp_data_req->buffer_length = buffer_length; - sctp_data_req->stream = stream; - - itti_send_msg_to_task(TASK_SCTP, instance, message_p); -} -//------------------------------------------------------------------------------ -int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet) -{ - S1AP_MME_UE_S1AP_ID_t scenario_mme_ue_s1ap_id = 0; - S1AP_MME_UE_S1AP_ID_t rx_mme_ue_s1ap_id = 0; - S1AP_PDU_PR present; - - present = rx_packet->sctp_hdr.u.data_hdr.payload.pdu.present; - - switch (rx_packet->sctp_hdr.u.data_hdr.payload.message.procedureCode) { - case S1AP_ProcedureCode_id_HandoverPreparation: - if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCommandIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCommandIEs.mme_ue_s1ap_id; - } - break; - - case S1AP_ProcedureCode_id_HandoverResourceAllocation: - if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestIEs.mme_ue_s1ap_id; - } else if (present == S1AP_S1AP_PDU_PR_successfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestAcknowledgeIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestAcknowledgeIEs.mme_ue_s1ap_id; - } else if (present == S1AP_S1AP_PDU_PR_unsuccessfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverFailureIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverFailureIEs.mme_ue_s1ap_id; - } - break; - - case S1AP_ProcedureCode_id_HandoverNotification: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverNotifyIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverNotifyIEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_PathSwitchRequest: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PathSwitchRequestIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PathSwitchRequestIEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_HandoverCancel: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCancelIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCancelIEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_E_RABSetup: - if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupRequestIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupResponseIEs.mme_ue_s1ap_id; - } - break; - - case S1ap_ProcedureCode_id_E_RABModify: - if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyRequestIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyResponseIEs.mme_ue_s1ap_id; - } - break; - - case S1ap_ProcedureCode_id_E_RABRelease: - if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseCommandIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseCommandIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseResponseIEs.mme_ue_s1ap_id; - } - break; - - case S1ap_ProcedureCode_id_E_RABReleaseIndication: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseIndicationIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseIndicationIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_InitialContextSetup: - if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupRequestIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupResponseIEs.mme_ue_s1ap_id; - } - break; - - case S1ap_ProcedureCode_id_Paging: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PagingIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PagingIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_downlinkNASTransport: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_initialUEMessage: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialUEMessageIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialUEMessageIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_uplinkNASTransport: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_Reset: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ResetIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ResetIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_ErrorIndication: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ErrorIndicationIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ErrorIndicationIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_NASNonDeliveryIndication_IEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_NASNonDeliveryIndication_IEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_S1Setup: - /*if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupRequestIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupResponseIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupFailureIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupFailureIEs.mme_ue_s1ap_id; - }*/ - break; - - case S1ap_ProcedureCode_id_UEContextReleaseRequest: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseRequestIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_UEContextModification: - if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationRequestIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationResponseIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationFailureIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationFailureIEs.mme_ue_s1ap_id; - } - break; - - case S1ap_ProcedureCode_id_UECapabilityInfoIndication: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UECapabilityInfoIndicationIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UECapabilityInfoIndicationIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_UEContextRelease: - if (present == S1AP_PDU_PR_initiatingMessage) { - switch (rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.present) { - case S1ap_UE_S1AP_IDs_PR_uE_S1AP_ID_pair: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; - break; - case S1ap_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.mME_UE_S1AP_ID; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.mME_UE_S1AP_ID; - break; - } - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCompleteIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCompleteIEs.mme_ue_s1ap_id; - } - break; - - case S1ap_ProcedureCode_id_eNBStatusTransfer: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBStatusTransferIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBStatusTransferIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_MMEStatusTransfer: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEStatusTransferIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEStatusTransferIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_DeactivateTrace: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DeactivateTraceIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DeactivateTraceIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_TraceStart: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceStartIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceStartIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_TraceFailureIndication: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceFailureIndicationIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceFailureIndicationIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_ENBConfigurationUpdate: - /*if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateFailureIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateFailureIEs.mme_ue_s1ap_id; - }*/ - break; - - case S1ap_ProcedureCode_id_MMEConfigurationUpdate: - /*if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateFailureIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateFailureIEs.mme_ue_s1ap_id; - }*/ - break; - - case S1ap_ProcedureCode_id_LocationReportingControl: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingControlIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingControlIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_LocationReportingFailureIndication: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingFailureIndicationIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingFailureIndicationIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_LocationReport: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_OverloadStart: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStartIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStartIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_OverloadStop: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStopIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStopIEs.mme_ue_s1ap_id; - break; - - case S1ap_ProcedureCode_id_WriteReplaceWarning: - /*if (present == S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningRequestIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningResponseIEs.mme_ue_s1ap_id; - }*/ - break; - - case S1AP_ProcedureCode_id_eNBDirectInformationTransfer: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBDirectInformationTransferIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBDirectInformationTransferIEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_MMEDirectInformationTransfer: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEDirectInformationTransferIEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEDirectInformationTransferIEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_PrivateMessage: - case S1AP_ProcedureCode_id_eNBConfigurationTransfer: - case S1AP_ProcedureCode_id_MMEConfigurationTransfer: - AssertFatal(0, "TODO"); - break; - - case S1AP_ProcedureCode_id_CellTrafficTrace: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_CellTrafficTraceIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_CellTrafficTraceIEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_Kill: - /*if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillRequestIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillRequestIEs.mme_ue_s1ap_id; - } else { - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillResponseIEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillResponseIEs.mme_ue_s1ap_id; - }*/ - break; - - case S1AP_ProcedureCode_id_downlinkUEAssociatedLPPaTransport: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_uplinkUEAssociatedLPPaTransport: - rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - break; - - case S1AP_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport: - //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; - break; - - default: - AssertFatal(0, "Unknown procedure code %ld", rx_packet->sctp_hdr.u.data_hdr.payload.message.procedureCode); - } - - if (scenario_mme_ue_s1ap_id != rx_mme_ue_s1ap_id) { - S1AP_DEBUG("%s() Updating mme_ue_s1ap_id %u -> %u \n", __FUNCTION__, scenario_mme_ue_s1ap_id, rx_mme_ue_s1ap_id); - et_packet_t *p = spacket; - - while (p) { - et_s1ap_update_mme_ue_s1ap_id(p, scenario_mme_ue_s1ap_id, rx_mme_ue_s1ap_id); - p = p->next; - } - return 0; - } - return 1; -} -//------------------------------------------------------------------------------ -asn_comp_rval_t * et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints) -{ - asn_comp_rval_t *rv = NULL; - if (s1ap1->pdu.present != s1ap2->pdu.present) {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PRESENT; return rv;} - switch (s1ap1->pdu.present) { - case S1AP_PDU_PR_NOTHING: - break; - case S1AP_PDU_PR_initiatingMessage: - if (s1ap1->pdu.choice.initiatingMessage.procedureCode != s1ap2->pdu.choice.initiatingMessage.procedureCode) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} - if (s1ap1->pdu.choice.initiatingMessage.criticality != s1ap2->pdu.choice.initiatingMessage.criticality) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} - break; - case S1AP_PDU_PR_successfulOutcome: - if (s1ap1->pdu.choice.successfulOutcome.procedureCode != s1ap2->pdu.choice.successfulOutcome.procedureCode) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} - if (s1ap1->pdu.choice.successfulOutcome.criticality != s1ap2->pdu.choice.successfulOutcome.criticality) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} - break; - case S1AP_PDU_PR_unsuccessfulOutcome: - if (s1ap1->pdu.choice.unsuccessfulOutcome.procedureCode != s1ap2->pdu.choice.unsuccessfulOutcome.procedureCode) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} - if (s1ap1->pdu.choice.unsuccessfulOutcome.criticality != s1ap2->pdu.choice.unsuccessfulOutcome.criticality) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} - break; - default: - AssertFatal(0, "Unknown pdu.present %d", s1ap1->pdu.present); - } - - if (s1ap1->binary_stream_allocated_size == s1ap2->binary_stream_allocated_size) { - if (memcmp((void*)s1ap1->binary_stream, (void*)s1ap2->binary_stream, s1ap1->binary_stream_allocated_size) == 0) return NULL; - } - // if no matching, may be the scenario need minor corrections (same enb_ue_s1ap_id but need to update mme_ue_s1ap_id) - return et_s1ap_ies_is_matching(s1ap1->pdu.present, &s1ap1->message, &s1ap2->message, constraints); -} - -//------------------------------------------------------------------------------ -et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind) -{ - et_packet_t * packet = NULL; - AssertFatal (NULL != s1ap_data_ind, "Bad parameter sctp_data_ind\n"); - packet = calloc(1, sizeof(*packet)); - packet->action = ET_PACKET_ACTION_S1C_NULL; - //packet->time_relative_to_first_packet.tv_sec = 0; - //packet->time_relative_to_first_packet.tv_usec = 0; - //packet->time_relative_to_last_sent_packet.tv_sec = 0; - //packet->time_relative_to_last_sent_packet.tv_usec = 0; - //packet->time_relative_to_last_received_packet.tv_sec = 0; - //packet->time_relative_to_last_received_packet.tv_usec = 0; - //packet->original_frame_number = 0; - //packet->packet_number = 0; - packet->enb_instance = 0; //TODO - //packet->ip_hdr; - // keep in mind: allocated buffer: sctp_datahdr.payload.binary_stream - packet->sctp_hdr.chunk_type = SCTP_CID_DATA; - memcpy((void*)&packet->sctp_hdr.u.data_hdr, (void*)&s1ap_data_ind->sctp_datahdr, sizeof(packet->sctp_hdr)); - //packet->next = NULL; - packet->status = ET_PACKET_STATUS_RECEIVED; - //packet->timer_id = 0; - AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed"); - return packet; -} - - -//------------------------------------------------------------------------------ -// return 0 if packet was waited -int et_scenario_set_packet_received(et_packet_t * const packet) -{ - et_packet_t * p = NULL; - int rc = 0; - - packet->status = ET_PACKET_STATUS_RECEIVED; - S1AP_DEBUG("Packet received: num %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); - S1AP_DEBUG("Last Packet received: num %u | original frame number %u \n", g_scenario->last_rx_packet->packet_number, g_scenario->last_rx_packet->original_frame_number); - - p = g_scenario->last_rx_packet; - while (NULL != p) { - if (ET_PACKET_ACTION_S1C_RECEIVE == p->action) { - if ((ET_PACKET_STATUS_RECEIVED == p->status) || (ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT == p->status)) { - g_scenario->last_rx_packet = p; - g_scenario->time_last_rx_packet.tv_sec = p->timestamp_packet.tv_sec; - g_scenario->time_last_rx_packet.tv_usec = p->timestamp_packet.tv_usec; - S1AP_DEBUG("Set Last Packet received: num %u | original frame number %u \n", g_scenario->last_rx_packet->packet_number, g_scenario->last_rx_packet->original_frame_number); - S1AP_DEBUG("Set time_last_rx_packet %ld.%06d\n", g_scenario->time_last_rx_packet.tv_sec, g_scenario->time_last_rx_packet.tv_usec); - } else { - break; - } - } - p = p->next; - } - - if (0 != packet->timer_id) { - rc = timer_remove(packet->timer_id); - AssertFatal(rc == 0, "TODO: Debug Timer on Rx packet num %u unknown", packet->packet_number); - g_scenario->timer_count--; - return rc; - } - return 1; -} - -//------------------------------------------------------------------------------ -int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind) -{ - et_packet_t *packet = NULL; - et_packet_t *rx_packet = NULL; - unsigned long int not_found = 1; - asn_comp_rval_t *comp_results = NULL; - asn_comp_rval_t *comp_results2 = NULL; - unsigned char error_code = 0; - - AssertFatal (NULL != s1ap_data_ind, "Bad parameter sctp_data_ind\n"); - rx_packet = et_build_packet_from_s1ap_data_ind(s1ap_data_ind); - - if (NULL == g_scenario->last_rx_packet) { - packet = g_scenario->list_packet; - while (NULL != packet) { - if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - if ((ET_PACKET_STATUS_RECEIVED == packet->status) || (ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT == packet->status)) { - g_scenario->last_rx_packet = packet; - if (ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT != packet->status) { - g_scenario->time_last_rx_packet.tv_sec = packet->timestamp_packet.tv_sec; - g_scenario->time_last_rx_packet.tv_usec = packet->timestamp_packet.tv_usec; - } - S1AP_DEBUG("Set Last Packet received: num %u | original frame number %u \n", g_scenario->last_rx_packet->packet_number, g_scenario->last_rx_packet->original_frame_number); - S1AP_DEBUG("Set time_last_rx_packet %ld.%06d\n", g_scenario->time_last_rx_packet.tv_sec, g_scenario->time_last_rx_packet.tv_usec); - } else { - break; - } - } - packet = packet->next; - } - packet = g_scenario->list_packet; - } else { - packet = g_scenario->last_rx_packet->next; - } - // not_found threshold may sure depend on number of mme, may be not sure on number of UE - while ((NULL != packet) && (not_found < 9)) { - S1AP_DEBUG("%s() Considering packet num %d original frame number %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number); - if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - comp_results = et_sctp_is_matching(&packet->sctp_hdr, &rx_packet->sctp_hdr, g_constraints); - if (NULL == comp_results) { - S1AP_DEBUG("Compare RX packet with packet: num %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); - packet->timestamp_packet.tv_sec = rx_packet->timestamp_packet.tv_sec; - packet->timestamp_packet.tv_usec = rx_packet->timestamp_packet.tv_usec; - return et_scenario_set_packet_received(packet); - } else { - S1AP_DEBUG("Compare RX packet with packet: num %u | original frame number %u failed\n", - packet->packet_number, packet->original_frame_number); - while (comp_results) { - S1AP_DEBUG("Result err code %s(%u) ASN1 struct name %s\n", - et_error_match2str(comp_results->err_code), comp_results->err_code, comp_results->name); - - // (each asn1 rc <= 166 (enum e_S1AP_ProtocolIE_ID, in generated file S1AP_ProtocolIE_ID.h)) - if (comp_results->err_code == COMPARE_ERR_CODE_NO_MATCH) { - //TODO MME_UE_S1AP_ID, etc. - // get latest error code - if (strcmp(comp_results->name, "S1ap-MME-UE-S1AP-ID") == 0) { - if (0 == et_handle_s1ap_mismatch_mme_ue_s1ap_id((et_packet_t *const)packet, (et_packet_t *const)rx_packet)) { - packet->timestamp_packet.tv_sec = rx_packet->timestamp_packet.tv_sec; - packet->timestamp_packet.tv_usec = rx_packet->timestamp_packet.tv_usec; - return et_scenario_set_packet_received(packet); - } - } else if (strcmp(comp_results->name, "S1ap-TransportLayerAddress") == 0) { - S1AP_WARN("Some work needed there for %s, TODO in generic_scenario.xsl, add sgw conf file in the process, anyway continuing...\n",comp_results->name); - packet->timestamp_packet.tv_sec = rx_packet->timestamp_packet.tv_sec; - packet->timestamp_packet.tv_usec = rx_packet->timestamp_packet.tv_usec; - return et_scenario_set_packet_received(packet); - } else { - S1AP_WARN("\n\nRX PACKET:\n"); - et_display_packet_sctp(&rx_packet->sctp_hdr); - S1AP_WARN("\n\nWAITED PACKET:\n"); - et_display_packet_sctp(&packet->sctp_hdr); - AssertFatal(0,"Some work needed there"); - } - } - comp_results2 = comp_results; - comp_results = comp_results2->next; - et_free_pointer(comp_results2); - } - } - } - not_found += 1; - packet = packet->next; - } - et_display_packet_sctp(&rx_packet->sctp_hdr); - AssertFatal(0, "Rx packet not found in scenario (see dump above)"); - return -1; -} - -//------------------------------------------------------------------------------ -void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind) -{ - int result = 0; - et_event_t event; - - DevAssert(sctp_data_ind != NULL); - - memset((void*)&event, 0, sizeof(event)); - - event.code = ET_EVENT_RX_S1AP; - event.u.s1ap_data_ind.sctp_datahdr.tsn = 0; - event.u.s1ap_data_ind.sctp_datahdr.stream = sctp_data_ind->stream; - event.u.s1ap_data_ind.sctp_datahdr.ssn = 0; - event.u.s1ap_data_ind.sctp_datahdr.ppid = S1AP_SCTP_PPID; - event.u.s1ap_data_ind.sctp_datahdr.assoc_id = sctp_data_ind->assoc_id; - - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_pos = 0; - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_allocated_size = sctp_data_ind->buffer_length; - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream = NULL; - if ((sctp_data_ind->buffer_length > 0) && (NULL != sctp_data_ind->buffer)) { - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream = calloc(1, sctp_data_ind->buffer_length); - memcpy(event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream, - sctp_data_ind->buffer, - sctp_data_ind->buffer_length); - - if (et_s1ap_decode_pdu( - &event.u.s1ap_data_ind.sctp_datahdr.payload.pdu, - &event.u.s1ap_data_ind.sctp_datahdr.payload.message, - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream, - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_allocated_size) < 0) { - AssertFatal (0, "ERROR Cannot decode RX S1AP message!\n"); - } - - } - - result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - - et_scenario_fsm_notify_event(event); - - memset((void*)&event, 0, sizeof(event)); - event.code = ET_EVENT_TICK; - et_scenario_fsm_notify_event(event); - -} -//------------------------------------------------------------------------------ -void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr, - uint16_t in_streams, - uint16_t out_streams) -{ - MessageDef *message_p = NULL; - sctp_new_association_req_t *sctp_new_association_req_p = NULL; - s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - - DevAssert(instance_p != NULL); - DevAssert(mme_ip_address != NULL); - - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; - sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - - sctp_new_association_req_p->in_streams = in_streams; - sctp_new_association_req_p->out_streams = out_streams; - - memcpy(&sctp_new_association_req_p->remote_address, - mme_ip_address, - sizeof(*mme_ip_address)); - - memcpy(&sctp_new_association_req_p->local_address, - local_ip_addr, - sizeof(*local_ip_addr)); - - /* Create new MME descriptor */ - s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); - DevAssert(s1ap_mme_data_p != NULL); - - s1ap_mme_data_p->cnx_id = et_s1ap_eNB_fetch_add_global_cnx_id(); - sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - - s1ap_mme_data_p->assoc_id = -1; - s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - - memcpy((void*)&s1ap_mme_data_p->mme_net_ip_address, mme_ip_address, sizeof(*mme_ip_address)); - - - STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - - /* Insert the new descriptor in list of known MME - * but not yet associated. - */ - RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p); - s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; - instance_p->s1ap_mme_nb ++; - instance_p->s1ap_mme_pending_nb ++; - - itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); -} -//------------------------------------------------------------------------------ -void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, - struct s1ap_eNB_instance_s * const s1ap_eNB_instance, - s1ap_eNB_mme_data_t * const mme_desc_p) -{ - et_packet_t *packet = NULL; - int ret; - unsigned int old_enb_port = 0; - unsigned int old_mme_port = 0; - - S1AP_DEBUG("%s for SCTP association (%u)\n",__FUNCTION__,assoc_id); - - packet = g_scenario->list_packet; - while (NULL != packet) { - switch (packet->sctp_hdr.chunk_type) { - - case SCTP_CID_DATA : - S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_DATA\n",__FUNCTION__,assoc_id); - if ((ET_PACKET_STATUS_NONE == packet->status) || (ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING == packet->status)) { - if (0 < old_mme_port) { - if (packet->action == ET_PACKET_ACTION_S1C_SEND) { - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &mme_desc_p->mme_net_ip_address); - if (0 == ret) { - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &s1ap_eNB_instance->s1c_net_ip_address); - if (0 == ret) { - // same IP src, same IP dst - if ((packet->sctp_hdr.dst_port == old_mme_port) && (packet->sctp_hdr.src_port == old_enb_port)) { - packet->sctp_hdr.u.data_hdr.assoc_id = assoc_id; - S1AP_DEBUG("tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); - S1AP_DEBUG("\tUpdated assoc id: %u\n", assoc_id); - } - } - } - } else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &mme_desc_p->mme_net_ip_address); - if (0 == ret) { - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &s1ap_eNB_instance->s1c_net_ip_address); - if (0 == ret) { - // same IP src, same IP dst - if ((packet->sctp_hdr.src_port == old_mme_port) && (packet->sctp_hdr.dst_port == old_enb_port)) { - packet->sctp_hdr.u.data_hdr.assoc_id = assoc_id; - S1AP_DEBUG("tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); - S1AP_DEBUG("\tUpdated assoc id: %u\n", assoc_id); - } - } - } - } - } - } - break; - - // Strong assumption - // in replayed scenario, the order of SCTP INIT packets is supposed to be the same as in the catched scenario - case SCTP_CID_INIT: - S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_INIT\n",__FUNCTION__,assoc_id); - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &mme_desc_p->mme_net_ip_address); - if (0 == ret) { - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &s1ap_eNB_instance->s1c_net_ip_address); - if (0 == ret) { - if (0 == old_enb_port) { - if (ET_PACKET_STATUS_NONE == packet->status) { - packet->status = ET_PACKET_STATUS_SENT; - old_enb_port = packet->sctp_hdr.src_port; - S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_INIT SUCCESS\n",__FUNCTION__,assoc_id); - } - } - } - } - break; - - case SCTP_CID_INIT_ACK: - S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_INIT_ACK\n",__FUNCTION__,assoc_id); - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &mme_desc_p->mme_net_ip_address); - if (0 == ret) { - ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &s1ap_eNB_instance->s1c_net_ip_address); - if (0 == ret) { - if (old_enb_port == packet->sctp_hdr.dst_port) { - if (ET_PACKET_STATUS_NONE == packet->status) { - packet->status = ET_PACKET_STATUS_RECEIVED; - old_mme_port = packet->sctp_hdr.dst_port; - S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_INIT_ACK SUCCESS\n",__FUNCTION__,assoc_id); - } - } - } - } - break; - - case SCTP_CID_HEARTBEAT: - case SCTP_CID_HEARTBEAT_ACK: - case SCTP_CID_COOKIE_ECHO: - case SCTP_CID_COOKIE_ACK: - case SCTP_CID_ECN_ECNE: - case SCTP_CID_ECN_CWR: - break; - - case SCTP_CID_ABORT: - case SCTP_CID_SHUTDOWN: - case SCTP_CID_SHUTDOWN_ACK: - case SCTP_CID_ERROR: - case SCTP_CID_SHUTDOWN_COMPLETE: - //TODO - break; - - default: - AssertFatal(0, "Unknown chunk_type %d packet num %u", packet->sctp_hdr.chunk_type, packet->packet_number); - ; - } - packet = packet->next; - } -} -//------------------------------------------------------------------------------ -void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown) -{ - if (sctp_shutdown) { - /* A previously connected MME has been shutdown */ - - /* TODO check if it was used by some eNB and send a message to inform these eNB if there is no more associated MME */ - if (mme_desc_p->state == S1AP_ENB_STATE_CONNECTED) { - mme_desc_p->state = S1AP_ENB_STATE_DISCONNECTED; - - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb > 0) { - /* Decrease associated MME number */ - mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb --; - } - - /* If there are no more associated MME, inform eNB app */ - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); - S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; - itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); - } - } - } else { - /* Check that at least one setup message is pending */ - DevCheck(mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb > 0, mme_desc_p->s1ap_eNB_instance->instance, - mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb, 0); - - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb > 0) { - /* Decrease pending messages number */ - mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb --; - mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb++; - } - - et_s1ap_update_assoc_id_of_packets(mme_desc_p->assoc_id, - mme_desc_p->s1ap_eNB_instance, - mme_desc_p); - - - /* If there are no more pending messages, inform eNB app */ - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); - S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; - itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); - } - } -} -//------------------------------------------------------------------------------ -void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB) -{ - s1ap_eNB_instance_t *new_instance; - uint8_t index; - - DevAssert(s1ap_register_eNB != NULL); - - /* Look if the provided instance already exists */ - new_instance = et_s1ap_eNB_get_instance(instance); - - if (new_instance != NULL) { - /* Checks if it is a retry on the same eNB */ - DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0); - DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0); - DevCheck(new_instance->tac == s1ap_register_eNB->tac, new_instance->tac, s1ap_register_eNB->tac, 0); - DevCheck(new_instance->mcc == s1ap_register_eNB->mcc, new_instance->mcc, s1ap_register_eNB->mcc, 0); - DevCheck(new_instance->mnc == s1ap_register_eNB->mnc, new_instance->mnc, s1ap_register_eNB->mnc, 0); - DevCheck(new_instance->mnc_digit_length == s1ap_register_eNB->mnc_digit_length, new_instance->mnc_digit_length, s1ap_register_eNB->mnc_digit_length, 0); - DevCheck(memcmp((void*)&new_instance->s1c_net_ip_address, (void*)&s1ap_register_eNB->enb_ip_address, sizeof(new_instance->s1c_net_ip_address)) == 0, 0,0,0); - } else { - new_instance = calloc(1, sizeof(s1ap_eNB_instance_t)); - DevAssert(new_instance != NULL); - - RB_INIT(&new_instance->s1ap_ue_head); - RB_INIT(&new_instance->s1ap_mme_head); - - /* Copy usefull parameters */ - new_instance->instance = instance; - new_instance->eNB_name = s1ap_register_eNB->eNB_name; - new_instance->eNB_id = s1ap_register_eNB->eNB_id; - new_instance->cell_type = s1ap_register_eNB->cell_type; - new_instance->tac = s1ap_register_eNB->tac; - new_instance->mcc = s1ap_register_eNB->mcc; - new_instance->mnc = s1ap_register_eNB->mnc; - new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length; - memcpy((void*)&new_instance->s1c_net_ip_address, (void*)&s1ap_register_eNB->enb_ip_address, sizeof(new_instance->s1c_net_ip_address)); - - /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ - et_s1ap_eNB_insert_new_instance(new_instance); - - S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n", - instance, - s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", - s1ap_register_eNB->eNB_id); - } - - DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, - S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0); - - /* Trying to connect to provided list of MME ip address */ - for (index = 0; index < s1ap_register_eNB->nb_mme; index++) { - et_s1ap_eNB_register_mme(new_instance, - &s1ap_register_eNB->mme_ip_address[index], - &s1ap_register_eNB->enb_ip_address, - s1ap_register_eNB->sctp_in_streams, - s1ap_register_eNB->sctp_out_streams); - } -} - -//------------------------------------------------------------------------------ -void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) -{ - s1ap_eNB_instance_t *instance_p = NULL; - s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - - DevAssert(sctp_new_association_resp != NULL); - - instance_p = et_s1ap_eNB_get_instance(instance); - DevAssert(instance_p != NULL); - - s1ap_mme_data_p = et_s1ap_eNB_get_MME(instance_p, -1, - sctp_new_association_resp->ulp_cnx_id); - DevAssert(s1ap_mme_data_p != NULL); - - if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - - et_s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - - return; - } - - S1AP_DEBUG("Received successful result for SCTP association (%u), instance %d, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - /* Update parameters */ - s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; - s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; - s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - - et_s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); -} - -//------------------------------------------------------------------------------ -void *et_s1ap_eNB_task(void *arg) -{ - MessageDef *received_msg = NULL; - int result; - - S1AP_DEBUG("Starting S1AP layer\n"); - - et_s1ap_eNB_prepare_internal_data(); - - itti_mark_task_ready(TASK_S1AP); - MSC_START_USE(); - - while (1) { - itti_receive_msg(TASK_S1AP, &received_msg); - - switch (ITTI_MSG_ID(received_msg)) { - case TERMINATE_MESSAGE: - S1AP_WARN("*** Exiting S1AP thread\n"); - itti_exit_task(); - break; - - case S1AP_REGISTER_ENB_REQ: { - /* Register a new eNB. - * in Virtual mode eNBs will be distinguished using the mod_id/ - * Each eNB has to send an S1AP_REGISTER_ENB message with its - * own parameters. - */ - et_s1ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &S1AP_REGISTER_ENB_REQ(received_msg)); - } - break; - - case SCTP_NEW_ASSOCIATION_RESP: { - et_s1ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - } - break; - - case SCTP_DATA_IND: { - et_s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - } - break; - - case TIMER_HAS_EXPIRED: - LOG_I(S1AP, " Received TIMER_HAS_EXPIRED: timer_id %d\n", TIMER_HAS_EXPIRED(received_msg).timer_id); - { - et_packet_t * packet = (et_packet_t*)TIMER_HAS_EXPIRED (received_msg).arg; - et_event_t event; - g_scenario->timer_count--; - if (NULL != packet) { - if (packet->status == ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING) { - memset((void*)&event, 0, sizeof(event)); - event.code = ET_EVENT_RX_PACKET_TIME_OUT; - event.u.rx_packet_time_out = packet; - et_scenario_fsm_notify_event(event); - } else if (packet->status == ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) { - memset((void*)&event, 0, sizeof(event)); - event.code = ET_EVENT_TX_TIMED_PACKET; - event.u.tx_timed_packet = packet; - et_scenario_fsm_notify_event(event); - - et_event_t continue_event; - continue_event.code = ET_EVENT_TICK; - et_scenario_fsm_notify_event(continue_event); - } else if ((packet->status != ET_PACKET_STATUS_SENT) && ((packet->status != ET_PACKET_STATUS_RECEIVED))) { - AssertFatal (0, "Bad status %d of packet timed out!\n", packet->status); - } - } else { - LOG_W(S1AP, " Received TIMER_HAS_EXPIRED: timer_id %d, no packet attached to timer\n", TIMER_HAS_EXPIRED(received_msg).timer_id); - } - } - if (TIMER_HAS_EXPIRED (received_msg).timer_id == g_scenario->enb_register_retry_timer_id) { - /* Restart the registration process */ - g_scenario->registered_enb = 0; - et_eNB_app_register (g_scenario->enb_properties); - } - break; - - default: - S1AP_ERROR("Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - - received_msg = NULL; - } - - return NULL; -} - - diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c deleted file mode 100644 index bc7ca6afbd..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c +++ /dev/null @@ -1,232 +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 - */ - -/* - play_scenario_s1ap_compare_ie.c - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tree.h" -#include "queue.h" - - -#include "intertask_interface.h" -#include "platform_types.h" -#include "assertions.h" -#include "conversions.h" -#include "s1ap_common.h" -#include "play_scenario_s1ap_eNB_defs.h" -#include "play_scenario.h" -#include "msc.h" -//------------------------------------------------------------------------------ -extern et_scenario_t *g_scenario; -extern uint32_t g_constraints; -//------------------------------------------------------------------------------ - -//asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints) -//{ -//} - -void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id) -{ - xmlNode *cur_node = NULL; - xmlAttrPtr attr = NULL; - xmlChar *xml_char = NULL; - int size = 0; - int pos = 0; - int go_deeper_in_tree = 1; - //S1AP_INFO("%s() mme_ue_s1ap_id %u\n", __FUNCTION__, new_id); - - // modify - for (cur_node = (xmlNode *)node; cur_node; cur_node = cur_node->next) { - go_deeper_in_tree = 1; - if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) { - // do not get hidden fields - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide"); - if (NULL != xml_char) { - if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) { - go_deeper_in_tree = 0; - } - xmlFree(xml_char); - } - if (0 < go_deeper_in_tree) { - // first get size - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"pos"); - if (NULL != xml_char) { - pos = strtoul((const char *)xml_char, NULL, 0); - pos -= s1ap->xml_stream_pos_offset; - AssertFatal(pos >= 0, "Bad pos %d xml_stream_pos_offset %d", pos, s1ap->xml_stream_pos_offset); - xmlFree(xml_char); - xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size"); - if (NULL != xml_char) { - const xmlChar value_d[32]; - const xmlChar value_h[20]; - const xmlChar showname[64]; - int ret = 0; - int pos2 = 0; - unsigned long int uli = 0; - char hex[3] = {0,0,0}; - char *end_ptr = NULL; - - size = strtoul((const char *)xml_char, NULL, 0); - xmlFree(xml_char); - // second: try to set value (always hex) - ret = snprintf((char *)value_d, 32, "%ld", new_id); - AssertFatal((ret > 0) && (ret < 32), "Could not convert int to dec str"); - ret = snprintf((char *)value_h, 20, "C0%08X", new_id); - AssertFatal((ret > 0) && (ret < 20), "Could not convert int to hex str"); - ret = snprintf((char *)showname, 64, "MME-UE-S1AP-ID: %d", new_id); - AssertFatal((ret > 0) && (ret < 64), "Could not convert int to dec str"); - - attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"value", value_h); - attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"show", value_d); - attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"showname", showname); - //TODO update s1ap->binary_stream @pos with new_id_hex, size - AssertFatal((pos+size) < s1ap->binary_stream_allocated_size, "Rewrite of mme_ue_s1ap_id out of bounds of binary_stream"); - //avoid endianess issues - do { - hex[0] = value_h[pos2++]; - hex[1] = value_h[pos2++]; - hex[2] = '\0'; - end_ptr = hex; - uli = strtoul(hex, &end_ptr, 16); - AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %lu errno %d", hex, uli, errno); - s1ap->binary_stream[pos++] = (unsigned char)uli; - } while (pos2 < (2*5)); - // update ASN1 - et_decode_s1ap(s1ap); - //S1AP_INFO("Updated ASN1 for %s\n", showname); - } - } - } - } - if (0 < go_deeper_in_tree) { - update_xpath_node_mme_ue_s1ap_id(s1ap, cur_node->children, new_id); - } - } -} - -/** - * update_xpath_nodes: - * @nodes: the nodes set. - * @value: the new value for the node(s) - * - * Prints the @nodes content to @output. - * From http://www.xmlsoft.org/examples/#xpath2.c - */ -void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id) -{ - int size = 0; - int i = 0; - xmlNode *s1ap_node = NULL; - - size = (nodes) ? nodes->nodeNr : 0; - //S1AP_DEBUG("%s() num nodes %u\n", __FUNCTION__, size); - - /* - * NOTE: the nodes are processed in reverse order, i.e. reverse document - * order because xmlNodeSetContent can actually free up descendant - * of the node and such nodes may have been selected too ! Handling - * in reverse order ensure that descendant are accessed first, before - * they get removed. Mixing XPath and modifications on a tree must be - * done carefully ! - */ - for(i = size - 1; i >= 0; i--) { - s1ap_node = nodes->nodeTab[i]; - AssertFatal(NULL != s1ap_node, "One element of resultset of XPATH expression is NULL\n"); - update_xpath_node_mme_ue_s1ap_id(s1ap_payload, s1ap_node, new_id); - /* - * All the elements returned by an XPath query are pointers to - * elements from the tree *except* namespace nodes where the XPath - * semantic is different from the implementation in libxml2 tree. - * As a result when a returned node set is freed when - * xmlXPathFreeObject() is called, that routine must check the - * element type. But node from the returned set may have been removed - * by xmlNodeSetContent() resulting in access to freed data. - * This can be exercised by running valgrind - * There is 2 ways around it: - * - make a copy of the pointers to the nodes from the result set - * then call xmlXPathFreeObject() and then modify the nodes - * or - * - remove the reference to the modified nodes from the node set - * as they are processed, if they are not namespace nodes. - */ - if (nodes->nodeTab[i]->type != XML_NAMESPACE_DECL) { - nodes->nodeTab[i] = NULL; - } - } -} -//------------------------------------------------------------------------------ -int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id) -{ - xmlChar xpath_expression[ET_XPATH_EXPRESSION_MAX_LENGTH]; - int ret = 0; - xmlDocPtr doc = NULL; - xmlXPathContextPtr xpath_ctx = NULL; - xmlXPathObjectPtr xpath_obj = NULL; - - //S1AP_DEBUG("%s() packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number, old_id, new_id); - - ret = snprintf(xpath_expression, ET_XPATH_EXPRESSION_MAX_LENGTH, "//field[@name=\"s1ap.MME_UE_S1AP_ID\"][@show=\"%u\"]", old_id); - AssertFatal((ret > 0) && (ret < ET_XPATH_EXPRESSION_MAX_LENGTH), "Could not build XPATH expression err=%d", ret); - - doc = packet->sctp_hdr.u.data_hdr.payload.doc; - // Create xpath evaluation context - xpath_ctx = xmlXPathNewContext(doc); - if(xpath_ctx == NULL) { - fprintf(stderr,"Error: unable to create new XPath context\n"); - xmlFreeDoc(doc); - return(-1); - } - - // Evaluate xpath expression - xpath_obj = xmlXPathEvalExpression(xpath_expression, xpath_ctx); - xmlXPathFreeContext(xpath_ctx); - AssertFatal(xpath_obj != NULL, "Unable to evaluate XPATH expression \"%s\"\n", xpath_expression); - - if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)){ - xmlXPathFreeObject(xpath_obj); - S1AP_DEBUG("%s() No match \"%s\"packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", - __FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id); - return -1; - } - // update selected nodes - update_xpath_nodes_mme_ue_s1ap_id(&packet->sctp_hdr.u.data_hdr.payload, xpath_obj->nodesetval, new_id); - - // Cleanup of XPath data - xmlXPathFreeObject(xpath_obj); - - return 0; -} diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h b/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h deleted file mode 100644 index 532e14bb1d..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h +++ /dev/null @@ -1,242 +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 - */ - -#include - -#include "queue.h" -#include "tree.h" - -#include "sctp_eNB_defs.h" - -#ifndef PLAY_SCENARIO_S1AP_ENB_DEFS_H_ -#define PLAY_SCENARIO_S1AP_ENB_DEFS_H_ - -#define ENB_TAC (1) -#define ENB_MCC (208) -#define ENB_MNC (92) - -#define ENB_NAME "Eurecom ENB" -#define ENB_NAME_FORMAT (ENB_NAME" %u") - -#define S1AP_PORT_NUMBER (36412) -#define S1AP_SCTP_PPID (18) - -#define X2AP_PORT_NUMBER (36422) -#define X2AP_SCTP_PPID (27) - -#define S1AP_ENB_NAME_LENGTH_MAX (150) - -typedef enum { - /* Disconnected state: initial state for any association. */ - S1AP_ENB_STATE_DISCONNECTED = 0x0, - /* State waiting for S1 Setup response message if eNB is MME accepted or - * S1 Setup failure if MME rejects the eNB. - */ - S1AP_ENB_STATE_WAITING = 0x1, - /* The eNB is successfully connected to MME, UE contexts can be created. */ - S1AP_ENB_STATE_CONNECTED = 0x2, - /* The MME has sent an overload start message. Once the MME disables the - * OVERLOAD marker, the state of the association will be - * S1AP_ENB_STATE_CONNECTED. - */ - S1AP_ENB_OVERLOAD = 0x3, - /* Max number of states available */ - S1AP_ENB_STATE_MAX, -} s1ap_eNB_state_t; - - -/* If the Overload Action IE in the OVERLOAD START message is set to - * - “reject all RRC connection establishments for non-emergency mobile - * originated data transfer “ (i.e. reject traffic corresponding to RRC cause - * “mo-data “ (TS 36.331 [16])), or - * - “reject all RRC connection establishments for signalling “ (i.e. reject - * traffic corresponding to RRC cause “modata” and “mo-signalling” - * (TS 36.331 [16])),or - * - “only permit RRC connection establishments for emergency sessions and - * mobile terminated services” (i.e. only permit traffic corresponding to RRC - * cause “emergency” and “mt-Access” (TS 36.331 [16])). - * - * NOTE: When the Overload Action IE is set to “only permit RRC connection - * establishments for emergency sessions and mobile terminated services”, - * emergency calls with RRC cause “highPriorityAcess” from high priority users - * are rejected (TS 24.301 [24]). - */ -typedef enum { - S1AP_OVERLOAD_REJECT_MO_DATA = 0x0, - S1AP_OVERLOAD_REJECT_ALL_SIGNALLING = 0x1, - S1AP_OVERLOAD_ONLY_EMERGENCY_AND_MT = 0x2, - S1AP_NO_OVERLOAD = 0x3, - S1AP_OVERLOAD_MAX, -} s1ap_overload_state_t; - -/* Served PLMN identity element */ -struct plmn_identity_s { - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - STAILQ_ENTRY(plmn_identity_s) next; -}; - -/* Served group id element */ -struct served_group_id_s { - uint16_t mme_group_id; - STAILQ_ENTRY(served_group_id_s) next; -}; - -/* Served mme code for a particular MME */ -struct mme_code_s { - uint8_t mme_code; - STAILQ_ENTRY(mme_code_s) next; -}; - -/* Served gummei element */ -struct served_gummei_s { - /* Number of MME served PLMNs */ - uint8_t nb_served_plmns; - /* List of served PLMNs by MME */ - STAILQ_HEAD(served_plmns_s, plmn_identity_s) served_plmns; - - /* Number of group id in list */ - uint8_t nb_group_id; - /* Served group id list */ - STAILQ_HEAD(served_group_ids_s, served_group_id_s) served_group_ids; - - /* Number of MME code */ - uint8_t nb_mme_code; - /* MME Code to uniquely identify an MME within an MME pool area */ - STAILQ_HEAD(mme_codes_s, mme_code_s) mme_codes; - - /* Next GUMMEI element */ - STAILQ_ENTRY(served_gummei_s) next; -}; - -struct s1ap_eNB_instance_s; - -/* This structure describes association of a eNB to a MME */ -typedef struct s1ap_eNB_mme_data_s { - /* MME descriptors tree, ordered by sctp assoc id */ - RB_ENTRY(s1ap_eNB_mme_data_s) entry; - - /* This is the optional name provided by the MME */ - char *mme_name; - net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets - - /* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max - * number of 8 RATs but in our case only one is used. The LTE related pool - * configuration is included on the first place in the list. - */ - STAILQ_HEAD(served_gummeis_s, served_gummei_s) served_gummei; - - /* Relative processing capacity of an MME with respect to the other MMEs - * in the pool in order to load-balance MMEs within a pool as defined - * in TS 23.401. - */ - uint8_t relative_mme_capacity; - - /* Current MME overload information (if any). */ - s1ap_overload_state_t overload_state; - /* Current eNB->MME S1AP association state */ - s1ap_eNB_state_t state; - - /* Next usable stream for UE signalling */ - int32_t nextstream; - - /* Number of input/ouput streams */ - uint16_t in_streams; - uint16_t out_streams; - - /* Connexion id used between SCTP/S1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - /* Only meaningfull in virtual mode */ - struct s1ap_eNB_instance_s *s1ap_eNB_instance; -} s1ap_eNB_mme_data_t; - -typedef struct s1ap_eNB_instance_s { - /* Next s1ap eNB association. - * Only used for virtual mode. - */ - STAILQ_ENTRY(s1ap_eNB_instance_s) s1ap_eNB_entries; - - /* Number of MME requested by eNB (tree size) */ - uint32_t s1ap_mme_nb; - /* Number of MME for which association is pending */ - uint32_t s1ap_mme_pending_nb; - /* Number of MME successfully associated to eNB */ - uint32_t s1ap_mme_associated_nb; - /* Tree of S1AP MME associations ordered by association ID */ - RB_HEAD(s1ap_mme_map, s1ap_eNB_mme_data_s) s1ap_mme_head; - - /* TODO: add a map ordered by relative MME capacity */ - - /* Tree of UE ordered by eNB_ue_s1ap_id's */ - RB_HEAD(s1ap_ue_map, s1ap_eNB_ue_context_s) s1ap_ue_head; - - /* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */ - instance_t instance; - - /* Displayable name of eNB */ - char *eNB_name; - net_ip_address_t s1c_net_ip_address; - - /* Unique eNB_id to identify the eNB within EPC. - * In our case the eNB is a macro eNB so the id will be 20 bits long. - * For Home eNB id, this field should be 28 bits long. - */ - uint32_t eNB_id; - /* The type of the cell */ - enum cell_type_e cell_type; - - /* Tracking area code */ - uint16_t tac; - - /* Mobile Country Code - * Mobile Network Code - */ - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - -} s1ap_eNB_instance_t; - -typedef struct { - /* List of served eNBs - * Only used for virtual mode - */ - STAILQ_HEAD(s1ap_eNB_instances_head_s, s1ap_eNB_instance_s) s1ap_eNB_instances_head; - /* Nb of registered eNBs */ - uint8_t nb_registered_eNBs; - - /* Generate a unique connexion id used between S1AP and SCTP */ - uint16_t global_cnx_id; -} s1ap_eNB_internal_data_t; - -int s1ap_eNB_compare_assoc_id( - struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2); - -/* Generate the tree management functions */ -RB_PROTOTYPE(s1ap_mme_map, s1ap_eNB_mme_data_s, entry, - s1ap_eNB_compare_assoc_id); - -#endif /* PLAY_SCENARIO_S1AP_ENB_DEFS_H_ */ diff --git a/openair3/TEST/EPC_TEST/play_scenario_sctp.c b/openair3/TEST/EPC_TEST/play_scenario_sctp.c deleted file mode 100644 index c126608598..0000000000 --- a/openair3/TEST/EPC_TEST/play_scenario_sctp.c +++ /dev/null @@ -1,112 +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 - */ - -/* - play_scenario_sctp.c - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - */ - - -#include - -#include "intertask_interface.h" -#include "platform_types.h" -#include "assertions.h" -#include "play_scenario.h" - -//------------------------------------------------------------------------------ -asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints) -{ - asn_comp_rval_t *rv = NULL; - - // no comparison for ports - if (sctp1->ppid != sctp2->ppid) { - S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid); - rv = calloc(1, sizeof(asn_comp_rval_t)); - rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID; - return rv; - } - - if (sctp1->assoc_id != sctp2->assoc_id) { - S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id); - rv = calloc(1, sizeof(asn_comp_rval_t)); - rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID; - return rv; - } - - if (sctp1->stream != sctp2->stream) { - if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) { - rv = calloc(1, sizeof(asn_comp_rval_t)); - rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_STREAM_ID; - return rv; - } else { - S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream); - } - } - - // We do not have SSN from lower layers - // if (sctp1->ssn != sctp2->ssn) { - // if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) { - // rv = calloc(1, sizeof(asn_comp_rval_t)); - // rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN; - // return rv; - // } else { - // S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn); - // } - // } - return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints); -} - -//------------------------------------------------------------------------------ -asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints) -{ - // no comparison for ports - asn_comp_rval_t *rv = NULL; - - if (sctp1->chunk_type != sctp2->chunk_type) { - S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type); - rv = calloc(1, sizeof(asn_comp_rval_t)); - rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE; - return rv; - } - - switch (sctp1->chunk_type) { - case SCTP_CID_DATA: - return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints); - break; - - case SCTP_CID_INIT: - AssertFatal(0, "Not needed now"); - break; - - case SCTP_CID_INIT_ACK: - AssertFatal(0, "Not needed now"); - break; - - default: - AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type); - } - - return NULL; -} diff --git a/openair3/TEST/oaisim_mme_client_test.c b/openair3/TEST/oaisim_mme_client_test.c deleted file mode 100644 index 8fcda8a5ad..0000000000 --- a/openair3/TEST/oaisim_mme_client_test.c +++ /dev/null @@ -1,122 +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 - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "sctp_primitives_client.h" - -#include "s1ap_common.h" -#include "s1ap_eNB.h" -#include "s1ap_mme.h" - -char ip_addr[] = "127.0.0.1"; - -int assoc[2]; -uint8_t id[] = { 0x03, 0x56, 0xf0, 0xd8 }; -char identity[] = { 0x02, 0x08, 0x34 }; -char tac[] = { 0x00, 0x01 }; -char infoNAS[] = { 0x07, 0x42, 0x01, 0xE0, 0x06, 0x00, 0x00, 0xF1, 0x10, 0x00, 0x01, 0x00, 0x2C, - 0x52, 0x01, 0xC1, 0x01, 0x09, 0x10, 0x03, 0x77, 0x77, 0x77, 0x07, 0x61, 0x6E, 0x72, 0x69, 0x74, - 0x73, 0x75, 0x03, 0x63, 0x6F, 0x6D, 0x05, 0x01, 0x0A, 0x01, 0x20, 0x37, 0x27, 0x0E, 0x80, 0x80, - 0x21, 0x0A, 0x03, 0x00, 0x00, 0x0A, 0x81, 0x06, 0x0A, 0x00, 0x00, 0x01, 0x50, 0x0B, 0xF6, - 0x00, 0xF1, 0x10, 0x80, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01 - }; - -uint32_t eNB_UE_S1AP_ID = 0; - -int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer, - uint32_t *length); - -int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer, - uint32_t *length) -{ - InitialUEMessageIEs initialUEmessageIEs; - InitialUEMessageIEs *initialUEmessageIEs_p = &initialUEmessageIEs; - memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs)); - initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID; - initialUEmessageIEs.nas_pdu.buf = infoNAS; - initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS); - initialUEmessageIEs.tai.tAC.buf = tac; - initialUEmessageIEs.tai.tAC.size = 2; - initialUEmessageIEs.tai.pLMNidentity.buf = identity; - initialUEmessageIEs.tai.pLMNidentity.size = 3; - initialUEmessageIEs.eutran_cgi.pLMNidentity.buf = identity; - initialUEmessageIEs.eutran_cgi.pLMNidentity.size = 3; - initialUEmessageIEs.eutran_cgi.cell_ID.buf = id; - initialUEmessageIEs.eutran_cgi.cell_ID.size = 4; - initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4; - initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data; - return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length); -} - -void recv_callback(uint8_t *buffer, uint32_t length) -{ - uint8_t *bufferS; - uint32_t len; - s1ap_eNB_generate_initial_ue_message(&bufferS, &len); - sctp_send_msg(assoc[0], 1, bufferS, len); -} - -int main(int argc, char *argv[]) -{ - asn_enc_rval_t retVal; - uint8_t *buffer; - uint32_t len; - SupportedTAs_Item_t ta; - PLMNidentity_t plmnIdentity; - asn_debug = 0; - asn1_xer_print = 0; - S1SetupRequestIEs s1SetupRequest; - memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs)); - s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID; - s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.buf = id; - s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3; - s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4; - OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3); - s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT; - OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom", - strlen("ENB 1 eurecom")); - memset(&ta, 0, sizeof(SupportedTAs_Item_t)); - memset(&plmnIdentity, 0, sizeof(PLMNidentity_t)); - OCTET_STRING_fromBuf(&ta.tAC, tac, 2); - OCTET_STRING_fromBuf(&plmnIdentity, identity, 3); - ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity); - ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta); - s1SetupRequest.defaultPagingDRX = PagingDRX_v64; - s1ap_eNB_encode_s1setuprequest(&s1SetupRequest, &buffer, &len); - assoc[0] = sctp_connect_to_remote_host(ip_addr, 36412, &recv_callback); - sctp_send_msg(0, 0, buffer, len); - free(buffer); - // generateUplinkNASTransport(&buffer, &len); - // sctp_send_msg(assoc[0], 0, buffer, len); - // s1ap_mme_decode_pdu(buffer, len); - pthread_join(sctp_get_receiver_thread(assoc[0]), NULL); - return(0); -} diff --git a/openair3/TEST/oaisim_mme_itti_test.c b/openair3/TEST/oaisim_mme_itti_test.c deleted file mode 100644 index ecfbdb0acb..0000000000 --- a/openair3/TEST/oaisim_mme_itti_test.c +++ /dev/null @@ -1,93 +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 - */ - -#include -#include -#include -#include - -#include -#include - -#include - -#include "mme_config.h" -#include "gtpv1u_sgw_defs.h" - -#include "intertask_interface.h" - -#include "sctp_primitives_server.h" -#include "udp_primitives_server.h" -#include "s1ap_mme.h" -#include "log.h" -#include "sgw_lite_defs.h" -#include "ipv4_defs.h" - -int main(int argc, char *argv[]) -{ - int i = 0; - int prio = 0; - mme_config_t mme_config; - MessageDef *message_p; - struct sched_param param = { - .sched_priority = 10, - }; - - config_parse_opt_line(argc, argv, &mme_config); - fprintf(stdout, "Starting %s ITTI test\n", PACKAGE_STRING); - - if (setpriority(PRIO_PROCESS, 0, prio) < 0) { - fprintf(stderr, "Cannot assign requested prio: %d\n" - "%d:%s\n", prio, errno, strerror(errno)); - return -1; - } - - if (sched_setscheduler(0, SCHED_RR, ¶m) < 0) { - fprintf(stderr, "Cannot assign requested scheduler policy\n" - "%d:%s\n", errno, strerror(errno)); - return -1; - } - - /* Calling each layer init function */ - log_init(&mme_config); - itti_init(TASK_MAX, tasks_info); - sctp_init(&mme_config); - udp_init(&mme_config); - s1ap_mme_init(&mme_config); - gtpv1u_init(&mme_config); - ipv4_init(&mme_config); - - sgw_lite_init(&mme_config); - - message_p = itti_alloc_new_message(TASK_S1AP, MESSAGE_TEST); - - while(i < (1 << 15)) { - if (send_broadcast_message(message_p) < 0) { - fprintf(stderr, "Failed to send broadcast message %d\n", i); - } - - i++; - } - - fprintf(stderr, "Successfully sent %lu messages", get_current_message_number()); - - return 0; -} diff --git a/openair3/TEST/oaisim_mme_list_benchmark.c b/openair3/TEST/oaisim_mme_list_benchmark.c deleted file mode 100644 index 633e83aace..0000000000 --- a/openair3/TEST/oaisim_mme_list_benchmark.c +++ /dev/null @@ -1,261 +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 - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "sctp_primitives_client.h" - -#include "s1ap_common.h" -#include "s1ap_eNB.h" -#include "s1ap_mme.h" - -#include "s1ap_eNB_encoder.h" -#include "s1ap_eNB_decoder.h" - -#define NB_OF_ENB 10 -#define NB_OF_UES 100 - -static int connected_eNB = 0; -static char ip_addr[] = "127.0.0.1"; -uint32_t ipv4_local = 0x7F000001; -static uint8_t id[] = { 0x03, 0x56, 0xf0, 0xd8 }; -static char identity[] = { 0x02, 0x08, 0x34 }; -static char tac[] = { 0x00, 0x01 }; -static char infoNAS[] = { 0x07, 0x42, 0x01, 0xE0, 0x06, 0x00, 0x00, 0xF1, 0x10, 0x00, 0x01, 0x00, 0x2C, - 0x52, 0x01, 0xC1, 0x01, 0x09, 0x10, 0x03, 0x77, 0x77, 0x77, 0x07, 0x61, 0x6E, 0x72, 0x69, 0x74, - 0x73, 0x75, 0x03, 0x63, 0x6F, 0x6D, 0x05, 0x01, 0x0A, 0x01, 0x20, 0x37, 0x27, 0x0E, 0x80, 0x80, - 0x21, 0x0A, 0x03, 0x00, 0x00, 0x0A, 0x81, 0x06, 0x0A, 0x00, 0x00, 0x01, 0x50, 0x0B, 0xF6, - 0x00, 0xF1, 0x10, 0x80, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01 - }; -uint32_t nb_eNB = NB_OF_ENB; -uint32_t nb_ue = NB_OF_UES; - -void s1ap_test_generate_s1_setup_request(uint32_t eNB_id, uint8_t **buffer, - uint32_t *length); -int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID, - uint8_t **buffer, - uint32_t *length); -int recv_callback(uint32_t assocId, - uint32_t stream, - uint8_t *buffer, - uint32_t length); -int sctp_connected(void *args, - uint32_t assocId, - uint32_t instreams, - uint32_t outstreams); - -void s1ap_test_generate_s1_setup_request(uint32_t eNB_id, uint8_t **buffer, - uint32_t *length) -{ - S1SetupRequestIEs_t s1SetupRequest; - SupportedTAs_Item_t ta; - PLMNidentity_t plmnIdentity; - uint8_t *id_p = (uint8_t *)(&eNB_id + 1); - memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs_t)); - s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID; - s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.buf = id_p; - s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3; - s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4; - OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3); - s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT; - OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom", - strlen("ENB 1 eurecom")); - memset(&ta, 0, sizeof(SupportedTAs_Item_t)); - memset(&plmnIdentity, 0, sizeof(PLMNidentity_t)); - OCTET_STRING_fromBuf(&ta.tAC, tac, 2); - OCTET_STRING_fromBuf(&plmnIdentity, identity, 3); - ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity); - ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta); - s1SetupRequest.defaultPagingDRX = PagingDRX_v64; - s1ap_eNB_encode_s1_setup_request(&s1SetupRequest, buffer, length); -} - -int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID, - uint8_t **buffer, - uint32_t *length) -{ - InitialUEMessageIEs_t initialUEmessageIEs; - InitialUEMessageIEs_t *initialUEmessageIEs_p = &initialUEmessageIEs; - memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs_t)); - initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID & 0x00ffffff; - initialUEmessageIEs.nas_pdu.buf = (uint8_t *)infoNAS; - initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS); - initialUEmessageIEs.tai.tAC.buf = (uint8_t *)tac; - initialUEmessageIEs.tai.tAC.size = 2; - initialUEmessageIEs.tai.pLMNidentity.buf = (uint8_t *)identity; - initialUEmessageIEs.tai.pLMNidentity.size = 3; - initialUEmessageIEs.eutran_cgi.pLMNidentity.buf = (uint8_t *)identity; - initialUEmessageIEs.eutran_cgi.pLMNidentity.size = 3; - initialUEmessageIEs.eutran_cgi.cell_ID.buf = (uint8_t *)id; - initialUEmessageIEs.eutran_cgi.cell_ID.size = 4; - initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4; - initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data; - return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length); -} - -int s1ap_test_generate_initial_setup_resp(uint32_t eNB_UE_S1AP_ID, - uint32_t mme_UE_S1AP_ID, - uint8_t eRAB_id, - uint32_t teid, - uint8_t **buffer, - uint32_t *length) -{ - InitialContextSetupResponseIEs_t initialResponseIEs; - InitialContextSetupResponseIEs_t *initialResponseIEs_p = &initialResponseIEs; - E_RABSetupItemCtxtSURes_t e_RABSetupItemCtxtSURes; - memset(initialResponseIEs_p, 0, sizeof(InitialContextSetupResponseIEs_t)); - memset(&e_RABSetupItemCtxtSURes, 0, sizeof(E_RABSetupItemCtxtSURes_t)); - initialResponseIEs_p->mme_ue_s1ap_id = mme_UE_S1AP_ID; - initialResponseIEs_p->eNB_UE_S1AP_ID = eNB_UE_S1AP_ID; - e_RABSetupItemCtxtSURes.e_RAB_ID = eRAB_id; - e_RABSetupItemCtxtSURes.transportLayerAddress.buf = (uint8_t *)&ipv4_local; - e_RABSetupItemCtxtSURes.transportLayerAddress.size = 4; - e_RABSetupItemCtxtSURes.gTP_TEID.buf = (uint8_t *)&teid; - e_RABSetupItemCtxtSURes.gTP_TEID.size = 4; - ASN_SEQUENCE_ADD( - &initialResponseIEs_p->e_RABSetupListCtxtSURes.e_RABSetupItemCtxtSURes, - &e_RABSetupItemCtxtSURes); - return s1ap_eNB_encode_initial_context_setup_response(initialResponseIEs_p, - buffer, length); -} - -int recv_callback(uint32_t assocId, - uint32_t stream, - uint8_t *buffer, - uint32_t length) -{ - S1AP_S1AP_PDU_t pdu; - uint8_t *buffer2; - uint32_t len; - int j; - - if (s1ap_eNB_decode_pdu(&pdu, buffer, length) < 0) { - fprintf(stderr, "s1ap_eNB_decode_pdu returned status < 0\n"); - free(buffer); - return -1; - } - - if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_S1Setup - && pdu.present == S1AP_S1AP_PDU_PR_successfulOutcome) { - for (j = 0; j < nb_ue; j++) { - s1ap_test_generate_initial_ue_message(j, &buffer2, &len); - - if (sctp_send_msg(assocId, j % 64 + 1, buffer2, len) < 0) { - fprintf(stderr, - "sctp_send_msg returned status < 0\nSomething bad happened on SCTP layer\n"); - free(buffer2); - break; - } - - free(buffer2); - } - } else if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_InitialContextSetup - && pdu.present == S1AP_PDU_PR_initiatingMessage) { - fprintf(stdout, "Received InitialContextSetup request\n"); - s1ap_test_generate_initial_setup_resp( - message.msg.initialContextSetupRequestIEs.eNB_UE_S1AP_ID, - message.msg.initialContextSetupRequestIEs.mme_ue_s1ap_id, - 0x5, - 0x1, - &buffer2, - &len); - - if (sctp_send_msg(assocId, stream, buffer2, len) < 0) { - fprintf(stderr, - "sctp_send_msg returned status < 0\nSomething bad happened on SCTP layer\n"); - free(buffer2); - } - - free(buffer2); - } else { - fprintf(stderr, "Received unexpected message %d %d\n", message.procedureCode, - message.direction); - free(buffer); - return -1; - } - - free(buffer); - return 0; -} - -int sctp_connected(void *args, - uint32_t assocId, - uint32_t instreams, - uint32_t outstreams) -{ - uint8_t *buffer; - uint32_t len; - fprintf(stdout, "New association %d\n", assocId); - s1ap_test_generate_s1_setup_request(assocId * nb_eNB, &buffer, &len); - - if (sctp_send_msg(assocId, 0, buffer, len) < 0) { - free(buffer); - fprintf(stderr, - "sctp_send_msg returned status < 0. Something bad happened on SCTP layer\n"); - exit(0); - } - - free(buffer); - connected_eNB++; - return 0; -} - -int main(int argc, char *argv[]) -{ - asn_enc_rval_t retVal; - int i; - SupportedTAs_Item_t ta; - PLMNidentity_t plmnIdentity; - asn_debug = 0; - asn1_xer_print = 0; - - if (argc > 1) { - nb_eNB = atoi(argv[1]); - - if (argc > 2) { - nb_ue = atoi(argv[2]); - } - } - - for (i = 0; i < nb_eNB; i++) { - sctp_connect_to_remote_host(ip_addr, 36412, 18, NULL, sctp_connected, - recv_callback); - } - - while (1) { - sleep(1); - } - - // generateUplinkNASTransport(&buffer, &len); - // sctp_send_msg(assoc[0], 0, buffer, len); - // s1ap_mme_decode_pdu(buffer, len); - sctp_terminate(); - return(0); -} diff --git a/openair3/TEST/oaisim_mme_s1ap_test.c b/openair3/TEST/oaisim_mme_s1ap_test.c deleted file mode 100644 index aa8f92aee1..0000000000 --- a/openair3/TEST/oaisim_mme_s1ap_test.c +++ /dev/null @@ -1,179 +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 - */ - -#include -#include -#include - -#include "s1ap_common.h" -#include "s1ap_eNB_decoder.h" -#include "s1ap_mme_decoder.h" -#include "s1ap_eNB_encoder.h" - -#define MAX_BUF_LENGTH (1024) - -typedef struct { - char *procedure_name; - uint8_t buffer[MAX_BUF_LENGTH]; - uint32_t buf_len; -} s1ap_test_t; - -s1ap_test_t s1ap_test[] = { - // { - // .procedure_name = "Downlink NAS transport", - // .buffer = { - // 0x00, 0x0B, 0x40, 0x21, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - // 0x05, 0xC0, 0x01, 0x10, 0xCE, 0xCC, 0x00, 0x08, 0x00, 0x03, - // 0x40, 0x01, 0xB3, 0x00, 0x1A, 0x00, 0x0A, 0x09, 0x27, 0xAB, - // 0x1F, 0x7C, 0xEC, 0x01, 0x02, 0x01, 0xD9 - // }, - // .buf_len = 37, - // }, - { - .procedure_name = "Uplink NAS transport", - .buffer = { - 0x00, 0x0D, 0x40, 0x41, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, - 0x05, 0xC0, 0x01, 0x10, 0xCE, 0xCC, 0x00, 0x08, 0x00, 0x03, - 0x40, 0x01, 0xB3, 0x00, 0x1A, 0x00, 0x14, 0x13, 0x27, 0xD3, - 0x77, 0xED, 0x4C, 0x01, 0x02, 0x01, 0xDA, 0x28, 0x08, 0x03, - 0x69, 0x6D, 0x73, 0x03, 0x70, 0x66, 0x74, 0x00, 0x64, 0x40, - 0x08, 0x00, 0x02, 0xF8, 0x29, 0x00, 0x00, 0x20, 0x40, 0x00, - 0x43, 0x40, 0x06, 0x00, 0x02, 0xF8, 0x29, 0x00, 0x04, - }, - .buf_len = 69, - }, - { - .procedure_name = "UE capability info indication", - .buffer = { - 0x00, 0x16, 0x40, 0x37, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x05, 0xC0, 0x01, 0x10, 0xCE, 0xCC, 0x00, 0x08, 0x00, 0x03, - 0x40, 0x01, 0xB3, 0x00, 0x4A, 0x40, 0x20, 0x1F, 0x00, 0xE8, - 0x01, 0x01, 0xA8, 0x13, 0x80, 0x00, 0x20, 0x83, 0x13, 0x05, - 0x0B, 0x8B, 0xFC, 0x2E, 0x2F, 0xF0, 0xB8, 0xBF, 0xAF, 0x87, - 0xFE, 0x40, 0x44, 0x04, 0x07, 0x0C, 0xA7, 0x4A, 0x80, - }, - .buf_len = 59, - }, - { - .procedure_name = "Initial Context Setup Request", - .buffer = { - 0x00, 0x09, 0x00, 0x80, 0xD4, 0x00, 0x00, 0x06, 0x00, 0x00, - 0x00, 0x05, 0xC0, 0x01, 0x10, 0xCE, 0xCC, 0x00, 0x08, 0x00, - 0x03, 0x40, 0x01, 0xB3, 0x00, 0x42, 0x00, 0x0A, 0x18, 0x08, - 0xF0, 0xD1, 0x80, 0x60, 0x02, 0xFA, 0xF0, 0x80, 0x00, 0x18, - 0x00, 0x80, 0x81, 0x00, 0x00, 0x34, 0x00, 0x7C, 0x45, 0x00, - 0x09, 0x3D, 0x0F, 0x80, 0x0A, 0x05, 0x00, 0x02, 0x03, 0x78, - 0x48, 0x86, 0x6D, 0x27, 0xC7, 0x97, 0x8E, 0xA1, 0x02, 0x07, - 0x42, 0x01, 0x49, 0x06, 0x00, 0x02, 0xF8, 0x29, 0x00, 0x04, - 0x00, 0x48, 0x52, 0x01, 0xC1, 0x01, 0x09, 0x1B, 0x03, 0x69, - 0x6D, 0x73, 0x03, 0x70, 0x66, 0x74, 0x06, 0x6D, 0x6E, 0x63, - 0x30, 0x39, 0x32, 0x06, 0x6D, 0x63, 0x63, 0x32, 0x30, 0x38, - 0x04, 0x67, 0x70, 0x72, 0x73, 0x05, 0x01, 0x0A, 0x80, 0x00, - 0x24, 0x5D, 0x01, 0x00, 0x30, 0x10, 0x23, 0x93, 0x1F, 0x93, - 0x96, 0xFE, 0xFE, 0x74, 0x4B, 0xFF, 0xFF, 0x00, 0xC5, 0x00, - 0x6C, 0x00, 0x32, 0x0B, 0x84, 0x34, 0x01, 0x08, 0x5E, 0x04, - 0xFE, 0xFE, 0xC5, 0x6C, 0x50, 0x0B, 0xF6, 0x02, 0xF8, 0x29, - 0x80, 0x00, 0x01, 0xF0, 0x00, 0x70, 0x8A, 0x53, 0x12, 0x64, - 0x01, 0x01, 0x00, 0x6B, 0x00, 0x05, 0x18, 0x00, 0x0C, 0x00, - 0x00, 0x00, 0x49, 0x00, 0x20, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - }, - .buf_len = 217, - }, - { - .procedure_name = "Initial context setup response", - .buffer = { - 0x20, 0x09, 0x00, 0x26, 0x00, 0x00, 0x03, 0x00, 0x00, 0x40, - 0x05, 0xC0, 0x01, 0x10, 0xCE, 0xCC, 0x00, 0x08, 0x40, 0x03, - 0x40, 0x01, 0xB3, 0x00, 0x33, 0x40, 0x0F, 0x00, 0x00, 0x32, - 0x40, 0x0A, 0x0A, 0x1F, 0x0A, 0x05, 0x02, 0x05, 0x00, 0x0F, - 0x7A, 0x03, - }, - .buf_len = 42, - } -}; - -static int compare_buffer(uint8_t *buffer, uint32_t length_buffer, - uint8_t *pattern, - uint32_t length_pattern) -{ - int i; - - if (length_buffer != length_pattern) { - printf("Length mismatch, expecting %d bytes, got %d bytes\n", length_pattern, - length_buffer); - return -1; - } - - for (i = 0; i < length_buffer; i++) { - if (pattern[i] != buffer[i]) { - printf("Mismatch fount in bytes %d\nExpecting 0x%02x, got 0x%02x\n", - i, pattern[i], buffer[i]); - } - } - - return 0; -} - -int main(int argc, char *argv[]) -{ - int i; - asn1_xer_print = 2; - - if (argc > 1) { - asn_debug = 1; - } - - for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) { - S1AP_S1AP_PDU_t pdu; - uint8_t *buffer; - uint32_t length; - memset(&pdu, 0, sizeof(pdu)); - printf("Trying to decode %s procedure with asn1c decoder\n", - s1ap_test[i].procedure_name); - - if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer, - s1ap_test[i].buf_len) < 0) { - if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer, - s1ap_test[i].buf_len) < 0) { - printf("Failed to decode this message\n"); - } else { - printf("Succesfully decoded %s with eNB decoder\n", s1ap_test[i].procedure_name); - } - } else { - printf("Succesfully decoded %s with MME decoder\n", s1ap_test[i].procedure_name); - } - - printf("Trying to encode %s procedure with asn1c encoder\n", - s1ap_test[i].procedure_name); - - if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { - printf("Failed to encode this message on MME side, trying eNB side\n"); - } else { - compare_buffer(buffer, length, s1ap_test[i].buffer, s1ap_test[i].buf_len); - free(buffer); - } - } - - return 0; -} diff --git a/openair3/TEST/oaisim_mme_sctp_test.c b/openair3/TEST/oaisim_mme_sctp_test.c deleted file mode 100644 index b8be3e185c..0000000000 --- a/openair3/TEST/oaisim_mme_sctp_test.c +++ /dev/null @@ -1,74 +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 - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "sctp_primitives_client.h" - -#include "s1ap_common.h" -#include "s1ap_eNB.h" -#include "s1ap_mme.h" - -#include "s1ap_eNB_encoder.h" -#include "s1ap_eNB_decoder.h" - -int recv_callback(uint32_t assocId, - uint32_t stream, - uint8_t *buffer, - uint32_t length) -{ - free(buffer); - return 0; -} - -int sctp_connected(void *args, - uint32_t assocId, - uint32_t instreams, - uint32_t outstreams) -{ - return 0; -} - -int main(int argc, char *argv[]) -{ - asn_enc_rval_t retVal; - int i; - - for (i = 0; i < nb_eNB; i++) { - sctp_connect_to_remote_host(ip_addr, 36412, NULL, sctp_connected, recv_callback); - } - - while (1) { - sleep(1); - } - - sctp_terminate(); - return(0); -} diff --git a/openair3/TEST/oaisim_mme_test_s1c.c b/openair3/TEST/oaisim_mme_test_s1c.c deleted file mode 100644 index 94a554ab5f..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c.c +++ /dev/null @@ -1,339 +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 - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "UTIL/LOG/log_extern.h" -#include "assertions.h" -#include "intertask_interface.h" -#include "sctp_eNB_task.h" -#include "s1ap_eNB.h" -#include "enb_config.h" - -#include "oaisim_mme_test_s1c.h" - -# define ENB_REGISTER_RETRY_DELAY 5 -//------------------------------------------------------------------------------ -static void get_options (int argc, char **argv); -static uint32_t eNB_app_register(const uint32_t enb_id_start, const uint32_t enb_id_end, const Enb_properties_array_t *enb_properties); -static void *eNB_app_task (void *args_p); -void mme_test_s1_start_test(instance_t instance); -//------------------------------------------------------------------------------ -static char *conf_config_file_name = NULL; -const Enb_properties_array_t *enb_properties = NULL; -int16_t glog_level = LOG_INFO; -int16_t glog_verbosity = LOG_MED; -s1c_test_t s1c_test = { - 0, // scenario_index - 0, // tx_next_message_index - 0, // rx_next_message_index - 0 // assoc_id - }; - -//------------------------------------------------------------------------------ -static void get_options (int argc, char **argv) -//------------------------------------------------------------------------------ -{ - int c; - - - while ((c = getopt_long (argc, argv, "K:g:G:O:",NULL,NULL)) != -1) { - switch (c) { - case 'O': - conf_config_file_name = optarg; - break; - - case 'g': - glog_level=atoi(optarg); // value between 1 - 9 - break; - - case 'G': - glog_verbosity=atoi(optarg);// value from 0, 0x5, 0x15, 0x35, 0x75 - break; - - default: - break; - } - } - - AssertFatal(conf_config_file_name != NULL,"Please provide a configuration file\n"); - - -} - - -//------------------------------------------------------------------------------ -static uint32_t eNB_app_register(const uint32_t enb_id_start, const uint32_t enb_id_end, const Enb_properties_array_t *enb_properties) -//------------------------------------------------------------------------------ -{ - uint32_t enb_id; - uint32_t mme_id; - MessageDef *msg_p; - uint32_t register_enb_pending = 0; - char *str = NULL; - struct in_addr addr; - - // 1 eNB should be max. - // 1 eNB should be max. - for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { - { - s1ap_register_enb_req_t *s1ap_register_eNB; - - /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); - - s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p); - - /* Some default/random parameters */ - s1ap_register_eNB->eNB_id = enb_properties->properties[enb_id]->eNB_id; - s1ap_register_eNB->cell_type = enb_properties->properties[enb_id]->cell_type; - s1ap_register_eNB->eNB_name = enb_properties->properties[enb_id]->eNB_name; - s1ap_register_eNB->tac = enb_properties->properties[enb_id]->tac; - s1ap_register_eNB->mcc = enb_properties->properties[enb_id]->mcc; - s1ap_register_eNB->mnc = enb_properties->properties[enb_id]->mnc; - s1ap_register_eNB->mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length; - s1ap_register_eNB->default_drx = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[0]; - - s1ap_register_eNB->nb_mme = enb_properties->properties[enb_id]->nb_mme; - AssertFatal (s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, "Too many MME for eNB %d (%d/%d)!", enb_id, s1ap_register_eNB->nb_mme, - S1AP_MAX_NB_MME_IP_ADDRESS); - - for (mme_id = 0; mme_id < s1ap_register_eNB->nb_mme; mme_id++) { - s1ap_register_eNB->mme_ip_address[mme_id].ipv4 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4; - s1ap_register_eNB->mme_ip_address[mme_id].ipv6 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6; - strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv4_address, - enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4_address, - sizeof(s1ap_register_eNB->mme_ip_address[0].ipv4_address)); - strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv6_address, - enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6_address, - sizeof(s1ap_register_eNB->mme_ip_address[0].ipv6_address)); - } - - s1ap_register_eNB->enb_ip_address.ipv6 = 0; - s1ap_register_eNB->enb_ip_address.ipv4 = 1; - addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_S1_MME; - str = inet_ntoa(addr); - strcpy(s1ap_register_eNB->enb_ip_address.ipv4_address, str); - - itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - - register_enb_pending++; - } - } - - return register_enb_pending; -} - -//------------------------------------------------------------------------------ -static void *eNB_app_task(void *args_p) -//------------------------------------------------------------------------------ -{ - const Enb_properties_array_t *enb_properties_p = NULL; - uint32_t enb_nb = 1; /* Default number of eNB is 1 */ - uint32_t enb_id_start = 0; - uint32_t enb_id_end = enb_id_start + enb_nb; - uint32_t register_enb_pending; - uint32_t registered_enb; - long enb_register_retry_timer_id; - MessageDef *msg_p = NULL; - const char *msg_name = NULL; - instance_t instance; - int result; - - itti_mark_task_ready (TASK_ENB_APP); - - enb_properties_p = enb_config_get(); - - AssertFatal (enb_nb <= enb_properties_p->number, - "Number of eNB is greater than eNB defined in configuration file (%d/%d)!", - enb_nb, enb_properties_p->number); - - - /* Try to register each eNB */ - registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); - - do { - // Wait for a message - itti_receive_msg (TASK_ENB_APP, &msg_p); - - msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); - - switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - itti_exit_task (); - break; - - case MESSAGE_TEST: - LOG_I(ENB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); - break; - - - case S1AP_REGISTER_ENB_CNF: - LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, - S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); - - DevAssert(register_enb_pending > 0); - register_enb_pending--; - - /* Check if at least eNB is registered with one MME */ - if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) { - registered_enb++; - } - - /* Check if all register eNB requests have been processed */ - if (register_enb_pending == 0) { - if (registered_enb == enb_nb) { - mme_test_s1_start_test(instance); - - - } else { - uint32_t not_associated = enb_nb - registered_enb; - - LOG_W(ENB_APP, " %d eNB %s not associated with a MME, retrying registration in %d seconds ...\n", - not_associated, not_associated > 1 ? "are" : "is", ENB_REGISTER_RETRY_DELAY); - - /* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */ - if (timer_setup (ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - NULL, &enb_register_retry_timer_id) < 0) { - LOG_E(ENB_APP, " Can not start eNB register retry timer, use \"sleep\" instead!\n"); - - sleep(ENB_REGISTER_RETRY_DELAY); - /* Restart the registration process */ - registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); - } - } - } - - break; - - case S1AP_DEREGISTERED_ENB_IND: - LOG_W(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, - S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); - - /* TODO handle recovering of registration */ - break; - - case TIMER_HAS_EXPIRED: - LOG_I(ENB_APP, " Received %s: timer_id %d\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id); - - if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) { - /* Restart the registration process */ - registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); - } - - break; - - default: - LOG_E(ENB_APP, "Received unexpected message %s\n", msg_name); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } while (1); - - return NULL; -} - - -//------------------------------------------------------------------------------ -void mme_test_s1_start_test(instance_t instance) -//------------------------------------------------------------------------------ -{ - s1ap_eNB_itti_send_sctp_data_req(instance, - s1c_test.assoc_id, - s1ap_scenarios[s1c_test.scenario_index][s1c_test.tx_next_message_index].buffer, - s1ap_scenarios[s1c_test.scenario_index][s1c_test.tx_next_message_index].buf_len, - s1ap_scenarios[s1c_test.scenario_index][s1c_test.tx_next_message_index].sctp_stream_id); -} - - -//------------------------------------------------------------------------------ -void mme_test_s1_notify_sctp_data_ind(uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length) -//------------------------------------------------------------------------------ -{ - -} - - -//------------------------------------------------------------------------------ -int main( int argc, char **argv ) -//------------------------------------------------------------------------------ -{ - // initialize the log (see log.h for details) - logInit(); - - get_options (argc, argv); //Command-line options - set_glog(glog_level, glog_verbosity); - log_set_instance_type (LOG_INSTANCE_ENB); - - /* Read eNB configuration file */ - enb_properties = enb_config_init(conf_config_file_name); - - itti_init(TASK_MAX, tasks_info); - - itti_wait_ready(1); - - if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; - } - - if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) { - LOG_E(S1AP, "Create task for S1AP failed\n"); - return -1; - } - - if (itti_create_task (TASK_ENB_APP, eNB_app_task, NULL) < 0) { - LOG_E(S1AP, "Create task for S1AP failed\n"); - return -1; - } - - itti_wait_ready(0); - - - - sleep(30); - - logClean(); - return 0; -} diff --git a/openair3/TEST/oaisim_mme_test_s1c.h b/openair3/TEST/oaisim_mme_test_s1c.h deleted file mode 100644 index 91e4472caf..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c.h +++ /dev/null @@ -1,30 +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 - */ - -typedef struct s1c_test_s { - int scenario_index; - int tx_next_message_index; - int rx_next_message_index; - int32_t assoc_id; -}s1c_test_t; - -void mme_test_s1_start_test(instance_t instance); -void mme_test_s1_notify_sctp_data_ind(uint32_t assoc_id, int32_t stream, const uint8_t * const data, const uint32_t data_length); diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c deleted file mode 100644 index 60da125073..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c +++ /dev/null @@ -1,291 +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 - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "tree.h" -#include "queue.h" -#include "intertask_interface.h" -#include "s1ap_eNB_default_values.h" -#include "s1ap_common.h" -#include "s1ap_eNB_defs.h" -#include "s1ap_eNB_management_procedures.h" -#include "assertions.h" - -#include "platform_types.h" -#include "oaisim_mme_test_s1c.h" - - -void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) -{ - int result; - DevAssert(sctp_data_ind != NULL); - mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); - result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); -} - - -void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) -{ - MessageDef *message_p; - sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ); - sctp_data_req = &message_p->ittiMsg.sctp_data_req; - sctp_data_req->assoc_id = assoc_id; - sctp_data_req->buffer = buffer; - sctp_data_req->buffer_length = buffer_length; - sctp_data_req->stream = stream; - itti_send_msg_to_task(TASK_SCTP, instance, message_p); -} - -void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown) -{ - if (sctp_shutdown) { - /* A previously connected MME has been shutdown */ - - /* TODO check if it was used by some eNB and send a message to inform these eNB if there is no more associated MME */ - if (mme_desc_p->state == S1AP_ENB_STATE_CONNECTED) { - mme_desc_p->state = S1AP_ENB_STATE_DISCONNECTED; - - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb > 0) { - /* Decrease associated MME number */ - mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb --; - } - - /* If there are no more associated MME, inform eNB app */ - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); - S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; - itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); - } - } - } else { - /* Check that at least one setup message is pending */ - DevCheck(mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb > 0, mme_desc_p->s1ap_eNB_instance->instance, - mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb, 0); - - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb > 0) { - /* Decrease pending messages number */ - mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb --; - } - - /* If there are no more pending messages, inform eNB app */ - if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); - S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; - itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); - } - } -} - -void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) -{ - s1ap_eNB_instance_t *instance_p; - s1ap_eNB_mme_data_t *s1ap_mme_data_p; - DevAssert(sctp_new_association_resp != NULL); - instance_p = s1ap_eNB_get_instance(instance); - DevAssert(instance_p != NULL); - s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1, - sctp_new_association_resp->ulp_cnx_id); - DevAssert(s1ap_mme_data_p != NULL); - - if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; - } - - /* Update parameters */ - s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; - s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; - s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - /* Prepare new S1 Setup Request */ - mme_test_s1_start_test(instance_p, s1ap_mme_data_p); -} - -void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr) -{ - MessageDef *message_p = NULL; - sctp_new_association_req_t *sctp_new_association_req_p = NULL; - s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - DevAssert(instance_p != NULL); - DevAssert(mme_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; - sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - memcpy(&sctp_new_association_req_p->remote_address, - mme_ip_address, - sizeof(*mme_ip_address)); - memcpy(&sctp_new_association_req_p->local_address, - local_ip_addr, - sizeof(*local_ip_addr)); - /* Create new MME descriptor */ - s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); - DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id(); - sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - s1ap_mme_data_p->assoc_id = -1; - s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME - * but not yet associated. - */ - RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p); - s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; - instance_p->s1ap_mme_nb ++; - instance_p->s1ap_mme_pending_nb ++; - itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); -} - - - -void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB) -{ - s1ap_eNB_instance_t *new_instance; - uint8_t index; - DevAssert(s1ap_register_eNB != NULL); - /* Look if the provided instance already exists */ - new_instance = s1ap_eNB_get_instance(instance); - - if (new_instance != NULL) { - /* Checks if it is a retry on the same eNB */ - DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0); - DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0); - DevCheck(new_instance->tac == s1ap_register_eNB->tac, new_instance->tac, s1ap_register_eNB->tac, 0); - DevCheck(new_instance->mcc == s1ap_register_eNB->mcc, new_instance->mcc, s1ap_register_eNB->mcc, 0); - DevCheck(new_instance->mnc == s1ap_register_eNB->mnc, new_instance->mnc, s1ap_register_eNB->mnc, 0); - DevCheck(new_instance->mnc_digit_length == s1ap_register_eNB->mnc_digit_length, new_instance->mnc_digit_length, s1ap_register_eNB->mnc_digit_length, 0); - DevCheck(new_instance->default_drx == s1ap_register_eNB->default_drx, new_instance->default_drx, s1ap_register_eNB->default_drx, 0); - } else { - new_instance = calloc(1, sizeof(s1ap_eNB_instance_t)); - DevAssert(new_instance != NULL); - RB_INIT(&new_instance->s1ap_ue_head); - RB_INIT(&new_instance->s1ap_mme_head); - /* Copy usefull parameters */ - new_instance->instance = instance; - new_instance->eNB_name = s1ap_register_eNB->eNB_name; - new_instance->eNB_id = s1ap_register_eNB->eNB_id; - new_instance->cell_type = s1ap_register_eNB->cell_type; - new_instance->tac = s1ap_register_eNB->tac; - new_instance->mcc = s1ap_register_eNB->mcc; - new_instance->mnc = s1ap_register_eNB->mnc; - new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length; - new_instance->default_drx = s1ap_register_eNB->default_drx; - /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ - s1ap_eNB_insert_new_instance(new_instance); - S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n", - instance, - s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", - s1ap_register_eNB->eNB_id); - } - - DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, - S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0); - - /* Trying to connect to provided list of MME ip address */ - for (index = 0; index < s1ap_register_eNB->nb_mme; index++) { - s1ap_eNB_register_mme(new_instance, &s1ap_register_eNB->mme_ip_address[index], - &s1ap_register_eNB->enb_ip_address); - } -} - - - - -void *s1ap_eNB_task(void *arg) -{ - MessageDef *received_msg = NULL; - int result; - S1AP_DEBUG("Starting S1AP layer\n"); - s1ap_eNB_prepare_internal_data(); - itti_mark_task_ready(TASK_S1AP); - - while (1) { - itti_receive_msg(TASK_S1AP, &received_msg); - - switch (ITTI_MSG_ID(received_msg)) { - case TERMINATE_MESSAGE: - itti_exit_task(); - break; - - case S1AP_REGISTER_ENB_REQ: { - /* Register a new eNB. - * in Virtual mode eNBs will be distinguished using the mod_id/ - * Each eNB has to send an S1AP_REGISTER_ENB message with its - * own parameters. - */ - s1ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &S1AP_REGISTER_ENB_REQ(received_msg)); - } - break; - - case SCTP_NEW_ASSOCIATION_RESP: { - s1ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - } - break; - - case SCTP_DATA_IND: { - s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - } - break; - - default: - S1AP_ERROR("Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; - } - - return NULL; -} diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.h b/openair3/TEST/oaisim_mme_test_s1c_s1ap.h deleted file mode 100644 index 4faec0e66e..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.h +++ /dev/null @@ -1,60 +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 - */ - -#ifndef __TEST_OAISIM_MME_TEST_S1C_S1AP__H__ -#define __TEST_OAISIM_MME_TEST_S1C_S1AP__H__ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind); - -void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); - -void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); - -void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); - -void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr, - uint16_t in_streams, - uint16_t out_streams); -void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB); -void *s1ap_eNB_task(void *arg); - -#endif diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario.c b/openair3/TEST/oaisim_mme_test_s1c_scenario.c deleted file mode 100644 index 60d74866c8..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c_scenario.c +++ /dev/null @@ -1,279 +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 - */ - -#include -#include -#include -#include - -#include "oaisim_mme_test_s1c_scenario.h" - -int scenario_index = 0; -int scenario_message_index = 0; -int debug = 0; -int error_count = 0; -int break_on_error = 0; - - -extern s1ap_message_test_t s1ap_scenario1[]; - -s1ap_message_test_t s1ap_scenarios[][] = {s1ap_scenario1}; - -/* -1 means invalid */ -static const signed char hex_digits[0x100] = { - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, - -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -}; - -//------------------------------------------------------------------------------ -void -fail (const char *format, ...) -//------------------------------------------------------------------------------ -{ - char str[1024]; - va_list arg_ptr; - - va_start (arg_ptr, format); - vsnprintf ( str, sizeof(str), format, arg_ptr); - va_end (arg_ptr); - fputs(str, stderr); - error_count++; - - if (break_on_error) - exit (1); -} - -//------------------------------------------------------------------------------ -void -success (const char *format, ...) -//------------------------------------------------------------------------------ -{ - char str[1024]; - va_list arg_ptr; - - va_start (arg_ptr, format); - vsnprintf ( str, sizeof(str), format, arg_ptr); - va_end (arg_ptr); - fputs(str, stderr); -} - -//------------------------------------------------------------------------------ -void -escapeprint (const char *str, size_t len) -//------------------------------------------------------------------------------ -{ - size_t i; - - printf (" (length %d bytes):\n\t", (int) len); - - for (i = 0; i < len; i++) { - if (((str[i] & 0xFF) >= 'A' && (str[i] & 0xFF) <= 'Z') || - ((str[i] & 0xFF) >= 'a' && (str[i] & 0xFF) <= 'z') || - ((str[i] & 0xFF) >= '0' && (str[i] & 0xFF) <= '9') - || (str[i] & 0xFF) == ' ' || (str[i] & 0xFF) == '.') - printf ("%c", (str[i] & 0xFF)); - else - printf ("\\x%02X", (str[i] & 0xFF)); - - if ((i + 1) % 16 == 0 && (i + 1) < len) - printf ("'\n\t'"); - } - - printf ("\n"); -} - -//------------------------------------------------------------------------------ -void -hexprint (const void *_str, size_t len) -//------------------------------------------------------------------------------ -{ - size_t i; - const char* str = _str; - - printf ("\t;; "); - - for (i = 0; i < len; i++) { - printf ("%02x ", (str[i] & 0xFF)); - - if ((i + 1) % 8 == 0) - printf (" "); - - if ((i + 1) % 16 == 0 && i + 1 < len) - printf ("\n\t;; "); - } - - printf ("\n"); -} - -//------------------------------------------------------------------------------ -void -binprint (const void *_str, size_t len) -//------------------------------------------------------------------------------ -{ - size_t i; - const char* str = _str; - - printf ("\t;; "); - - for (i = 0; i < len; i++) { - printf ("%d%d%d%d%d%d%d%d ", - (str[i] & 0xFF) & 0x80 ? 1 : 0, - (str[i] & 0xFF) & 0x40 ? 1 : 0, - (str[i] & 0xFF) & 0x20 ? 1 : 0, - (str[i] & 0xFF) & 0x10 ? 1 : 0, - (str[i] & 0xFF) & 0x08 ? 1 : 0, - (str[i] & 0xFF) & 0x04 ? 1 : 0, - (str[i] & 0xFF) & 0x02 ? 1 : 0, (str[i] & 0xFF) & 0x01 ? 1 : 0); - - if ((i + 1) % 3 == 0) - printf (" "); - - if ((i + 1) % 6 == 0 && i + 1 < len) - printf ("\n\t;; "); - } - - printf ("\n"); -} - -//------------------------------------------------------------------------------ -int -compare_buffer(const uint8_t *buffer, const uint32_t length_buffer, - const uint8_t *pattern, const uint32_t length_pattern) -//------------------------------------------------------------------------------ -{ - int i; - - if (length_buffer != length_pattern) { - printf("Length mismatch, expecting %d bytes, got %d bytes\n", length_pattern, - length_buffer); - hexprint(buffer, length_buffer); - return -1; - } - - for (i = 0; i < length_buffer; i++) { - if (pattern[i] != buffer[i]) { - printf("Expecting:\n"); - hexprint(pattern, length_pattern); - printf("Received:\n"); - hexprint(buffer, length_buffer); - printf("Mismatch fount in byte %d\nExpecting 0x%02x, got 0x%02x\n", - i, pattern[i], buffer[i]); - return -1; - } - } - - return 0; -} - -//------------------------------------------------------------------------------ -unsigned -decode_hex_length(const char *h) -//------------------------------------------------------------------------------ -{ - const unsigned char *hex = (const unsigned char *) h; - unsigned count; - unsigned i; - - for (count = i = 0; hex[i]; i++) { - if (isspace(hex[i])) - continue; - - if (hex_digits[hex[i]] < 0) - abort(); - - count++; - } - - if (count % 2) - abort(); - - return count / 2; -} - -//------------------------------------------------------------------------------ -int -decode_hex(uint8_t *dst, const char *h) -//------------------------------------------------------------------------------ -{ - const unsigned char *hex = (const unsigned char *) h; - unsigned i = 0; - - for (;;) { - int high, low; - - while (*hex && isspace(*hex)) - hex++; - - if (!*hex) - return 1; - - high = hex_digits[*hex++]; - - if (high < 0) - return 0; - - while (*hex && isspace(*hex)) - hex++; - - if (!*hex) - return 0; - - low = hex_digits[*hex++]; - - if (low < 0) - return 0; - - dst[i++] = (high << 4) | low; - } -} - -//------------------------------------------------------------------------------ -uint8_t * -decode_hex_dup(const char *hex) -//------------------------------------------------------------------------------ -{ - uint8_t *p; - unsigned length = decode_hex_length(hex); - - p = malloc(length * sizeof(uint8_t)); - - if (decode_hex(p, hex)) - return p; - else { - free(p); - return NULL; - } -} - diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario.h b/openair3/TEST/oaisim_mme_test_s1c_scenario.h deleted file mode 100644 index 8b9a8dd54a..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c_scenario.h +++ /dev/null @@ -1,56 +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 - */ - -#ifndef __TEST_OAISIM_MME_TEST_S1C_SCENARIO__H__ -#define __TEST_OAISIM_MME_TEST_S1C_SCENARIO__H__ - -#include -#include - -#define MME_TEST_S1_MAX_BUF_LENGTH (1024) -#define MME_TEST_S1_MAX_BYTES_TEST (32) - -typedef enum entity_s{ - MME, - ENB -} entity_t; - -typedef struct s1ap_message_test_s{ - char *procedure_name; - uint8_t buffer[MME_TEST_S1_MAX_BUF_LENGTH]; - uint16_t dont_check[MME_TEST_S1_MAX_BYTES_TEST]; // bytes index test that can be omitted - uint32_t buf_len; - entity_t originating; - uint16_t sctp_stream_id; - uint32_t assoc_id; -} s1ap_message_test_t; - -void fail (const char *format, ...); -void success (const char *format, ...); -void escapeprint (const char *str, size_t len); -void hexprint (const void *_str, size_t len); -void binprint (const void *_str, size_t len); -int compare_buffer(const uint8_t *buffer, const uint32_t length_buffer, const uint8_t *pattern, const uint32_t length_pattern); -unsigned decode_hex_length(const char *h); -int decode_hex(uint8_t *dst, const char *h); -uint8_t *decode_hex_dup(const char *hex); - -#endif diff --git a/openair3/TEST/oaisim_mme_test_s1c_scenario1.c b/openair3/TEST/oaisim_mme_test_s1c_scenario1.c deleted file mode 100644 index 87a63b876a..0000000000 --- a/openair3/TEST/oaisim_mme_test_s1c_scenario1.c +++ /dev/null @@ -1,181 +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 - */ - -#include -#include "oaisim_mme_test_s1c_scenario.h" - - -// Description succesfull attach of UE, release UE. - -s1ap_message_test_t s1ap_scenario1[] = { - { - .procedure_name = "id-initialUEMessage", - .buffer = { - 0x00, 0x0C, - 0x00, 0x5C, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x04, 0x80, 0x06, 0x69, 0x2D, 0x00, 0x1A, 0x00, - 0x32, 0x31, 0x07, 0x41, 0x71, 0x08, 0x29, 0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0xE0, - 0xE0, 0x00, 0x20, 0x02, 0x01, 0xD0, 0x11, 0x27, 0x1A, 0x80, 0x80, 0x21, 0x10, 0x01, 0x00, 0x00, - 0x10, 0x81, 0x06, 0x00, 0x00, 0x00, 0x00, 0x83, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, - 0x00, 0x0A, 0x00, 0x00, 0x43, 0x00, 0x06, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x01, 0x00, 0x64, 0x40, - 0x08, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x86, 0x40, 0x01, 0x30 - }, - .dont_check = { - -1 - }, - .buf_len = 96, - .sctp_stream_id = 1, - .originating = ENB, - }, - { - .procedure_name = "id-downlinkNASTransport, Authentication request", - .buffer = { - 0x00, 0x0B, - 0x00, 0x3D, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xC0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, - 0x00, 0x04, 0x80, 0x06, 0x69, 0x2D, 0x00, 0x1A, 0x00, 0x25, 0x24, 0x07, 0x52, 0x00, 0xD3, 0xB5, - 0xF0, 0x89, 0x68, 0x02, 0x66, 0x5A, 0x08, 0xE6, 0x51, 0xC7, 0x29, 0x6B, 0x4D, 0xA0, 0x10, 0xDD, - 0x04, 0x53, 0xC8, 0x3F, 0x94, 0x80, 0x00, 0x03, 0xAF, 0x2F, 0x49, 0xF3, 0xC8, 0x38, 0x90, 0x00, - 0x00, 0x00 - }, - .dont_check = { - -1 - }, - .buf_len = 65, - .sctp_stream_id = 1, - .originating = MME, - }, - { - .procedure_name = "id-uplinkNASTransport, 0xAuthentication response", - .buffer = { - 0x00, 0x0d, - 0x40, 0x3a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, - 0x00, 0x04, 0x80, 0x06, 0x69, 0x2d, 0x00, 0x1a, 0x00, 0x0C, 0x0b, 0x07, 0x53, 0x08, 0x11, 0x82, - 0x98, 0x98, 0x3b, 0xca, 0xF2, 0x97, 0x00, 0x64, 0x40, 0x08, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x00, - 0xe0, 0x00, 0x00, 0x43, 0x40, 0x06, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x01, 0x00, 0x00 - }, - .dont_check = { - -1 - }, - .buf_len = 62, - .sctp_stream_id = 1, - .originating = ENB, - }, - { - .procedure_name = "id-downlinkNASTransport, Security mode command", - .buffer = { - 0x00, 0x0b, - 0x00, 0x26, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, - 0x00, 0x04, 0x80, 0x06, 0x69, 0x2d, 0x00, 0x1a, 0x00, 0x0e, 0x0d, 0x37, 0xFC, 0xc1, 0xda, 0xd9, - 0x00, 0x07, 0x5d, 0x02, 0x00, 0x02, 0xe0, 0xe0, 0x00, 0x00 - }, - .dont_check = { - -1 - }, - .buf_len = 42, - .sctp_stream_id = 1, - .originating = MME, - }, - { - .procedure_name = "id-uplinkNASTransport, Security mode complete", - .buffer = { - 0x00, 0x0d, - 0x40, 0x37, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, - 0x00, 0x04, 0x80, 0x06, 0x69, 0x2d, 0x00, 0x1a, 0x00, 0x09, 0x08, 0x47, 0x1d, 0xd0, 0xbb, 0xad, - 0x00, 0x07, 0x5e, 0x00, 0x64, 0x40, 0x08, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x00, 0xe0, 0x00, 0x00, - 0x43, 0x40, 0x06, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x01, 0x00 - }, - .dont_check = { - -1 - }, - .buf_len = 59, - .sctp_stream_id = 1, - .originating = ENB, - }, - { - .procedure_name = "id-InitialContextSetup, InitialContextSetupRequest , Attach accept, Activate default EPS bearer context request", - .buffer = { - 0x00, 0x09, - 0x00, 0x80, 0xba, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, - 0x08, 0x00, 0x04, 0x80, 0x06, 0x69, 0x2d, 0x00, 0x42, 0x00, 0x0a, 0x18, 0x05, 0xF5, 0xe1, 0x00, - 0x60, 0x02, 0xFa, 0xF0, 0x80, 0x00, 0x18, 0x00, 0x67, 0x00, 0x00, 0x34, 0x00, 0x62, 0x45, 0x00, - 0x09, 0x04, 0x0f, 0x80, 0x7f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x53, 0x27, 0x8b, 0xe6, - 0x60, 0xb5, 0x01, 0x07, 0x42, 0x01, 0x4a, 0x06, 0x20, 0x02, 0xF8, 0x39, 0x00, 0x01, 0x00, 0x31, - 0x52, 0x01, 0xc1, 0x01, 0x09, 0x09, 0x03, 0x6f, 0x61, 0x69, 0x04, 0x69, 0x70, 0x76, 0x34, 0x05, - 0x01, 0xc0, 0xbb, 0x00, 0x02, 0x5e, 0x04, 0xFe, 0xFe, 0xde, 0x9e, 0x27, 0x14, 0x80, 0x80, 0x21, - 0x10, 0x03, 0x00, 0x00, 0x10, 0x81, 0x06, 0xc0, 0xa8, 0x0C, 0x64, 0x83, 0x06, 0xc0, 0xa8, 0x6a, - 0x0C, 0x50, 0x0b, 0xF6, 0x02, 0xF8, 0x39, 0x80, 0x00, 0x01, 0x78, 0x00, 0x0C, 0x20, 0x17, 0x2C, - 0x00, 0x6b, 0x00, 0x05, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x20, 0xFa, 0x59, 0x15, - 0x4e, 0x32, 0x95, 0x04, 0x2d, 0x35, 0xa4, 0x47, 0xc3, 0x80, 0xab, 0x63, 0xd8, 0xe6, 0x91, 0x83, - 0x6C, 0x9a, 0xF0, 0xed, 0x85, 0x38, 0xa8, 0x27, 0x41, 0x6b, 0x2b, 0x64, 0x86, 0x00 - }, - .dont_check = { - -1 - }, - .buf_len = 191, - .sctp_stream_id = 1, - .originating = MME, - }, - { - .procedure_name = "id-UECapabilityInfoIndication", - .buffer = { - 0x00, 0x16, - 0x40, 0x2C, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, - 0x00, 0x04, 0x80, 0x06, 0x69, 0x2d, 0x00, 0x4a, 0x40, 0x14, 0x13, 0x81, 0x20, 0x00, 0x03, 0x00, - 0x10, 0x60, 0xe0, 0xc1, 0xF8, 0x3f, 0x07, 0xe0 ,0xfd, 0x78, 0x37, 0x62, 0x00, 0x00 - }, - .dont_check = { - -1 - }, - .buf_len = 48, - .originating = ENB, - }, - { - .procedure_name = "id-InitialContextSetup, InitialContextSetupResponse ", - .buffer = { - 0x20, 0x09, - 0x00, 0x27, 0x00, 0x00, 0x03, 0x00, 0x00, 0x40, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, - 0x40, 0x04, 0x80, 0x06, 0x69, 0x2d, 0x00, 0x33, 0x40, 0x0f, 0x00, 0x00, 0x32, 0x40, 0x0a, 0x0a, - 0x1f, 0x7f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01 - }, - .dont_check = { - -1 - }, - .buf_len = 64, - .sctp_stream_id = 1, - .originating = ENB, - }, - { - .procedure_name = "id-uplinkNASTransport, Attach complete, Activate default EPS bearer context accept", - .buffer = { - - 0x00, 0x0d, - 0x05, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x80, 0x00, 0x15, 0x20, 0x00, 0x08, 0x00, 0x04, 0x80, 0x06, - 0x69, 0x2d, 0x00, 0x1a, 0x00, 0x0e, 0x0d, 0x27, 0xc7, 0x8f, 0x5a, 0xd2, 0x01, 0x07, 0x43, 0x00, - 0x03, 0x52, 0x00, 0xc2, 0x00, 0x64, 0x40, 0x08, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x00, 0xe0, 0x00, - 0x00, 0x43, 0x40, 0x06, 0x00, 0x02, 0xF8, 0x39, 0x00, 0x01 - }, - .dont_check = { - -1 - }, - .buf_len = 64, - .sctp_stream_id = 1, - .originating = ENB, - } -}; diff --git a/openair3/UDP/udp_eNB_task.c b/openair3/UDP/udp_eNB_task.c deleted file mode 100644 index 8b9fc77bb1..0000000000 --- a/openair3/UDP/udp_eNB_task.c +++ /dev/null @@ -1,447 +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 udp_eNB_task.c -* \brief -* \author Sebastien ROUX, Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "queue.h" -#include "intertask_interface.h" -#include "assertions.h" -#include "udp_eNB_task.h" - -#include "common/utils/LOG/log.h" -#include "common/utils/LOG/vcd_signal_dumper.h" -#include "msc.h" - - -#define IPV4_ADDR "%u.%u.%u.%u" -#define IPV4_ADDR_FORMAT(aDDRESS) \ - (uint8_t)((aDDRESS) & 0x000000ff), \ - (uint8_t)(((aDDRESS) & 0x0000ff00) >> 8 ), \ - (uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \ - (uint8_t)(((aDDRESS) & 0xff000000) >> 24) - - -struct udp_socket_desc_s { - int sd; /* Socket descriptor to use */ - - pthread_t listener_thread; /* Thread affected to recv */ - - char *local_address; /* Local ipv4 address to use */ - uint16_t local_port; /* Local port to use */ - - task_id_t task_id; /* Task who has requested the new endpoint */ - - STAILQ_ENTRY(udp_socket_desc_s) entries; -}; - -static STAILQ_HEAD(udp_socket_list_s, udp_socket_desc_s) udp_socket_list; -static pthread_mutex_t udp_socket_list_mutex = PTHREAD_MUTEX_INITIALIZER; - - -static -struct udp_socket_desc_s * -udp_eNB_get_socket_desc(task_id_t task_id); - -void udp_eNB_process_file_descriptors( - struct epoll_event *events, - int nb_events); - -static -int -udp_eNB_create_socket( - int port, - char *ip_addr, - task_id_t task_id); - -int -udp_eNB_send_to( - int sd, - uint16_t port, - uint32_t address, - const uint8_t *buffer, - uint32_t length); - -void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP); - -void *udp_eNB_task(void *args_p); - -int udp_enb_init(void); -/* @brief Retrieve the descriptor associated with the task_id - */ -static -struct udp_socket_desc_s *udp_eNB_get_socket_desc(task_id_t task_id) -{ - struct udp_socket_desc_s *udp_sock_p = NULL; - -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_T(UDP_, "Looking for task %d\n", task_id); -#endif - - STAILQ_FOREACH(udp_sock_p, &udp_socket_list, entries) { - if (udp_sock_p->task_id == task_id) { -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_T(UDP_, "Found matching task desc\n"); -#endif - break; - } - } - return udp_sock_p; -} - -void udp_eNB_process_file_descriptors(struct epoll_event *events, int nb_events) -{ - int i; - struct udp_socket_desc_s *udp_sock_p = NULL; - - if (events == NULL) { - return; - } - - for (i = 0; i < nb_events; i++) { - STAILQ_FOREACH(udp_sock_p, &udp_socket_list, entries) { - if (udp_sock_p->sd == events[i].data.fd) { -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_D(UDP_, "Found matching task desc\n"); -#endif - udp_eNB_receiver(udp_sock_p); - break; - } - } - } -} - -static -int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id) -{ - - struct udp_socket_desc_s *udp_socket_desc_p = NULL; - int sd, rc; - struct sockaddr_in sin; - - LOG_I(UDP_, "Initializing UDP for local address %s with port %d\n", ip_addr, port); - - sd = socket(AF_INET, SOCK_DGRAM, 0); - AssertFatal(sd > 0, "UDP: Failed to create new socket: (%s:%d)\n", strerror(errno), errno); - - memset(&sin, 0, sizeof(struct sockaddr_in)); - sin.sin_family = AF_INET; - sin.sin_port = htons(port); - - if (ip_addr == NULL) { - sin.sin_addr.s_addr = inet_addr(INADDR_ANY); - } else { - sin.sin_addr.s_addr = inet_addr(ip_addr); - } - - if ((rc = bind(sd, (struct sockaddr *)&sin, sizeof(struct sockaddr_in))) < 0) { - close(sd); - LOG_E(UDP_, "Failed to bind socket: (%s:%d) address %s port %d\n", strerror(errno), errno, ip_addr, port); - return -1; - } - - /* Create a new descriptor for this connection */ - udp_socket_desc_p = calloc(1, sizeof(struct udp_socket_desc_s)); - - DevAssert(udp_socket_desc_p != NULL); - - udp_socket_desc_p->sd = sd; - udp_socket_desc_p->local_address = ip_addr; - udp_socket_desc_p->local_port = port; - udp_socket_desc_p->task_id = task_id; - - LOG_I(UDP_, "Inserting new descriptor for task %d, sd %d\n", udp_socket_desc_p->task_id, udp_socket_desc_p->sd); - pthread_mutex_lock(&udp_socket_list_mutex); - STAILQ_INSERT_TAIL(&udp_socket_list, udp_socket_desc_p, entries); - pthread_mutex_unlock(&udp_socket_list_mutex); - - itti_subscribe_event_fd(TASK_UDP, sd); - LOG_I(UDP_, "Initializing UDP for local address %s with port %d: DONE\n", ip_addr, port); - return sd; -} - -int -udp_eNB_send_to( - int sd, - uint16_t port, - uint32_t address, - const uint8_t *buffer, - uint32_t length) -{ - struct sockaddr_in to; - socklen_t to_length; - - if (sd <= 0 || ((buffer == NULL) && (length > 0))) { - LOG_E(UDP_, "udp_send_to: bad param\n"); - return -1; - } - - memset(&to, 0, sizeof(struct sockaddr_in)); - to_length = sizeof(to); - - to.sin_family = AF_INET; - to.sin_port = htons(port); - to.sin_addr.s_addr = address; - - if (sendto(sd, (void *)buffer, (size_t)length, 0, (struct sockaddr *)&to, - to_length) < 0) { - LOG_E(UDP_, - "[SD %d] Failed to send data to "IPV4_ADDR" on port %d, buffer size %u\n", - sd, IPV4_ADDR_FORMAT(address), port, length); - return -1; - } - -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_I(UDP_, "[SD %d] Successfully sent to "IPV4_ADDR - " on port %d, buffer size %u, buffer address %x\n", - sd, IPV4_ADDR_FORMAT(address), port, length, buffer); -#endif - return 0; -} - - -void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP) -{ - uint8_t l_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE]; - int n; - socklen_t from_len; - struct sockaddr_in addr; - MessageDef *message_p = NULL; - udp_data_ind_t *udp_data_ind_p = NULL; - uint8_t *forwarded_buffer = NULL; - - if (1) { - from_len = (socklen_t)sizeof(struct sockaddr_in); - - if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), MSG_TRUNC, - (struct sockaddr *)&addr, &from_len)) < 0) { - LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno)); - return; - } else if (n > sizeof(l_buffer)) { - LOG_E(UDP_, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, n); - return; - } else if (n == 0) { - LOG_W(UDP_, "Recvfrom returned 0\n"); - return; - } else { - forwarded_buffer = itti_malloc(TASK_UDP, udp_sock_pP->task_id, n*sizeof(uint8_t)); - DevAssert(forwarded_buffer != NULL); - memcpy(forwarded_buffer, l_buffer, n); - message_p = itti_alloc_new_message(TASK_UDP, 0, UDP_DATA_IND); - DevAssert(message_p != NULL); - udp_data_ind_p = &message_p->ittiMsg.udp_data_ind; - udp_data_ind_p->buffer = forwarded_buffer; - udp_data_ind_p->buffer_length = n; - udp_data_ind_p->peer_port = htons(addr.sin_port); - udp_data_ind_p->peer_address = addr.sin_addr.s_addr; - -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_I(UDP_, "Msg of length %d received from %s:%u\n", - n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); -#endif - - /* TODO: this is a hack. Let's accept failures and do nothing when - * it happens. Since itti_send_msg_to_task crashes when the message - * queue is full we wrote itti_try_send_msg_to_task that returns -1 - * if the queue is full. - */ - /* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */ - if (itti_send_msg_to_task(udp_sock_pP->task_id, INSTANCE_DEFAULT, message_p) < 0) { - LOG_E(UDP_, "Failed to send message %d to task %d\n", - UDP_DATA_IND, - udp_sock_pP->task_id); - itti_free(TASK_UDP, message_p); - itti_free(TASK_UDP, forwarded_buffer); - return; - } - } - } - - //close(udp_sock_p->sd); - //udp_sock_p->sd = -1; - - //pthread_mutex_lock(&udp_socket_list_mutex); - //STAILQ_REMOVE(&udp_socket_list, udp_sock_p, udp_socket_desc_s, entries); - //pthread_mutex_unlock(&udp_socket_list_mutex); -} - - -void *udp_eNB_task(void *args_p) -{ - int nb_events; - struct epoll_event *events; - MessageDef *received_message_p = NULL; - //const char *msg_name = NULL; - //instance_t instance = 0; - udp_enb_init(); - - itti_mark_task_ready(TASK_UDP); - MSC_START_USE(); - - while(1) { - itti_receive_msg(TASK_UDP, &received_message_p); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK, VCD_FUNCTION_IN); -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_D(UDP_, "Got message %p\n", &received_message_p); -#endif - - if (received_message_p != NULL) { - - //msg_name = ITTI_MSG_NAME (received_message_p); - //instance = ITTI_MSG_DESTINATION_INSTANCE (received_message_p); - - switch (ITTI_MSG_ID(received_message_p)) { - case UDP_INIT: { - LOG_D(UDP_, "Received UDP_INIT\n"); - udp_init_t *udp_init_p; - udp_init_p = &received_message_p->ittiMsg.udp_init; - udp_eNB_create_socket( - udp_init_p->port, - udp_init_p->address, - ITTI_MSG_ORIGIN_ID(received_message_p)); - } - break; - - case UDP_DATA_REQ: { -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_D(UDP_, "Received UDP_DATA_REQ\n"); -#endif - int udp_sd = -1; - ssize_t bytes_written; - - struct udp_socket_desc_s *udp_sock_p = NULL; - udp_data_req_t *udp_data_req_p; - struct sockaddr_in peer_addr; - - udp_data_req_p = &received_message_p->ittiMsg.udp_data_req; - - memset(&peer_addr, 0, sizeof(struct sockaddr_in)); - - peer_addr.sin_family = AF_INET; - peer_addr.sin_port = htons(udp_data_req_p->peer_port); - peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address; - - pthread_mutex_lock(&udp_socket_list_mutex); - udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p)); - - if (udp_sock_p == NULL) { - LOG_E(UDP_, - "Failed to retrieve the udp socket descriptor " - "associated with task %d\n", - ITTI_MSG_ORIGIN_ID(received_message_p)); - pthread_mutex_unlock(&udp_socket_list_mutex); - - if (udp_data_req_p->buffer) { - itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer); - } - - goto on_error; - } - - udp_sd = udp_sock_p->sd; - pthread_mutex_unlock(&udp_socket_list_mutex); - -//#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_D(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n", - udp_sd, - udp_data_req_p->buffer_length, - IPV4_ADDR_FORMAT(udp_data_req_p->peer_address), - udp_data_req_p->peer_port); -//#endif - bytes_written = sendto( - udp_sd, - &udp_data_req_p->buffer[udp_data_req_p->buffer_offset], - udp_data_req_p->buffer_length, - 0, - (struct sockaddr *)&peer_addr, - sizeof(struct sockaddr_in)); - - if (bytes_written != udp_data_req_p->buffer_length) { - LOG_E(UDP_, "There was an error while writing to socket %d rc %zd" - "(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)\n", - udp_sd, bytes_written, errno, strerror(errno)); - } - - itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_req_p->buffer); - } - break; - - case TERMINATE_MESSAGE: { - LOG_W(UDP_, " *** Exiting UDP thread\n"); - itti_exit_task(); - } - break; - - case MESSAGE_TEST: { - } break; - - default: { - LOG_W(UDP_, "Unkwnon message ID %d:%s\n", - ITTI_MSG_ID(received_message_p), - ITTI_MSG_NAME(received_message_p)); - } - break; - } - -on_error: - itti_free (ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); - received_message_p = NULL; - } - - nb_events = itti_get_events(TASK_UDP, &events); - - /* Now handle notifications for other sockets */ - if (nb_events > 0) { -#if defined(LOG_UDP) && LOG_UDP > 0 - LOG_D(UDP_, "UDP task Process %d events\n",nb_events); -#endif - udp_eNB_process_file_descriptors(events, nb_events); - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK, VCD_FUNCTION_OUT); - } - - LOG_I(UDP_, "Task UDP eNB exiting\n"); - return NULL; -} - -int udp_enb_init(void) -{ - LOG_I(UDP_, "Initializing UDP task interface\n"); - STAILQ_INIT(&udp_socket_list); - LOG_I(UDP_, "Initializing UDP task interface: DONE\n"); - return 0; -} diff --git a/openair3/UDP/udp_eNB_task.h b/openair3/UDP/udp_eNB_task.h deleted file mode 100644 index 8b783f7455..0000000000 --- a/openair3/UDP/udp_eNB_task.h +++ /dev/null @@ -1,97 +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 udp_eNB_task.h -* \brief -* \author Sebastien ROUX, Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ -#include -#include - -#ifndef UDP_ENB_TASK_H_ -#define UDP_ENB_TASK_H_ -#include "enb_config.h" - - -/** \brief UDP recv callback prototype. Will be called every time a payload is - * received on socket. - * \param port Port on which data had been received - * \param address Sender Ipv4 address - * \param buffer Pointer to data (should be freed by user) - * \param length Length of message received - * \param arg_p User provided argument (transparent for wrappers) - * @returns Execution result - */ -typedef int (*udp_recv_callback)(uint16_t port, - uint32_t address, - uint8_t *buffer, - uint32_t length, - void *arg_p); - -typedef struct { - int sd; /* Socket descriptor to use */ - pthread_t listener_thread; /* Thread affected to recv */ - char *local_address; /* Local ipv4 address to use */ - uint16_t local_port; /* Local port to use */ - task_id_t task_id; /* Task who has requested the new endpoint */ -} udp_data_t; - -/** \brief Create new datagram connection-less socket and create new thread - * for data in downstream. - * \param ip_addr Local IPv4 address to use - * \param port Local port to use - * \param udp_data_p - * \param recv_callback Pointer to data (should be freed by user) - * \param arg_p Optionnal argument to pass to recv_callback - * @returns < 0 on failure or socket descriptor on success - */ -int udp_create_connection(char *ip_addr, uint16_t port, - udp_data_t *udp_data_p, - udp_recv_callback recv_callback, - void *arg_p); - -/** \brief Send buffer to remote peer. - * \param sd socket descriptor to use - * \param port remote port - * \param address remote address - * \param buffer Data buffer to send - * \param length Buffer length - * @returns < 0 on failure or socket descriptor on success - */ -int udp_send_to(int sd, uint16_t port, uint32_t address, - const uint8_t *buffer, uint32_t length); - - -/** \brief UDP ITTI task on eNB. - * \param args_p - * @returns always NULL - */ -void *udp_eNB_task(void *args_p); - -/** \brief init UDP layer. - * \param enb_config_p configuration of eNB - * @returns always 0 - */ -int udp_enb_init(void); - -#endif /* UDP_ENB_TASK_H_ */ diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 64146bc7ca..cc41de3550 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -46,7 +46,7 @@ typedef struct Gtpv1uMsgHeader { #define GTP_GPDU (255) -typedef struct ocp_gtpv1u_bearer_s { +typedef struct gtpv1u_bearer_s { /* TEID used in dl and ul */ teid_t teid_incoming; ///< eNB TEID teid_t teid_outgoing; ///< Remote TEID @@ -55,10 +55,10 @@ typedef struct ocp_gtpv1u_bearer_s { tcp_udp_port_t outgoing_port; uint16_t seqNum; uint8_t npduNum; -} ocp_gtpv1u_bearer_t; +} gtpv1u_bearer_t; typedef struct { - map bearers; + map bearers; } teidData_t; typedef struct { @@ -79,7 +79,7 @@ class gtpEndPoint { // this allow using non standard gtp port number (different from 2152) // and so, for example tu run 4G and 5G cores on one system tcp_udp_port_t get_dstport() { - return (tcp_udp_port_t)atol(addr.destinationService); + return (tcp_udp_port_t)atol(addr.destinationService); } }; @@ -106,10 +106,10 @@ instance_t legacyInstanceMapping=0; #define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) #define GTPV1U_HEADER_SIZE (8) - - - static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, int msgType, teid_t teid, uint8_t *Msg,int msgLen, - bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { + + +static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, int msgType, teid_t teid, uint8_t *Msg,int msgLen, + bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { AssertFatal(extHdrFlag==false,"Not developped"); int headerAdditional=0; @@ -149,6 +149,7 @@ instance_t legacyInstanceMapping=0; to.sin_addr.s_addr = peerIp ; LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); int ret; + if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); @@ -173,7 +174,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b return; } - map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); @@ -191,12 +192,12 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b ptr2->second.npduNum++; // copy to release the mutex - ocp_gtpv1u_bearer_t tmp=ptr2->second; + gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, - GTP_GPDU, + GTP_GPDU, tmp.teid_outgoing, buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ; } @@ -216,7 +217,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, return; } - map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); @@ -234,12 +235,12 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, ptr2->second.npduNum++; // copy to release the mutex - ocp_gtpv1u_bearer_t tmp=ptr2->second; + gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), tmp.outgoing_ip_addr, tmp.outgoing_port, - GTP_GPDU, + GTP_GPDU, tmp.teid_outgoing, buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ; } @@ -257,7 +258,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r return; } - map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); @@ -267,7 +268,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r LOG_D(GTPU,"[%ld] sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", instance, rnti, rab_id,ptr2->second.teid_outgoing); - ocp_gtpv1u_bearer_t tmp=ptr2->second; + gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); Gtpv1uMsgHeaderT msgHdr; // N should be 0 for us (it was used only in 2G and 3G) @@ -309,6 +310,7 @@ static int udpServerSocket(openAddr_s addr) { LOG_E(GTPU,"getaddrinfo error: %s\n", gai_strerror(status)); return -1; } + int sockfd=-1; // loop through all the results and bind to the first we can @@ -383,12 +385,12 @@ static int udpServerSocket(openAddr_s addr) { return sockfd; } -instance_t ocp_gtpv1Init(openAddr_t context) { +instance_t gtpv1Init(openAddr_t context) { pthread_mutex_lock(&globGtp.gtp_lock); int id=udpServerSocket(context); if (id>=0) { - itti_subscribe_event_fd(OCP_GTPV1_U, id); + itti_subscribe_event_fd(TASK_GTPV1_U, id); } else LOG_E(GTPU,"can't create GTP-U instance\n"); @@ -408,7 +410,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer return; } - map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); + map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"[%ld] Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", instance, rnti, bearer_id); @@ -447,7 +449,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer inst->te2ue_mapping[incoming_teid].callBack=callBack; - ocp_gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; + gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; int addrs_length_in_bytes = remoteAddr.length / 8; @@ -487,21 +489,21 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer return incoming_teid; } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { +int gtpv1u_create_s1u_tunnel(instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); tcp_udp_port_t dstport=globGtp.instances[compatInst(instance)].get_dstport(); + for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { AssertFatal(create_tunnel_req->eps_bearer_id[i] > 4, "From legacy code not clear, seems impossible (bearer=%d)\n", create_tunnel_req->eps_bearer_id[i]); int incoming_rb_id=create_tunnel_req->eps_bearer_id[i]-4; - teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, incoming_rb_id, create_tunnel_req->eps_bearer_id[i], @@ -521,7 +523,7 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, return !GTPNOK; } -int ocp_gtpv1u_update_s1u_tunnel( +int gtpv1u_update_s1u_tunnel( const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, const rnti_t prior_rnti @@ -546,7 +548,7 @@ int ocp_gtpv1u_update_s1u_tunnel( LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1u_enb_create_tunnel_resp_t tmp; - (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); + (void)gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); return 0; } @@ -565,11 +567,12 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); tcp_udp_port_t dstport=globGtp.instances[compatInst(instance)].get_dstport(); + for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti, create_tunnel_req->incoming_rb_id[i], create_tunnel_req->pdusession_id[i], - create_tunnel_req->outgoing_teid[i], + create_tunnel_req->outgoing_teid[i], create_tunnel_req->dst_addr[i], dstport, sdap_gnb_data_req); create_tunnel_resp->status=0; @@ -593,14 +596,14 @@ int gtpv1u_update_ngu_tunnel( return GTPNOK; } -int ocp_gtpv1u_create_x2u_tunnel( +int gtpv1u_create_x2u_tunnel( const instance_t instanceP, const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP) { AssertFatal( false, "to be developped\n"); } -int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { +int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", instance, rnti); pthread_mutex_lock(&globGtp.gtp_lock); @@ -630,24 +633,64 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { // Legacy delete tunnel finish by deleting all the rnti // so the list of bearer provided is only a design bug -int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { - return newGtpuDeleteTunnel(instance, req_pP->rnti); +int gtpv1u_delete_s1u_tunnel( const instance_t instance, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return newGtpuDeleteAllTunnels(instance, req_pP->rnti); +} + +int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id) { + LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", + instance, rnti); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto ptrRNTI=inst->ue2te_mapping.find(rnti); + + if ( ptrRNTI == inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"[%ld] Delete GTP tunnels for rnti: %x, but no tunnel exits\n", instance, rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return -1; + } + + int nb=0; + + for (int i=0; isecond.bearers.find(pdusession_id[i]); + + if ( ptr2 == ptrRNTI->second.bearers.end() ) { + LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel RNTI:RAB: %x/%x\n", instance, rnti,pdusession_id[i]); + } else { + inst->te2ue_mapping.erase(ptr2->second.teid_incoming); + nb++; + } + } + + if (ptrRNTI->second.bearers.size() == 0 ) + // no tunnels on this rnti, erase the ue entry + inst->ue2te_mapping.erase(ptrRNTI); + + pthread_mutex_unlock(&globGtp.gtp_lock); + LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); + return !GTPNOK; } int gtpv1u_delete_x2u_tunnel( const instance_t instanceP, - const gtpv1u_enb_delete_tunnel_req_t *const req_pP, - int enbflag) { + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + LOG_E(GTPU,"x2 tunnel not implemented\n"); return 0; } +int gtpv1u_delete_ngu_tunnel( const instance_t instance, + gtpv1u_gnb_delete_tunnel_req_t *req) { + return newGtpuDeleteTunnels(instance, req->rnti, req->num_pdusession, req->pdusession_id); +} + static int Gtpv1uHandleEchoReq(int h, uint8_t *msgBuf, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; - + if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { LOG_E(GTPU, "[%d] Received a packet that is not GTP header\n", h); return GTPNOK; @@ -658,14 +701,12 @@ static int Gtpv1uHandleEchoReq(int h, return GTPNOK; } - uint16_t seq=ntohs(*(uint16_t*)(msgHdr+1)); + uint16_t seq=ntohs(*(uint16_t *)(msgHdr+1)); LOG_D(GTPU, "[%d] Received a echo request, TEID: %d, seq: %hu\n", h, msgHdr->teid, seq); - uint8_t recovery[2]={14,0}; - + uint8_t recovery[2]= {14,0}; return gtpv1uCreateAndSendMsg(h, peerIp, peerPort, GTP_ECHO_RSP, ntohl(msgHdr->teid), - recovery, sizeof recovery, - 1, 0, 0, seq, 0, 0); - + recovery, sizeof recovery, + 1, 0, 0, seq, 0, 0); } static int Gtpv1uHandleError(int h, @@ -871,14 +912,14 @@ void gtpv1uReceiver(int h) { #include -void *ocp_gtpv1uTask(void *args) { +void *gtpv1uTask(void *args) { while(1) { /* Trying to fetch a message from the message queue. If the queue is empty, this function will block till a message is sent to the task. */ MessageDef *message_p = NULL; - itti_receive_msg(OCP_GTPV1_U, &message_p); + itti_receive_msg(TASK_GTPV1_U, &message_p); if (message_p != NULL ) { openAddr_t addr= {0}; @@ -888,7 +929,7 @@ void *ocp_gtpv1uTask(void *args) { case GTPV1U_ENB_TUNNEL_DATA_REQ: { gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), >PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false); - itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); } break; @@ -908,7 +949,7 @@ void *ocp_gtpv1uTask(void *args) { case GTPV1U_ENB_END_MARKER_REQ: gtpv1uEndTunnel(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), >PV1U_ENB_TUNNEL_DATA_REQ(message_p)); - itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + itti_free(TASK_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); break; case GTPV1U_ENB_DATA_FORWARDING_REQ: @@ -923,7 +964,7 @@ void *ocp_gtpv1uTask(void *args) { strcpy(addr.originHost, GTPV1U_REQ(message_p).localAddrStr); strcpy(addr.originService, GTPV1U_REQ(message_p).localPortStr); strcpy(addr.destinationService,addr.originService); - AssertFatal((legacyInstanceMapping=ocp_gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n"); + AssertFatal((legacyInstanceMapping=gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n"); break; default: @@ -932,12 +973,12 @@ void *ocp_gtpv1uTask(void *args) { break; } - AssertFatal(EXIT_SUCCESS==itti_free(OCP_GTPV1_U, message_p), "Failed to free memory!\n"); + AssertFatal(EXIT_SUCCESS==itti_free(TASK_GTPV1_U, message_p), "Failed to free memory!\n"); } struct epoll_event *events; - int nb_events = itti_get_events(OCP_GTPV1_U, &events); + int nb_events = itti_get_events(TASK_GTPV1_U, &events); for (int i = 0; i < nb_events; i++) if ((events[i].events&EPOLLIN)) diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 3893acf40f..ba6cf0f8bb 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -8,19 +8,6 @@ extern "C" { #endif -#include -#if defined(NEW_GTPU) -#define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel -#define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel -#define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel -#define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel -#define gtpv1u_eNB_task ocp_gtpv1uTask -#define nr_gtpv1u_gNB_task ocp_gtpv1uTask -#define TASK_VARIABLE OCP_GTPV1_U -#else -#define TASK_VARIABLE TASK_GTPV1_U -#endif - typedef boolean_t (*gtpCallback)( protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, @@ -32,7 +19,7 @@ typedef boolean_t (*gtpCallback)( const pdcp_transmission_mode_t modeP, const uint32_t *sourceL2Id, const uint32_t *destinationL2Id); - + typedef struct openAddr_s { char originHost[HOST_NAME_MAX]; char originService[HOST_NAME_MAX]; @@ -43,18 +30,18 @@ typedef struct openAddr_s { // the init function create a gtp instance and return the gtp instance id // the parameter originInstance will be sent back in each message from gtp to the creator -void ocp_gtpv1uReceiver(int h); -void ocp_gtpv1uProcessTimeout(int handle,void *arg); -int ocp_gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); -int ocp_gtpv1u_update_s1u_tunnel(const instance_t instanceP, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, - const rnti_t prior_rnti - ); -int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); +void gtpv1uReceiver(int h); +void gtpv1uProcessTimeout(int handle,void *arg); +int gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); +int gtpv1u_update_s1u_tunnel(const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, + const rnti_t prior_rnti + ); +int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); -int ocp_gtpv1u_create_x2u_tunnel( +int gtpv1u_create_x2u_tunnel( const instance_t instanceP, const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); @@ -64,8 +51,10 @@ int ocp_gtpv1u_create_x2u_tunnel( teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_rb_id, teid_t teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack); void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid); -instance_t ocp_gtpv1Init(openAddr_t context); -void *ocp_gtpv1uTask(void *args); +int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti); +int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pdusessionid_t *pdusession_id); +instance_t gtpv1Init(openAddr_t context); +void *gtpv1uTask(void *args); #ifdef __cplusplus } diff --git a/openair3/GTPV1-U/gtpv1u_eNB_defs.h b/openair3/ocp-gtpu/gtpv1u_eNB_task.h similarity index 59% rename from openair3/GTPV1-U/gtpv1u_eNB_defs.h rename to openair3/ocp-gtpu/gtpv1u_eNB_task.h index fb317e4ca6..e764eb143b 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB_defs.h +++ b/openair3/ocp-gtpu/gtpv1u_eNB_task.h @@ -19,32 +19,23 @@ * contact@openairinterface.org */ -/*! \file gtpv1u_eNB_defs.h - * \brief - * \author Sebastien ROUX, Lionel GAUTHIER - * \version 1.0 - * \company Eurecom - * \email: lionel.gauthier@eurecom.fr - */ +/*! \file gtpv1u_eNB_task.h +* \brief +* \author Lionel Gauthier +* \company Eurecom +* \email: lionel.gauthier@eurecom.fr +*/ -#include "hashtable.h" -#include "LTE_asn_constant.h" +#ifndef GTPV1U_ENB_TASK_H_ +#define GTPV1U_ENB_TASK_H_ -#ifndef GTPV1U_ENB_DEFS_H_ -#define GTPV1U_ENB_DEFS_H_ +typedef struct gtpv1u_data_s { + /* RB tree of UEs */ + hash_table_t *ue_mapping; +} gtpv1u_data_t; -#include "NwGtpv1u.h" - -#define GTPV1U_UDP_PORT (2152) #define GTPV1U_BEARER_OFFSET 3 - #define GTPV1U_MAX_BEARERS_ID (max_val_LTE_DRB_Identity - GTPV1U_BEARER_OFFSET) - -#define GTPV1U_SOURCE_ENB (0) -#define GTPV1U_TARGET_ENB (1) -#define GTPV1U_MSG_FROM_SOURCE_ENB (0) -#define GTPV1U_MSG_FROM_SPGW (1) - typedef enum { BEARER_DOWN = 0, BEARER_IN_CONFIG, @@ -54,16 +45,7 @@ typedef enum { BEARER_MAX, } bearer_state_t; - -typedef struct gtpv1u_teid_data_s { - /* UE identifier for oaisim stack */ - module_id_t enb_id; - rnti_t ue_id; - ebi_t eps_bearer_id; -} gtpv1u_teid_data_t; - - -typedef struct gtpv1u_bearer_s { +typedef struct fixMe_gtpv1u_bearer_s { /* TEID used in dl and ul */ teid_t teid_eNB; ///< eNB TEID uintptr_t teid_eNB_stack_session; ///< eNB TEID @@ -71,12 +53,12 @@ typedef struct gtpv1u_bearer_s { in_addr_t sgw_ip_addr; struct in6_addr sgw_ip6_addr; teid_t teid_teNB; - in_addr_t tenb_ip_addr; ///< target eNB ipv4 - struct in6_addr tenb_ip6_addr; ///< target eNB ipv6 + in_addr_t tenb_ip_addr; ///< target eNB ipv4 + struct in6_addr tenb_ip6_addr; ///< target eNB ipv6 tcp_udp_port_t port; //NwGtpv1uStackSessionHandleT stack_session; bearer_state_t state; -} gtpv1u_bearer_t; +} fixMe_gtpv1u_bearer_t; typedef struct gtpv1u_ue_data_s { /* UE identifier for oaisim stack */ @@ -89,45 +71,43 @@ typedef struct gtpv1u_ue_data_s { * Note that the first LCID available for data is 3 and we fixed the maximum * number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32). */ - gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID]; + fixMe_gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID]; //RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node; } gtpv1u_ue_data_t; - -typedef struct gtpv1u_data_s { - /* nwgtpv1u stack internal data */ - NwGtpv1uStackHandleT gtpv1u_stack; - - /* RB tree of UEs */ - hash_table_t *ue_mapping; // PDCP->GTPV1U - hash_table_t *teid_mapping; // GTPV1U -> PDCP - - //RB_HEAD(gtpv1u_ue_map, gtpv1u_ue_data_s) gtpv1u_ue_map_head; - /* Local IP address to use */ - in_addr_t enb_ip_address_for_S1u_S12_S4_up; - /* UDP internal data */ - //udp_data_t udp_data; - - uint16_t seq_num; - uint8_t restart_counter; - -} gtpv1u_data_t; - +/* int gtpv1u_new_data_req( - uint8_t enb_module_idP, - rnti_t ue_rntiP, - uint8_t rab_idP, - uint8_t *buffer_pP, - uint32_t buf_lenP, - uint32_t buf_offsetP -); + uint8_t enb_id, + uint8_t ue_id, + uint8_t rab_id, + uint8_t *buffer, + uint32_t buf_len, + uint32_t buf_offset);*/ + +int gtpv1u_eNB_init(void); +void *gtpv1u_eNB_process_itti_msg(void *); +void *gtpv1u_eNB_task(void *args); int -gtpv1u_initial_req( - gtpv1u_data_t *gtpv1u_data_p, - uint32_t teid, - uint16_t port, - uint32_t address); +gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); -#endif /* GTPV1U_ENB_DEFS_H_ */ +int +gtpv1u_create_s1u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_tunnel_resp_t *const create_tunnel_resp_pP); + +int +gtpv1u_update_s1u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req_pP, + const rnti_t prior_rnti); + +int gtpv1u_delete_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP); +#endif /* GTPV1U_ENB_TASK_H_ */ diff --git a/openair3/GTPV1-U/gtpv1u_gNB_task.h b/openair3/ocp-gtpu/gtpv1u_gNB_task.h similarity index 86% rename from openair3/GTPV1-U/gtpv1u_gNB_task.h rename to openair3/ocp-gtpu/gtpv1u_gNB_task.h index fcfaa90304..817d0109ba 100644 --- a/openair3/GTPV1-U/gtpv1u_gNB_task.h +++ b/openair3/ocp-gtpu/gtpv1u_gNB_task.h @@ -37,8 +37,8 @@ void *nr_gtpv1u_gNB_task(void *args); int gtpv1u_create_ngu_tunnel( const instance_t instanceP, - const gtpv1u_gnb_create_tunnel_req_t * const create_tunnel_req_pP, - gtpv1u_gnb_create_tunnel_resp_t * const create_tunnel_resp_pP); + const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_pP); int gtpv1u_update_ngu_tunnel( @@ -47,5 +47,8 @@ gtpv1u_update_ngu_tunnel( const rnti_t prior_rnti ); +int gtpv1u_delete_ngu_tunnel( const instance_t instance, + gtpv1u_gnb_delete_tunnel_req_t *req); + #endif /* GTPV1U_GNB_TASK_H_ */ diff --git a/targets/ARCH/COMMON/record_player.c b/targets/ARCH/COMMON/record_player.c index 522f6b6d16..37f985b6b2 100644 --- a/targets/ARCH/COMMON/record_player.c +++ b/targets/ARCH/COMMON/record_player.c @@ -58,10 +58,9 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ // Use mmap for IQ files for systems with less than 6GB total RAM sysinfo(&systeminfo); - if (systeminfo.totalram < 6144000000) { - (*recplay_state)->use_mmap = 0; - } else { - (*recplay_state)->use_mmap = 1; + if (systeminfo.totalram < 6144000000 && ((*recplay_conf)->use_mmap == 1)) { + LOG_W(HW,"System with %f GB of mem (<6GB), mmap usage disabled\n",systeminfo.totalram/10E9); + (*recplay_conf)->use_mmap = 0; } } else { /* record player enabled */ free(*recplay_conf); diff --git a/targets/ARCH/COMMON/record_player.h b/targets/ARCH/COMMON/record_player.h index d91da68323..9310355e5b 100644 --- a/targets/ARCH/COMMON/record_player.h +++ b/targets/ARCH/COMMON/record_player.h @@ -78,7 +78,7 @@ typedef struct { #define CONFIG_HLP_SF_LOOPS "Number of loops to replay of the entire subframes file" #define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode" #define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode" - +#define CONFIG_HLP_USE_MMAP "In replay mode, map iq file in memory before replaying" /* keyword strings for config options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ #define CONFIG_OPT_SF_FILE "subframes-file" #define CONFIG_OPT_SF_REC "subframes-record" @@ -87,7 +87,7 @@ typedef struct { #define CONFIG_OPT_SF_LOOPS "subframes-loops" #define CONFIG_OPT_SF_RDELAY "subframes-read-delay" #define CONFIG_OPT_SF_WDELAY "subframes-write-delay" - +#define CONFIG_OPT_USE_MMAP "use-mmap" #define DEVICE_RECPLAY_SECTION "device.recplay" /* For information only - the macro is not usable in C++ */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -95,13 +95,14 @@ typedef struct { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define DEVICE_RECPLAY_PARAMS_DESC { \ - {CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:(char **)((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 1024}, \ - {CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \ - {CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_FILE, CONFIG_HLP_SF_FILE, 0, strptr:(char **)((*recplay_conf)->u_sf_filename), defstrval:DEF_SF_FILE, TYPE_STRING, 1024}, \ + {CONFIG_OPT_SF_REC, CONFIG_HLP_SF_REC, PARAMFLAG_BOOL, uptr:&(u_sf_record), defuintval:0, TYPE_UINT, 0}, \ + {CONFIG_OPT_SF_REP, CONFIG_HLP_SF_REP, PARAMFLAG_BOOL, uptr:&(u_sf_replay), defuintval:0, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_MAX, CONFIG_HLP_SF_MAX, 0, uptr:&((*recplay_conf)->u_sf_max), defintval:DEF_NB_SF, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_LOOPS, CONFIG_HLP_SF_LOOPS, 0, uptr:&((*recplay_conf)->u_sf_loops), defintval:DEF_SF_NB_LOOP, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, uptr:&((*recplay_conf)->u_sf_read_delay), defintval:DEF_SF_DELAY_READ, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, uptr:&((*recplay_conf)->u_sf_write_delay), defintval:DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \ + {CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, uptr:&((*recplay_conf)->use_mmap), defuintval:1, TYPE_UINT, 0}, \ }/*! \brief Record Player Configuration and state */ typedef struct { char u_sf_filename[1024]; // subframes file path @@ -109,10 +110,10 @@ typedef struct { unsigned int u_sf_loops ; // number of loops in replay mode unsigned int u_sf_read_delay; // read delay in replay mode unsigned int u_sf_write_delay ; // write delay in replay mode + unsigned int use_mmap; // default is to use mmap } recplay_conf_t; typedef struct { - int use_mmap; // default is to use mmap size_t mapsize; FILE *pFile; int fd; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index d268855566..e3b06a6438 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -648,57 +648,56 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp AssertFatal(1==0,"Shouldn't be here\n"); } - samples_received=0; - while (samples_received != nsamps) { + samples_received=0; + while (samples_received != nsamps) { - if (cc>1) { + if (cc>1) { // receive multiple channels (e.g. RF A and RF B) - std::vector buff_ptrs; + std::vector buff_ptrs; - for (int i=0; irx_stream->recv(buff_ptrs, nsamps, s->rx_md); - } else { + for (int i=0; irx_stream->recv(buff_ptrs, nsamps, s->rx_md); + } else { // receive a single channel (e.g. from connector RF A) - samples_received += s->rx_stream->recv((void*)((int32_t*)buff_tmp[0]+samples_received), - nsamps-samples_received, s->rx_md); - } - if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)) - break; - - if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) { - printf("sleep...\n"); //usleep(100); - } + samples_received += s->rx_stream->recv((void*)((int32_t*)buff_tmp[0]+samples_received), + nsamps-samples_received, s->rx_md); } - if (samples_received == nsamps) s->wait_for_first_pps=0; + if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)) + break; - // bring RX data into 12 LSBs for softmodem RX - for (int i=0; iwait_for_first_pps == 1) && (samples_received != nsamps)) { + printf("sleep...\n"); //usleep(100); + } + } + if (samples_received == nsamps) s->wait_for_first_pps=0; + + // bring RX data into 12 LSBs for softmodem RX + for (int i=0; irx_md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE) LOG_E(HW, "%s\n", s->rx_md.to_pp_string(true).c_str()); diff --git a/targets/ARCH/iqplayer/DOC/iqrecordplayer_usage.md b/targets/ARCH/iqplayer/DOC/iqrecordplayer_usage.md index a6e4138e8e..6ccdca3bfa 100644 --- a/targets/ARCH/iqplayer/DOC/iqrecordplayer_usage.md +++ b/targets/ARCH/iqplayer/DOC/iqrecordplayer_usage.md @@ -1,7 +1,7 @@ # I/Q record-playback ## using the iq recorder or iq player -This feature provides I/Q record-playback as presented in the 4th OAI workshop. Tests have only been performed with a eNB, but the implementation should allow any softmodem executable to use the iq's record/player. +This feature provides I/Q record-playback as presented in the 4th OAI workshop. The implementation allows any softmodem executable to use the iq's record/player. The I/Q record/playback feature is briefly described hereafter, it allows you to: * record subframes received by the USRP board in a file while the system is operating (for example you can record a full UE connection/traffic/ disconnection sequence). Today the oai USRP device is the only one supporting the recording feature. * replay subframes from a file to operate the system (possibly in multiple loops if the recorded sequence is convenient from the logical point of view). @@ -75,7 +75,7 @@ U[HW]I ru thread Writing file header to /tmp/iqfile ``` ### Playback/replay mode -The option works only for 5MHz bandwidth because the information stored in the iq's file header regarding bandwidth is not yet properly processed. +When replaying iq's received by eNB or gNB The option works only for 5MHz bandwidth because the information stored in the iq's file header regarding bandwidth is not yet properly processed. In this version, mismatch between file content and run time parameters might lead to unpredictable results. In addition a file recorded on a AVX2-capable processor cannot be replayed on a non-AVX2-capable processor (this is to be further investigated). options for replay mode are: * `subframes-replay` Activate replay mode @@ -83,6 +83,7 @@ options for replay mode are: * `subframes-loops` Number of iterations to replay the entire subframes file (default is 5) * `subframes-read-delay` Delay in microseconds to read a subframe in replay mode (default 200) * `subframes-write-delay` Delay in milliseconds to write a subframe in replay mode (default 15) +* `use-mmap` Boolean, set to 1 (true) by default, iq file is map to memory if true, otherwise iq's are read from file. >iq player session example: ```bash diff --git a/targets/ARCH/iqplayer/iqplayer_lib.c b/targets/ARCH/iqplayer/iqplayer_lib.c index 8b6844f9d3..b62c1935d3 100644 --- a/targets/ARCH/iqplayer/iqplayer_lib.c +++ b/targets/ARCH/iqplayer/iqplayer_lib.c @@ -68,19 +68,18 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair exit(-1); } - if (s->use_mmap) { + if (c->use_mmap) { // use mmap s->mapsize=sb.st_size; LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size ); void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) ; - s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) + sizeof(iqfile_header_t)); - if (mptr != MAP_FAILED) { + s->ms_sample = (iqrec_t *) ( mptr + sizeof(iqfile_header_t)); parse_iqfile_header(device, (iqfile_header_t *)mptr); s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t)); LOG_I(HW,"Loaded %u subframes.\n",s->nbSamplesBlocks ); } else { - LOG_E(HW,"Cannot mmap file, exiting.\n"); + LOG_E(HW,"Cannot mmap file, exiting, errnor %s\n",strerror(errno)); close(s->fd); exit(-1); } @@ -108,7 +107,7 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair if (lseek(s->fd,sizeof(iqfile_header_t), SEEK_SET) == 0) { LOG_I(HW,"Initial seek at beginning of the file\n" ); } else { - LOG_I(HW,"Problem initial seek at beginning of the file\n"); + LOG_I(HW,"Problem initial seek at beginning of the file, %s\n",strerror(errno)); } } else { LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename ); @@ -134,11 +133,10 @@ static int trx_iqplayer_start(openair0_device *device) { static void trx_iqplayer_end(openair0_device *device) { if (device == NULL) return; - if (device->recplay_state == NULL) return; - if (device->recplay_state->use_mmap) { + if (device->openair0_cfg->recplay_conf->use_mmap) { if (device->recplay_state->ms_sample != MAP_FAILED) { munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize); } @@ -201,21 +199,22 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes LOG_I(HW,"go back at the beginning of IQ file"); device->recplay_state->currentPtr=(uint8_t *)device->recplay_state->ms_sample; - if (!s->use_mmap) { - if (lseek(device->recplay_state->fd, 0, SEEK_SET) != 0) { - LOG_E(HW, "Problem seeking at the beginning of IQ file"); - } + if (!(device->openair0_cfg->recplay_conf->use_mmap) ) { + close(device->recplay_state->fd); + iqplayer_loadfile(device, device->openair0_cfg); + // LOG_E(HW, "Problem seeking at the beginning of IQ file %s\n",strerror(errno)); + } } - if (!s->use_mmap) { + if (!(device->openair0_cfg->recplay_conf->use_mmap)) { // read sample from file if (read(s->fd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) { - LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock ); + LOG_E(HW,"pb reading iqfile at index %lu %s\n",sizeof(iqrec_t)*s->curSamplesBlock, strerror(errno) ); exit(-1); } else { if (read(s->fd, s->ms_sample+1, s->ms_sample->nbBytes) != s->ms_sample->nbBytes) { - LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock ); + LOG_E(HW,"pb reading iqfile at index %lu %s\n",sizeof(iqrec_t)*s->curSamplesBlock, strerror(errno) ); exit(-1); } } @@ -225,7 +224,9 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" ); // the current timestamp is the stored timestamp until we wrap on input // USRP shifts 1 sample time to time - AssertFatal(s->wrap_count !=0 || abs(curHeader->ts-s->currentTs) < 5 ,""); + if (s->wrap_count !=0 && device->openair0_cfg->recplay_conf->use_mmap) + AssertFatal( abs(curHeader->ts-s->currentTs) < 5 , + "wrap_count=%li, ts %lu %lu",s->wrap_count,curHeader->ts,s->currentTs); AssertFatal(nsamps*4==curHeader->nbBytes,""); *ptimestamp = s->currentTs; memcpy(buff[0], curHeader+1, nsamps*4); @@ -233,7 +234,7 @@ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimes // Prepare for next read s->currentTs+=nsamps; - if (s->use_mmap) + if (device->openair0_cfg->recplay_conf->use_mmap) s->currentPtr+=sizeof(iqrec_t)+s->ms_sample->nbBytes; struct timespec req; diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 4463228dc7..a6ae906d9d 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -28,7 +28,6 @@ #include "sctp_eNB_task.h" #include "x2ap_eNB.h" #include "s1ap_eNB.h" - #include "udp_eNB_task.h" #include "gtpv1u_eNB_task.h" #if ENABLE_RAL #include "lteRALue.h" @@ -67,11 +66,7 @@ int create_tasks(uint32_t enb_nb) { if (EPC_MODE_ENABLED && !NODE_IS_DU(type) && ! ( split73==SPLIT73_DU ) ) { rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); AssertFatal(rc >= 0, "Create task for S1AP failed\n"); - if (!(get_softmodem_params()->emulate_rf)){ - rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for UDP failed\n"); - } - rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); + rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL); AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } @@ -91,7 +86,7 @@ int create_tasks(uint32_t enb_nb) { rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); // DU is now GTP-U instead of protobuf - rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); + rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL); AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } diff --git a/targets/COMMON/create_tasks_mbms.c b/targets/COMMON/create_tasks_mbms.c index 1cd3bb2f3a..b82b4f158b 100644 --- a/targets/COMMON/create_tasks_mbms.c +++ b/targets/COMMON/create_tasks_mbms.c @@ -28,7 +28,6 @@ #include "sctp_eNB_task.h" #include "x2ap_eNB.h" #include "s1ap_eNB.h" - #include "udp_eNB_task.h" #include "gtpv1u_eNB_task.h" #include "m2ap_eNB.h" #include "m2ap_MCE.h" @@ -75,46 +74,10 @@ int create_tasks_mbms(uint32_t enb_nb) { rc = itti_create_task (TASK_MCE_APP, MCE_app_task, NULL); AssertFatal(rc >= 0, "Create task for MCE APP failed\n"); - -// LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n"); -// rc = itti_create_task (TASK_ENB_APP, eNB_app_task, NULL); -// AssertFatal(rc >= 0, "Create task for eNB APP failed\n"); -// -// LOG_I(RRC,"Creating RRC eNB Task\n"); -// rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL); -// AssertFatal(rc >= 0, "Create task for RRC eNB failed\n"); -// -// if (EPC_MODE_ENABLED) { -// rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); -// AssertFatal(rc >= 0, "Create task for SCTP failed\n"); -// } -// rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); -// AssertFatal(rc >= 0, "Create task for SCTP failed\n"); -// -// -// if (EPC_MODE_ENABLED && !NODE_IS_DU(type)) { -// rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); -// AssertFatal(rc >= 0, "Create task for S1AP failed\n"); -// if (!(get_softmodem_params()->emulate_rf)){ -// rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); -// AssertFatal(rc >= 0, "Create task for UDP failed\n"); -// } -// rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); -// AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); -// if (is_x2ap_enabled()) { -// rc = itti_create_task(TASK_X2AP, x2ap_task, NULL); -// AssertFatal(rc >= 0, "Create task for X2AP failed\n"); -// } else { -// LOG_I(X2AP, "X2AP is disabled.\n"); -// } -// } -//// if(!EPC_MODE_ENABLED){ // rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); // AssertFatal(rc >= 0, "Create task for SCTP failed\n"); - rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for UDP failed\n"); - rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); + rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL); AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } /// diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c index 9341107af9..cdca62c399 100644 --- a/targets/COMMON/create_tasks_ue.c +++ b/targets/COMMON/create_tasks_ue.c @@ -27,7 +27,6 @@ #include "sctp_eNB_task.h" #include "s1ap_eNB.h" #include "openair3/NAS/UE/nas_ue_task.h" - #include "udp_eNB_task.h" #include "gtpv1u_eNB_task.h" #if ENABLE_RAL #include "lteRALue.h" diff --git a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf index 84c669571c..0e88f49021 100644 --- a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf +++ b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf @@ -70,23 +70,15 @@ eNBs = ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; # available options for level: error, warn, notice, info, debug, trace -# available options for verbosity: none, low, medium, high, full log_config : { global_log_level ="debug"; - global_log_verbosity ="medium"; hw_log_level ="debug"; - hw_log_verbosity ="medium"; phy_log_level ="info"; - phy_log_verbosity ="medium"; mac_log_level ="debug"; - 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"; }; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf index aab3876d96..0561c563dd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf @@ -269,17 +269,10 @@ NETWORK_CONTROLLER : 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index 575fddda2b..f13f20efba 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -263,18 +263,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index 38d3f5eac9..0e1080043a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -200,15 +200,10 @@ eNBs = ( log_config = { global_log_level = "info"; - global_log_verbosity = "medium"; pdcp_log_level = "info"; - pdcp_log_verbosity = "high"; rrc_log_level = "info"; - rrc_log_verbosity = "medium"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; gtp_log_level = "info"; - gtp_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index 8e786be5e9..0485957a8a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -96,17 +96,11 @@ RUs = ( 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"; flexran_agent_log_level = "info"; - flexran_agent_log_verbosity = "medium"; }; NETWORK_CONTROLLER : { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf index 67044f38d9..cc8df8185a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf @@ -382,24 +382,6 @@ eNBs = ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; - - 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"; - }; } ); @@ -438,17 +420,10 @@ RUs = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf index e044c186b9..4723fd3cba 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.100PRB.usrpx310.conf @@ -176,19 +176,12 @@ THREAD_STRUCT = ( log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf index 5a547622ab..d811fb068e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf @@ -256,17 +256,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf index 27826e5ce2..6669cef9a6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.usrpx310.conf @@ -176,19 +176,12 @@ THREAD_STRUCT = ( log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf index 5df0f107ea..1b4224da08 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf @@ -256,17 +256,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf index cb50cccf2b..ad95557bb9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf @@ -284,17 +284,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf index 245e4ecf94..8c0f57c65d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf @@ -212,18 +212,11 @@ THREAD_STRUCT = ( 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 ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf index 86b481f9d8..506966d167 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf @@ -256,17 +256,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf index 1eb5da6a18..177cddec12 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf @@ -251,41 +251,15 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); -/* - 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"; - }; -*/ log_config : { global_log_level ="crit"; - global_log_verbosity ="crit"; hw_log_level ="crit"; - hw_log_verbosity ="crit"; phy_log_level ="crit"; - phy_log_verbosity ="crit"; mac_log_level ="crit"; - mac_log_verbosity ="crit"; rlc_log_level ="crit"; - rlc_log_verbosity ="crit"; pdcp_log_level ="crit"; - pdcp_log_verbosity ="crit"; rrc_log_level ="crit"; - rrc_log_verbosity ="crit"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210-d2d.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210-d2d.conf index a929c439be..aac2ec5f5e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210-d2d.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210-d2d.conf @@ -244,18 +244,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index 43288ba324..07cebbe75b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -298,18 +298,11 @@ rfsimulator : 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210_ue_expansion.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210_ue_expansion.conf index 92f2d4e6f1..222b203f71 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210_ue_expansion.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210_ue_expansion.conf @@ -211,18 +211,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf index c3faa198dd..483aac6deb 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf @@ -265,18 +265,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index 8fa8fcf992..9a91640a08 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -251,18 +251,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf index c2e364b75e..05c81b5c51 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf @@ -245,18 +245,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index 813a0e58e3..fbae1136b0 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -265,18 +265,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf index d81655e5d5..e5685d00a4 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf @@ -257,18 +257,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index b063989fd2..b0126589cd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -257,18 +257,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf index a171f2aae0..683cdaeb2c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf @@ -258,18 +258,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf index 856eed4fc2..2d85f446d7 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf @@ -262,17 +262,10 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf index 012f46401e..e1c9e9e167 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf @@ -260,17 +260,10 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf index 2e4dc540f3..367ced1c8a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf @@ -303,17 +303,10 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf index a454af7b21..e7d671e6a4 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf @@ -254,18 +254,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index af26091260..c9363da7f8 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -253,18 +253,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index 928c70113f..0e5ee33950 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -253,18 +253,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 76bc5bf992..019a0f0a36 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -270,18 +270,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf index 7ff9d0ea77..35e742900a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf @@ -245,18 +245,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf index 5c0434b57e..37cde2feb1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf @@ -255,18 +255,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf index 4b1476a76d..f392240401 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf @@ -253,18 +253,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf index 50169f4bce..59af2a9187 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf @@ -253,18 +253,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf index e217f39b94..9358c3370f 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf @@ -246,18 +246,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf index b13962aee9..a52841158c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf @@ -1,18 +1,11 @@ log_config = { global_log_level ="debug"; - global_log_verbosity ="medium"; hw_log_level ="info"; - hw_log_verbosity ="medium"; phy_log_level ="info"; - phy_log_verbosity ="medium"; mac_log_level ="debug"; - mac_log_verbosity ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="debug"; - rrc_log_verbosity ="full"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf index 0b384958ae..9a0f1cb036 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf @@ -1,18 +1,11 @@ log_config = { global_log_level ="debug"; - global_log_verbosity ="medium"; hw_log_level ="info"; - hw_log_verbosity ="medium"; phy_log_level ="info"; - phy_log_verbosity ="medium"; mac_log_level ="debug"; - mac_log_verbosity ="medium"; rlc_log_level ="info"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="debug"; - rrc_log_verbosity ="full"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band38.tm1.if4p5.50PRB.lo.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band38.tm1.if4p5.50PRB.lo.conf index e05c64b4e8..4554a32a18 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band38.tm1.if4p5.50PRB.lo.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band38.tm1.if4p5.50PRB.lo.conf @@ -217,17 +217,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi-STUB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi-STUB.conf index 1ef71bedc2..c8bca91ccd 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi-STUB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi-STUB.conf @@ -200,19 +200,12 @@ THREAD_STRUCT = ( log_config : { global_log_level ="debug"; - global_log_verbosity ="medium"; hw_log_level ="info"; - hw_log_verbosity ="medium"; phy_log_level ="info"; - phy_log_verbosity ="medium"; mac_log_level ="debug"; - mac_log_verbosity ="high"; rlc_log_level ="debug"; - rlc_log_verbosity ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="high"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf index 9ce9f28cc2..1f72077ba3 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf @@ -239,17 +239,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf index 30cb852a28..401c42e503 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.conf @@ -217,17 +217,10 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf index 519305b68d..22da6735a2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.if4p5.50PRB.lo.conf @@ -218,17 +218,10 @@ THREAD_STRUCT = ( log_config = { global_log_level ="debug"; - global_log_verbosity ="medium"; hw_log_level ="info"; - hw_log_verbosity ="medium"; phy_log_level ="debug"; - phy_log_verbosity ="medium"; mac_log_level ="debug"; - 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf index 1583e07ca1..004ad4db78 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf @@ -235,18 +235,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf index 9b611b3f07..6a76028d25 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf @@ -168,19 +168,12 @@ eNBs = log_config : { global_log_level ="debug"; - 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"; }; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf index 3dc8e7dd32..c14cc9589a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.conf @@ -29,18 +29,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.tdd.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.tdd.conf index 494086defd..4f1a7fee30 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.tdd.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rru.oaisim.tdd.conf @@ -29,18 +29,11 @@ THREAD_STRUCT = ( 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_eNB_band13.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_eNB_band13.conf index 1d8f61e442..d2ef01392b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_eNB_band13.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_eNB_band13.conf @@ -204,25 +204,6 @@ eNBs = ENB_IPV4_ADDRESS_FOR_X2C = "192.168.18.199/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="high"; - 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 ="debug"; - rlc_log_verbosity ="high"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - } ); @@ -269,17 +250,10 @@ RUs = ( log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf index 6df25273c8..d493f29906 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_enb.conf @@ -205,25 +205,6 @@ eNBs = ENB_IPV4_ADDRESS_FOR_X2C = "192.168.18.199/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="high"; - 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 ="debug"; - rlc_log_verbosity ="high"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - } ); @@ -270,17 +251,10 @@ RUs = ( log_config : { global_log_level ="info"; - global_log_verbosity ="high"; 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 ="high"; pdcp_log_level ="info"; - pdcp_log_verbosity ="high"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index 5591ed082d..4ec53064f1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -263,18 +263,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf index dd8113e059..7c0fa96adb 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -272,18 +272,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf index 198ad8471c..57aa459d49 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf @@ -261,18 +261,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf index 96335f23ca..89dca2a75c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_nsa_n310.conf @@ -258,18 +258,11 @@ security = { 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"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index 680a6cb4ae..43c2ab20ad 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -78,22 +78,13 @@ gNBs = 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 ="debug"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; ngap_log_level ="debug"; - ngap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 215a57b95c..0b6d7cd7c8 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -254,22 +254,13 @@ THREAD_STRUCT = ( 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 ="debug"; - rlc_log_verbosity ="medium"; pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; rrc_log_level ="info"; - rrc_log_verbosity ="medium"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; ngap_log_level ="debug"; - ngap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf index ab4713f8b5..b0e02ff2bc 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf @@ -265,20 +265,12 @@ security = { 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 ="info"; - ngap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 2777035fdd..9bf20b54ab 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -282,22 +282,13 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf index 9e69bb6f4e..cab801525b 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -280,20 +280,12 @@ security = { 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/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 27a1b6ad62..9452f00eed 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -282,21 +282,12 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index f340d6116b..09cf892b91 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -281,22 +281,13 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf index c8a0bace37..280461d2ab 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf @@ -287,20 +287,12 @@ security = { 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/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf index befceae695..fac54a298b 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf @@ -310,21 +310,12 @@ security = { 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"; f1ap_log_level ="debug"; - f1ap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf new file mode 100644 index 0000000000..bd3076a014 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/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/targets/RT/USER/TOOLS/thread_ipc.h b/targets/RT/USER/TOOLS/thread_ipc.h deleted file mode 100644 index ec008c30df..0000000000 --- a/targets/RT/USER/TOOLS/thread_ipc.h +++ /dev/null @@ -1,83 +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 - */ - -#ifndef __THREAD_IPC_H__ -#define __THREAD_IPC_H__ - - -#define SUB_FRAME_LENGTH 7680 -#define FRAME_LENGTH 76800 - -#define UE_UL_DELAY 6 /*设置上行组帧在同步时钟基础上的延时(子帧个数)*/ -#define UE_UL_SEND_DELAY 6 /*上行发送子帧号在接收子帧时间戳上的延时(子帧个数)*/ - -#define BUFFERMAX 5 /*环形缓冲区个数*/ -#define LOWBUFFER 3 /*环形缓冲区下限, 不能为0*/ -#define HIGHBUFFER 4 /*环形缓冲区上限*/ - -typedef struct { - long long subframe_num; /*子帧编号*/ - int buffer[SUB_FRAME_LENGTH * 2]; /*一子帧数据*/ -} buffer_t; - -typedef struct { - int packet_num; /*环形缓冲区数据包计数器,表示环形缓冲区有效数据包个数*/ - int isfull; /*标记环形缓冲区有效数据包是否达到上限标志*/ - int isempty; /*标记环形缓冲区有效数据包是否达到下限标志*/ - - pthread_mutex_t buffer_mutex; /*环形缓冲区操作保护锁*/ - pthread_cond_t full_cond; /*环形缓冲区上限条件变量,配合isfull使用 */ - pthread_cond_t empty_cond; /*环形缓冲区下限条件变量,配合isempty使用*/ - - buffer_t loop_buf[BUFFERMAX]; /*环形缓冲区*/ -} loop_buffer_op_t; - -typedef struct { - int decoding_subframe_num; /*待解码子帧的编号*/ - pthread_mutex_t buffer_mutex; /*对sync_buffer临界区的保护锁*/ - int sync_buffer[SUB_FRAME_LENGTH * 10]; /*同步线程与下行解码线程数据共享缓冲区*/ -} sync_buffer_t; - -typedef struct { - unsigned int rx_timestamp; /*接收数据包第一个sample时间戳*/ - unsigned int tx_timestamp; /*待发送数据包的时间戳*/ - unsigned long long current_subframe; /*当前子帧编号*/ - - int ue_sync_state; /*表示UE是否在同步状态,0表示失同步,1表示同步*/ - pthread_mutex_t sync_mutex; /*根据ue_sync_state标志,唤醒组帧线程*/ - - pthread_mutex_t ul_send_mutex; /*用于sync线程唤醒发送线程发送数据*/ - pthread_mutex_t dl_decode_mutex;/*下行解码保护锁,用于sync线程唤醒解码线程解码*/ - - loop_buffer_op_t loop_buffer; - sync_buffer_t sync_buffer; -} g_thread_ipc_t; - -void loop_buffer_reset(buffer_t *loop_buf); -int thread_ipc_init(void); -int thread_ipc_deinit(void); -int set_thread_attr(pthread_attr_t *attr, int policy, int priority, int cpuid); -int find_subframe_num(unsigned long long current_subframe_num, buffer_t *buf, int *flag); -int ue_unsync_thread_ipc_reset(void); - -extern g_thread_ipc_t thread_ipc; - -#endif diff --git a/targets/RT/USER/lte-hwlat.c b/targets/RT/USER/lte-hwlat.c deleted file mode 100755 index 20482adf87..0000000000 --- a/targets/RT/USER/lte-hwlat.c +++ /dev/null @@ -1,944 +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 - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "assertions.h" -#include "PHY/types.h" - -#include "PHY/defs.h" - -#include -#define GET_TIME_INIT(num) struct timeval _timers[num] -#define GET_TIME_VAL(num) gettimeofday(&_timers[num], NULL) -#define TIME_VAL_TO_MS(num) (((double)_timers[num].tv_sec*1000.0) + ((double)_timers[num].tv_usec/1000.0)) - -#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all -//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all - -#include "../../ARCH/COMMON/common_lib.h" - -#include "PHY/extern.h" -#include "SCHED/extern.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/proto.h" - -#define SYRIQ_CHANNEL_TESTER 0 -#define SYRIQ_CHANNEL_TESTER2 0 -#define SYRIQ_CHANNEL_DATA1 1 - -volatile int oai_exit = 0; - -openair0_config_t openair0_cfg[MAX_CARDS]; - -#if 0 -#define NB_ANTENNAS_RX 4 - -#define DevAssert(cOND) _Assert_(cOND, _Assert_Exit_, "") -#define malloc16(x) memalign(16,x) - -#ifdef 0 -static inline void* malloc16_clear( size_t size ) -{ -#ifdef __AVX2__ - void* ptr = memalign(32, size); -#else - void* ptr = memalign(16, size); -#endif - if(ptr) - memset( ptr, 0, size ); - return ptr; -} -#endif - -#endif - -typedef struct latency_stat { - uint64_t counter; - - uint64_t stat250; - uint64_t stat500; - uint64_t stat600; - uint64_t stat700; - uint64_t stat800; - - uint64_t stat1300; - uint64_t stat1500; - uint64_t stat2000; - uint64_t stat2500; - uint64_t stat3000; - - uint64_t stat880; - uint64_t stat960; - uint64_t stat1040; - uint64_t stat1120; - uint64_t stat1200; -} latency_stat_t; - - -typedef struct timing_stats { - char *name; - double min; - double max; - double total; - unsigned int count; -} timing_stats_t; - - -//static struct timespec get_timespec_diff( -// struct timespec *start, -// struct timespec *stop ) -//{ -// struct timespec result; -// -// if ( ( stop->tv_nsec - start->tv_nsec ) < 0 ) { -// result.tv_sec = stop->tv_sec - start->tv_sec - 1; -// result.tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000; -// } -// else { -// result.tv_sec = stop->tv_sec - start->tv_sec; -// result.tv_nsec = stop->tv_nsec - start->tv_nsec; -// } -// -// return result; -//} - - -//static void measure_time ( -// openair0_device *rf_device, -// struct timespec *start, -// struct timespec *stop, -// timing_stats_t *stats, -// boolean_t START, -// uint8_t PRINT_INTERVAL ) -//{ -// if ( START ) { -// clock_gettime( CLOCK_MONOTONIC, start ); -// } -// else { -// clock_gettime( CLOCK_MONOTONIC, stop ); -// -// struct timespec diff; -// double current = 0; -//// boolean_t show_stats = false; -// -// diff = get_timespec_diff( start, stop ); -// current = (double)diff.tv_sec * 1000000 + (double)diff.tv_nsec / 1000; -// -// if ( current > stats->max ) { -// stats->max = current; -//// show_stats = true; -// } -// if ( stats->min == 0 || current < stats->min ) { -// stats->min = current; -//// show_stats = true; -// } -// stats->total += current; -// -//// if ( show_stats ) { -//// rf_device.trx_get_stats_func( &rf_device ); -//// } -// -//// if ( stats->count % PRINT_INTERVAL == 0 ) { -//// double avg = stats->total / ( stats->count + 1 ); -//// printf( "[%s][%d] Current : %.2lf µs, Min : %.2lf µs, Max : %.2lf µs, Avg : %.2lf µs\n", -//// stats->count, stats->name, current, stats->min, stats->max, avg ); -//// } -// -// stats->count++; -// } -//} -int32_t **rxdata; -int32_t **txdata; - -int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg); - -static inline void saif_meas(unsigned int frame_rx, unsigned int subframe_rx) { - static latency_stat_t __thread latency_stat; - static struct timespec __thread last= {0}; - struct timespec now; - clock_gettime(CLOCK_MONOTONIC_RAW, &now); - if ( last.tv_sec ) { - uint64_t diffTime = ((uint64_t)now.tv_sec *1000 *1000 *1000 + now.tv_nsec) - - ((uint64_t)last.tv_sec *1000 *1000 *1000 + last.tv_nsec); - diffTime/=1000; - latency_stat.counter++; - - if ( diffTime <= 800 ) { - if (diffTime < 250 ) - latency_stat.stat250++; - else if (diffTime < 500 ) - latency_stat.stat500++; - else if (diffTime < 600 ) - latency_stat.stat600++; - else if (diffTime < 700 ) - latency_stat.stat700++; - else - latency_stat.stat800++; - } - else if ( diffTime > 1200 ) { - if (diffTime < 1500 ) - latency_stat.stat1300++; - else if ( diffTime < 2000 ) - latency_stat.stat1500++; - else if ( diffTime < 2500 ) - latency_stat.stat2000++; - else if ( diffTime < 3000 ) - latency_stat.stat2500++; - else - latency_stat.stat3000++; - } - else - if (diffTime <= 880 ) - latency_stat.stat880++; - else if (diffTime <= 960 ) - latency_stat.stat960++; - else if (diffTime <= 1040 ) - latency_stat.stat1040++; - else if (diffTime < 1120 ) - latency_stat.stat1120++; - else - latency_stat.stat1200++; - - - if ( (diffTime>=1500) || ( !(frame_rx%1024) && subframe_rx == 0 ) ) { - time_t current=time(NULL); - printf("\n"); - printf("%.2f Period stats cnt=%7.7ld 0.. 250=%7.7ld 250.. 500=%7.7ld 500.. 600=%7.7ld 600.. 700=%7.7ld 700.. 800=%7.7ld - (frame_rx=%u) - %s", - now.tv_sec+(double)now.tv_nsec/1e9, - latency_stat.counter, - latency_stat.stat250, latency_stat.stat500, - latency_stat.stat600, latency_stat.stat700, - latency_stat.stat800, - frame_rx, - ctime(¤t)); - printf("%.2f Period stats cnt=%7.7ld 800.. 880=%7.7ld 880.. 960=%7.7ld 960..1040=%7.7ld 1040..1120=%7.7ld 1120..1200=%7.7ld - (frame_rx=%u) - %s", - now.tv_sec+(double)now.tv_nsec/1e9, - latency_stat.counter, - latency_stat.stat880, latency_stat.stat960, - latency_stat.stat1040, latency_stat.stat1120, - latency_stat.stat1200, - frame_rx, - ctime(¤t)); - printf("%.2f Period stats cnt=%7.7ld 1200..1300=%7.7ld 1300..1500=%7.7ld 1500..2000=%7.7ld 2000..2500=%7.7ld >3000=%7.7ld - (frame_rx=%u) - %s", - now.tv_sec+(double)now.tv_nsec/1e9, - latency_stat.counter, - latency_stat.stat1300, latency_stat.stat1500, - latency_stat.stat2000, latency_stat.stat2500, - latency_stat.stat3000, - frame_rx, - ctime(¤t)); - fflush(stdout); - } - } - last=now; -} -/* End of Changed by SYRTEM */ - -void exit_fun(const char* s) -{ - - if (s != NULL) { - printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s); - } - - oai_exit = 1; - -} - - -void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, char * name) { - -#ifdef DEADLINE_SCHEDULER - if (sched_runtime!=0) { - struct sched_attr attr= {0}; - attr.size = sizeof(attr); - // This creates a .5 ms fpga_recv_cnt reservation - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = sched_runtime; - attr.sched_deadline = sched_deadline; - attr.sched_period = 0; - AssertFatal(sched_setattr(0, &attr, 0) == 0, - "[SCHED] main eNB thread: sched_setattr failed %s \n",perror(errno)); - LOG_I(HW,"[SCHED][eNB] eNB main deadline thread %lu started on CPU %d\n", - (unsigned long)gettid(), sched_getcpu()); - } - -#else -#ifdef CPU_AFFINITY - if (get_nprocs() >2) { - for (j = 1; j < get_nprocs(); j++) - CPU_SET(j, &cpuset); - } - AssertFatal( 0 == pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset)==0,""); -#endif - struct sched_param sp; - sp.sched_priority = sched_fifo; - AssertFatal(pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp)==0, - "Can't set thread priority, Are you root?\n"); -#endif - - // Lock memory from swapping. This is a process wide call (not constraint to this thread). - mlockall(MCL_CURRENT | MCL_FUTURE); - pthread_setname_np( pthread_self(), name ); - -} - - -int main(void) -{ - int ret; - uint64_t i; - openair0_device rf_device; - openair0_timestamp timestamp = 0; - - unsigned int sub_frame = 0; - unsigned int frame_rx = 0; - - unsigned int nb_antennas_tx = 1; - unsigned int nb_antennas_rx = 1; - - - openair0_cfg[0].mmapped_dma = 0; - openair0_cfg[0].configFilename = NULL; - openair0_cfg[0].duplex_mode = duplex_mode_FDD; - - uint32_t **sendbuff = NULL; - uint32_t **recvbuff = NULL; - uint32_t expected_value = 0; - uint32_t received_value = 0; - int nsamp = 0; // 1 ms - int antenna_id = 1; - int c = 0; - int numIter = 0; - int fpga_loop = 0; -#if SYRIQ_CHANNEL_DATA1 - uint64_t first_ts = 0; - uint8_t is_first_ts = 0; - uint64_t trx_read_cnt = 0; - uint32_t j = 0; - uint32_t err_cnt = 0; -#else - int failure = 0; -#endif -#if 0 // 5MHz BW - unsigned int nb_sample_per_tti = 7680; - openair0_cfg[0].sample_rate = 7.68e6; - openair0_cfg[0].samples_per_frame = nb_sample_per_tti*10; - openair0_cfg[0].rx_bw = 2.5e6; - openair0_cfg[0].tx_bw = 2.5e6; - openair0_cfg[0].num_rb_dl = 25; -#endif - -#if 0 // 10MHz BW - unsigned int nb_sample_per_tti = 15360; - openair0_cfg[0].sample_rate = 15.36e6; - openair0_cfg[0].samples_per_frame = nb_sample_per_tti*10; - openair0_cfg[0].rx_bw = 5.0e6; - openair0_cfg[0].tx_bw = 5.0e6; - openair0_cfg[0].num_rb_dl = 50; -#endif - -#if 1 // 20MHz BW - unsigned int nb_sample_per_tti = 30720; - openair0_cfg[0].sample_rate = 30.72e6; - openair0_cfg[0].samples_per_frame = nb_sample_per_tti*10; - openair0_cfg[0].rx_bw = 10.0e6; - openair0_cfg[0].tx_bw = 10.0e6; - openair0_cfg[0].num_rb_dl = 100; -#endif - - const char *openair_dir = getenv("OPENAIR_DIR"); - const char *ini_file = "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR20.dat"; - - int readBlockSize; - void* rxp[nb_antennas_rx]; - void* txp[nb_antennas_tx]; - -// int32_t rxdata[1][nb_sample_per_tti*10+2048]; -#if 0 - int32_t **rxdata; -#endif -// init_thread(100000, 500000, sched_get_priority_max(SCHED_FIFO),"main UE"); - - printf("LTE HARDWARE Latency debug utility \n"); - printf("INIT data buffers \n"); - -#if 0 - rxdata = (int32_t**)memalign(32, nb_antennas_rx*sizeof(int32_t*) ); - rxdata[0] = (int32_t*)memalign(32,(nb_sample_per_tti*10+2048)*sizeof(int32_t)); -#else - rxdata = (int32_t**)malloc16( nb_antennas_rx*sizeof(int32_t*) ); - txdata = (int32_t**)malloc16( nb_antennas_tx*sizeof(int32_t*) ); - rxdata[0] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); - txdata[0] = (int32_t*)malloc16_clear( 307200*sizeof(int32_t) ); -#endif - - printf("INIT done\n"); - - memset(&rf_device, 0, sizeof(openair0_device)); - - rf_device.host_type = BBU_HOST; - openair0_cfg[0].duplex_mode = duplex_mode_FDD; - openair0_cfg[0].rx_num_channels = 1; - openair0_cfg[0].tx_num_channels = 1; - - // configure channel 0 - for (i=0; i= 2-307200 -> check expected value + status (RxoVer TxUnder) - - rxp[0] = (void*)&rxdata[0][0]; - txp[0] = (void*)&txdata[0][0]; - timestamp = 0; - nsamp = 30720; // 30720 => 1ms buffer - trx_read_cnt = 100000; // 1 loop => 1ms (10sec=10000; 15min = 900000) - antenna_id = 1; - int diff = 0; - int compare_start = 0; - - uint32_t looploop=0; - uint64_t error_cnt = 0; - uint64_t error_ts_start; - - for (i = 0; i < trx_read_cnt; i++) - { - -// printf("\n\n"); - - -// ret = rf_device.trx_read_func( &rf_device, ×tamp, &(rxp[0][(i*30720)%307200]), nsamp, antenna_id ); -// ret = rf_device.trx_read_func( &rf_device, ×tamp, recvbuff[0][(i*30720)%307200], nsamp, antenna_id ); - rxp[0] = (void*)&rxdata[0][(i*30720)%307200]; - GET_TIME_VAL(0); - ret = rf_device.trx_read_func( &rf_device, ×tamp, rxp, nsamp, antenna_id ); - GET_TIME_VAL(1); - - if (ret != nsamp) - { - printf("Error: nsamp received (%d) != nsamp required (%d)\n", ret, nsamp); - fflush(stdout); - return (-1); - } - if (!is_first_ts) - { - first_ts = timestamp; - is_first_ts = 1; - } - -// printf("%d - trx_read_func ret=%d - ts = %d - @=0x%08lx\n", i, ret, timestamp, rxp[0] ); - - txp[0] = (void*)&(txdata[0][ ((i*30720)%307200+2*30720)%307200 ]); -// printf(" i=%d @txp[0][0] = 0x%016lx\n", i, &(((uint32_t *)txp[0])[0]) ); -// printf(" i=%d @txp[0][1] = 0x%016lx\n", i, &(((uint32_t *)txp[0])[1]) ); - - for ( c = 0; c < nsamp; c++ ) - { - (((uint32_t *)txp[0])[c]) = ( (((timestamp+c+2*30720)<<4)&0x0000FFF0) + (((timestamp+c+2*30720)<<8)&0xFFF00000) ); - } - -// printf(" txp[0][%d] = 0x%x\n",0,((uint32_t *)(txp[0]))[0]); -// printf(" txp[0][%d] = 0x%x\n",1,((uint32_t *)(txp[0]))[1]); -// printf(" ...\n"); -// printf(" txp[0][%d] = 0x%x\n",nsamp-2,((uint32_t *)(txp[0]))[nsamp-2]); -// printf(" txp[0][%d] = 0x%x\n",nsamp-1,((uint32_t *)(txp[0]))[nsamp-1]); - - - ret = rf_device.trx_write_func( &rf_device, (timestamp+2*30720), txp, nsamp, antenna_id, false ); - if (ret != nsamp) - { - printf("Error: nsamp sent (%d) != nsamp required (%d)\n", ret, nsamp); - fflush(stdout); - return (-1); - } - -// printf("%d - trx_write_func ret=%d - ts = %d - @=0x%08lx\n", i, ret, (timestamp+2*30720), txp[0] ); - - - if (timestamp >= (first_ts + 2 * 307200)) - { - - // check Rx Overflow - - // check Tx Underflow - - // check Expected Value - for ( c = 0; c < nsamp; c++ ) - { - -// LOOPBACK -#if 1 - expected_value = ((timestamp + c)&0xFFFFFF); - received_value = ((uint32_t *)(rxp[0]))[c]; - received_value = ((received_value)&0xFFF) + ((received_value>>4)&0xFFF000); - - if (compare_start == 0) - { - compare_start = 1; - diff = expected_value - received_value; - } - received_value = (received_value + diff)&0xFFFFFF; - -#if 1 - - if (expected_value != received_value) - { - if(!error_cnt) - error_ts_start = (timestamp + c); - else - { - if (looploop < 32) - printf("%d - %d != %d - ts %d - raw 0x%x - diff %d\n", - looploop, - expected_value, received_value, - (timestamp + c), ((uint32_t *)(rxp[0]))[c], - diff); - looploop++; - } - - error_cnt++; - - if(!(error_cnt%102400)) - printf(" -> error detected : cnt=%d - start=%ld - stop=... diff=%d\n", - error_cnt, - error_ts_start, - diff); - - } - else - { - if(error_cnt) - { - printf(" -> error detected : cnt=%d - start=%ld - stop=%ld\n\n", - error_cnt, - error_ts_start, - (timestamp + c) ); - looploop=0; - } - error_cnt=0; - } -#endif -#endif - -// DEBUG mode 0 -#if 0 - received_value = ((uint32_t *)(rxp[0]))[c]; - received_value = ((received_value)&0xFFF) + ((received_value>>4)&0xFFF000); - received_value = (received_value&0xFFFFFF); - if (compare_start == 0) - { - compare_start = 1; - expected_value = received_value; - } - else - { - expected_value++; - expected_value = (expected_value&0xFFFFFF); - } - - if (expected_value != received_value) - { - if(!error_cnt) - error_ts_start = (timestamp + c); - error_cnt++; - } - else - { - if(error_cnt) - { - printf(" -> error detected : cnt=%d - start=%ld - stop=%ld\n\n", - error_cnt, - error_ts_start, - (timestamp + c) ); - } - error_cnt=0; - } - - - -// if (expected_value != received_value) -// { -// printf("%d -> %d != %d (ts+c=%ld)(raw=0x%08x)\n", -// looploop, -// expected_value, received_value, -// (timestamp + c), -// ((uint32_t *)(rxp[0]))[c] ); -// -// if (received_value) -// expected_value = received_value; -// } -#endif - - } - } - } - - printf("HwLat Application returns !!!\n"); - fflush(stdout); - sleep(1); - - - printf("\n"); - rf_device.trx_end_func( &rf_device ); - - sleep(1); - free(sendbuff[0]); - free(sendbuff); - free(recvbuff[0]); - free(recvbuff); - - exit(0); - - - - return(0); - - - -// puts( "* Frequency modification test" ); -// rf_device.trx_set_freq_func( &rf_device, &openair0_cfg[0], 0 ); - -// puts( "* Gain modification test" ); -// rf_device.trx_set_gains_func( &rf_device, &openair0_cfg[0] ); // NOT working (cf. initialization) - -//#if LTE_UE -// sleep(1); - GET_TIME_VAL(0); - for (i = 0; i < trx_read_cnt; i++) - { - printf("\n"); - ret = rf_device.trx_read_func( &rf_device, ×tamp, rxp, nsamp, antenna_id ); - printf("* timestamp=%ld\n", timestamp); -#if 1 - for (j = 0; j < nsamp; j++) - { - if ( ((uint32_t *)rxp[0])[j] != ((expected_value + j + timestamp)%307200) ) - { - err_cnt++; - printf("rxp[%06d]=0x%08x (expected 0x%08lx)\n", j, ((uint32_t *)rxp[0])[j], ((expected_value + j + timestamp)%307200) ); - } - if (err_cnt >= 128) - { - printf("Error: more than 128 expected value failed !\n"); - i = (trx_read_cnt - 1); - j = nsamp; - break; - } - } - //expected_value = (expected_value + nsamp)%307200; - expected_value = (expected_value)%307200; -#endif - } - GET_TIME_VAL(1); -//#endif - -/* ********** ********** */ -/* SYRIQ_CHANNEL_DATA1 */ -/* ********** ********** */ -#if SYRIQ_CHANNEL_DATA1 - -// rf_device.trx_get_stats_func( &rf_device ); - - rf_device.trx_end_func( &rf_device ); - - printf("\n* rf_device.trx_read_func(%d) x %d: %.6lf s\n\n", nsamp, i, ((TIME_VAL_TO_MS(1) - TIME_VAL_TO_MS(0)))/1000.0 ); - -// rf_device.trx_get_stats_func( &rf_device ); - -#if 0 - for (i = 0; i < nsamp; i++) - { -// if ( ((uint32_t *)rxp[0])[i] != i) -// { - err_cnt++; - printf("rxp[%06d]=0x%08x (expected 0x%08x)\n", i, ((uint32_t *)rxp[0])[i], i); -// } -// if (err_cnt > 256) -// { -// i = 307200; -// break; -// } - } -#endif -// for (i = 1024-32; i < 1024+32; i++) -// { -//// if ( ((uint32_t *)rxp[0])[i] != i) -//// { -// err_cnt++; -// printf("rxp[%06d]=0x%08x (expected 0x%08x)\n", i, ((uint32_t *)rxp[0])[i], i); -//// } -// if (err_cnt > 256) -// { -// i = 307200; -// break; -// } -// } - printf("SYRIQ CHANNEL DATA1 done !!!\n"); - sleep(1); - return(0); -#endif -/* ********** ********** */ -/* SYRIQ_CHANNEL_DATA1 */ -/* ********** ********** */ - - - - timestamp = 0; - ret = rf_device.trx_write_func( &rf_device, timestamp, (void**)sendbuff, nsamp, antenna_id, false ); - printf("* rf_device.trx_write_func returns %d\n", ret); - - sleep(1); - - nsamp = 30720; - numIter = 100000; - for ( c = 0; c < numIter; c++ ) - { - fpga_loop ++; - if ( !(fpga_loop % 1000) ) - { - printf("\rtest loop %d / %d", fpga_loop, numIter); - fflush(stdout); - } - -// printf("* TEST : %08d\n", (c+1)); -// measure_time( &rf_device, &start, &stop, &tx_stats, true, 10 ); -// ret = rf_device.trx_write_func( &rf_device, timestamp, (void**)sendbuff, nsamp, antenna_id, false ); -// printf("* rf_device.trx_write_func returns %d\n", ret); -// measure_time( &rf_device, &start, &stop, &tx_stats, false, 10 ); - -// sleep(1); - -// measure_time( &rf_device, &start, &stop, &tx_stats, true, 10 ); - ret = rf_device.trx_read_func( &rf_device, ×tamp, (void**)recvbuff, nsamp, antenna_id ); -// measure_time( &rf_device, &start, &stop, &tx_stats, false, 10 ); - - // Check the data - if (ret > 0) - { -/* ********** ********** */ -/* SYRIQ_CHANNEL_TESTER */ -/* ********** ********** */ -#if SYRIQ_CHANNEL_TESTER - failure = 0; - for (i = 0; i < ret; i++) - { - if ( ((i%1024) == 0) || ((i%1024) == 1) || ((i%1024) == 2) || ((i%1024) == 3) ) - { - if ( (recvbuff[0])[i] != (1020 + ((i%1024)+1)) ) - { - printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) ); - failure = 1; - } - } - else if ( (recvbuff[0])[i] != ((i%1024)+1) ) - { - printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) ); - failure = 1; - } - else - { - printf("* DONE (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) ); - } - if(failure) - break; - } - if (failure) - printf("* ERROR recv %08d checked FAILURE ret=%d\n", (c+1), ret); - else - { -// printf("* DONE recv %08d checked SUCCESSFULLY ret=%d\n", (c+1), ret); - } -#endif -/* ********** ********** */ -/* SYRIQ_CHANNEL_TESTER2*/ -/* ********** ********** */ -#if SYRIQ_CHANNEL_TESTER2 -// printf("* ret=%d timestamp=%ld (%ld)\n", ret, timestamp, (timestamp%307200)); - failure = 0; - for (i = 0; i < ret; i++) - { -// printf("* (recvbuff[0])[%d]: %d\n", i, (uint32_t)(recvbuff[0])[i]); -// printf("* timestamp+(i/1024+1)*1024 - 3 + i%1024: %d\n", (timestamp-nsamp+(i/1024+1)*1024 - 3 + i%1024)%307200 ); - expected_value = ((((i%1024)+1)/*>>4*/)&0x00000FFF); - if ( ((i%1024) == 0) || ((i%1024) == 1) || ((i%1024) == 2) || ((i%1024) == 3) ) - { - expected_value = ((((timestamp-nsamp+(i/1024+1)*1024 - 3 + i%1024))%307200)); - if ( (recvbuff[0])[i] != expected_value) - { - if ( (expected_value == 0) && ((recvbuff[0])[i] != 4915200) ) - { - printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], expected_value ); - failure = 1; - } - if ( (expected_value == 0) && ((recvbuff[0])[i] == 4915200) ) - { -// printf("* DONE loop in circular buffer\n"); - } - } - } - else if ( (recvbuff[0])[i] != expected_value ) - { - printf("* ERROR (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) ); - failure = 1; - } - else - { -// printf("* DONE (buff[0])[%d]: %d, expected %d\n", i, (uint32_t)(recvbuff[0])[i], ((i%1024)+1) ); - } -// if(failure) -// break; - } - if (failure) - printf("* ERROR recv %08d checked FAILURE ret=%d\n", (c+1), ret); - else - { -// printf("* DONE recv %08d checked SUCCESSFULLY ret=%d\n", (c+1), ret); - } -#endif -#if LOOPBACK - -#endif - } - else - { - printf("* ERROR rf_device.trx_read_func returns %d\n", ret); - } - - } - printf("\n"); - rf_device.trx_end_func( &rf_device ); - - sleep(1); - free(sendbuff[0]); - free(sendbuff); - free(recvbuff[0]); - free(recvbuff); - - exit(0); - -// END IS HERE ! - - rf_device.trx_set_freq_func(&rf_device,&openair0_cfg[0],0); - - if (rf_device.trx_start_func(&rf_device) != 0 ) { - printf("Could not start the device\n"); - oai_exit=1; - } - - while(!oai_exit){ - - rxp[0] = (void*)&rxdata[0][sub_frame*nb_sample_per_tti]; - - readBlockSize = rf_device.trx_read_func(&rf_device, - ×tamp, - rxp, - nb_sample_per_tti, - 0); - - if ( readBlockSize != nb_sample_per_tti ) - oai_exit = 1; - - sub_frame++; - sub_frame%=10; - - if( sub_frame == 0) - frame_rx++; - - saif_meas(frame_rx, sub_frame); - } - - return(0); -} diff --git a/targets/RT/USER/lte-hwlat2.c b/targets/RT/USER/lte-hwlat2.c deleted file mode 100644 index 85ec61e44f..0000000000 --- a/targets/RT/USER/lte-hwlat2.c +++ /dev/null @@ -1,1282 +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 - */ - - -/* ************************************************************************************************* - - USER GUIDE - - 1 - CONFIGURE TEST SESSION - see TESTS PARAMETERS section below - - 2 - COMPILATION CMD LINE (same as openair compilation) - - NO AVX SUPPORT - /usr/bin/cc -msse4.1 -mssse3 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -g -DMALLOC_CHECK_=3 -O2 -o lte-hwlat-test lte-hwlat2.c -lrt -lpthread -lm -ldl - - AVX2 Support - /usr/bin/cc -mavx2 -msse4.1 -mssse3 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -g -DMALLOC_CHECK_=3 -O2 -o lte-hwlat-test lte-hwlat2.c -lrt -lpthread -lm -ldl - - - 3 - RUN - sudo cset shield --force --kthread on -c 1-3 // for 4 cores - sudo cset shield --force --kthread on -c 1-7 // for 8 cores - sudo cset shield ./lte-hwlat-test - - 4 - remove cset shield - sudo cset shield --reset - - ***************************************************************************************************/ - -/* ************************************************************************************************* - * TESTS PARAMETERS - */ -#define HWLAT_LOOP_CNT 1000000 /* measurment loop count for each thread*/ -#define HWLAT_TTI_SLEEP_US 250 /* usleep duration -> IQ capture simulation (in µ seconds) */ - -#define RX_NB_TH 6 - -#define CALIB_RT_INTRUMENTATION 0 - -/* Laurent Thpmas instrumentation -> see openair2/UTIL/LOG/log.h for full implementation - -> This is a copy and paste implementation in this file for a self contained source */ -#define INSTRUMENTATION_LT_RDTSC 1 -/* SYRTEM rdtsc instrumentation implementation (see below for more infaormation) */ -#define INSTRUMENTATION_SYR_RDTSC 2 -/* SYRTEM instrumentation using clock_gettime MONOTONIC */ -#define INSTRUMENTATION_SYR_CLOCK_MONO 3 -/* SYRTEM instrumentation using clock_gettime REALTIME */ -#define INSTRUMENTATION_SYR_CLOCK_REALTIME 4 - -#define HWLAT_INSTRUMENTATION INSTRUMENTATION_LT_RDTSC - - -/* Statistics histogram output */ -#define HISTOGRAM_MIN_VALUE 0 -#define HISTOGRAM_MAX_VALUE 2000 -#define HISTOGRAM_STEP 1 -#define HISTOGRAM_SIZE ( ( ( HISTOGRAM_MAX_VALUE - HISTOGRAM_MIN_VALUE ) / HISTOGRAM_STEP ) + 1 ) - - - -/* *************************************************************************************************/ - - -/* - * INCLUDES - */ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* For SYS_xxx definitions */ -#ifndef __STDC_FORMAT_MACROS -#define __STDC_FORMAT_MACROS -#endif -#include - - -/* From rt_wrapper.h -****************************************************************************************/ -#define gettid() syscall(__NR_gettid) // for gettid - -/* From common/utils/itti/assertions.h -****************************************************************************************/ -# define display_backtrace() - -#define _Assert_Exit_ \ -{ \ - fprintf(stderr, "\nExiting execution\n"); \ - display_backtrace(); \ - fflush(stdout); \ - fflush(stderr); \ - exit(EXIT_FAILURE); \ -} - -#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \ -do { \ - if (!(cOND)) { \ - fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \ - "In %s() %s:%d\n" fORMAT, \ - __FUNCTION__, __FILE__, __LINE__, ##aRGS); \ - aCTION; \ - } \ -} while(0) - -#define AssertFatal(cOND, fORMAT, aRGS...) _Assert_(cOND, _Assert_Exit_, fORMAT, ##aRGS) - - -/* From "openair1/PHY/TOOLS/time_meas.h" -****************************************************************************************/ -double cpu_freq_GHz; - - -typedef struct { - - long long in; - long long diff; - long long diff_now; - long long p_time; /*!< \brief absolute process duration */ - long long diff_square; /*!< \brief process duration square */ - long long max; - int trials; - int meas_flag; -} time_stats_t; - -static inline unsigned long long rdtsc_oai(void) __attribute__((always_inline)); -static inline unsigned long long rdtsc_oai(void) -{ - unsigned long long a, d; - __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d)); - return (d<<32) | a; -} - -double get_cpu_freq_GHz(void); - -static inline void reset_meas(time_stats_t *ts) { - - ts->trials=0; - ts->diff=0; - ts->diff_now=0; - ts->p_time=0; - ts->diff_square=0; - ts->max=0; - ts->meas_flag=0; - -} - -double estimate_MHz_syr(void); -static __inline__ uint64_t pickCyclesStart(void); -static __inline__ uint64_t pickCyclesStop(void); - - -/* From "openair2/UTIL/LOG/log.h" -****************************************************************************************/ -extern double cpuf; -extern double cpu_mhz_syr; - - -static __inline__ uint64_t rdtsc(void) { - uint64_t a, d; - __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d)); - return (d<<32) | a; -} - -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]); -// SYRTEM : just use printf do not include all LOG_X for this test -//#if DISABLE_LOG_X - printf("%s",txt2); -//#else -// LOG_W(PHY, "%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 uint64_t 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); // SYRTEM : Printed only a the end of the measurment loop - return diff; - } - return 0; -} - -static inline uint64_t updateTimes_syr(uint64_t start, Meas *M, int period, char * txt) { - if (start!=0) { -// uint64_t end=rdtsc(); - uint64_t end=pickCyclesStop(); - long long diff=(long long)((double)(end-start)/(cpu_mhz_syr)); -// 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); // SYRTEM : Printed only a the end of the measurment loop - return diff; - } - return 0; -} - - - - -#define initRefTimes(a) static __thread Meas a= {0} -#define pickTime(a) uint64_t a=rdtsc() -#define pickTime_syr(a) uint64_t a=pickCyclesStart() -#define readTime(a) a - - - - - - -/* - * DEFINES - */ - -#define TIMESPEC_TO_DOUBLE_US( t ) ( ( (double)t.tv_sec * 1000000 ) + ( (double)t.tv_nsec / 1000 ) ) - -typedef struct histo_time { - double max; - unsigned int count; -} histo_time_t; - -static void measure_time ( struct timespec *start, struct timespec *stop, uint8_t START, uint16_t PRINT_INTERVAL ); -static struct timespec get_timespec_diff( struct timespec *start, struct timespec *stop ); -void histogram_save_in_csv( histo_time_t *histo , char *file_prefix); -histo_time_t *histogram_init( histo_time_t *histo ); -void histogram_store_value( histo_time_t *histo, double value ); - - -#define FIFO_PRIORITY 40 - - - -#define true 1 -#define false 0 - - - - -/* - * STRUCTURES - */ - - -/* stub of UE_rxtx_proc full structure in openair1/PHY/defs.h -*/ -typedef struct UE_rxtx_proc { - int instance_cnt_rxtx; - pthread_t pthread_rxtx; - pthread_cond_t cond_rxtx; - pthread_mutex_t mutex_rxtx; - - - int sub_frame_start; - int sub_frame_step; - unsigned long long gotIQs; - - - unsigned long syr_rdtsc_rxtx_th_unlock_iteration; - uint64_t syr_rdtsc_ue_th_got_iq; - double syr_rdtsc_rxtx_th_unlock; - double syr_rdtsc_rxtx_th_unlock_max; - double syr_rdtsc_rxtx_th_unlock_mean; - double syr_rdtsc_rxtx_th_unlock_min; - histo_time_t *syr_rdtsc_rxtx_th_unlock_histogram; - -} UE_rxtx_proc_t; - - - -/* this structure is used to pass both UE phy vars and - * proc to the function UE_thread_rxn_txnp4 - */ -struct rx_tx_thread_data { - /* PHY_VARS_UE *UE; */ // UE phy vars not used for this test - UE_rxtx_proc_t *proc; // We use a stub of rxtx_proc see definition above -}; - - -// ODD / EVEN Scheduling -#if 0 -typedef struct threads_s { - int iq; - int odd; - int even; -} threads_t; -threads_t threads = { -1, -1, -1 }; // Core number for each thread (iq=3, even=2, odd=1) -#endif - -// SLOT 0 / SLOT 1 parallelization -typedef struct threads_s { - int iq; - int one; - int two; - int three; - int four; - int five; - int six; - int slot1_proc_one; - int slot1_proc_two; - int slot1_proc_three; -} threads_t; -threads_t threads= {7,6,5,4,3,2,1,-1,-1,-1}; - -/* - * FUNCTIONS DEFINITION - */ - -void *UE_thread(void *arg); -void init_UE(int nb_inst); - - - -/* - * GLOBALS VARIABLES - */ - -volatile int oai_exit = 0; -int th_count = 0; -double cpuf; -double cpu_mhz_syr; - - - - - - - -pthread_t pthread_ue; -pthread_attr_t attr_ue; - -UE_rxtx_proc_t **rxtx_proc; - -struct timespec even_start, even_stop; -struct timespec odd_start, odd_stop; - -histo_time_t *th_wake_histogram; - - -/* - * FUNCTIONS - */ - - - -void exit_fun(const char* s) { - if ( s != NULL ) { - printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s); - } - - oai_exit = 1; -} - - - - -void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name) { - -#ifdef DEADLINE_SCHEDULER - if (sched_runtime!=0) { - struct sched_attr attr= {0}; - attr.size = sizeof(attr); - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = sched_runtime; - attr.sched_deadline = sched_deadline; - attr.sched_period = 0; - AssertFatal(sched_setattr(0, &attr, 0) == 0, - "[SCHED] %s thread: sched_setattr failed %s \n", name, strerror(errno)); - LOG_I(HW,"[SCHED][eNB] %s deadline thread %lu started on CPU %d\n", - name, (unsigned long)gettid(), sched_getcpu()); - } - -#else - if (CPU_COUNT(cpuset) > 0) - AssertFatal( 0 == pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), cpuset), ""); - struct sched_param sp; - sp.sched_priority = sched_fifo; - AssertFatal(pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp)==0, - "Can't set thread priority, Are you root?\n"); - /* Check the actual affinity mask assigned to the thread */ - cpu_set_t *cset=CPU_ALLOC(CPU_SETSIZE); - if (0 == pthread_getaffinity_np(pthread_self(), CPU_ALLOC_SIZE(CPU_SETSIZE), cset)) { - char txt[512]={0}; - for (int j = 0; j < CPU_SETSIZE; j++) - if (CPU_ISSET(j, cset)) - sprintf(txt+strlen(txt), " %d ", j); - printf("CPU Affinity of thread %s is %s\n", name, txt); - } - CPU_FREE(cset); -#endif - - // Lock memory from swapping. This is a process wide call (not constraint to this thread). - mlockall(MCL_CURRENT | MCL_FUTURE); - pthread_setname_np( pthread_self(), name ); - -// SYRTEM : Synchronization thread is not simulated -> just ignore this part of code -// // LTS: this sync stuff should be wrong -// printf("waiting for sync (%s)\n",name); -// pthread_mutex_lock(&sync_mutex); -// printf("Locked sync_mutex, waiting (%s)\n",name); -// while (sync_var<0) -// pthread_cond_wait(&sync_cond, &sync_mutex); -// pthread_mutex_unlock(&sync_mutex); - printf("started %s as PID: %ld\n",name, gettid()); -} - -void init_UE(int nb_inst) -{ - int inst; - for (inst=0; inst < nb_inst; inst++) { - // UE->rfdevice.type = NONE_DEV; -// SYRTEM : we use a stub of phy_var_ue -// PHY_VARS_UE *UE = PHY_vars_UE_g[inst][0]; -// AssertFatal(0 == pthread_create(&UE->proc.pthread_ue, &UE->proc.attr_ue, UE_thread, (void*)UE), ""); - AssertFatal( 0 == pthread_create( &pthread_ue, &attr_ue, UE_thread, NULL ), "" ); - } - - printf("UE threads created by %ld\n", gettid()); -} - - -// SYRTEM - UE synchronization thread is not used in this latency test program -//static void *UE_thread_synch(void *arg) { -// ... -//} - - -// SYRTEM - Stub of UE_thread_rxn_txnp4 -// -> No DSP scheduled -// -> Only thread initialization and thread wake up are kept - -static void *UE_thread_rxn_txnp4(void *arg){ - static __thread int UE_thread_rxtx_retval; - struct rx_tx_thread_data *rtd = arg; - UE_rxtx_proc_t *proc = rtd->proc; - - proc->instance_cnt_rxtx=-1; - - char threadname[256]; - sprintf(threadname,"UE_%d_proc_%d", 0, proc->sub_frame_start); - - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - - if ( (proc->sub_frame_start)%RX_NB_TH == 0 && threads.one != -1 ) - CPU_SET(threads.one, &cpuset); - if ( (proc->sub_frame_start)%RX_NB_TH == 1 && threads.two != -1 ) - CPU_SET(threads.two, &cpuset); - if ( (proc->sub_frame_start)%RX_NB_TH == 2 && threads.three != -1 ) - CPU_SET(threads.three, &cpuset); - if ( (proc->sub_frame_start)%RX_NB_TH == 3 && threads.four != -1 ) - CPU_SET(threads.four, &cpuset); - if ( (proc->sub_frame_start)%RX_NB_TH == 4 && threads.five != -1 ) - CPU_SET(threads.five, &cpuset); - if ( (proc->sub_frame_start)%RX_NB_TH == 5 && threads.six != -1 ) - CPU_SET(threads.six, &cpuset); - //CPU_SET(threads.three, &cpuset); - init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset, - threadname); - - - proc->syr_rdtsc_rxtx_th_unlock_iteration=0; - proc->syr_rdtsc_rxtx_th_unlock_max=0; - proc->syr_rdtsc_rxtx_th_unlock_mean=0; - proc->syr_rdtsc_rxtx_th_unlock_min=1000; - proc->syr_rdtsc_rxtx_th_unlock_histogram = NULL; - proc->syr_rdtsc_rxtx_th_unlock_histogram = histogram_init (proc->syr_rdtsc_rxtx_th_unlock_histogram); - - while (!oai_exit) { - if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { - printf("[SCHED][UE] error locking mutex for UE RXTX\n" ); - exit_fun("nothing to add"); - } - while (proc->instance_cnt_rxtx < 0) { - // most of the time, the thread is waiting here - pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx ); - } - if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) { - printf("[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" ); - exit_fun("nothing to add"); - } - - - proc->syr_rdtsc_rxtx_th_unlock = (double)(pickCyclesStop()-proc->syr_rdtsc_ue_th_got_iq )/cpu_mhz_syr; - - proc->syr_rdtsc_rxtx_th_unlock_iteration++; - - proc->syr_rdtsc_rxtx_th_unlock_mean += proc->syr_rdtsc_rxtx_th_unlock; - if ( proc->syr_rdtsc_rxtx_th_unlock_max < proc->syr_rdtsc_rxtx_th_unlock ) - proc->syr_rdtsc_rxtx_th_unlock_max = proc->syr_rdtsc_rxtx_th_unlock; - if ( proc->syr_rdtsc_rxtx_th_unlock_min > proc->syr_rdtsc_rxtx_th_unlock ) - proc->syr_rdtsc_rxtx_th_unlock_min = proc->syr_rdtsc_rxtx_th_unlock; - histogram_store_value( proc->syr_rdtsc_rxtx_th_unlock_histogram, proc->syr_rdtsc_rxtx_th_unlock ); - - - if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { - printf("[SCHED][UE] error locking mutex for UE RXTX\n" ); - exit_fun("noting to add"); - } - proc->instance_cnt_rxtx--; - if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) { - printf("[SCHED][UE] error unlocking mutex for UE RXTX\n" ); - exit_fun("noting to add"); - } - } - -// thread finished - free(arg); - return &UE_thread_rxtx_retval; -} - - - - -void *UE_thread(void *arg) { - - int i = 0; - int hw_loop_cnt = 0; - - int nb_threads = RX_NB_TH; - char threadname[128]; - cpu_set_t cpuset; - struct rx_tx_thread_data *rtd; - UE_rxtx_proc_t *proc; - - CPU_ZERO( &cpuset ); - - if ( threads.iq != -1 ) - CPU_SET( threads.iq, &cpuset ); - init_thread( 100000, 500000, FIFO_PRIORITY, &cpuset, "HDW Threads" ); - - sprintf( threadname, "Main UE %d", 0 ); - pthread_setname_np( pthread_self(), threadname ); - - -// init_UE_threads(UE) - pthread_attr_init( &attr_ue ); - pthread_attr_setstacksize( &attr_ue, 8192 );//5*PTHREAD_STACK_MIN); - - for ( i = 0; i < nb_threads; i++ ) { - - printf("\n"); - - rtd = calloc( 1, sizeof( struct rx_tx_thread_data ) ); - if ( rtd == NULL ) - abort(); - - rtd->proc = rxtx_proc[i]; // &UE->proc.proc_rxtx[i]; - - pthread_mutex_init( &rxtx_proc[i]->mutex_rxtx ,NULL ); // pthread_mutex_init( &UE->proc.proc_rxtx[i].mutex_rxtx,NULL ); - pthread_cond_init( &rxtx_proc[i]->cond_rxtx, NULL ); // pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL); - rtd->proc->sub_frame_start=i; - rtd->proc->sub_frame_step=nb_threads; - printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, rxtx_proc[i]->sub_frame_start,nb_threads, i); - pthread_create( &rxtx_proc[i]->pthread_rxtx, NULL, UE_thread_rxn_txnp4, rtd ); // pthread_create( &UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_thread_rxn_txnp4, rtd); - - usleep(1000); - - } -// init_UE_threads(UE) - - - - int sub_frame=-1; - while ( !oai_exit ) { - - sub_frame++; - sub_frame %= 10; - - proc = rxtx_proc[hw_loop_cnt%RX_NB_TH]; - - // Simulate IQ reception - usleep( HWLAT_TTI_SLEEP_US ); - - proc->syr_rdtsc_ue_th_got_iq = pickCyclesStart(); - - AssertFatal(pthread_mutex_lock(&proc->mutex_rxtx) ==0,""); - - proc->instance_cnt_rxtx++; - if ( proc->instance_cnt_rxtx == 0 ) { - if ( pthread_cond_signal( &proc->cond_rxtx) != 0 ) { - exit_fun( "nothing to add" ); - } - } else { - if ( proc->instance_cnt_rxtx > 2 ) - exit_fun( "instance_cnt_rxtx > 2" ); - } - - AssertFatal( pthread_cond_signal( &proc->cond_rxtx ) == 0 ,"" ); - AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); - - - /* Do not go indefinitely */ - hw_loop_cnt++; - - if ( hw_loop_cnt%1000 == 0 ) - { - printf("\r%d/%d",hw_loop_cnt,HWLAT_LOOP_CNT*RX_NB_TH); - fflush(stdout); - } - - if (hw_loop_cnt >= HWLAT_LOOP_CNT*RX_NB_TH) - { - printf("\n\n"); - for (i=0 ; ipthread_rxtx,threadname,128 ); - printf("RxTX Thread unlock latency on thread %s (it. %lu) (us) : max=%8.3f - mean=%8.3f - min=%8.3f\n", - threadname, - proc->syr_rdtsc_rxtx_th_unlock_iteration, - proc->syr_rdtsc_rxtx_th_unlock_max, - proc->syr_rdtsc_rxtx_th_unlock_mean/proc->syr_rdtsc_rxtx_th_unlock_iteration, - proc->syr_rdtsc_rxtx_th_unlock_min); - - histogram_save_in_csv(proc->syr_rdtsc_rxtx_th_unlock_histogram, threadname ); - - } - printf("\n\n"); - oai_exit = 1; - } - - } // while !oai_exit - - oai_exit = 1; - - return NULL; -} - -#define CALIB_LOOP_CNT 1000000 //2000000000 -#define CALIB_LOOP_REPORT_PERIOD 1000 -#define CALIB_LOOP_UP_THRESHOLD 20 // 20 -> for NG Intel flat model -#define CALIB_USLEEP 250 - -int main( void ) -{ - - int i; - - -#if CALIB_RT_INTRUMENTATION - uint32_t calib_loop_count; - - - uint64_t lt_overhead_cur; - uint64_t lt_overhead_min; - uint64_t lt_overhead_max; - uint64_t lt_overhead_mean; - histo_time_t *lt_overhead_histogram = NULL; - - uint64_t lt_syr_overhead_cur; - uint64_t lt_syr_overhead_min; - uint64_t lt_syr_overhead_max; - uint64_t lt_syr_overhead_mean; - histo_time_t *lt_syr_overhead_histogram = NULL; - - double syr_rdtsc_overhead_cur; - double syr_rdtsc_overhead_min; - double syr_rdtsc_overhead_max; - double syr_rdtsc_overhead_mean; - histo_time_t *syr_rdtsc_overhead_histogram = NULL; - - double syr_clock_gettime_overhead_cur; - double syr_clock_gettime_overhead_min; - double syr_clock_gettime_overhead_max; - double syr_clock_gettime_overhead_mean; - histo_time_t *syr_clock_gettime_overhead_histogram = NULL; - - - uint64_t cycles_start; - uint64_t cycles_stop; - - uint64_t cycles_diff; - uint64_t cycles_diff_max = 0; - - - struct timespec start; - struct timespec stop; -#endif - - cpuf = get_cpu_freq_GHz(); - cpu_mhz_syr = estimate_MHz_syr(); - - printf("\n\ncpuf %f - cpu_mhz_syr %f\n\n", cpuf, cpu_mhz_syr); - -#if CALIB_RT_INTRUMENTATION - - /* ********************************************************************************************** */ - /* CALIBRATION */ - /* ********************************************************************************************** */ - - /* ************************************************************* - Laurent Thomas instrumentation overhead - */ - printf("\nCalibrating OAI Realtime Instrumentation (Laurent Thomas imp.)\n"); - calib_loop_count = CALIB_LOOP_CNT; - initRefTimes(lt_instru_calib); // Laurent Thomas realtime instrumentation calibration measurments - lt_overhead_min = 1000; - lt_overhead_max = 0; - lt_overhead_mean = 0; - lt_overhead_histogram = histogram_init( lt_overhead_histogram ); - while(calib_loop_count) - { - pickTime(lt_start); - -// asm volatile(""); // Nop instruction - usleep(CALIB_USLEEP); - - lt_overhead_cur = updateTimes( readTime(lt_start), - <_instru_calib, - CALIB_LOOP_CNT, - "Laurent Thomas realtime instrumentation calibration measurments"); - - lt_overhead_mean += lt_overhead_cur; - if ( lt_overhead_max < lt_overhead_cur ) - lt_overhead_max = lt_overhead_cur; - if ( lt_overhead_min > lt_overhead_cur ) - lt_overhead_min = lt_overhead_cur; - histogram_store_value( lt_overhead_histogram, (double)lt_overhead_cur ); - - if ( calib_loop_count%CALIB_LOOP_REPORT_PERIOD == 0 ) - { - printf("\r%d/%d",calib_loop_count,CALIB_LOOP_CNT); - fflush(stdout); - } - - calib_loop_count--; - } - lt_overhead_mean = lt_overhead_mean/CALIB_LOOP_CNT; - -// printMeas("\nLaurent Thomas realtime instrumentation calibration measurments",<_instru_calib,CALIB_LOOP_CNT); - - - /* ************************************************************* - Laurent Thomas instrumentation overhead - */ - printf("\nCalibrating OAI Realtime Instrumentation - SYRTEM revisited\n"); - calib_loop_count = CALIB_LOOP_CNT; - initRefTimes(lt_instru_calib_syr); // Laurent Thomas realtime instrumentation calibration measurments - lt_syr_overhead_min = 1000; - lt_syr_overhead_max = 0; - lt_syr_overhead_mean = 0; - lt_syr_overhead_histogram = histogram_init( lt_syr_overhead_histogram ); - while(calib_loop_count) - { - pickTime_syr(lt_start_syr); - -// asm volatile(""); // Nop instruction - usleep(CALIB_USLEEP); - - lt_syr_overhead_cur = updateTimes_syr(readTime(lt_start_syr), <_instru_calib_syr, CALIB_LOOP_CNT, "Laurent Thomas realtime instrumentation calibration measurments (SYRTEM Update)"); - - lt_syr_overhead_mean += lt_syr_overhead_cur; - if ( lt_syr_overhead_max < lt_syr_overhead_cur ) - lt_syr_overhead_max = lt_syr_overhead_cur; - if ( lt_syr_overhead_min > lt_syr_overhead_cur ) - lt_syr_overhead_min = lt_syr_overhead_cur; - histogram_store_value( lt_syr_overhead_histogram, (double)lt_syr_overhead_cur ); - - if ( calib_loop_count%CALIB_LOOP_REPORT_PERIOD == 0 ) - { - printf("\r%d/%d",calib_loop_count,CALIB_LOOP_CNT); - fflush(stdout); - } - - calib_loop_count--; - } - lt_syr_overhead_mean = lt_syr_overhead_mean / CALIB_LOOP_CNT; - -// printMeas("\nLaurent Thomas realtime instrumentation calibration measurments (SYRTEM Update)",<_instru_calib_syr,CALIB_LOOP_CNT); - - - - /* ************************************************************* - SYRTEM RDTSC instrumentation overhead - */ - printf("\nCalibrating SYRTEM RDTSC Realtime Instrumentation\n"); - calib_loop_count = CALIB_LOOP_CNT; - syr_rdtsc_overhead_min = 1000; - syr_rdtsc_overhead_max = 0; - syr_rdtsc_overhead_mean = 0; - syr_rdtsc_overhead_histogram = histogram_init( syr_rdtsc_overhead_histogram ); - while(calib_loop_count) - { - - cycles_start = pickCyclesStart(); - -// asm volatile(""); // Nop instruction - usleep(CALIB_USLEEP); - - cycles_stop = pickCyclesStop(); - - cycles_diff = cycles_stop - cycles_start; - if(cycles_diff_max < cycles_diff) - cycles_diff_max = cycles_diff; - - syr_rdtsc_overhead_cur = (double)cycles_diff/cpu_mhz_syr; - - syr_rdtsc_overhead_mean += syr_rdtsc_overhead_cur; - if ( syr_rdtsc_overhead_max < syr_rdtsc_overhead_cur ) - syr_rdtsc_overhead_max = syr_rdtsc_overhead_cur; - if ( syr_rdtsc_overhead_min > syr_rdtsc_overhead_cur ) - syr_rdtsc_overhead_min = syr_rdtsc_overhead_cur; - histogram_store_value( syr_rdtsc_overhead_histogram, (double)syr_rdtsc_overhead_cur ); - - if ( calib_loop_count%CALIB_LOOP_REPORT_PERIOD == 0 ) - { - printf("\r%d/%d",calib_loop_count,CALIB_LOOP_CNT); - fflush(stdout); - } - - calib_loop_count--; - } - syr_rdtsc_overhead_mean = syr_rdtsc_overhead_mean / CALIB_LOOP_CNT; - -// printf("\nSYRTEM RDTSV realtime instrumentation calibration : cycles_diff_max %ld - tsc_duration_max %f us\n ", cycles_diff_max, tsc_duration_max); - - - - /* ************************************************************* - SYRTEM Clock_gettime MONOTONIC instrumentation overhead - */ - printf("\nCalibrating SYRTEM clock_gettime Realtime Instrumentation\n"); - calib_loop_count = CALIB_LOOP_CNT; - syr_clock_gettime_overhead_min = 1000; - syr_clock_gettime_overhead_max = 0; - syr_clock_gettime_overhead_mean = 0; - syr_clock_gettime_overhead_histogram = histogram_init( syr_clock_gettime_overhead_histogram ); - while(calib_loop_count) - { - - clock_gettime( CLOCK_MONOTONIC, &start ); - -// asm volatile(""); // Nop instruction - usleep(CALIB_USLEEP); - - clock_gettime( CLOCK_MONOTONIC, &stop ); - syr_clock_gettime_overhead_cur = TIMESPEC_TO_DOUBLE_US( get_timespec_diff( &start, &stop ) ); - - syr_clock_gettime_overhead_mean += syr_clock_gettime_overhead_cur; - if ( syr_clock_gettime_overhead_max < syr_clock_gettime_overhead_cur ) - syr_clock_gettime_overhead_max = syr_clock_gettime_overhead_cur; - if ( syr_clock_gettime_overhead_min > syr_clock_gettime_overhead_cur ) - syr_clock_gettime_overhead_min = syr_clock_gettime_overhead_cur; - histogram_store_value( syr_clock_gettime_overhead_histogram, (double)syr_clock_gettime_overhead_cur ); - - if ( calib_loop_count%CALIB_LOOP_REPORT_PERIOD == 0 ) - { - printf("\r%d/%d",calib_loop_count,CALIB_LOOP_CNT); - fflush(stdout); - } - - calib_loop_count--; - } - syr_clock_gettime_overhead_mean = syr_clock_gettime_overhead_mean / CALIB_LOOP_CNT; - -// printf("\nSYRTEM clock_gettime MONOTONIC calibration : clock_gettime duration_max %f us\n ", max); - - - printf("\n"); - - printf("OAI LT RT profiling overhead (it. %d) (us) : max=%8ld - mean=%8ld - min=%8ld\n", - CALIB_LOOP_CNT, - lt_overhead_max, lt_overhead_mean, lt_overhead_min); - printf("OAI SYR RT profiling overhead (it. %d) (us) : max=%8ld - mean=%8ld - min=%8ld\n", - CALIB_LOOP_CNT, - lt_syr_overhead_max, lt_syr_overhead_mean, lt_syr_overhead_min); - printf("SYR RDTSC profiling overhead (it. %d) (us) : max=%8.3f - mean=%8.3f - min=%8.3f\n", - CALIB_LOOP_CNT, - syr_rdtsc_overhead_max, syr_rdtsc_overhead_mean, syr_rdtsc_overhead_min); - printf("SYR clock_gettime profiling overhead (it. %d) (us): max=%8.3f - mean=%8.3f - min=%8.3f\n", - CALIB_LOOP_CNT, - syr_clock_gettime_overhead_max, syr_clock_gettime_overhead_mean, syr_clock_gettime_overhead_min); - - return 0; -#endif - - rxtx_proc = calloc( RX_NB_TH, sizeof( UE_rxtx_proc_t* ) ); - for (i=0 ; i - * Small changes by David Sterba - * - */ - - struct timespec start; - struct timespec stop; - - unsigned long long int cycles[2]; /* must be 64 bit */ - double microseconds; /* total time taken */ - - - /* get this function in cached memory */ - cycles[0] = rdtsc (); - clock_gettime( CLOCK_REALTIME, &start ); - - /* we don't trust that this is any specific length of time */ - usleep (100000); - - cycles[1] = rdtsc (); - clock_gettime( CLOCK_REALTIME, &stop ); - microseconds = TIMESPEC_TO_DOUBLE_US( get_timespec_diff( &start, &stop ) ); - - unsigned long long int elapsed = 0; - if (cycles[1] < cycles[0]) - { - //printf("c0 = %llu c1 = %llu",cycles[0],cycles[1]); - elapsed = UINT32_MAX - cycles[0]; - elapsed = elapsed + cycles[1]; - //printf("c0 = %llu c1 = %llu max = %llu elapsed=%llu\n",cycles[0], cycles[1], UINT32_MAX,elapsed); - } - else - { - elapsed = cycles[1] - cycles[0]; - // printf("\nc0 = %llu c1 = %llu elapsed=%llu\n",cycles[0], cycles[1],elapsed); - } - - double mhz = elapsed / microseconds; - - - //printf("%llg MHz processor (estimate). diff cycles=%llu microseconds=%llu \n", mhz, elapsed, microseconds); - //printf("%g elapsed %llu microseconds %llu\n",mhz, elapsed, microseconds); - return (mhz); -} - - - -/** TSC Timestamp references - - - http://oliveryang.net/2015/09/pitfalls-of-TSC-usage/#312-tsc-sync-behaviors-on-smp-system - - https://www.intel.com/content/www/us/en/embedded/training/ia-32-ia-64-benchmark-code-execution-paper.html - - https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3b-part-2-manual.pdf - - - http://blog.tinola.com/?e=54 - - https://stackoverflow.com/questions/24392392/getting-tsc-frequency-from-proc-cpuinfo !! warning on turbo - - https://gist.github.com/nfarring/1624742 - - https://www.lmax.com/blog/staff-blogs/2015/10/25/time-stamp-counters/ - - https://github.com/cyring/CoreFreq - - https://patchwork.kernel.org/patch/9438133/ --> TSC_ADJUST - to be checked - -> https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/388964 - - https://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=11&ved=0ahUKEwjwpJbem5DVAhWBDpoKHXv0Dt04ChAWCCIwAA&url=https%3A%2F%2Fsigarra.up.pt%2Ffeup%2Fpt%2Fpub_geral.show_file%3Fpi_gdoc_id%3D809041&usg=AFQjCNFHTMjmjWMG6QSVnLDflEoU0RavKw&cad=rja - - https://unix4lyfe.org/benchmarking/ - - https://stackoverflow.com/questions/27693145/rdtscp-versus-rdtsc-cpuid - - https://github.com/dterei/tsc/blob/master/tsc.h - - https://software.intel.com/en-us/forums/intel-isa-extensions/topic/280440 - - https://stackoverflow.com/questions/19941588/wrong-clock-cycle-measurements-with-rdtsc - - - -*/ - - - - - - -static __inline__ uint64_t pickCyclesStart(void) { - unsigned cycles_low, cycles_high; - asm volatile( "CPUID\n\t" // serialize - "RDTSC\n\t" // read clock - "MOV %%edx, %0\n\t" - "MOV %%eax, %1\n\t" - : "=r" (cycles_high), "=r" (cycles_low) - :: "%rax", "%rbx", "%rcx", "%rdx" ); -return ((uint64_t) cycles_high << 32) | cycles_low; -} - -static __inline__ uint64_t pickCyclesStop(void) { - uint32_t eax, edx; - - __asm__ __volatile__("rdtscp" - : "=a" (eax), "=d" (edx) - : - : "%ecx", "memory"); - -return (((uint64_t)edx << 32) | eax); -} - - - - - - - - -/************************************************************************************** - EXTRACT from openair1/PHY/TOOLS/time_meas.c -***************************************************************************************/ -double get_cpu_freq_GHz(void) { - - time_stats_t ts = {0}; - reset_meas(&ts); - ts.trials++; - ts.in = rdtsc_oai(); - sleep(1); - ts.diff = (rdtsc_oai()-ts.in); - cpu_freq_GHz = (double)ts.diff/1000000000; - printf("CPU Freq is %f \n", cpu_freq_GHz); - return cpu_freq_GHz; -} - - - -/************************************************************************************** - SYRTEM STATISTICS HELPER -***************************************************************************************/ - - - -histo_time_t *histogram_init(histo_time_t *histo ) -{ - int i = 0; - double max_val = HISTOGRAM_MIN_VALUE + HISTOGRAM_STEP; - - histo = calloc( HISTOGRAM_SIZE, sizeof( histo_time_t ) ); - if ( histo == NULL ) { - printf( "ERROR allocating histogram structure !\n" ); - return NULL; - } - - for ( i = 0; i < HISTOGRAM_SIZE; i++ ) { - histo[i].max = max_val; - max_val += HISTOGRAM_STEP; - } - - return histo; -} - - -void histogram_store_value( histo_time_t *histo, double value ) -{ - int i = 0; - - for ( i = 0; i < HISTOGRAM_SIZE; i++ ) { - if ( histo[i].max >= value || ( i + 1 ) == HISTOGRAM_SIZE ) { - histo[i].count++; - break; - } - } -} - - -void histogram_save_in_csv( histo_time_t *histo , char *file_sufix) -{ - char *csv_filename; - char month[3], day[3], hour[3], min[3], sec[3]; - time_t curr_time; - struct tm *datetime; - - curr_time = time( NULL ); - datetime = localtime( &curr_time ); - - csv_filename = calloc( sizeof( char ), 64 ); - if ( csv_filename == NULL ) { - return; - } - - memset( csv_filename, 0x00, 64 ); - memset( month, 0x00, 3 ); - memset( day, 0x00, 3 ); - memset( hour, 0x00, 3 ); - memset( min, 0x00, 3 ); - memset( sec, 0x00, 3 ); - -/* Month. */ - if ( datetime->tm_mon < 9 ) - snprintf( month, 3, "0%d", datetime->tm_mon + 1 ); - else - snprintf( month, 3, "%d", datetime->tm_mon + 1 ); - -/* Day. */ - if ( datetime->tm_mday < 10 ) - snprintf( day, 3, "0%d", datetime->tm_mday ); - else - snprintf( day, 3, "%d", datetime->tm_mday ); - -/* Hour. */ - if ( datetime->tm_hour < 10 ) - snprintf( hour, 3, "0%d", datetime->tm_hour ); - else - snprintf( hour, 3, "%d", datetime->tm_hour ); - -/* Minute. */ - if ( datetime->tm_min < 10 ) - snprintf( min, 3, "0%d", datetime->tm_min ); - else - snprintf( min, 3, "%d", datetime->tm_min ); - -/* Second. */ - if ( datetime->tm_sec < 10 ) - snprintf( sec, 3, "0%d", datetime->tm_sec ); - else - snprintf( sec, 3, "%d", datetime->tm_sec ); - - snprintf( csv_filename, 63, "ADRV9371_ZC706_HISTO_UEtoRXTX_%d%s%s%s%s%s_%s.csv", - datetime->tm_year + 1900, month, day, hour, min, sec, file_sufix ); - - FILE *fp; - int i = 0; - int min_val = 0; - - fp = fopen( csv_filename, "w+" ); - - fprintf( fp, "range;count\n" ); - - for ( i = 0; i < HISTOGRAM_SIZE; i++ ) { - if ( i + 1 == HISTOGRAM_SIZE ) - fprintf( fp, "%d+;%u\n", min_val, histo[i].count ); - else - fprintf( fp, "%d-%.0f;%u\n", min_val, histo[i].max, histo[i].count ); - min_val = histo[i].max; - } - free(csv_filename); - fclose( fp ); -} - - - -static struct timespec get_timespec_diff( - struct timespec *start, - struct timespec *stop ) -{ - struct timespec result; - - if ( ( stop->tv_nsec - start->tv_nsec ) < 0 ) { - result.tv_sec = stop->tv_sec - start->tv_sec - 1; - result.tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000; - } - else { - result.tv_sec = stop->tv_sec - start->tv_sec; - result.tv_nsec = stop->tv_nsec - start->tv_nsec; - } - - return result; -} - - -static void measure_time ( - struct timespec *start, - struct timespec *stop, - uint8_t START, - uint16_t PRINT_INTERVAL ) -{ - static double max = 0; - static double min = 0; - static double total = 0; - static int count = 0; - - if ( START ) { - clock_gettime( CLOCK_REALTIME, start ); - } - else { - clock_gettime( CLOCK_REALTIME, stop ); - - struct timespec diff; - double current = 0; - - diff = get_timespec_diff( start, stop ); -// current = ( (double)diff.tv_sec * 1000000 ) + ( (double)diff.tv_nsec / 1000 ); - current = TIMESPEC_TO_DOUBLE_US( diff ); - - if ( current > max ) { - max = current; - } - if ( min == 0 || current < min ) { - min = current; - } - total += current; - - histogram_store_value( th_wake_histogram, current ); - - if ( count % PRINT_INTERVAL == 0 && count != 0 ) { - double avg = total / ( count + 1 ); - printf( "[%d] Current : %.2lf µs, Min : %.2lf µs, Max : %.2lf µs, Moy : %.2lf µs\n", - count, current, min, max, avg ); - } - count++; - } -} - - - - - - - - - - - - - - - - diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 8ad610f1af..7e897c7deb 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -48,7 +48,6 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include "assertions.h" -#include "msc.h" #include "PHY/defs_common.h" #include "PHY/types.h" #include "PHY/INIT/phy_init.h" @@ -62,7 +61,6 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "targets/ARCH/COMMON/common_lib.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" -//#include "PHY/TOOLS/time_meas.h" /* these variables have to be defined before including ENB_APP/enb_paramdef.h */ static int DEFBANDS[] = {7}; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 85e493f194..07f900b641 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -34,13 +34,9 @@ #define _GNU_SOURCE /* See feature_test_macros(7) */ #include -#include - - #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include "assertions.h" -#include "msc.h" #include "PHY/types.h" @@ -79,7 +75,6 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "common/utils/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" #include "enb_config.h" -//#include "PHY/TOOLS/time_meas.h" #include "create_tasks.h" @@ -499,8 +494,6 @@ static void init_pdcp(void) { pdcp_set_rlc_data_req_func(rlc_data_req); pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } - } else { - pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind); } } @@ -555,13 +548,7 @@ int main ( int argc, char **argv ) cpuf=get_cpu_freq_GHz(); printf("ITTI init, useMME: %i\n",EPC_MODE_ENABLED); itti_init(TASK_MAX, tasks_info); - // allows to forward in wireshark L2 protocol for decoding - // initialize mscgen log after ITTI - if (get_softmodem_params()->start_msc) { - load_module_shlib("msc",NULL,0,&msc_interface); - } - MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); // to make a graceful exit when ctrl-c is pressed set_softmodem_sighandler(); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index cf35a13fe9..0267ad8ce0 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -23,14 +23,12 @@ #include "../../ARCH/COMMON/common_lib.h" //#undef MALLOC #include "assertions.h" -#include "msc.h" #include "PHY/types.h" #include "PHY/defs_eNB.h" #include "PHY/defs_UE.h" #include "flexran_agent.h" #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" -#include "proto_agent.h" #include "executables/softmodem-common.h" diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 1643ca36ca..2e95e56d85 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -815,11 +815,6 @@ static void *UE_thread_rxn_txnp4(void *arg) pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx ); } - //printf("Processing sub frqme %d in %s\n", proc->subframe_rx, threadname); - initRefTimes(t2); - initRefTimes(t3); - pickTime(current); - updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)"); // Process Rx data for one sub-frame lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx); @@ -886,7 +881,6 @@ static void *UE_thread_rxn_txnp4(void *arg) if (UE->mode != loop_through_memory) phy_procedures_UE_S_TX(UE,0,0); - updateTimes(current, &t3, 10000, "Delay to process sub-frame (case 3)"); proc->instance_cnt_rxtx--; if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM ) { @@ -1470,12 +1464,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) oai_subframe_ind(proc->frame_rx, proc->subframe_rx); } - //Guessing that the next 4 lines are not needed for the phy_stub mode. - /*initRefTimes(t2); - initRefTimes(t3); - pickTime(current); - updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/ - if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); exit_fun("nothing to add"); @@ -2225,8 +2213,6 @@ void *UE_thread(void *arg) LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); } - pickTime(gotIQs); - /* no timeout in IS_SOFTMODEM_BASICSIM or IS_SOFTMODEM_RFSIM mode */ if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) { ret = pthread_mutex_lock(&proc->mutex_rxtx); @@ -2264,12 +2250,6 @@ void *UE_thread(void *arg) } } - //UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs); - //UE->proc.proc_rxtx[1].gotIQs=readTime(gotIQs); - for (th_id=0; th_id < RX_NB_TH; th_id++) { - UE->proc.proc_rxtx[th_id].gotIQs=readTime(gotIQs); - } - proc->subframe_rx=sub_frame; proc->subframe_tx=(sub_frame+4)%10; proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); @@ -2281,10 +2261,6 @@ void *UE_thread(void *arg) T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx)); AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,""); AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,""); - initRefTimes(t1); - initStaticTime(lastTime); - updateTimes(lastTime, &t1, 20000, "Delay between two IQ acquisitions (case 1)"); - pickStaticTime(lastTime); } else { printf("Processing subframe %d",proc->subframe_rx); getchar(); diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 4395694bf4..2b39bd3f0f 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -37,7 +37,6 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include "assertions.h" -#include "msc.h" #include "PHY/types.h" @@ -596,12 +595,6 @@ int main( int argc, char **argv ) { printf("ITTI init\n"); itti_init(TASK_MAX, tasks_info); - // initialize mscgen log after ITTI - if (get_softmodem_params()->start_msc) { - load_module_shlib("msc",NULL,0,&msc_interface); - } - - MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); ue_id_g = (node_number == 0) ? 0 : node_number-2; //ue_id_g = 0, 1, ..., if(node_number == 0) diff --git a/targets/RT/USER/ru_control.c b/targets/RT/USER/ru_control.c index 7280c78523..083b5f91ef 100644 --- a/targets/RT/USER/ru_control.c +++ b/targets/RT/USER/ru_control.c @@ -46,7 +46,6 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include "assertions.h" -#include "msc.h" #include "PHY/types.h" diff --git a/targets/SCRIPTS/msc_gen.py b/targets/SCRIPTS/msc_gen.py deleted file mode 100755 index ed5d337fc2..0000000000 --- a/targets/SCRIPTS/msc_gen.py +++ /dev/null @@ -1,329 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# The aim of this script is to collect some traces from oai stack and generate a sequence diagram image (png or jpeg). -# -# It is supposed that a protocol name (MSC_NEW_STR) starts with...its name (RRC, MAC, NAS, S1AP, etc) then is followed by an underscore and whatever (RRC_UE, RRC_eNB) -# Like this it is possible to distinguish between PDUS, SDUs or other messages only by reading source ans destination - -import sys -import subprocess -import re -import socket -import datetime -from datetime import date -import os, errno -import argparse - - - - -parser = argparse.ArgumentParser() -parser.add_argument("--diag_rlc_um", "-u", type=str,help="Try to find RLC protocol diagnostics", default="no") -parser.add_argument("--dir", "-d", type=str,help="Directory where msc logs can be found", default="/tmp") -parser.add_argument("--profile", "-p", type=str,help="E_UTRAN, EPC", default="EPC") -parser.add_argument("--no_message", "-M", type=str,help="Trace PDUs, not messages, SDUs", default="no") -parser.add_argument("--no_pdu", "-P", type=str,help="Trace messages, SDUs, not PDUs", default="no") -parser.add_argument("--no_event", "-E", type=str,help="Do not trace events", default="no") -args = parser.parse_args() - -MSCGEN_OUTPUT_TYPE = "png" -MAX_MESSAGES_PER_PAGE = 36 - -MSC_NEW_STR = '[PROTO]' -MSC_MSG_STR = '[MESSAGE]' -MSC_BOX_STR = '[EVENT]' - - -# This list is filled as follow : g_proto_names[module_id_int] = (proto_name), example RRC_UE -g_proto_names = [] -# This list is filled as follow : g_proto_names[module_id_int] = (basename proto_name) example: RRC -g_proto_types = [] - - - -# list of messages -g_messages = {} - - -# Display color of messages of sending entities -g_display_color = ['\"teal\"', # To check in msc.h: MSC_NAS_UE - '\"red\"', # To check in msc.h: MSC_RRC_UE - '\"red\"', # To check in msc.h: MSC_NAS_UE - '\"red\"', # To check in msc.h: MSC_PDCP_UE - '\"red\"', # To check in msc.h: MSC_RLC_UE - '\"red\"', # To check in msc.h: MSC_MAC_UE - '\"red\"', # To check in msc.h: MSC_PHY_UE - '\"indigo\"', # To check in msc.h: MSC_PHY_ENB - '\"indigo\"', # To check in msc.h: MSC_MAC_ENB - '\"indigo\"', # To check in msc.h: MSC_RLC_ENB - '\"indigo\"', # To check in msc.h: MSC_PDCP_ENB - '\"orange\"', # To check in msc.h: MSC_RRC_ENB - '\"black\"', # To check in msc.h: MSC_IP_ENB - '\"black\"', # To check in msc.h: MSC_S1AP_ENB - '\"black\"', # To check in msc.h: MSC_GTPU_ENB - '\"black\"', # To check in msc.h: MSC_GTPU_SGW - '\"black\"', # To check in msc.h: MSC_S1AP_MME - '\"black\"', # To check in msc.h: MSC_MMEAPP_MME - '\"black\"', # To check in msc.h: MSC_NAS_MME - '\"black\"', # To check in msc.h: MSC_NAS_EMM_MME - '\"black\"', # To check in msc.h: MSC_NAS_ESM_MME - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"', - '\"black\"'] - - -# helper for diagnostic of RLC -g_diag_rlc_sn = {} - -g_sequence_generator = 0 - - -g_filenames = [] -if "E_UTRAN" == args.profile.strip(): - g_filenames = [ - args.dir+'/openair.msc.0.log', - args.dir+'/openair.msc.1.log'] -elif "EPC" == args.profile.strip(): - g_filenames = [ - args.dir+'/openair.msc.2.log', - args.dir+'/openair.msc.3.log', - args.dir+'/openair.msc.4.log'] - -def sequence_number_generator(): - global g_sequence_generator - l_seq = g_sequence_generator - g_sequence_generator = g_sequence_generator + 1 - return l_seq - -def file_is_empty(fpath): - return False if os.path.isfile(fpath) and os.path.getsize(fpath) > 0 else True - -def parse_oai_log_files(): - global g_entities_dic - global g_entities - global g_messages - global g_final_display_order_list - #open TXT file that contain OAI filtered traces for mscgen - - # we may insert diagnostic events - event_id_offset = 0 - for filename in g_filenames: - if file_is_empty(filename): - continue - try: - fhandle = open(filename, 'r') - fcontent = fhandle.read() - fhandle.close() - - # split file content in lines - lines = fcontent.splitlines() - for line in lines: - print ("INPUT LINE: %s " % line) - if line.strip() != "" and not line.strip().startswith('#'): - partition = line.split(' ',3) - event_id = int(partition[0]) + event_id_offset - event_type = partition[1] - entity_id = int(partition[2]) - if MSC_NEW_STR == event_type: - entity_name = partition[3] - if len(g_proto_names) <= entity_id: - for i in range(len(g_proto_names),(entity_id +1)): - g_proto_names.append("NotDeclared") - g_proto_types.append("NotDeclared") - g_proto_names[entity_id] = entity_name - partition_name1 = entity_name.split('_',1); - partition_name2 = partition_name1[0].split('-',1); - partition_name3 = partition_name2[0].split(); - g_proto_types[entity_id] = partition_name3 - print ("entity name %s , entity type %s" % (g_proto_names[entity_id],g_proto_types[entity_id]) ) - # if line is a trace of a message between 2 protocol entities or layers - elif MSC_MSG_STR == event_type: - #print ("partition[3]:%s" % partition[3]) - sub_partition = partition[3].split(' ',4) - arrow = sub_partition[0] - entity2_id = int(sub_partition[1]) - mac = int(sub_partition[2]) - time = sub_partition[3] - message = sub_partition[4] - Message = {} - Message['mac'] = mac - Message['time'] = time - Message['message'] = message - Message['line_color'] = g_display_color[entity_id] - Message['text_color'] = g_display_color[entity_id] - if arrow == '<-': - if "yes" == args.diag_rlc_um.strip() and "DATA SN " in message and "RB UM " in message: - rlc_key = re.match(r"[^[]*\[([^]]*)\]", message).groups()[0] - sn_info = message.partition("SN")[2] - if sn_info.strip() != "": - sn_str = sn_info.strip().partition(" ")[0] - sn = int(sn_str) - if rlc_key in g_diag_rlc_sn: - previous_sn = g_diag_rlc_sn[rlc_key] - if (previous_sn + 1) % 1024 != sn: - print ("DIAG missing SN: %s " % line) - MessageDiag = {} - MessageDiag['type'] = "box" - MessageDiag['tx'] = entity_id - MessageDiag['rx'] = entity_id - MessageDiag['discarded'] = False - MessageDiag['time'] = time - MessageDiag['message'] = "Missing SN "+ sn_str + " detected" - MessageDiag['line_color'] = '\"red\"' - MessageDiag['text_color'] = '\"red\"' - g_messages[event_id + event_id_offset] = MessageDiag - event_id_offset = event_id_offset + 1 - g_diag_rlc_sn[rlc_key] = int(sn) - Message['type'] = "rx" - Message['tx'] = entity2_id - Message['rx'] = entity_id - Message['discarded'] = False - g_messages[event_id + event_id_offset] = Message - - elif arrow == '->': - Message['type'] = "tx" - Message['tx'] = entity_id - Message['rx'] = entity2_id - Message['discarded'] = False - g_messages[event_id + event_id_offset] = Message - elif arrow == 'x-': - Message['type'] = "rx" - Message['tx'] = entity2_id - Message['rx'] = entity_id - Message['discarded'] = True - g_messages[event_id + event_id_offset] = Message - elif arrow == '-x': - Message['type'] = "tx" - Message['tx'] = entity_id - Message['rx'] = entity2_id - Message['discarded'] = True - g_messages[event_id + event_id_offset] = Message - - elif MSC_BOX_STR == event_type: - sub_partition = partition[3].split(' ',1) - time = sub_partition[0] - message = sub_partition[1] - Message = {} - Message['type'] = "box" - Message['tx'] = entity_id - Message['rx'] = entity_id - Message['discarded'] = False - Message['time'] = time - Message['message'] = message - Message['line_color'] = g_display_color[entity_id] - Message['text_color'] = g_display_color[entity_id] - g_messages[event_id + event_id_offset] = Message - - except IOError, e: - print ("File %s INPUT LINE: %s " % (filename, line)) - print 'err message' - - #print("------------------------------------") - #print (" %s " % ( g_messages ) ) - -# for event_id_int in sorted(g_messages.iterkeys()): - - - -def msc_chart_write_header(fileP): - global g_final_display_order_list - fileP.write("msc {\n") - fileP.write("width = \"2048\";\n") - - entity_line_list_str = '' - #print (" %s " % ( g_proto_names ) ) - for entity in g_proto_names: - if entity != 'NotDeclared': - entity_line_list_str = entity_line_list_str + ' ' + entity + ',' - - entity_line_list_str = entity_line_list_str.rstrip().strip(',') - fileP.write(" %s;\n" % (entity_line_list_str)) - - -def msc_chart_write_footer(fileP): - fileP.write("\n}\n") - -def msc_chart_generate(file_nameP): - global MSCGEN_OUTPUT_TYPE - print "Generating sequence diagram for ",file_nameP - command_line = "mscgen -T " + MSCGEN_OUTPUT_TYPE + " -i " + file_nameP - fi,fo,fe=os.popen3(command_line) - for i in fe.readlines(): - print "error:",i - -def get_new_file_descriptor(): - global g_base_file_name - global g_page_index - l_file_name = g_base_file_name + str(g_page_index)+'.txt' - l_file = open(l_file_name, "wb") - print "Generating mscgen input file ",l_file_name; - return l_file - - -###### MAIN STAR HERE ################# -parse_oai_log_files() - -g_page_index = 0 -g_message_index = 0 -g_now = datetime.datetime.now() -g_now_formated = 'mscgen_' + args.profile.strip() + '_'+ g_now.strftime("%Y-%m-%d_%H.%M.%S") -#g_currentdir = os.curdir -g_resultdir = os.path.join(args.dir, g_now_formated) -os.mkdir(g_resultdir) -os.chdir(g_resultdir) - -g_base_file_name = args.profile.strip() + '_mscgen_page_' - -g_file = get_new_file_descriptor() -msc_chart_write_header(g_file) - -for event_id_int in sorted(g_messages.iterkeys()): - message = g_messages[event_id_int] - if 'tx' in message['type']: - if "yes" == args.no_message.strip(): - if g_proto_types[message['tx']] != g_proto_types[message['rx']]: - continue - if "yes" == args.no_pdu.strip(): - if g_proto_types[message['tx']] == g_proto_types[message['rx']]: - continue - g_file.write(" %s=>%s [ label = \"(%d|%s) %s\", linecolour=%s , textcolour=%s ] ;\n" % (g_proto_names[message['tx']], g_proto_names[message['rx']], event_id_int, message['time'], message['message'], message['line_color'], message['text_color'])) - - elif 'rx' in message['type']: - if "yes" == args.no_message.strip(): - if g_proto_types[message['tx']] != g_proto_types[message['rx']]: - continue - if "yes" == args.no_pdu.strip(): - if g_proto_types[message['tx']] == g_proto_types[message['rx']]: - continue - g_file.write(" %s<=%s [ label = \"(%d|%s) %s\", linecolour=%s , textcolour=%s ] ;\n" % (g_proto_names[message['rx']], g_proto_names[message['tx']], event_id_int, message['time'], message['message'], message['line_color'], message['text_color'])) - - elif 'box' in message['type']: - if "yes" == args.no_event.strip(): - continue - g_file.write(" %s note %s [ label = \"%s\", textcolour=%s ] ;\n" % (g_proto_names[message['tx']], g_proto_names[message['rx']], message['message'], message['text_color'])) - - g_message_index = g_message_index + 1 - - if ((g_message_index % MAX_MESSAGES_PER_PAGE) == 0): - msc_chart_write_footer(g_file) - g_file.close() - msc_chart_generate(g_file.name) - g_page_index = g_page_index + 1 - - g_file = get_new_file_descriptor() - msc_chart_write_header(g_file) - - -msc_chart_write_footer(g_file) -g_file.close() -msc_chart_generate(g_file.name)