From: lal.harshita Date: Thu, 5 Aug 2021 05:06:02 +0000 (+0530) Subject: Implementation of function for filling k2 table [Issue-ID: ODUHIGH-341] X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F6578%2F1;p=o-du%2Fl2.git Implementation of function for filling k2 table [Issue-ID: ODUHIGH-341] Change-Id: I1c83561ff97ee350e242777b86943161a71f4838 Signed-off-by: lal.harshita (cherry picked from commit ace81c4951bcf19172a207377f57da42dc112515) --- diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index d2e5839e0..1191492cf 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -876,6 +876,8 @@ uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg) BuildK0K1Table(cellCb, &cellCb->cellCfg.schInitialDlBwp.k0K1InfoTbl, true, cellCb->cellCfg.schInitialDlBwp.pdschCommon, pdschCfg, DEFAULT_UL_ACK_LIST_COUNT, defaultUlAckTbl); + BuildK2InfoTable(cellCb, cellCb->cellCfg.schInitialUlBwp.puschCommon.timeDomRsrcAllocList,\ + cellCb->cellCfg.schInitialUlBwp.puschCommon.numTimeDomRsrcAlloc, &cellCb->cellCfg.schInitialUlBwp.k2InfoTbl); /* Initializing global variables */ cellCb->actvUeBitMap = 0; cellCb->boIndBitMap = 0; diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 75ca894b3..27f4aa9e1 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -290,6 +290,8 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of void BuildK0K1Table(SchCellCb *cell, SchK0K1TimingInfoTbl *k0K1InfoTbl, bool pdschCfgCmnPres, SchPdschCfgCmn pdschCmnCfg,\ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl); void schProcessRaReq(SlotTimingInfo currTime, SchCellCb *cellCb); +void BuildK2InfoTable(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], uint16_t puschSymTblSize,\ +SchK2TimingInfoTbl *k2InfoTbl); /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index f3c52fc53..fea12b3f6 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -1117,6 +1117,158 @@ SchPdschConfig pdschDedCfg, uint8_t ulAckListCount, uint8_t *UlAckTbl) #endif } } + +/******************************************************************* +* +* @brief Fills K2 information table for FDD +* +* @details +* +* Function : BuildK2InfoTableForFdd +* +* Functionality: +* Fills K2 information table for FDD +* +* @params[in] SchCellCb *cell,SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], +* uint16_t puschSymTblSize,SchK2TimingInfoTbl *k2InfoTbl +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +void BuildK2InfoTableForFdd(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], uint16_t puschSymTblSize,\ +SchK2TimingInfoTbl *k2InfoTbl) +{ + uint16_t slotIdx=0, k2Index=0, k2TmpVal=0; + + /* Initialization the structure and storing the total slot values. */ + memset(k2InfoTbl, 0, sizeof(SchK2TimingInfoTbl)); + k2InfoTbl->tblSize = cell->numSlots; + + /* Checking all possible indexes for K2. */ + for(slotIdx = 0; slotIdx < cell->numSlots; slotIdx++) + { + /* Storing K2 values. */ + for(k2Index = 0; ((k2Index < puschSymTblSize) && (k2Index < MAX_NUM_K2_IDX)); k2Index++) + { + k2TmpVal= k2InfoTbl->k2TimingInfo[slotIdx].numK2; + k2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[k2TmpVal] = k2Index; + k2InfoTbl->k2TimingInfo[slotIdx].numK2++; + } + } +} + +/******************************************************************* + * + * @brief Fills K2 information table + * + * @details + * + * Function : BuildK2InfoTable + * + * Functionality: + * Fills K2 information table + * + * @params[in] SchCellCb *cell,SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], + * uint16_t puschSymTblSize, SchK2TimingInfoTbl *k2InfoTbl + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void BuildK2InfoTable(SchCellCb *cell, SchPuschTimeDomRsrcAlloc timeDomRsrcAllocList[], uint16_t puschSymTblSize,\ +SchK2TimingInfoTbl *k2InfoTbl) +{ + +#ifdef NR_TDD + bool dlSymbolPresent = false; + uint8_t slotIdx=0, k2Index=0, k2TmpVal=0, numK2 =0, currentSymbol =0; + uint8_t startSymbol =0, endSymbol =0, checkSymbol=0, totalCfgSlot=0, slotCfg=0; + SlotConfig currentSlot; +#endif + + if(cell->cellCfg.dupMode == DUPLEX_MODE_FDD) + { + BuildK2InfoTableForFdd(cell, timeDomRsrcAllocList, puschSymTblSize, k2InfoTbl); + } + else + { +#ifdef NR_TDD + + /* Initialization the structure and storing the total slot values. */ + memset(k2InfoTbl, 0, sizeof(SchK2TimingInfoTbl)); + k2InfoTbl->tblSize = cell->numSlots; + totalCfgSlot = calculateSlotPatternLength(cell->cellCfg.ssbSchCfg.scsCommon, cell->cellCfg.tddCfg.tddPeriod); + + /* Checking all possible indexes for K2. */ + for(slotIdx = 0; slotIdx < k2InfoTbl->tblSize; slotIdx++) + { + currentSlot = schGetSlotSymbFrmt(slotIdx % totalCfgSlot, cell->slotFrmtBitMap); + + /* If current slot is UL then skip because PDCCH is sent only in DL slots */ + if(currentSlot != UL_SLOT) + { + for(k2Index = 0; ((k2Index < puschSymTblSize) && (k2Index < MAX_NUM_K2_IDX)); k2Index++) + { + /* Storing k2, startSymbol, endSymbol information for further processing. + * If k2 is absent then fill the default values given in spec 38.331 + * PUSCH-TimeDomainResourceAllocationList field descriptions */ + k2TmpVal = timeDomRsrcAllocList[k2Index].k2; + if(!k2TmpVal) + { + switch(cell->cellCfg.ssbSchCfg.scsCommon) + { + case SCS_15KHZ: + k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS15; + break; + case SCS_30KHZ: + k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS30; + break; + case SCS_60KHZ: + k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS60; + break; + case SCS_120KHZ: + k2TmpVal = DEFAULT_K2_VALUE_FOR_SCS120; + break; + } + } + + /* Current slot + k2 should be either UL or FLEXI slot. + * If slot is FLEXI then check all the symbols of that slot, + * it should not contain any DL or FLEXI slot */ + k2TmpVal = (slotIdx + k2TmpVal) % totalCfgSlot; + slotCfg = schGetSlotSymbFrmt(k2TmpVal, cell->slotFrmtBitMap); + if(slotCfg == DL_SLOT) + { + continue; + } + if(slotCfg == FLEXI_SLOT) + { + startSymbol = timeDomRsrcAllocList[k2Index].startSymbol; + endSymbol = startSymbol+ timeDomRsrcAllocList[k2Index].symbolLength; + dlSymbolPresent = false; + for(checkSymbol= startSymbol; checkSymbolcellCfg.tddCfg.slotCfg[k2TmpVal][checkSymbol]; + if(currentSymbol == DL_SLOT || currentSymbol == FLEXI_SLOT) + { + dlSymbolPresent = true; + break; + } + } + } + /* Store all the values if all condition satisfies. */ + if(dlSymbolPresent != true || slotCfg == UL_SLOT) + { + numK2 = k2InfoTbl->k2TimingInfo[slotIdx].numK2; + k2InfoTbl->k2TimingInfo[slotIdx].k2Indexes[numK2] = k2Index; + k2InfoTbl->k2TimingInfo[slotIdx].numK2++; + } + } + } + } +#endif + } +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index 8b8428156..62a1abe4f 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -235,11 +235,17 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) memcpy(&ueCb->ueCfg.spCellCfg , &ueCfg->spCellCfg, sizeof(SchSpCellCfg)); ueCb->ueCfg.spCellCfgPres = true; dlDataToUlAck = ueCfg->spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck; - if(dlDataToUlAck) + if(ueCb->cellCb) { - BuildK0K1Table(ueCb->cellCb, &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1InfoTbl, false, pdschCfg,\ - ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, dlDataToUlAck->dlDataToUlAckListCount,\ - dlDataToUlAck->dlDataToUlAckList); + if(dlDataToUlAck) + { + BuildK0K1Table(ueCb->cellCb, &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.k0K1InfoTbl, false, pdschCfg,\ + ueCfg->spCellCfg.servCellCfg.initDlBwp.pdschCfg, dlDataToUlAck->dlDataToUlAckListCount,\ + dlDataToUlAck->dlDataToUlAckList); + BuildK2InfoTable(ueCb->cellCb, ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.timeDomRsrcAllocList,\ + ueCfg->spCellCfg.servCellCfg.initUlBwp.puschCfg.numTimeDomRsrcAlloc,\ + &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2InfoTbl); + } } } diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 31dd8a73b..fdfa2905f 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -99,7 +99,13 @@ #define MAX_NUM_K0_IDX 16 /* Max number of pdsch time domain downlink allocation */ #define MAX_NUM_K1_IDX 8 /* As per spec 38.213 section 9.2.3 Max number of PDSCH-to-HARQ resource indication */ #define MIN_NUM_K1_IDX 4 /* Min K1 values */ -#define DEFAULT_K0_VALUE 0 /*As per 38.331, PDSCH-TimeDomainResourceAllocation field descriptions*/ +#define MAX_NUM_K2_IDX 16 /* PUSCH time domain UL resource allocation list */ +#define DEFAULT_K0_VALUE 0 /* As per 38.331, PDSCH-TimeDomainResourceAllocation field descriptions */ +/* As per 38.331, PUSCH-TimeDomainResourceAllocationList field descriptions */ +#define DEFAULT_K2_VALUE_FOR_SCS15 1 +#define DEFAULT_K2_VALUE_FOR_SCS30 1 +#define DEFAULT_K2_VALUE_FOR_SCS60 2 +#define DEFAULT_K2_VALUE_FOR_SCS120 3 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr) \ { \ @@ -682,11 +688,24 @@ typedef struct schBwpDlCfg SchK0K1TimingInfoTbl k0K1InfoTbl; }SchBwpDlCfg; +typedef struct schK2TimingInfo +{ + uint8_t numK2; + uint8_t k2Indexes[MAX_NUM_K2_IDX]; +}SchK2TimingInfo; + +typedef struct schK2TimingInfoTbl +{ + uint16_t tblSize; + SchK2TimingInfo k2TimingInfo[MAX_NUM_CONFIG_SLOTS]; +}SchK2TimingInfoTbl; + typedef struct schBwpUlCfg { SchBwpParams bwp; SchPucchCfgCmn pucchCommon; SchPuschCfgCmn puschCommon; + SchK2TimingInfoTbl k2InfoTbl; }SchBwpUlCfg; typedef struct schCellCfg @@ -1352,6 +1371,7 @@ typedef struct schInitialUlBwp SchPucchCfg pucchCfg; bool puschCfgPres; SchPuschCfg puschCfg; + SchK2TimingInfoTbl k2InfoTbl; }SchInitialUlBwp; /* Uplink BWP information */