Merge remote-tracking branch 'origin/extra-pdu-session' into integration_2025_w29 (!3486)

NR UE: Enable additional PDU session

- fix a bug with wraparound of buffer_remain_ep
- Add --extra-pdu-id command line option

Testing procedure:

1. Start cn in openairinterface5g/doc/tutorial_resources/oai-cn5g with
   docker compose up
2. Start gnb:

    sudo ./nr-softmodem -O ../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --rfsimulator.server_address server

3. Monitor extra interfaces being created:

    watch -n 0.5 "ifconfig | grep tun"

4. Start UE:

    sudo ./nr-uesoftmodem -C 3619200000 -r 106 --numerology 1 --ssb 516  --band 78 --rfsim  --uicc0.imsi 001010000000001 --extra-pdu-id 11

5. An extra tun interface oaitun_ue1p11 should be created. Observe in
   the terminal from step 3
6. Ping the core network from both interfaces, e.g., ping -I
   oaitun_ue1p11 10.0.0.1, ping -I oaitun_ue1 10.0.0.1. This should
   generate traffic on the gNB on different LCIDs.
This commit is contained in:
Robert Schmidt
2025-07-17 09:45:08 +02:00
6 changed files with 25 additions and 11 deletions
+5 -1
View File
@@ -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
+3
View File
@@ -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);
+2 -1
View File
@@ -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)
+7 -6
View File
@@ -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) {
+1
View File
@@ -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/)
+7 -3
View File
@@ -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);