From f80896f93fa34e963fc62e1c7601225c0a7643f6 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 24 Aug 2023 15:06:54 +0200 Subject: [PATCH] Fix LCID to RB association, allow more than 8 LCIDs in the UE --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 5 +---- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 10 ++++++---- openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h | 5 +---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 94aff89a56..6776ac6a49 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2586,7 +2586,6 @@ static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_fr } // if is_nr_UL_slot } -#define MAX_LCID 8 // NR_MAX_NUM_LCID shall be used but the mac_rlc_data_req function can fetch data for max 8 LCID typedef struct { uint8_t bsr_len; uint8_t bsr_ce_len; @@ -2872,7 +2871,6 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, //mac_ce_p->phr_ce_len = 0; //mac_ce_p->phr_header_len = 0; - uint8_t lcid = 0; uint16_t sdu_length = 0; uint16_t num_sdus = 0; mac_ce_p->sdu_length_total = 0; @@ -2898,8 +2896,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, // Check for DCCH first // TO DO: Multiplex in the order defined by the logical channel prioritization - for (lcid = UL_SCH_LCID_SRB1; lcid < MAX_LCID; lcid++) { - + for (int lcid = UL_SCH_LCID_SRB1; lcid < NR_MAX_NUM_LCID; lcid++) { buflen_remain = buflen - (mac_ce_p->total_mac_pdu_header_len + mac_ce_p->sdu_length_total + sh_size); LOG_D(NR_MAC, "In %s: [UE %d] [%d.%d] UL-DXCH -> ULSCH, RLC with LCID 0x%02x (TBS %d bytes, sdu_length_total %d bytes, MAC header len %d bytes, buflen_remain %d bytes)\n", diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 7a2d3ae0a5..3f8a298f9e 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -54,15 +54,17 @@ static uint64_t nr_rlc_current_time; static int nr_rlc_current_time_last_frame; static int nr_rlc_current_time_last_subframe; -nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, - logical_chan_id_t channel_id) +static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t channel_id) { if (channel_id == 0) return ue->srb0; nr_rlc_rb_t *rb = &ue->lcid2rb[channel_id - 1]; - if (rb->type == NR_RLC_SRB) + if (rb->type == NR_RLC_NONE) + return NULL; + if (rb->type == NR_RLC_SRB) { + AssertFatal(rb->choice.srb_id > 0, "logic bug: impossible to have srb0 here\n"); return ue->srb[rb->choice.srb_id - 1]; - else { + } else { AssertFatal(rb->type == NR_RLC_DRB, "Invalid RB type\n"); return ue->drb[rb->choice.drb_id - 1]; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index 5c7c58e3ee..ed29c5458b 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -27,10 +27,7 @@ typedef void nr_rlc_ue_manager_t; -typedef enum nr_rlc_rb_type { - NR_RLC_SRB = 0, - NR_RLC_DRB = 1 -} nr_rlc_rb_type; +typedef enum nr_rlc_rb_type { NR_RLC_NONE = 0, NR_RLC_SRB = 1, NR_RLC_DRB = 2 } nr_rlc_rb_type; typedef struct nr_rlc_rb_t { nr_rlc_rb_type type;