# macro for output file name and makefile name
#
-PLTFRM_FLAGS= -UMSPD -DODU -DINTEL_FAPI -UODU_MEMORY_DEBUG_LOG -DDEBUG_ASN_PRINT -DDEBUG_PRINT -DERROR_PRINT -USTART_DL_UL_DATA -UNR_DRX -UCALL_FLOW_DEBUG_LOG -UODU_SLOT_IND_DEBUG_LOG
+PLTFRM_FLAGS= -UMSPD -DODU -DINTEL_FAPI -UODU_MEMORY_DEBUG_LOG -DDEBUG_ASN_PRINT -UDEBUG_PRINT -DERROR_PRINT -USTART_DL_UL_DATA -UNR_DRX -UCALL_FLOW_DEBUG_LOG -UODU_SLOT_IND_DEBUG_LOG
ifeq ($(MODE),TDD)
PLTFRM_FLAGS += -DNR_TDD
uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp);
uint8_t MacProcSchStatsRsp(Pst *pst, SchStatsRsp *schStatsRsp);
+uint8_t MacProcSchStatsInd(Pst *pst, SchStatsInd *schStatsInd);
#endif
/**********************************************************************
End of file
MacCb macCb;
+MacDuStatsIndFunc macDuStatsIndOpts[] =
+{
+ packDuMacStatsInd, /* packing for loosely coupled */
+ DuProcMacStatsInd, /* packing for tightly coupled */
+ packDuMacStatsInd /* packing for light weight loosly coupled */
+};
+
+
/*******************************************************************
*
* @brief Sends DL BO Info to SCH
return ret;
}
+/**
+ * @brief Mac process the statistics indication received from sch.
+ *
+ * @details
+ *
+ * Function : MacProcSchStatsInd
+ *
+ * This function process the statistics indication received from sch
+ *
+ * @param[in] Pst *pst
+ * @param[in] SchStatsInd *schStatsInd
+ * @return int
+ * -# ROK
+ **/
+uint8_t MacProcSchStatsInd(Pst *pst, SchStatsInd *schStatsInd)
+{
+ Pst indPst;
+ MacStatsInd *macStatsInd;
+
+#ifdef DEBUG_PRINT
+ DU_LOG("\nDEBUG --> MAC : MacProcSchStatsInd: Received Statistics Indication from SCH");
+#endif
+
+ if(schStatsInd == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : MacProcSchStatsInd: NULL pointer :schStatsInd");
+ return RFAILED;
+ }
+
+ MAC_ALLOC_SHRABL_BUF(macStatsInd, sizeof(MacStatsInd));
+ if(macStatsInd == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchStatsInd");
+ return RFAILED;
+ }
+
+ switch(schStatsInd->type)
+ {
+ case SCH_DL_TOTAL_PRB_USAGE:
+ {
+ macStatsInd->type = MAC_DL_TOTAL_PRB_USAGE;
+ break;
+ }
+ case SCH_UL_TOTAL_PRB_USAGE:
+ {
+ macStatsInd->type = MAC_UL_TOTAL_PRB_USAGE;
+ break;
+ }
+ default:
+ {
+ DU_LOG("\nERROR --> MAC : MacProcSchStatsInd: Invalid measurement type [%d]", schStatsInd->type);
+ MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, macStatsInd, sizeof(MacStatsInd));
+ return RFAILED;
+ }
+ }
+ macStatsInd->value = schStatsInd->value;
+
+ memset(&indPst, 0, sizeof(Pst));
+ FILL_PST_MAC_TO_DUAPP(indPst, EVENT_MAC_STATISTICS_IND);
+ return (*macDuStatsIndOpts[indPst.selector])(&indPst, macStatsInd);
+}
+
/**********************************************************************
End of file
**********************************************************************/
strcpy(message,"EVENT_STATISTICS_RSP_TO_MAC");
break;
}
+ case EVENT_STATISTICS_IND_TO_MAC:
+ {
+ strcpy(message,"EVENT_STATISTICS_IND_TO_MAC");
+ break;
+ }
default:
strcpy(message,"Invalid Event");
break;
MacProcSchStatsRsp(pst, (SchStatsRsp *)msg);
break;
}
+ case EVENT_STATISTICS_IND_TO_MAC:
+ {
+ MacProcSchStatsInd(pst, (SchStatsInd *)msg);
+ break;
+ }
default:
{
return RFAILED;
return ROK;
} /* End of SchProcStatsReq */
+/*******************************************************************
+ *
+ * @brief Fill and send statistics indication to MAC
+ *
+ * @details
+ *
+ * Function : SchSendStatsIndToMac
+ *
+ * Functionality: Fill and send statistics indication to MAC
+ *
+ * @params[in] SCH Instance
+ * Measurement Type
+ * Measurement Value
+ * Size of value parameter
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t SchSendStatsIndToMac(Inst inst, SchMeasurementType measType, double value)
+{
+ Pst pst;
+ uint8_t ret = ROK;
+ SchStatsInd statsInd;
+
+#ifdef DEBUG_PRINT
+ DU_LOG("\nDEBUG --> SCH : Filling statistics indication");
+#endif
+
+ memset(&statsInd, 0, sizeof(SchStatsInd));
+ statsInd.type = measType;
+ statsInd.value = value;
+
+ /* Filling post structure */
+ memset(&pst, 0, sizeof(Pst));
+ FILL_PST_SCH_TO_MAC(pst, inst);
+ pst.event = EVENT_STATISTICS_IND_TO_MAC;
+
+ ret = MacMessageRouter(&pst, (void *)&statsInd);
+ if(ret == RFAILED)
+ {
+ DU_LOG("\nERROR --> SCH : SchSendStatsIndToMac(): Failed to send Statistics Indication");
+ }
+ return ret;
+}
+
+
/**********************************************************************
End of file
**********************************************************************/
/* Statistics Function */
uint8_t SchProcStatsReq(Pst *pst, SchStatsReq *statsReq);
+uint8_t SchSendStatsIndToMac(Inst inst, SchMeasurementType measType, double value);
/**********************************************************************
End of file
/* Update DL statistics */
if(schCb[schInst].statistics.dlTotalPrbUsage)
{
- schCb[schInst].statistics.dlTotalPrbUsage->numPrbUsedForTx += cell->schUlSlotInfo[slot]->prbAlloc.numPrbAlloc;
+ schCb[schInst].statistics.dlTotalPrbUsage->numPrbUsedForTx += cell->schDlSlotInfo[slot]->prbAlloc.numPrbAlloc;
schCb[schInst].statistics.dlTotalPrbUsage->totalPrbAvailForTx += MAX_NUM_RB;
}
arg.wait = 0;
- DU_LOG("\nINFO --> SCH : Starting Timer Event [%d] with Wait Time [%d] ms", \
+#ifdef DEBUG_PRINT
+ DU_LOG("\nDEBUG --> SCH : Starting Timer Event [%d] with Wait Time [%d] ms", \
tmrEvnt, timerValue);
+#endif
switch (tmrEvnt)
{
arg.timers = NULLP;
- DU_LOG("\nINFO --> SCH : Stopping Timer Event [%d]", tmrType);
+#ifdef DEBUG_PRINT
+ DU_LOG("\nDEBUG --> SCH : Stopping Timer Event [%d]", tmrType);
+#endif
switch (tmrType)
{
*/
uint8_t SchProcDlTotalPrbUsageTmrExp(TotalPrbUsage *dlTotalPrbUsage)
{
- uint8_t percentageOfTotalPrbUsed = 0;
+ double percentageOfTotalPrbUsed = 0;
if(dlTotalPrbUsage->totalPrbAvailForTx)
- percentageOfTotalPrbUsed = ((dlTotalPrbUsage->numPrbUsedForTx * 100) / dlTotalPrbUsage->totalPrbAvailForTx);
- //SchSendStatsIndToMac(dlTotalPrbUsage->schInst, SCH_DL_TOTAL_PRB_USAGE, percentageOfTotalPrbUsed);
+ percentageOfTotalPrbUsed = ((100.0 * dlTotalPrbUsage->numPrbUsedForTx) / dlTotalPrbUsage->totalPrbAvailForTx);
+ SchSendStatsIndToMac(dlTotalPrbUsage->schInst, SCH_DL_TOTAL_PRB_USAGE, percentageOfTotalPrbUsed);
/* Restart Timer */
dlTotalPrbUsage->numPrbUsedForTx = 0;
*/
uint8_t SchProcUlTotalPrbUsageTmrExp(TotalPrbUsage *ulTotalPrbUsage)
{
- uint8_t percentageOfTotalPrbUsed = 0;
+ double percentageOfTotalPrbUsed = 0;
if(ulTotalPrbUsage->totalPrbAvailForTx)
- percentageOfTotalPrbUsed = ((ulTotalPrbUsage->numPrbUsedForTx * 100) / ulTotalPrbUsage->totalPrbAvailForTx);
- //SchSendStatsIndToMac(ulTotalPrbUsage->schInst, SCH_UL_TOTAL_PRB_USAGE, percentageOfTotalPrbUsed);
+ percentageOfTotalPrbUsed = ((100.0 * ulTotalPrbUsage->numPrbUsedForTx) / ulTotalPrbUsage->totalPrbAvailForTx);
+ SchSendStatsIndToMac(ulTotalPrbUsage->schInst, SCH_UL_TOTAL_PRB_USAGE, percentageOfTotalPrbUsed);
/* Restart Timer */
ulTotalPrbUsage->numPrbUsedForTx = 0;
**/
uint8_t schTmrExpiry(PTR cb, uint8_t tmrEvnt)
{
+#ifdef DEBUG_PRINT
+ DU_LOG("\nDEBUG --> SCH : Timer Expired. Event [%d]", tmrEvnt);
+#endif
+
switch (tmrEvnt)
{
case EVENT_DL_TOTAL_PRB_USAGE_TMR:
return RFAILED;
}
+/*******************************************************************
+*
+* @brief Packs and Sends Statistics Indication from MAC to DUAPP
+*
+* @details
+*
+* Function : packDuMacStatsInd
+*
+* Functionality:
+* Packs and Sends statistics response from MAC to DUAPP
+*
+*
+* @params[in] Post structure pointer
+* StatsInd pointer
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t packDuMacStatsInd(Pst *pst, MacStatsInd *statsInd)
+{
+ 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 packDuMacStatsInd");
+ return RFAILED;
+ }
+ /* pack the address of the structure */
+ CMCHKPK(oduPackPointer,(PTR)statsInd, mBuf);
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Only LWLC supported for packDuMacStatsInd");
+ return RFAILED;
+ }
+ return ODU_POST_TASK(pst,mBuf);
+}
+
+/*******************************************************************
+*
+* @brief Unpacks Statistics Indication received from MAC
+*
+* @details
+*
+* Function : unpackDuMacStatsInd
+*
+* Functionality:
+* Unpacks Statistics Indication received from MAC
+*
+* @params[in] Pointer to Handler
+* Post structure pointer
+* Message Buffer
+* @return ROK - success
+* RFAILED - failure
+*
+* ****************************************************************/
+uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf)
+{
+ if(pst->selector == ODU_SELECTOR_LWLC)
+ {
+ MacStatsInd *statsInd;
+
+ /* unpack the address of the structure */
+ CMCHKUNPK(oduUnpackPointer, (PTR *)&statsInd, mBuf);
+ ODU_PUT_MSG_BUF(mBuf);
+ return (*func)(pst, statsInd);
+ }
+ else
+ {
+ /* Nothing to do for other selectors */
+ DU_LOG("\nERROR --> DU APP : Only LWLC supported for Statistics Indication ");
+ ODU_PUT_MSG_BUF(mBuf);
+ }
+
+ return RFAILED;
+}
+
/**********************************************************************
End of file
**********************************************************************/
#define EVENT_MAC_DL_BROADCAST_REQ 228
#define EVENT_MAC_STATISTICS_REQ 229
#define EVENT_MAC_STATISTICS_RSP 230
+#define EVENT_MAC_STATISTICS_IND 231
#define BSR_PERIODIC_TIMER_SF_10 10
#define BSR_RETX_TIMER_SF_320 320
CauseOfResult cause;
}MacStatsRsp;
+typedef struct macStatsInd
+{
+ MacMeasurementType type;
+ double value;
+}MacStatsInd;
+
/****************** FUNCTION POINTERS ********************************/
/* DL broadcast req from DU APP to MAC*/
Pst *pst,
MacStatsRsp *statsRsp));
+/* Statistics Ind from MAC to DU APP */
+typedef uint8_t (*MacDuStatsIndFunc) ARGS((
+ Pst *pst,
+ MacStatsInd *statsInd));
+
/******************** FUNCTION DECLARATIONS ********************************/
uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId);
uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf);
uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp);
uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf);
+uint8_t packDuMacStatsInd(Pst *pst, MacStatsInd *statsRsp);
+uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsRsp);
+uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf);
#endif
#define EVENT_PHR_IND_TO_SCH 34
#define EVENT_STATISTICS_REQ_TO_SCH 35
#define EVENT_STATISTICS_RSP_TO_MAC 36
+#define EVENT_STATISTICS_IND_TO_MAC 37
/*macros*/
#define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
CauseOfResult cause;
}SchStatsRsp;
+typedef struct schStatsInd
+{
+ SchMeasurementType type;
+ double value;
+}SchStatsInd;
+
/* function declarations */
uint8_t MacMessageRouter(Pst *pst, void *msg);
uint8_t SchMessageRouter(Pst *pst, void *msg);
strcpy(message,"EVENT_MAC_STATISTICS_RSP");
break;
}
+ case EVENT_MAC_STATISTICS_IND:
+ {
+ strcpy(message,"EVENT_MAC_STATISTICS_IND");
+ break;
+ }
default:
{
strcpy(message,"Invalid Event");
ret = unpackDuMacStatsRsp(DuProcMacStatsRsp, pst, mBuf);
break;
}
+ case EVENT_MAC_STATISTICS_IND:
+ {
+ ret = unpackDuMacStatsInd(DuProcMacStatsInd, pst, mBuf);
+ break;
+ }
default:
{
DU_LOG("\nERROR --> DU_APP : Invalid event received at duActvTsk from ENTMAC");
return RFAILED;
}
+/*******************************************************************
+ *
+ * @brief Process statistics indication from MAC
+ *
+ * @details
+ *
+ * Function : DuProcMacStatsInd
+ *
+ * Functionality: Processes statistics indication from MAC.
+ *
+ * @params[in]
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsInd)
+{
+ if(statsInd)
+ {
+#ifdef DEBUG_PRINT
+ DU_LOG("\nDEBUG --> DU_APP : DuProcMacStatsInd: Received Statistics Indication");
+ DU_LOG("\nMeasurement type [%d] Measurement Value [%lf]", statsInd->type, statsInd->value);
+#endif
+
+ /* TODO : When stats indication is received
+ * DU APP searches for the message type in E2AP RIC subscription database
+ * and stores in the value in the list of subscribed measurements
+ *
+ * This will be implemented in next gerrit.
+ */
+
+ DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsInd, sizeof(MacStatsInd));
+ return ROK;
+ }
+
+ DU_LOG("\nINFO --> DU_APP : DuProcMacStatsInd: Received NULL Pointer");
+ return RFAILED;
+}
+
/**********************************************************************
End of file
**********************************************************************/