1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* header include files -- defines (.h) */
20 #include "common_def.h"
23 #include "du_app_mac_inf.h"
24 #include "mac_sch_interface.h"
25 #include "rlc_mac_inf.h"
26 #include "mac_upr_inf_api.h"
29 #include "fapi_interface.h"
31 #include "lwr_mac_fsm.h"
32 #include "lwr_mac_upr_inf.h"
34 #include "mac_utils.h"
36 /* This file contains message handling functionality for MAC */
40 /* Function pointer for sending crc ind from MAC to SCH */
41 MacSchCrcIndFunc macSchCrcIndOpts[]=
48 /* Function pointer for sending DL RLC BO Info from MAC to SCH */
49 MacSchDlRlcBoInfoFunc macSchDlRlcBoInfoOpts[]=
51 packMacSchDlRlcBoInfo,
56 /* Function pointer for sending short BSR from MAC to SCH */
57 MacSchBsrFunc macSchBsrOpts[]=
64 /* Function pointer for sending SR Uci ind from MAC to SCH */
65 MacSchSrUciIndFunc macSchSrUciIndOpts[]=
72 /* Function pointer for sending Slice cfg ind from MAC to SCH */
73 MacSchSliceCfgReqFunc macSchSliceCfgReqOpts[]=
75 packMacSchSliceCfgReq,
80 /* Function pointer for sending Slice cfg ind from MAC to SCH */
81 MacSchSliceReCfgReqFunc macSchSliceReCfgReqOpts[]=
83 packMacSchSliceReCfgReq,
85 packMacSchSliceReCfgReq
87 /*******************************************************************
89 * @brief Sends DL BO Info to SCH
93 * Function : sendDlRlcBoInfoToSch
96 * Sends DL BO Info to SCH
99 * @return ROK - success
102 ****************************************************************/
103 uint8_t sendDlRlcBoInfoToSch(DlRlcBoInfo *dlBoInfo)
107 FILL_PST_MAC_TO_SCH(pst, EVENT_DL_RLC_BO_INFO_TO_SCH);
108 return(*macSchDlRlcBoInfoOpts[pst.selector])(&pst, dlBoInfo);
111 /*******************************************************************
113 * @brief Sends CRC Indication to SCH
117 * Function : sendCrcIndMacToSch
120 * Sends CRC Indication to SCH
123 * @return ROK - success
126 ****************************************************************/
127 uint8_t sendCrcIndMacToSch(CrcIndInfo *crcInd)
131 FILL_PST_MAC_TO_SCH(pst, EVENT_CRC_IND_TO_SCH);
132 return(*macSchCrcIndOpts[pst.selector])(&pst, crcInd);
135 /*******************************************************************
137 * @brief Processes CRC Indication from PHY
141 * Function : fapiMacCrcInd
144 * Processes CRC Indication from PHY
146 * @params[in] Post Structure Pointer
147 * Crc Indication Pointer
148 * @return ROK - success
151 * ****************************************************************/
152 uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
155 CrcIndInfo crcIndInfo;
156 DU_LOG("\nDEBUG --> MAC : Received CRC indication");
157 GET_CELL_IDX(crcInd->cellId, cellIdx);
158 /* Considering one pdu and one preamble */
159 crcIndInfo.cellId = macCb.macCell[cellIdx]->cellId;
160 crcIndInfo.crnti = crcInd->crcInfo[0].rnti;
161 crcIndInfo.timingInfo.sfn = crcInd->timingInfo.sfn;
162 crcIndInfo.timingInfo.slot = crcInd->timingInfo.slot;
163 crcIndInfo.numCrcInd = crcInd->crcInfo[0].numCb;
164 crcIndInfo.crcInd[0] = crcInd->crcInfo[0].cbCrcStatus[0];
166 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, crcInd, sizeof(CrcInd));
167 return(sendCrcIndMacToSch(&crcIndInfo));
170 /*******************************************************************
172 * @brief Process Rx Data Ind at MAC
176 * Function : fapiMacRxDataInd
179 * Process Rx Data Ind at MAC
181 * @params[in] Post structure
183 * @return ROK - success
186 * ****************************************************************/
187 uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
190 DU_LOG("\nDEBUG --> MAC : Received Rx Data indication");
191 /* TODO : compare the handle received in RxDataInd with handle send in PUSCH
192 * PDU, which is stored in raCb */
194 for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++)
196 unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]);
197 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd->pdus[pduIdx].pduData,\
198 rxDataInd->pdus[pduIdx].pduLength);
200 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd, sizeof(RxDataInd));
204 /*******************************************************************
206 * @brief Processes DL data from RLC
210 * Function : MacProcRlcDlData
213 * Processes DL data from RLC
215 * @params[in] Post structure
217 * @return ROK - success
220 * ****************************************************************/
221 uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
226 uint8_t *txPdu = NULLP;
227 uint8_t schInfoIdx = 0 ;
228 uint16_t cellIdx = 0, txPduLen = 0;
230 MacDlSlot *currDlSlot = NULLP;
231 DlRlcBoInfo dlBoInfo;
233 memset(&macDlData , 0, sizeof(MacDlData));
234 DU_LOG("\nDEBUG --> MAC: Received DL data for sfn=%d slot=%d numPdu= %d", \
235 dlData->slotInfo.sfn, dlData->slotInfo.slot, dlData->numPdu);
237 GET_UE_ID(dlData->rnti, ueId);
239 /* Copy the pdus to be muxed into mac Dl data */
240 macDlData.ueId = ueId;
241 macDlData.numPdu = dlData->numPdu;
242 for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
244 macDlData.pduInfo[pduIdx].lcId = dlData->pduInfo[pduIdx].lcId;
245 macDlData.pduInfo[pduIdx].pduLen = dlData->pduInfo[pduIdx].pduLen;
246 macDlData.pduInfo[pduIdx].dlPdu = dlData->pduInfo[pduIdx].pduBuf;
249 GET_CELL_IDX(dlData->cellId, cellIdx);
250 /* Store DL data in the scheduled slot */
251 if(macCb.macCell[cellIdx] ==NULLP)
253 DU_LOG("\nERROR --> MAC : MacProcRlcDlData(): macCell does not exists");
256 currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlData->slotInfo.slot];
257 if(currDlSlot->dlInfo.dlMsgAlloc[ueId-1])
259 for(schInfoIdx=0; schInfoIdx<currDlSlot->dlInfo.dlMsgAlloc[ueId-1]->numSchedInfo; schInfoIdx++)
261 if((currDlSlot->dlInfo.dlMsgAlloc[ueId-1]->dlMsgSchedInfo[schInfoIdx].pduPres == PDSCH_PDU) ||
262 (currDlSlot->dlInfo.dlMsgAlloc[ueId-1]->dlMsgSchedInfo[schInfoIdx].pduPres == BOTH))
266 txPduLen = currDlSlot->dlInfo.dlMsgAlloc[ueId-1]->dlMsgSchedInfo[schInfoIdx].dlMsgPdschCfg.codeword[0].tbSize\
267 - TX_PAYLOAD_HDR_LEN;
268 MAC_ALLOC(txPdu, txPduLen);
271 DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcRlcDlData");
274 macMuxPdu(&macDlData, NULLP, txPdu, txPduLen);
276 currDlSlot->dlInfo.dlMsgAlloc[ueId-1]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.dlMsgPduLen = txPduLen;
277 currDlSlot->dlInfo.dlMsgAlloc[ueId-1]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.dlMsgPdu = txPdu;
280 for(lcIdx = 0; lcIdx < dlData->numLc; lcIdx++)
282 if(dlData->boStatus[lcIdx].bo)
284 memset(&dlBoInfo, 0, sizeof(DlRlcBoInfo));
285 dlBoInfo.cellId = dlData->boStatus[lcIdx].cellId;
286 GET_CRNTI(dlBoInfo.crnti, dlData->boStatus[lcIdx].ueId);
287 dlBoInfo.lcId = dlData->boStatus[lcIdx].lcId;
288 dlBoInfo.dataVolume = dlData->boStatus[lcIdx].bo;
289 sendDlRlcBoInfoToSch(&dlBoInfo);
294 for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
296 MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData->pduInfo[pduIdx].pduBuf,\
297 dlData->pduInfo[pduIdx].pduLen);
299 if(pstInfo->selector == ODU_SELECTOR_LWLC)
301 MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData, sizeof(RlcData));
306 /*******************************************************************
308 * @brief Builds and Sends UL Data to RLC
312 * Function : macProcUlData
314 * Functionality: Builds and Sends UL Data to RLC
319 * LC Id on which payload was received
320 * Pointer to the payload
322 * @return ROK - success
325 * ****************************************************************/
326 uint8_t macProcUlData(uint16_t cellId, uint16_t rnti, SlotTimingInfo slotInfo, \
327 uint8_t lcId, uint16_t pduLen, uint8_t *pdu)
332 /* Filling RLC Ul Data*/
333 MAC_ALLOC_SHRABL_BUF(ulData, sizeof(RlcData));
336 DU_LOG("\nERROR --> MAC : Memory allocation failed while sending UL data to RLC");
339 memset(ulData, 0, sizeof(RlcData));
340 ulData->cellId = cellId;
342 memcpy(&ulData->slotInfo, &slotInfo, sizeof(SlotTimingInfo));
343 ulData->slotInfo.cellId = cellId;
345 /* Filling pdu info */
346 if(lcId != SRB0_LCID)
347 ulData->pduInfo[ulData->numPdu].commCh = false;
349 ulData->pduInfo[ulData->numPdu].commCh = true;
351 ulData->pduInfo[ulData->numPdu].lcId = lcId;
352 ulData->pduInfo[ulData->numPdu].pduBuf = pdu;
353 ulData->pduInfo[ulData->numPdu].pduLen = pduLen;
356 /* Filling Post and send to RLC */
357 memset(&pst, 0, sizeof(Pst));
358 FILL_PST_MAC_TO_RLC(pst, 0, EVENT_UL_DATA_TO_RLC);
359 MacSendUlDataToRlc(&pst, ulData);
365 /*******************************************************************
367 * @brief Processes BO status from RLC
371 * Function : MacProcRlcBOStatus
374 * Processes BO status from RLC
376 * @params[in] Post structure
378 * @return ROK - success
381 * ****************************************************************/
382 uint8_t MacProcRlcBoStatus(Pst* pst, RlcBoStatus* boStatus)
384 DlRlcBoInfo dlBoInfo;
386 dlBoInfo.cellId = boStatus->cellId;
387 GET_CRNTI(dlBoInfo.crnti, boStatus->ueId);
388 dlBoInfo.lcId = boStatus->lcId;
389 dlBoInfo.dataVolume = boStatus->bo;
391 sendDlRlcBoInfoToSch(&dlBoInfo);
393 if(pst->selector == ODU_SELECTOR_LWLC)
395 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, boStatus, sizeof(RlcBoStatus));
401 /*******************************************************************
403 * @brief Send LC schedule result report to RLC
407 * Function : sendSchRptToRlc
409 * Functionality: Send LC schedule result report to RLC
412 * @return ROK - success
415 * ****************************************************************/
416 uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotTimingInfo slotInfo, uint8_t ueIdx, uint8_t schInfoIdx)
420 RlcSchedResultRpt *schedRpt = NULLP;
422 MAC_ALLOC_SHRABL_BUF(schedRpt, sizeof(RlcSchedResultRpt));
425 DU_LOG("\nERROR --> MAC: Memory allocation failure in sendSchResultRepToRlc");
429 DU_LOG("\nDEBUG --> MAC: Send scheduled result report for sfn %d slot %d", slotInfo.sfn, slotInfo.slot);
430 schedRpt->cellId = dlInfo.cellId;
431 schedRpt->slotInfo.sfn = slotInfo.sfn;
432 schedRpt->slotInfo.slot = slotInfo.slot;
434 if(dlInfo.dlMsgAlloc[ueIdx])
436 schedRpt->rnti = dlInfo.dlMsgAlloc[ueIdx]->crnti;
437 schedRpt->numLc = dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].numLc;
438 for(lcIdx = 0; lcIdx < schedRpt->numLc; lcIdx++)
440 schedRpt->lcSch[lcIdx].lcId = dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].lcSchInfo[lcIdx].lcId;
441 schedRpt->lcSch[lcIdx].bufSize = dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].lcSchInfo[lcIdx].schBytes;
442 schedRpt->lcSch[lcIdx].commCh = false;
447 FILL_PST_MAC_TO_RLC(pst, RLC_DL_INST, EVENT_SCHED_RESULT_TO_RLC);
448 if(MacSendSchedResultRptToRlc(&pst, schedRpt) != ROK)
450 DU_LOG("\nERROR --> MAC: Failed to send Schedule result report to RLC");
451 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, schedRpt, sizeof(RlcSchedResultRpt));
458 /*******************************************************************
460 * @brief Handles cell start reuqest from DU APP
464 * Function : MacProcCellStart
467 * Handles cell start reuqest from DU APP
469 * @params[in] Post structure pointer
471 * @return ROK - success
474 * ****************************************************************/
475 uint8_t MacProcCellStart(Pst *pst, OduCellId *cellId)
477 DU_LOG("\nINFO --> MAC : Handling cell start request");
479 sendToLowerMac(START_REQUEST, 0, cellId);
481 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
487 /*******************************************************************
489 * @brief Handles cell stop from DU APP
493 * Function : MacProcCellStop
496 * Handles cell stop from DU APP
498 * @params[in] Post structure pointer
500 * @return ROK - success
503 * ****************************************************************/
504 uint8_t MacProcCellStop(Pst *pst, OduCellId *cellId)
509 DU_LOG("\nINFO --> MAC : Sending cell stop request to Lower Mac");
510 GET_CELL_IDX(cellId->cellId, cellIdx);
511 if(macCb.macCell[cellIdx])
513 macCb.macCell[cellIdx]->state = CELL_TO_BE_STOPPED;
517 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
523 /*******************************************************************
525 * @brief Handles DL CCCH Ind from DU APP
529 * Function : MacProcDlCcchInd
532 * Handles DL CCCH Ind from DU APP
534 * @params[in] Post structure pointer
535 * DL CCCH Ind pointer
536 * @return ROK - success
539 * ****************************************************************/
540 uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
542 uint8_t ueId = 0, ueIdx = 0;
545 DlRlcBoInfo dlBoInfo;
546 memset(&dlBoInfo, 0, sizeof(DlRlcBoInfo));
548 DU_LOG("\nDEBUG --> MAC : Handling DL CCCH IND");
550 GET_CELL_IDX(dlCcchIndInfo->cellId, cellIdx);
552 dlBoInfo.cellId = dlCcchIndInfo->cellId;
553 dlBoInfo.crnti = dlCcchIndInfo->crnti;
555 if(dlCcchIndInfo->msgType == RRC_SETUP)
557 dlBoInfo.lcId = SRB0_LCID; // SRB ID 0 for msg4
558 /* (MSG4 pdu + 3 bytes sub-header) + (Contention resolution id MAC CE + 1 byte sub-header) */
559 dlBoInfo.dataVolume = (dlCcchIndInfo->dlCcchMsgLen + 3) + (MAX_CRI_SIZE + 1);
561 /* storing Msg4 Pdu in raCb */
562 GET_UE_ID(dlBoInfo.crnti, ueId);
564 if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == dlCcchIndInfo->crnti)
566 macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen;
567 MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu, \
568 macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
569 if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu)
571 for(idx = 0; idx < dlCcchIndInfo->dlCcchMsgLen; idx++)
573 macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu[idx] =\
574 dlCcchIndInfo->dlCcchMsg[idx];
579 sendDlRlcBoInfoToSch(&dlBoInfo);
581 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo->dlCcchMsg, \
582 dlCcchIndInfo->dlCcchMsgLen);
583 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo, sizeof(DlCcchIndInfo));
588 /*******************************************************************
590 * @brief Sends UL CCCH Ind to DU APP
594 * Function : macProcUlCcchInd
597 * MAC sends UL CCCH Ind to DU APP
599 * @params[in] Post structure pointer
601 * @return ROK - success
604 * ****************************************************************/
605 uint8_t macProcUlCcchInd(uint16_t cellId, uint16_t crnti, uint16_t rrcContSize, uint8_t *rrcContainer)
609 UlCcchIndInfo *ulCcchIndInfo = NULLP;
611 MAC_ALLOC_SHRABL_BUF(ulCcchIndInfo, sizeof(UlCcchIndInfo));
614 DU_LOG("\nERROR --> MAC: Memory failed in macProcUlCcchInd");
618 ulCcchIndInfo->cellId = cellId;
619 ulCcchIndInfo->crnti = crnti;
620 ulCcchIndInfo->ulCcchMsgLen = rrcContSize;
621 ulCcchIndInfo->ulCcchMsg = rrcContainer;
624 FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_UL_CCCH_IND);
626 if(MacDuAppUlCcchInd(&pst, ulCcchIndInfo) != ROK)
628 DU_LOG("\nERROR --> MAC: Failed to send UL CCCH Ind to DU APP");
629 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
630 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
636 /*******************************************************************
638 * @brief Processes received short BSR
642 * Function : macProcShortBsr
645 * MAC sends Short BSR to SCH
647 * @params[in] cell ID
652 * @return ROK - success
655 * ****************************************************************/
656 uint8_t macProcShortBsr(uint16_t cellId, uint16_t crnti, uint8_t lcgId, uint32_t bufferSize)
659 UlBufferStatusRptInd bsrInd;
661 memset(&pst, 0, sizeof(Pst));
662 memset(&bsrInd, 0, sizeof(UlBufferStatusRptInd));
664 bsrInd.cellId = cellId;
665 bsrInd.crnti = crnti;
666 bsrInd.bsrType = SHORT_BSR;
667 bsrInd.numLcg = 1; /* short bsr reports one lcg at a time */
668 bsrInd.dataVolInfo[0].lcgId = lcgId;
669 bsrInd.dataVolInfo[0].dataVol = bufferSize;
671 FILL_PST_MAC_TO_SCH(pst, EVENT_SHORT_BSR);
672 return(*macSchBsrOpts[pst.selector])(&pst, &bsrInd);
675 /*******************************************************************
677 * @brief Processes received short BSR
681 * Function : macProcShortBsr
684 * MAC sends Short BSR to SCH
686 * @params[in] cell ID
691 * @return ROK - success
694 * ****************************************************************/
695 uint8_t macProcLongBsr(uint16_t cellId, uint16_t crnti,uint8_t numLcg,\
696 DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS])
699 UlBufferStatusRptInd bsrInd;
702 memset(&pst, 0, sizeof(Pst));
703 memset(&bsrInd, 0, sizeof(UlBufferStatusRptInd));
705 bsrInd.cellId = cellId;
706 bsrInd.crnti = crnti;
707 bsrInd.bsrType = LONG_BSR;
708 bsrInd.numLcg = numLcg;
710 for(lcgIdx = 0; lcgIdx < numLcg; lcgIdx++)
711 memcpy(&(bsrInd.dataVolInfo[lcgIdx]), &(dataVolInfo[lcgIdx]), sizeof(DataVolInfo));
713 FILL_PST_MAC_TO_SCH(pst, EVENT_LONG_BSR);
714 return(*macSchBsrOpts[pst.selector])(&pst, &bsrInd);
717 /*******************************************************************
719 * @brief Builds and send SR UCI Indication to SCH
723 * Function : buildAndSendSrInd
726 * Builds and send SR UCI Indication to SCH
728 * @params[in] SrUciIndInfo Pointer
730 * @return ROK - success
733 * ****************************************************************/
734 uint8_t buildAndSendSrInd(UciInd *macUciInd, uint8_t crnti)
738 SrUciIndInfo srUciInd;
739 memset(&pst, 0, sizeof(Pst));
740 memset(&srUciInd, 0, sizeof(SrUciIndInfo));
742 GET_CELL_IDX(macUciInd->cellId, cellIdx);
743 srUciInd.cellId = macCb.macCell[cellIdx]->cellId;
744 srUciInd.crnti = crnti;
745 srUciInd.slotInd.sfn = macUciInd->slotInd.sfn;
746 srUciInd.slotInd.slot = macUciInd->slotInd.slot;
747 srUciInd.numSrBits++;
748 memset(srUciInd.srPayload, 0, MAX_SR_BITS_IN_BYTES);
751 FILL_PST_MAC_TO_SCH(pst, EVENT_UCI_IND_TO_SCH);
753 return(*macSchSrUciIndOpts[pst.selector])(&pst, &srUciInd);
756 /*******************************************************************
758 * @brief Processes UCI Indication from PHY
762 * Function : fapiMacUciInd
765 * Processes UCI Indication from PHY
767 * @params[in] Post Structure Pointer
768 * UCI Indication Pointer
769 * @return ROK - success
772 * ****************************************************************/
773 uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
782 nPdus = macUciInd->numUcis;
785 switch(macUciInd->pdus[pduIdx].pduType)
789 case UCI_IND_PUCCH_F0F1:
790 if(macUciInd->pdus[pduIdx].uci.uciPucchF0F1.srInfo.srIndPres)
792 DU_LOG("\nDEBUG --> MAC : Received SR UCI indication");
793 crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti;
794 ret = buildAndSendSrInd(macUciInd, crnti);
797 case UCI_IND_PUCCH_F2F3F4:
800 DU_LOG("\nERROR --> MAC: Invalid Pdu Type %d at FapiMacUciInd", macUciInd->pdus[pduIdx].pduType);
810 DU_LOG("\nERROR --> MAC: Received Uci Ind is NULL at FapiMacUciInd()");
813 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macUciInd, sizeof(UciInd));
817 /*******************************************************************
819 * @brief fill Slice Cfg Request info in shared structre
823 * Function : fillSliceCfgInfo
826 * fill Slice Cfg Request info in shared structre
828 * @params[in] SchSliceCfgReq *schSliceCfgReq
829 * MacSliceCfgReq *macSliceCfgReq;
830 * @return ROK - success
833 **********************************************************************/
834 uint8_t fillSliceCfgInfo(SchSliceCfgReq *schSliceCfgReq, MacSliceCfgReq *macSliceCfgReq)
838 if(macSliceCfgReq->listOfSliceCfg)
840 schSliceCfgReq->numOfConfiguredSlice = macSliceCfgReq->numOfConfiguredSlice;
841 MAC_ALLOC(schSliceCfgReq->listOfConfirguration, schSliceCfgReq->numOfConfiguredSlice *sizeof(SchRrmPolicyOfSlice*));
842 if(schSliceCfgReq->listOfConfirguration == NULLP)
844 DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
847 for(cfgIdx = 0; cfgIdx<schSliceCfgReq->numOfConfiguredSlice; cfgIdx++)
849 MAC_ALLOC(schSliceCfgReq->listOfConfirguration[cfgIdx], sizeof(SchRrmPolicyOfSlice));
850 if(schSliceCfgReq->listOfConfirguration[cfgIdx] == NULLP)
852 DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
856 memcpy(&schSliceCfgReq->listOfConfirguration[cfgIdx]->snssai, &macSliceCfgReq->listOfSliceCfg[cfgIdx]->snssai, sizeof(Snssai));
858 if(macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio)
860 MAC_ALLOC(schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio));
861 if(schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo == NULLP)
863 DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
866 schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyMaxRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyMaxRatio;
867 schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyMinRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyMinRatio;
868 schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyDedicatedRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyDedicatedRatio;
874 /*******************************************************************
876 * @brief Processes Slice Cfg Request recived from DU
880 * Function : MacProcSliceCfgReq
883 * Processes Processes Slice Cfg Request recived from DU
885 * @params[in] Post Structure Pointer
886 * MacSliceCfgReq *macSliceCfgReq;
887 * @return ROK - success
890 **********************************************************************/
891 uint8_t MacProcSliceCfgReq(Pst *pst, MacSliceCfgReq *macSliceCfgReq)
895 SchSliceCfgReq *schSliceCfgReq;
897 DU_LOG("\nINFO --> MAC : Received Slice Cfg request from DU APP");
900 MAC_ALLOC(schSliceCfgReq, sizeof(SchSliceCfgReq));
901 if(schSliceCfgReq == NULLP)
903 DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcSliceCfgReq");
908 if(fillSliceCfgInfo(schSliceCfgReq, macSliceCfgReq) == ROK)
910 FILL_PST_MAC_TO_SCH(schPst, EVENT_SLICE_CFG_REQ_TO_SCH);
911 ret = (*macSchSliceCfgReqOpts[schPst.selector])(&schPst, schSliceCfgReq);
914 freeMacSliceCfgReq(macSliceCfgReq, pst);
918 DU_LOG("\nINFO --> MAC : Received MacSliceCfgReq is NULL");
923 /*******************************************************************
925 * @brief Processes Slice ReCfg Request recived from DU
929 * Function : MacProcSliceReCfgReq
932 * Processes Processes Slice ReCfg Request recived from DU
934 * @params[in] Post Structure Pointer
935 * MacSliceCfgReq *macSliceReCfgReq;
936 * @return ROK - success
939 **********************************************************************/
940 uint8_t MacProcSliceReCfgReq(Pst *pst, MacSliceCfgReq *macSliceReCfgReq)
944 SchSliceCfgReq *schSliceReCfgReq;
946 DU_LOG("\nINFO --> MAC : Received Slice ReCfg request from DU APP");
949 MAC_ALLOC(schSliceReCfgReq, sizeof(SchSliceCfgReq));
950 if(schSliceReCfgReq == NULLP)
952 DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcSliceReCfgReq");
957 if(fillSliceCfgInfo(schSliceReCfgReq, macSliceReCfgReq) == ROK)
959 FILL_PST_MAC_TO_SCH(schPst, EVENT_SLICE_RECFG_REQ_TO_SCH);
960 ret = (*macSchSliceReCfgReqOpts[schPst.selector])(&schPst, schSliceReCfgReq);
964 freeMacSliceCfgReq(macSliceReCfgReq, pst);
968 DU_LOG("\nINFO --> MAC : Received MacSliceCfgReq is NULL");
973 /**********************************************************************
975 **********************************************************************/