X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_rach.c;h=363f0b956772e9dca5c7a6f4fc2103968099566c;hb=ff0c6fbd56fc24b9c286dc6444e1e0fbe8871625;hp=18a6200bf799e1b18aa275c4f8cb12e33053f7e1;hpb=3ecca3e4e3a36a7f357a475bd4a938b0ac551e7c;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_rach.c b/src/5gnrmac/mac_rach.c index 18a6200bf..363f0b956 100644 --- a/src/5gnrmac/mac_rach.c +++ b/src/5gnrmac/mac_rach.c @@ -78,29 +78,40 @@ uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd) { uint8_t pduIdx; uint8_t preambleIdx; - RachIndInfo rachIndInfo; + RachIndInfo *rachIndInfo; DU_LOG("\nINFO --> MAC : Received RACH indication"); /* Considering one pdu and one preamble */ pduIdx = 0; preambleIdx = 0; - rachIndInfo.cellId = rachInd->cellId; - rachIndInfo.timingInfo.sfn = rachInd->timingInfo.sfn; - rachIndInfo.timingInfo.slot = rachInd->timingInfo.slot; - rachIndInfo.slotIdx = rachInd->rachPdu[pduIdx].slotIdx; - rachIndInfo.symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx; - rachIndInfo.freqIdx = rachInd->rachPdu[pduIdx].freqIdx; - rachIndInfo.preambleIdx = \ + MAC_ALLOC(rachIndInfo, sizeof(RachIndInfo)); + if(!rachIndInfo) + { + DU_LOG("\nERROR --> MAC : Memory allocation failure in fapiMacRachInd"); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rachInd, sizeof(RachInd)); + return RFAILED; + } + + rachIndInfo->cellId = rachInd->cellId; + rachIndInfo->timingInfo.sfn = rachInd->timingInfo.sfn; + rachIndInfo->timingInfo.slot = rachInd->timingInfo.slot; + rachIndInfo->slotIdx = rachInd->rachPdu[pduIdx].slotIdx; + rachIndInfo->symbolIdx = rachInd->rachPdu[pduIdx].symbolIdx; + rachIndInfo->freqIdx = rachInd->rachPdu[pduIdx].freqIdx; + rachIndInfo->preambleIdx = \ rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].preamIdx; - rachIndInfo.timingAdv = \ + rachIndInfo->timingAdv = \ rachInd->rachPdu[pduIdx].preamInfo[preambleIdx].timingAdv; - /* storing the value in macRaCb */ - createMacRaCb(&rachIndInfo); + /* Store the value in macRaCb */ + createMacRaCb(rachIndInfo); + /* Free sharable buffer used to send RACH Indication from lower MAC to MAC */ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rachInd, sizeof(RachInd)); - return(sendRachIndMacToSch(&rachIndInfo)); + + /* Send RACH Indication to SCH */ + return(sendRachIndMacToSch(rachIndInfo)); } /* spec-38.211 Table 6.3.3.1-7 */ @@ -127,11 +138,15 @@ uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo) { uint16_t cellIdx; +#ifdef CALL_FLOW_DEBUG_LOG + DU_LOG("\nCall Flow: ENTSCH -> ENTMAC : EVENT_UL_SCH_INFO\n"); +#endif + GET_CELL_IDX(ulSchedInfo->cellId, cellIdx); if(ulSchedInfo != NULLP) { MacUlSlot *currUlSlot = - &macCb.macCell[cellIdx]->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOT_SUPPORTED]; + &macCb.macCell[cellIdx]->ulSlot[ulSchedInfo->slotIndInfo.slot % MAX_SLOTS]; memcpy(&currUlSlot->ulInfo, ulSchedInfo, sizeof(UlSchedInfo)); } return ROK;