Commit afc75c5d authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'integration_2023_w37' into 'develop'

integration_2023_w37

* !1909 Rework for aarch64 support after SIMDe integration
* !1995 Fix packing/unpacking for nFAPI P5 messages
* !2228 TDLA, TDLB and TDLC channel models in DLSIM
* !2327 Bugfixes and some rewrite for nr rlc am control PDU reception
* !2331 NR UE HARQ improvements to handle more than 4 per PUCCH
* !2286 Service Models integration - KPM v03.00, GTP, MAC, RLC and PDCP
* !2336 fix(ci): HTML reporting for Ubuntu build fix
* !2338 nr-softmodem: fixed invalid length calculation, leading to segfault
* !2326 Tutorials: Update NR SA Tutorials to be compliant with OAI CN5G pre-2.0 release
* !2334 NR UE DL channel estimation fix
* !2325 Compute ULSCH TB CRC
parents 79fd37b4 29b4e64d
[submodule "openair2/E2AP/flexric"]
path = openair2/E2AP/flexric
url = https://gitlab.eurecom.fr/mosaic5g/flexric.git
branch = remotes/origin/mir_dev
branch = remotes/origin/service-models-integration
......@@ -102,21 +102,23 @@ add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of bui
# in case /proc/cpuinfo exists we want to inspect available Intrinsics
# -so not to go always through SIMDE emulation
# -so to avoid AVX512 instructions generation by gcc
execute_process(COMMAND uname -m OUTPUT_VARIABLE CPUARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "CPUARCH ${CPUARCH}")
if(EXISTS "/proc/cpuinfo")
if(EXISTS "/proc/cpuinfo" AND NOT CROSS_COMPILE)
file(STRINGS "/proc/cpuinfo" CPUFLAGS REGEX flags LIMIT_COUNT 1)
else()
message(WARNING "did not find /proc/cpuinfo -- not setting any x86-specific compilation variables")
endif()
eval_boolean(AUTODETECT_AVX512 DEFINED CPUFLAGS AND CPUFLAGS MATCHES "avx512")
add_boolean_option(AVX512 ${AUTODETECT_AVX512} "Whether AVX512 intrinsics is available on the host processor" ON)
eval_boolean(AUTODETECT_AVX2 DEFINED CPUFLAGS AND CPUFLAGS MATCHES "avx2")
add_boolean_option(AVX2 ${AUTODETECT_AVX2} "Whether AVX2 intrinsics is available on the host processor" ON)
if(${CPUARCH} STREQUAL "x86_64" AND DEFINED CPUFLAGS)
message(STATUS "CPU architecture is ${CMAKE_SYSTEM_PROCESSOR}")
if (CROSS_COMPILE)
message(STATUS "setting as aarch64")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -gdwarf-2 -lgcc -lrt")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
# The following intrinsics are assumed to be available on any x86 system
# (avx, f16c, fma, gnfi, mmx, pclmul, sse, sse2, sse3, xop)
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -DSIMDE_X86_AVX_NATIVE -DSIMDE_X86_AVX_NATIVE -DSIMDE_X86_F16C_NATIVE -DSIMDE_X86_FMA_NATIVE -DSIMDE_X86_GFNI_NATIVE -DSIMDE_X86_MMX_NATIVE -DSIMDE_X86_PCLMUL_NATIVE -DSIMDE_X86_SSE2_NATIVE -DSIMDE_X86_SSE3_NATIVE -DSIMDE_X86_SSE_NATIVE -DSIMDE_X86_XOP_HAVE_COM_ -DSIMDE_X86_XOP_NATIVE")
......@@ -139,11 +141,19 @@ if(${CPUARCH} STREQUAL "x86_64" AND DEFINED CPUFLAGS)
if(CPUINFO MATCHES "ssse3")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -DSIMDE_X86_SSSE3_NATIVE")
endif()
elseif(${CPUARCH} NOT STREQUAL "x86_64")
message(FATAL_ERROR "Cannot compile for CPU architecture ${CPUARCH}")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -gdwarf-2 -lgcc -lrt")
else()
message(FATAL_ERROR "compile for CPU architecture ${CPUARCH}, CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -march=native")
if (NOT CROSS_COMPILE)
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -march=native")
else ()
set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -march=armv8-a")
endif()
# add autotools definitions that were maybe used!
add_definitions("-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")
......@@ -856,7 +866,7 @@ target_link_libraries(ldpc_parityCheck PRIVATE ldpc_gen_HEADERS)
add_library(coding MODULE ${PHY_TURBOSRC} )
add_library(dfts MODULE ${OPENAIR1_DIR}/PHY/TOOLS/oai_dfts.c )
add_library(dfts MODULE ${OPENAIR1_DIR}/PHY/TOOLS/oai_dfts.c ${OPENAIR1_DIR}/PHY/TOOLS/oai_dfts_neon.c)
set(PHY_SRC_COMMON
......@@ -1109,7 +1119,6 @@ if (${SMBV})
endif (${SMBV})
set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c)
set(PHY_NR_UE_SRC ${PHY_NR_UE_SRC} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c)
add_library(PHY_COMMON ${PHY_SRC_COMMON})
target_link_libraries(PHY_COMMON PRIVATE shlib_loader)
......
......@@ -16,8 +16,6 @@ Please refer to the steps described on our website: [How to contribute to OAI](h
* This decision was made for the license reasons.
* The Continuous Integration will reject your merge request.
- All merge requests SHALL have `develop` branch as target branch.
- All merge requests SHALL have source branch names that SHALL not contain the `/` character.
* We are using a `docker` registry scheme and the image names are based on the source branch name.
## Coding Styles ##
......
......@@ -589,6 +589,7 @@ def triggerCN5GSlaveJob (jobName, gitlabStatusName) {
if ("MERGE".equals(env.gitlabActionType)) {
shortenShaOne = sh returnStdout: true, script: 'git log -1 --pretty=format:"%h" --abbrev=8 ' + env.gitlabMergeRequestLastCommit
shortenShaOne = shortenShaOne.trim()
branchName = env.gitlabSourceBranch.replaceAll("/", "-").trim()
fullRanTag = 'porcepix.sboai.cs.eurecom.fr/oai-gnb:' + env.gitlabSourceBranch + '-' + shortenShaOne
} else {
shortenShaOne = sh returnStdout: true, script: 'git log -1 --pretty=format:"%h" --abbrev=8 ' + env.GIT_COMMIT
......
......@@ -185,9 +185,12 @@ rfsim4g_enb_nos1:
l2sim5g_ue:
Host: localhost
AttachScript: docker start l2sim-oai-nr-ue0
DetachScript: docker stop l2sim-oai-nr-ue0
NetworkScript: docker exec l2sim-oai-nr-ue0 ip a show dev oaitun_ue1
CmdPrefix: docker exec l2sim-oai-nr-ue0
IF: oaitun_ue1
MTU: 1500
l2sim5g_ext_dn:
Host: localhost
......@@ -196,9 +199,12 @@ l2sim5g_ext_dn:
l2sim4g_ue:
Host: localhost
AttachScript: docker start l2sim4g-oai-lte-ue1
DetachScript: docker stop l2sim4g-oai-lte-ue1
NetworkScript: docker exec l2sim4g-oai-lte-ue1 ip a show dev oaitun_ue1
CmdPrefix: docker exec l2sim4g-oai-lte-ue1
IF: oaitun_ue1
MTU: 1500
l2sim4g_ext_dn:
Host: localhost
......
......@@ -266,7 +266,8 @@ class Cluster:
baseTag = 'develop'
forceBaseImageBuild = False
if self.ranAllowMerge: # merging MR branch into develop -> temporary image
imageTag = f'{self.ranBranch}-{self.ranCommitID[0:8]}'
branchName = self.ranBranch.replace('/','-')
imageTag = f'{branchName}-{self.ranCommitID[0:8]}'
if self.ranTargetBranch == 'develop':
ret = self.cmd.run(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel9 | grep --colour=never -i INDEX')
result = re.search('index', ret.stdout)
......@@ -412,7 +413,6 @@ class Cluster:
imageSize = {}
for image in attemptedImages:
self.cmd.run(f'mkdir -p cmake_targets/log/{image}')
self.cmd.run(f'python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/{image}.log')
tag = imageTag if image != 'ran-base' else baseTag
size = self._get_image_size(image, tag)
if size <= 0:
......
......@@ -97,7 +97,9 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge
def ImageTagToUse(imageName, ranCommitID, ranBranch, ranAllowMerge):
shortCommit = ranCommitID[0:8]
if ranAllowMerge:
tagToUse = f'{ranBranch}-{shortCommit}'
# Allowing contributor to have a name/branchName format
branchName = ranBranch.replace('/','-')
tagToUse = f'{branchName}-{shortCommit}'
else:
tagToUse = f'develop-{shortCommit}'
fullTag = f'{imageName}:{tagToUse}'
......@@ -153,17 +155,13 @@ def AnalyzeBuildLogs(buildRoot, images, globalStatus):
committed = False
tagged = False
with open(f'{buildRoot}/{image}.log', mode='r') as inputfile:
startOfTargetImageCreation = False # check for tagged/committed only after image created
for line in inputfile:
result = re.search(f'FROM .* [aA][sS] {image}$', str(line))
if result is not None:
startOfTargetImageCreation = True
if startOfTargetImageCreation:
lineHasTag = re.search(f'Successfully tagged {image}:', str(line)) is not None
tagged = tagged or lineHasTag
# the OpenShift Cluster builder prepends image registry URL
lineHasCommit = re.search(f'COMMIT [a-zA-Z0-9\.:/\-]*{image}', str(line)) is not None
committed = committed or lineHasCommit
lineHasTag = re.search(f'Successfully tagged {image}:', str(line)) is not None
lineHasTag2 = re.search(f'naming to docker.io/library/{image}:', str(line)) is not None
tagged = tagged or lineHasTag or lineHasTag2
# the OpenShift Cluster builder prepends image registry URL
lineHasCommit = re.search(f'COMMIT [a-zA-Z0-9\.:/\-]*{image}', str(line)) is not None
committed = committed or lineHasCommit
errorandwarnings['errors'] = 0 if committed or tagged else 1
errorandwarnings['warnings'] = 0
errorandwarnings['status'] = committed or tagged
......@@ -370,22 +368,23 @@ class Containerize():
# Creating a tupple with the imageName and the DockerFile prefix pattern on obelix
if result is not None:
imageNames.append(('oai-enb', 'eNB'))
else:
result = re.search('gNB', self.imageKind)
if result is not None:
imageNames.append(('oai-gnb', 'gNB'))
else:
result = re.search('all', self.imageKind)
if result is not None:
imageNames.append(('oai-enb', 'eNB'))
imageNames.append(('oai-gnb', 'gNB'))
imageNames.append(('oai-nr-cuup', 'nr-cuup'))
imageNames.append(('oai-lte-ue', 'lteUE'))
imageNames.append(('oai-nr-ue', 'nrUE'))
if self.host == 'Red Hat':
imageNames.append(('oai-physim', 'phySim'))
if self.host == 'Ubuntu':
imageNames.append(('oai-lte-ru', 'lteRU'))
result = re.search('gNB', self.imageKind)
if result is not None:
imageNames.append(('oai-gnb', 'gNB'))
result = re.search('all', self.imageKind)
if result is not None:
imageNames.append(('oai-enb', 'eNB'))
imageNames.append(('oai-gnb', 'gNB'))
imageNames.append(('oai-nr-cuup', 'nr-cuup'))
imageNames.append(('oai-lte-ue', 'lteUE'))
imageNames.append(('oai-nr-ue', 'nrUE'))
if self.host == 'Red Hat':
imageNames.append(('oai-physim', 'phySim'))
if self.host == 'Ubuntu':
imageNames.append(('oai-lte-ru', 'lteRU'))
result = re.search('build_cross_arm64', self.imageKind)
if result is not None:
self.dockerfileprefix = '.ubuntu20.cross-arm64'
# Workaround for some servers, we need to erase completely the workspace
if self.forcedWorkspaceCleanup:
......@@ -468,9 +467,12 @@ class Containerize():
if image != 'ran-build':
cmd.run(f'sed -i -e "s#ran-build:latest#ran-build:{imageTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}')
cmd.run(f'{self.cli} build {self.cliBuildOptions} --target {image} --tag {image}:{imageTag} --file docker/Dockerfile.{pattern}{self.dockerfileprefix} . > cmake_targets/log/{image}.log 2>&1', timeout=1200)
# split the log
cmd.run(f"mkdir -p cmake_targets/log/{image}")
cmd.run(f"python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/{image}.log")
if image == 'ran-build':
cmd.run(f"docker run --name test-log -d {image}:{imageTag} /bin/true")
cmd.run(f"docker cp test-log:/oai-ran/cmake_targets/log/ cmake_targets/log/{image}/")
cmd.run(f"docker rm -f test-log")
else:
cmd.run(f"mkdir -p cmake_targets/log/{image}")
# check the status of the build
ret = cmd.run(f"{self.cli} image inspect --format=\'Size = {{{{.Size}}}} bytes\' {image}:{imageTag}")
if ret.returncode != 0:
......@@ -986,14 +988,11 @@ class Containerize():
for svcName in services:
# head -n -1 suppresses the final "X exited with status code Y"
filename = f'{svcName}-{HTML.testCase_id}.log'
#mySSH.command(f'docker-compose -f ci-docker-compose.yml logs --no-log-prefix -- {svcName} | head -n -1 &> {lSourcePath}/cmake_targets/log/{filename}', '\$', 30)
mySSH.command(f'docker-compose -f ci-docker-compose.yml logs --no-log-prefix -- {svcName} &> {lSourcePath}/cmake_targets/log/{filename}', '\$', 120)
mySSH.command('docker-compose -f ci-docker-compose.yml down', '\$', 5)
# Cleaning any created tmp volume
mySSH.command('docker volume prune --force', '\$', 20)
mySSH.command('docker-compose -f ci-docker-compose.yml down -v', '\$', 5)
mySSH.close()
# Analyzing log file!
files = ','.join([f'{s}-{HTML.testCase_id}' for s in services])
if len(services) > 1:
......@@ -1296,7 +1295,7 @@ class Containerize():
logging.debug('\u001B[1m Undeploying \u001B[0m')
logging.debug(f'Working dir is back {self.yamlPath[0]}')
cmd = 'docker-compose -f docker-compose-ci.yml down'
cmd = 'docker-compose -f docker-compose-ci.yml down -v'
deployStatus = myCmd.run(cmd, timeout=100)
if deployStatus.returncode != 0:
myCmd.close()
......@@ -1307,9 +1306,6 @@ class Containerize():
return
self.deployedContainers = []
# Cleaning any created tmp volume
cmd = 'docker volume prune --force'
deployStatus = myCmd.run(cmd, timeout=100, reportNonZero=False)
myCmd.close()
if fullStatus:
......
......@@ -519,6 +519,7 @@ class OaiCiTest():
ping_cmd = f'{ue.getCmdPrefix()} ping {interface} {self.ping_args} 2>&1 | tee /tmp/{ping_log_file}'
cmd = cls_cmd.getConnection(ue.getHost())
response = cmd.run(ping_cmd, timeout=int(ping_time[0])*1.5)
ue_header = f'UE {ue.getName()} ({ueIP})'
if response.returncode != 0:
message = ue_header + ': ping crashed: TIMEOUT?'
logging.error('\u001B[1;37;41m ' + message + ' \u001B[0m')
......@@ -528,7 +529,6 @@ class OaiCiTest():
cmd.copyin(src=f'/tmp/{ping_log_file}', tgt=local_ping_log_file)
cmd.close()
ue_header = f'UE {ue.getName()} ({ueIP})'
with open(local_ping_log_file, 'r') as f:
ping_output = "".join(f.readlines())
result = re.search(', (?P<packetloss>[0-9\.]+)% packet loss, time [0-9\.]+ms', ping_output)
......
......@@ -106,7 +106,8 @@ class PhySim:
if self.ranCommitID != '':
mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30)
if self.ranAllowMerge:
imageTag = f'{self.ranBranch}-{self.ranCommitID[0:8]}'
branchName = self.ranBranch.replace('/','-')
imageTag = f'{branchName}-{self.ranCommitID[0:8]}'
if self.ranTargetBranch == '':
if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'):
mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 30)
......
......@@ -679,7 +679,7 @@ class EPCManagement():
mySSH.copyout(self.IPAddress, self.UserName, self.Password, './' + self.yamlPath + '/mme.conf', self.SourceCodePath + '/scripts')
mySSH.command('chmod 775 entrypoint.sh', '\$', 60)
mySSH.command('wget --quiet --tries=3 --retry-connrefused https://raw.githubusercontent.com/OPENAIRINTERFACE/openair-hss/develop/src/hss_rel14/db/oai_db.cql', '\$', 30)
mySSH.command('docker-compose down', '\$', 60)
mySSH.command('docker-compose down -v', '\$', 60)
mySSH.command('docker-compose up -d db_init', '\$', 60)
# databases take time...
time.sleep(10)
......@@ -831,8 +831,7 @@ class EPCManagement():
listOfContainers += ' prod-trf-gen'
nbContainers += 1
mySSH.command('docker-compose down', '\$', 60)
mySSH.command('docker volume prune --force || true', '\$', 60)
mySSH.command('docker-compose down -v', '\$', 60)
mySSH.command('docker inspect --format=\'{{.State.Health.Status}}\' ' + listOfContainers, '\$', 10)
noMoreContainerNb = mySSH.getBefore().count('No such object')
mySSH.command('docker inspect --format=\'{{.Name}}\' prod-oai-public-net prod-oai-private-net', '\$', 10)
......
......@@ -750,7 +750,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'WaitEndBuild_eNB':
RAN.WaitBuildeNBisFinished(HTML)
elif action == 'Custom_Command':
logging.info(f"Executing custom command")
RAN.CustomCommand(HTML)
if RAN.prematureExit:
CiTestObj.AutoTerminateeNB(HTML,RAN,EPC,CONTAINERS)
......
......@@ -260,6 +260,7 @@ class RANManagement():
self.checkBuildeNB(lIpAddr, lUserName, lPassWord, lSourcePath, self.backgroundBuildTestId[int(self.eNB_instance)], HTML)
def CustomCommand(self, HTML):
logging.info(f"Executing custom command on {self.node}")
cmd = cls_cmd.getConnection(self.node)
ret = cmd.run(self.command)
cmd.close()
......
......@@ -36,7 +36,7 @@
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<forced_workspace_cleanup>True</forced_workspace_cleanup>
<proxy_commit>a2fa216</proxy_commit>
<proxy_commit>f390610304baf6b66e4ec8cc00bf91398a651172</proxy_commit>
</testCase>
</testCaseList>
......@@ -32,7 +32,7 @@
000001
000002
000003
000011
000004
200000
020001
020002
......@@ -82,10 +82,10 @@
<nb_healthy>10</nb_healthy>
</testCase>
<testCase id="000011">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>10</idle_sleep_time_in_sec>
<testCase id="000004">
<class>Attach_UE</class>
<desc>Attach OAI UE</desc>
<id>l2sim4g_ue</id>
</testCase>
<testCase id="020001">
......
......@@ -32,7 +32,7 @@
000001
000002
000003
000011
000004
200000
020001
020002
......@@ -80,10 +80,10 @@
<nb_healthy>9</nb_healthy>
</testCase>
<testCase id="000011">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>10</idle_sleep_time_in_sec>
<testCase id="000004">
<class>Attach_UE</class>
<desc>Attach OAI UE</desc>
<id>l2sim5g_ue</id>
</testCase>
<testCase id="020001">
......
......@@ -28,6 +28,7 @@
<TestCaseRequestedList>
111111
100011
004000
000010
000011
020011
......@@ -45,6 +46,13 @@
<images_to_pull>oai-gnb oai-nr-ue</images_to_pull>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fdd_phytest_rrc.config</command>
</testCase>
<testCase id="000010">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G gNB RF sim SA</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100012
004000
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -36,6 +37,13 @@
<yaml_path>yaml_files/5g_rfsimulator_fdd_phytest</yaml_path>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fdd_phytest_rrc.config</command>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
......
......@@ -28,6 +28,7 @@
<TestCaseRequestedList>
111111
100001
004000
000000
000001
020001
......@@ -43,6 +44,13 @@
<images_to_pull>oai-gnb oai-nr-ue</images_to_pull>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fr2_32prb_rrc.config</command>
</testCase>
<testCase id="000000">
<class>DeployGenObject</class>
<desc>Deploy OAI gNB</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100002
004000
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -36,6 +37,13 @@
<yaml_path>yaml_files/5g_rfsimulator_fr2_32prb</yaml_path>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_fr2_32prb_rrc.config</command>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
......
......@@ -28,6 +28,7 @@
<TestCaseRequestedList>
111111
100001
004000
000000
000001
020001
......@@ -43,6 +44,13 @@
<images_to_pull>oai-gnb oai-nr-ue</images_to_pull>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_tdd_dora_rrc.config</command>
</testCase>
<testCase id="000000">
<class>DeployGenObject</class>
<desc>Deploy OAI gNB</desc>
......
......@@ -26,6 +26,7 @@
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100002
004000
222222
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
......@@ -36,6 +37,13 @@
<yaml_path>yaml_files/5g_rfsimulator_tdd_dora</yaml_path>
</testCase>
<testCase id="004000">
<class>Custom_Command</class>
<desc>Clean-Up any residual volume</desc>
<node>localhost</node>
<command>docker volume rm 5g_rfsimulator_tdd_dora_rrc.config</command>
</testCase>
<testCase id="222222">
<class>Clean_Test_Server_Images</class>
<desc>Clean Test Images on Test Server</desc>
......
<!--
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
-->
<testCaseList>
<htmlTabRef>build-tab</htmlTabRef>
<htmlTabName>Build Container Images</htmlTabName>
<htmlTabIcon>wrench</htmlTabIcon>
<TestCaseRequestedList>
000001
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="000001">
<class>Build_Image</class>
<desc>Cross-Compile for ARM64</desc>
<kind>build_cross_arm64</kind>
<eNB_instance>0</eNB_instance>
<eNB_serverId>0</eNB_serverId>
<forced_workspace_cleanup>True</forced_workspace_cleanup>
</testCase>
</testCaseList>
......@@ -36,7 +36,7 @@
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<forced_workspace_cleanup>True</forced_workspace_cleanup>
<proxy_commit>a2fa216</proxy_commit>
<proxy_commit>f390610304baf6b66e4ec8cc00bf91398a651172</proxy_commit>
</testCase>
</testCaseList>
......@@ -200,8 +200,8 @@
-n100 -e16 -s11 -S13
-n100 -q1 -e26 -s30
-n100 -e0 -t95 -S-1.0 -i 2 1 0
-n10 -s20 -U 3 0 0 2 -gR -x1 -y4 -z4
-n10 -s20 -U 3 0 0 2 -gR -x2 -y4 -z4
-n10 -s20 -U 3 0 0 2 -gA -x1 -y4 -z4
-n10 -s20 -U 3 0 0 2 -gA -x2 -y4 -z4
-n10 -s20 -U 3 0 0 2 -x4 -y4 -z4</main_exec_args>
<tags>test1 test2 test3 test4 test5 test6 test7</tags>
<search_expr_true>PDSCH test OK</search_expr_true>
......
......@@ -38,7 +38,6 @@ gen_nvram_path=$OPENAIR_DIR/cmake_targets/ran_build/build
conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
HW=""
VERBOSE_CI=0
VERBOSE_COMPILE=0
RUN_GROUP=0
TEST_CASE_GROUP=""
......@@ -110,8 +109,6 @@ Options:
Adds a debgging facility to the binary files: GUI with major internal synchronization events
-x | --xforms
Will compile with software oscilloscope features
--verbose-ci
Compile with verbose instructions in CI Docker env
--verbose-compile
Shows detailed compilation instructions in makefile
--build-doxygen
......@@ -336,10 +333,6 @@ function main() {
-x | --xforms)
echo_info "Will generate the software oscilloscope features"
shift;;
--verbose-ci)
VERBOSE_CI=1
echo_info "Will compile with verbose instructions in CI Docker env"
shift;;
--verbose-compile)
VERBOSE_COMPILE=1
echo_info "Will compile with verbose instructions"
......
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc-9)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++-9)
set(CROSS_COMPILE 1)
set(bnProc_gen_128_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(bnProc_gen_avx2_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(bnProc_gen_avx512_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(cnProc_gen_128_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(cnProc_gen_avx2_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(cnProc_gen_avx512_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(genids_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
set(_check_vcd_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NATIVE_DIR}) # /../build)
......@@ -233,11 +233,6 @@ compilations() {
$CMAKE --build . $verbose --target $targets -- -j$(nproc)
ret=$?
} > $dlog/$logfile 2>&1
if [ "$VERBOSE_CI" == "1" ]; then
echo "====== Start of log for $logfile ======"
cat $dlog/$logfile
echo "====== End of log for $logfile ======"
fi
check_warnings "$dlog/$logfile"
if [[ $ret -eq 0 ]]; then
echo_success "$targets compiled"
......
......@@ -52,7 +52,11 @@
// Fixme: a better place to be shure it is called
void read_cpu_hardware (void) __attribute__ ((constructor));
void read_cpu_hardware (void) {__builtin_cpu_init(); }
#if !defined(__arm__) && !defined(__aarch64__)
void read_cpu_hardware (void) {__builtin_cpu_init(); }
#else
void read_cpu_hardware (void) {}
#endif
log_mem_cnt_t log_mem_d[2];
int log_mem_flag = 0;
......
add_executable(genids genids.c)
set_target_properties(genids PROPERTIES RUNTIME_OUTPUT_DIRECTORY .)
if (CROSS_COMPILE)
find_package(genids)
else()
add_executable(genids genids.c)
set_target_properties(genids PROPERTIES RUNTIME_OUTPUT_DIRECTORY .)
export(TARGETS genids FILE
"${CMAKE_BINARY_DIR}/genidsConfig.cmake")
endif()
add_custom_command(OUTPUT T_IDs.h
COMMAND ./genids ${CMAKE_CURRENT_SOURCE_DIR}/T_messages.txt T_IDs.h
COMMAND genids ${CMAKE_CURRENT_SOURCE_DIR}/T_messages.txt T_IDs.h
DEPENDS genids
COMMENT "Generating T_IDs.h from T_messages.txt"
)
......@@ -12,14 +17,19 @@ add_custom_command(OUTPUT T_messages.txt.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_executable(_check_vcd check_vcd.c tracer/database.c tracer/utils.c T_IDs.h T_messages.txt.h)
target_include_directories(_check_vcd PRIVATE
.. ../itti ../../../openair2/COMMON tracer
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(_check_vcd PRIVATE -Wall)
target_link_libraries(_check_vcd PRIVATE m pthread)
set_target_properties(_check_vcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY .)
if (CROSS_COMPILE)
find_package(_check_vcd)
else ()
add_executable(_check_vcd check_vcd.c tracer/database.c tracer/utils.c T_IDs.h T_messages.txt.h)
target_include_directories(_check_vcd PRIVATE
.. ../itti ../../../openair2/COMMON tracer
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(_check_vcd PRIVATE -Wall)
target_link_libraries(_check_vcd PRIVATE m pthread)
set_target_properties(_check_vcd PROPERTIES RUNTIME_OUTPUT_DIRECTORY .)
export(TARGETS _check_vcd FILE
"${CMAKE_BINARY_DIR}/_check_vcdConfig.cmake")
endif()
add_custom_target(check_vcd
COMMAND _check_vcd ${CMAKE_CURRENT_SOURCE_DIR}/T_messages.txt ${CMAKE_CURRENT_SOURCE_DIR}/../LOG/vcd_signal_dumper.h
DEPENDS _check_vcd
......
......@@ -38,7 +38,7 @@ static time_stats_t **measur_table;
notifiedFIFO_t measur_fifo;
double get_cpu_freq_GHz(void)
{
if (cpu_freq_GHz <1 ) {
if (cpu_freq_GHz <0.01 ) {
time_stats_t ts = {0};
reset_meas(&ts);
ts.trials++;
......@@ -46,8 +46,7 @@ double get_cpu_freq_GHz(void)
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;
}
......
......@@ -106,8 +106,16 @@ static inline unsigned long long rdtsc_oai(void) {
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return (d<<32) | a;
}
#elif defined(__aarch64__)
static inline uint64_t rdtsc_oai(void) __attribute__((always_inline));
static inline uint64_t rdtsc_oai(void)
{
uint64_t r = 0;
asm volatile("mrs %0, cntvct_el0" : "=r"(r));
return r;
}
#elif defined(__arm__) || defined(__aarch64__)
#elif defined(__arm__)
static inline uint32_t rdtsc_oai(void) __attribute__((always_inline));
static inline uint32_t rdtsc_oai(void) {
uint32_t r = 0;
......
......@@ -118,12 +118,6 @@ char *itoa(int i) {
return strdup(buffer);
}
void *memcpy1(void *dst,const void *src,size_t n) {
void *ret=dst;
asm volatile("rep movsb" : "+D" (dst) : "c"(n), "S"(src) : "cc","memory");
return(ret);
}
void set_priority(int priority)
{
......
......@@ -102,8 +102,6 @@ int hex_char_to_hex_value (char c);
// Converts an hexadecimal ASCII coded string into its value.**
int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
void *memcpy1(void *dst,const void *src,size_t n);
void set_priority(int priority);
char *itoa(int i);
......
......@@ -215,3 +215,8 @@ ccmake ../../..
cmake-gui ../../..
```
You can of course use all standard cmake/ninja/make commands in this directory.
# Cross Compile
If you want to use cross-compiler on x86 platform for aarch64 version, please refer the [cross-compile.md](./cross-compile.md) for more information.
......@@ -90,7 +90,7 @@ cd ~/openairinterface5g/cmake_targets
cd ~/openairinterface5g
source oaienv
cd cmake_targets
./build_oai -w USRP --ninja --gNB -c
./build_oai -w USRP --ninja --gNB -C
```
# 4. Run OAI CN5G and OAI gNB
......
......@@ -66,8 +66,8 @@ docker pull oaisoftwarealliance/oai-udr:develop
docker pull oaisoftwarealliance/oai-udm:develop
docker pull oaisoftwarealliance/oai-ausf:develop
docker pull oaisoftwarealliance/oai-spgwu-tiny:develop
docker pull oaisoftwarealliance/trf-gen-cn5g:latest
docker build --target ims --tag asterisk-ims:latest --file ~/oai-cn5g/Dockerfile .
docker pull oaisoftwarealliance/trf-gen-cn5g:jammy
docker pull oaisoftwarealliance/ims:latest
```
# 3. Run OAI CN5G
......
......@@ -81,7 +81,7 @@ sudo apt install -y libforms-dev libforms-bin
cd ~/openairinterface5g
source oaienv
cd cmake_targets
./build_oai -w USRP --ninja --nrUE --gNB --build-lib "nrscope" -c
./build_oai -w USRP --ninja --nrUE --gNB --build-lib "nrscope" -C
```
# 4. Run OAI CN5G and OAI gNB
......
......@@ -19,6 +19,7 @@
- [FEATURE_SET.md](./FEATURE_SET.md): lists supported features
- [GET_SOURCES.md](./GET_SOURCES.md): how to download the sources
- [BUILD.md](./BUILD.md): how to build the sources
- [cross-compile.md](./cross-compile.md): how to cross-compile OAI for ARM
- [clang-format.md](./clang-format.md): how to format the code
- [environment-variables.md](./environment-variables.md): the environment variables used by OAI
......
[[_TOC_]]
# OpenAirInterface Cross-Compiler User Guide
## Environment
- OS: ubuntu 20.04
### Set up the environment
Set up for install the package for aarch64.
```shell
sudo dpkg --add-architecture arm64
echo -e \
"deb [arch=arm64] http://ports.ubuntu.com/ focal main restricted\n"\
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates main restricted\n"\
"deb [arch=arm64] http://ports.ubuntu.com/ focal universe\n"\
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates universe\n"\
"deb [arch=arm64] http://ports.ubuntu.com/ focal multiverse\n"\
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates multiverse\n"\
"deb [arch=arm64] http://ports.ubuntu.com/ focal-backports main restricted universe multiverse"\
| sudo tee /etc/apt/sources.list.d/arm-cross-compile-sources.list
sudo cp /etc/apt/sources.list "/etc/apt/sources.list.`date`.backup"
sudo sed -i -E "s/(deb)\ (http:.+)/\1\ [arch=amd64]\ \2/" /etc/apt/sources.list
sudo apt update
sudo apt install -y gcc-9-aarch64-linux-gnu \
g++-9-aarch64-linux-gnu
sudo apt-get install -y \
libatlas-base-dev:arm64 \
libblas-dev:arm64 \
libc6-dev-i386 \
liblapack-dev:arm64 \
liblapacke-dev:arm64 \
libreadline-dev:arm64 \
libgnutls28-dev:arm64 \
libconfig-dev:arm64 \
libsctp-dev:arm64 \
libssl-dev:arm64 \
libtool:arm64 \
zlib1g-dev:arm64
```
## Install and Build
### Install required packages
Use the host compiler to install some dependencies.
```shell
cd cmake_targets
./build_oai -I
```
### Build the LDPC generators
Use the x86 compiler to build the `ldpc_generators` and generate the header
file in the `ran_build/build` folder. They are necessary during a build for
code generation, and therefore need to be created for the x86 architecture.
```shell
rm -r ran_build
mkdir ran_build
mkdir ran_build/build
mkdir ran_build/build-cross
cd ran_build/build
cmake ../../..
make -j`nproc` ldpc_generators generate_T
```
### Build the Other Executables for aarch64
Switch to the `ran_build/build-cross` folder to build the target executables
for ARM. The `cross-arm.cmake` file defines some ARM-specific build tools
(e.g., compilers) that you might need to adapt. Further, it defines cmake
variables that define in this step where the host tools (such as LDPC
generators) are to be found. For the latter, the `NATIVE_DIR` option has to
be defined in order to tell cmake where the host tools have been built.
```shell
cd ../build-cross
cmake ../../.. -DCMAKE_TOOLCHAIN_FILE=../../../cmake_targets/cross-arm.cmake -DNATIVE_DIR=../build
make -j`nproc` dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim
make -j`nproc` lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem
make -j`nproc` params_libconfig coding rfsimulator
```
ARG BASE_IMAGE=ubuntu:jammy
FROM $BASE_IMAGE as ims
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
asterisk \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["asterisk", "-fp"]
################################################################################
# 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
################################################################################
# OAI CN Configuration File
### This file can be used by all OAI NFs
### Some fields are specific to an NF and will be ignored by other NFs
### The {{ env['ENV_NAME'] }} syntax lets you define these values in a docker-compose file
### If you intend to mount this file or use a bare-metal deployment, please refer to README.md
### The README.md also defines default values and allowed values for each configuration parameter
############# Common configuration
# Log level for all the NFs
log_level:
general: debug
# If you enable registration, the other NFs will use the NRF discovery mechanism
register_nf:
general: yes
http_version: 2
############## SBI Interfaces
### Each NF takes its local SBI interfaces and remote interfaces from here, unless it gets them using NRF discovery mechanisms
nfs:
amf:
host: oai-amf
sbi:
port: 8080
api_version: v1
interface_name: eth0
n2:
interface_name: eth0
port: 38412
smf:
host: oai-smf
sbi:
port: 8080
api_version: v1
interface_name: eth0
n4:
interface_name: eth0
port: 8805
udm:
host: oai-udm
sbi:
port: 8080
api_version: v1
interface_name: eth0
udr:
host: oai-udr
sbi:
port: 8080
api_version: v1
interface_name: eth0
ausf:
host: oai-ausf
sbi:
port: 8080
api_version: v1
interface_name: eth0
nrf:
host: oai-nrf
sbi:
port: 8080
api_version: v1
interface_name: eth0
#### Common for UDR and AMF
database:
host: mysql
user: test
type: mysql
password: test
database_name: oai_db
generate_random: true
connection_timeout: 300 # seconds
############## NF-specific configuration
amf:
pid_directory: "/var/run"
amf_name: "OAI-AMF"
# This really depends on if we want to keep the "mini" version or not
support_features_options:
enable_simple_scenario: no
enable_nssf: no
enable_smf_selection: yes
use_external_udm: no
relative_capacity: 30
statistics_timer_interval: 20 #in seconds
emergency_support: false
served_guami_list:
- mcc: 001
mnc: 01
amf_region_id: 80
amf_set_id: 001
amf_pointer: 01
plmn_support_list:
- mcc: 001
mnc: 01
tac: 0x0001
nssai:
- sst: 1
supported_integrity_algorithms:
- "NIA1"
- "NIA2"
supported_encryption_algorithms:
- "NEA0"
- "NEA1"
- "NEA2"
smf:
ue_mtu: 1500
support_features:
use_local_subscription_info: yes # Use infos from local_subscription_info or from UDM
use_local_pcc_rules: yes # Use infos from local_pcc_rules or from PCF
# we resolve from NRF, this is just to configure usage_reporting
upfs:
- host: oai-spgwu
config:
enable_usage_reporting: no
ue_dns:
primary_ipv4: "1.1.1.1"
primary_ipv6: "2001:4860:4860::8888"
secondary_ipv4: "8.8.8.8"
secondary_ipv6: "2001:4860:4860::8888"
ims:
pcscf_ipv4: "192.168.70.139"
pcscf_ipv6: "fe80::7915:f408:1787:db8b"
# the DNN you configure here should be configured in "dnns"
local_subscription_infos:
- single_nssai:
sst: 1
dnn: "oai"
qos_profile:
5qi: 9
session_ambr_ul: "10Gbps"
session_ambr_dl: "10Gbps"
- single_nssai:
sst: 1
dnn: "openairinterface"
qos_profile:
5qi: 9
session_ambr_ul: "10Gbps"
session_ambr_dl: "10Gbps"
- single_nssai:
sst: 1
dnn: "ims"
qos_profile:
5qi: 9
session_ambr_ul: "10Gbps"
session_ambr_dl: "10Gbps"
## DNN configuration
dnns:
- dnn: "oai"
pdu_session_type: "IPV4"
ipv4_subnet: "12.1.1.2/24"
- dnn: "openairinterface"
pdu_session_type: "IPV4V6"
ipv4_subnet: "12.1.2.2/24"
ipv6_prefix: "2001:1:2::/64"
- dnn: "ims"
pdu_session_type: "IPV4V6"
ipv4_subnet: "12.1.9.2/24"
ipv6_prefix: "2001:1:2::/64"
......@@ -211,13 +211,13 @@ CREATE TABLE `SessionManagementSubscriptionData` (
--
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000001', '00101', '{\"sst\": 1, \"sd\": \"0xFFFFFF\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.99\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
('001010000000001', '00101', '{\"sst\": 1, \"sd\": \"16777215\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.101\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000002', '00101', '{\"sst\": 1, \"sd\": \"0xFFFFFF\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.100\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
('001010000000002', '00101', '{\"sst\": 1, \"sd\": \"16777215\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.102\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000003', '00101', '{\"sst\": 1, \"sd\": \"0xFFFFFF\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.101\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
('001010000000003', '00101', '{\"sst\": 1, \"sd\": \"16777215\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.103\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
INSERT INTO `SessionManagementSubscriptionData` (`ueid`, `servingPlmnid`, `singleNssai`, `dnnConfigurations`) VALUES
('001010000000004', '00101', '{\"sst\": 1, \"sd\": \"0xFFFFFF\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.102\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
('001010000000004', '00101', '{\"sst\": 1, \"sd\": \"16777215\"}','{\"oai\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 6,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"},\"staticIpAddress\":[{\"ipv4Addr\": \"12.1.1.104\"}]},\"ims\":{\"pduSessionTypes\":{ \"defaultSessionType\": \"IPV4V6\"},\"sscModes\": {\"defaultSscMode\": \"SSC_MODE_1\"},\"5gQosProfile\": {\"5qi\": 2,\"arp\":{\"priorityLevel\": 15,\"preemptCap\": \"NOT_PREEMPT\",\"preemptVuln\":\"PREEMPTABLE\"},\"priorityLevel\":1},\"sessionAmbr\":{\"uplink\":\"1000Mbps\", \"downlink\":\"1000Mbps\"}}}');
-- --------------------------------------------------------
......
......@@ -14,42 +14,37 @@ services:
- MYSQL_ROOT_PASSWORD=linux
healthcheck:
test: /bin/bash -c "/tmp/mysql-healthcheck.sh"
interval: 10s
timeout: 5s
retries: 5
interval: 5s
timeout: 2s
retries: 10
networks:
public_net:
ipv4_address: 192.168.70.131
ims:
container_name: "asterisk-ims"
image: asterisk-ims:latest
image: oaisoftwarealliance/ims:latest
volumes:
- ./conf/sip.conf:/etc/asterisk/sip.conf
- ./conf/users.conf:/etc/asterisk/users.conf
healthcheck:
test: /bin/bash -c "pgrep asterisk"
interval: 10s
timeout: 5s
retries: 5
interval: 5s
timeout: 2s
retries: 10
networks:
public_net:
ipv4_address: 192.168.70.139
oai-udr:
container_name: "oai-udr"
image: oaisoftwarealliance/oai-udr:v1.5.1
image: oaisoftwarealliance/oai-udr:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-udr/etc/config.yaml
environment:
- TZ=Europe/Paris
- UDR_NAME=OAI_UDR
- UDR_INTERFACE_NAME_FOR_NUDR=eth0
- MYSQL_IPV4_ADDRESS=mysql
- MYSQL_USER=test
- MYSQL_PASS=test
- MYSQL_DB=oai_db
- WAIT_MYSQL=120
- USE_FQDN_DNS=yes
- REGISTER_NRF=yes
- NRF_IPV4_ADDRESS=192.168.70.130
- NRF_FQDN=oai-nrf
depends_on:
- mysql
- oai-nrf
......@@ -58,92 +53,60 @@ services:
ipv4_address: 192.168.70.136
oai-udm:
container_name: "oai-udm"
image: oaisoftwarealliance/oai-udm:v1.5.1
image: oaisoftwarealliance/oai-udm:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-udm/etc/config.yaml
environment:
- TZ=Europe/Paris
- UDM_NAME=OAI_UDM
- SBI_IF_NAME=eth0
- REGISTER_NRF=yes
- USE_FQDN_DNS=yes
- UDR_IP_ADDRESS=192.168.70.136
- UDR_FQDN=oai-udr
- NRF_IPV4_ADDRESS=192.168.70.130
- NRF_FQDN=oai-nrf
depends_on:
- oai-nrf
- oai-udr
networks:
public_net:
ipv4_address: 192.168.70.137
oai-ausf:
container_name: "oai-ausf"
image: oaisoftwarealliance/oai-ausf:v1.5.1
image: oaisoftwarealliance/oai-ausf:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-ausf/etc/config.yaml
environment:
- TZ=Europe/Paris
- AUSF_NAME=OAI_AUSF
- SBI_IF_NAME=eth0
- USE_FQDN_DNS=yes
- REGISTER_NRF=yes
- UDM_IP_ADDRESS=192.168.70.137
- UDM_FQDN=oai-udm
- NRF_IPV4_ADDRESS=192.168.70.130
- NRF_FQDN=oai-nrf
depends_on:
- oai-nrf
- oai-udm
networks:
public_net:
ipv4_address: 192.168.70.138
oai-nrf:
container_name: "oai-nrf"
image: oaisoftwarealliance/oai-nrf:v1.5.1
image: oaisoftwarealliance/oai-nrf:develop
expose:
- 80/tcp
- 8080/tcp
volumes:
- ./conf/config.yaml:/openair-nrf/etc/config.yaml
environment:
- TZ=Europe/Paris
- NRF_INTERFACE_NAME_FOR_SBI=eth0
networks:
public_net:
ipv4_address: 192.168.70.130
oai-amf:
container_name: "oai-amf"
image: oaisoftwarealliance/oai-amf:v1.5.1
image: oaisoftwarealliance/oai-amf:develop
expose:
- 80/tcp
- 8080/tcp
- 38412/sctp
volumes:
- ./conf/config.yaml:/openair-amf/etc/config.yaml
environment:
- TZ=Europe/Paris
# PLMN informations
- MCC=001
- MNC=01
- REGION_ID=128
- AMF_SET_ID=1
- SERVED_GUAMI_MCC_0=001
- SERVED_GUAMI_MNC_0=01
- SERVED_GUAMI_REGION_ID_0=128
- SERVED_GUAMI_AMF_SET_ID_0=1
- PLMN_SUPPORT_MCC=001
- PLMN_SUPPORT_MNC=01
- PLMN_SUPPORT_TAC=0x0001
# Slice 0 (1, 0xFFFFFF)
- SST_0=1
- AMF_INTERFACE_NAME_FOR_NGAP=eth0
- AMF_INTERFACE_NAME_FOR_N11=eth0
# One single SMF instance
- SMF_INSTANCE_ID_0=1
- SMF_FQDN_0=oai-smf
- SMF_IPV4_ADDR_0=192.168.70.133
- SELECTED_0=true
# Interaction with other NFs
- NF_REGISTRATION=yes
- USE_FQDN_DNS=yes
- EXTERNAL_AUSF=yes
# Algorithm choices
- CIPH_ALGO_LIST=["NEA0" , "NEA1" , "NEA2"]
- INT_ALGO_LIST=["NIA1" , "NIA2"]
# Other NF
- NRF_IPV4_ADDRESS=192.168.70.130
- NRF_FQDN=oai-nrf
- AUSF_IPV4_ADDRESS=192.168.70.138
- AUSF_FQDN=oai-ausf
- UDM_IPV4_ADDRESS=192.168.70.137
- UDM_FQDN=oai-udm
depends_on:
- mysql
- oai-nrf
- oai-ausf
networks:
......@@ -151,58 +114,30 @@ services:
ipv4_address: 192.168.70.132
oai-smf:
container_name: "oai-smf"
image: oaisoftwarealliance/oai-smf:v1.5.1
image: oaisoftwarealliance/oai-smf:develop
expose:
- 80/tcp
- 8080/tcp
- 8805/udp
volumes:
- ./conf/config.yaml:/openair-smf/etc/config.yaml
environment:
- TZ=Europe/Paris
- SMF_INTERFACE_NAME_FOR_N4=eth0
- SMF_INTERFACE_NAME_FOR_SBI=eth0
- DEFAULT_DNS_IPV4_ADDRESS=8.8.8.8
- DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4
- AMF_IPV4_ADDRESS=192.168.70.132
- AMF_FQDN=oai-amf
- UDM_IPV4_ADDRESS=192.168.70.137
- UDM_FQDN=oai-udm
- UPF_IPV4_ADDRESS=192.168.70.134
- UPF_FQDN_0=oai-spgwu-tiny
- NRF_IPV4_ADDRESS=192.168.70.130
- NRF_FQDN=oai-nrf
- USE_LOCAL_SUBSCRIPTION_INFO=yes
- REGISTER_NRF=yes
- DISCOVER_UPF=yes
- USE_FQDN_DNS=yes
- UE_MTU=1500
# Slice 0 (1, 0xFFFFFF)
- DNN_NI0=oai
- TYPE0=IPv4
- DNN_RANGE0=12.1.1.2 - 12.1.1.254
- NSSAI_SST0=1
- SESSION_AMBR_UL0=10Gbps
- SESSION_AMBR_DL0=10Gbps
# Slice 1 (1, 0xFFFFFF)
- DNN_NI1=openairinterface
- TYPE1=IPv4v6
- DNN_RANGE1=12.1.2.2 - 12.1.2.254
- NSSAI_SST1=1
- SESSION_AMBR_UL1=10Gbps
- SESSION_AMBR_DL1=10Gbps
# Slice 2 for ims
- DNN_NI2=ims
- TYPE2=IPv4v6
- DNN_RANGE2=12.1.9.2 - 12.1.9.254
- NSSAI_SST2=1
- SESSION_AMBR_UL2=10Gbps
- SESSION_AMBR_DL2=10Gbps
# IMS server
- DEFAULT_CSCF_IPV4_ADDRESS=192.168.70.139
depends_on:
- oai-nrf
- oai-amf
networks:
public_net:
ipv4_address: 192.168.70.133
oai-spgwu-tiny:
container_name: "oai-spgwu-tiny"
image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.1
oai-spgwu:
container_name: "oai-spgwu"
image: oaisoftwarealliance/oai-spgwu-tiny:develop
expose:
- 2152/udp
- 8805/udp
- 8080/tcp
# TODO: oai-spgwu-tiny will not support the new common yaml config file feature
# waiting for the new oai-upf NF
environment:
- TZ=Europe/Paris
- SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0
......@@ -213,9 +148,12 @@ services:
- ENABLE_5G_FEATURES=yes
- REGISTER_NRF=yes
- USE_FQDN_NRF=yes
- UPF_FQDN_5G=oai-spgwu-tiny
- UPF_FQDN_5G=oai-spgwu
- NRF_IPV4_ADDRESS=192.168.70.130
- NRF_FQDN=oai-nrf
# Mandatory to set the NRF PORT to 8080 (it is set to default to 80 otherwise)
- HTTP_VERSION=2
- NRF_PORT=8080
# Slice 0 (1, 0xFFFFFF)
- NSSAI_SST_0=1
- DNN_0=oai
......@@ -238,22 +176,25 @@ services:
public_net:
ipv4_address: 192.168.70.134
oai-ext-dn:
image: oaisoftwarealliance/trf-gen-cn5g:latest
privileged: true
init: true
container_name: oai-ext-dn
image: oaisoftwarealliance/trf-gen-cn5g:jammy
entrypoint: /bin/bash -c \
"ip route add 12.1.0.0/16 via 192.168.70.134 dev eth0; sleep infinity"
depends_on:
- oai-spgwu-tiny
"ip route add 12.1.0.0/16 via 192.168.70.134 dev eth0; ip route; sleep infinity"
command: ["/bin/bash", "-c", "trap : SIGTERM SIGINT; sleep infinity & wait"]
healthcheck:
test: /bin/bash -c "ip r | grep 12.1.0"
interval: 10s
timeout: 5s
retries: 5
interval: 5s
timeout: 2s
retries: 10
networks:
public_net:
ipv4_address: 192.168.70.135
networks:
# public_net:
# external:
# name: demo-oai-public-net
public_net:
driver: bridge
name: demo-oai-public-net
......
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface BUILD service
# Valid for Ubuntu 20.04 to cross-compile for ARM64
#
#---------------------------------------------------------------------
# Very important, the focal image shall not be using mirrors. A lot of them do NOT support ARM64.
FROM ubuntu:focal AS ran-base
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
#install developers pkg/repo
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
#enabling arm64 architecture
dpkg --add-architecture arm64 && \
echo "deb [arch=arm64] http://ports.ubuntu.com/ focal main restricted\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates main restricted\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal universe\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates universe\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal multiverse\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-updates multiverse\n" \
"deb [arch=arm64] http://ports.ubuntu.com/ focal-backports main restricted universe multiverse" \
| tee /etc/apt/sources.list.d/arm-cross-compile-sources.list && \
cp /etc/apt/sources.list "/etc/apt/sources.list.`date`.backup" && \
sed -i -E "s/(deb)\ (http:.+)/\1\ [arch=amd64]\ \2/" /etc/apt/sources.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
build-essential \
psmisc \
git \
tzdata \
xxd \
# ARM64 packages
libatlas-base-dev:arm64 \
libblas-dev:arm64 \
liblapack-dev:arm64 \
liblapacke-dev:arm64 \
libreadline-dev:arm64 \
libgnutls28-dev:arm64 \
libconfig-dev:arm64 \
libsctp-dev:arm64 \
libssl-dev:arm64 \
libtool:arm64 \
zlib1g-dev:arm64 \
# cross build libs and compilers
libc6-dev-i386 \
gcc-9-aarch64-linux-gnu \
g++-9-aarch64-linux-gnu && \
apt-get clean
# create the WORKDIR
WORKDIR /oai-ran
COPY . .
#run build_oai -I to get the builder image
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai -I && \
apt-get clean
......@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP -t Ethernet --verbose-ci --noavx512 -c
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP -t Ethernet --noavx512 -c
......@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP -t Ethernet --verbose-ci --noavx512 -c
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope" -w USRP -t Ethernet --noavx512 -c
......@@ -35,4 +35,4 @@ COPY . .
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP -t Ethernet --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib "telnetsrv enbscope uescope nrscope nrqtscope" -w USRP -t Ethernet --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
......@@ -19,74 +19,29 @@
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
# Python for CI of OAI-eNB + COTS-UE
#
# Required Python Version
# Python 3.x
# Dockerfile for the Open-Air-Interface BUILD service
# Valid for Ubuntu 20.04 to cross-compile for ARM64
#
# Required Python Package
# pexpect
#---------------------------------------------------------------------
#-----------------------------------------------------------
# Import Libs
#-----------------------------------------------------------
import sys # arg
import re # reg
import os
import subprocess
class SplitReport():
def __init__(self):
self.logfilename = ''
self.destinationFolder = ''
def split(self):
self.destinationFolder = self.logfilename.replace(".log","")
if os.path.isfile(self.logfilename):
newImageLog = open(self.logfilename + '.new', 'w')
copyFlag = True
with open(self.logfilename, 'r') as imageLog:
for line in imageLog:
header = False
ret = re.search('====== Start of log for ([0-9\.A-Za-z\-\_]+) ======', line)
if ret is not None:
copyFlag = False
header = True
detailedLogFile = open(self.destinationFolder + '/' + ret.group(1), 'w')
if copyFlag:
newImageLog.write(line)
ret = re.search('====== End of log for ([0-9\.A-Za-z\-\_]+) ======', line)
if ret is not None:
copyFlag = True
detailedLogFile.close()
elif not copyFlag and not header:
detailedLogFile.write(line)
imageLog.close()
newImageLog.close()
os.rename(self.logfilename + '.new', self.logfilename)
else:
print('Cannot split unfound file')
#--------------------------------------------------------------------------------------------------------
#
# Start of main
#
#--------------------------------------------------------------------------------------------------------
argvs = sys.argv
argc = len(argvs)
SP = SplitReport()
while len(argvs) > 1:
myArgv = argvs.pop(1)
if re.match('^\-\-logfilename=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match('^\-\-logfilename=(.+)$', myArgv, re.IGNORECASE)
SP.logfilename = matchReg.group(1)
SP.split()
sys.exit(0)
FROM ran-base:latest as ran-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
COPY . .
# build all targets so final targets can be created afterwards
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p ran_build/build ran_build/build-cross && \
cd ran_build/build && \
cmake ../../.. -GNinja && \
echo "====== Start of log for host-tools ======" && \
ninja ldpc_generators generate_T && \
echo "====== End of log for host-tools ======" && \
cd ../build-cross/ && \
cmake ../../.. -GNinja -DCMAKE_TOOLCHAIN_FILE=../../../cmake_targets/cross-arm.cmake -DNATIVE_DIR=../build && \
echo "====== Start of log for cross-build executables ======" && \
ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator && \
echo "====== End of log for cross-build executables ======"
......@@ -40,4 +40,4 @@ RUN /bin/sh oaienv && \
mkdir -p log && \
export CC=/usr/bin/clang && \
export CXX=/usr/bin/clang++ && \
./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --noavx512 --disable-T-Tracer -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --noavx512 --disable-T-Tracer -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
......@@ -38,7 +38,7 @@ RUN dnf install -y libasan libubsan
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
./build_oai --phy_simulators --ninja --verbose-ci --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
./build_oai --phy_simulators --ninja --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
#start from scratch for target executable
FROM registry.access.redhat.com/ubi9/ubi:latest as oai-physim
......
......@@ -250,7 +250,8 @@ void *pnf_nr_p7_thread_start(void *ptr) {
return 0;
}
int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_t *req) {
int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_t *req)
{
printf("[PNF] pnf param request\n");
nfapi_nr_pnf_param_response_t resp;
memset(&resp, 0, sizeof(resp));
......@@ -271,10 +272,11 @@ int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_
resp.pnf_param_general.shared_bands = pnf->shared_bands;
resp.pnf_param_general.shared_pa = pnf->shared_pa;
resp.pnf_param_general.maximum_total_power = pnf->max_total_power;
resp.num_tlvs = 1;
resp.pnf_phy.tl.tag = NFAPI_PNF_PHY_TAG;
resp.pnf_phy.number_of_phys = 1;
for(int i = 0; i < 1; ++i) {
for (int i = 0; i < 1; ++i) {
resp.pnf_phy.phy[i].phy_config_index = pnf->phys[i].index;
resp.pnf_phy.phy[i].downlink_channel_bandwidth_supported = pnf->phys[i].dl_channel_bw_support;
resp.pnf_phy.phy[i].uplink_channel_bandwidth_supported = pnf->phys[i].ul_channel_bw_support;
......@@ -284,21 +286,21 @@ int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_
resp.pnf_phy.phy[i].nmm_modes_supported = pnf->phys[i].nmm_modes_supported;
resp.pnf_phy.phy[i].number_of_rfs = 2;
for(int j = 0; j < 1; ++j) {
for (int j = 0; j < 1; ++j) {
resp.pnf_phy.phy[i].rf_config[j].rf_config_index = pnf->phys[i].rfs[j];
}
resp.pnf_phy.phy[i].number_of_rf_exclusions = 0;
for(int j = 0; j < 0; ++j) {
for (int j = 0; j < 0; ++j) {
resp.pnf_phy.phy[i].excluded_rf_config[j].rf_config_index = pnf->phys[i].excluded_rfs[j];
}
resp.num_tlvs++;
}
nfapi_nr_pnf_pnf_param_resp(config, &resp);
return 0;
}
int pnf_param_request(nfapi_pnf_config_t *config, nfapi_pnf_param_request_t *req) {
printf("[PNF] pnf param request\n");
nfapi_pnf_param_response_t resp;
......@@ -989,33 +991,35 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
return 0;
}
int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_config_request_scf_t *req)
int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_config_request_scf_t *req)
{
printf("[PNF] Received NFAPI_CONFIG_REQ phy_id:%d\n", req->header.phy_id);
pnf_info *pnf = (pnf_info *)(config->user_data);
uint8_t num_tlv = 0;
//struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
// In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
// struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
// In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
NR_DL_FRAME_PARMS *fp;
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) {
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
fp = &gNB->frame_parms;
} else {
fp = (NR_DL_FRAME_PARMS *) malloc(sizeof(NR_DL_FRAME_PARMS));
fp = (NR_DL_FRAME_PARMS *)malloc(sizeof(NR_DL_FRAME_PARMS));
}
phy_info *phy_info = pnf->phys;
printf("\nTiming window tag: %d\n",NFAPI_NR_NFAPI_TIMING_WINDOW_TAG);
if(req->nfapi_config.timing_window.tl.tag == NFAPI_NR_NFAPI_TIMING_WINDOW_TAG) {
printf("\nTiming window tag: %d\n", NFAPI_NR_NFAPI_TIMING_WINDOW_TAG);
if (req->nfapi_config.timing_window.tl.tag == NFAPI_NR_NFAPI_TIMING_WINDOW_TAG) {
phy_info->timing_window = req->nfapi_config.timing_window.value;
printf("Phy_info:Timing window:%u NFAPI_CONFIG:timing_window:%u\n", phy_info->timing_window, req->nfapi_config.timing_window.value);
printf("Phy_info:Timing window:%u NFAPI_CONFIG:timing_window:%u\n",
phy_info->timing_window,
req->nfapi_config.timing_window.value);
num_tlv++;
}
if(req->nfapi_config.timing_info_mode.tl.tag == NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG) {
if (req->nfapi_config.timing_info_mode.tl.tag == NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG) {
printf("timing info mode:%d\n", req->nfapi_config.timing_info_mode.value);
phy_info->timing_info_mode = req->nfapi_config.timing_info_mode.value;
num_tlv++;
......@@ -1023,8 +1027,8 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
phy_info->timing_info_mode = 0;
printf("NO timing info mode provided\n");
}
//TODO: Read the P7 message offset values
if(req->nfapi_config.timing_info_period.tl.tag == NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG) {
// TODO: Read the P7 message offset values
if (req->nfapi_config.timing_info_period.tl.tag == NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG) {
printf("timing info period provided value:%d\n", req->nfapi_config.timing_info_period.value);
phy_info->timing_info_period = req->nfapi_config.timing_info_period.value;
num_tlv++;
......@@ -1032,18 +1036,18 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
phy_info->timing_info_period = 0;
}
if(req->carrier_config.dl_bandwidth.tl.tag == NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG) {
phy_info->dl_channel_bw_support = req->carrier_config.dl_bandwidth.value; //rf_config.dl_channel_bandwidth.value;
fp->N_RB_DL = req->carrier_config.dl_bandwidth.value; //rf_config.dl_channel_bandwidth.value;
if (req->carrier_config.dl_bandwidth.tl.tag == NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG) {
phy_info->dl_channel_bw_support = req->carrier_config.dl_bandwidth.value; // rf_config.dl_channel_bandwidth.value;
fp->N_RB_DL = req->carrier_config.dl_bandwidth.value; // rf_config.dl_channel_bandwidth.value;
num_tlv++;
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG N_RB_DL:%u\n", __FUNCTION__, fp->N_RB_DL);
} else {
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Missing NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG\n", __FUNCTION__);
}
if(req->carrier_config.uplink_bandwidth.tl.tag == NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG) {
phy_info->ul_channel_bw_support = req->carrier_config.uplink_bandwidth.value; //req->rf_config.ul_channel_bandwidth.value;
fp->N_RB_UL = req->carrier_config.uplink_bandwidth.value; //req->rf_config.ul_channel_bandwidth.value;
if (req->carrier_config.uplink_bandwidth.tl.tag == NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG) {
phy_info->ul_channel_bw_support = req->carrier_config.uplink_bandwidth.value; // req->rf_config.ul_channel_bandwidth.value;
fp->N_RB_UL = req->carrier_config.uplink_bandwidth.value; // req->rf_config.ul_channel_bandwidth.value;
num_tlv++;
}
......@@ -1052,12 +1056,12 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
num_tlv++;
}
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG\n");
NR_PHY_Config_t nr_phy_config;
nr_phy_config.Mod_id = 0;
nr_phy_config.CC_id=0;
nr_phy_config.CC_id = 0;
nr_phy_config.cfg = req;
nr_phy_config_request(&nr_phy_config);
nr_dump_frame_parms(fp);
......@@ -1066,19 +1070,28 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
struct sockaddr_in vnf_p7_sockaddr;
memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4);
phy_info->remote_addr = inet_ntoa(vnf_p7_sockaddr.sin_addr);
printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n", phy_info->id, phy_info->remote_addr, phy_info->remote_port,
phy_info->timing_window, phy_info->timing_info_mode, phy_info->timing_info_period);
printf("[PNF] %d vnf p7 %s:%d timing %d %d %d\n",
phy_info->id,
phy_info->remote_addr,
phy_info->remote_port,
phy_info->timing_window,
phy_info->timing_info_mode,
phy_info->timing_info_period);
nfapi_nr_config_response_scf_t nfapi_resp;
memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id;
nfapi_resp.error_code = 0;
nfapi_resp.num_invalid_tlvs = 0;
nfapi_resp.num_invalid_tlvs_configured_in_idle = 0;
nfapi_resp.num_invalid_tlvs_configured_in_running = 0;
nfapi_resp.num_missing_tlvs = 0;
nfapi_nr_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PNF_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
if(NFAPI_MODE==NFAPI_UE_STUB_PNF)
if (NFAPI_MODE == NFAPI_UE_STUB_PNF)
free(fp);
return 0;
}
......
/*
* Copyright 2017 Cisco Systems, Inc.
*
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
*
* 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.
......@@ -14,7 +14,6 @@
* limitations under the License.
*/
#ifndef _NFAPI_H_
#define _NFAPI_H_
......@@ -40,7 +39,6 @@ uint8_t pulls16(uint8_t **in, int16_t *out, uint8_t *end);
uint8_t pull32(uint8_t **in, uint32_t *out, uint8_t *end);
uint8_t pulls32(uint8_t **in, int32_t *out, uint8_t *end);
uint32_t pullarray8(uint8_t **in, uint8_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
uint32_t pullarray16(uint8_t **in, uint16_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
uint32_t pullarrays16(uint8_t **in, int16_t out[], uint32_t max_len, uint32_t len, uint8_t *end);
......@@ -61,40 +59,79 @@ uint32_t pusharray32(const uint32_t *values_to_push,
uint8_t *out_end);
uint32_t pusharrays32(int32_t in[], uint32_t max_len, uint32_t len, uint8_t **out, uint8_t *end);
typedef uint8_t (*pack_array_elem_fn)(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end);
uint8_t packarray(void* array, uint16_t elem_size, uint16_t max_count, uint16_t count, uint8_t **ppWritePackedMsg, uint8_t *end, pack_array_elem_fn fn);
typedef uint8_t (*unpack_array_elem_fn)(void* elem, uint8_t **ppReadPackedMsg, uint8_t *end);
uint8_t unpackarray(uint8_t **ppReadPackedMsg, void* array, uint16_t elem_size, uint16_t max_count, uint16_t count, uint8_t *end, unpack_array_elem_fn fn);
typedef uint8_t (*pack_array_elem_fn)(void *elem, uint8_t **ppWritePackedMsg, uint8_t *end);
uint8_t packarray(void *array,
uint16_t elem_size,
uint16_t max_count,
uint16_t count,
uint8_t **ppWritePackedMsg,
uint8_t *end,
pack_array_elem_fn fn);
typedef uint8_t (*unpack_array_elem_fn)(void *elem, uint8_t **ppReadPackedMsg, uint8_t *end);
uint8_t unpackarray(uint8_t **ppReadPackedMsg,
void *array,
uint16_t elem_size,
uint16_t max_count,
uint16_t count,
uint8_t *end,
unpack_array_elem_fn fn);
uint8_t pack_tl(nfapi_tl_t *tl, uint8_t **ppWritePackedMsg, uint8_t *end);
uint8_t unpack_tl(uint8_t **ppReadPackedMsg, nfapi_tl_t *tl, uint8_t *end);
typedef uint8_t (*pack_tlv_fn)(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
typedef uint8_t (*pack_tlv_fn)(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn);
uint32_t pack_vendor_extension_tlv(nfapi_tl_t* ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config);
int unpack_vendor_extension(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t* config, nfapi_tl_t** ve_tlv);
typedef uint8_t (*unpack_tlv_fn)(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
typedef struct
{
uint16_t tag;
void* tlv;
unpack_tlv_fn unpack_func;
uint8_t pack_nr_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn);
uint32_t pack_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config);
int unpack_vendor_extension_tlv(nfapi_tl_t *tl,
uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_p4_p5_codec_config_t *config,
nfapi_tl_t **ve_tlv);
uint8_t get_tlv_padding(uint16_t tlv_length);
typedef uint8_t (*unpack_tlv_fn)(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end);
typedef struct {
uint16_t tag;
void *tlv;
unpack_tlv_fn unpack_func;
} unpack_tlv_t;
int unpack_tlv_list(unpack_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t* packedMsgEnd, nfapi_p4_p5_codec_config_t* config, nfapi_tl_t** ve);
uint32_t pack_p7_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config);
typedef uint8_t (*unpack_p7_tlv_fn)(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t*);
typedef struct
{
uint16_t tag;
void* tlv;
unpack_p7_tlv_fn unpack_func;
int unpack_tlv_list(unpack_tlv_t unpack_fns[],
uint16_t size,
uint8_t **ppReadPackedMsg,
uint8_t *packedMsgEnd,
nfapi_p4_p5_codec_config_t *config,
nfapi_tl_t **ve);
int unpack_nr_tlv_list(unpack_tlv_t unpack_fns[],
uint16_t size,
uint8_t **ppReadPackedMsg,
uint8_t *packedMsgEnd,
nfapi_p4_p5_codec_config_t *config,
nfapi_tl_t **ve);
uint32_t pack_p7_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
typedef uint8_t (*unpack_p7_tlv_fn)(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *);
typedef struct {
uint16_t tag;
void *tlv;
unpack_p7_tlv_fn unpack_func;
} unpack_p7_tlv_t;
int unpack_p7_tlv_list(unpack_p7_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t* packedMsgEnd, nfapi_p7_codec_config_t* config, nfapi_tl_t** ve);
int unpack_p7_tlv_list(unpack_p7_tlv_t unpack_fns[],
uint16_t size,
uint8_t **ppReadPackedMsg,
uint8_t *packedMsgEnd,
nfapi_p7_codec_config_t *config,
nfapi_tl_t **ve);
int unpack_nr_p7_tlv_list(unpack_p7_tlv_t unpack_fns[],
uint16_t size,
uint8_t **ppReadPackedMsg,
uint8_t *packedMsgEnd,
nfapi_p7_codec_config_t *config,
nfapi_tl_t **ve);
#if defined(__cplusplus)
}
......
......@@ -292,8 +292,8 @@ typedef enum {
} nfapi_nr_ssb_and_cset_mux_pattern_type_e;
typedef enum {
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=0,
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED=1
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=1,
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED=0
} nfapi_nr_cce_reg_mapping_type_e;
typedef enum {
......
......@@ -474,7 +474,8 @@ typedef struct {
typedef struct {
nfapi_p4_p5_message_header_t header;
uint32_t error_code;
uint8_t error_code;
uint8_t num_tlvs;
nfapi_pnf_param_general_t pnf_param_general;
nfapi_pnf_phy_t pnf_phy;
nfapi_vendor_extension_tlv_t vendor_extension;
......@@ -489,7 +490,7 @@ typedef struct {
typedef struct {
nfapi_p4_p5_message_header_t header;
uint32_t error_code;
uint8_t error_code;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_pnf_config_response_t;
......@@ -566,7 +567,10 @@ typedef struct {
typedef struct {
nfapi_p4_p5_message_header_t header;
uint8_t error_code;
//uint8_t num_invalid_tlvs;
uint8_t num_invalid_tlvs;
uint8_t num_invalid_tlvs_configured_in_idle;
uint8_t num_invalid_tlvs_configured_in_running;
uint8_t num_missing_tlvs;
// TODO: add list of invalid/unsupported TLVs (see Table 3.18)
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_config_response_scf_t;
......
......@@ -567,9 +567,14 @@ uint32_t pack_vendor_extension_tlv(nfapi_tl_t *ve, uint8_t **ppWritePackedMsg, u
return 1;
}
uint32_t unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config, nfapi_tl_t **ve_tlv) {
if(ve_tlv != 0 && config != 0) {
if(config->unpack_vendor_extension_tlv) {
int unpack_vendor_extension_tlv(nfapi_tl_t *tl,
uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_p4_p5_codec_config_t *config,
nfapi_tl_t **ve_tlv)
{
if (ve_tlv != 0 && config != 0) {
if (config->unpack_vendor_extension_tlv) {
return (config->unpack_vendor_extension_tlv)(tl, ppReadPackedMsg, end, (void **)ve_tlv, config);
}
}
......@@ -702,6 +707,104 @@ int unpack_tlv_list(unpack_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPa
return 1;
}
int unpack_nr_tlv_list(unpack_tlv_t unpack_fns[],
uint16_t size,
uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_p4_p5_codec_config_t *config,
nfapi_tl_t **ve)
{
nfapi_tl_t generic_tl;
uint8_t numBadTags = 0;
uint16_t idx = 0;
while ((uint8_t *)(*ppReadPackedMsg) < end) {
// unpack the tl and process the values accordingly
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0;
uint8_t tagMatch = 0;
uint8_t *pStartOfValue = *ppReadPackedMsg;
for (idx = 0; idx < size; ++idx) {
if (unpack_fns[idx].tag == generic_tl.tag) { // match the extracted tag value with all the tags in unpack_fn list
tagMatch = 1;
nfapi_tl_t *tl = (nfapi_tl_t *)(unpack_fns[idx].tlv);
tl->tag = generic_tl.tag;
tl->length = generic_tl.length;
int result = (*unpack_fns[idx].unpack_func)(tl, ppReadPackedMsg, end);
if (result == 0) {
return 0;
}
// check if the length was right;
if (tl->length != (*ppReadPackedMsg - pStartOfValue)) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"Warning tlv tag 0x%x length %d not equal to unpack %ld\n",
tl->tag,
tl->length,
(*ppReadPackedMsg - pStartOfValue));
on_error();
}
// Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
int padding = get_tlv_padding(tl->length);
if (padding != 0) {
(*ppReadPackedMsg) += padding;
}
}
}
if (tagMatch == 0) {
if (generic_tl.tag >= NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE && generic_tl.tag <= NFAPI_VENDOR_EXTENSION_MAX_TAG_VALUE) {
int result = unpack_vendor_extension_tlv(&generic_tl, ppReadPackedMsg, end, config, ve);
if (result == 0) {
// got tot the end.
return 0;
} else if (result < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown VE TAG value: 0x%04x\n", generic_tl.tag);
on_error();
if (++numBadTags > MAX_BAD_TAG) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
on_error();
return 0;
}
if ((end - *ppReadPackedMsg) >= generic_tl.length) {
// Advance past the unknown TLV
(*ppReadPackedMsg) += generic_tl.length + get_tlv_padding(generic_tl.length);
} else {
// go to the end
return 0;
}
}
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown TAG value: 0x%04x\n", generic_tl.tag);
on_error();
if (++numBadTags > MAX_BAD_TAG) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
on_error();
return 0;
}
if ((end - *ppReadPackedMsg) >= generic_tl.length) {
// Advance past the unknown TLV
(*ppReadPackedMsg) += generic_tl.length + get_tlv_padding(generic_tl.length);
} else {
// go to the end
return 0;
}
}
}
}
return 1;
}
int unpack_p7_tlv_list(unpack_p7_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config, nfapi_tl_t **ve) {
nfapi_tl_t generic_tl;
uint8_t numBadTags = 0;
......@@ -785,6 +888,103 @@ int unpack_p7_tlv_list(unpack_p7_tlv_t unpack_fns[], uint16_t size, uint8_t **pp
return 1;
}
int unpack_nr_p7_tlv_list(unpack_p7_tlv_t unpack_fns[],
uint16_t size,
uint8_t **ppReadPackedMsg,
uint8_t *end,
nfapi_p7_codec_config_t *config,
nfapi_tl_t **ve)
{
nfapi_tl_t generic_tl;
uint8_t numBadTags = 0;
uint16_t idx = 0;
while ((uint8_t *)(*ppReadPackedMsg) < end) {
// unpack the tl and process the values accordingly
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0;
uint8_t tagMatch = 0;
uint8_t *pStartOfValue = *ppReadPackedMsg;
for (idx = 0; idx < size; ++idx) {
if (unpack_fns[idx].tag == generic_tl.tag) {
tagMatch = 1;
nfapi_tl_t *tl = (nfapi_tl_t *)(unpack_fns[idx].tlv);
tl->tag = generic_tl.tag;
tl->length = generic_tl.length;
int result = (*unpack_fns[idx].unpack_func)(tl, ppReadPackedMsg, end, config);
if (result == 0) {
return 0;
}
// check if the length was right;
if (tl->length != (*ppReadPackedMsg - pStartOfValue)) {
NFAPI_TRACE(NFAPI_TRACE_ERROR,
"Warning tlv tag 0x%x length %d not equal to unpack %ld\n",
tl->tag,
tl->length,
(*ppReadPackedMsg - pStartOfValue));
on_error();
}
// Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
int padding = get_tlv_padding(tl->length);
if (padding != 0) {
(*ppReadPackedMsg) += padding;
}
}
}
if (tagMatch == 0) {
if (generic_tl.tag >= NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE && generic_tl.tag <= NFAPI_VENDOR_EXTENSION_MAX_TAG_VALUE) {
int result = unpack_p7_vendor_extension_tlv(&generic_tl, ppReadPackedMsg, end, config, ve);
if (result == 0) {
// got to end
return 0;
} else if (result < 0) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown TAG value: 0x%04x\n", generic_tl.tag);
on_error();
if (++numBadTags > MAX_BAD_TAG) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
on_error();
return -1;
}
if ((end - *ppReadPackedMsg) >= generic_tl.length) {
// Advance past the unknown TLV
(*ppReadPackedMsg) += generic_tl.length + get_tlv_padding(generic_tl.length);
} else {
// got ot the dn
return 0;
}
}
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown TAG value: 0x%04x\n", generic_tl.tag);
on_error();
if (++numBadTags > MAX_BAD_TAG) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Supplied message has had too many bad tags\n");
on_error();
return -1;
}
if ((end - *ppReadPackedMsg) >= generic_tl.length) {
// Advance past the unknown TLV
(*ppReadPackedMsg) += generic_tl.length + get_tlv_padding(generic_tl.length);
} else {
// got ot the dn
return 0;
}
}
}
}
return 1;
}
// This intermediate function deals with calculating the length of the value
// and writing into the tlv header.
uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn) {
......@@ -820,6 +1020,47 @@ uint8_t pack_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *e
return 1;
}
uint8_t pack_nr_tlv(uint16_t tag, void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end, pack_tlv_fn fn)
{
nfapi_tl_t *tl = (nfapi_tl_t *)tlv;
// If the tag is defined
if (tl->tag == tag) {
uint8_t *pStartOfTlv = *ppWritePackedMsg;
// write a dumy tlv header
if (pack_tl(tl, ppWritePackedMsg, end) == 0)
return 0;
// Record the start of the value
uint8_t *pStartOfValue = *ppWritePackedMsg;
// pack the tlv value
if (fn(tlv, ppWritePackedMsg, end) == 0)
return 0;
// calculate the length of the value and rewrite the tl header
tl->length = (*ppWritePackedMsg) - pStartOfValue;
// rewrite the header with the correct length
pack_tl(tl, &pStartOfTlv, end);
// Add padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1)
int padding = get_tlv_padding(tl->length);
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "TLV 0x%x with padding of %d bytes\n", tl->tag, padding);
if (padding != 0) {
memset(*ppWritePackedMsg, 0, padding);
(*ppWritePackedMsg) += padding;
}
} else {
if (tl->tag != 0) {
NFAPI_TRACE(NFAPI_TRACE_WARN, "Warning pack_tlv tag 0x%x does not match expected 0x%x\n", tl->tag, tag);
} else {
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "Warning pack_tlv tag 0x%x ZERO does not match expected 0x%x\n", tl->tag, tag);
}
}
return 1;
}
const char *nfapi_error_code_to_str(nfapi_error_code_e value) {
switch(value) {
case NFAPI_MSG_OK:
......@@ -853,3 +1094,8 @@ const char *nfapi_error_code_to_str(nfapi_error_code_e value) {
return "UNKNOWN";
}
}
uint8_t get_tlv_padding(uint16_t tlv_length)
{
return (4 - (tlv_length % 4)) % 4;
}
This diff is collapsed.
This diff is collapsed.
......@@ -2131,77 +2131,77 @@ int pnf_read_dispatch_message(pnf_t* pnf)
int pnf_nr_read_dispatch_message(pnf_t* pnf)
{
int socket_connected = 1;
// 1. Peek the message header
// 2. If the message is larger than the stack buffer then create a dynamic buffer
// 3. Read the buffer
// 4. Handle the p5 message
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
uint8_t* dynamic_buffer = 0;
uint8_t* read_buffer = &stack_buffer[0];
uint32_t message_size = 0;
struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
{
int flags = MSG_PEEK;
message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, /*(struct sockaddr*)&addr, &addr_len*/ 0, 0, &sndrcvinfo, &flags);
if(message_size == -1)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to peek sctp message size errno:%d\n", errno);
return 0;
}
nfapi_p4_p5_message_header_t header;
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
if(unpack_result < 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to unpack p5 message header\n");
return 0;
}
message_size = header.message_length;
// now have the size of the mesage
}
if(message_size > stack_buffer_size)
{
dynamic_buffer = (uint8_t*)malloc(message_size);
if(dynamic_buffer == NULL)
{
// todo : add error mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
return -1;
}
read_buffer = dynamic_buffer;
}
{
int flags = 0;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
if(recvmsg_result == -1)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
}
else
{
int socket_connected = 1;
// 1. Peek the message header
// 2. If the message is larger than the stack buffer then create a dynamic buffer
// 3. Read the buffer
// 4. Handle the p5 message
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
uint32_t stack_buffer_size = 32; // should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
uint8_t* dynamic_buffer = 0;
uint8_t* read_buffer = &stack_buffer[0];
uint32_t message_size = 0;
struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
{
int flags = MSG_PEEK;
message_size = sctp_recvmsg(pnf->p5_sock,
header_buffer,
header_buffer_size,
/*(struct sockaddr*)&addr, &addr_len*/ 0,
0,
&sndrcvinfo,
&flags);
if (message_size == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to peek sctp message size errno:%d\n", errno);
return 0;
}
nfapi_p4_p5_message_header_t header;
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
if (unpack_result < 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to unpack p5 message header\n");
return 0;
}
message_size = header.message_length + header_buffer_size;
// now have the size of the mesage
}
if (message_size > stack_buffer_size) {
dynamic_buffer = (uint8_t*)malloc(message_size);
if (dynamic_buffer == NULL) {
// todo : add error mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
return -1;
}
read_buffer = dynamic_buffer;
}
{
int flags = 0;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
int recvmsg_result =
sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
if (recvmsg_result == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
} else {
#if 0
// print the received message
printf("\n MESSAGE RECEIVED: \n");
......@@ -2211,56 +2211,44 @@ int pnf_nr_read_dispatch_message(pnf_t* pnf)
printf("\n");
#endif
if (flags & MSG_NOTIFICATION)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
// todo - handle the events
}
else
{
/*
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
pnf->p5_sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port),
sndrcvinfo.sinfo_assoc_id,
sndrcvinfo.sinfo_stream,
ntohl(sndrcvinfo.sinfo_ppid),
message_size,
flags);
*/
// handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80)
{
pnf_nr_handle_p5_message(pnf, read_buffer, message_size);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
// assume socket disconnected
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
socket_connected = 0;
}
}
}
}
if(dynamic_buffer)
{
free(dynamic_buffer);
}
return socket_connected;
if (flags & MSG_NOTIFICATION) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
// todo - handle the events
} else {
/*
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
pnf->p5_sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port),
sndrcvinfo.sinfo_assoc_id,
sndrcvinfo.sinfo_stream,
ntohl(sndrcvinfo.sinfo_ppid),
message_size,
flags);
*/
// handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80) {
pnf_nr_handle_p5_message(pnf, read_buffer, message_size);
} else {
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
// assume socket disconnected
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
socket_connected = 0;
}
}
}
}
if (dynamic_buffer) {
free(dynamic_buffer);
}
return socket_connected;
}
int pnf_message_pump(pnf_t* pnf)
{
uint8_t socketConnected = 1;
......
......@@ -1240,134 +1240,118 @@ void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_
}
}
int vnf_nr_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
{
if(1)
{
int socket_connected = 1;
// 1. Peek the message header
// 2. If the message is larger than the stack buffer then create a dynamic buffer
// 3. Read the buffer
// 4. Handle the p5 message
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
uint8_t* dynamic_buffer = 0;
uint8_t* read_buffer = &stack_buffer[0];
uint32_t message_size = 0;
struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
{
int flags = MSG_PEEK;
message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
if(message_size == -1)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to peek sctp message size errno:%d\n", errno);
return 0;
}
nfapi_p4_p5_message_header_t header;
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
if(unpack_result < 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to decode message header %d\n", unpack_result);
return 0;
}
message_size = header.message_length;
// now have the size of the mesage
}
if(message_size > stack_buffer_size)
{
dynamic_buffer = (uint8_t*)malloc(message_size);
if(dynamic_buffer == NULL)
{
// todo : add error mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
return -1;
}
read_buffer = dynamic_buffer;
}
{
int flags = 0;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
if(recvmsg_result == -1)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
}
else
{
if (flags & MSG_NOTIFICATION)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
// todo - handle the events
}
else
{
/*
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
pnf->p5_sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port),
sndrcvinfo.sinfo_assoc_id,
sndrcvinfo.sinfo_stream,
ntohl(sndrcvinfo.sinfo_ppid),
message_size,
flags);
*/
// handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80)
{
// printf("\nVNF RECEIVES:\n");
// for(int i=0; i<message_size; i++){
// printf("%d", read_buffer[i]);
// }
// printf("\n");
vnf_nr_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
// assume socket disconnected
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
socket_connected = 0;
}
}
}
}
if(dynamic_buffer)
{
free(dynamic_buffer);
}
return socket_connected;
}
if (1) {
int socket_connected = 1;
// 1. Peek the message header
// 2. If the message is larger than the stack buffer then create a dynamic buffer
// 3. Read the buffer
// 4. Handle the p5 message
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
uint32_t stack_buffer_size = 32; // should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
uint8_t* dynamic_buffer = 0;
uint8_t* read_buffer = &stack_buffer[0];
uint32_t message_size = 0;
struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
{
int flags = MSG_PEEK;
message_size =
sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
if (message_size == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to peek sctp message size errno:%d\n", errno);
return 0;
}
nfapi_p4_p5_message_header_t header;
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
if (unpack_result < 0) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to decode message header %d\n", unpack_result);
return 0;
}
message_size = header.message_length + header_buffer_size;
// now have the size of the mesage
}
if (message_size > stack_buffer_size) {
dynamic_buffer = (uint8_t*)malloc(message_size);
if (dynamic_buffer == NULL) {
// todo : add error mesage
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
return -1;
}
read_buffer = dynamic_buffer;
}
{
int flags = 0;
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
int recvmsg_result =
sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
if (recvmsg_result == -1) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
} else {
if (flags & MSG_NOTIFICATION) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
// todo - handle the events
} else {
/*
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
pnf->p5_sock,
inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port),
sndrcvinfo.sinfo_assoc_id,
sndrcvinfo.sinfo_stream,
ntohl(sndrcvinfo.sinfo_ppid),
message_size,
flags);
*/
// handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80) {
// printf("\nVNF RECEIVES:\n");
// for(int i=0; i<message_size; i++){
// printf("%d", read_buffer[i]);
// }
// printf("\n");
vnf_nr_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
} else {
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
// assume socket disconnected
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
socket_connected = 0;
}
}
}
}
if (dynamic_buffer) {
free(dynamic_buffer);
}
return socket_connected;
}
}
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
......
This diff is collapsed.
......@@ -34,9 +34,9 @@ void exit_function(const char* file, const char* function, const int line, const
exit(-1);
}
signed char quantize(double D, double x, unsigned char B) {
int8_t quantize(double D, double x, uint8_t B) {
double qxd;
short maxlev;
int16_t maxlev;
qxd = floor(x / D);
maxlev = 1 << (B - 1); //(char)(pow(2,B-1));
......@@ -45,7 +45,7 @@ signed char quantize(double D, double x, unsigned char B) {
else if (qxd >= maxlev)
qxd = maxlev - 1;
return ((char) qxd);
return ((int8_t) qxd);
}
......
......@@ -23,6 +23,7 @@
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "assertions.h"
#include "SIMULATION/TOOLS/sim.h"
#include "common/utils/load_module_shlib.h"
......@@ -43,7 +44,7 @@
#define NR_LDPC_ENABLE_PARITY_CHECK
// 4-bit quantizer
char quantize4bit(double D,double x)
int8_t quantize4bit(double D,double x)
{
double qxd;
qxd = floor(x/D);
......@@ -54,13 +55,13 @@ char quantize4bit(double D,double x)
else if (qxd > 7)
qxd = 7;
return((char)qxd);
return((int8_t)qxd);
}
char quantize8bit(double D,double x)
int8_t quantize8bit(double D,double x)
{
double qxd;
//char maxlev;
//int8_t maxlev;
qxd = floor(x/D);
//maxlev = 1<<(B-1);
......@@ -72,7 +73,7 @@ char quantize8bit(double D,double x)
else if (qxd >= 128)
qxd = 127;
return((char)qxd);
return((int8_t)qxd);
}
typedef struct {
......@@ -92,7 +93,7 @@ int test_ldpc(short max_iterations,
int nom_rate,
int denom_rate,
double SNR,
unsigned char qbits,
uint8_t qbits,
short block_length,
unsigned int ntrials,
int n_segments,
......@@ -117,15 +118,15 @@ int test_ldpc(short max_iterations,
sigma = 1.0/sqrt(2*SNR);
opp_enabled=1;
//short test_input[block_length];
unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
uint8_t *test_input[MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
//short *c; //padded codeword
unsigned char estimated_output[MAX_NUM_DLSCH_SEGMENTS][block_length];
uint8_t 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_input_optim[MAX_NUM_DLSCH_SEGMENTS];
uint8_t *channel_input[MAX_NUM_DLSCH_SEGMENTS];
uint8_t *channel_input_optim[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 };
int8_t channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
short BG=0,nrows=0;//,ncols;
int no_punctured_columns,removed_bit;
int i1,Zc,Kb=0;
......@@ -149,12 +150,12 @@ int test_ldpc(short max_iterations,
// generate input block
for(int j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
test_input[j]=(unsigned char *)malloc16(sizeof(unsigned char) * block_length/8);
memset(test_input[j], 0, sizeof(unsigned char) * block_length / 8);
channel_input[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
memset(channel_input[j], 0, sizeof(unsigned char) * 68 * 384);
channel_input_optim[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
memset(channel_input_optim[j], 0, sizeof(unsigned char) * 68 * 384);
test_input[j]=(uint8_t *)malloc16(sizeof(uint8_t) * block_length/8);
memset(test_input[j], 0, sizeof(uint8_t) * block_length / 8);
channel_input[j] = (uint8_t *)malloc16(sizeof(uint8_t) * 68*384);
memset(channel_input[j], 0, sizeof(uint8_t) * 68 * 384);
channel_input_optim[j] = (uint8_t *)malloc16(sizeof(uint8_t) * 68*384);
memset(channel_input_optim[j], 0, sizeof(uint8_t) * 68 * 384);
}
reset_meas(&time);
......@@ -179,7 +180,7 @@ int test_ldpc(short max_iterations,
for (int j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
for (int i=0; i<block_length/8; i++) {
test_input[j][i]=(unsigned char) rand();
test_input[j][i]=(uint8_t) rand();
//test_input[j][i]=j%256;
//test_input[j][i]=252;
}
......@@ -265,7 +266,7 @@ int test_ldpc(short max_iterations,
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
encoder_implemparams_t impp=INIT0_LDPCIMPLEMPARAMS;
impp.gen_code=1;
impp.gen_code = 2;
if (ntrials==0)
encoder_orig(test_input,channel_input, Zc, BG, block_length, BG, &impp);
impp.gen_code=0;
......@@ -327,21 +328,21 @@ int test_ldpc(short max_iterations,
modulated_input[j][i]=-1.0;///sqrt(2);
///channel_output[i] = modulated_input[i] + gaussdouble(0.0,1.0) * 1/sqrt(2*SNR);
//channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
//channel_output_fixed[i] = (int8_t) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//channel_output_fixed[i] = (char)quantize(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits);
channel_output_fixed[j][i] = (char)quantize(sigma/4.0/4.0,modulated_input[j][i] + sigma*gaussdouble(0.0,1.0),qbits);
//channel_output_fixed[i] = (char)quantize8bit(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0));
//channel_output_fixed[i] = (int8_t)quantize(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits);
channel_output_fixed[j][i] = (int8_t)quantize(sigma/4.0/4.0,modulated_input[j][i] + sigma*gaussdouble(0.0,1.0),qbits);
//channel_output_fixed[i] = (int8_t)quantize8bit(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0));
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//printf("channel_output_fixed[%d]: %d\n",i,channel_output_fixed[i]);
//Uncoded BER
unsigned char channel_output_uncoded = channel_output_fixed[j][i]<0 ? 1 /* QPSK demod */ : 0;
uint8_t channel_output_uncoded = channel_output_fixed[j][i]<0 ? 1 /* QPSK demod */ : 0;
if (channel_output_uncoded != channel_input_optim[j][i-2*Zc])
*errors_bit_uncoded = (*errors_bit_uncoded) + 1;
*errors_bit_uncoded = (*errors_bit_uncoded) + 1;
}
......@@ -373,8 +374,8 @@ int test_ldpc(short max_iterations,
}
for (int i=0; i<block_length; 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
uint8_t estoutputbit = (estimated_output[j][i/8]&(1<<(i&7)))>>(i&7);
uint8_t inputbit = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments
if (estoutputbit != inputbit)
*errors_bit = (*errors_bit) + 1;
}
......@@ -445,7 +446,7 @@ int main(int argc, char *argv[])
int nom_rate=1;
int denom_rate=3;
double SNR0=-2.0,SNR,SNR_lin;
unsigned char qbits=8;
uint8_t qbits=8;
unsigned int decoded_errors[10000]; // initiate the size of matrix equivalent to size of SNR
int c,i=0, i1 = 0;
......
......@@ -116,7 +116,7 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
}
/*
void print_shorts(char *s,__m128i *x) {
void print_shorts(char *s,simde__m128i *x) {
short *tempb = (short *)x;
......
......@@ -39,9 +39,6 @@
#ifndef __CRC_H__
#define __CRC_H__
#include <x86intrin.h>
#include "crcext.h"
#include "types.h"
#include "PHY/sse_intrin.h"
......@@ -305,14 +302,20 @@ uint32_t crc32_calc_slice4(const uint8_t *data,
* @return New 16 byte folded data
*/
__forceinline
__m128i crc32_folding_round(const __m128i data_block,
const __m128i k1_k2,
const __m128i fold)
simde__m128i crc32_folding_round(const simde__m128i data_block,
const simde__m128i k1_k2,
const simde__m128i fold)
{
__m128i tmp = _mm_clmulepi64_si128(fold, k1_k2, 0x11);
#ifdef __x86_64__
simde__m128i tmp = _mm_clmulepi64_si128(fold, k1_k2, 0x11);
return simde_mm_xor_si128(_mm_clmulepi64_si128(fold, k1_k2, 0x00), simde_mm_xor_si128(data_block, tmp));
#else
simde__m128i tmp = simde_mm_clmulepi64_si128(fold, k1_k2, 0x11);
return _mm_xor_si128(_mm_clmulepi64_si128(fold, k1_k2, 0x00),
_mm_xor_si128(data_block, tmp));
return simde_mm_xor_si128(simde_mm_clmulepi64_si128(fold, k1_k2, 0x00),
simde_mm_xor_si128(data_block, tmp));
#endif
}
/**
......@@ -324,17 +327,23 @@ __m128i crc32_folding_round(const __m128i data_block,
* @return data reduced to 64 bits
*/
__forceinline
__m128i crc32_reduce_128_to_64(__m128i data128, const __m128i k3_q)
simde__m128i crc32_reduce_128_to_64(simde__m128i data128, const simde__m128i k3_q)
{
__m128i tmp;
simde__m128i tmp;
tmp = _mm_xor_si128(_mm_clmulepi64_si128(data128, k3_q, 0x01 /* k3 */),
#ifdef __x86_64__
tmp = simde_mm_xor_si128(_mm_clmulepi64_si128(data128, k3_q, 0x01 /* k3 */),
data128);
data128 = _mm_xor_si128(_mm_clmulepi64_si128(tmp, k3_q, 0x01 /* k3 */),
data128 = simde_mm_xor_si128(_mm_clmulepi64_si128(tmp, k3_q, 0x01 /* k3 */),
data128);
#else
tmp = simde_mm_xor_si128(simde_mm_clmulepi64_si128(data128, k3_q, 0x01 /* k3 */), data128);
data128 = simde_mm_xor_si128(simde_mm_clmulepi64_si128(tmp, k3_q, 0x01 /* k3 */), data128);
return _mm_srli_si128(_mm_slli_si128(data128, 8), 8);
#endif
return simde_mm_srli_si128(simde_mm_slli_si128(data128, 8), 8);
}
/**
......@@ -348,15 +357,22 @@ __m128i crc32_reduce_128_to_64(__m128i data128, const __m128i k3_q)
*/
__forceinline
uint32_t
crc32_reduce_64_to_32(__m128i fold, const __m128i k3_q, const __m128i p_res)
crc32_reduce_64_to_32(simde__m128i fold, const simde__m128i k3_q, const simde__m128i p_res)
{
__m128i temp;
temp = _mm_clmulepi64_si128(_mm_srli_si128(fold, 4),
simde__m128i temp;
#ifdef __x86_64__
temp = _mm_clmulepi64_si128(simde_mm_srli_si128(fold, 4),
k3_q, 0x10 /* Q */);
temp = _mm_srli_si128(_mm_xor_si128(temp, fold), 4);
temp = simde_mm_srli_si128(simde_mm_xor_si128(temp, fold), 4);
temp = _mm_clmulepi64_si128(temp, p_res, 0 /* P */);
return _mm_extract_epi32(_mm_xor_si128(temp, fold), 0);
#else
temp = simde_mm_clmulepi64_si128(simde_mm_srli_si128(fold, 4),
k3_q, 0x10 /* Q */);
temp = simde_mm_srli_si128(simde_mm_xor_si128(temp, fold), 4);
temp = simde_mm_clmulepi64_si128(temp, p_res, 0 /* P */);
#endif
return simde_mm_extract_epi32(simde_mm_xor_si128(temp, fold), 0);
}
/**
......@@ -379,7 +395,7 @@ crc32_calc_pclmulqdq(const uint8_t *data,
uint32_t data_len, uint32_t crc,
const struct crc_pclmulqdq_ctx *params)
{
__m128i temp, fold, k, swap;
simde__m128i temp, fold, k, swap;
uint32_t n;
if (unlikely(data == NULL || data_len == 0 || params == NULL))
......@@ -405,7 +421,7 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* Load first 16 data bytes in \a fold and
* set \a swap BE<->LE 16 byte conversion variable
*/
fold = _mm_loadu_si128((__m128i *)data);
fold = simde_mm_loadu_si128((simde__m128i *)data);
swap = crc_xmm_be_le_swap128;
/**
......@@ -420,20 +436,20 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* - adjust data block
* - 4 least significant bytes need to be zero
*/
fold = _mm_shuffle_epi8(fold, swap);
fold = _mm_slli_si128(xmm_shift_right(fold, 20 - data_len), 4);
fold = simde_mm_shuffle_epi8(fold, swap);
fold = simde_mm_slli_si128(xmm_shift_right(fold, 20 - data_len), 4);
/**
* Apply CRC init value
*/
temp = _mm_insert_epi32(_mm_setzero_si128(), bswap4(crc), 0);
temp = simde_mm_insert_epi32(simde_mm_setzero_si128(), bswap4(crc), 0);
temp = xmm_shift_left(temp, data_len - 4);
fold = _mm_xor_si128(fold, temp);
fold = simde_mm_xor_si128(fold, temp);
} else {
/**
* There are 2x16 data blocks or more
*/
__m128i next_data;
simde__m128i next_data;
/**
* n = number of bytes required to align \a data_len
......@@ -445,10 +461,10 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* Apply CRC initial value and
* get \a fold to BE format
*/
fold = _mm_xor_si128(fold,
_mm_insert_epi32(_mm_setzero_si128(),
fold = simde_mm_xor_si128(fold,
simde_mm_insert_epi32(simde_mm_setzero_si128(),
crc, 0));
fold = _mm_shuffle_epi8(fold, swap);
fold = simde_mm_shuffle_epi8(fold, swap);
/**
* Load next 16 bytes of data and
......@@ -456,9 +472,9 @@ crc32_calc_pclmulqdq(const uint8_t *data,
*
* CONCAT(fold,next_data) >> (n*8)
*/
next_data = _mm_loadu_si128((__m128i *)&data[16]);
next_data = _mm_shuffle_epi8(next_data, swap);
next_data = _mm_or_si128(xmm_shift_right(next_data, n),
next_data = simde_mm_loadu_si128((simde__m128i *)&data[16]);
next_data = simde_mm_shuffle_epi8(next_data, swap);
next_data = simde_mm_or_si128(xmm_shift_right(next_data, n),
xmm_shift_left(fold, 16 - n));
fold = xmm_shift_right(fold, n);
......@@ -467,12 +483,12 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* In such unlikely case clear 4 least significant bytes
*/
next_data =
_mm_slli_si128(_mm_srli_si128(next_data, 4), 4);
simde_mm_slli_si128(simde_mm_srli_si128(next_data, 4), 4);
/**
* Do the initial folding round on 2 first 16 byte chunks
*/
k = _mm_load_si128((__m128i *)(&params->k1));
k = simde_mm_load_si128((simde__m128i *)(&params->k1));
fold = crc32_folding_round(next_data, k, fold);
if (likely(data_len > 32)) {
......@@ -480,7 +496,7 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* \a data_block needs to be at least 48 bytes long
* in order to get here
*/
__m128i new_data;
simde__m128i new_data;
/**
* Main folding loop
......@@ -493,8 +509,8 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* - the last 16 bytes is processed separately
*/
for (n = 16 + 16 - n; n < (data_len - 16); n += 16) {
new_data = _mm_loadu_si128((__m128i *)&data[n]);
new_data = _mm_shuffle_epi8(new_data, swap);
new_data = simde_mm_loadu_si128((simde__m128i *)&data[n]);
new_data = simde_mm_shuffle_epi8(new_data, swap);
fold = crc32_folding_round(new_data, k, fold);
}
......@@ -504,9 +520,9 @@ crc32_calc_pclmulqdq(const uint8_t *data,
* Read from offset -4 is to avoid one
* shift right operation.
*/
new_data = _mm_loadu_si128((__m128i *)&data[n - 4]);
new_data = _mm_shuffle_epi8(new_data, swap);
new_data = _mm_slli_si128(new_data, 4);
new_data = simde_mm_loadu_si128((simde__m128i *)&data[n - 4]);
new_data = simde_mm_shuffle_epi8(new_data, swap);
new_data = simde_mm_slli_si128(new_data, 4);
fold = crc32_folding_round(new_data, k, fold);
} /* if (data_len > 32) */
}
......@@ -520,14 +536,14 @@ crc32_calc_pclmulqdq(const uint8_t *data,
/**
* REDUCTION 128 -> 64
*/
k = _mm_load_si128((__m128i *)(&params->k3));
k = simde_mm_load_si128((simde__m128i *)(&params->k3));
fold = crc32_reduce_128_to_64(fold, k);
/**
* REDUCTION 64 -> 32
*/
n = crc32_reduce_64_to_32(fold, k,
_mm_load_si128((__m128i *)(&params->p)));
simde_mm_load_si128((simde__m128i *)(&params->p)));
#ifdef __KERNEL__
/**
......
......@@ -30,17 +30,15 @@
Modified in June, 2001, to include the length non multiple of 8
*/
#ifndef __SSE4_1__
#if !defined(__SSE4_1__) && !defined(__aarch64__)
#define USE_INTEL_CRC 0
#else
#define USE_INTEL_CRC __SSE4_1__
#define USE_INTEL_CRC 1
#include "crc.h"
#endif
#include "coding_defs.h"
#include "assertions.h"
#if USE_INTEL_CRC
#include "crc.h"
#endif
/*ref 36-212 v8.6.0 , pp 8-9 */
/* the highest degree is set by default */
......@@ -103,14 +101,14 @@ static uint32_t crc6Table[256];
#if USE_INTEL_CRC
static const struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq __attribute__((aligned(16))) = {
0x64e4d700, /**< k1 */
0x2c8c9d00, /**< k2 */
0xd9fe8c00, /**< k3 */
0xf845fe24, /**< q */
0x864cfb00, /**< p */
0ULL /**< res */
0x64e4d700, /**< k1 */
0x2c8c9d00, /**< k2 */
0xd9fe8c00, /**< k3 */
0xf845fe24, /**< q */
0x864cfb00, /**< p */
0ULL /**< res */
};
__m128i crc_xmm_be_le_swap128;
simde__m128i crc_xmm_be_le_swap128;
const uint8_t crc_xmm_shift_tab[48]
__attribute__((aligned(16))) = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
......@@ -133,9 +131,9 @@ void crcTableInit (void)
crc8Table[c] = crcbit(&c, 1, poly8) >> 24;
crc6Table[c] = crcbit(&c, 1, poly6) >> 24;
} while (++c);
#if USE_INTEL_CRC
crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b,
0x04050607, 0x00010203);
#if defined(__SSE4_1__) || defined(__aarch64__)
crc_xmm_be_le_swap128 = simde_mm_setr_epi32(0x0c0d0e0f, 0x08090a0b,
0x04050607, 0x00010203);
#endif
}
......@@ -164,7 +162,7 @@ uint32_t crc24a(unsigned char* inptr, int bitlen)
crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc;
}
#if USE_INTEL_CRC
#if defined(__SSE4_1__) || defined(__aarch64__)
else {
return crc32_calc_pclmulqdq(inptr, octetlen, 0,
&lte_crc24a_pclmulqdq);
......
......@@ -33,7 +33,7 @@
#ifndef __CRCEXT_H__
#define __CRCEXT_H__
#include <x86intrin.h>
#include "PHY/sse_intrin.h"
#include "types.h"
/**
* Flag indicating availability of PCLMULQDQ instruction
......@@ -45,7 +45,7 @@ extern int pclmulqdq_available;
* Flag indicating availability of PCLMULQDQ instruction
* Only valid after running CRCInit() function.
*/
extern __m128i crc_xmm_be_le_swap128;
extern simde__m128i crc_xmm_be_le_swap128;
extern const uint8_t crc_xmm_shift_tab[48];
/**
......@@ -57,11 +57,11 @@ extern const uint8_t crc_xmm_shift_tab[48];
* @return \a reg >> (\a num * 8)
*/
__forceinline
__m128i xmm_shift_right(__m128i reg, const unsigned int num)
simde__m128i xmm_shift_right(simde__m128i reg, const unsigned int num)
{
const __m128i *p = (const __m128i *)(crc_xmm_shift_tab + 16 + num);
const simde__m128i *p = (const simde__m128i *)(crc_xmm_shift_tab + 16 + num);
return _mm_shuffle_epi8(reg, _mm_loadu_si128(p));
return simde_mm_shuffle_epi8(reg, simde_mm_loadu_si128(p));
}
/**
......@@ -73,11 +73,11 @@ __m128i xmm_shift_right(__m128i reg, const unsigned int num)
* @return \a reg << (\a num * 8)
*/
__forceinline
__m128i xmm_shift_left(__m128i reg, const unsigned int num)
simde__m128i xmm_shift_left(simde__m128i reg, const unsigned int num)
{
const __m128i *p = (const __m128i *)(crc_xmm_shift_tab + 16 - num);
const simde__m128i *p = (const simde__m128i *)(crc_xmm_shift_tab + 16 - num);
return _mm_shuffle_epi8(reg, _mm_loadu_si128(p));
return simde_mm_shuffle_epi8(reg, simde_mm_loadu_si128(p));
}
/**
......
......@@ -5,15 +5,29 @@ add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/generator_cnProc_avx512 ldpc/generato
# custom target to build all generators
add_custom_target(ldpc_generators)
# if (CROSS_COMPILE)
# find_package(bnProc_gen_avx2)
# find_package(bnProc_gen_128)
# find_package(bnProc_gen_avx512)
# find_package(cnProc_gen_avx2)
# find_package(cnProc_gen_128)
# find_package(cnProc_gen_avx512)
# endif()
add_dependencies(ldpc_generators
bnProc_gen_avx2
bnProc_gen_avx512
cnProc_gen_avx2
cnProc_gen_avx512)
bnProc_gen_avx2_files
bnProc_gen_128_files
bnProc_gen_avx512_files
cnProc_gen_avx2_files
cnProc_gen_128_files
cnProc_gen_avx512_files)
add_library(ldpc_gen_HEADERS INTERFACE)
target_link_libraries(ldpc_gen_HEADERS INTERFACE
bnProc_gen_avx2_HEADERS
bnProc_gen_128_HEADERS
bnProc_gen_avx512_HEADERS
cnProc_gen_avx2_HEADERS
cnProc_gen_128_HEADERS
cnProc_gen_avx512_HEADERS)
/*
* 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 <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_bnProc_BG1_generator_128(const char*, int);
void nrLDPC_bnProc_BG2_generator_128(const char*, int);
void nrLDPC_bnProcPc_BG1_generator_128(const char*, int);
void nrLDPC_bnProcPc_BG2_generator_128(const char*, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++){
nrLDPC_bnProc_BG1_generator_128(dir, R[i]);
nrLDPC_bnProc_BG2_generator_128(dir, R[i]);
nrLDPC_bnProcPc_BG1_generator_128(dir, R[i]);
nrLDPC_bnProcPc_BG2_generator_128(dir, R[i]);
}
return(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 <stdio.h>
#include <stdint.h>
#define NB_R 3
void nrLDPC_cnProc_BG1_generator_128(const char*, int);
void nrLDPC_cnProc_BG2_generator_128(const char*, int);
const char *__asan_default_options()
{
/* don't do leak checking in nr_ulsim, creates problems in the CI */
return "detect_leaks=0";
}
int main(int argc, char *argv[])
{
if (argc != 2) {
fprintf(stderr, "usage: %s <output-dir>\n", argv[0]);
return 1;
}
const char *dir = argv[1];
int R[NB_R]={0,1,2};
for(int i=0; i<NB_R;i++) {
nrLDPC_cnProc_BG1_generator_128(dir, R[i]);
nrLDPC_cnProc_BG2_generator_128(dir, R[i]);
}
return(0);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
flexric @ 8ee3aca1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment