Merge "[Epic-ID: ODUHIGH-517][Task-ID: ODUHIGH-541] Shifting the Conversion of FreqDo...
authorSangeeta Vaidhyanathan <svaidhya@radisys.com>
Tue, 5 Dec 2023 09:17:16 +0000 (09:17 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 5 Dec 2023 09:17:16 +0000 (09:17 +0000)
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_util.c
src/5gnrmac/lwr_mac_utils.h
src/5gnrsch/sch.c
src/5gnrsch/sch_ue_mgr.c
src/5gnrsch/sch_utils.c
src/5gnrsch/sch_utils.h

index 440f30f..b05d963 100644 (file)
@@ -35,6 +35,7 @@
 #endif
 #include "lwr_mac_fsm.h"
 #include "lwr_mac_phy.h"
+#include "lwr_mac_utils.h"
 #include "mac_utils.h"
 
 #define MIB_SFN_BITMASK 0xFC
@@ -3125,7 +3126,8 @@ void fillPagePdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req
 
       dlTtiReqPdu->pdu.pdcch_pdu.startSymbolIndex    = pageAlloc->pageDlDci.ssStartSymbolIndex;
       dlTtiReqPdu->pdu.pdcch_pdu.durationSymbols     = pageAlloc->pageDlDci.durationSymbols;
-      memcpy(dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource, pageAlloc->pageDlDci.freqDomainResource, 6*sizeof(uint8_t));
+      convertFreqDomRsrcMapToIAPIFormat(pageAlloc->pageDlDci.freqDomainResource, \
+                                         dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource);
       dlTtiReqPdu->pdu.pdcch_pdu.cceRegMappingType   = pageAlloc->pageDlDci.cceRegMappingType;
       dlTtiReqPdu->pdu.pdcch_pdu.regBundleSize       = pageAlloc->pageDlDci.cceReg.interleaved.regBundleSize;
       dlTtiReqPdu->pdu.pdcch_pdu.interleaverSize     = pageAlloc->pageDlDci.cceReg.interleaved.interleaverSize;
@@ -3205,7 +3207,8 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_
 
       dlTtiReqPdu->pdu.pdcch_pdu.startSymbolIndex = pdcchInfo->coresetCfg.startSymbolIndex;
       dlTtiReqPdu->pdu.pdcch_pdu.durationSymbols = pdcchInfo->coresetCfg.durationSymbols;
-      memcpy(dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource, pdcchInfo->coresetCfg.freqDomainResource, 6);
+      convertFreqDomRsrcMapToIAPIFormat(pdcchInfo->coresetCfg.freqDomainResource,\
+                                         dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource);
       dlTtiReqPdu->pdu.pdcch_pdu.cceRegMappingType = pdcchInfo->coresetCfg.cceRegMappingType;
       dlTtiReqPdu->pdu.pdcch_pdu.regBundleSize = pdcchInfo->coresetCfg.regBundleSize;
       dlTtiReqPdu->pdu.pdcch_pdu.interleaverSize = pdcchInfo->coresetCfg.interleaverSize;
@@ -4743,7 +4746,8 @@ uint8_t fillUlDciPdcchPdu(fapi_dci_pdu_t *ulDciReqPdu, fapi_vendor_dci_pdu_t *ve
       ulDciReqPdu->pdcchPduConfig.cyclicPrefix      = dlInfo->ulGrant->bwpCfg.cyclicPrefix; 
       ulDciReqPdu->pdcchPduConfig.startSymbolIndex  = dlInfo->ulGrant->coresetCfg.startSymbolIndex;
       ulDciReqPdu->pdcchPduConfig.durationSymbols   = dlInfo->ulGrant->coresetCfg.durationSymbols;
-      memcpy(ulDciReqPdu->pdcchPduConfig.freqDomainResource, dlInfo->ulGrant->coresetCfg.freqDomainResource, 6);
+      convertFreqDomRsrcMapToIAPIFormat(dlInfo->ulGrant->coresetCfg.freqDomainResource, \
+                                           ulDciReqPdu->pdcchPduConfig.freqDomainResource);
       ulDciReqPdu->pdcchPduConfig.cceRegMappingType = dlInfo->ulGrant->coresetCfg.cceRegMappingType;
       ulDciReqPdu->pdcchPduConfig.regBundleSize     = dlInfo->ulGrant->coresetCfg.regBundleSize;
       ulDciReqPdu->pdcchPduConfig.interleaverSize   = dlInfo->ulGrant->coresetCfg.interleaverSize;
index 0a92691..0fd3358 100644 (file)
@@ -135,7 +135,58 @@ void fillDlDciPayload(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos,\
    }
 }
 
+/*
+ * As per FAPI spec, 
+ * Frequency domain resources is a bitmap defining non-overlapping groups of 6 PRBs in ascending order.
+ * [TS38.213 10.1]. Bitmap of uint8 array. 45 bits.
+ *
+ * As per IAPI,
+ * CORESET-freqdom.frequencyDomainResources : The bits of the bitmap have a one-to-one mapping with
+ * non-overlapping groups of 6 RBs. The most significant bit of the first word corresponds to
+ * the most significant bit defined in 38.331.
+ *
+ * FAPI and IAPI both are 45 bits. Mapped from bit 0 LS Byte for the FAPI and
+ * bit 0 LS U32 entry for IAPI.
+ * FAPI is to be filled in following format such that Intel L1 is able to decode it :
+ *
+ *            FAPI                                 IAPI 
+ * FreqDomainResource[0] bits 7-0     ->    nFreqDomain[0] bits 7-0
+ * FreqDomainResource[1] bits 7-0     ->    nFreqDomain[0] bits 15-8
+ * FreqDomainResource[2] bits 7-0     ->    nFreqDomain[0] bits 23-16
+ * FreqDomainResource[3] bits 7-0     ->    nFreqDomain[0] bits 31-24
+ * FreqDomainResource[4] bits 7-0     ->    nFreqDomain[1] bits 7-0
+ * FreqDomainResource[5] bits 7-0     ->    nFreqDomain[1] bits 15-8
+ *
+ * where for the last entry bits 7,6 and 5 are don't care in the FAPI and bits
+ * 31-13 are don't care in the IAPI.
+ */
+void convertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap)
+{
+   int8_t  idx;
+   uint8_t  numBitsToShift = 0;
+   uint64_t freqDomainResources = 0;
+
+   /* Bit operation to create a 64-bit integer that has
+    * 48 LSBs [Bit 47 to Bit 0] mapped to sourceBitMap[0] to sourceBitMap[5]
+    */
+   for(idx = FREQ_DOM_RSRC_SIZE-1; idx >=0; idx--)
+   {
+      freqDomainResources |= ((uint64_t)sourceBitMap[idx] << numBitsToShift);
+      numBitsToShift += 8;
+   }
+
+   /* Right shift 3 bits because bits[2-0] are unused in sourceBitMap[5] */
+   freqDomainResources = freqDomainResources >> 3;
 
+   /* Filling destBitMap such that LSB bit 0 of freqDomainResources maps to LSB 
+    * of first word of destBitMap */
+   numBitsToShift = 0;
+   for(idx=0; idx<FREQ_DOM_RSRC_SIZE; idx++)
+   {
+      destBitMap[idx] = freqDomainResources >> numBitsToShift;
+      numBitsToShift += 8;
+   }
+}
 
 /**********************************************************************
   End of file
index 2af0921..50f9a45 100644 (file)
@@ -60,6 +60,7 @@
    _pst.intfVer = 0;                                        \
 }
  
+void convertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap);
 /**********************************************************************
          End of file
 **********************************************************************/
index 5e09bb3..1043e6d 100644 (file)
@@ -595,7 +595,7 @@ uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots,SchPdcchC
    uint8_t mValue = 0;
    uint8_t firstSymbol = 0; /* need to calculate using formula mentioned in 38.213 */
    uint8_t slotIndex = 0;
-   uint8_t FreqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
+   uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
    uint16_t tbSize = 0;
    uint8_t ssbIdx = 0;
    PdcchCfg *pdcch;
@@ -655,8 +655,8 @@ uint8_t fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots,SchPdcchC
    pdcch->coresetCfg.durationSymbols = numSymbols;
    
    /* Fill Bitmap for PRBs in coreset */
-   fillCoresetFeqDomAllocMap(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
-   covertFreqDomRsrcMapToIAPIFormat(FreqDomainResource, pdcch->coresetCfg.freqDomainResource);
+   fillCoresetFeqDomAllocMap(((offsetPointA-offset)/6), (numRbs/6), freqDomainResource);
+   memcpy(pdcch->coresetCfg.freqDomainResource, freqDomainResource, FREQ_DOM_RSRC_SIZE);
 
    pdcch->coresetCfg.cceRegMappingType = 1; /* coreset0 is always interleaved */
    pdcch->coresetCfg.regBundleSize = 6;    /* spec-38.211 sec 7.3.2.2 */
@@ -782,9 +782,8 @@ uint8_t SchProcCellCfgReq(Pst *pst, SchCellCfg *schCellCfg)
    offset = coresetIdxTable[coreset0Idx][3];
    fillCoresetFeqDomAllocMap(((cellCb->cellCfg.dlCfgCommon.schFreqInfoDlSib.offsetToPointA - offset)/6), \
                                   (numRbs/6), freqDomainResource);
-   covertFreqDomRsrcMapToIAPIFormat(freqDomainResource, \
-      cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc);
-
+   memcpy(cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdcchCommon.commonSearchSpace.freqDomainRsrc,\
+               freqDomainResource,FREQ_DOM_RSRC_SIZE);
    /* Fill K0 - K1 table for common cfg*/ 
    BuildK0K1Table(cellCb, &cellCb->k0K1InfoTbl, true, cellCb->cellCfg.dlCfgCommon.schInitialDlBwp.pdschCommon,
                    pdschCfg, DEFAULT_UL_ACK_LIST_COUNT, defaultUlAckTbl);
index 67c05a8..23d3638 100644 (file)
@@ -287,7 +287,6 @@ void fillSpCellInSchCb(SchSpCellRecfg *destSpCellCfg, SchSpCellCfg *srcSpCellCfg
 uint8_t fillSchUeCbFrmCfgReq(Inst inst, SchUeCb *ueCb, SchUeCfgReq *ueCfg)
 {
    uint8_t   lcIdx, ueLcIdx, idx;
-   uint8_t   freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
    SchPdschCfgCmn pdschCfg;
    SchPucchDlDataToUlAck *dlDataToUlAck;
    uint8_t retDL = ROK, retUL = ROK;
@@ -362,11 +361,6 @@ uint8_t fillSchUeCbFrmCfgReq(Inst inst, SchUeCb *ueCb, SchUeCfgReq *ueCfg)
       }
       fillSpCellInSchCb(&ueCb->ueCfg.spCellCfg, &ueCfg->spCellCfg);
 
-      covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\
-            freqDomainResource);
-      memset(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE);
-      memcpy(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE);
-
       ueCb->ueCfg.spCellCfgPres = true;
       dlDataToUlAck = ueCfg->spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck;
       if(ueCb->cellCb)
@@ -452,7 +446,6 @@ uint8_t fillSchUeCbFrmCfgReq(Inst inst, SchUeCb *ueCb, SchUeCfgReq *ueCfg)
 uint8_t fillSchUeCbFrmRecfgReq(Inst inst, SchUeCb *ueCb, SchUeRecfgReq *ueRecfg)
 {
    uint8_t   lcIdx, ueLcIdx, idx;
-   uint8_t   freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
    SchPdschCfgCmn pdschCfg;
    SchPucchDlDataToUlAck *dlDataToUlAck;
    uint8_t retDL = ROK, retUL = ROK;
@@ -540,11 +533,6 @@ uint8_t fillSchUeCbFrmRecfgReq(Inst inst, SchUeCb *ueCb, SchUeRecfgReq *ueRecfg)
       }
       memcpy(&ueCb->ueCfg.spCellCfg , &ueRecfg->spCellRecfg, sizeof(SchSpCellRecfg));
 
-      covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\
-            freqDomainResource);
-      memset(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE);
-      memcpy(ueCb->ueCfg.spCellCfg.servCellRecfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE);
-
       ueCb->ueCfg.spCellCfgPres = true;
       dlDataToUlAck = ueRecfg->spCellRecfg.servCellRecfg.initUlBwp.pucchCfg.dlDataToUlAck;
       if(ueCb->cellCb)
index 7e849ab..e4775eb 100644 (file)
@@ -1786,58 +1786,6 @@ uint8_t calculateSlotPatternLength(uint8_t scs, uint8_t periodicity)
 }
 #endif
 
-/*
- * As per FAPI spec, 
- * Frequency domain resources is a bitmap defining non-overlapping groups of 6 PRBs in ascending order.
- * [TS38.213 10.1]. Bitmap of uint8 array. 45 bits.
- *
- * As per IAPI,
- * CORESET-freqdom.frequencyDomainResources : The bits of the bitmap have a one-to-one mapping with
- * non-overlapping groups of 6 RBs. The most significant bit of the first word corresponds to
- * the most significant bit defined in 38.331.
- *
- * FAPI and IAPI both are 45 bits. Mapped from bit 0 LS Byte for the FAPI and
- * bit 0 LS U32 entry for IAPI.
- * FAPI is to be filled in following format such that Intel L1 is able to decode it :
- *
- *            FAPI                                 IAPI 
- * FreqDomainResource[0] bits 7-0     ->    nFreqDomain[0] bits 7-0
- * FreqDomainResource[1] bits 7-0     ->    nFreqDomain[0] bits 15-8
- * FreqDomainResource[2] bits 7-0     ->    nFreqDomain[0] bits 23-16
- * FreqDomainResource[3] bits 7-0     ->    nFreqDomain[0] bits 31-24
- * FreqDomainResource[4] bits 7-0     ->    nFreqDomain[1] bits 7-0
- * FreqDomainResource[5] bits 7-0     ->    nFreqDomain[1] bits 15-8
- *
- * where for the last entry bits 7,6 and 5 are don't care in the FAPI and bits
- * 31-13 are don't care in the IAPI.
- */
-void covertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap)
-{
-   int8_t  idx;
-   uint8_t  numBitsToShift = 0;
-   uint64_t freqDomainResources = 0;
-
-   /* Bit operation to create a 64-bit integer that has
-    * 48 LSBs [Bit 47 to Bit 0] mapped to sourceBitMap[0] to sourceBitMap[5]
-    */
-   for(idx = FREQ_DOM_RSRC_SIZE-1; idx >=0; idx--)
-   {
-      freqDomainResources |= ((uint64_t)sourceBitMap[idx] << numBitsToShift);
-      numBitsToShift += 8;
-   }
-
-   /* Right shift 3 bits because bits[2-0] are unused in sourceBitMap[5] */
-   freqDomainResources = freqDomainResources >> 3;
-
-   /* Filling destBitMap such that LSB bit 0 of freqDomainResources maps to LSB 
-    * of first word of destBitMap */
-   numBitsToShift = 0;
-   for(idx=0; idx<FREQ_DOM_RSRC_SIZE; idx++)
-   {
-      destBitMap[idx] = freqDomainResources >> numBitsToShift;
-      numBitsToShift += 8;
-   }
-}
 /**********************************************************************
          End of file
 **********************************************************************/
index 094a1b7..433c33e 100644 (file)
@@ -127,7 +127,6 @@ CmLList* isPrbAvailable(CmLListCp *freePrbBlockList, uint16_t startPrb, uint16_t
 void removeAllocatedPrbFromFreePrbList(CmLListCp *freePrbBlockList, CmLList *node, \
    uint16_t startPrb, uint16_t numPrb);
 uint8_t findDmrsStartSymbol(uint16_t dlDmrsSymbBitMap);
-void covertFreqDomRsrcMapToIAPIFormat(uint8_t *sourceBitMap, uint8_t *destBitMap);
 
 uint8_t updateLcListReqPRB(CmLListCp *lcLL, uint8_t lcId, uint32_t payloadSize);
 uint32_t calculateEstimateTBSize(uint32_t reqBO, uint16_t mcsIdx,uint8_t numSymbols,\