X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Flwr_mac_handle_phy.c;h=a8f251ca235247e6c83aecdb726c8e2ef08aa334;hb=de6a435729e3cad9d4a66329080b8206a64f452c;hp=db000be47e570248df64c04071c905e0f4bd86cb;hpb=528b3d3a09d7486a0c549820bac601db60fde18e;p=o-du%2Fl2.git diff --git a/src/5gnrmac/lwr_mac_handle_phy.c b/src/5gnrmac/lwr_mac_handle_phy.c index db000be47..a8f251ca2 100644 --- a/src/5gnrmac/lwr_mac_handle_phy.c +++ b/src/5gnrmac/lwr_mac_handle_phy.c @@ -20,7 +20,7 @@ #include "common_def.h" #include "lrg.h" #ifdef INTEL_FAPI -#include "fapi.h" +#include "nr5g_fapi_internal.h" #include "fapi_vendor_extension.h" #endif @@ -105,33 +105,24 @@ uint8_t procSlotInd(fapi_slot_ind_t *fapiSlotInd) { /* fill Pst structure to send to lwr_mac to MAC */ Pst pst; - uint16_t ret; - SlotIndInfo *slotInd; + uint16_t ret = 0; + SlotTimingInfo *slotInd = {0}; - MAC_ALLOC_SHRABL_BUF(slotInd, sizeof(SlotIndInfo)); + MAC_ALLOC_SHRABL_BUF(slotInd, sizeof(SlotTimingInfo)); if(slotInd) { slotInd->cellId = lwrMacCb.cellCb[0].cellId; slotInd->sfn = fapiSlotInd->sfn; slotInd->slot = fapiSlotInd->slot; - FILL_PST_LWR_MAC_TO_MAC(pst, EVENT_SLOT_IND_TO_MAC); + pst.selector = ODU_SELECTOR_LWLC; ret = (*sendSlotIndOpts[pst.selector])(&pst, slotInd); } else { - printf("\nLWR_MAC: Memory allocation failed in procSlotInd"); + DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed in procSlotInd"); ret = RFAILED; } - -#ifdef INTEL_WLS_MEM - slotIndIdx++; - if(slotIndIdx > WLS_MEM_FREE_PRD) - { - slotIndIdx = 1; - } - freeWlsBlockList(slotIndIdx - 1); -#endif return ret; } @@ -158,16 +149,17 @@ uint8_t procStopInd() MAC_ALLOC_SHRABL_BUF(cellId, sizeof(uint16_t)); if(!cellId) { - printf("\nLWR_MAC: Memory Allocation failed in procStopInd"); + DU_LOG("\nERROR --> LWR_MAC: Memory Allocation failed in procStopInd"); return RFAILED; } *cellId = lwrMacCb.cellCb[0].cellId; lwrMacCb.phyState = PHY_STATE_CONFIGURED; lwrMacCb.cellCb[0].state = PHY_STATE_CONFIGURED; - DU_LOG("\nLWR_MAC: PHY has moved to configured state"); + DU_LOG("\nINFO --> LWR_MAC: PHY has moved to configured state"); FILL_PST_LWR_MAC_TO_MAC(pst, EVENT_STOP_IND_TO_MAC); + pst.selector = ODU_SELECTOR_LWLC; return (*sendStopIndOpts[pst.selector])(&pst, cellId); } @@ -195,13 +187,18 @@ uint8_t procRachInd(fapi_rach_indication_t *fapiRachInd) RachPduInfo *rachPdu = NULLP; RachInd *rachInd = NULLP; + if(!fapiRachInd->numPdus) + { + DU_LOG("\nDEBUG --> LWR_MAC : No PDU in RACH.indication at [%d, %d]", fapiRachInd->sfn, fapiRachInd->slot); + return ROK; + } + MAC_ALLOC_SHRABL_BUF(rachInd, sizeof(RachInd)); if(!rachInd) { - printf("\nLWR_MAC: Memory Allocation failed in procRachInd"); + DU_LOG("\nERROR --> LWR_MAC : Memory Allocation failed in procRachInd"); return RFAILED; } - rachInd->cellId = lwrMacCb.cellCb[0].cellId; rachInd->timingInfo.sfn = fapiRachInd->sfn; rachInd->timingInfo.slot = fapiRachInd->slot; @@ -226,7 +223,6 @@ uint8_t procRachInd(fapi_rach_indication_t *fapiRachInd) /* Fill post and sent to MAC */ FILL_PST_LWR_MAC_TO_MAC(pst, EVENT_RACH_IND_TO_MAC); return (*sendRachIndOpts[pst.selector])(&pst, rachInd); - }/* handleRachInd */ /******************************************************************* @@ -257,9 +253,14 @@ uint8_t procCrcInd(fapi_crc_ind_t *fapiCrcInd) MAC_ALLOC_SHRABL_BUF(crcInd, sizeof(CrcInd)); if(!crcInd) { - printf("\nLWR_MAC: Memory Allocation failed in procCrcInd"); + DU_LOG("\nERROR --> LWR_MAC : Memory Allocation failed in procCrcInd"); return RFAILED; } + if(!fapiCrcInd->numCrcs) + { + DU_LOG("\nDEBUG --> LWR_MAC : No CRC PDUs in CRC.indication at [%d, %d]", fapiCrcInd->sfn, fapiCrcInd->slot); + return ROK; + } crcInd->cellId = lwrMacCb.cellCb[0].cellId; crcInd->timingInfo.sfn = fapiCrcInd->sfn; @@ -309,16 +310,21 @@ uint8_t procCrcInd(fapi_crc_ind_t *fapiCrcInd) uint8_t procRxDataInd(fapi_rx_data_indication_t *fapiRxDataInd) { Pst pst; - uint8_t pduIdx; + uint8_t pduIdx =0; RxDataInd *rxDataInd = NULLP; RxDataIndPdu *pdu = NULLP; MAC_ALLOC_SHRABL_BUF(rxDataInd, sizeof(RxDataInd)); if(!rxDataInd) { - printf("\nLWR_MAC: Memory Allocation failed in procRxDataInd"); + DU_LOG("\nERROR --> LWR_MAC : Memory Allocation failed in procRxDataInd"); return RFAILED; } + if(!fapiRxDataInd->numPdus) + { + DU_LOG("\nDEBUG --> LWR_MAC : No PDU in RX_Data.indication at [%d, %d]", fapiRxDataInd->sfn, fapiRxDataInd->slot); + return ROK; + } rxDataInd->cellId = lwrMacCb.cellCb[0].cellId; rxDataInd->timingInfo.sfn = fapiRxDataInd->sfn; @@ -423,10 +429,11 @@ uint8_t procUciInd(fapi_uci_indication_t *fapiUciInd) MAC_ALLOC_SHRABL_BUF(macUciInd, sizeof(UciInd)); if(!macUciInd) { - printf("\nLWR_MAC: Memory Allocation failed in procUciInd"); + DU_LOG("\nERROR --> LWR_MAC: Memory Allocation failed in procUciInd"); return RFAILED; } + DU_LOG("\nDEBUG --> LWR_MAC: Processing UCI Indication"); memset(macUciInd, 0, sizeof(UciInd)); macUciInd->cellId = lwrMacCb.cellCb[0].cellId; macUciInd->slotInd.sfn = fapiUciInd->sfn; @@ -451,7 +458,7 @@ uint8_t procUciInd(fapi_uci_indication_t *fapiUciInd) case UCI_IND_PUCCH_F2F3F4: break; default: - DU_LOG("\nLWR_MAC: Invalid Pdu Type %d at procmacUciInd()", macUciInd->pdus[pduIdx].pduType); + DU_LOG("\nERROR --> LWR_MAC: Invalid Pdu Type %d at procmacUciInd()", macUciInd->pdus[pduIdx].pduType); ret = RFAILED; break; } @@ -463,12 +470,70 @@ uint8_t procUciInd(fapi_uci_indication_t *fapiUciInd) } else { - DU_LOG("\nLWR_MAC: Failed sending UCI Ind to MAC"); + DU_LOG("\nERROR --> LWR_MAC: Failed sending UCI Ind to MAC"); } return ret; } #endif /* FAPI */ +/******************************************************************* + * @brief Function prints src, dest, msg infor about all the msgs that + received. + * + * @details + * + * Function :callFlowFromPhyToLwrMac + * + * Function call Flow From Phy To LwrMac + * + * @param[in] Pst *pst, Post structure of the primitive. + * + * @return void + * ****************************************************************/ +void callFlowFromPhyToLwrMac(uint16_t msgId) +{ + char message[100]; + switch(msgId) + { +#ifdef INTEL_TIMER_MODE + case FAPI_VENDOR_EXT_UL_IQ_SAMPLES: + strcpy(message,"FAPI_VENDOR_EXT_UL_IQ_SAMPLES"); + break; +#endif + case FAPI_PARAM_RESPONSE: + strcpy(message,"FAPI_PARAM_RESPONSE"); + break; + case FAPI_CONFIG_RESPONSE: + strcpy(message,"FAPI_CONFIG_RESPONSE"); + break; + case FAPI_SLOT_INDICATION: + strcpy(message,"FAPI_SLOT_INDICATION"); + break; + case FAPI_ERROR_INDICATION: + strcpy(message,"FAPI_ERROR_INDICATION"); + break; + case FAPI_RX_DATA_INDICATION: + strcpy(message,"FAPI_RX_DATA_INDICATION"); + break; + case FAPI_CRC_INDICATION: + strcpy(message,"FAPI_CRC_INDICATION"); + break; + case FAPI_UCI_INDICATION: + strcpy(message,"FAPI_UCI_INDICATION"); + break; + case FAPI_SRS_INDICATION: + strcpy(message,"FAPI_SRS_INDICATION"); + break; + case FAPI_RACH_INDICATION: + strcpy(message,"FAPI_RACH_INDICATION"); + break; + case FAPI_STOP_INDICATION: + strcpy(message,"FAPI_STOP_INDICATION"); + break; + } + DU_LOG("\nCall Flow: PHY -> ENTLWRMAC : %s\n",message); +} + /******************************************************************* * * @brief Processes message from PHY @@ -488,11 +553,25 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg) { #ifdef INTEL_FAPI /* extract the header */ - fapi_msg_t *header; + fapi_msg_t *header = NULLP; header = (fapi_msg_t *)msg; +#ifdef CALL_FLOW_DEBUG_LOG + callFlowFromPhyToLwrMac(header->msg_id); +#endif + switch(header->msg_id) { +#ifdef INTEL_TIMER_MODE + case FAPI_VENDOR_EXT_UL_IQ_SAMPLES: + { + DU_LOG("\nDEBUG --> LWR_MAC: Received FAPI_VENDOR_EXT_UL_IQ_SAMPLES"); + //send config req + uint16_t cellId = 1; + sendToLowerMac(CONFIG_REQUEST, 0, (void *)&cellId); + break; + } +#endif case FAPI_PARAM_RESPONSE: { sendToLowerMac(PARAM_RESPONSE, msgSize, msg); @@ -507,12 +586,12 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg) { if(lwrMacCb.phyState == PHY_STATE_CONFIGURED) { - DU_LOG("\nLWR_MAC: PHY has moved to running state"); + DU_LOG("\nINFO --> LWR_MAC: PHY has moved to running state"); lwrMacCb.phyState = PHY_STATE_RUNNING; lwrMacCb.cellCb[0].state = PHY_STATE_RUNNING; } - fapi_slot_ind_t *slotInd; + fapi_slot_ind_t *slotInd = NULLP; slotInd = (fapi_slot_ind_t *)msg; procSlotInd(slotInd); break; @@ -555,7 +634,7 @@ void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg) } case FAPI_STOP_INDICATION: { - DU_LOG("\nLWR_MAC: Handling Stop Indication"); + DU_LOG("\nINFO --> LWR_MAC: Handling Stop Indication"); procStopInd(); break; }