X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrsch%2Fsch_ue_mgr.c;h=460f71e632ccc73ae3b8c46e586aa9e971487c14;hb=67b89506e1d6a7a775d5095f390d5dcb610deb86;hp=a3a0c55298ac39696adcecd13474bc57b8f001e2;hpb=5007af25423493fbc002e30d847aa05d44bc180e;p=o-du%2Fl2.git diff --git a/src/5gnrsch/sch_ue_mgr.c b/src/5gnrsch/sch_ue_mgr.c index a3a0c5529..460f71e63 100644 --- a/src/5gnrsch/sch_ue_mgr.c +++ b/src/5gnrsch/sch_ue_mgr.c @@ -114,6 +114,18 @@ void fillSchDlLcCtxt(SchDlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg) ueCbLcCfg->lcp = lcCfg->dlLcCfg.lcp; ueCbLcCfg->lcState = SCH_LC_STATE_ACTIVE; ueCbLcCfg->bo = 0; + if(lcCfg->drbQos) + { + ueCbLcCfg->pduSessionId = lcCfg->drbQos->pduSessionId; + } + if(lcCfg->snssai) + { + if(ueCbLcCfg->snssai == NULLP)/*In CONFIG_MOD case, no need to allocate SNSSAI memory*/ + { + SCH_ALLOC(ueCbLcCfg->snssai, sizeof(Snssai)); + } + memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(Snssai)); + } } /******************************************************************* @@ -142,6 +154,19 @@ void fillSchUlLcCtxt(SchUlLcCtxt *ueCbLcCfg, SchLcCfg *lcCfg) ueCbLcCfg->pbr = lcCfg->ulLcCfg.pbr; ueCbLcCfg->bsd = lcCfg->ulLcCfg.bsd; + if(lcCfg->drbQos) + { + ueCbLcCfg->pduSessionId = lcCfg->drbQos->pduSessionId; + } + if(lcCfg->snssai) + { + /*In CONFIG_MOD case, no need to allocate SNSSAI memory again*/ + if(ueCbLcCfg->snssai == NULLP) + { + SCH_ALLOC(ueCbLcCfg->snssai, sizeof(Snssai)); + } + memcpy(ueCbLcCfg->snssai, lcCfg->snssai,sizeof(Snssai)); + } } /******************************************************************* @@ -167,6 +192,20 @@ void updateSchUlCb(uint8_t delIdx, SchUlCb *ulInfo) memcpy(&ulInfo->ulLcCtxt[lcIdx], &ulInfo->ulLcCtxt[lcIdx+1], sizeof(SchUlLcCtxt)); memset(&ulInfo->ulLcCtxt[lcIdx+1], 0, sizeof(SchUlLcCtxt)); } + /*Leakage of Last Index*/ + /*Last index of ulLcCtxt(before deletion) should be void*/ + if(ulInfo->ulLcCtxt[ulInfo->numUlLc].snssai != NULLP) + { + DU_LOG("ERROR --> SCH: updateSchUlCb Last index:%d (Before Deletion) memory is leaking",\ + ulInfo->numUlLc); + SCH_FREE(ulInfo->ulLcCtxt[ulInfo->numUlLc].snssai, sizeof(Snssai)); + } + else + { + DU_LOG("INFO --> SCH: updateSchUlCb Last index:%d (before deletion) memory is freed successfully",\ + ulInfo->numUlLc); + + } } /******************************************************************* @@ -192,6 +231,19 @@ void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo) memcpy(&dlInfo->dlLcCtxt[lcIdx], &dlInfo->dlLcCtxt[lcIdx+1], sizeof(SchDlLcCtxt)); memset(&dlInfo->dlLcCtxt[lcIdx+1], 0, sizeof(SchDlLcCtxt)); } + /*Leakage of Last Index*/ + /*Last index of ulLcCtxt(before deletion) should be void*/ + if(dlInfo->dlLcCtxt[dlInfo->numDlLc].snssai != NULLP) + { + DU_LOG("ERROR --> SCH: updateSchDlCb Last index:%d (before deletion) memory is leaking: Delete the S-NSSAI memory",\ + dlInfo->numDlLc); + SCH_FREE(dlInfo->dlLcCtxt[dlInfo->numDlLc].snssai, sizeof(Snssai)); + } + else + { + DU_LOG("INFO --> SCH: updateSchDlCb Last index:%d (before deletion) memory is freed successfully",\ + dlInfo->numDlLc); + } } /******************************************************************* @@ -213,7 +265,10 @@ void updateSchDlCb(uint8_t delIdx, SchDlCb *dlInfo) uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) { uint8_t lcIdx, ueLcIdx; - + uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0}; + SchPdschCfgCmn pdschCfg; + SchPucchDlDataToUlAck *dlDataToUlAck; + ueCb->ueCfg.cellId = ueCfg->cellId; ueCb->ueCfg.crnti = ueCfg->crnti; if(ueCfg->macCellGrpCfgPres == true) @@ -231,15 +286,34 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) if(ueCfg->spCellCfgPres == true) { memcpy(&ueCb->ueCfg.spCellCfg , &ueCfg->spCellCfg, sizeof(SchSpCellCfg)); + + covertFreqDomRsrcMapToIAPIFormat(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc,\ + freqDomainResource); + memset(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, 0, FREQ_DOM_RSRC_SIZE); + memcpy(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdcchCfg.cRSetToAddModList[0].freqDomainRsrc, freqDomainResource, FREQ_DOM_RSRC_SIZE); + ueCb->ueCfg.spCellCfgPres = true; + dlDataToUlAck = ueCfg->spCellCfg.servCellCfg.initUlBwp.pucchCfg.dlDataToUlAck; + if(ueCb->cellCb) + { + 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,\ + NULLP, &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.k2InfoTbl); + } + } } + ueCb->state = SCH_UE_STATE_ACTIVE; - if(ueCfg->ambrCfg != NULLP) + if(ueCfg->ambrCfg) { - SCH_ALLOC(ueCb->ueCfg.ambrCfg , sizeof(SchAmbrCfg)); - memcpy(&ueCb->ueCfg.ambrCfg->ulBr , &ueCfg->ambrCfg->ulBr, sizeof(SchAmbrCfg)); + SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); + ueCb->ueCfg.ambrCfg = ueCfg->ambrCfg; } - memcpy(&ueCb->ueCfg.dlModInfo, &ueCfg->dlModInfo , sizeof(SchModulationInfo)); memcpy(&ueCb->ueCfg.ulModInfo, &ueCfg->ulModInfo , sizeof(SchModulationInfo)); @@ -262,14 +336,32 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) { fillSchUlLcCtxt(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); - fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); break; } - if(ueCfg->schLcCfg[ueLcIdx].configType == CONFIG_DEL) + /*BUG: ueCfg using lcIdx (Looping around numLCs in ueCfg whereas + * ueLcIdx Loops around numUlLc in SCH UL DB*/ + if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_DEL) { memset(&ueCb->ulInfo.ulLcCtxt[ueLcIdx], 0, sizeof(SchUlLcCtxt)); ueCb->ulInfo.numUlLc--; - updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead + updateSchUlCb(ueLcIdx, &ueCb->ulInfo); //moving arr elements one idx ahead + + break; + } + } + }/*End of inner for loop */ + + for(ueLcIdx = 0; ueLcIdx < ueCb->dlInfo.numDlLc; ueLcIdx++) //searching for Lc to be Mod + { + if(ueCb->dlInfo.dlLcCtxt[ueLcIdx].lcId == ueCfg->schLcCfg[lcIdx].lcId) + { + if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_MOD) + { + fillSchDlLcCtxt(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], &ueCfg->schLcCfg[lcIdx]); + break; + } + if(ueCfg->schLcCfg[lcIdx].configType == CONFIG_DEL) + { memset(&ueCb->dlInfo.dlLcCtxt[ueLcIdx], 0, sizeof(SchDlLcCtxt)); ueCb->dlInfo.numDlLc--; updateSchDlCb(ueLcIdx, &ueCb->dlInfo); //moving arr elements one idx ahead @@ -278,6 +370,10 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg) } }/*End of inner for loop */ } + + SCH_FREE(ueCfg->schLcCfg[lcIdx].drbQos, sizeof(SchDrbQosInfo)); + SCH_FREE(ueCfg->schLcCfg[lcIdx].snssai, sizeof(Snssai)); + }/* End of outer for loop */ return ROK; } @@ -353,6 +449,10 @@ uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfg *ueCfg) SchUeCfgRsp cfgRsp; Inst inst = pst->dstInst - 1; memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); + +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_ADD_UE_CONFIG_REQ_TO_SCH\n"); +#endif if(!ueCfg) { @@ -422,13 +522,12 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S uint16_t puschSlot = 0; uint16_t startRb = 0; uint8_t numRb = 0; - uint8_t numPdschSymbols= 14; uint16_t tbSize = 0; uint8_t buffer = 5; uint8_t idx = 0; SchCellCb *cellCb = ueCb->cellCb; SchUlSlotInfo *schUlSlotInfo = NULLP; - uint8_t k2=0, startSymb=0 , symbLen=0; + uint8_t k2=0, startSymb=0 , symbLen=11; if(ueCb->ueCfg.spCellCfgPres == true) { @@ -440,7 +539,7 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S startRb = cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb; tbSize = schCalcTbSize(dataVol + buffer); /* 2 bytes header + some buffer */ - numRb = schCalcNumPrb(tbSize, ueCb->ueCfg.ulModInfo.mcsIndex, numPdschSymbols); + numRb = schCalcNumPrb(tbSize, ueCb->ueCfg.ulModInfo.mcsIndex, symbLen); /* increment PUSCH PRB */ cellCb->schUlSlotInfo[puschSlot]->puschCurrentPrb += numRb; @@ -465,7 +564,7 @@ uint8_t schFillPuschAlloc(SchUeCb *ueCb, uint16_t pdcchSlot, uint32_t dataVol, S /* Update pusch in cell */ for(idx=startSymb; idxschUlSlotInfo[puschSlot]->assignedPrb[idx] = startRb + numRb; + //cellCb->schUlSlotInfo[puschSlot]->assignedPrb[idx] = startRb + numRb; } schUlSlotInfo = cellCb->schUlSlotInfo[puschSlot]; @@ -592,6 +691,10 @@ uint8_t MacSchModUeConfigReq(Pst *pst, SchUeCfg *ueCfg) SchUeCfgRsp cfgRsp; Inst inst = pst->dstInst - 1; memset(&cfgRsp, 0, sizeof(SchUeCfgRsp)); + +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH\n"); +#endif if(!ueCfg) { @@ -758,12 +861,22 @@ void deleteSchPdschServCellCfg(SchPdschServCellCfg *pdschServCellCfg) * ****************************************************************/ void deleteSchUeCb(SchUeCb *ueCb) { + uint8_t timeDomRsrcIdx = 0, ueLcIdx = 0; SchPucchCfg *pucchCfg = NULLP; + SchPdschConfig *pdschCfg = NULLP; + if(ueCb) { SCH_FREE(ueCb->ueCfg.ambrCfg, sizeof(SchAmbrCfg)); if(ueCb->ueCfg.spCellCfgPres) { + if(ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfgPres == true) + { + pdschCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initDlBwp.pdschCfg; + for(timeDomRsrcIdx = 0; timeDomRsrcIdx < pdschCfg->numTimeDomRsrcAlloc; timeDomRsrcIdx++) + SCH_FREE(pdschCfg->timeDomRsrcAllociList[timeDomRsrcIdx].k0, sizeof(uint8_t)); + } + if(ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfgPres == true) { pucchCfg = &ueCb->ueCfg.spCellCfg.servCellCfg.initUlBwp.pucchCfg; @@ -786,6 +899,15 @@ void deleteSchUeCb(SchUeCb *ueCb) SCH_FREE(ueCb->ueCfg.spCellCfg.servCellCfg.bwpInactivityTmr, sizeof(uint8_t)); deleteSchPdschServCellCfg(&ueCb->ueCfg.spCellCfg.servCellCfg.pdschServCellCfg); } + /*Need to Free the memory allocated for S-NSSAI*/ + for(ueLcIdx = 0; ueLcIdx < ueCb->ulInfo.numUlLc; ueLcIdx++) + { + SCH_FREE(ueCb->ulInfo.ulLcCtxt[ueLcIdx].snssai, sizeof(Snssai)); + } + for(ueLcIdx = 0; ueLcIdx < ueCb->dlInfo.numDlLc; ueLcIdx++) + { + SCH_FREE(ueCb->dlInfo.dlLcCtxt[ueLcIdx].snssai, sizeof(Snssai)); + } memset(ueCb, 0, sizeof(SchUeCb)); } } @@ -811,7 +933,11 @@ uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete *ueDelete) ErrorCause result; SchCellCb *cellCb = NULLP; Inst inst = pst->dstInst - 1; - + +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_UE_DELETE_REQ_TO_SCH\n"); +#endif + if(!ueDelete) { DU_LOG("\nERROR --> SCH : MacSchUeDeleteReq(): Ue Delete request failed"); @@ -911,39 +1037,35 @@ uint8_t SchSendCellDeleteRspToMac(SchCellDelete *ueDelete, Inst inst, SchMacRsp * ****************************************************************/ void deleteSchCellCb(SchCellCb *cellCb) { - uint8_t idx=0; + uint8_t sliceIdx=0, slotIdx=0; if(cellCb->schDlSlotInfo) { - for(idx=0; idxnumSlots; idx++) + for(slotIdx=0; slotIdxnumSlots; slotIdx++) { - if(cellCb->schDlSlotInfo[idx]) - { - SCH_FREE(cellCb->schDlSlotInfo[idx]->rarInfo, sizeof(RarInfo)); - if(cellCb->schDlSlotInfo[idx]->dlMsgInfo) - { - SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPdu,\ - cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPduLen); - SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo, sizeof(DlMsgInfo)); - } - SCH_FREE(cellCb->schDlSlotInfo[idx], sizeof(SchDlSlotInfo)); - } + SCH_FREE(cellCb->schDlSlotInfo[slotIdx], sizeof(SchDlSlotInfo)); } - SCH_FREE(cellCb->schDlSlotInfo, sizeof(SchDlSlotInfo)); + SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*)); } if(cellCb->schUlSlotInfo) { - for(idx=0; idxnumSlots; idx++) + for(slotIdx=0; slotIdxnumSlots; slotIdx++) { - if(cellCb->schUlSlotInfo[idx]) - { - SCH_FREE(cellCb->schUlSlotInfo[idx]->schPuschInfo,sizeof(SchPuschInfo)); - SCH_FREE(cellCb->schUlSlotInfo[idx], sizeof(SchUlSlotInfo)); - } + SCH_FREE(cellCb->schUlSlotInfo[slotIdx], sizeof(SchUlSlotInfo)); } - SCH_FREE(cellCb->schUlSlotInfo, sizeof(SchUlSlotInfo)); + SCH_FREE(cellCb->schUlSlotInfo, cellCb->numSlots * sizeof(SchUlSlotInfo*)); } - SCH_FREE(cellCb->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg, sizeof(PdschCfg)); + + if(cellCb->cellCfg.snssai) + { + for(sliceIdx=0; sliceIdxcellCfg.numSliceSupport; sliceIdx++) + { + SCH_FREE(cellCb->cellCfg.snssai[sliceIdx], sizeof(Snssai)); + } + SCH_FREE(cellCb->cellCfg.snssai, cellCb->cellCfg.numSliceSupport*sizeof(Snssai*)); + } + SCH_FREE(cellCb->cellCfg.rrmPolicy, sizeof(SchRrmPolicy)); memset(cellCb, 0, sizeof(SchCellCb)); + } /******************************************************************* @@ -967,6 +1089,10 @@ uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDelete *cellDelete) uint8_t cellIdx=0, ret = RFAILED; Inst inst = pst->dstInst - 1; SchMacRsp result= RSP_OK; + +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTMAC -> ENTSCH : EVENT_CELL_DELETE_REQ_TO_SCH\n"); +#endif if(!cellDelete) {