Commit bba14188 authored by Robert Schmidt's avatar Robert Schmidt

Merge branch 'integration_2023_w40' into 'develop'

integration_2023_w40

See merge request oai/openairinterface5g!2381

* !2345 fix bug for IE cause in pdu session accept
* !2361 Fix Msg3 MAC CE C-RNTI
* !2371 fix(ci): printing the warning and error lines for CI purposes
* !2374 Fix SSB ARFCN: wrong ARFCNs in FDD
* !2379 fix the selection of DCI candidates at UE
* !2369 Add bwp_size and bwp_start fields to CSI_RS PDU struct at NR UE
* !2349 E2AP Version 1,2,3 and KPM version 2, 3
* !2375 increase the max fd of rfsim, that have been shorten to tightly for cpu saving
* !2367 chore(ci): improve GitLab <-> Jenkins contributor experience
* !2378 F1AP: correct message handling
* !2370 NR PDCP RB suspend
* !2107 Compute RI based on SRS up to 4
* !2339 PUCCH power computation
* !2382 Remove dead code in NR UE
* !2229 PUSCH LLR 128/256 SIMDe routines for ARM/x86
parents 0be397b2 7957b466
......@@ -289,6 +289,15 @@ add_definitions(-DHAVE_NETINET_IN_H)
set(E2_AGENT "OFF" CACHE STRING "O-RAN-compliant E2 Agent")
set_property(CACHE E2_AGENT PROPERTY STRINGS "ON" "OFF")
set(E2AP_VERSION "E2AP_V2" CACHE STRING "E2AP version")
set_property(CACHE E2AP_VERSION PROPERTY STRINGS "E2AP_V1" "E2AP_V2" "E2AP_V3")
message(STATUS "Selected E2AP_VERSION: ${E2AP_VERSION}")
set(KPM_VERSION "KPM_V2" CACHE STRING "The KPM SM version to use")
set_property(CACHE KPM_VERSION PROPERTY STRINGS "KPM_V2" "KPM_V3")
message(STATUS "Selected KPM Version: ${KPM_VERSION}")
##################################################
# ASN.1 grammar C code generation & dependencies #
##################################################
......@@ -1409,9 +1418,11 @@ add_library(L2
)
target_link_libraries(L2 PRIVATE x2ap s1ap lte_rrc m2ap)
target_link_libraries(L2 PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
if(E2_AGENT)
target_link_libraries(L2 PUBLIC e2_agent e2_ran_func)
target_compile_definitions(L2 PRIVATE E2_AGENT)
target_compile_definitions(L2 PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
......@@ -1443,6 +1454,7 @@ target_link_libraries(e1_pdcp_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap nr_rlc)
if(E2_AGENT)
target_link_libraries(L2_NR PUBLIC e2_agent e2_ran_func)
target_compile_definitions(L2_NR PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
target_compile_definitions(L2_NR PRIVATE E2_AGENT)
endif()
......@@ -1965,6 +1977,7 @@ target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
if(E2_AGENT)
target_compile_definitions(lte-softmodem PRIVATE E2_AGENT)
target_compile_definitions(lte-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
add_executable(oairu
......@@ -2061,6 +2074,11 @@ target_link_libraries(nr-softmodem PRIVATE
target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
if(E2_AGENT)
target_compile_definitions(nr-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
add_dependencies(nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc)
......
This diff is collapsed.
......@@ -67,6 +67,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ('Verify Parameters') {
steps {
script {
......
......@@ -61,6 +61,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ('Verify Parameters') {
steps {
script {
......
......@@ -61,6 +61,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ('Verify Parameters') {
steps {
script {
......
......@@ -66,6 +66,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ("Verify Parameters") {
steps {
script {
......
......@@ -54,6 +54,13 @@ pipeline {
lock(extra: lockResources)
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ("Verify Parameters") {
steps {
script {
......
......@@ -66,32 +66,14 @@ pipeline {
ansiColor('xterm')
lock(extra: lockResources)
}
// the following parameter options are commented out so it shows the ones
// that you SHALL have to run the job.
// You can use them as template
/*
parameters {
//node-test parameters
string(name: 'pythonExecutor', defaultValue: 'nodea', description: 'Node where the pipeline - python scripts will be executed')
string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run')
string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage')
booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact')
string(name: 'lockResources', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource')
//eNB parameters
string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB')
credentials(name: 'eNB_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for eNB')
string(name: 'eNB_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of eNB source code')
//EPC parameters
string(name: 'EPC_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of EPC')
string(name: 'EPC_Type', defaultValue: 'ltebox', description: 'EPC type: OAI or ltebox')
credentials(name: 'EPC_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for EPC')
string(name: 'EPC_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of EPC source code')
}
*/
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ("Verify Parameters") {
steps {
script {
......
......@@ -433,7 +433,7 @@ class Containerize():
if ret.returncode != 0:
logging.error('\u001B[1m Could not build properly ran-base\u001B[0m')
# Recover the name of the failed container?
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs {self.cli} rm -f")
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs --no-run-if-empty {self.cli} rm -f")
cmd.run(f"{self.cli} image prune --force")
cmd.close()
logging.error('\u001B[1m Building OAI Images Failed\u001B[0m')
......@@ -466,8 +466,8 @@ class Containerize():
cmd.run(f'sed -i -e "s#{baseImage}:latest#{baseImage}:{baseTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}')
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)
if image == 'ran-build':
ret = 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)
if image == 'ran-build' and ret.returncode == 0:
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")
......@@ -479,7 +479,7 @@ class Containerize():
logging.error('\u001B[1m Could not build properly ' + image + '\u001B[0m')
status = False
# Here we should check if the last container corresponds to a failed command and destroy it
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs {self.cli} rm -f")
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs --no-run-if-empty {self.cli} rm -f")
allImagesSize[image] = 'N/A -- Build Failed'
break
else:
......
......@@ -32,7 +32,7 @@ gNBs =
absoluteFrequencySSB = 432990;
dl_frequencyBand = 66;
# this is 3600 MHz
dl_absoluteFrequencyPointA = 430000;
dl_absoluteFrequencyPointA = 430002;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
......@@ -53,7 +53,7 @@ gNBs =
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 66;
ul_absoluteFrequencyPointA = 350000;
ul_absoluteFrequencyPointA = 350002;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
......
......@@ -32,7 +32,7 @@ gNBs =
absoluteFrequencySSB = 430590;
dl_frequencyBand = 66;
# this is 2150 MHz
dl_absoluteFrequencyPointA = 430000;
dl_absoluteFrequencyPointA = 430002;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
......@@ -54,7 +54,7 @@ gNBs =
#frequencyInfoUL
ul_frequencyBand = 66;
# this is 1750 MHz
ul_absoluteFrequencyPointA = 350000;
ul_absoluteFrequencyPointA = 350002;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
......
......@@ -185,7 +185,7 @@ services:
privileged: true
container_name: rfsim5g-oai-nr-ue
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169080000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169090000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
......
......@@ -186,7 +186,7 @@ services:
privileged: true
container_name: rfsim5g-oai-nr-ue
environment:
USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152250000 --CO -400000000 --ssb 76 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152260000 --CO -400000000 --ssb 76 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
......
......@@ -233,6 +233,8 @@ compilations() {
$CMAKE --build . $verbose --target $targets -- -j$(nproc)
ret=$?
} > $dlog/$logfile 2>&1
# Print the errors and warnings for CI purposes
egrep -A3 "warning:|error:" $dlog/$logfile || true
check_warnings "$dlog/$logfile"
if [[ $ret -eq 0 ]]; then
echo_success "$targets compiled"
......
......@@ -855,15 +855,6 @@ void flush_mem_to_file(void)
}
}
const char logmem_log_level[NUM_LOG_LEVEL] = {
[OAILOG_ERR] = 'E',
[OAILOG_WARNING] = 'W',
[OAILOG_ANALYSIS] = 'A',
[OAILOG_INFO] = 'I',
[OAILOG_DEBUG] = 'D',
[OAILOG_TRACE] = 'T',
};
static void log_output_memory(log_component_t *c, const char *file, const char *func, int line, int comp, int level, const char* format,va_list args)
{
//logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
......
......@@ -34,14 +34,14 @@ 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 && \
mkdir -p log 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 && \
ninja ldpc_generators generate_T > ../../log/host-tools.txt 2>&1 && \
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 && \
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 > ../../log/all.txt 2>&1 && \
echo "====== End of log for cross-build executables ======"
......@@ -696,10 +696,13 @@ int main( int argc, char **argv ) {
// OAI Wrapper
e2_agent_args_t oai_args = RCconfig_NR_E2agent();
AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} ");
AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., add in config file the next line: e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} ");
AssertFatal(oai_args.ip != NULL , "Please, specify the IP address of the nearRT-RIC in the config file, i.e., e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\"");
fr_args_t args = {.ip = oai_args.ip}; // init_fr_args(0, NULL);
printf("After RCconfig_NR_E2agent %s %s \n",oai_args.sm_dir, oai_args.ip );
fr_args_t args = { .ip = oai_args.ip }; // init_fr_args(0, NULL);
memcpy(args.libs_dir, oai_args.sm_dir, 128);
sleep(1);
......@@ -726,6 +729,7 @@ int main( int argc, char **argv ) {
printf("[E2 NODE]: mcc = %d mnc = %d mnc_digit = %d nb_id = %d \n", mcc, mnc, mnc_digit_len, nb_id);
printf("[E2 NODE]: Args %s %s \n", args.ip, args.libs_dir);
init_agent_api(mcc, mnc, mnc_digit_len, nb_id, cu_du_id, node_type, io, &args);
// }
......
......@@ -686,7 +686,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
int n_buf = Prx*max_ul_mimo_layers;
int nb_re_pusch = N_RB_UL * NR_NB_SC_PER_RB;
int nb_re_pusch2 = (nb_re_pusch + 7) & ~7;
int nb_re_pusch2 = (nb_re_pusch + 15) & ~15;
gNB->pusch_vars = (NR_gNB_PUSCH *)malloc16_clear(gNB->max_nb_pusch * sizeof(NR_gNB_PUSCH));
for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) {
......@@ -697,24 +697,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
pusch->ptrs_phase_per_slot = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_estimates_time = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->rxdataF_comp = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_mag0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_magb0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_magc0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_mag = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_magb = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->ul_ch_magc = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pusch->rho = (int32_t ***)malloc16(Prx * sizeof(int32_t **));
pusch->llr_layers = (int16_t **)malloc16(max_ul_mimo_layers * sizeof(int32_t *));
for (i = 0; i < Prx; i++) {
pusch->rxdataF_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->rho[i] = (int32_t **)malloc16_clear(NR_MAX_NB_LAYERS * NR_MAX_NB_LAYERS * sizeof(int32_t *));
for (int j = 0; j < max_ul_mimo_layers; j++) {
for (int k = 0; k < max_ul_mimo_layers; k++) {
pusch->rho[i][j * max_ul_mimo_layers + k] =
(int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
}
}
}
for (i = 0; i < n_buf; i++) {
pusch->ul_ch_estimates[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size * fp->symbols_per_slot);
......@@ -722,12 +707,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
pusch->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size);
pusch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->symbols_per_slot); // symbols per slot
pusch->rxdataF_comp[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->ul_ch_mag0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->ul_ch_magb0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->ul_ch_magc0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->ul_ch_mag[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->ul_ch_magb[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
pusch->ul_ch_magc[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
}
for (i=0; i< max_ul_mimo_layers; i++) {
......@@ -851,11 +830,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars->llr_layers[i]);
for (int i = 0; i < Prx; i++) {
free_and_zero(pusch_vars->rxdataF_ext[i]);
for (int j=0; j< max_ul_mimo_layers; j++) {
for (int k=0; k<max_ul_mimo_layers; k++)
free_and_zero(pusch_vars->rho[i][j * max_ul_mimo_layers + k]);
}
free_and_zero(pusch_vars->rho[i]);
}
for (int i = 0; i < n_buf; i++) {
free_and_zero(pusch_vars->ul_ch_estimates[i]);
......@@ -863,12 +837,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars->ul_ch_estimates_time[i]);
free_and_zero(pusch_vars->ptrs_phase_per_slot[i]);
free_and_zero(pusch_vars->rxdataF_comp[i]);
free_and_zero(pusch_vars->ul_ch_mag0[i]);
free_and_zero(pusch_vars->ul_ch_magb0[i]);
free_and_zero(pusch_vars->ul_ch_magc0[i]);
free_and_zero(pusch_vars->ul_ch_mag[i]);
free_and_zero(pusch_vars->ul_ch_magb[i]);
free_and_zero(pusch_vars->ul_ch_magc[i]);
}
free_and_zero(pusch_vars->llr_layers);
free_and_zero(pusch_vars->rxdataF_ext);
......@@ -878,13 +846,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(pusch_vars->ul_ch_estimates_time);
free_and_zero(pusch_vars->ul_valid_re_per_slot);
free_and_zero(pusch_vars->rxdataF_comp);
free_and_zero(pusch_vars->ul_ch_mag0);
free_and_zero(pusch_vars->ul_ch_magb0);
free_and_zero(pusch_vars->ul_ch_magc0);
free_and_zero(pusch_vars->ul_ch_mag);
free_and_zero(pusch_vars->ul_ch_magb);
free_and_zero(pusch_vars->ul_ch_magc);
free_and_zero(pusch_vars->rho);
free_and_zero(pusch_vars->llr);
} // ULSCH_id
......
......@@ -1146,9 +1146,8 @@ static uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms,
simde__m128i *after_mf_c_128 = (simde__m128i *)af_mf_10;
simde__m128i *after_mf_d_128 = (simde__m128i *)af_mf_11;
int rxComp_aligned = ((nb_rb * 12) % 8) ? (8 - (nb_rb * 12) % 8) : 0;
simde__m128i *rxdataF_comp128_0 = (simde__m128i *)&rxdataF_comp[0][symbol * (nb_rb * 12 + rxComp_aligned)];
simde__m128i *rxdataF_comp128_1 = (simde__m128i *)&rxdataF_comp[n_rx][symbol * (nb_rb * 12 + rxComp_aligned)];
simde__m128i *rxdataF_comp128_0 = (simde__m128i *)&rxdataF_comp[0][symbol * buffer_length];
simde__m128i *rxdataF_comp128_1 = (simde__m128i *)&rxdataF_comp[n_rx][symbol * buffer_length];
if (mod_order > 2) {
if (mod_order == 4) {
......@@ -1277,7 +1276,7 @@ static void inner_rx (PHY_VARS_gNB *gNB,
int nb_layer = rel15_ul->nrOfLayers;
int nb_rx_ant = frame_parms->nb_antennas_rx;
int dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
int buffer_length = (rel15_ul->rb_size * NR_NB_SC_PER_RB + 7) & ~7;
int buffer_length = (rel15_ul->rb_size * NR_NB_SC_PER_RB + 15) & ~15;
c16_t rxFext[nb_rx_ant][buffer_length] __attribute__((aligned(32)));
c16_t chFext[nb_layer][nb_rx_ant][buffer_length] __attribute__((aligned(32)));
......@@ -1578,8 +1577,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
// extract the data in the OFDM frame, to the start of the array
int soffset = (slot&3)*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size;
if (nb_re_pusch & 7)
nb_re_pusch += 8 - (nb_re_pusch & 7);
nb_re_pusch = (nb_re_pusch + 15) & ~15;
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++)
for (int aatx = 0; aatx < rel15_ul->nrOfLayers; aatx++)
......
......@@ -256,6 +256,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int32_t rp[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][nb_re_pucch];
memset(rp, 0, sizeof(rp));
int32_t *tmp_rp = NULL;
int signal_energy = 0;
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
uint8_t l2 = l + pucch_pdu->start_symbol_index;
......@@ -286,9 +287,13 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
#endif
}
signal_energy += signal_energy_nodc((int32_t *)r, nb_re_pucch);
}
}
signal_energy /= (pucch_pdu->nr_of_symbols * frame_parms->nb_antennas_rx);
int pucch_power_dBtimes10 = 10 * dB_fixed(signal_energy);
//int32_t no_corr = 0;
int seq_index = 0;
int64_t temp;
......@@ -377,7 +382,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int SNRtimes10,sigenergy=0;
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++)
sigenergy += signal_energy_nodc(rp[aa][0],12);
SNRtimes10 = xrtmag_dBtimes10-(10*max_n0);
SNRtimes10 = pucch_power_dBtimes10 - (10 * max_n0);
int cqi;
if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) cqi=255;
......@@ -421,7 +426,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq.harq_confidence_level = no_conf;
uci_pdu->harq.harq_list[0].harq_value = !(index&0x01);
LOG_D(PHY,
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, "
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d pucch_power_dBtimes10 %d n0 %d (%d,%d) pucch0_thres %d, "
"cqi %d, SNRtimes10 %d, energy %f\n",
frame,
slot,
......@@ -429,6 +434,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq.harq_confidence_level == 0 ? "good" : "bad",
xrtmag_dBtimes10,
xrtmag_next_dBtimes10,
pucch_power_dBtimes10,
max_n0,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
......@@ -454,7 +460,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq.harq_list[1].harq_value = !(index&0x01);
uci_pdu->harq.harq_list[0].harq_value = !((index>>1)&0x01);
LOG_D(PHY,
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) "
"[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d pucch_power_dBtimes10 %d n0 %d (%d,%d) "
"pucch0_thres %d, cqi %d, SNRtimes10 %d\n",
frame,
slot,
......@@ -463,6 +469,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq.harq_confidence_level == 0 ? "good" : "bad",
xrtmag_dBtimes10,
xrtmag_next_dBtimes10,
pucch_power_dBtimes10,
max_n0,
uci_stats->pucch0_n00,
uci_stats->pucch0_n01,
......
......@@ -834,6 +834,26 @@ int nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
return 0;
}
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *convert_csirs_pdu(fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu)
{
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *dl_tti_csi_rs_pdu = calloc(1, sizeof(nfapi_nr_dl_tti_csi_rs_pdu_rel15_t));
dl_tti_csi_rs_pdu->subcarrier_spacing = csirs_config_pdu->subcarrier_spacing;
dl_tti_csi_rs_pdu->cyclic_prefix = csirs_config_pdu->cyclic_prefix;
dl_tti_csi_rs_pdu->start_rb = csirs_config_pdu->start_rb;
dl_tti_csi_rs_pdu->nr_of_rbs = csirs_config_pdu->nr_of_rbs;
dl_tti_csi_rs_pdu->csi_type = csirs_config_pdu->csi_type;
dl_tti_csi_rs_pdu->row = csirs_config_pdu->row;
dl_tti_csi_rs_pdu->freq_domain = csirs_config_pdu->freq_domain;
dl_tti_csi_rs_pdu->symb_l0 = csirs_config_pdu->symb_l0;
dl_tti_csi_rs_pdu->symb_l1 = csirs_config_pdu->symb_l1;
dl_tti_csi_rs_pdu->cdm_type = csirs_config_pdu->cdm_type;
dl_tti_csi_rs_pdu->freq_density = csirs_config_pdu->freq_density;
dl_tti_csi_rs_pdu->scramb_id = csirs_config_pdu->scramb_id;
dl_tti_csi_rs_pdu->power_control_offset = csirs_config_pdu->power_control_offset;
dl_tti_csi_rs_pdu->power_control_offset_ss = csirs_config_pdu->power_control_offset_ss;
return dl_tti_csi_rs_pdu;
}
void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
{
......@@ -891,7 +911,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t
ue->nr_csi_info->csi_rs_generated_signal,
AMP,
ue->nr_csi_info,
(nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *) csirs_config_pdu,
convert_csirs_pdu((fapi_nr_dl_config_csirs_pdu_rel15_t*)&ue->csirs_vars[gNB_id]->csirs_config_pdu),
proc->nr_slot_rx,
&N_cdm_groups,
&CDM_group_size,
......
......@@ -345,48 +345,8 @@ typedef struct {
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **rxdataF_comp;
/// \brief Magnitude of the UL channel estimates. Used for 2nd-bit level thresholds in LLR computation
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_mag;
/// \brief Magnitude of the UL channel estimates scaled for 3rd bit level thresholds in LLR computation
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magb;
/// \brief Magnitude of the UL channel estimates scaled for 4th bit level thresholds in LLR computation
/// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
int32_t **ul_ch_magc;
/// \brief Cross-correlation of two UE signals.
/// - first index: rx antenna [0..nb_antennas_rx[
/// - second index: symbol [0..]
int32_t ***rho;
/// \f$\log_2(\max|H_i|^2)\f$
int16_t log2_maxh;
/// \brief Magnitude of Uplink Channel first layer (16QAM level/First 64QAM level/First 256QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_mag0;
/// \brief Magnitude of Uplink Channel second layer (16QAM level/First 64QAM level/First 256QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_mag1[8][8];
/// \brief Magnitude of Uplink Channel, first layer (2nd 64QAM/256QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magb0;
/// \brief Magnitude of Uplink Channel second layer (2nd 64QAM/256QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magb1[8][8];
/// \brief Magnitude of Uplink Channel, first layer (3rd 256QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magc0;
/// \brief Magnitude of Uplink Channel second layer (3rd 256QAM level).
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
/// - second index: ? [0..168*N_RB_UL[
int32_t **ul_ch_magc1[8][8];
/// measured RX power based on DRS
int ulsch_power[8];
/// total signal over antennas
......
......@@ -465,12 +465,6 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
int off = ((pusch_pdu->rb_size&1) == 1)? 4:0;
LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][(slot_rx&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
LOG_M("rxsigF0_ext.m",
"rxsF0_ext",
&gNB->pusch_vars[0].rxdataF_ext[0][pusch_pdu->start_symbol_index * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
pusch_pdu->nr_of_symbols * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("chestF0.m",
"chF0",
&gNB->pusch_vars[0].ul_ch_estimates[0][pusch_pdu->start_symbol_index * gNB->frame_parms.ofdm_symbol_size],
......@@ -498,12 +492,6 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
0);
if (gNB->frame_parms.nb_antennas_rx > 1) {
LOG_M("rxsigF1.m","rxsF1",&gNB->common_vars.rxdataF[1][(slot_rx&3)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
LOG_M("rxsigF1_ext.m",
"rxsF1_ext",
&gNB->pusch_vars[0].rxdataF_ext[1][pusch_pdu->start_symbol_index * NR_NB_SC_PER_RB * pusch_pdu->rb_size],
pusch_pdu->nr_of_symbols * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("chestF1.m",
"chF1",
&gNB->pusch_vars[0].ul_ch_estimates[1][pusch_pdu->start_symbol_index * gNB->frame_parms.ofdm_symbol_size],
......
......@@ -1296,18 +1296,6 @@ int main(int argc, char *argv[])
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("chmagF0.m",
"chmF0",
&pusch_vars->ul_ch_mag[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("chmagbF0.m",
"chmbF0",
&pusch_vars->ul_ch_magb[0][start_symbol * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size))],
nb_symb_sch * (off + (NR_NB_SC_PER_RB * pusch_pdu->rb_size)),
1,
1);
LOG_M("rxsigF0_llrlayers0.m",
"rxsF0_llrlayers0",
&pusch_vars->llr_layers[0][0],
......
......@@ -29,6 +29,9 @@ else()
message(FATAL_ERROR "Unknown building type. Either choose a static or a dynamic library")
endif()
#######
## E2AP encoding and versioning
#######
set(E2AP_ENCODING "ASN" CACHE STRING "The E2AP encoding to use")
set_property(CACHE E2AP_ENCODING PROPERTY STRINGS "ASN" "FLATBUFFERS")
......@@ -76,6 +79,35 @@ set(SM_ENCODING_GTP "PLAIN" CACHE STRING "The GTP SM encoding to use")
set_property(CACHE SM_ENCODING_GTP PROPERTY STRINGS "PLAIN")
message(STATUS "Selected GTP SM_ENCODING: ${SM_ENCODING_GTP}")
if(E2AP_VERSION STREQUAL "E2AP_V1")
add_library(e2ap_ran_func_obj OBJECT
flexric/src/lib/e2ap/v1_01/e2ap_types/common/e2ap_ran_function.c )
add_library(e2ap_plmn_obj OBJECT
flexric/src/lib/e2ap/v1_01/e2ap_types/common/e2ap_plmn.c )
add_library(e2ap_global_node_id_obj OBJECT
flexric/src/lib/e2ap/v1_01/e2ap_types/common/e2ap_global_node_id.c )
elseif(E2AP_VERSION STREQUAL "E2AP_V2")
add_library(e2ap_ran_func_obj OBJECT
flexric/src/lib/e2ap/v2_03/e2ap_types/common/e2ap_ran_function.c )
add_library(e2ap_plmn_obj OBJECT
flexric/src/lib/e2ap/v2_03/e2ap_types/common/e2ap_plmn.c )
add_library(e2ap_global_node_id_obj OBJECT
flexric/src/lib/e2ap/v2_03/e2ap_types/common/e2ap_global_node_id.c )
elseif(E2AP_VERSION STREQUAL "E2AP_V3")
add_library(e2ap_ran_func_obj OBJECT
flexric/src/lib/e2ap/v3_01/e2ap_types/common/e2ap_ran_function.c )
add_library(e2ap_plmn_obj OBJECT
flexric/src/lib/e2ap/v3_01/e2ap_types/common/e2ap_plmn.c )
add_library(e2ap_global_node_id_obj OBJECT
flexric/src/lib/e2ap/v3_01/e2ap_types/common/e2ap_global_node_id.c )
else()
message(FATAL_ERROR "E2AP Unknown version selected")
endif()
########
### Flatbuffer
########
......
......@@ -3,6 +3,8 @@ add_subdirectory(O-RAN)
add_library(e2_ran_func STATIC
init_ran_func.c
read_setup_ran.c
../flexric/test/rnd/fill_rnd_data_e2_setup_req.c
)
target_link_libraries(e2_ran_func
......@@ -10,3 +12,6 @@ target_link_libraries(e2_ran_func
e2_ran_func_cust
e2_ran_func_oran
)
# This dependency sucks! Create pointers and forward declarations!
target_compile_definitions(e2_ran_func PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
......@@ -16,3 +16,5 @@ add_library(e2_ran_func_cust STATIC
)
target_link_libraries(e2_ran_func_cust PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs)
# This dependency sucks! Create pointers and forward declarations!
target_compile_definitions(e2_ran_func_cust PRIVATE ${E2AP_VERSION} ${KPM_VERSION} )
#include "ran_func_gtp.h"
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_gtp.h"
#include <assert.h>
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_gtp.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
static
const int mod_id = 0;
......
......@@ -2,10 +2,6 @@
#define RAN_FUNC_SM_GTP_READ_WRITE_AGENT_H
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
void read_gtp_sm(void*);
......
#include "ran_func_pdcp.h"
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_pdcp.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_pdcp.h"
#include "common/ran_context.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
static
const int mod_id = 0;
......
......@@ -2,12 +2,6 @@
#define RAN_FUNC_SM_PDCP_READ_WRITE_AGENT_H
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
#include "common/ran_context.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
void read_pdcp_sm(void*);
......
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "ran_func_rlc.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_rlc.h"
static
......
......@@ -2,11 +2,6 @@
#define RAN_FUNC_SM_RLC_READ_WRITE_AGENT_H
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
void read_rlc_sm(void*);
......
......@@ -7,3 +7,4 @@ add_library(e2_ran_func_oran STATIC
)
target_link_libraries(e2_ran_func_oran PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs)
target_compile_definitions(e2_ran_func_oran PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
......@@ -2,6 +2,8 @@
#include "../../flexric/test/rnd/fill_rnd_data_rc.h"
#include "../../flexric/src/sm/rc_sm/ie/ir/lst_ran_param.h"
#include "../../flexric/src/sm/rc_sm/ie/ir/ran_param_list.h"
#include "../../flexric/src/agent/e2_agent_api.h"
#include <assert.h>
#include <stdio.h>
#include <pthread.h>
......
#include "init_ran_func.h"
#include "read_setup_ran.h"
#include "../flexric/src/agent/e2_agent_api.h"
#include "CUSTOMIZED/ran_func_mac.h"
#include "CUSTOMIZED/ran_func_rlc.h"
#include "CUSTOMIZED/ran_func_pdcp.h"
......@@ -67,6 +69,10 @@ sm_io_ag_ran_t init_ran_func_ag(void)
init_write_ctrl(&io.write_ctrl_tbl);
init_write_subs(&io.write_subs_tbl);
#if defined(E2AP_V2) || defined(E2AP_V3)
io.read_setup_ran = read_setup_ran;
#endif
return io;
}
/*
* 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 "read_setup_ran.h"
#include "../../E2AP/flexric/src/lib/e2ap/e2ap_node_component_config_add_wrapper.h"
#include "../../E2AP/flexric/test/rnd/fill_rnd_data_e2_setup_req.h"
#include <assert.h>
#include <stdlib.h>
void read_setup_ran(void* data)
{
assert(data != NULL);
#ifdef E2AP_V1
#elif defined(E2AP_V2) || defined(E2AP_V3)
*((e2ap_node_component_config_add_t*)data) = fill_e2ap_node_component_config_add();
#else
static_assert(0!=0, "Unknown E2AP version");
#endif
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef READ_SETUP_RAN_E2_AGENT_H
#define READ_SETUP_RAN_E2_AGENT_H
void read_setup_ran(void* data);
#endif
......@@ -11,7 +11,7 @@ Please see [NOTICE](NOTICE.md) file for third party software that is included in
# Overview
This tutorial describes the steps of deployment 5G OAI RAN, with integrated E2 agent, and FlexRIC, O-RAN compliant nearRT-RIC.
This tutorial describes the steps of deployment 5G OAI RAN, with integrated E2 agent and a nearRT-RIC using O-RAN compliant FlexRIC.
# 1. Installation
......@@ -29,9 +29,10 @@ This tutorial describes the steps of deployment 5G OAI RAN, with integrated E2 a
```bash
git clone https://github.com/swig/swig.git
cd swig
git checkout release-4.1
./autogen.sh
./configure --prefix=/usr/
make
make -j8
make install
```
......@@ -57,12 +58,15 @@ git clone https://gitlab.eurecom.fr/oai/openairinterface5g oai
cd oai/
```
### 2.1.2 Build OAI
### 2.1.2 Build OAI with E2 Agent
- By default, OAI will build the E2 Agent with E2AP v2 and KPM v2. If you want a different version, edit the variable E2AP\_VERSION and KPM\_VERSION at OAI's CMakeLists.txt file.
```bash
cd cmake_targets/
./build_oai -I -w SIMU --gNB --nrUE --build-e2 --ninja
```
If the flexric folder is empty, try manually the following commands
If the openair2/E2AP/flexric folder is empty, try manually the following commands
```bash
git submodule init
......@@ -74,15 +78,18 @@ git submodule update
* `--gNB` is to build the `nr-softmodem` and `nr-cuup` executables and all required shared libraries
* `--nrUE` is to build the `nr-uesoftmodem` executable and all required shared libraries
* `--ninja` is to use the ninja build tool, which speeds up compilation
* `--build-e2` option is to use the E2 agent, integrated within gNB.
* `--build-e2` option is to use the E2 agent, integrated within RAN.
## 2.2 FlexRIC
- By default, FlexRIC will build the nearRT-RIC with E2AP v2 and KPM v2. If you want a different version, edit the variable E2AP\_VERSION and KPM\_VERSION at FlexRIC's CMakeLists.txt file. Note that OAI's and FlexRIC's E2AP\_VERSION and KPM\_VERSION need to match due to O-RAN incompatibilities among versions.
### 2.2.1 Clone the FlexRIC repository
```bash
git clone https://gitlab.eurecom.fr/mosaic5g/flexric flexric
cd flexric/
git checkout 8ee3aca107a9da8ccf425e623bed18cd40a31fa1
git checkout 035fd2e8f9a9d2c16df8d44c9e8c13ccddf9ff19
```
### 2.2.2 Build FlexRIC
......@@ -98,7 +105,8 @@ sudo make install
By default the service model libraries will be installed in the path `/usr/local/lib/flexric` while the configuration file in `/usr/local/etc/flexric`.
Available SMs in this version are:
* KPM v03.00 (xapp_kpm_moni)
* KPM v02.03 and KPM v03.00 (xapp_kpm_moni)
* RC v01.03 (xapp_kpm_rc)
* GTP (xapp_gtp_moni)
* MAC + RLC + PDCP (xapp_mac_rlc_pdcp_moni)
......@@ -106,7 +114,7 @@ If you are interested in TC and SLICE SMs, please follow the instructions at htt
# 3. Start the process
In order to configure E2 agent, please, add the following block in the configuration file:
In order to configure E2 agent, please, add the following block in OAI's configuration file:
```bash
e2_agent = {
near_ric_ip_addr = "127.0.0.1";
......
flexric @ 035fd2e8
Subproject commit 8ee3aca107a9da8ccf425e623bed18cd40a31fa1
Subproject commit 035fd2e8f9a9d2c16df8d44c9e8c13ccddf9ff19
......@@ -957,9 +957,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context
F1AP_UEContextModificationRequest_t *out;
uint8_t *buffer=NULL;
uint32_t len=0;
// for test
LOG_W(F1AP, "UE Context Modification Request PLMN is hardcoded!\n");
f1ap_served_cell_info_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.mnc_digit_length=2};
/* Create */
/* 0. Message Type */
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
......@@ -985,13 +983,18 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context
/* optional */
/* c3. NRCGI */
if (0) {
if (true) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie3);
ie3->id = F1AP_ProtocolIE_ID_id_SpCell_ID;
ie3->criticality = F1AP_Criticality_ignore;
ie3->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI;
/* - nRCGI */
addnRCGI(ie3->value.choice.NRCGI, &hardCoded);
f1ap_served_cell_info_t nrcgi = {
.plmn = f1ap_ue_context_modification_req->plmn,
.nr_cellid = f1ap_ue_context_modification_req->nr_cellid,
};
addnRCGI(ie3->value.choice.NRCGI, &nrcgi);
}
/* optional */
......@@ -1113,6 +1116,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context
F1AP_SCell_ToBeSetupMod_Item_t *scell_toBeSetupMod_item=
&scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item;
// /* - sCell_ID */
f1ap_served_cell_info_t hardCoded = {0};
addnRCGI(scell_toBeSetupMod_item->sCell_ID, &hardCoded);
/* sCellIndex */
scell_toBeSetupMod_item->sCellIndex = 6; // issue here
......@@ -1140,6 +1144,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context
F1AP_SCell_ToBeRemoved_Item_t *scell_toBeRemoved_item=
&scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item;
/* - sCell_ID */
f1ap_served_cell_info_t hardCoded = {0};
addnRCGI(scell_toBeRemoved_item->sCell_ID, &hardCoded);
}
}
......
......@@ -927,16 +927,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t
f1ap_ue_context_modification_req->rrc_container = malloc(ieRRC->value.choice.RRCContainer.size);
memcpy(f1ap_ue_context_modification_req->rrc_container,
ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size);
protocol_ctxt_t ctxt;
// decode RRC Container and act on the message type
ctxt.rntiMaybeUEid = f1ap_ue_context_modification_req->gNB_DU_ue_id;
ctxt.instance = instance;
ctxt.module_id = instance;
ctxt.enb_flag = 1;
ctxt.eNB_index = instance;
mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__);
memcpy(&pdcp_pdu_p->data[0], ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size);
du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ieRRC->value.choice.RRCContainer.size, pdcp_pdu_p);
f1ap_ue_context_modification_req->rrc_container_length = ieRRC->value.choice.RRCContainer.size;
} else {
LOG_E(F1AP, " RRCContainer in UEContextModificationRequestIEs size id 0\n");
}
......@@ -944,6 +935,32 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t
LOG_D(F1AP, "can't find RRCContainer in UEContextModificationRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer);
}
/* CU2DU Information */
F1AP_UEContextModificationRequestIEs_t *ieCU2DU = NULL;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextModificationRequestIEs_t,
ieCU2DU,
container,
F1AP_ProtocolIE_ID_id_CUtoDURRCInformation,
false);
if (ieCU2DU != NULL) {
f1ap_ue_context_modification_req->cu_to_du_rrc_information =
calloc(1, sizeof(*f1ap_ue_context_modification_req->cu_to_du_rrc_information));
AssertFatal(f1ap_ue_context_modification_req->cu_to_du_rrc_information != NULL, "out of memory\n");
cu_to_du_rrc_information_t *cu2du = f1ap_ue_context_modification_req->cu_to_du_rrc_information;
const F1AP_CUtoDURRCInformation_t *cu2duie = &ieCU2DU->value.choice.CUtoDURRCInformation;
if (cu2duie->cG_ConfigInfo != NULL)
LOG_W(F1AP, "UE RNTI %04x: ignoring cg_ConfigInfo, not implemented\n", f1ap_ue_context_modification_req->gNB_DU_ue_id);
if (cu2duie->measConfig != NULL)
LOG_W(F1AP, "UE RNTI %04x: ignoring measConfig, not implemented\n", f1ap_ue_context_modification_req->gNB_DU_ue_id);
if (cu2duie->uE_CapabilityRAT_ContainerList != NULL) {
F1AP_UE_CapabilityRAT_ContainerList_t *uecap = cu2duie->uE_CapabilityRAT_ContainerList;
cu2du->uE_CapabilityRAT_ContainerList = calloc(uecap->size, sizeof(*cu2du->uE_CapabilityRAT_ContainerList));
AssertFatal(cu2du->uE_CapabilityRAT_ContainerList != NULL, "out of memory\n");
cu2du->uE_CapabilityRAT_ContainerList_length = uecap->size;
memcpy(cu2du->uE_CapabilityRAT_ContainerList, uecap->buf, uecap->size);
}
}
ue_context_modification_request(f1ap_ue_context_modification_req);
return 0;
}
......
......@@ -46,34 +46,44 @@ void fill_dci_search_candidates(const NR_SearchSpace_t *ss,
{
LOG_D(NR_MAC,"Filling search candidates for DCI\n");
rel15->number_of_candidates = 0;
int i = 0;
for (int maxL = 16; maxL > 0; maxL >>= 1) {
uint8_t aggregation, number_of_candidates;
uint8_t aggregation, max_number_of_candidates;
find_aggregation_candidates(&aggregation,
&number_of_candidates,
&max_number_of_candidates,
ss,
maxL);
if (number_of_candidates > 0) {
LOG_D(NR_MAC,"L %d, number of candidates %d, aggregation %d\n", maxL, number_of_candidates, aggregation);
int N_cce_sym = 0; // nb of rbs of coreset per symbol
for (int f = 0; f < 6; f++) {
for (int t = 0; t < 8; t++) {
N_cce_sym += ((rel15->coreset.frequency_domain_resource[f] >> t) & 1);
if (max_number_of_candidates == 0)
continue;
LOG_D(NR_MAC,"L %d, max number of candidates %d, aggregation %d\n", maxL, max_number_of_candidates, aggregation);
int N_cce_sym = 0; // nb of rbs of coreset per symbol
for (int f = 0; f < 6; f++) {
for (int t = 0; t < 8; t++) {
N_cce_sym += ((rel15->coreset.frequency_domain_resource[f] >> t) & 1);
}
}
int N_cces = N_cce_sym * rel15->coreset.duration;
if (N_cces < aggregation)
continue;
for (int j = 0; j < max_number_of_candidates; j++) {
int first_cce = aggregation * ((Y + ((j * N_cces) / (aggregation * max_number_of_candidates)) + 0) % (N_cces / aggregation));
LOG_D(NR_MAC,"Candidate %d of %d first_cce %d (L %d N_cces %d Y %d)\n", j, max_number_of_candidates, first_cce, aggregation, N_cces, Y);
// to avoid storing more than one candidate with the same aggregation and starting CCE (duplicated candidate)
bool duplicated = false;
for (int k = 0; k < i; k++) {
if (rel15->CCE[k] == first_cce && rel15->L[k] == aggregation) {
duplicated = true;
LOG_D(NR_MAC, "Candidate %d of %d is duplicated\n", j, max_number_of_candidates);
}
}
int N_cces = N_cce_sym * rel15->coreset.duration;
// limit the number of candidates to the ones fitting current configuration
int max_candidates = min(N_cces / aggregation, number_of_candidates);
rel15->number_of_candidates += max_candidates;
for (int j = 0; j < max_candidates; i++, j++) {
int first_cce = aggregation * ((Y + ((j * N_cces) / (aggregation * number_of_candidates)) + 0) % (N_cces / aggregation));
LOG_D(NR_MAC,"Candidate %d of %d first_cce %d (L %d N_cces %d Y %d)\n", j, max_candidates, first_cce, aggregation, N_cces, Y);
if (!duplicated) {
rel15->CCE[i] = first_cce;
rel15->L[i] = aggregation;
i++;
}
}
}
rel15->number_of_candidates = i;
}
NR_ControlResourceSet_t *ue_get_coreset(const NR_UE_MAC_INST_t *mac, const int coreset_id)
......
......@@ -1879,16 +1879,14 @@ static void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, s
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
NR_mac_stats_t *stats = &UE->mac_stats;
LOG_D(NR_MAC, "ue rnti 0x%04x, harq is waiting %d, round %d, frame %d %d, harq id %d\n", ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
if (harq->is_waiting == 0) {
if (harq->round == 0) {
if (stats->dl.errors == 0) {
if (UE->Msg4_ACKed) {
LOG_A(NR_MAC, "(UE RNTI 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", ra->rnti);
UE->Msg4_ACKed = true;
UE->ra_timer = 0;
// Pause scheduling according to:
......
......@@ -2570,7 +2570,8 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo
dl_tti_csirs_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_csi_rs_pdu));
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csirs_pdu_rel15 = &dl_tti_csirs_pdu->csi_rs_pdu.csi_rs_pdu_rel15;
csirs_pdu_rel15->bwp_size = dl_bwp->BWPSize;
csirs_pdu_rel15->bwp_start = dl_bwp->BWPStart;
csirs_pdu_rel15->subcarrier_spacing = dl_bwp->scs;
if (dl_bwp->cyclicprefix)
csirs_pdu_rel15->cyclic_prefix = *dl_bwp->cyclicprefix;
......@@ -2916,8 +2917,11 @@ void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu
uint8_t du2cu[1024];
int encoded = encode_cellGroupConfig(UE->CellGroup, du2cu, sizeof(du2cu));
DevAssert(mac->f1_config.setup_req != NULL);
AssertFatal(mac->f1_config.setup_req->num_cells_available == 1, "can handle only one cell\n");
const f1ap_initial_ul_rrc_message_t ul_rrc_msg = {
/* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */
.plmn = mac->f1_config.setup_req->cell[0].info.plmn,
.nr_cellid = mac->f1_config.setup_req->cell[0].info.nr_cellid,
.gNB_DU_ue_id = rnti,
.crnti = rnti,
.rrc_container = (uint8_t *) sdu,
......
......@@ -1011,6 +1011,8 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
LOG_D(NR_MAC,"%4d.%2d bit %d pid %d ack/nack %d\n",frame, slot, harq_bit,pid,harq_value);
handle_dl_harq(UE, pid, harq_value == 0 && harq_confidence == 0, nrmac->dl_bler.harq_round_max);
if (!UE->Msg4_ACKed && harq_value == 0 && harq_confidence == 0)
UE->Msg4_ACKed = true;
if (harq_confidence == 1) UE->mac_stats.pucch0_DTX++;
}
......
......@@ -795,6 +795,9 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg.3 to have UE come back with new RA attempt\n", ra->rnti);
return;
} else {
// Reset Msg4_ACKed to not schedule ULSCH and DLSCH before RRC Reconfiguration
UE_C->Msg4_ACKed = false;
// The UE identified by C-RNTI still exists at the gNB
nr_mac_reset_ul_failure(&UE_C->UE_sched_ctrl);
......@@ -1316,8 +1319,11 @@ void handle_nr_srs_measurements(const module_id_t module_id,
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
sched_ctrl->srs_feedback.sri = NR_SRS_SRI_0;
start_meas(&nr_mac->nr_srs_ri_computation_timer);
nr_srs_ri_computation(&nr_srs_channel_iq_matrix, current_BWP, &sched_ctrl->srs_feedback.ul_ri);
stop_meas(&nr_mac->nr_srs_ri_computation_timer);
start_meas(&nr_mac->nr_srs_tpmi_computation_timer);
sched_ctrl->srs_feedback.tpmi = nr_srs_tpmi_estimation(current_BWP->pusch_Config,
current_BWP->transform_precoding,
nr_srs_channel_iq_matrix.channel_matrix,
......@@ -1327,6 +1333,7 @@ void handle_nr_srs_measurements(const module_id_t module_id,
nr_srs_channel_iq_matrix.prg_size,
nr_srs_channel_iq_matrix.num_prgs,
sched_ctrl->srs_feedback.ul_ri);
stop_meas(&nr_mac->nr_srs_tpmi_computation_timer);
sprintf(stats->srs_stats, "UL-RI %d, TPMI %d", sched_ctrl->srs_feedback.ul_ri + 1, sched_ctrl->srs_feedback.tpmi);
......
......@@ -369,7 +369,8 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req)
update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc);
}
if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || req->drbs_to_be_released_length > 0) {
if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || req->drbs_to_be_released_length > 0
|| ue_cap != NULL) {
resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t));
AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n");
resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, 1024);
......
......@@ -69,6 +69,8 @@ void *nrmac_stats_thread(void *arg) {
p += print_meas_log(&gNB->schedule_dlsch, "dlsch scheduler", NULL, NULL, p, end - p);
p += print_meas_log(&gNB->rlc_data_req, "rlc_data_req", NULL, NULL, p, end - p);
p += print_meas_log(&gNB->rlc_status_ind, "rlc_status_ind", NULL, NULL, p, end - p);
p += print_meas_log(&gNB->nr_srs_ri_computation_timer, "UL-RI computation time", NULL, NULL, p, end - p);
p += print_meas_log(&gNB->nr_srs_tpmi_computation_timer, "UL-TPMI computation time", NULL, NULL, p, end - p);
fwrite(output, p - output, 1, file);
fflush(file);
sleep(1);
......
......@@ -806,6 +806,10 @@ typedef struct gNB_MAC_INST_s {
time_stats_t rlc_data_req;
/// processing time of rlc_status_ind
time_stats_t rlc_status_ind;
/// processing time of nr_srs_ri_computation
time_stats_t nr_srs_ri_computation_timer;
/// processing time of nr_srs_tpmi_estimation
time_stats_t nr_srs_tpmi_computation_timer;
/// processing time of eNB MCH scheduler
time_stats_t schedule_mch;
/// processing time of eNB ULSCH reception
......
......@@ -369,7 +369,7 @@ void nr_pdcp_entity_set_time(struct nr_pdcp_entity_t *entity, uint64_t now)
check_t_reordering(entity);
}
void nr_pdcp_entity_release(nr_pdcp_entity_t *entity)
static void deliver_all_sdus(nr_pdcp_entity_t *entity)
{
// deliver the PDCP SDUs stored in the receiving PDCP entity to upper layers
while (entity->rx_list != NULL) {
......@@ -384,6 +384,22 @@ void nr_pdcp_entity_release(nr_pdcp_entity_t *entity)
}
}
void nr_pdcp_entity_suspend(nr_pdcp_entity_t *entity)
{
entity->tx_next = 0;
if (entity->t_reordering_start != 0) {
entity->t_reordering_start = 0;
deliver_all_sdus(entity);
}
entity->rx_next = 0;
entity->rx_deliv = 0;
}
void nr_pdcp_entity_release(nr_pdcp_entity_t *entity)
{
deliver_all_sdus(entity);
}
void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity)
{
nr_pdcp_sdu_t *cur = entity->rx_list;
......@@ -444,6 +460,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity(
ret->delete_entity = nr_pdcp_entity_delete;
ret->release_entity = nr_pdcp_entity_release;
ret->suspend_entity = nr_pdcp_entity_suspend;
ret->get_stats = nr_pdcp_entity_get_stats;
ret->deliver_sdu = deliver_sdu;
......
......@@ -77,6 +77,7 @@ typedef struct nr_pdcp_entity_t {
int sdu_id, char *pdu_buffer, int pdu_max_size);
void (*delete_entity)(struct nr_pdcp_entity_t *entity);
void (*release_entity)(struct nr_pdcp_entity_t *entity);
void (*suspend_entity)(struct nr_pdcp_entity_t *entity);
void (*get_stats)(struct nr_pdcp_entity_t *entity, nr_pdcp_statistics_t *out);
/* set_security: pass -1 to integrity_algorithm / ciphering_algorithm
......
......@@ -1057,6 +1057,32 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id,
return 1;
}
void nr_pdcp_suspend_srb(ue_id_t ue_id, int srb_id)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
nr_pdcp_entity_t *srb = ue->srb[srb_id - 1];
if (srb == NULL) {
LOG_E(PDCP, "Trying to susbend SRB with ID %d but it is not established\n", srb_id);
return;
}
srb->suspend_entity(srb);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_pdcp_suspend_drb(ue_id_t ue_id, int drb_id)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
nr_pdcp_entity_t *drb = ue->drb[drb_id - 1];
if (drb == NULL) {
LOG_E(PDCP, "Trying to susbend DRB with ID %d but it is not established\n", drb_id);
return;
}
drb->suspend_entity(drb);
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
......
......@@ -66,6 +66,8 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
bool nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(ue_id_t ue_id);
void nr_pdcp_suspend_srb(ue_id_t ue_id, int srb_id);
void nr_pdcp_suspend_drb(ue_id_t ue_id, int drb_id);
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering);
void nr_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, long t_Reordering);
void nr_pdcp_release_srb(ue_id_t ue_id, int srb_id);
......
......@@ -269,7 +269,7 @@ static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_
// taken out (but the reestablishment will likely not work).
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon;
uint32_t scc_ssb_arfcn = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB;
AssertFatal(ssb_arfcn == scc_ssb_arfcn, "fuck: SCC SSB ARFCN original %d vs. computed %d\n", scc_ssb_arfcn, ssb_arfcn);
AssertFatal(ssb_arfcn == scc_ssb_arfcn, "mismatch of SCC SSB ARFCN original %d vs. computed %d! Note: you can remove this Assert, the gNB might run but UE connection instable\n", scc_ssb_arfcn, ssb_arfcn);
}
return ssb_arfcn;
......@@ -2077,7 +2077,6 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i
}
if (resp->du_to_cu_rrc_information != NULL && resp->du_to_cu_rrc_information->cellGroupConfig != NULL) {
LOG_W(RRC, "UE context modification response contains new CellGroupConfig for UE %04x, triggering reconfiguration\n", UE->rnti);
NR_CellGroupConfig_t *cellGroupConfig = NULL;
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_CellGroupConfig,
......
......@@ -27,46 +27,49 @@
extern char *baseNetAddress;
static uint16_t getShort(uint8_t *input)
{
uint16_t tmp16;
memcpy(&tmp16, input, sizeof(tmp16));
return htons(tmp16);
}
void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_length)
{
uint8_t offset = 0;
security_protected_nas_5gs_msg_t sec_nas_hdr;
security_protected_plain_nas_5gs_msg_t sec_nas_msg;
pdu_session_establishment_accept_msg_t psea_msg;
sec_nas_hdr.epd = *(buffer + (offset++));
sec_nas_hdr.sht = *(buffer + (offset++));
uint8_t *curPtr = buffer;
sec_nas_hdr.epd = *curPtr++;
sec_nas_hdr.sht = *curPtr++;
uint32_t tmp;
memcpy(&tmp, buffer + offset, sizeof(tmp));
memcpy(&tmp, buffer, sizeof(tmp));
sec_nas_hdr.mac = htonl(tmp);
offset+=sizeof(sec_nas_hdr.mac);
sec_nas_hdr.sqn = *(buffer + (offset++));
sec_nas_msg.epd = *(buffer + (offset++));
sec_nas_msg.sht = *(buffer + (offset++));
sec_nas_msg.msg_type = *(buffer + (offset++));
sec_nas_msg.payload_type = *(buffer + (offset++));
uint16_t tmp16;
memcpy(&tmp16, buffer + offset, sizeof(tmp16));
sec_nas_msg.payload_len = htons(tmp16);
offset+=sizeof(sec_nas_msg.payload_len);
curPtr += sizeof(sec_nas_hdr.mac);
sec_nas_hdr.sqn = *curPtr++;
sec_nas_msg.epd = *curPtr++;
sec_nas_msg.sht = *curPtr++;
sec_nas_msg.msg_type = *curPtr++;
sec_nas_msg.payload_type = *curPtr++;
sec_nas_msg.payload_len = getShort(curPtr);
curPtr += sizeof(sec_nas_msg.payload_len);
/* Mandatory Presence IEs */
psea_msg.epd = *(buffer + (offset++));
psea_msg.pdu_id = *(buffer + (offset++));
psea_msg.pti = *(buffer + (offset++));
psea_msg.msg_type = *(buffer + (offset++));
psea_msg.pdu_type = *(buffer + offset) & 0x0f;
psea_msg.ssc_mode = (*(buffer + (offset++)) & 0xf0) >> 4;
memcpy(&tmp16, buffer + offset, sizeof(tmp16));
psea_msg.qos_rules.length = htons(tmp16);
offset+=sizeof(psea_msg.qos_rules.length);
psea_msg.epd = *curPtr++;
psea_msg.pdu_id = *curPtr++;
psea_msg.pti = *curPtr++;
psea_msg.msg_type = *curPtr++;
psea_msg.pdu_type = *curPtr & 0x0f;
psea_msg.ssc_mode = (*curPtr++ & 0xf0) >> 4;
psea_msg.qos_rules.length = getShort(curPtr);
curPtr += sizeof(psea_msg.qos_rules.length);
/* Supports the capture of only one QoS Rule, it should be changed for multiple QoS Rules */
qos_rule_t qos_rule;
qos_rule.id = *(buffer + (offset++));
memcpy(&tmp16, buffer + offset, sizeof(tmp16));
qos_rule.length = htons(tmp16);
offset+=sizeof(qos_rule.length);
qos_rule.oc = (*(buffer + offset) & 0xE0) >> 5;
qos_rule.dqr = (*(buffer + offset) & 0x10) >> 4;
qos_rule.nb_pf = *(buffer + (offset++)) & 0x0F;
qos_rule.id = *curPtr++;
qos_rule.length = getShort(curPtr);
curPtr += sizeof(qos_rule.length);
qos_rule.oc = (*(curPtr)&0xE0) >> 5;
qos_rule.dqr = (*(curPtr)&0x10) >> 4;
qos_rule.nb_pf = *curPtr++ & 0x0F;
if(qos_rule.nb_pf) {
packet_filter_t pf;
......@@ -74,40 +77,39 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
if(qos_rule.oc == ROC_CREATE_NEW_QOS_RULE ||
qos_rule.oc == ROC_MODIFY_QOS_RULE_ADD_PF ||
qos_rule.oc == ROC_MODIFY_QOS_RULE_REPLACE_PF) {
pf.pf_type.type_1.pf_dir = (*(buffer + offset) & 0x30) >> 4;
pf.pf_type.type_1.pf_id = *(buffer + offset++) & 0x0F;
pf.pf_type.type_1.length = *(buffer + offset++);
offset += (qos_rule.nb_pf * pf.pf_type.type_1.length); /* Ommit the Packet filter List */
pf.pf_type.type_1.pf_dir = (*curPtr & 0x30) >> 4;
pf.pf_type.type_1.pf_id = *curPtr++ & 0x0F;
pf.pf_type.type_1.length = *curPtr++;
curPtr += (qos_rule.nb_pf * pf.pf_type.type_1.length); /* Ommit the Packet filter List */
} else if (qos_rule.oc == ROC_MODIFY_QOS_RULE_DELETE_PF) {
offset += qos_rule.nb_pf;
curPtr += qos_rule.nb_pf;
}
}
qos_rule.prcd = *(buffer + offset++);
qos_rule.qfi = *(buffer + offset++);
psea_msg.sess_ambr.length = *(buffer + offset++);
offset += psea_msg.sess_ambr.length; /* Ommit the Seassion-AMBR */
qos_rule.prcd = *curPtr++;
qos_rule.qfi = *curPtr++;
psea_msg.sess_ambr.length = *curPtr++;
curPtr += psea_msg.sess_ambr.length; /* Ommit the Seassion-AMBR */
/* Optional Presence IEs */
uint8_t psea_iei = *(buffer + offset++);
while(offset < msg_length) {
while (curPtr < buffer + msg_length) {
uint8_t psea_iei = *curPtr++;
switch (psea_iei) {
case IEI_5GSM_CAUSE: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received 5GSM Cause IEI\n");
offset++;
curPtr++;
break;
case IEI_PDU_ADDRESS:
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received PDU Address IE\n");
psea_msg.pdu_addr_ie.pdu_length = *(buffer + offset++);
psea_msg.pdu_addr_ie.pdu_type = *(buffer + offset++);
psea_msg.pdu_addr_ie.pdu_length = *curPtr++;
psea_msg.pdu_addr_ie.pdu_type = *curPtr++;
if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV4) {
psea_msg.pdu_addr_ie.pdu_addr_oct1 = *(buffer + offset++);
psea_msg.pdu_addr_ie.pdu_addr_oct2 = *(buffer + offset++);
psea_msg.pdu_addr_ie.pdu_addr_oct3 = *(buffer + offset++);
psea_msg.pdu_addr_ie.pdu_addr_oct4 = *(buffer + offset++);
psea_msg.pdu_addr_ie.pdu_addr_oct1 = *curPtr++;
psea_msg.pdu_addr_ie.pdu_addr_oct2 = *curPtr++;
psea_msg.pdu_addr_ie.pdu_addr_oct3 = *curPtr++;
psea_msg.pdu_addr_ie.pdu_addr_oct4 = *curPtr++;
nas_getparams();
sprintf(baseNetAddress, "%d.%d", psea_msg.pdu_addr_ie.pdu_addr_oct1, psea_msg.pdu_addr_ie.pdu_addr_oct2);
nas_config(1, psea_msg.pdu_addr_ie.pdu_addr_oct3, psea_msg.pdu_addr_ie.pdu_addr_oct4, "oaitun_ue");
......@@ -117,78 +119,68 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
psea_msg.pdu_addr_ie.pdu_addr_oct3,
psea_msg.pdu_addr_ie.pdu_addr_oct4);
} else {
offset += psea_msg.pdu_addr_ie.pdu_length;
curPtr += psea_msg.pdu_addr_ie.pdu_length;
}
psea_iei = *(buffer + offset++);
break;
case IEI_RQ_TIMER_VALUE: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received RQ timer value IE\n");
offset++; /* TS 24.008 10.5.7.3 */
psea_iei = *(buffer + offset++);
curPtr++; /* TS 24.008 10.5.7.3 */
break;
case IEI_SNSSAI: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received S-NSSAI IE\n");
uint8_t snssai_length = *(buffer + offset);
offset += (snssai_length + sizeof(snssai_length));
psea_iei = *(buffer + offset++);
uint8_t snssai_length = *curPtr;
curPtr += (snssai_length + sizeof(snssai_length));
break;
case IEI_ALWAYSON_PDU: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received Always-on PDU Session indication IE\n");
offset++;
psea_iei = *(buffer + offset++);
curPtr++;
break;
case IEI_MAPPED_EPS: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received Mapped EPS bearer context IE\n");
uint16_t mapped_eps_length = htons(*(uint16_t *)(buffer + offset));
offset += mapped_eps_length;
psea_iei = *(buffer + offset++);
uint16_t mapped_eps_length = getShort(curPtr);
curPtr += mapped_eps_length;
break;
case IEI_EAP_MSG: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received EAP message IE\n");
uint16_t eap_length = htons(*(uint16_t *)(buffer + offset));
offset += (eap_length + sizeof(eap_length));
psea_iei = *(buffer + offset++);
uint16_t eap_length = getShort(curPtr);
curPtr += (eap_length + sizeof(eap_length));
break;
case IEI_AUTH_QOS_DESC: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received Authorized QoS flow descriptions IE\n");
psea_msg.qos_fd_ie.length = htons(*(uint16_t *)(buffer + offset));
offset += (psea_msg.qos_fd_ie.length + sizeof(psea_msg.qos_fd_ie.length));
psea_iei = *(buffer + offset++);
psea_msg.qos_fd_ie.length = getShort(curPtr);
curPtr += (psea_msg.qos_fd_ie.length + sizeof(psea_msg.qos_fd_ie.length));
break;
case IEI_EXT_CONF_OPT: /* Ommited */
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received Extended protocol configuration options IE\n");
psea_msg.ext_pp_ie.length = htons(*(uint16_t *)(buffer + offset));
offset += (psea_msg.ext_pp_ie.length + sizeof(psea_msg.ext_pp_ie.length ));
psea_iei = *(buffer + offset++);
psea_msg.ext_pp_ie.length = getShort(curPtr);
curPtr += (psea_msg.ext_pp_ie.length + sizeof(psea_msg.ext_pp_ie.length));
break;
case IEI_DNN:
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Received DNN IE\n");
psea_msg.dnn_ie.dnn_length = *(buffer + offset++);
psea_msg.dnn_ie.dnn_length = *curPtr++;
char apn[APN_MAX_LEN];
if(psea_msg.dnn_ie.dnn_length <= APN_MAX_LEN &&
psea_msg.dnn_ie.dnn_length >= APN_MIN_LEN) {
for (int i = 0 ; i < psea_msg.dnn_ie.dnn_length ; ++i)
apn[i] = *(buffer + offset + i);
memcpy(apn, curPtr, psea_msg.dnn_ie.dnn_length);
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - APN: %s\n", apn);
} else
LOG_E(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - DNN IE has invalid length\n");
offset = msg_length;
curPtr = buffer + msg_length; // we force stop processing
break;
default:
LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - Not known IE\n");
offset = msg_length;
curPtr = buffer + msg_length; // we force stop processing
break;
}
}
......
......@@ -961,7 +961,7 @@ static int Gtpv1uHandleError(int h,
uint32_t msgBufLen,
uint16_t peerPort,
uint32_t peerIp) {
LOG_E(GTPU,"Hadle error to be dev\n");
LOG_E(GTPU, "Handle error to be dev\n");
int rc = GTPNOK;
return rc;
}
......
......@@ -70,7 +70,6 @@
#define sampleToByte(a,b) ((a)*(b)*sizeof(sample_t))
#define byteToSample(a,b) ((a)/(sizeof(sample_t)*(b)))
#define MAX_SIMULATION_CONNECTED_NODES 5
#define GENERATE_CHANNEL 10 // each frame (or slot?) in DL
// This needs to be re-architected in the future
......@@ -86,7 +85,7 @@
// FD_SETSIE) and reduced to 125. This should allow for around 20 simultaeous UEs.
//
// #define MAX_FD_RFSIMU FD_SETSIZE
#define MAX_FD_RFSIMU 125
#define MAX_FD_RFSIMU 250
#define SYSCTL_MEM_VALUE 134217728 // Kernel network buffer size
#define SEND_BUFF_SIZE SYSCTL_MEM_VALUE // Socket buffer size
......@@ -803,7 +802,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
for ( int i=0; i < t->tx_num_channels; i++)
samplesVoid[i]=(void *)&v;
rfsimulator_write_internal(t, t->lastWroteTS > 1 ? t->lastWroteTS - 1 : 0, samplesVoid, 1, t->tx_num_channels, 1, true);
rfsimulator_write_internal(t, t->lastWroteTS > 1 ? t->lastWroteTS - 1 : 0, samplesVoid, 1, t->tx_num_channels, 1, false);
} else {
if ( events[nbEv].events & (EPOLLHUP | EPOLLERR | EPOLLRDHUP) ) {
socketError(t,fd);
......@@ -963,7 +962,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
"Waiting on socket, current last ts: %ld, expected at least : %ld\n",
b->lastReceivedTS,
t->nextRxTstamp + nsamps);
flushInput(t, 1000, nsamps); // was 3
flushInput(t, 3, nsamps);
}
} while (have_to_wait);
}
......
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