X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch.c;h=3e485c4a542b4764b1da43464058a12c60b059c8;hb=2bd852089c3226f721d83b30f816b90f803237f6;hp=fe18fec2efe14a32717edaa854c2bbda69e2f811;hpb=38ebc92a011353b8b2d9401efa4173c79114fa1c;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index fe18fec2e..3e485c4a5 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -72,6 +72,7 @@ SchSliceReCfgRspFunc SchSliceReCfgRspOpts[] = MacProcSchSliceReCfgRsp, /* TC */ packSchSliceReCfgRsp /* LWLC */ }; + /** * @brief Task Initiation function. * @@ -334,22 +335,12 @@ uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd) * ****************************************************************/ uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd) { + Inst inst = pst->dstInst-SCH_INST_START; #ifdef CALL_FLOW_DEBUG_LOG DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_CRC_IND_TO_SCH\n"); #endif - switch(crcInd->crcInd[0]) - { - case CRC_FAILED: - DU_LOG("\nDEBUG --> SCH : Received CRC indication. CRC Status [FAILURE]"); - break; - case CRC_PASSED: - DU_LOG("\nDEBUG --> SCH : Received CRC indication. CRC Status [PASS]"); - break; - default: - DU_LOG("\nDEBUG --> SCH : Invalid CRC state %d", crcInd->crcInd[0]); - return RFAILED; - } + schProcessCrcInd(crcInd, inst); return ROK; } @@ -908,6 +899,11 @@ uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg) cellCb->actvUeBitMap = 0; cellCb->boIndBitMap = 0; + cellCb->cellCfg.schHqCfg.maxDlDataHqTx = SCH_MAX_NUM_DL_HQ_TX; + cellCb->cellCfg.schHqCfg.maxMsg4HqTx = SCH_MAX_NUM_MSG4_TX; + cellCb->cellCfg.schHqCfg.maxUlDataHqTx = SCH_MAX_NUM_UL_HQ_TX; + cellCb->cellCfg.schRachCfg.maxMsg3Tx = SCH_MAX_NUM_MSG3_TX; + /* Fill and send Cell config confirm */ memset(&rspPst, 0, sizeof(Pst)); FILL_PST_SCH_TO_MAC(rspPst, pst->dstInst); @@ -944,13 +940,11 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) bool isLcIdValid = false; SchUeCb *ueCb = NULLP; SchCellCb *cell = NULLP; - Inst inst = pst->dstInst-SCH_INST_START; - CmLListCp *lcLL = NULLP; + Inst inst = pst->dstInst-SCH_INST_START; #ifdef CALL_FLOW_DEBUG_LOG DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_DL_RLC_BO_INFO_TO_SCH\n"); -#endif - +#endif DU_LOG("\nDEBUG --> SCH : Received RLC BO Status indication LCId [%d] BO [%d]", dlBoInfo->lcId, dlBoInfo->dataVolume); cell = schCb[inst].cells[inst]; @@ -981,28 +975,20 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) *Thus clearing out the LC from the Lc priority list*/ if(dlBoInfo->dataVolume == 0) { - /*Check the LC is Dedicated or default and accordingly LCList will - * be used*/ - if(ueCb->dlInfo.dlLcCtxt[lcId].isDedicated) - { - lcLL = &(ueCb->dlLcPrbEst.dedLcInfo->dedLcList); - } - else - { - lcLL = &(ueCb->dlLcPrbEst.defLcList); - } - handleLcLList(lcLL, lcId, DELETE); + /* TODO : Check the LC is Dedicated or default and accordingly LCList + * will be used*/ return ROK; } if(lcId == SRB0_LCID) { cell->raCb[ueId -1].msg4recvd = true; - cell->raCb[ueId -1].dlMsgPduLen = dlBoInfo->dataVolume; - + cell->raCb[ueId -1].dlMsgPduLen = dlBoInfo->dataVolume; } else { + /* TODO : These part of changes will be corrected during DL scheduling as + * per K0 - K1 -K2 */ SET_ONE_BIT(ueId, cell->boIndBitMap); if(ueCb->dlInfo.dlLcCtxt[lcId].lcId == lcId) { @@ -1014,7 +1000,6 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo) return RFAILED; } } - /* Adding UE Id to list of pending UEs to be scheduled */ addUeToBeScheduled(cell, ueId); return ROK; @@ -1131,14 +1116,55 @@ uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd) } if(uciInd->numSrBits) { - ueCb->srRcvd = true; - + ueCb->srRcvd = true; /* Adding UE Id to list of pending UEs to be scheduled */ addUeToBeScheduled(cellCb, ueCb->ueId); } return ROK; } +/******************************************************************* + * + * @brief Processes HARQ UCI indication from MAC + * + * @details + * + * Function : MacSchHarqUciInd + * + * Functionality: + * Processes HARQ UCI indication from MAC + * + * @params[in] Post structure + * UCI Indication + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t MacSchHarqUciInd(Pst *pst, HarqUciIndInfo *uciInd) +{ + Inst inst = pst->dstInst-SCH_INST_START; + SchUeCb *ueCb; + SchCellCb *cellCb = schCb[inst].cells[inst]; + +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_UCI_IND_TO_SCH\n"); +#endif + + DU_LOG("\nDEBUG --> SCH : Received HARQ"); + + ueCb = schGetUeCb(cellCb, uciInd->crnti); + + if(ueCb->state == SCH_UE_STATE_INACTIVE) + { + DU_LOG("\nERROR --> SCH : Crnti %d is inactive", uciInd->crnti); + return ROK; + } + + schUpdateHarqFdbk(ueCb, uciInd->numHarq, uciInd->harqPayload, &uciInd->slotInd); + + return ROK; +} + /******************************************************************* * * @brief Allocates requested PRBs for DL @@ -2101,6 +2127,156 @@ void schCfgPdcchMonOccOfPO(SchCellCb *cell) } } +/**************************************************************************** + * + * @brief Storing the paging information in SCH database + * + * @details + * + * Function : schAddPagingIndtoList + * + * Functionality: Storing the paging information in SCH database + * + * @params[in] CmLListCp *storedPageList, CmLList *pageIndInfo + * + * @return ROK - sucess + * RFAILED - failure + * + *************************************************************************/ +uint8_t schAddPagingIndtoList(CmLListCp *storedPageList,void * pageIndInfo) +{ + CmLList *firstNodeOfList = NULLP; + CmLList *currentNodeInfo = NULLP; + SchPageInfo *tempNode = NULLP, *recvdNode = NULLP; + + recvdNode = (SchPageInfo*) pageIndInfo; + CM_LLIST_FIRST_NODE(storedPageList,firstNodeOfList); + + SCH_ALLOC(currentNodeInfo, sizeof(CmLList)); + if(!currentNodeInfo) + { + DU_LOG("\nERROR --> SCH : schAddPagingIndtoList() : Memory allocation failed"); + return RFAILED; + } + + currentNodeInfo->node = (PTR)pageIndInfo; + while(firstNodeOfList) + { + tempNode = (SchPageInfo*)(firstNodeOfList->node); + if ((recvdNode->pageTxTime.slot < tempNode->pageTxTime.slot)) + { + cmLListInsCrnt(storedPageList, currentNodeInfo); + break; + } + else if ((recvdNode->pageTxTime.slot == tempNode->pageTxTime.slot)) + { + DU_LOG("\nERROR --> SCH : schAddPagingIndtoList() : Slot[%d] is already present in the list", recvdNode->pageTxTime.slot); + return RFAILED; + } + else + { + CM_LLIST_NEXT_NODE(storedPageList, firstNodeOfList); + } + } + + if(!firstNodeOfList) + { + cmLListAdd2Tail(storedPageList, currentNodeInfo); + } + DU_LOG("\nDEBUG --> SCH : Paging information is stored successfully for PF:%d, Slot:%d",\ + recvdNode->pageTxTime.sfn, recvdNode->pageTxTime.slot); + return ROK; +} + +/**************************************************************************** + * + * @brief Process paging indication at SCH recevied form MAC + * + * @details + * + * Function : MacSchPagingInd + * + * Functionality: Process paging indication at SCH recevied form MAC + * + * @params[in] Pst *pst, SchPageInd *pageInd + * + * @return void + * + *************************************************************************/ +uint8_t MacSchPagingInd(Pst *pst, SchPageInd *pageInd) +{ + uint8_t ret = RFAILED; + uint16_t cellIdx = 0; + Inst inst = pst->dstInst - SCH_INST_START; + SchCellCb *cellCb = NULLP; + SchPageInfo *pageInfo = NULLP; + + if(pageInd) + { + DU_LOG("\nDEBUG --> SCH : Received paging indication from MAC for cellId[%d]",\ + pageInd->cellId); + + /* Fetch Cell CB */ + for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++) + { + if((schCb[inst].cells[cellIdx]) && (schCb[inst].cells[cellIdx]->cellId == pageInd->cellId)) + { + cellCb = schCb[inst].cells[cellIdx]; + break; + } + } + if(cellCb) + { + if(pageInd->i_s > cellCb->cellCfg.sib1SchCfg.pageCfg.numPO) + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): i_s should not be greater than number of paging occasion"); + } + else + { + SCH_ALLOC(pageInfo, sizeof(SchPageInfo)); + if(pageInfo) + { + pageInfo->pf = pageInd->pf; + pageInfo->i_s = pageInd->i_s; + pageInfo->pageTxTime.cellId = pageInd->cellId; + pageInfo->pageTxTime.sfn = (pageInd->pf + cellCb->pageCb.pagMonOcc[pageInd->i_s].frameOffset) % MAX_SFN; + pageInfo->pageTxTime.slot = cellCb->pageCb.pagMonOcc[pageInd->i_s].pagingOccSlot; + pageInfo->mcs = DEFAULT_MCS; + pageInfo->msgLen = pageInd->pduLen; + SCH_ALLOC(pageInfo->pagePdu, pageInfo->msgLen); + if(!pageInfo->pagePdu) + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to allocate memory"); + } + else + { + memcpy(pageInfo->pagePdu, pageInd->pagePdu, pageInfo->msgLen); + ret = schAddPagingIndtoList(&cellCb->pageCb.pageIndInfoRecord[pageInfo->pageTxTime.sfn], pageInfo); + if(ret != ROK) + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to store paging record"); + } + } + } + else + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to allocate memory"); + } + } + } + else + { + DU_LOG("\nERROR --> SCH : Cell ID [%d] not found", pageInd->cellId); + } + SCH_FREE(pageInd->pagePdu, pageInd->pduLen); + SCH_FREE(pageInd, sizeof(SchPageInd)); + } + else + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Received null pointer"); + } + return ret; +} /********************************************************************** End of file **********************************************************************/