+
+/**
+ * @brief Mac process the downlink Broadcast Req received from DUAPP
+ *
+ * @details
+ *
+ * Function : MacProcDlBroadcastReq
+ *
+ * This function process the downlink Broadcast Req received from DUAPP
+ *
+ * @param[in] Pst *pst
+ * @param[in] DlBroadcastReq *dlBroadcastReq
+ * @return int
+ * -# ROK
+ **/
+uint8_t MacProcDlBroadcastReq(Pst *pst, MacDlBroadcastReq *dlBroadcastReq)
+{
+ uint8_t ret = ROK, idx=0;
+ uint16_t cellIdx = 0;
+
+ if(dlBroadcastReq)
+ {
+ DU_LOG("\nINFO --> MAC : Received DL braodcast req from DU_APP for cellId[%d]", dlBroadcastReq->cellId);
+
+ GET_CELL_IDX(dlBroadcastReq->cellId, cellIdx);
+
+ if(macCb.macCell[cellIdx] == NULLP || macCb.macCell[cellIdx]->cellId != dlBroadcastReq->cellId)
+ {
+ ret = RFAILED;
+ DU_LOG("\nERROR --> MAC : MacProcDlBroadcastReq(): CellId[%d] does not exist", dlBroadcastReq->cellId);
+ }
+ else
+ {
+ /*TODO - Complete the processing of DL Broadcast Request*/
+ }
+ for(idx = 0; idx<dlBroadcastReq->numSiBlock; idx++)
+ {
+ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq->siSchedulingInfo[idx]->siAreaID, sizeof(uint8_t));
+ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq->siSchedulingInfo[idx], sizeof(SiSchedulingInfo));
+ }
+ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlBroadcastReq, sizeof(MacDlBroadcastReq));
+ }
+ else
+ {
+ ret = RFAILED;
+ DU_LOG("\nERROR --> MAC : MacProcDlBroadcastReq(): Received Null pointer");
+ }
+ return ret;
+}
+
+/**
+ * @brief Mac process the statistics Req received from DUAPP
+ *
+ * @details
+ *
+ * Function : MacProcStatsReq
+ *
+ * This function process the statistics request from duapp
+ *
+ * @param[in] Pst *pst
+ * @param[in] StatsReq *statsReq
+ * @return int
+ * -# ROK
+ **/
+uint8_t MacProcStatsReq(Pst *pst, MacStatsReq *macStatsReq)
+{
+ uint8_t macStatsIdx = 0, schStatsIdx = 0;
+ uint8_t ret = RFAILED;
+ bool measTypeInvalid = false;
+ Pst schPst;
+ SchStatsReq *schStatsReq = NULLP;
+ CauseOfResult cause;
+
+ if(macStatsReq)
+ {
+ DU_LOG("\nINFO --> MAC : Received Statistics Request from DU_APP");
+
+ MAC_ALLOC(schStatsReq, sizeof(SchStatsReq));
+ if(schStatsReq == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : MacProcStatsReq: Failed to allocate memory");
+ cause = RESOURCE_UNAVAILABLE;
+ }
+ else
+ {
+ schStatsReq->numStats = 0;
+ for(macStatsIdx=0; macStatsIdx < macStatsReq->numStats; macStatsIdx++)
+ {
+ /* Checking each measurement type to send only SCH related
+ * measurement config to SCH
+ * This will be useful in future when some measurement type will
+ * be configured for SCH and rest for only MAC */
+ switch(macStatsReq->statsList[macStatsIdx].type)
+ {
+ case MAC_DL_TOTAL_PRB_USAGE:
+ {
+ schStatsReq->statsList[schStatsIdx].type = SCH_DL_TOTAL_PRB_USAGE;
+ break;
+ }
+ case MAC_UL_TOTAL_PRB_USAGE:
+ {
+ schStatsReq->statsList[schStatsIdx].type = SCH_UL_TOTAL_PRB_USAGE;
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> MAC : MacProcStatsReq: Invalid measurement type [%d]", \
+ macStatsReq->statsList[macStatsIdx].type);
+ measTypeInvalid = true;
+ }
+ }
+
+ if(!measTypeInvalid)
+ {
+ schStatsReq->statsList[schStatsIdx].periodicity = macStatsReq->statsList[macStatsIdx].periodicity;
+ schStatsIdx++;
+ measTypeInvalid = false;
+ }
+ }
+ schStatsReq->numStats = schStatsIdx;
+
+ /* If no measurement types are valid, it is failure scenario.
+ * Even if one measurement type is valid, send to SCH */
+ if(schStatsReq->numStats)
+ {
+ FILL_PST_MAC_TO_SCH(schPst, EVENT_STATISTICS_REQ_TO_SCH);
+ ret = SchMessageRouter(&schPst, (void *)schStatsReq);
+ }
+ else
+ {
+ cause = PARAM_INVALID;
+ }
+ }
+ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macStatsReq, sizeof(MacStatsReq));
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC : MacProcStatsReq(): Received Null pointer");
+ cause = PARAM_INVALID;
+ }
+
+ if(ret == RFAILED)
+ {
+ /* Send negative acknowledgment to DU APP. TBD in next gerrit */
+ }
+ return ret;
+}
+