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
+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) {