From c0a78e6c4793cf5168bd2c21fb09f8ea697b49b7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 9 Mar 2026 10:14:46 +0100 Subject: [PATCH] RLC data ind: single call for complete TB at UE --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 24 ++++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index ffe1c99823..4b548f0d78 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3876,6 +3876,8 @@ static int nr_ue_validate_successrar(uint8_t *pduP, return n; } +#define MAX_NUM_DATA_IND 1024 + /////////////////////////////////// // brief: nr_ue_process_mac_pdu // function: parsing DL PDU header @@ -3941,6 +3943,9 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_ pdu_len -= n; } + nr_rlc_data_ind_t data_ind[MAX_NUM_DATA_IND] = {0}; + int num_data_ind = 0; + while (!done && pdu_len > 0){ uint16_t mac_len = 0x0000; uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct @@ -3972,7 +3977,8 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_ if (mac_len > 0) { LOG_DDUMP(NR_MAC, (void *)pduP, mac_subheader_len + mac_len, LOG_DUMP_CHAR, "DL_SCH_LCID_CCCH (e.g. RRCSetup) payload: "); nr_rlc_data_ind_t ind = {.ch = rx_lcid, .buf = pduP + mac_subheader_len, .len = mac_len}; - nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, &ind, 1); + data_ind[num_data_ind++] = ind; + DevAssert(num_data_ind < MAX_NUM_DATA_IND); } break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: @@ -4084,8 +4090,11 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_ // MAC SDU // From values 1 to 32 it equals to the identity of the logical channel case 1 ... 32: - if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) - return; + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) { + LOG_E(MAC, "get_mac_len(): invalid pdu_len %d (mac_len %d mac_subheader_len %d)\n", pdu_len, mac_len, mac_subheader_len); + done = 1; + break; + } // discard the received subPDU if RB is suspended if (is_lcid_suspended(mac, rx_lcid)) { LOG_W(NR_MAC, "Received PDU for a suspended RB, corresponding to LCID %d. Dropping it.\n", rx_lcid); @@ -4093,7 +4102,8 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_ } LOG_D(NR_MAC, "%4d.%2d : DLSCH -> LCID %d %d bytes\n", frameP, slot, rx_lcid, mac_len); nr_rlc_data_ind_t ind = {.ch = rx_lcid, .buf = pduP + mac_subheader_len, .len = mac_len}; - nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, &ind, 1); + data_ind[num_data_ind++] = ind; + DevAssert(num_data_ind < MAX_NUM_DATA_IND); break; default: LOG_W(MAC, "unknown lcid %02x\n", rx_lcid); @@ -4101,9 +4111,13 @@ static void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_ } pduP += (mac_subheader_len + mac_len); pdu_len -= (mac_subheader_len + mac_len); - if (pdu_len < 0) + if (pdu_len < 0) { LOG_E(MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", mac->ue_id, frameP, slot, pdu_len); + done = 1; + } } + + nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, data_ind, num_data_ind); } /**