Merge "Fixes for SIB1 transmission and FAPI STOP.request [Issue-ID: ODUHIGH-325]"
[o-du/l2.git] / src / 5gnrmac / lwr_mac_handle_phy.c
index 54a6643..7e9d54e 100644 (file)
@@ -116,6 +116,7 @@ uint8_t procSlotInd(fapi_slot_ind_t *fapiSlotInd)
       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
@@ -159,6 +160,7 @@ uint8_t procStopInd()
    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);
 }
 
@@ -189,9 +191,14 @@ uint8_t procRachInd(fapi_rach_indication_t  *fapiRachInd)
    MAC_ALLOC_SHRABL_BUF(rachInd, sizeof(RachInd));
    if(!rachInd)
    {
-      DU_LOG("\nERROR  -->  LWR_MAC: Memory Allocation failed in procRachInd");
+      DU_LOG("\nERROR  -->  LWR_MAC : Memory Allocation failed in procRachInd");
       return RFAILED;
    }
+   if(!fapiRachInd->numPdus)
+   {
+      DU_LOG("\nDEBUG  -->  LWR_MAC : No PDU in RACH.indication at [%d, %d]", fapiRachInd->sfn, fapiRachInd->slot);
+      return ROK;
+   }
 
    rachInd->cellId = lwrMacCb.cellCb[0].cellId;
    rachInd->timingInfo.sfn = fapiRachInd->sfn;
@@ -217,7 +224,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 */
 
 /*******************************************************************
@@ -248,9 +254,14 @@ uint8_t procCrcInd(fapi_crc_ind_t  *fapiCrcInd)
    MAC_ALLOC_SHRABL_BUF(crcInd, sizeof(CrcInd));
    if(!crcInd)
    {
-      DU_LOG("\nERROR  -->  LWR_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;
@@ -307,9 +318,14 @@ uint8_t procRxDataInd(fapi_rx_data_indication_t  *fapiRxDataInd)
    MAC_ALLOC_SHRABL_BUF(rxDataInd, sizeof(RxDataInd));
    if(!rxDataInd)
    {
-      DU_LOG("\nERROR  -->  LWR_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;