From 90fa3d5534001676e0dc98ed311e371fb3f56981 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 29 May 2024 14:23:44 +0200 Subject: [PATCH] gNB: make SR timers configurable in CONF file --- openair1/SIMULATION/NR_PHY/dlsim.c | 5 +- openair1/SIMULATION/NR_PHY/ulsim.c | 5 +- openair2/GNB_APP/gnb_config.c | 14 +++ openair2/GNB_APP/gnb_paramdef.h | 24 +++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 7 ++ openair2/RRC/NR/nr_rrc_config.c | 128 +++++++++++++++++++++--- 6 files changed, 165 insertions(+), 18 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index ac37c03336..b2c0a931ab 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -643,7 +643,10 @@ int main(int argc, char **argv) .minRXTXTIME = 6, .do_CSIRS = 0, .do_SRS = 0, - .force_256qam_off = false}; + .force_256qam_off = false, + .timer_config.sr_ProhibitTimer = 0, + .timer_config.sr_TransMax = 64, + .timer_config.sr_ProhibitTimer_v1700 = 0}; RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index ae2abbdc3d..1c8dc7b001 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -607,7 +607,10 @@ int main(int argc, char *argv[]) .minRXTXTIME = 0, .do_CSIRS = 0, .do_SRS = 0, - .force_256qam_off = false}; + .force_256qam_off = false, + .timer_config.sr_ProhibitTimer = 0, + .timer_config.sr_TransMax = 64, + .timer_config.sr_ProhibitTimer_v1700 = 0}; RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index b0a49e02fb..1c76805eac 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1321,6 +1321,20 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) config.force_256qam_off ? "force off" : "may be on", config.use_deltaMCS ? "on" : "off"); + paramdef_t Timers_Params[] = GNB_TIMERS_PARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; + sprintf(aprefix, "%s.[0].%s", GNB_CONFIG_STRING_GNB_LIST, GNB_CONFIG_STRING_TIMERS_CONFIG); + config_get(config_get_if(), Timers_Params, sizeofArray(Timers_Params), aprefix); + + config.timer_config.sr_ProhibitTimer = *Timers_Params[GNB_TIMERS_SR_PROHIBIT_TIMER_IDX].iptr; + config.timer_config.sr_TransMax = *Timers_Params[GNB_TIMERS_SR_TRANS_MAX_IDX].iptr; + config.timer_config.sr_ProhibitTimer_v1700 = *Timers_Params[GNB_TIMERS_SR_PROHIBIT_TIMER_V1700_IDX].iptr; + LOG_I(GNB_APP, + "sr_ProhibitTimer %d, sr_TransMax %d, sr_ProhibitTimer_v1700 %d\n", + config.timer_config.sr_ProhibitTimer, + config.timer_config.sr_TransMax, + config.timer_config.sr_ProhibitTimer_v1700); + NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); NR_ServingCellConfig_t *scd = get_scd_config(cfg); diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 46dae3622e..642c911e5c 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -323,6 +323,30 @@ typedef enum { #define GNB_AMF_IPV4_ADDRESS_IDX 0 +/*---------------------------------------------------------------------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------------------------------------------------------------------*/ +/* TIMERS configuration parameters section name */ +#define GNB_CONFIG_STRING_TIMERS_CONFIG "TIMERS" + +/* TIMERS configuration parameters names */ +#define GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER "sr_ProhibitTimer" +#define GNB_CONFIG_STRING_TIMERS_SR_TRANS_MAX "sr_TransMax" +#define GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER_V1700 "sr_ProhibitTimer_v1700" + +/*-------------------------------------------------------------------------------------------------------------------------------------*/ +/* TIMERS configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-------------------------------------------------------------------------------------------------------------------------------------*/ +#define GNB_TIMERS_PARAMS_DESC { \ +{GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_SR_TRANS_MAX, NULL, 0, .iptr=NULL, .defintval=64, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER_V1700, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +} + +#define GNB_TIMERS_SR_PROHIBIT_TIMER_IDX 0 +#define GNB_TIMERS_SR_TRANS_MAX_IDX 1 +#define GNB_TIMERS_SR_PROHIBIT_TIMER_V1700_IDX 2 + /*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/ /* SCTP configuration parameters section name */ diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 48e25e794b..01dcfc4e40 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -128,6 +128,12 @@ typedef struct nr_pdsch_AntennaPorts_t { int XP; } nr_pdsch_AntennaPorts_t; +typedef struct nr_mac_timers { + int sr_ProhibitTimer; + int sr_TransMax; + int sr_ProhibitTimer_v1700; +} nr_mac_timers_t; + typedef struct nr_mac_config_t { int sib1_tda; nr_pdsch_AntennaPorts_t pdsch_AntennaPorts; @@ -140,6 +146,7 @@ typedef struct nr_mac_config_t { bool use_deltaMCS; //int pusch_TargetSNRx10; //int pucch_TargetSNRx10; + nr_mac_timers_t timer_config; } nr_mac_config_t; typedef struct NR_preamble_ue { diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 9f6133628c..2295440973 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2282,7 +2282,102 @@ static NR_PhysicalCellGroupConfig_t *configure_phy_cellgroup(void) return physicalCellGroupConfig; } -static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(void) +static long *get_sr_ProhibitTimer(const nr_mac_timers_t *timer_config) +{ + if (timer_config->sr_ProhibitTimer == 0) + return NULL; + + long *ret = calloc(1, sizeof(*ret)); + switch (timer_config->sr_ProhibitTimer) { + case 1: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms1; + break; + case 2: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms2; + break; + case 4: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms4; + break; + case 8: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms8; + break; + case 16: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms16; + break; + case 32: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms32; + break; + case 64: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms64; + break; + case 128: + *ret = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms128; + break; + default: + AssertFatal(1 == 0, "Invalid value configured for sr_ProhibitTimer!\n"); + } + return ret; +} + +static long get_sr_TransMax(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->sr_TransMax) { + case 4: + return NR_SchedulingRequestToAddMod__sr_TransMax_n4; + case 8: + return NR_SchedulingRequestToAddMod__sr_TransMax_n8; + case 16: + return NR_SchedulingRequestToAddMod__sr_TransMax_n16; + case 32: + return NR_SchedulingRequestToAddMod__sr_TransMax_n32; + case 64: + return NR_SchedulingRequestToAddMod__sr_TransMax_n64; + default: + AssertFatal(1 == 0, "Invalid value configured for sr_TransMax!\n"); + } +} + +static long *get_sr_ProhibitTimer_v1700(const nr_mac_timers_t *timer_config) +{ + if (timer_config->sr_ProhibitTimer_v1700 == 0) + return NULL; + + long *ret = calloc(1, sizeof(*ret)); + switch (timer_config->sr_ProhibitTimer_v1700) { + case 192: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms192; + break; + case 256: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms256; + break; + case 320: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms320; + break; + case 384: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms384; + break; + case 448: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms448; + break; + case 512: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms512; + break; + case 576: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms576; + break; + case 640: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms640; + break; + case 1082: + *ret = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms1082; + break; + default: + AssertFatal(1 == 0, "Invalid value configured for sr_ProhibitTimer_v1700!\n"); + } + return ret; +} + +static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(const nr_mac_timers_t *timer_config) { NR_MAC_CellGroupConfig_t * mac_CellGroupConfig = calloc(1, sizeof(*mac_CellGroupConfig)); AssertFatal(mac_CellGroupConfig != NULL, "Couldn't allocate mac-CellGroupConfig. Out of memory!\n"); @@ -2303,20 +2398,21 @@ static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(void) mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList)); struct NR_SchedulingRequestToAddMod *schedulingrequestlist = CALLOC(1,sizeof(*schedulingrequestlist)); schedulingrequestlist->schedulingRequestId = 0; - schedulingrequestlist->sr_ProhibitTimer = NULL; - schedulingrequestlist->sr_TransMax = NR_SchedulingRequestToAddMod__sr_TransMax_n64; + schedulingrequestlist->sr_ProhibitTimer = get_sr_ProhibitTimer(timer_config); + schedulingrequestlist->sr_TransMax = get_sr_TransMax(timer_config); asn1cSeqAdd(&(mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list),schedulingrequestlist); - mac_CellGroupConfig->ext4 = calloc(1, sizeof(*mac_CellGroupConfig->ext4)); - mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700 = - calloc(1, sizeof(*mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700)); - mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700->schedulingRequestToAddModListExt_v1700 = - calloc(1, sizeof(*mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700->schedulingRequestToAddModListExt_v1700)); - struct NR_SchedulingRequestToAddModExt_v1700 *schedulingrequestlist_v1700 = calloc(1, sizeof(*schedulingrequestlist_v1700)); - schedulingrequestlist_v1700->sr_ProhibitTimer_v1700 = calloc(1, sizeof(*schedulingrequestlist_v1700->sr_ProhibitTimer_v1700)); - *schedulingrequestlist_v1700->sr_ProhibitTimer_v1700 = NR_SchedulingRequestToAddModExt_v1700__sr_ProhibitTimer_v1700_ms576; - asn1cSeqAdd(&(mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700->schedulingRequestToAddModListExt_v1700->list), - schedulingrequestlist_v1700); + if (timer_config->sr_ProhibitTimer_v1700 != 0) { + mac_CellGroupConfig->ext4 = calloc(1, sizeof(*mac_CellGroupConfig->ext4)); + mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700 = + calloc(1, sizeof(*mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700)); + mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700->schedulingRequestToAddModListExt_v1700 = + calloc(1, sizeof(*mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700->schedulingRequestToAddModListExt_v1700)); + struct NR_SchedulingRequestToAddModExt_v1700 *schedulingrequestlist_v1700 = calloc(1, sizeof(*schedulingrequestlist_v1700)); + schedulingrequestlist_v1700->sr_ProhibitTimer_v1700 = get_sr_ProhibitTimer_v1700(timer_config); + asn1cSeqAdd(&(mac_CellGroupConfig->ext4->schedulingRequestConfig_v1700->schedulingRequestToAddModListExt_v1700->list), + schedulingrequestlist_v1700); + } mac_CellGroupConfig->skipUplinkTxDynamic=false; mac_CellGroupConfig->ext1 = NULL; @@ -2584,8 +2680,8 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, cellGroupConfig->rlc_BearerToReleaseList = NULL; /* mac CellGroup Config */ - cellGroupConfig->mac_CellGroupConfig = configure_mac_cellgroup(); - + cellGroupConfig->mac_CellGroupConfig = configure_mac_cellgroup(&configuration->timer_config); + cellGroupConfig->physicalCellGroupConfig = configure_phy_cellgroup(); cellGroupConfig->spCellConfig = get_initial_SpCellConfig(uid, scc, servingcellconfigdedicated, configuration); @@ -2798,7 +2894,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC secondaryCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); asn1cSeqAdd(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); - secondaryCellGroup->mac_CellGroupConfig = configure_mac_cellgroup(); + secondaryCellGroup->mac_CellGroupConfig = configure_mac_cellgroup(&configuration->timer_config); secondaryCellGroup->physicalCellGroupConfig = configure_phy_cellgroup(); secondaryCellGroup->spCellConfig = calloc(1, sizeof(*secondaryCellGroup->spCellConfig)); secondaryCellGroup->spCellConfig->servCellIndex = calloc(1, sizeof(*secondaryCellGroup->spCellConfig->servCellIndex));