JIRA ID:[ODUHIGH-259, ODUHIGH-260]
[o-du/l2.git] / src / 5gnrmac / mac_msg_hdl.c
index 72765d3..aef583b 100644 (file)
@@ -35,7 +35,7 @@
 
 /* This file contains message handling functionality for MAC */
 
-extern MacCb  macCb;
+MacCb  macCb;
 
 uint16_t buildMacPdu(RlcData *dlData);
 #ifdef EGTP_TEST
@@ -153,6 +153,7 @@ uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd)
    crcIndInfo.numCrcInd = crcInd->crcInfo[0].numCb;
    crcIndInfo.crcInd[0] = crcInd->crcInfo[0].cbCrcStatus[0];
 
+   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, crcInd, sizeof(CrcInd));
    return(sendCrcIndMacToSch(&crcIndInfo));
 }
 
@@ -183,7 +184,10 @@ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
    for(pduIdx = 0; pduIdx < rxDataInd->numPdus; pduIdx++)
    {
       unpackRxData(rxDataInd->cellId, rxDataInd->timingInfo, &rxDataInd->pdus[pduIdx]);
+      MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd->pdus[pduIdx].pduData,\
+         rxDataInd->pdus[pduIdx].pduLength);
    }
+   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, rxDataInd, sizeof(RxDataInd));
    return ROK;
 }
 
@@ -411,54 +415,62 @@ uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotIndInfo slotInfo)
  *
  * @details
  *
- *    Function : MacProcCellStartReq
+ *    Function : MacProcCellStart
  *
  *    Functionality:
  *      Handles cell start reuqest from DU APP
  *
  * @params[in] Post structure pointer
- *             Cell Start Request info pointer 
+ *             Cell Id 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t MacProcCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
+uint8_t MacProcCellStart(Pst *pst, OduCellId  *cellId)
 {
    DU_LOG("\nMAC : Handling cell start request");
-   sendToLowerMac(START_REQUEST, 0, cellStartInfo);
+   gSlotCount = 0;
+   sendToLowerMac(START_REQUEST, 0, cellId);
 
-   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellStartInfo, \
-        sizeof(MacCellStartInfo));
+   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
+        sizeof(OduCellId));
 
    return ROK;
 }
 
 /*******************************************************************
  *
- * @brief Handles cell stop request from DU APP
+ * @brief Handles cell stop from DU APP
  *
  * @details
  *
- *    Function : MacProcCellStartReq
+ *    Function : MacProcCellStop
  *
  *    Functionality:
- *        Handles cell stop request from DU APP
+ *        Handles cell stop from DU APP
  *
  * @params[in] Post structure pointer
- *             Mac Cell stop information
+ *             Cell Id
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t MacProcCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
+uint8_t MacProcCellStop(Pst *pst, OduCellId  *cellId)
 {
 #ifdef INTEL_FAPI
+   uint16_t      cellIdx; 
+   SlotIndInfo   slotInfo;
+
    DU_LOG("\nMAC : Sending cell stop request to Lower Mac");
-   sendToLowerMac(FAPI_STOP_REQUEST, 0, cellStopInfo);
+   GET_CELL_IDX(cellId->cellId, cellIdx);
+   slotInfo.cellId = cellId->cellId;
+   slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn;
+   slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot;
+   sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo);
 #endif
 
-   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellStopInfo, \
-        sizeof(MacCellStopInfo));
+   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
+        sizeof(OduCellId));
 
    return ROK;
 }
@@ -708,6 +720,7 @@ uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
       DU_LOG("\nMAC: Received Uci Ind is NULL at FapiMacUciInd()");
       ret = RFAILED;
    }
+   MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macUciInd, sizeof(UciInd));
    return ret;
 }