From b375a804bfb87cc2bb1d8d34c545d193b8260590 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 30 Nov 2022 16:22:52 +0100 Subject: [PATCH 1/3] Cleanup of NUMBER_OF_NR_UE_MAX and its references - this defition is obsolete --- common/openairinterface5g_limits.h | 2 -- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/common/openairinterface5g_limits.h b/common/openairinterface5g_limits.h index f420722350..2349941cf2 100644 --- a/common/openairinterface5g_limits.h +++ b/common/openairinterface5g_limits.h @@ -27,7 +27,6 @@ # ifndef PHYSIM # ifndef UE_EXPANSION # define NUMBER_OF_UE_MAX 40 -# define NUMBER_OF_NR_UE_MAX 4 # define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_gNB_MAX 1 # else @@ -37,7 +36,6 @@ # endif # else # define NUMBER_OF_UE_MAX 4 -# define NUMBER_OF_NR_UE_MAX 4 # define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_gNB_MAX 1 # endif diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 631ef803d9..315fa9a013 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -308,7 +308,7 @@ int main(int argc, char **argv) int tx_offset; int32_t txlev_sum = 0, atxlev[4]; int start_rb = 0; - int UE_id =0; // [hna] only works for UE_id = 0 because NUMBER_OF_NR_UE_MAX is set to 1 (phy_init_nr_gNB causes segmentation fault) + int UE_id = 0; int print_perf = 0; cpuf = get_cpu_freq_GHz(); int msg3_flag = 0; From c99539a8067a434525907d556d98e61e33075126 Mon Sep 17 00:00:00 2001 From: Guido Date: Thu, 1 Dec 2022 05:44:45 -0800 Subject: [PATCH 2/3] Bugfix wrong use of qsort - The qsort() function is defined as: void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); and sorts an array with nmemb elements of size size. - in the gNB scheduling functions, nmemb and size were swapped - this was causing a stack overflow ending with a SEGFAULT under certain circumstances --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index af76867ef3..7131e9c2b2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -628,7 +628,7 @@ void pf_dl(module_id_t module_id, } } - qsort(UE_sched, sizeof(*UE_sched), sizeofArray(UE_sched), comparator); + qsort(UE_sched, sizeofArray(UE_sched), sizeof(UEsched_t), comparator); UEsched_t *iterator = UE_sched; const int min_rbSize = 5; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index d6a9553c10..680e308400 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1705,7 +1705,7 @@ void pf_ul(module_id_t module_id, curUE++; } - qsort(UE_sched, sizeof(*UE_sched), sizeofArray(UE_sched), comparator); + qsort(UE_sched, sizeofArray(UE_sched), sizeof(UEsched_t), comparator); UEsched_t *iterator=UE_sched; /* Loop UE_sched to find max coeff and allocate transmission */ From 3a24b66ecf069efd3dfa30ee778a4c24323ed7c8 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 15 Dec 2022 10:28:32 +0100 Subject: [PATCH 3/3] Define for RX/TX Max Size of RLC buffers - new definition to replace hardcoded values --- openair2/COMMON/platform_constants.h | 4 ++++ openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index f053fe7f1e..47dac57832 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -119,6 +119,10 @@ #define CH_OFFSET 0x0004 #define CH_SHIFT 2 +// RLC Entity +#define RLC_TX_MAXSIZE 10000000 +#define RLC_RX_MAXSIZE 10000000 + // RLC_AM_SEND_MRW # define SEND_MRW_OFF 15 # define SEND_MRW_ON 240 diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 31dbfefd5e..d841260475 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -758,8 +758,8 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig poll_byte = -1; max_retx_threshold = 8; sn_field_length = 12; - nr_rlc_am = new_nr_rlc_entity_am(10000000, - 10000000, + nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE, + RLC_TX_MAXSIZE, deliver_sdu, ue, successful_delivery, ue, max_retx_reached, ue, @@ -840,8 +840,8 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ if (ue->drb[drb_id-1] != NULL) { LOG_W(RLC, "%s:%d:%s: DRB %d already exists for UE with RNTI %04x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } else { - nr_rlc_am = new_nr_rlc_entity_am(10000000, - 10000000, + nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE, + RLC_TX_MAXSIZE, deliver_sdu, ue, successful_delivery, ue, max_retx_reached, ue, @@ -912,8 +912,8 @@ static void add_drb_um(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ if (ue->drb[drb_id-1] != NULL) { LOG_W(RLC, "DEBUG add_drb_um %s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } else { - nr_rlc_um = new_nr_rlc_entity_um(100000000, - 100000000, + nr_rlc_um = new_nr_rlc_entity_um(RLC_RX_MAXSIZE, + RLC_TX_MAXSIZE, deliver_sdu, ue, t_reassembly, sn_field_length);