From 7f31659a8647b547d07bcb73b5d77b6b5019601b Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 1 Dec 2022 10:17:06 +0100 Subject: [PATCH] limit dl_DataToUL_ACK to the number of slots per frame to avoid the need to resize VRB_map and UL_tti_req_ahead --- openair1/PHY/impl_defs_nr.h | 96 ------------------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 18 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 6 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 2 +- openair2/RRC/NR/nr_rrc_config.c | 18 ++-- openair2/RRC/NR/nr_rrc_config.h | 2 +- 7 files changed, 26 insertions(+), 120 deletions(-) diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 742f77186d..6db54684e6 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -518,102 +518,6 @@ typedef struct { } initial_pucch_resource_t; -/* structure with all possible fields for pucch format from 0 to 4 */ -typedef struct { - pucch_format_nr_t format; /* format 0 1 2 3 4 */ - uint8_t initialCyclicShift; /* x x */ - uint8_t nrofSymbols; /* x x x x x */ - uint8_t startingSymbolIndex; /* x x x x x */ - uint8_t timeDomainOCC; /* x */ - uint8_t nrofPRBs; /* x x */ - uint8_t occ_length; /* x */ - uint8_t occ_Index; /* x */ -} PUCCH_format_t; - -typedef struct { - uint8_t pucch_ResourceId; /* maxNrofPUCCH-Resources = 128 */ - uint16_t startingPRB; /* maxNrofPhysicalResourceBlocks = 275 */ - feature_status_t intraSlotFrequencyHopping; - uint16_t secondHopPRB; - PUCCH_format_t format_parameters; -} PUCCH_Resource_t; - -typedef struct { - uint8_t pucch_ResourceSetId; /* maxNrofPUCCH-ResourceSets = 4 */ -/* - -- PUCCH resources of format0 and format1 are only allowed in the first PUCCH reosurce set, - -- i.e., in a PUCCH-ResourceSet with pucch-ResourceSetId = 0. This set may contain between 8 and 32 resources. - -- PUCCH resources of format2, format3 and format4 are only allowed in a PUCCH-ReosurceSet with pucch-ResourceSetId > 0. If present, these sets must contain 8 resources each. - -- The UE chooses a PUCCH-Resource from this list based on the 3-bit PUCCH resource indicator field in DCI as - -- speciied in 38.213, FFS_section. - -- Note that this list contains only a list of resource IDs. The actual resources are configured in PUCCH-Config. -*/ - uint8_t pucch_resource_id[MAX_NB_OF_PUCCH_RESOURCES_PER_SET]; /* pucch resources belonging to current set is a 32 bit map to address maxNrofPUCCH-ResourcesPerSet = 32 resources */ - - uint8_t first_resources_set_R_PUCCH; /* size of first resource set which can be higher than 8 */ -/* - -- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE - -- chooses the first of its PUCCH-ResourceSet which supports the number of bits that the UE wants to transmit. - -- The field is not present in the first set (Set0) since the maximum Size of Set0 is specified to be 3 bit. - -- The field is not present in the last configured set since the UE derives its maximum payload size as specified in 38.213. - -- This field can take integer values that are multiples of 4. Corresponds to L1 parameter 'N_2' or 'N_3' (see 38.213, section 9.2) -*/ - uint16_t maxPayloadMinus1; /* INTEGER (4..256) */ -} PUCCH_ResourceSet_t; - -typedef struct { -/* - -- Enabling inter-slot frequency hopping when PUCCH Format 1, 3 or 4 is repeated over multiple slots. - -- The field is not applicable for format 2. - */ - feature_status_t interslotFrequencyHopping; -/* - -- Enabling 2 DMRS symbols per hop of a PUCCH Format 3 or 4 if both hops are more than X symbols when FH is enabled (X=4). - -- Enabling 4 DMRS sybmols for a PUCCH Format 3 or 4 with more than 2X+1 symbols when FH is disabled (X=4). - -- Corresponds to L1 parameter 'PUCCH-F3-F4-additional-DMRS' (see 38.213, section 9.2.1) - -- The field is not applicable for format 1 and 2. -*/ - enable_feature_t additionalDMRS; -/* - -- Max coding rate to determine how to feedback UCI on PUCCH for format 2, 3 or 4 - -- Corresponds to L1 parameter 'PUCCH-F2-maximum-coderate', 'PUCCH-F3-maximum-coderate' and 'PUCCH-F4-maximum-coderate' - -- (see 38.213, section 9.2.5) - -- The field is not applicable for format 1. -*/ - PUCCH_MaxCodeRate_t maxCodeRate; -/* - -- Number of slots with the same PUCCH F1, F3 or F4. When the field is absent the UE applies the value n1. - -- Corresponds to L1 parameter 'PUCCH-F1-number-of-slots', 'PUCCH-F3-number-of-slots' and 'PUCCH-F4-number-of-slots' - -- (see 38.213, section 9.2.6) - -- The field is not applicable for format 2. -*/ - uint8_t nrofSlots; -/* - -- Enabling pi/2 BPSK for UCI symbols instead of QPSK for PUCCH. - -- Corresponds to L1 parameter 'PUCCH-PF3-PF4-pi/2PBSK' (see 38.213, section 9.2.5) - -- The field is not applicable for format 1 and 2. -*/ - feature_status_t pi2PBSK; -/* - -- Enabling simultaneous transmission of CSI and HARQ-ACK feedback with or without SR with PUCCH Format 2, 3 or 4 - -- Corresponds to L1 parameter 'PUCCH-F2-Simultaneous-HARQ-ACK-CSI', 'PUCCH-F3-Simultaneous-HARQ-ACK-CSI' and - -- 'PUCCH-F4-Simultaneous-HARQ-ACK-CSI' (see 38.213, section 9.2.5) - -- When the field is absent the UE applies the value OFF - -- The field is not applicable for format 1. -*/ - enable_feature_t simultaneousHARQ_ACK_CSI; -} PUCCH_FormatConfig_t; - -typedef struct { - PUCCH_Resource_t *PUCCH_Resource[MAX_NB_OF_PUCCH_RESOURCES]; - PUCCH_ResourceSet_t *PUCCH_ResourceSet[MAX_NB_OF_PUCCH_RESOURCE_SETS]; - PUCCH_FormatConfig_t *formatConfig[NUMBER_PUCCH_FORMAT_NR-1]; /* format 0 is not there */ - uint8_t dl_DataToUL_ACK[NB_DL_DATA_TO_UL_ACK]; /* table TS 38.213 Table 9.2.3-1: Mapping of PSDCH-to-HARQ_feedback timing indicator field values to numbers of slots */ - void *spatial_Relation_Info[MAX_NR_OF_SPATIAL_RELATION_INFOS]; -} PUCCH_Config_t; - - - /*********************************************************************** * * FUNCTIONALITY : Scheduling Request Configuration (SR) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index c55aeec49e..f829a2fcd5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2745,23 +2745,21 @@ uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) { } -void get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config, +int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config, nr_dci_format_t dci_format, uint8_t *pdsch_to_harq_feedback) { if (dci_format == NR_DL_DCI_FORMAT_1_0) { - for (int i=0; i<8; i++) - pdsch_to_harq_feedback[i] = i+1; + for (int i = 0; i < 8; i++) + pdsch_to_harq_feedback[i] = i + 1; + return 8; } else { - AssertFatal(pucch_Config!=NULL,"pucch_Config shouldn't be null here\n"); - if(pucch_Config->dl_DataToUL_ACK != NULL) { - for (int i=0; i<8; i++) { - pdsch_to_harq_feedback[i] = *pucch_Config->dl_DataToUL_ACK->list.array[i]; - } + AssertFatal(pucch_Config != NULL && pucch_Config->dl_DataToUL_ACK != NULL,"dl_DataToUL_ACK shouldn't be null here\n"); + for (int i = 0; i < pucch_Config->dl_DataToUL_ACK->list.count; i++) { + pdsch_to_harq_feedback[i] = *pucch_Config->dl_DataToUL_ACK->list.array[i]; } - else - AssertFatal(0==1,"There is no allocated dl_DataToUL_ACK for pdsch to harq feedback\n"); + return pucch_Config->dl_DataToUL_ACK->list.count; } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 2ff7196679..72340adbac 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1111,9 +1111,9 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, dci_format = UE->current_DL_BWP.dci_format; uint8_t pdsch_to_harq_feedback[8]; - get_pdsch_to_harq_feedback(pucch_Config, dci_format, pdsch_to_harq_feedback); + int fb_size = get_pdsch_to_harq_feedback(pucch_Config, dci_format, pdsch_to_harq_feedback); - for (int f=0; f<8; f++) { + for (int f = 0; f < fb_size; f++) { // can't schedule ACKNACK before minimum feedback time if(pdsch_to_harq_feedback[f] < minfbtime) continue; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 0d1e2fc3e0..0204643d2e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -217,9 +217,9 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, int r_pucch, int do_common); -void get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config, - nr_dci_format_t dci_format, - uint8_t *pdsch_to_harq_feedback); +int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config, + nr_dci_format_t dci_format, + uint8_t *pdsch_to_harq_feedback); void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, nr_scs_e scs_common, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 2729a78b33..5e9b5fd32a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -820,7 +820,7 @@ void fill_initial_SpCellConfig(int uid, scheduling_request_config(scc, pucch_Config); - set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME); + set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME, scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing); SpCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->initialDownlinkBWP)); NR_BWP_DownlinkDedicated_t *bwp_Dedicated = SpCellConfig->spCellConfigDedicated->initialDownlinkBWP; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 114b0f7610..e2fd0bd971 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -626,14 +626,18 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){ } } -void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time) { - +void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time, NR_SubcarrierSpacing_t subcarrierSpacing) +{ pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK)); + const int n_slots_frame = slotsperframe[subcarrierSpacing]; long *delay[8]; - for (int i=0;i<8;i++) { - delay[i] = calloc(1,sizeof(*delay[i])); - *delay[i] = i+min_feedback_time; - ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); + for (int i = 0; i < 8; i++) { + int curr_delay = i + min_feedback_time; + if (curr_delay <= n_slots_frame) { + delay[i] = calloc(1,sizeof(*delay[i])); + *delay[i] = curr_delay; + ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); + } } } @@ -1169,7 +1173,7 @@ void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, config_pucch_resset1(pucch_Config, uecap); set_pucch_power_config(pucch_Config, configuration->do_CSIRS); scheduling_request_config(scc, pucch_Config); - set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME); + set_dl_DataToUL_ACK(pucch_Config, configuration->minRXTXTIME, ubwp->bwp_Common->genericParameters.subcarrierSpacing); NR_PUSCH_Config_t *pusch_Config = NULL; if(servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList && diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index f9c0675551..aaed2d15de 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -54,7 +54,7 @@ void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsc void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay); void config_pucch_resset0(NR_PUCCH_Config_t *pucch_Config, int uid, int curr_bwp, NR_UE_NR_Capability_t *uecap); void config_pucch_resset1(NR_PUCCH_Config_t *pucch_Config, NR_UE_NR_Capability_t *uecap); -void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time); +void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time, NR_SubcarrierSpacing_t subcarrierSpacing); void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs); void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc, NR_PUCCH_Config_t *pucch_Config);