diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index fad251b060..6ed407a507 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -201,11 +201,15 @@ nrUE_params_t *get_nrUE_params(void) { } static void get_options(configmodule_interface_t *cfg) { - paramdef_t cmdline_params[] =CMDLINE_NRUEPARAMS_DESC ; + paramdef_t cmdline_params[] = CMDLINE_NRUEPARAMS_DESC; int numparams = sizeofArray(cmdline_params); config_get(cfg, cmdline_params, numparams, NULL); if (nrUE_params.vcdflag > 0) ouput_vcd = 1; + AssertFatal(nrUE_params.extra_pdu_id != get_softmodem_params()->default_pdu_session_id, + "Default PDU ID (%d) and Extra PDU ID (%d) must be different!\n", + get_softmodem_params()->default_pdu_session_id, + nrUE_params.extra_pdu_id); } // set PHY vars from command line diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 2eb9138e78..e5f2eb6571 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -24,6 +24,7 @@ extern uint16_t ue_id_g; #define CONFIG_HLP_AGC "Rx Gain control used for UE\n" #define CONFIG_HLP_NUM_UL_ACTORS "Number of UL actors to use. Set to 0 to disable UL actor framework and do processing inline\n" #define CONFIG_HLP_NUM_DL_ACTORS "Number of DL actors to use. Set to 0 to disable DL actor framework and do processing inline\n" +#define CONFIG_HLP_EXTRA_PDU_ID "ID of an additional PDU session to configure alongside default PDU session\n" /***************************************************************************************************************************************/ /* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument @@ -81,6 +82,7 @@ extern uint16_t ue_id_g; {"agc", CONFIG_HLP_AGC, PARAMFLAG_BOOL, .iptr=&(nrUE_params.agc), .defintval=0, TYPE_INT, 0}, \ {"num-ul-actors", CONFIG_HLP_NUM_UL_ACTORS, 0, .iptr=&nrUE_params.num_ul_actors, .defintval=2, TYPE_INT, 0}, \ {"num-dl-actors", CONFIG_HLP_NUM_DL_ACTORS, 0, .iptr=&nrUE_params.num_dl_actors, .defintval=4, TYPE_INT, 0}, \ + {"extra-pdu-id", CONFIG_HLP_EXTRA_PDU_ID, 0, .iptr=&nrUE_params.extra_pdu_id, .defintval=-1, TYPE_INT, 0}, \ } // clang-format on @@ -122,6 +124,7 @@ typedef struct { int tx_max_power; int num_ul_actors; int num_dl_actors; + int extra_pdu_id; } nrUE_params_t; extern uint64_t get_nrUE_optmask(void); extern uint64_t set_nrUE_optmask(uint64_t bitmask); diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 8bd3558ff1..005677a9de 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -189,7 +189,7 @@ extern int usrp_tx_thread; {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, .iptr=&softmodem_params.threequarter_fs, .defintval=0, TYPE_INT, 0}, \ {"imscope" , CONFIG_HLP_IMSCOPE, PARAMFLAG_BOOL, .uptr=&enable_imscope, .defintval=0, TYPE_UINT, 0}, \ {"imscope-record" , CONFIG_HLP_IMSCOPE_RECORD,PARAMFLAG_BOOL, .uptr=&enable_imscope_record, .defintval=0, TYPE_UINT, 0}, \ - {"default_pdu_id", NULL, 0, .iptr=&DEFAULT_PDU_ID, .defintval=10, TYPE_INT, 0}, \ + {"default-pdu-id", NULL, 0, .iptr=&DEFAULT_PDU_ID, .defintval=10, TYPE_INT, 0}, \ } // clang-format on @@ -347,6 +347,7 @@ typedef struct { int no_itti; int threequarter_fs; int default_pdu_session_id; + int extra_pdu_session_id; } softmodem_params_t; #define IS_SA_MODE(sM_params) (!(sM_params)->phy_test && !(sM_params)->do_ra && !(sM_params)->nsa) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 25ddd20b1d..009cbc0ccf 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2514,7 +2514,10 @@ static long get_num_bytes_to_reqlc(NR_UE_MAC_INST_t *mac, } } AssertFatal(num_remaining_bytes >= 0 && num_bytes_requested <= buflen_remain, - "the total number of bytes allocated until target length is greater than expected\n"); + "the total number of bytes allocated until target length is greater than expected: num_bytes_requested %ld, " + "buflen_remain %d\n", + num_bytes_requested, + buflen_remain); LOG_D(NR_MAC, "number of bytes requested for lcid %d is %li\n", lc_num, num_bytes_requested); return num_bytes_requested; @@ -2780,11 +2783,9 @@ static uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac, remain); if (num_lcids_same_priority == count_same_priority_lcids) { - buflen_ep = (remain - (count_same_priority_lcids * sizeof(NR_MAC_SUBHEADER_LONG))) / count_same_priority_lcids; - /* after serving equal priority LCIDs in the first round, buflen_remain could be > 0 and < (count_same_priority_lcids * sh_size) - if above division yeilds a remainder. hence the following sets buflen_ep to 0 if there is not enough buffer left for subsequent rounds - */ - buflen_ep = buflen_ep < 0 ? 0 : buflen_ep; + buflen_ep = remain < count_same_priority_lcids * sizeof(NR_MAC_SUBHEADER_LONG) + ? 0 + : (remain - (count_same_priority_lcids * sizeof(NR_MAC_SUBHEADER_LONG))) / count_same_priority_lcids; } while (mac_ce_info.end_for_tailer - mac_ce_info.cur_ptr > 0) { diff --git a/openair3/NAS/NR_UE/CMakeLists.txt b/openair3/NAS/NR_UE/CMakeLists.txt index ec391092e5..edc596fa5f 100644 --- a/openair3/NAS/NR_UE/CMakeLists.txt +++ b/openair3/NAS/NR_UE/CMakeLists.txt @@ -11,6 +11,7 @@ target_link_libraries(nr_nas PUBLIC nas_common_ies_lib nas_utils ds + UTIL ) target_include_directories(nr_nas PUBLIC . 5GS/) diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index f2d87e5606..615cc5a4f1 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -74,6 +74,7 @@ #include "fgmm_authentication_reject.h" #include "ds/byte_array.h" #include "key_nas_deriver.h" +#include "nr-uesoftmodem.h" #define MAX_NAS_UE 4 @@ -1773,10 +1774,10 @@ static void send_nas_5gmm_ind(instance_t instance, const Guti5GSMobileIdentity_t itti_send_msg_to_task(TASK_RRC_NRUE, instance, msg); } -static void request_default_pdusession(nr_ue_nas_t *nas) +static void request_pdusession(nr_ue_nas_t *nas, int pdusession_id) { MessageDef *message_p = itti_alloc_new_message(TASK_NAS_NRUE, nas->UE_id, NAS_PDU_SESSION_REQ); - NAS_PDU_SESSION_REQ(message_p).pdusession_id = get_softmodem_params()->default_pdu_session_id; + NAS_PDU_SESSION_REQ(message_p).pdusession_id = pdusession_id; NAS_PDU_SESSION_REQ(message_p).pdusession_type = 0x91; // 0x91 = IPv4, 0x92 = IPv6, 0x93 = IPv4v6 NAS_PDU_SESSION_REQ(message_p).sst = nas->uicc->nssai_sst; NAS_PDU_SESSION_REQ(message_p).sd = nas->uicc->nssai_sd; @@ -1868,7 +1869,10 @@ static void handle_registration_accept(nr_ue_nas_t *nas, const uint8_t *pdu_buff if (get_user_nssai_idx(msg.nas_allowed_nssai, nas) < 0) { LOG_E(NAS, "NSSAI parameters not match with allowed NSSAI. Couldn't request PDU session.\n"); } else { - request_default_pdusession(nas); + request_pdusession(nas, get_softmodem_params()->default_pdu_session_id); + if (get_nrUE_params()->extra_pdu_id != -1) { + request_pdusession(nas, get_nrUE_params()->extra_pdu_id); + } } // Free local message after processing free_fgmm_registration_accept(&msg);