From 465d7de5a9601aad5f7452bc5d255e72efbf23a7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Jul 2025 12:34:46 +0200 Subject: [PATCH] Remove --usim-test command line option Remove the --usim-test option: to my knowledge, it's not used by users, and is misleadingly placed in various places where there should not be a difference w.r.t. USIM configuration. When making the changes, I assumed that --usim-test would be 0 (the default), which is the case in all executables when not specified in options except for the nr_dlsim, nr_pbchsmi, nr_ulsim simulators. The only exception is the initialization of PDCP from the MAC, which is not correct (the PDCP is in the CU, so it does not make sense to call it from the MAC which is in the DU). Instead, always initialize from main, even in the NSA case (NSA was covered by the incorrect initialization from MAC). This in turn let to some more cleanup around function du_rlc_data_req(). After receiving GTP packets at the DU, they were given to the PDCP to enqueue the packet at RLC. This does not work anymore, since the PDCP is not initialized; it also does not seem necessary, as this enqueue functionality is necessary to decouple PDCP and RLC to avoid deadlocks in monolithic, but in split-mode, this cannot happen. Instead, call directly into the RLC when receiving GTP packets. --- doc/F1AP/F1-design.md | 4 ++-- executables/nr-softmodem.c | 10 ++------ executables/softmodem-common.h | 5 ---- openair1/SIMULATION/NR_PHY/dlsim.c | 1 - openair1/SIMULATION/NR_PHY/pbchsim.c | 1 - openair1/SIMULATION/NR_PHY/ulsim.c | 1 - openair2/GNB_APP/gnb_config.c | 24 +++++-------------- openair2/LAYER2/MAC/ue_procedures.c | 3 +-- .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/main.c | 3 --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 16 ------------- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 8 ------- openair2/RRC/LTE/MESSAGES/asn1_msg.c | 12 ---------- openair3/NAS/UE/EMM/Authentication.c | 9 +------ .../UE/EMM/SAP/EmmDeregisteredNormalService.c | 9 +------ openair3/NAS/UE/EMM/emm_main.c | 5 ---- openair3/NAS/UE/UEprocess.c | 1 - 17 files changed, 14 insertions(+), 100 deletions(-) diff --git a/doc/F1AP/F1-design.md b/doc/F1AP/F1-design.md index 65ea6b38cf..b96f29c149 100644 --- a/doc/F1AP/F1-design.md +++ b/doc/F1AP/F1-design.md @@ -389,8 +389,8 @@ into the RLC via `enqueue_rlc_data_req()`, or (f1ap) sends a GTP message through the GTP API. In the DU in DL, assuming the GTP-U tunnel exists, GTP decapsulates the packet -and calls the reception call back `du_rlc_data_req()`, which calls -`enqueue_rlc_data_req()` in turn. +and calls the reception call back `nr_rlc_data_req()`, which enqueues the +packet into the UE's RLC buffer. ## Tunnel Setup diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 602606039a..5cc5e3a4fc 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -261,9 +261,9 @@ static int create_gNB_tasks(ngran_node_t node_type, configmodule_interface_t *cf RC.nrrrc = calloc(1, sizeof(*RC.nrrrc)); RC.nrrrc[0] = RCconfig_NRRRC(); - if (!get_softmodem_params()->nsa && !(node_type == ngran_gNB_DU)) { + if (node_type != ngran_gNB_DU) { // we start pdcp in both cuup (for drb) and cucp (for srb) - init_pdcp(); + nr_pdcp_layer_init(); } if (get_softmodem_params()->nsa) { //&& !NODE_IS_DU(node_type) @@ -513,12 +513,6 @@ static void wait_nfapi_init(char *thread_name) pthread_mutex_unlock(&nfapi_sync_mutex); } -void init_pdcp(void) { - if (!NODE_IS_DU(get_node_type())) { - nr_pdcp_layer_init(); - } -} - #ifdef E2_AGENT static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) { diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 005677a9de..33d4f4cf04 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -66,7 +66,6 @@ extern "C" #define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n" #define CONFIG_HLP_TME "tells hardware to use a time reference (0:internal, 1:external, 2:gpsdo)\n" #define CONFIG_HLP_TUNE_OFFSET "LO tuning offset to use in Hz\n" -#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n" #define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n" #define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n" #define CONFIG_HLP_ULF "Set the uplink frequency offset for all component carriers\n" @@ -134,7 +133,6 @@ extern "C" #define TIMING_SOURCE softmodem_params.timing_source #define TUNE_OFFSET softmodem_params.tune_offset #define SEND_DMRSSYNC softmodem_params.send_dmrs_sync -#define USIM_TEST softmodem_params.usim_test #define CHEST_FREQ softmodem_params.chest_freq #define CHEST_TIME softmodem_params.chest_time #define NFAPI softmodem_params.nfapi @@ -156,7 +154,6 @@ extern int usrp_tx_thread; {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, .iptr=&PHY_TEST, .defintval=0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, .iptr=&DO_RA, .defintval=0, TYPE_INT, 0}, \ {"sl-mode", CONFIG_HLP_SL_MODE, 0, .u8ptr=&SL_MODE, .defintval=0, TYPE_UINT8, 0}, \ - {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, .u8ptr=&USIM_TEST, .defintval=0, TYPE_UINT8, 0}, \ {"clock-source", CONFIG_HLP_CLK, 0, .uptr=&CLOCK_SOURCE, .defintval=0, TYPE_UINT, 0}, \ {"time-source", CONFIG_HLP_TME, 0, .uptr=&TIMING_SOURCE, .defintval=0, TYPE_UINT, 0}, \ {"tune-offset", CONFIG_HLP_TUNE_OFFSET, 0, .dblptr=&TUNE_OFFSET, .defintval=0, TYPE_DOUBLE, 0}, \ @@ -221,7 +218,6 @@ extern int usrp_tx_thread; { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ - { .s5 = { NULL } }, \ { .s3a = { config_checkstr_assign_integer, \ {"MONOLITHIC", "PNF", "VNF", "AERIAL","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \ {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF, NFAPI_MODE_AERIAL,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \ @@ -324,7 +320,6 @@ typedef struct { int phy_test; int do_ra; uint8_t sl_mode; - uint8_t usim_test; int emulate_rf; int chain_offset; int numerology; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index f1fa7885a4..33fd847ecf 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -654,7 +654,6 @@ printf("%d\n", slot); InitSinLUT(); get_softmodem_params()->phy_test = 1; - get_softmodem_params()->usim_test = 1; get_softmodem_params()->do_ra = 0; IS_SOFTMODEM_DLSIM = true; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 4fc6f788b7..6279663e74 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -154,7 +154,6 @@ int main(int argc, char **argv) int ssb_scan_threads = 0; channel_desc_t *gNB2UE; - get_softmodem_params()->usim_test = 1; //uint8_t extended_prefix_flag=0; //int8_t interf1=-21,interf2=-21; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 4e127fe0b7..56c9a9dd9f 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -576,7 +576,6 @@ int main(int argc, char *argv[]) get_softmodem_params()->phy_test = 1; get_softmodem_params()->do_ra = 0; - get_softmodem_params()->usim_test = 1; if (snr1set == 0) snr1 = snr0 + 10; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 5274a4696d..f01b5968f7 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1237,15 +1237,9 @@ static NR_ServingCellConfigCommon_t *get_scc_config(configmodule_interface_t *cf // TODO: Make CSS aggregation levels configurable int css_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; css_num_agg_level_candidates[PDCCH_AGG_LEVEL1] = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; - if (get_softmodem_params()->usim_test) { - css_num_agg_level_candidates[PDCCH_AGG_LEVEL2] = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - css_num_agg_level_candidates[PDCCH_AGG_LEVEL4] = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - css_num_agg_level_candidates[PDCCH_AGG_LEVEL8] = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; - } else { - css_num_agg_level_candidates[PDCCH_AGG_LEVEL2] = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - css_num_agg_level_candidates[PDCCH_AGG_LEVEL4] = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; - css_num_agg_level_candidates[PDCCH_AGG_LEVEL8] = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; - } + css_num_agg_level_candidates[PDCCH_AGG_LEVEL2] = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + css_num_agg_level_candidates[PDCCH_AGG_LEVEL4] = NR_SearchSpace__nrofCandidates__aggregationLevel4_n2; + css_num_agg_level_candidates[PDCCH_AGG_LEVEL8] = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; css_num_agg_level_candidates[PDCCH_AGG_LEVEL16] = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; NR_SearchSpace_t *ss1 = rrc_searchspace_config(true, 1, 0, css_num_agg_level_candidates); @@ -1674,15 +1668,9 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) // Construct default aggragation level list or read from config int uess_num_agg_level_candidates[NUM_PDCCH_AGG_LEVELS]; uess_num_agg_level_candidates[PDCCH_AGG_LEVEL1] = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; - if (get_softmodem_params()->usim_test) { - uess_num_agg_level_candidates[PDCCH_AGG_LEVEL2] = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - uess_num_agg_level_candidates[PDCCH_AGG_LEVEL4] = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - uess_num_agg_level_candidates[PDCCH_AGG_LEVEL8] = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; - } else { - uess_num_agg_level_candidates[PDCCH_AGG_LEVEL2] = NR_SearchSpace__nrofCandidates__aggregationLevel2_n2; - uess_num_agg_level_candidates[PDCCH_AGG_LEVEL4] = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; - uess_num_agg_level_candidates[PDCCH_AGG_LEVEL8] = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; - } + uess_num_agg_level_candidates[PDCCH_AGG_LEVEL2] = NR_SearchSpace__nrofCandidates__aggregationLevel2_n2; + uess_num_agg_level_candidates[PDCCH_AGG_LEVEL4] = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; + uess_num_agg_level_candidates[PDCCH_AGG_LEVEL8] = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; uess_num_agg_level_candidates[PDCCH_AGG_LEVEL16] = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; int* agg_level_list = uess_num_agg_level_candidates; int num_agg_levels = 5; diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index fced846a3c..69beaa7281 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -2460,8 +2460,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, && (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { // Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU - if (( get_softmodem_params()->usim_test == 0) && (lcid == DCCH1) - && (lcid_rlc_pdu_count == 0) && (num_sdus)) { + if ((lcid == DCCH1) && (lcid_rlc_pdu_count == 0) && (num_sdus)) { // Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed break; } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index b65a829f40..d9b0136069 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -94,7 +94,7 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue uint8_t *sdu = malloc16(sdu_buffer_sizeP); memcpy(sdu, sdu_buffer_pP, sdu_buffer_sizeP); - du_rlc_data_req(ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu); + nr_rlc_data_req(ctxt_pP, srb_flagP, rb_idP, muiP, sdu_buffer_sizeP, sdu); return true; } diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index e4808fe7c7..c4f0fad659 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -310,9 +310,6 @@ void mac_top_init_gNB(ngran_node_t node_type, nr_rlc_op_mode_t mode = NODE_IS_MONOLITHIC(node_type) ? NR_RLC_OP_MODE_MONO_GNB : NR_RLC_OP_MODE_SPLIT_GNB; int success = nr_rlc_module_init(mode); AssertFatal(success == 0,"Could not initialize RLC layer\n"); - - // These should be out of here later - if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(); } else { RC.nrmac = NULL; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 4375692e9b..e170e90823 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -218,22 +218,6 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, if (pthread_mutex_unlock(&q.m) != 0) abort(); } -void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - uint8_t *sdu_pP) -{ - enqueue_rlc_data_req(ctxt_pP, - srb_flagP, - rb_idP, muiP, - confirmP, - sdu_sizeP, - sdu_pP); -} - /****************************************************************************/ /* rlc_data_req queue - end */ /****************************************************************************/ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index a77cc895e6..8d6a65cad6 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -36,14 +36,6 @@ struct NR_SRB_ToAddMod; void nr_pdcp_layer_init(void); -void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - uint8_t *sdu_pP); - bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const rb_id_t rb_id, diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index 6ab23569af..9511a7494b 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -4717,18 +4717,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname, bool // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count = 0; // no measurements on other bands // UE_EUTRA_Capability->featureGroupIndicators // null - if (get_softmodem_params()->usim_test == 1) { - // featureGroup is mandatory for CMW tests - // featureGroup is filled only for usim-test mode - BIT_STRING_t *bit_string = CALLOC(1, sizeof(*bit_string)); - char featrG[4] = { 0x00, 0x08, 0x00, 0x04 }; - bit_string->buf = CALLOC(1, 4); - memcpy(bit_string->buf, featrG, 4); - bit_string->size = 4; - bit_string->bits_unused = 0; - UE_EUTRA_Capability->featureGroupIndicators = bit_string; - } - if (get_softmodem_params()->nsa && received_nr_msg) { allocate_en_DC_r15(UE_EUTRA_Capability); diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 55b269f413..33e42e9d99 100644 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -210,14 +210,7 @@ int emm_proc_authentication_request(nas_user_t *user, int native_ksi, int ksi, * of the core network by means of the received AUTN parameter and * request the USIM to compute RES, CK and IK for given RAND */ - if(get_softmodem_params()->usim_test == 0) - { - rc = usim_api_authenticate(&user->usim_data, rand, autn, &auts, &res, &ck, &ik); - } - else - { - rc = usim_api_authenticate_test(&user->usim_data, rand, autn, &auts, &res, &ck, &ik); - } + rc = usim_api_authenticate(&user->usim_data, rand, autn, &auts, &res, &ck, &ik); } if (rc != RETURNok) { diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c index a49f71cd4b..e497353a01 100644 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c @@ -110,14 +110,7 @@ int EmmDeregisteredNormalService(nas_user_t *user, const emm_reg_t *evt) /* * Initiate the attach procedure for EPS services */ - if(get_softmodem_params()->usim_test == 0) - { - rc = emm_proc_attach(user, EMM_ATTACH_TYPE_EPS); - } - else - { - rc = emm_proc_attach(user, EMM_ATTACH_TYPE_IMSI); // CMW500 IMSI initial attach expected - } + rc = emm_proc_attach(user, EMM_ATTACH_TYPE_EPS); break; case _EMMREG_ATTACH_REQ: diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c index 3deabbe9be..e934012e4c 100644 --- a/openair3/NAS/UE/EMM/emm_main.c +++ b/openair3/NAS/UE/EMM/emm_main.c @@ -51,11 +51,6 @@ Description Defines the EPS Mobility Management procedure call manager, #include "IdleMode.h" #include "common/utils/mem/oai_memory.h" -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ -extern uint8_t usim_test; - /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ diff --git a/openair3/NAS/UE/UEprocess.c b/openair3/NAS/UE/UEprocess.c index 1de5db45ab..2a38c6a461 100644 --- a/openair3/NAS/UE/UEprocess.c +++ b/openair3/NAS/UE/UEprocess.c @@ -72,7 +72,6 @@ static void _nas_signal_handler(int signal); static void _nas_clean(user_api_id_t *user_api_id, int net_fd); -uint8_t usim_test = 0; // FIXME user must be set up with right itti message instance // FIXME allocate user and initialize its fields nas_user_t *user = NULL;