X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fphy_stub%2Fphy_stub_msg_hdl.c;h=56b85be9399a297a8fc883101000bdecfc31918a;hb=f191979f3454e08cc049af12d6323819730260ef;hp=1974165e27844e8c7b0b4ec64e00126dde576762;hpb=2e79829c81833df467daa9cce57a967d2224876e;p=o-du%2Fl2.git diff --git a/src/phy_stub/phy_stub_msg_hdl.c b/src/phy_stub/phy_stub_msg_hdl.c index 1974165e2..56b85be93 100644 --- a/src/phy_stub/phy_stub_msg_hdl.c +++ b/src/phy_stub/phy_stub_msg_hdl.c @@ -24,15 +24,17 @@ #include "du_app_mac_inf.h" #include "mac_sch_interface.h" #include "lwr_mac.h" +#include "lwr_mac_fsm.h" #include "lwr_mac_phy.h" #ifdef INTEL_FAPI #include "fapi.h" #include "fapi_vendor_extension.h" #endif -#include "lphy_stub.h" #include "lwr_mac_upr_inf.h" #include "mac_utils.h" #include "phy_stub.h" +#include "phy_stub_utils.h" +#include "lwr_mac_phy_stub_inf.h" /******************************************************************* * @@ -243,6 +245,15 @@ void l1HdlParamReq(uint32_t msgLen, void *msg) void l1HdlConfigReq(uint32_t msgLen, void *msg) { + rachIndSent = false; + msg3Sent = false; + msg5ShortBsrSent = false; + msg5Sent = false; + dlDedMsg = false; + msgSecurityModeComp = false; + msgRrcReconfiguration = false; + msgRegistrationComp = false; + #ifdef INTEL_FAPI p_fapi_api_queue_elem_t configReqElem = (p_fapi_api_queue_elem_t)msg; fapi_config_req_t *configReq = (fapi_config_req_t *)(configReqElem +1); @@ -638,10 +649,13 @@ uint16_t l1BuildAndSendRachInd(uint16_t slot, uint16_t sfn) * ****************************************************************/ uint16_t l1BuildAndSendSlotIndication() { + Pst pst; + Buffer *mBuf; + #ifdef INTEL_FAPI fapi_slot_ind_t *slotIndMsg; - MAC_ALLOC(slotIndMsg, sizeof(fapi_slot_ind_t)); + MAC_ALLOC_SHRABL_BUF(slotIndMsg, sizeof(fapi_slot_ind_t)); if(!slotIndMsg) { DU_LOG("\nERROR --> PHY_STUB: Memory allocation failed for slot Indication Message"); @@ -654,24 +668,36 @@ uint16_t l1BuildAndSendSlotIndication() slotIndMsg->slot = slotValue; #ifdef ODU_SLOT_IND_DEBUG_LOG - DU_LOG("\n\nDEBUG --> PHY_STUB: SLOT indication [%d:%d]",sfnValue,slotValue); + DU_LOG("\n\nDEBUG --> PHY_STUB: Sending Slot Indication [%d : %d] to MAC", sfnValue, slotValue); #endif + /* increment for the next TTI */ slotValue++; if(sfnValue >= MAX_SFN_VALUE && slotValue > MAX_SLOT_VALUE) { - sfnValue = 0; - slotValue = 0; + sfnValue = 0; + slotValue = 0; } else if(slotValue > MAX_SLOT_VALUE) { - sfnValue++; - slotValue = 0; + sfnValue++; + slotValue = 0; } fillMsgHeader(&slotIndMsg->header, FAPI_SLOT_INDICATION, \ - sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t)); - procPhyMessages(slotIndMsg->header.msg_id, sizeof(fapi_slot_ind_t), (void*)slotIndMsg); - MAC_FREE(slotIndMsg, sizeof(fapi_slot_ind_t)); + sizeof(fapi_slot_ind_t) - sizeof(fapi_msg_t)); + + memset(&pst, 0, sizeof(Pst)); + FILL_PST_PHY_STUB_TO_LWR_MAC(pst, EVT_PHY_STUB_SLOT_IND); + + ODU_GET_MSG_BUF(pst.region, pst.pool, &mBuf); + if(!mBuf) + { + DU_LOG("\nERROR --> PHY_STUB: Failed to allocate memory for slot indication buffer"); + MAC_FREE_SHRABL_BUF(pst.region, pst.pool, slotIndMsg, sizeof(fapi_slot_ind_t)); + return RFAILED; + } + CMCHKPK(oduPackPointer, (PTR)slotIndMsg, mBuf); + ODU_POST_TASK(&pst, mBuf); } #endif return ROK; @@ -1023,7 +1049,7 @@ S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg) numPdus--; } - if(rachIndSent == false && ulTtiReq->sfn == 2 && ulTtiReq->slot == 6) + if(rachIndSent == false && ulTtiReq->sfn == 16 && ulTtiReq->slot == 6) { rachIndSent = true; l1BuildAndSendRachInd(ulTtiReq->slot, ulTtiReq->sfn); @@ -1052,10 +1078,12 @@ S16 l1HdlUlTtiReq(uint16_t msgLen, void *msg) uint16_t l1BuildAndSendStopInd() { #ifdef INTEL_FAPI + Pst pst; + Buffer *mBuf = NULLP; fapi_stop_ind_t *stopIndMsg = NULLP; uint32_t msgLen = 0; - MAC_ALLOC(stopIndMsg, sizeof(fapi_stop_ind_t)); + MAC_ALLOC_SHRABL_BUF(stopIndMsg, sizeof(fapi_stop_ind_t)); if(!stopIndMsg) { DU_LOG("\nERROR --> PHY_STUB: Memory allocation failed for stop Indication Message"); @@ -1065,9 +1093,18 @@ uint16_t l1BuildAndSendStopInd() { fillMsgHeader(&stopIndMsg->header, FAPI_STOP_INDICATION, msgLen); DU_LOG("\n\nINFO --> PHY_STUB: Processing Stop indication to MAC"); - procPhyMessages(stopIndMsg->header.msg_id,\ - sizeof(fapi_stop_ind_t), (void*)stopIndMsg); - MAC_FREE(stopIndMsg, sizeof(fapi_stop_ind_t)); + + memset(&pst, 0, sizeof(Pst)); + FILL_PST_PHY_STUB_TO_LWR_MAC(pst, EVT_PHY_STUB_STOP_IND); + ODU_GET_MSG_BUF(pst.region, pst.pool, &mBuf); + if(!mBuf) + { + DU_LOG("\nERROR --> PHY_STUB: Failed to allocate memory for slot indication buffer"); + MAC_FREE_SHRABL_BUF(pst.region, pst.pool, stopIndMsg, sizeof(fapi_stop_ind_t)); + return RFAILED; + } + CMCHKPK(oduPackPointer, (PTR)stopIndMsg, mBuf); + ODU_POST_TASK(&pst, mBuf); } #endif return ROK; @@ -1098,7 +1135,6 @@ S16 l1HdlStopReq(uint32_t msgLen, void *msg) { l1HdlSlotIndicaion(TRUE); DU_LOG("\nINFO --> PHY_STUB: Slot Indication is stopped successfully"); - l1BuildAndSendStopInd(); MAC_FREE(msg, msgLen); } else