[Bug-ID: ODUHIGH-631] MSG4 PDCCH and PDSCH crash fix 90/13790/2
authorsvaidhya <svaidhya@radisys.com>
Thu, 28 Nov 2024 12:49:03 +0000 (18:19 +0530)
committersvaidhya <svaidhya@radisys.com>
Fri, 29 Nov 2024 09:28:51 +0000 (14:58 +0530)
Change-Id: I9efbf066246fdd9d33e0a52f59609c6a53055ec3
Signed-off-by: svaidhya <svaidhya@radisys.com>
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/mac.h
src/5gnrmac/mac_slot_ind.c
src/5gnrsch/sch.c
src/5gnrsch/sch.h
src/5gnrsch/sch_common.c
src/5gnrsch/sch_slot_ind.c
src/cm/mac_sch_interface.h

index 6b08376..f7bfc3a 100644 (file)
@@ -4000,7 +4000,8 @@ uint16_t fillDlTtiReq(SlotTimingInfo currTimingInfo)
                         pduIndex++;
 
                         DU_LOG("\033[1;32m");
-                        if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status))
+                        if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status) && \
+                              (*macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status == TRUE))
                         {
                            DU_LOG("\nDEBUG  -->  LWR_MAC: MSG4 sent...");
                            MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status, sizeof(bool));
index d4a3f80..294edc7 100644 (file)
@@ -120,13 +120,14 @@ typedef struct macUlSlot
 
 typedef struct macCbInfo
 {
-   uint16_t    cellId;
-   uint16_t    crnti;
-   uint8_t     msg3Pdu[6];  /* used as CRI value during muxing */
-   uint8_t     *msg4Pdu;    /* storing DL-CCCH Ind Pdu */
-   uint16_t    msg4PduLen;  /* storing DL-CCCH Ind Pdu Len */
-   DlHarqProcCb msg4HqInfo; /* HARQ process info for msg 4 */
-   bool         *macMsg4Status;
+   uint16_t        cellId;
+   uint16_t        crnti;
+   uint8_t         msg3Pdu[6];  /* used as CRI value during muxing */
+   uint8_t        *msg4Pdu;    /* storing DL-CCCH Ind Pdu */
+   uint16_t        msg4PduLen;  /* storing DL-CCCH Ind Pdu Len */
+   DlHarqProcCb    msg4HqInfo; /* HARQ process info for msg 4 */
+   bool           *macMsg4Status;
+   SlotTimingInfo  msg4PdschSlotInfo; /*MSG4 PDSCH slot timing info*/
 }MacRaCbInfo;
 
 typedef struct macCe
index cbcf1c3..16b3a93 100644 (file)
@@ -92,15 +92,20 @@ uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo)
             if(dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdcchCfg && dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdcchCfg->coresetCfg.coreSetType == CORESET_TYPE0)
             {
                MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status, sizeof(bool));
+               *macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status = FALSE;
+               memcpy(&macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PdschSlotInfo, &dlSchedInfo->schSlotValue.msg4PdschTime, sizeof(SlotTimingInfo));
             }
 
             /* Check if the downlink pdu is msg4 */
-            if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status))
+            if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status) && 
+                  (macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PdschSlotInfo.sfn == dlSchedInfo->schSlotValue.dlMsgTime.sfn && 
+                   macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4PdschSlotInfo.slot == dlSchedInfo->schSlotValue.dlMsgTime.slot))
             {
                GET_UE_ID(dlSchedInfo->dlMsgAlloc[ueIdx]->crnti, ueId);
                ueIdx = ueId -1;
                schedInfo = dlSchedInfo->dlMsgAlloc[ueIdx];
                hqProcCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4HqInfo;
+               *macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status = TRUE;
 
                if(!dlSchedInfo->dlMsgAlloc[ueIdx]->transportBlock[0].ndi)
                {
@@ -340,7 +345,9 @@ void buildAndSendMuxPdu(SlotTimingInfo currTimingInfo)
    {
       if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx])
       {
-         if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status)&& (currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg))
+         if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status)&&
+              (*macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status == TRUE) &&
+              (currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg))
          {
             fillMsg4Pdu(currTimingInfo.cellId, currDlSlot->dlInfo.dlMsgAlloc[ueIdx]);
          }
index bd61e20..60a45a6 100644 (file)
@@ -946,6 +946,7 @@ void deleteSchCellCb(SchCellCb *cellCb)
          }
          SCH_FREE(cellCb->schDlSlotInfo[slotIdx]->ulGrant, sizeof(DciInfo));
          SCH_FREE(cellCb->schDlSlotInfo[slotIdx], sizeof(SchDlSlotInfo));
+         SCH_FREE(msg4PdschTime, sizeof(SlotTimingInfo));
       }
       SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*));
    }
index b8b5d48..6bbd143 100644 (file)
@@ -331,15 +331,16 @@ typedef struct schPdcchAllocInfo
  */
 typedef struct schDlSlotInfo
 {
-   SchPrbAlloc  prbAlloc;                 /*!< PRB allocated/available in this slot */
-   bool         ssbPres;                  /*!< Flag to determine if SSB is present in this slot */
-   uint8_t      ssbIdxSupported;          /*!< Max SSB index */
-   SsbInfo      ssbInfo[MAX_SSB_IDX];     /*!< SSB info */
-   bool         sib1Pres;                 /*!< Flag to determine if SIB1 is present in this slot */
-   uint8_t      pdcchUe;                  /*!< UE for which PDCCH Common is scheduled in this slot */
-   RarAlloc     *rarAlloc[MAX_NUM_UE];    /*!< RAR allocation per UE*/
-   DciInfo      *ulGrant;
-   DlMsgSchInfo *dlMsgAlloc[MAX_NUM_UE];  /*!< Dl msg allocation per UE*/
+   SchPrbAlloc    prbAlloc;                 /*!< PRB allocated/available in this slot */
+   bool           ssbPres;                  /*!< Flag to determine if SSB is present in this slot */
+   uint8_t        ssbIdxSupported;          /*!< Max SSB index */
+   SsbInfo        ssbInfo[MAX_SSB_IDX];     /*!< SSB info */
+   bool           sib1Pres;                 /*!< Flag to determine if SIB1 is present in this slot */
+   uint8_t        pdcchUe;                  /*!< UE for which PDCCH Common is scheduled in this slot */
+   SlotTimingInfo *msg4PdschTime;          /*!< PDSCH time for MSG4*/
+   RarAlloc       *rarAlloc[MAX_NUM_UE];    /*!< RAR allocation per UE*/
+   DciInfo        *ulGrant;
+   DlMsgSchInfo   *dlMsgAlloc[MAX_NUM_UE];  /*!< Dl msg allocation per UE*/
 }SchDlSlotInfo;
 
 typedef struct schRaCb
index fe6b86c..5329040 100644 (file)
@@ -1895,6 +1895,9 @@ uint8_t schProcessMsg4Req(SchCellCb *cell, SlotTimingInfo currTime, uint8_t ueId
    /* Check if both DCI and RAR are sent in the same slot.
     * If not, allocate memory RAR PDSCH slot to store RAR info
     */
+   SCH_ALLOC(cell->schDlSlotInfo[pdcchTime.slot]->msg4PdschTime, sizeof(SlotTimingInfo));
+   memcpy(cell->schDlSlotInfo[pdcchTime.slot]->msg4PdschTime, &pdschTime, sizeof(SlotTimingInfo));
+   
    if(pdcchTime.slot == pdschTime.slot)
    {
       SCH_ALLOC(dciSlotAlloc->dlMsgPdschCfg, sizeof(PdschCfg));
index 1e319d3..147a528 100644 (file)
@@ -752,6 +752,12 @@ uint8_t SchProcSlotInd(Pst *pst, SlotTimingInfo *slotInd)
        * specific interface structure to send to MAC */
       if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->dlMsgAlloc[ueIdx] != NULLP)
       {
+         if(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->msg4PdschTime != NULLP)
+         {
+            memcpy(&dlSchedInfo.schSlotValue.msg4PdschTime, \
+                      cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->msg4PdschTime, sizeof(SlotTimingInfo));
+            SCH_FREE(cell->schDlSlotInfo[dlSchedInfo.schSlotValue.dlMsgTime.slot]->msg4PdschTime, sizeof(SlotTimingInfo));
+         }
          slot = dlSchedInfo.schSlotValue.dlMsgTime.slot;
          dlSchedInfo.dlMsgAlloc[ueIdx] = cell->schDlSlotInfo[slot]->dlMsgAlloc[ueIdx];
          cell->schDlSlotInfo[slot]->dlMsgAlloc[ueIdx] = NULLP;
index 63fc020..abebf23 100644 (file)
@@ -1113,6 +1113,7 @@ typedef struct schSlotValue
    SlotTimingInfo broadcastTime;
    SlotTimingInfo rarTime;
    SlotTimingInfo dlMsgTime;
+   SlotTimingInfo msg4PdschTime;
    SlotTimingInfo ulDciTime;
 }SchSlotValue;