From fe671a887644e8e8379fdecbfb9055002834a7ee Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 29 Jul 2024 18:23:10 +0200 Subject: [PATCH] take into account the option to have initial pucch when scheduling UCI on PUSCH --- openair1/PHY/impl_defs_nr.h | 10 ---- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 9 +++ openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 10 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 62 ++++++++++++-------- 5 files changed, 54 insertions(+), 39 deletions(-) diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 7f9dfad719..16d5854604 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -487,16 +487,6 @@ typedef enum { reserved = 7 } PUCCH_MaxCodeRate_t; -typedef struct { - pucch_format_nr_t format; - uint8_t startingSymbolIndex; - uint8_t nrofSymbols; - uint16_t PRB_offset; - uint8_t nb_CS_indexes; - uint8_t initial_CS_indexes[MAX_NB_CYCLIC_SHIFT]; -} initial_pucch_resource_t; - - /*********************************************************************** * * FUNCTIONALITY : Scheduling Request Configuration (SR) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 426d8f88d1..819cbea02f 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -184,6 +184,15 @@ typedef enum { #undef UE_STATE } NR_UE_L2_STATE_t; +typedef struct { + pucch_format_nr_t format; + uint8_t startingSymbolIndex; + uint8_t nrofSymbols; + uint16_t PRB_offset; + uint8_t nb_CS_indexes; + uint8_t initial_CS_indexes[MAX_NB_CYCLIC_SHIFT]; +} initial_pucch_resource_t; + typedef enum { GO_TO_IDLE, DETACH, diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 6feca8756e..c5334ed04a 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -210,7 +210,7 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, int slot); bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sched_t *pucch); - +initial_pucch_resource_t get_initial_pucch_resource(const int idx); void multiplex_pucch_resource(NR_UE_MAC_INST_t *mac, PUCCH_sched_t *pucch, int num_res); int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index bd233f2163..b853df90eb 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1514,6 +1514,11 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, current_harq->dai_cumul); } +initial_pucch_resource_t get_initial_pucch_resource(const int idx) +{ + return initial_pucch_resource[idx]; +} + int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int slot, frame_t frame, @@ -1534,10 +1539,9 @@ int nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, LOG_D(NR_MAC, "initial_pucch_id %d, pucch_resource %p\n", pucch->initial_pucch_id, pucch->pucch_resource); // configure pucch from Table 9.2.1-1 // only for ack/nack - if (pucch->initial_pucch_id > -1 && - pucch->pucch_resource == NULL) { + if (pucch->initial_pucch_id > -1 && pucch->pucch_resource == NULL) { const int idx = *current_UL_BWP->pucch_ConfigCommon->pucch_ResourceCommon; - const initial_pucch_resource_t pucch_resourcecommon = initial_pucch_resource[idx]; + const initial_pucch_resource_t pucch_resourcecommon = get_initial_pucch_resource(idx); pucch_pdu->format_type = pucch_resourcecommon.format; pucch_pdu->start_symbol_index = pucch_resourcecommon.startingSymbolIndex; pucch_pdu->nr_of_symbols = pucch_resourcecommon.nrofSymbols; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index a3be440cc7..d1d523a962 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2322,7 +2322,11 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) LOG_D(NR_MAC,"Map SSB to RO done\n"); } -static bool schedule_uci_on_pusch(NR_UE_MAC_INST_t *mac, frame_t frame_tx, int slot_tx, const PUCCH_sched_t *pucch) +static bool schedule_uci_on_pusch(NR_UE_MAC_INST_t *mac, + frame_t frame_tx, + int slot_tx, + const PUCCH_sched_t *pucch, + NR_UE_UL_BWP_t *current_UL_BWP) { fapi_nr_ul_config_request_pdu_t *ulcfg_pdu = lockGet_ul_iterator(mac, frame_tx, slot_tx); if (!ulcfg_pdu) @@ -2337,29 +2341,37 @@ static bool schedule_uci_on_pusch(NR_UE_MAC_INST_t *mac, frame_t frame_tx, int s NR_PUCCH_Resource_t *pucchres = pucch->pucch_resource; int nr_of_symbols = 0; int start_symbol_index = 0; - switch(pucchres->format.present) { - case NR_PUCCH_Resource__format_PR_format0 : - nr_of_symbols = pucchres->format.choice.format0->nrofSymbols; - start_symbol_index = pucchres->format.choice.format0->startingSymbolIndex; - break; - case NR_PUCCH_Resource__format_PR_format1 : - nr_of_symbols = pucchres->format.choice.format1->nrofSymbols; - start_symbol_index = pucchres->format.choice.format1->startingSymbolIndex; - break; - case NR_PUCCH_Resource__format_PR_format2 : - nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; - start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; - break; - case NR_PUCCH_Resource__format_PR_format3 : - nr_of_symbols = pucchres->format.choice.format3->nrofSymbols; - start_symbol_index = pucchres->format.choice.format3->startingSymbolIndex; - break; - case NR_PUCCH_Resource__format_PR_format4 : - nr_of_symbols = pucchres->format.choice.format4->nrofSymbols; - start_symbol_index = pucchres->format.choice.format4->startingSymbolIndex; - break; - default : - AssertFatal(false, "Undefined PUCCH format \n"); + if (pucch->initial_pucch_id > -1 && pucch->pucch_resource == NULL) { + const int idx = *current_UL_BWP->pucch_ConfigCommon->pucch_ResourceCommon; + const initial_pucch_resource_t pucch_resourcecommon = get_initial_pucch_resource(idx); + start_symbol_index = pucch_resourcecommon.startingSymbolIndex; + nr_of_symbols = pucch_resourcecommon.nrofSymbols; + } + else { + switch(pucchres->format.present) { + case NR_PUCCH_Resource__format_PR_format0 : + nr_of_symbols = pucchres->format.choice.format0->nrofSymbols; + start_symbol_index = pucchres->format.choice.format0->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format1 : + nr_of_symbols = pucchres->format.choice.format1->nrofSymbols; + start_symbol_index = pucchres->format.choice.format1->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format2 : + nr_of_symbols = pucchres->format.choice.format2->nrofSymbols; + start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format3 : + nr_of_symbols = pucchres->format.choice.format3->nrofSymbols; + start_symbol_index = pucchres->format.choice.format3->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format4 : + nr_of_symbols = pucchres->format.choice.format4->nrofSymbols; + start_symbol_index = pucchres->format.choice.format4->startingSymbolIndex; + break; + default : + AssertFatal(false, "Undefined PUCCH format \n"); + } } int final_symbol = nr_of_symbols + start_symbol_index; // PUCCH overlapping in time with PUSCH @@ -2468,7 +2480,7 @@ void nr_ue_pucch_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, int slotP) mac->nr_ue_emul_l1.num_csi_reports = pucch[j].n_csi; // checking if we need to schedule pucch[j] on PUSCH - if (schedule_uci_on_pusch(mac, frameP, slotP, &pucch[j])) + if (schedule_uci_on_pusch(mac, frameP, slotP, &pucch[j], mac->current_UL_BWP)) continue; fapi_nr_ul_config_request_pdu_t *pdu = lockGet_ul_config(mac, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PUCCH);