From 064201886fa5a8f26194d36407f236a3d705dbb6 Mon Sep 17 00:00:00 2001 From: svaidhya Date: Thu, 28 Nov 2024 18:19:03 +0530 Subject: [PATCH] [Bug-ID: ODUHIGH-631] MSG4 PDCCH and PDSCH crash fix Change-Id: I9efbf066246fdd9d33e0a52f59609c6a53055ec3 Signed-off-by: svaidhya --- src/5gnrmac/lwr_mac_fsm.c | 3 ++- src/5gnrmac/mac.h | 15 ++++++++------- src/5gnrmac/mac_slot_ind.c | 11 +++++++++-- src/5gnrsch/sch.c | 1 + src/5gnrsch/sch.h | 19 ++++++++++--------- src/5gnrsch/sch_common.c | 3 +++ src/5gnrsch/sch_slot_ind.c | 6 ++++++ src/cm/mac_sch_interface.h | 1 + 8 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index 6b083766c..f7bfc3aa6 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -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)); diff --git a/src/5gnrmac/mac.h b/src/5gnrmac/mac.h index d4a3f80cf..294edc731 100644 --- a/src/5gnrmac/mac.h +++ b/src/5gnrmac/mac.h @@ -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 diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index cbcf1c347..16b3a9307 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -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]); } diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index bd61e20ed..60a45a658 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -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*)); } diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index b8b5d4828..6bbd14315 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -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 diff --git a/src/5gnrsch/sch_common.c b/src/5gnrsch/sch_common.c index fe6b86ceb..532904076 100644 --- a/src/5gnrsch/sch_common.c +++ b/src/5gnrsch/sch_common.c @@ -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)); diff --git a/src/5gnrsch/sch_slot_ind.c b/src/5gnrsch/sch_slot_ind.c index 1e319d3e4..147a5286a 100644 --- a/src/5gnrsch/sch_slot_ind.c +++ b/src/5gnrsch/sch_slot_ind.c @@ -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; diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index 63fc020a3..abebf239f 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -1113,6 +1113,7 @@ typedef struct schSlotValue SlotTimingInfo broadcastTime; SlotTimingInfo rarTime; SlotTimingInfo dlMsgTime; + SlotTimingInfo msg4PdschTime; SlotTimingInfo ulDciTime; }SchSlotValue; -- 2.16.6