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 == SRB1_LCID || lcId == SRB2_LCID)
348 ulData->pduInfo[ulData->numPdu].commCh = true;
350 ulData->pduInfo[ulData->numPdu].lcId = lcId;
351 ulData->pduInfo[ulData->numPdu].pduBuf = pdu;
352 ulData->pduInfo[ulData->numPdu].pduLen = pduLen;
355 /* Filling Post and send to RLC */
356 memset(&pst, 0, sizeof(Pst));
357 FILL_PST_MAC_TO_RLC(pst, 0, EVENT_UL_DATA_TO_RLC);
358 MacSendUlDataToRlc(&pst, ulData);
364 /*******************************************************************
366 * @brief Processes BO status from RLC
370 * Function : MacProcRlcBOStatus
373 * Processes BO status from RLC
375 * @params[in] Post structure
377 * @return ROK - success
380 * ****************************************************************/
381 uint8_t MacProcRlcBoStatus(Pst* pst, RlcBoStatus* boStatus)
383 DlRlcBoInfo dlBoInfo;
385 dlBoInfo.cellId = boStatus->cellId;
386 GET_CRNTI(dlBoInfo.crnti, boStatus->ueId);
387 dlBoInfo.lcId = boStatus->lcId;
388 dlBoInfo.dataVolume = boStatus->bo;
390 sendDlRlcBoInfoToSch(&dlBoInfo);
392 if(pst->selector == ODU_SELECTOR_LWLC)
394 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, boStatus, sizeof(RlcBoStatus));
400 /*******************************************************************
402 * @brief Send LC schedule result report to RLC
406 * Function : sendSchRptToRlc
408 * Functionality: Send LC schedule result report to RLC
411 * @return ROK - success
414 * ****************************************************************/
415 uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotTimingInfo slotInfo, uint8_t ueIdx, uint8_t schInfoIdx)
419 RlcSchedResultRpt *schedRpt = NULLP;
421 MAC_ALLOC_SHRABL_BUF(schedRpt, sizeof(RlcSchedResultRpt));
424 DU_LOG("\nERROR --> MAC: Memory allocation failure in sendSchResultRepToRlc");
428 DU_LOG("\nDEBUG --> MAC: Send scheduled result report for sfn %d slot %d", slotInfo.sfn, slotInfo.slot);
429 schedRpt->cellId = dlInfo.cellId;
430 schedRpt->slotInfo.sfn = slotInfo.sfn;
431 schedRpt->slotInfo.slot = slotInfo.slot;
433 if(dlInfo.dlMsgAlloc[ueIdx])
435 schedRpt->rnti = dlInfo.dlMsgAlloc[ueIdx]->crnti;
436 schedRpt->numLc = dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].numLc;
437 for(lcIdx = 0; lcIdx < schedRpt->numLc; lcIdx++)
439 schedRpt->lcSch[lcIdx].lcId = dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].lcSchInfo[lcIdx].lcId;
440 schedRpt->lcSch[lcIdx].bufSize = dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].lcSchInfo[lcIdx].schBytes;
441 schedRpt->lcSch[lcIdx].commCh = false;
446 FILL_PST_MAC_TO_RLC(pst, RLC_DL_INST, EVENT_SCHED_RESULT_TO_RLC);
447 if(MacSendSchedResultRptToRlc(&pst, schedRpt) != ROK)
449 DU_LOG("\nERROR --> MAC: Failed to send Schedule result report to RLC");
450 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, schedRpt, sizeof(RlcSchedResultRpt));
457 /*******************************************************************
459 * @brief Handles cell start reuqest from DU APP
463 * Function : MacProcCellStart
466 * Handles cell start reuqest from DU APP
468 * @params[in] Post structure pointer
470 * @return ROK - success
473 * ****************************************************************/
474 uint8_t MacProcCellStart(Pst *pst, OduCellId *cellId)
476 DU_LOG("\nINFO --> MAC : Handling cell start request");
478 sendToLowerMac(START_REQUEST, 0, cellId);
480 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
486 /*******************************************************************
488 * @brief Handles cell stop from DU APP
492 * Function : MacProcCellStop
495 * Handles cell stop from DU APP
497 * @params[in] Post structure pointer
499 * @return ROK - success
502 * ****************************************************************/
503 uint8_t MacProcCellStop(Pst *pst, OduCellId *cellId)
508 DU_LOG("\nINFO --> MAC : Sending cell stop request to Lower Mac");
509 GET_CELL_IDX(cellId->cellId, cellIdx);
510 if(macCb.macCell[cellIdx])
512 macCb.macCell[cellIdx]->state = CELL_TO_BE_STOPPED;
516 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
522 /*******************************************************************
524 * @brief Handles DL CCCH Ind from DU APP
528 * Function : MacProcDlCcchInd
531 * Handles DL CCCH Ind from DU APP
533 * @params[in] Post structure pointer
534 * DL CCCH Ind pointer
535 * @return ROK - success
538 * ****************************************************************/
539 uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
541 uint8_t ueId = 0, ueIdx = 0;
544 DlRlcBoInfo dlBoInfo;
545 memset(&dlBoInfo, 0, sizeof(DlRlcBoInfo));
547 DU_LOG("\nDEBUG --> MAC : Handling DL CCCH IND");
549 GET_CELL_IDX(dlCcchIndInfo->cellId, cellIdx);
551 dlBoInfo.cellId = dlCcchIndInfo->cellId;
552 dlBoInfo.crnti = dlCcchIndInfo->crnti;
554 if(dlCcchIndInfo->msgType == RRC_SETUP)
556 dlBoInfo.lcId = SRB0_LCID; // SRB ID 0 for msg4
557 /* (MSG4 pdu + 3 bytes sub-header) + (Contention resolution id MAC CE + 1 byte sub-header) */
558 dlBoInfo.dataVolume = (dlCcchIndInfo->dlCcchMsgLen + 3) + (MAX_CRI_SIZE + 1);
560 /* storing Msg4 Pdu in raCb */
561 GET_UE_ID(dlBoInfo.crnti, ueId);
563 if(macCb.macCell[cellIdx]->macRaCb[ueIdx].crnti == dlCcchIndInfo->crnti)
565 macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen = dlCcchIndInfo->dlCcchMsgLen;
566 MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu, \
567 macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PduLen);
568 if(macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu)
570 for(idx = 0; idx < dlCcchIndInfo->dlCcchMsgLen; idx++)
572 macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4Pdu[idx] =\
573 dlCcchIndInfo->dlCcchMsg[idx];
578 sendDlRlcBoInfoToSch(&dlBoInfo);
580 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo->dlCcchMsg, \
581 dlCcchIndInfo->dlCcchMsgLen);
582 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo, sizeof(DlCcchIndInfo));
587 /*******************************************************************
589 * @brief Sends UL CCCH Ind to DU APP
593 * Function : macProcUlCcchInd
596 * MAC sends UL CCCH Ind to DU APP
598 * @params[in] Post structure pointer
600 * @return ROK - success
603 * ****************************************************************/
604 uint8_t macProcUlCcchInd(uint16_t cellId, uint16_t crnti, uint16_t rrcContSize, uint8_t *rrcContainer)
608 UlCcchIndInfo *ulCcchIndInfo = NULLP;
610 MAC_ALLOC_SHRABL_BUF(ulCcchIndInfo, sizeof(UlCcchIndInfo));
613 DU_LOG("\nERROR --> MAC: Memory failed in macProcUlCcchInd");
617 ulCcchIndInfo->cellId = cellId;
618 ulCcchIndInfo->crnti = crnti;
619 ulCcchIndInfo->ulCcchMsgLen = rrcContSize;
620 ulCcchIndInfo->ulCcchMsg = rrcContainer;
623 FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_UL_CCCH_IND);
625 if(MacDuAppUlCcchInd(&pst, ulCcchIndInfo) != ROK)
627 DU_LOG("\nERROR --> MAC: Failed to send UL CCCH Ind to DU APP");
628 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg, ulCcchIndInfo->ulCcchMsgLen);
629 MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
635 /*******************************************************************
637 * @brief Processes received short BSR
641 * Function : macProcShortBsr
644 * MAC sends Short BSR to SCH
646 * @params[in] cell ID
651 * @return ROK - success
654 * ****************************************************************/
655 uint8_t macProcShortBsr(uint16_t cellId, uint16_t crnti, uint8_t lcgId, uint32_t bufferSize)
658 UlBufferStatusRptInd bsrInd;
660 memset(&pst, 0, sizeof(Pst));
661 memset(&bsrInd, 0, sizeof(UlBufferStatusRptInd));
663 bsrInd.cellId = cellId;
664 bsrInd.crnti = crnti;
665 bsrInd.bsrType = SHORT_BSR;
666 bsrInd.numLcg = 1; /* short bsr reports one lcg at a time */
667 bsrInd.dataVolInfo[0].lcgId = lcgId;
668 bsrInd.dataVolInfo[0].dataVol = bufferSize;
670 FILL_PST_MAC_TO_SCH(pst, EVENT_SHORT_BSR);
671 return(*macSchBsrOpts[pst.selector])(&pst, &bsrInd);
674 /*******************************************************************
676 * @brief Processes received short BSR
680 * Function : macProcShortBsr
683 * MAC sends Short BSR to SCH
685 * @params[in] cell ID
690 * @return ROK - success
693 * ****************************************************************/
694 uint8_t macProcLongBsr(uint16_t cellId, uint16_t crnti,uint8_t numLcg,\
695 DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS])
698 UlBufferStatusRptInd bsrInd;
701 memset(&pst, 0, sizeof(Pst));
702 memset(&bsrInd, 0, sizeof(UlBufferStatusRptInd));
704 bsrInd.cellId = cellId;
705 bsrInd.crnti = crnti;
706 bsrInd.bsrType = LONG_BSR;
707 bsrInd.numLcg = numLcg;
709 for(lcgIdx = 0; lcgIdx < numLcg; lcgIdx++)
710 memcpy(&(bsrInd.dataVolInfo[lcgIdx]), &(dataVolInfo[lcgIdx]), sizeof(DataVolInfo));
712 FILL_PST_MAC_TO_SCH(pst, EVENT_LONG_BSR);
713 return(*macSchBsrOpts[pst.selector])(&pst, &bsrInd);
716 /*******************************************************************
718 * @brief Builds and send SR UCI Indication to SCH
722 * Function : buildAndSendSrInd
725 * Builds and send SR UCI Indication to SCH
727 * @params[in] SrUciIndInfo Pointer
729 * @return ROK - success
732 * ****************************************************************/
733 uint8_t buildAndSendSrInd(UciInd *macUciInd, uint8_t crnti)
737 SrUciIndInfo srUciInd;
738 memset(&pst, 0, sizeof(Pst));
739 memset(&srUciInd, 0, sizeof(SrUciIndInfo));
741 GET_CELL_IDX(macUciInd->cellId, cellIdx);
742 srUciInd.cellId = macCb.macCell[cellIdx]->cellId;
743 srUciInd.crnti = crnti;
744 srUciInd.slotInd.sfn = macUciInd->slotInd.sfn;
745 srUciInd.slotInd.slot = macUciInd->slotInd.slot;
746 srUciInd.numSrBits++;
747 memset(srUciInd.srPayload, 0, MAX_SR_BITS_IN_BYTES);
750 FILL_PST_MAC_TO_SCH(pst, EVENT_UCI_IND_TO_SCH);
752 return(*macSchSrUciIndOpts[pst.selector])(&pst, &srUciInd);
755 /*******************************************************************
757 * @brief Processes UCI Indication from PHY
761 * Function : fapiMacUciInd
764 * Processes UCI Indication from PHY
766 * @params[in] Post Structure Pointer
767 * UCI Indication Pointer
768 * @return ROK - success
771 * ****************************************************************/
772 uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
781 nPdus = macUciInd->numUcis;
784 switch(macUciInd->pdus[pduIdx].pduType)
788 case UCI_IND_PUCCH_F0F1:
789 if(macUciInd->pdus[pduIdx].uci.uciPucchF0F1.srInfo.srIndPres)
791 DU_LOG("\nDEBUG --> MAC : Received SR UCI indication");
792 crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti;
793 ret = buildAndSendSrInd(macUciInd, crnti);
796 case UCI_IND_PUCCH_F2F3F4:
799 DU_LOG("\nERROR --> MAC: Invalid Pdu Type %d at FapiMacUciInd", macUciInd->pdus[pduIdx].pduType);
809 DU_LOG("\nERROR --> MAC: Received Uci Ind is NULL at FapiMacUciInd()");
812 MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macUciInd, sizeof(UciInd));
816 /*******************************************************************
818 * @brief fill Slice Cfg Request info in shared structre
822 * Function : fillSliceCfgInfo
825 * fill Slice Cfg Request info in shared structre
827 * @params[in] SchSliceCfgReq *schSliceCfgReq
828 * MacSliceCfgReq *macSliceCfgReq;
829 * @return ROK - success
832 **********************************************************************/
833 uint8_t fillSliceCfgInfo(SchSliceCfgReq *schSliceCfgReq, MacSliceCfgReq *macSliceCfgReq)
837 if(macSliceCfgReq->listOfSliceCfg)
839 schSliceCfgReq->numOfConfiguredSlice = macSliceCfgReq->numOfConfiguredSlice;
840 MAC_ALLOC(schSliceCfgReq->listOfConfirguration, schSliceCfgReq->numOfConfiguredSlice *sizeof(SchRrmPolicyOfSlice*));
841 if(schSliceCfgReq->listOfConfirguration == NULLP)
843 DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
846 for(cfgIdx = 0; cfgIdx<schSliceCfgReq->numOfConfiguredSlice; cfgIdx++)
848 MAC_ALLOC(schSliceCfgReq->listOfConfirguration[cfgIdx], sizeof(SchRrmPolicyOfSlice));
849 if(schSliceCfgReq->listOfConfirguration[cfgIdx] == NULLP)
851 DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
855 memcpy(&schSliceCfgReq->listOfConfirguration[cfgIdx]->snssai, &macSliceCfgReq->listOfSliceCfg[cfgIdx]->snssai, sizeof(Snssai));
857 if(macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio)
859 MAC_ALLOC(schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo, sizeof(SchRrmPolicyRatio));
860 if(schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo == NULLP)
862 DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
865 schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyMaxRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyMaxRatio;
866 schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyMinRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyMinRatio;
867 schSliceCfgReq->listOfConfirguration[cfgIdx]->rrmPolicyRatioInfo->policyDedicatedRatio = macSliceCfgReq->listOfSliceCfg[cfgIdx]->rrmPolicyRatio->policyDedicatedRatio;
873 /*******************************************************************
875 * @brief Processes Slice Cfg Request recived from DU
879 * Function : MacProcSliceCfgReq
882 * Processes Processes Slice Cfg Request recived from DU
884 * @params[in] Post Structure Pointer
885 * MacSliceCfgReq *macSliceCfgReq;
886 * @return ROK - success
889 **********************************************************************/
890 uint8_t MacProcSliceCfgReq(Pst *pst, MacSliceCfgReq *macSliceCfgReq)
894 SchSliceCfgReq *schSliceCfgReq;
896 DU_LOG("\nINFO --> MAC : Received Slice Cfg request from DU APP");
899 MAC_ALLOC(schSliceCfgReq, sizeof(SchSliceCfgReq));
900 if(schSliceCfgReq == NULLP)
902 DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcSliceCfgReq");
907 if(fillSliceCfgInfo(schSliceCfgReq, macSliceCfgReq) == ROK)
909 FILL_PST_MAC_TO_SCH(schPst, EVENT_SLICE_CFG_REQ_TO_SCH);
910 ret = (*macSchSliceCfgReqOpts[schPst.selector])(&schPst, schSliceCfgReq);
913 freeMacSliceCfgReq(macSliceCfgReq, pst);
917 DU_LOG("\nINFO --> MAC : Received MacSliceCfgReq is NULL");
922 /*******************************************************************
924 * @brief Processes Slice ReCfg Request recived from DU
928 * Function : MacProcSliceReCfgReq
931 * Processes Processes Slice ReCfg Request recived from DU
933 * @params[in] Post Structure Pointer
934 * MacSliceCfgReq *macSliceReCfgReq;
935 * @return ROK - success
938 **********************************************************************/
939 uint8_t MacProcSliceReCfgReq(Pst *pst, MacSliceCfgReq *macSliceReCfgReq)
943 SchSliceCfgReq *schSliceReCfgReq;
945 DU_LOG("\nINFO --> MAC : Received Slice ReCfg request from DU APP");
948 MAC_ALLOC(schSliceReCfgReq, sizeof(SchSliceCfgReq));
949 if(schSliceReCfgReq == NULLP)
951 DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcSliceReCfgReq");
956 if(fillSliceCfgInfo(schSliceReCfgReq, macSliceReCfgReq) == ROK)
958 FILL_PST_MAC_TO_SCH(schPst, EVENT_SLICE_RECFG_REQ_TO_SCH);
959 ret = (*macSchSliceReCfgReqOpts[schPst.selector])(&schPst, schSliceReCfgReq);
963 freeMacSliceCfgReq(macSliceReCfgReq, pst);
967 DU_LOG("\nINFO --> MAC : Received MacSliceCfgReq is NULL");
972 /**********************************************************************
974 **********************************************************************/