From 2ef2d8f7898595224fc395babea5ee3e64ff1618 Mon Sep 17 00:00:00 2001 From: pborla Date: Wed, 13 Nov 2024 16:32:38 +0530 Subject: [PATCH] TDD PERIODICITY slot config corrected as per SCF222v10.02 Table 3-26 Change-Id: I2e42d9e99250b9dda730587a726f87663ffc044c Signed-off-by: svaidhya --- src/5gnrmac/lwr_mac_fsm.c | 65 ++++++++++++++++---------- src/5gnrmac/lwr_mac_util.c | 91 +++++++++++++++++++++++++++++++++++++ src/5gnrmac/lwr_mac_utils.h | 3 ++ src/cm/common_def.h | 1 + 4 files changed, 137 insertions(+), 23 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index bddfb324c..36eb6fe67 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -2026,8 +2026,11 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg) #ifdef NR_TDD uint8_t slotIdx = 0; uint8_t symbolIdx =0; + uint8_t numSlotsInMaxPeriodicity = 0; /*number of TDD Slots in MAX_PERIODICITY(10ms) as per numerology*/ + uint8_t numSlotsInCurrPeriodicity = 0; /*number of TDD Slots in Configured_PERIODICITY(0.5ms to 10ms) as per numerology*/ + uint8_t cntSlotCfg = 0; /*number of Slot Cfg repeatition*/ #endif - uint8_t totalTlv=0; + uint16_t totalTlv=0; uint16_t index = 0; uint16_t *cellId =NULLP; uint16_t cellIdx =0; @@ -2058,8 +2061,18 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg) #ifndef NR_TDD totalTlv = 24; #else + numSlotsInMaxPeriodicity = MAX_TDD_PERIODICITY * pow(2, macCb.macCell[cellIdx]->numerology); + numSlotsInCurrPeriodicity = calcNumSlotsInCurrPeriodicity(macCfgParams.tddCfg.tddPeriod, macCb.macCell[cellIdx]->numerology); + + if(numSlotsInCurrPeriodicity == 0) + { + DU_LOG("\nERROR --> LWR_MAC: CONFIG_REQ: numSlotsInCurrPeriodicity is 0 thus exiting"); + return RFAILED; + } + DU_LOG("\nINFO --> LWR_MAC: CONFIG_REQ: numberofTDDSlot in MAX_PERIOICITY(10ms) = %d", numSlotsInMaxPeriodicity); + DU_LOG("\nINFO --> LWR_MAC: CONFIG_REQ: numberofTDDSlot in CURRENT PERIOICITY(enumVal = %d) = %d\n", macCfgParams.tddCfg.tddPeriod, numSlotsInCurrPeriodicity); //configReq->number_of_tlvs = 25 + 1 + MAX_TDD_PERIODICITY_SLOTS * MAX_SYMB_PER_SLOT; - totalTlv = 25 + 1+ MAX_TDD_PERIODICITY_SLOTS * MAX_SYMB_PER_SLOT; + totalTlv = 25 + 1+ numSlotsInMaxPeriodicity * MAX_SYMB_PER_SLOT; #endif /* totalCfgReqMsgLen = size of config req's msg header + size of tlv supporting + size of tlv supporting *sizeof(fapi_uint32_tlv_t) */ totalCfgReqMsgLen += sizeof(configReq->header) + sizeof( configReq->number_of_tlvs) + totalTlv*sizeof(fapi_uint32_tlv_t); @@ -2185,33 +2198,39 @@ uint8_t buildAndSendOAIConfigReqToL1(void *msg) /* fill TDD table */ fillTlvs(&configReq->tlvs[index++], FAPI_TDD_PERIOD_TAG, \ sizeof(uint8_t), macCfgParams.tddCfg.tddPeriod << TLV_ALIGN(8), &msgLen); - for(slotIdx =0 ;slotIdx < MAX_TDD_PERIODICITY_SLOTS; slotIdx++) + + cntSlotCfg = numSlotsInMaxPeriodicity/numSlotsInCurrPeriodicity; + while(cntSlotCfg) { - for(symbolIdx = 0; symbolIdx < MAX_SYMB_PER_SLOT; symbolIdx++) + for(slotIdx =0 ;slotIdx < numSlotsInCurrPeriodicity; slotIdx++) { - /*Fill Full-DL Slots as well as DL symbols ini 1st Flexi Slo*/ - if(slotIdx < macCfgParams.tddCfg.nrOfDlSlots || \ - (slotIdx == macCfgParams.tddCfg.nrOfDlSlots && symbolIdx < macCfgParams.tddCfg.nrOfDlSymbols)) + for(symbolIdx = 0; symbolIdx < MAX_SYMB_PER_SLOT; symbolIdx++) { - fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \ - sizeof(uint8_t), DL_SYMBOL << TLV_ALIGN(8), &msgLen); - } + /*Fill Full-DL Slots as well as DL symbols ini 1st Flexi Slo*/ + if(slotIdx < macCfgParams.tddCfg.nrOfDlSlots || \ + (slotIdx == macCfgParams.tddCfg.nrOfDlSlots && symbolIdx < macCfgParams.tddCfg.nrOfDlSymbols)) + { + fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \ + sizeof(uint8_t), DL_SYMBOL<< TLV_ALIGN(8), &msgLen); + } - /*Fill Full-FLEXI SLOT and as well as Flexi Symbols in 1 slot preceding FULL-UL slot*/ - else if(slotIdx < (MAX_TDD_PERIODICITY_SLOTS - macCfgParams.tddCfg.nrOfUlSlots -1) || \ - (slotIdx == (MAX_TDD_PERIODICITY_SLOTS - macCfgParams.tddCfg.nrOfUlSlots -1) && \ - symbolIdx < (MAX_SYMB_PER_SLOT - macCfgParams.tddCfg.nrOfUlSymbols))) - { - fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \ - sizeof(uint8_t), FLEXI_SYMBOL << TLV_ALIGN(8), &msgLen); - } - /*Fill Partial UL symbols and Full-UL slot*/ - else - { - fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \ - sizeof(uint8_t), UL_SYMBOL << TLV_ALIGN(8), &msgLen); + /*Fill Full-FLEXI SLOT and as well as Flexi Symbols in 1 slot preceding FULL-UL slot*/ + else if(slotIdx < (numSlotsInCurrPeriodicity - macCfgParams.tddCfg.nrOfUlSlots -1) || \ + (slotIdx == (numSlotsInCurrPeriodicity - macCfgParams.tddCfg.nrOfUlSlots -1) && \ + symbolIdx < (MAX_SYMB_PER_SLOT - macCfgParams.tddCfg.nrOfUlSymbols))) + { + fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \ + sizeof(uint8_t), FLEXI_SYMBOL<< TLV_ALIGN(8), &msgLen); + } + /*Fill Partial UL symbols and Full-UL slot*/ + else + { + fillTlvs(&configReq->tlvs[index++], FAPI_SLOT_CONFIG_TAG, \ + sizeof(uint8_t), UL_SYMBOL<< TLV_ALIGN(8), &msgLen); + } } } + cntSlotCfg--; } #endif diff --git a/src/5gnrmac/lwr_mac_util.c b/src/5gnrmac/lwr_mac_util.c index 0fd3358be..08ab8ac93 100644 --- a/src/5gnrmac/lwr_mac_util.c +++ b/src/5gnrmac/lwr_mac_util.c @@ -188,6 +188,97 @@ void convertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMa } } +#ifdef NR_TDD +/** + *@brief Returns Num of Slots in Current TDD periodicity + * + * @details + * + * Function : calcNumSlotsInCurrPeriodicity + * + * This API returns numOfSlots In CurrPeriodicity as per numerology + * + * @param[in] DlUlTxPeriodicity, numerology + * @return numSlotsInCurrPeriodicity + * **/ + +uint8_t calcNumSlotsInCurrPeriodicity(DlUlTxPeriodicity tddPeriod, uint8_t numerology) +{ + float periodicityInMsec = 0; + + switch(tddPeriod) + { + case TX_PRDCTY_MS_0P5: + { + if(numerology <= 0) + { + DU_LOG("\nERROR --> LWR_MAC_UTILS: numerology:%d cant be configured with 0.5ms periodicity",numerology); + return 0; + } + periodicityInMsec = 0.5; + break; + } + case TX_PRDCTY_MS_0P625: + { + if(numerology <= 2) + { + DU_LOG("\nERROR --> LWR_MAC_UTILS: numerology:%d cant be configured with 0.625ms periodicity",numerology); + return 0; + } + periodicityInMsec = 0.625; + break; + } + case TX_PRDCTY_MS_1: + { + periodicityInMsec = 1; + break; + } + case TX_PRDCTY_MS_1P25: + { + if(numerology <= 1) + { + DU_LOG("\nERROR --> LWR_MAC_UTILS: numerology:%d cant be configured with 1.25ms periodicity",numerology); + return 0; + } + periodicityInMsec = 1.25; + break; + } + case TX_PRDCTY_MS_2: + { + periodicityInMsec = 2; + break; + } + case TX_PRDCTY_MS_2P5: + { + if(numerology <= 0) + { + DU_LOG("\nERROR --> LWR_MAC_UTILS: numerology:%d cant be configured with 2.5ms periodicity",numerology); + return 0; + } + periodicityInMsec = 2.5; + break; + } + case TX_PRDCTY_MS_5: + { + periodicityInMsec = 5; + break; + } + case TX_PRDCTY_MS_10: + { + periodicityInMsec = 10; + break; + } + default: + { + DU_LOG("\nERROR --> LWR_MAC_UTILS : Invalid DlUlTxPeriodicity:%d", tddPeriod); + return 0; + } + } + + return (periodicityInMsec * pow(2,numerology)); +} +#endif + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrmac/lwr_mac_utils.h b/src/5gnrmac/lwr_mac_utils.h index 50f9a4538..d583a1b4a 100644 --- a/src/5gnrmac/lwr_mac_utils.h +++ b/src/5gnrmac/lwr_mac_utils.h @@ -61,6 +61,9 @@ } void convertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap); +#ifdef NR_TDD +uint8_t calcNumSlotsInCurrPeriodicity(DlUlTxPeriodicity tddPeriod, uint8_t numerology); +#endif /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 3001fccc6..6846dec02 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -160,6 +160,7 @@ * TODO : To support 160, FAPI_MAX_NUM_TLVS_CONFIG in fapi_interface.h * of Intel L1 must be incremented to a higher number */ #define MAX_TDD_PERIODICITY_SLOTS 10 +#define MAX_TDD_PERIODICITY 10 #endif #define GET_UE_ID( _crnti,_ueId) \