From d0ba1a30e39b582563b632398c42aac217db4607 Mon Sep 17 00:00:00 2001 From: francescomani <email@francescomani.it> Date: Fri, 7 Feb 2025 10:03:00 +0100 Subject: [PATCH] use frame_type in frame_structure instead of bool --- common/utils/nr/nr_common.h | 2 +- openair1/SCHED_NR/phy_frame_config_nr.c | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 18 +++++++++--------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 +++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 ++-- openair2/RRC/NR/nr_rrc_config.c | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index bdd10e78967..88444182633 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -142,7 +142,7 @@ typedef struct frame_structure_s { int8_t numb_slots_frame; int8_t numb_slots_period; int8_t numb_period_frame; - bool is_tdd; + frame_type_t frame_type; } frame_structure_t; typedef struct { diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index bff35ce4fff..63fd570b4c0 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -395,7 +395,7 @@ void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { void do_tdd_config_sim(PHY_VARS_gNB *gNB, int mu) { - frame_structure_t fs = {.is_tdd = true}; + frame_structure_t fs = {.frame_type = TDD}; fs.numb_slots_frame = (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; fs.numb_period_frame = get_nb_periods_per_frame(gNB->gNB_config.tdd_table.tdd_period.value); fs.numb_slots_period = fs.numb_slots_frame / fs.numb_period_frame; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 5e9c466e031..0a511defafb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -380,7 +380,7 @@ int get_first_ul_slot(const frame_structure_t *fs, bool mixed) { DevAssert(fs); - if (fs->is_tdd) { + if (fs->frame_type == TDD) { for (int i = 0; i < fs->numb_slots_period; i++) { if ((mixed && is_ul_slot(i, fs)) || fs->period_cfg.tdd_slot_bitmap[i].slot_type == TDD_NR_UPLINK_SLOT) { return i; @@ -396,7 +396,7 @@ int get_first_ul_slot(const frame_structure_t *fs, bool mixed) */ int get_dl_slots_per_period(const frame_structure_t *fs) { - return fs->is_tdd ? fs->period_cfg.num_dl_slots : fs->numb_slots_frame; + return fs->frame_type == TDD ? fs->period_cfg.num_dl_slots : fs->numb_slots_frame; } /** @@ -404,7 +404,7 @@ int get_dl_slots_per_period(const frame_structure_t *fs) */ int get_ul_slots_per_period(const frame_structure_t *fs) { - return fs->is_tdd ? fs->period_cfg.num_ul_slots : fs->numb_slots_frame; + return fs->frame_type == TDD ? fs->period_cfg.num_ul_slots : fs->numb_slots_frame; } /** @@ -416,7 +416,7 @@ int get_full_ul_slots_per_period(const frame_structure_t *fs) { DevAssert(fs); - if (!fs->is_tdd) + if (fs->frame_type == FDD) return fs->numb_slots_frame; int count = 0; @@ -438,7 +438,7 @@ int get_full_dl_slots_per_period(const frame_structure_t *fs) { DevAssert(fs); - if (!fs->is_tdd) + if (fs->frame_type == FDD) return fs->numb_slots_frame; int count = 0; @@ -456,7 +456,7 @@ int get_full_dl_slots_per_period(const frame_structure_t *fs) */ int get_ul_slots_per_frame(const frame_structure_t *fs) { - return fs->is_tdd ? fs->numb_period_frame * get_ul_slots_per_period(fs) : fs->numb_slots_frame; + return fs->frame_type == TDD ? fs->numb_period_frame * get_ul_slots_per_period(fs) : fs->numb_slots_frame; } /** @@ -471,7 +471,7 @@ int get_ul_slot_offset(const frame_structure_t *fs, int idx, bool count_mixed) DevAssert(fs); // FDD - if (!fs->is_tdd) + if (fs->frame_type == FDD) return idx; // UL slots indexes in period @@ -514,10 +514,10 @@ void config_frame_structure(int mu, if (frame_type == TDD) { fs->numb_period_frame = get_nb_periods_per_frame(tdd_period); fs->numb_slots_period = fs->numb_slots_frame / fs->numb_period_frame; - fs->is_tdd = true; + fs->frame_type = TDD; config_tdd_patterns(scc->tdd_UL_DL_ConfigurationCommon, fs); } else { // FDD - fs->is_tdd = false; + fs->frame_type = FDD; fs->numb_period_frame = 1; fs->numb_slots_period = fs->numb_slots_frame; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index c6a42324d9f..73e09f6e13e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -126,7 +126,7 @@ static void clear_beam_information(NR_beam_info_t *beam_info, int frame, int slo */ bool is_ul_slot(const slot_t slot, const frame_structure_t *fs) { - if (!fs->is_tdd) + if (fs->frame_type == FDD) return true; const tdd_period_config_t *pc = &fs->period_cfg; slot_t s = get_slot_idx_in_period(slot, fs); @@ -142,7 +142,7 @@ bool is_ul_slot(const slot_t slot, const frame_structure_t *fs) */ bool is_dl_slot(const slot_t slot, const frame_structure_t *fs) { - if (!fs->is_tdd) + if (fs->frame_type == FDD) return true; const tdd_period_config_t *pc = &fs->period_cfg; slot_t s = get_slot_idx_in_period(slot, fs); @@ -156,7 +156,7 @@ bool is_dl_slot(const slot_t slot, const frame_structure_t *fs) */ bool is_mixed_slot(const slot_t slot, const frame_structure_t *fs) { - if (!fs->is_tdd) + if (fs->frame_type == FDD) return false; slot_t s = get_slot_idx_in_period(slot, fs); const tdd_period_config_t *pc = &fs->period_cfg; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 5981381bb39..2d91fb7ffe6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -971,7 +971,7 @@ static bool get_feasible_msg3_tda(const NR_ServingCellConfigCommon_t *scc, int abs_slot = slot + k2 + mu_delta; int temp_frame = (frame + (abs_slot / slots_per_frame)) & 1023; int temp_slot = abs_slot % slots_per_frame; // msg3 slot according to 8.3 in 38.213 - if (fs->is_tdd && !is_ul_slot(temp_slot, fs)) + if (fs->frame_type == TDD && !is_ul_slot(temp_slot, fs)) continue; const tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index b63eb010a11..231e5c2e99b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -61,7 +61,7 @@ int get_dl_tda(const gNB_MAC_INST *nrmac, int slot) if (nrmac->UE_info.sched_csirs > 0) return 1; - if (fs->is_tdd) { + if (fs->frame_type == TDD) { int s = get_slot_idx_in_period(slot, fs); // if there is a mixed slot where we can transmit DL const tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 90cd1a46549..1fcceae2b98 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1036,7 +1036,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, continue; const int pucch_slot = (slot + pdsch_to_harq_feedback[f] + NTN_gNB_Koffset) % n_slots_frame; // check if the slot is UL - if (fs->is_tdd) { + if (fs->frame_type == TDD) { int mod_slot = pucch_slot % fs->numb_slots_period; if (!is_ul_slot(mod_slot, fs)) continue; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index c67af3bb3b9..8eff77ef820 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -48,7 +48,7 @@ int get_ul_tda(gNB_MAC_INST *nrmac, int frame, int slot) /* there is a mixed slot only when in TDD */ frame_structure_t *fs = &nrmac->frame_structure; - if (fs->is_tdd) { + if (fs->frame_type == TDD) { // if there is uplink symbols in mixed slot int s = get_slot_idx_in_period(slot, fs); tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap; @@ -1535,7 +1535,7 @@ static bool nr_UE_is_to_be_scheduled(const frame_structure_t *fs, * Force the default transmission in a full slot as early * as possible in the UL portion of TDD period (last_ul_slot) */ int num_slots_per_period = fs->numb_slots_period; - int last_ul_slot = fs->is_tdd ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot; + int last_ul_slot = fs->frame_type == TDD ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot; const int last_ul_sched = sched_ctrl->last_ul_frame * n + last_ul_slot; const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n); /* UE is to be scheduled if diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index d2266a74f3e..4fe0a2d764b 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1262,7 +1262,7 @@ static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedul { const frame_structure_t *fs = &RC.nrmac[0]->frame_structure; int sr_slot = 1; // in FDD SR in slot 1 - if (fs->is_tdd) + if (fs->frame_type == TDD) sr_slot = get_first_ul_slot(fs, true); schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset)); -- GitLab