uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp);
uint8_t MacProcDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc);
uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp);
+
+uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp);
#endif
/**********************************************************************
End of file
packDuMacSliceRecfgRsp /* packing for light weight loosly coupled */
};
+MacDuStatsRspFunc macDuStatsRspOpts[] =
+{
+ packDuMacStatsRsp, /* packing for loosely coupled */
+ DuProcMacStatsRsp, /* packing for tightly coupled */
+ packDuMacStatsRsp /* packing for light weight loosly coupled */
+};
+
+
/**
* @brief Layer Manager Configuration request handler for Scheduler
*
return ret;
}
+/**
+ * @brief Fill and send statistics response to DU APP
+ *
+ * @details
+ *
+ * Function : MacSendStatsRspToDuApp
+ *
+ * Fill and send statistics response to DU APP
+ *
+ * @param[in] Response
+ * @param[in] Cause of response
+ * @return int
+ * -# ROK
+ **/
+uint8_t MacSendStatsRspToDuApp(MacRsp rsp, CauseOfResult cause)
+{
+ uint8_t ret = ROK;
+ Pst pst;
+ MacStatsRsp *macStatsRsp = NULLP;
+
+ /* Workaround : To skip corrupted memory, allocating a pointer that will
+ * remain unused */
+ uint8_t *dummyPtr = NULLP;
+ MAC_ALLOC_SHRABL_BUF(dummyPtr, sizeof(uint8_t));
+
+ MAC_ALLOC_SHRABL_BUF(macStatsRsp, sizeof(MacStatsRsp));
+ if(macStatsRsp == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsRsp");
+ ret = RFAILED;
+ }
+ else
+ {
+ macStatsRsp->rsp = rsp;
+ macStatsRsp->cause = cause;
+
+ memset(&pst, 0, sizeof(Pst));
+ FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STATISTICS_RSP);
+ if(((*macDuStatsRspOpts[pst.selector])(&pst, macStatsRsp))!= ROK)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to send statistics response to DU APP");
+ MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsRsp, sizeof(MacStatsRsp));
+ ret = RFAILED;
+ }
+ }
+
+ /* Workaround : Freeing the dummy pointer */
+ MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, dummyPtr, sizeof(uint8_t));
+ return ret;
+}
+
/**
* @brief Mac process the statistics Req received from DUAPP
*
if(ret == RFAILED)
{
- /* Send negative acknowledgment to DU APP. TBD in next gerrit */
+ MacSendStatsRspToDuApp(MAC_DU_APP_RSP_NOK, cause);
+ }
+ return ret;
+}
+
+/**
+ * @brief Mac process the statistics rsp received from sch.
+ *
+ * @details
+ *
+ * Function : MacProcSchStatsRsp
+ *
+ * This function process the statistics response received from sch
+ *
+ * @param[in] Pst *pst
+ * @param[in] SchStatsRsp *schStatsRsp
+ * @return int
+ * -# ROK
+ **/
+uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp)
+{
+ uint8_t ret = RFAILED;
+
+ if(schStatsRsp)
+ {
+ if(schStatsRsp->rsp == RSP_OK)
+ ret = MacSendStatsRspToDuApp(MAC_DU_APP_RSP_OK, schStatsRsp->cause);
+ else
+ ret = MacSendStatsRspToDuApp(MAC_DU_APP_RSP_NOK, schStatsRsp->cause);
+
+ MAC_FREE(schStatsRsp, sizeof(SchStatsRsp));
}
return ret;
}
strcpy(message,"EVENT_DL_REL_HQ_PROC");
break;
}
+ case EVENT_STATISTICS_RSP_TO_MAC:
+ {
+ strcpy(message,"EVENT_STATISTICS_RSP_TO_MAC");
+ break;
+ }
default:
strcpy(message,"Invalid Event");
break;
MacSchReleaseDlHarqProc(pst, (SchRlsHqInfo *)msg);
break;
}
+ case EVENT_STATISTICS_RSP_TO_MAC:
+ {
+ MacProcSchStatsRsp(pst, (SchStatsRsp *)msg);
+ break;
+ }
default:
{
return RFAILED;
return ret;
}
+/*******************************************************************
+ *
+ * @brief Fill and send statistics response to MAC
+ *
+ * @details
+ *
+ * Function : SchSendStatsRspToMac
+ *
+ * Functionality: Fill and send statistics response to MAC
+ *
+ * @params[in] Inst inst, SchMacRsp result
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t SchSendStatsRspToMac(Inst inst, SchMacRsp result, CauseOfResult cause)
+{
+ Pst rspPst;
+ uint8_t ret = ROK;
+ SchStatsRsp *statsRsp;
+
+ DU_LOG("\nINFO --> SCH : Filling statistics response");
+ SCH_ALLOC(statsRsp, sizeof(SchStatsRsp));
+ if(statsRsp == NULLP)
+ {
+ DU_LOG("\nERROR --> SCH : Failed to allocate memory in SchSendStatsRspToMac()");
+ return RFAILED;
+ }
+ memset(statsRsp, 0, sizeof(SchStatsRsp));
+ statsRsp->rsp = result;
+ statsRsp->cause = cause;
+
+ /* Filling response post */
+ memset(&rspPst, 0, sizeof(Pst));
+ FILL_PST_SCH_TO_MAC(rspPst, inst);
+ rspPst.event = EVENT_STATISTICS_RSP_TO_MAC;
+
+ ret = MacMessageRouter(&rspPst, (void *)statsRsp);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> SCH : SchSendStatsRspToMac(): Failed to send Statistics Response");
+ return ret;
+ }
+ return ret;
+}
+
/*******************************************************************
*
* @brief Processes Statistics Request from MAC
SCH_FREE(statsReq, sizeof(SchStatsReq));
- /* TODO : in next gerrit */
- //SchSendStatsRspToMac(inst, rsp, cause);
+ SchSendStatsRspToMac(inst, rsp, cause);
return ROK;
} /* End of SchProcStatsReq */
**/
uint8_t schTmrExpiry(PTR cb, uint8_t tmrEvnt)
{
- DU_LOG("\nINFO --> SCH : Timer Event [%d] expired", tmrEvnt);
-
- struct timeval tp;
- gettimeofday(&tp, 0);
- time_t curtime = tp.tv_sec;
- struct tm *t = localtime(&curtime);
-
switch (tmrEvnt)
{
case EVENT_DL_TOTAL_PRB_USAGE_TMR:
return RFAILED;
}
+/*******************************************************************
+*
+* @brief Packs and Sends Statistics Response from MAC to DUAPP
+*
+* @details
+*
+* Function : packDuMacStatsRsp
+*
+* Functionality:
+* Packs and Sends statistics response from MAC to DUAPP
+*
+*
+* @params[in] Post structure pointer
+* StatsRsp pointer
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t packDuMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
+{
+ Buffer *mBuf = NULLP;
+
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : Memory allocation failed at packDuMacStatsRsp");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)statsRsp, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacStatsRsp");
+ return RFAILED;
+ }
+ return ODU_POST_TASK(pst,mBuf);
+}
+
+/*******************************************************************
+*
+* @brief Unpacks Statistics Response received from MAC
+*
+* @details
+*
+* Function : unpackDuMacStatsRsp
+*
+* Functionality:
+* Unpacks Statistics Response received from MAC
+*
+* @params[in] Pointer to Handler
+* Post structure pointer
+* Message Buffer
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ MacStatsRsp *statsRsp;
+
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&statsRsp, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, statsRsp);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\nERROR --> DU APP : Only LWLC supported for Statistics Response ");
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+
+ return RFAILED;
+}
+
/**********************************************************************
End of file
**********************************************************************/
#define EVENT_MAC_UE_SYNC_STATUS_IND 227
#define EVENT_MAC_DL_BROADCAST_REQ 228
#define EVENT_MAC_STATISTICS_REQ 229
+#define EVENT_MAC_STATISTICS_RSP 230
#define BSR_PERIODIC_TIMER_SF_10 10
#define BSR_RETX_TIMER_SF_320 320
MacStatsInfo statsList[MAX_NUM_STATS];
}MacStatsReq;
+typedef struct macStatsRsp
+{
+ MacRsp rsp;
+ CauseOfResult cause;
+}MacStatsRsp;
+
/****************** FUNCTION POINTERS ********************************/
/* DL broadcast req from DU APP to MAC*/
Pst *pst,
MacStatsReq *statsReq));
+/* Statistics Response from MAC to DU APP */
+typedef uint8_t (*MacDuStatsRspFunc) ARGS((
+ Pst *pst,
+ MacStatsRsp *statsRsp));
+
/******************** FUNCTION DECLARATIONS ********************************/
uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId);
uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf);
uint8_t MacProcStatsReq(Pst *pst, MacStatsReq *statsReq);
uint8_t unpackMacStatsReq(DuMacStatsReqFunc func, Pst *pst, Buffer *mBuf);
+uint8_t packDuMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
+uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
+uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf);
+
#endif
#define EVENT_UL_CQI_TO_SCH 33
#define EVENT_PHR_IND_TO_SCH 34
#define EVENT_STATISTICS_REQ_TO_SCH 35
+#define EVENT_STATISTICS_RSP_TO_MAC 36
/*macros*/
#define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
SchStatsInfo statsList[MAX_NUM_STATS];
}SchStatsReq;
+typedef struct schStatsRsp
+{
+ SchMacRsp rsp;
+ CauseOfResult cause;
+}SchStatsRsp;
+
/* function declarations */
uint8_t MacMessageRouter(Pst *pst, void *msg);
uint8_t SchMessageRouter(Pst *pst, void *msg);
strcpy(message,"EVENT_MAC_SLICE_RECFG_RSP");
break;
}
+ case EVENT_MAC_STATISTICS_RSP:
+ {
+ strcpy(message,"EVENT_MAC_STATISTICS_RSP");
+ break;
+ }
default:
{
strcpy(message,"Invalid Event");
ret = unpackDuMacUeResetRsp(DuProcMacUeResetRsp, pst, mBuf);
break;
}
+ case EVENT_MAC_STATISTICS_RSP:
+ {
+ ret = unpackDuMacStatsRsp(DuProcMacStatsRsp, pst, mBuf);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
return ROK;
}
+/*******************************************************************
+ *
+ * @brief Process statistics response from MAC
+ *
+ * @details
+ *
+ * Function : DuProcMacStatsRsp
+ *
+ * Functionality: Processes statistics configuration response
+ * from MAC. If configuration is succsessful, DUAPP starts
+ * reporting period timer for this subscription request
+ * from RIC
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
+{
+ if(statsRsp)
+ {
+ if(statsRsp->rsp == MAC_DU_APP_RSP_OK)
+ {
+ DU_LOG("\nINFO --> DU_APP : Statistics configured successfully");
+ /* TODO : Start Reporting period timer for this subscription request
+ * To be handled in next gerrit */
+ }
+ else
+ {
+ DU_LOG("\nERROR --> DU_APP : Statistics configuration failed with cause [%d]", statsRsp->cause);
+ }
+ DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsRsp, sizeof(MacStatsRsp));
+ return ROK;
+ }
+
+ DU_LOG("\nINFO --> DU_APP : DuProcMacStatsRsp: Received NULL Pointer");
+ return RFAILED;
+}
+
/**********************************************************************
End of file
**********************************************************************/