X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_slot_ind.c;h=e17d220ac6d9abde6f143ddcaa8b8443218f5dcf;hb=12da8be0c4941e107b9ff0d18ce5b6eb7f5f7d20;hp=042c89d2c52c5f57f5e499b48c8461de20809e7b;hpb=6fee61a10e1ad48ff7105b3201038ac8a337fd4a;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index 042c89d2c..e17d220ac 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -54,7 +54,7 @@ uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo) uint8_t *retxTb = NULLP, *txPdu = NULLP; uint16_t txPduLen = 0; MacDlSlot *currDlSlot = NULLP; - DlMsgSchInfo schedInfo; + DlMsgSchInfo *schedInfo; DlHarqProcCb *hqProcCb = NULLP; #ifdef CALL_FLOW_DEBUG_LOG @@ -88,85 +88,84 @@ uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo) dlSlot[dlSchedInfo->schSlotValue.dlMsgTime.slot]; currDlSlot->dlInfo.dlMsgAlloc[ueIdx] = dlSchedInfo->dlMsgAlloc[ueIdx]; /* copy msg4 alloc pointer in MAC slot info */ currDlSlot->dlInfo.cellId = dlSchedInfo->cellId; + + if(dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdcchCfg && dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdcchCfg->coresetCfg.coreSetType == CORESET_TYPE0) + { + MAC_ALLOC(macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status, sizeof(bool)); + } /* Check if the downlink pdu is msg4 */ - for(schInfoIdx=0; schInfoIdx < dlSchedInfo->dlMsgAlloc[ueIdx]->numSchedInfo; schInfoIdx++) + if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status)) { - if(dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.isMsg4Pdu) - { - GET_UE_ID(dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.crnti, ueId); - ueIdx = ueId -1; - schedInfo = dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx]; - hqProcCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4HqInfo; + GET_UE_ID(dlSchedInfo->dlMsgAlloc[ueIdx]->crnti, ueId); + ueIdx = ueId -1; + schedInfo = dlSchedInfo->dlMsgAlloc[ueIdx]; + hqProcCb = &macCb.macCell[cellIdx]->macRaCb[ueIdx].msg4HqInfo; - if(!dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].isRetx) + if(!dlSchedInfo->dlMsgAlloc[ueIdx]->transportBlock[0].ndi) + { + /* First transmission of MSG4 */ + hqProcCb->procId = schedInfo->harqProcNum; + for(cwIdx = 0; cwIdx < schedInfo->dlMsgPdschCfg->numCodewords; cwIdx++) { - /* First transmission of MSG4 */ - hqProcCb->procId = schedInfo.dlMsgInfo.harqProcNum; - for(cwIdx = 0; cwIdx < schedInfo.dlMsgPdschCfg.numCodewords; cwIdx++) - { - memcpy(&hqProcCb->tbInfo[hqProcCb->numTb].txTime, &dlSchedInfo->schSlotValue.dlMsgTime, \ - sizeof(SlotTimingInfo)); - hqProcCb->tbInfo[hqProcCb->numTb].tbSize = schedInfo.dlMsgPdschCfg.codeword[cwIdx].tbSize; - hqProcCb->numTb++; - } + memcpy(&hqProcCb->tbInfo[hqProcCb->numTb].txTime, &dlSchedInfo->schSlotValue.dlMsgTime, \ + sizeof(SlotTimingInfo)); + hqProcCb->tbInfo[hqProcCb->numTb].tbSize = schedInfo->dlMsgPdschCfg->codeword[cwIdx].tbSize; + hqProcCb->numTb++; } - else + } + else + { + /* MSG4 retransmission */ + if(hqProcCb->procId == schedInfo->harqProcNum) { - /* MSG4 retransmission */ - if(hqProcCb->procId == schedInfo.dlMsgInfo.harqProcNum) - { - memcpy(&hqProcCb->tbInfo[0].txTime, &dlSchedInfo->schSlotValue.dlMsgTime, \ - sizeof(SlotTimingInfo)); - } + memcpy(&hqProcCb->tbInfo[0].txTime, &dlSchedInfo->schSlotValue.dlMsgTime, \ + sizeof(SlotTimingInfo)); } } - else + } + else + { + memcpy(&currDlSlot->dlInfo.schSlotValue, &dlSchedInfo->schSlotValue, sizeof(SchSlotValue)); + + if(!dlSchedInfo->dlMsgAlloc[ueIdx]->transportBlock[0].ndi) { - memcpy(&currDlSlot->dlInfo.schSlotValue, &dlSchedInfo->schSlotValue, sizeof(SchSlotValue)); - - if(!dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].isRetx) + /* If new data transmission is scheduled, send schedule results to RLC */ + if(dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdschCfg) { - /* If new data transmission is scheduled, send schedule results to RLC */ - if((dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].pduPres == PDSCH_PDU) || - (dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].pduPres == BOTH)) - { - sendSchedRptToRlc(currDlSlot->dlInfo, dlSchedInfo->schSlotValue.dlMsgTime, ueIdx, schInfoIdx); + sendSchedRptToRlc(currDlSlot->dlInfo, dlSchedInfo->schSlotValue.dlMsgTime, ueIdx, schInfoIdx); - /* Add HARQ Proc to DL HARQ Proc Entity in UE */ - addDlHqProcInUe(currDlSlot->dlInfo.schSlotValue.dlMsgTime, &macCb.macCell[cellIdx]->ueCb[ueIdx], \ - dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx]); - } + /* Add HARQ Proc to DL HARQ Proc Entity in UE */ + addDlHqProcInUe(currDlSlot->dlInfo.schSlotValue.dlMsgTime, &macCb.macCell[cellIdx]->ueCb[ueIdx], \ + dlSchedInfo->dlMsgAlloc[ueIdx]); } - else + } + else + { + /* For retransmission, fetch PDU to be retransmitted from DL HARQ entity and schedule on corresponding slot */ + + /* As of now this loop will run only once for one TB. + * TODO : update handling of fetched TB appropriately when support for two TB is added + */ + for(cwIdx = 0; cwIdx < dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdschCfg->numCodewords; cwIdx++) { - /* For retransmission, fetch PDU to be retransmitted from DL HARQ entity and schedule on corresponding slot */ - - /* As of now this loop will run only once for one TB. - * TODO : update handling of fetched TB appropriately when support for two TB is added - */ - for(cwIdx = 0; \ - cwIdx < dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgPdschCfg.numCodewords;\ - cwIdx++) + /* Fetch TB to be retransmitted */ + txPduLen = dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgPdschCfg->codeword[cwIdx].tbSize; + retxTb = fetchTbfromDlHarqProc(currDlSlot->dlInfo.schSlotValue.dlMsgTime, \ + &macCb.macCell[cellIdx]->ueCb[ueIdx], \ + dlSchedInfo->dlMsgAlloc[ueIdx]->harqProcNum, txPduLen); + + /* Store PDU in corresponding DL slot */ + MAC_ALLOC(txPdu, txPduLen); + if(!txPdu) { - /* Fetch TB to be retransmitted */ - txPduLen = dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgPdschCfg.codeword[cwIdx].tbSize; - retxTb = fetchTbfromDlHarqProc(currDlSlot->dlInfo.schSlotValue.dlMsgTime, \ - &macCb.macCell[cellIdx]->ueCb[ueIdx], \ - dlSchedInfo->dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.harqProcNum, txPduLen); - - /* Store PDU in corresponding DL slot */ - MAC_ALLOC(txPdu, txPduLen); - if(!txPdu) - { - DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcDlAlloc"); - return RFAILED; - } - memcpy(txPdu, retxTb, txPduLen); - - currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.dlMsgPduLen = txPduLen; - currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.dlMsgPdu = txPdu; - } + DU_LOG("\nERROR --> MAC : Memory allocation failed in MacProcDlAlloc"); + return RFAILED; + } + memcpy(txPdu, retxTb, txPduLen); + + currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPduLen = txPduLen; + currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdu = txPdu; } } } @@ -251,7 +250,7 @@ void fillMsg4Pdu(uint16_t cellId, DlMsgSchInfo *msg4SchInfo) memset(&msg4DlData, 0, sizeof(MacDlData)); memset(&macCeData, 0, sizeof(MacCeInfo)); - GET_UE_ID(msg4SchInfo->dlMsgInfo.crnti, ueId); + GET_UE_ID(msg4SchInfo->crnti, ueId); ueIdx = ueId -1; if(macCb.macCell[cellIdx] == NULLP) @@ -297,12 +296,12 @@ void fillMsg4Pdu(uint16_t cellId, DlMsgSchInfo *msg4SchInfo) /* storing msg4 Pdu in macDlSlot */ if(hqProcCb->tbInfo[0].tb) { - msg4SchInfo->dlMsgInfo.dlMsgPduLen = msg4TxPduLen; - MAC_ALLOC(msg4SchInfo->dlMsgInfo.dlMsgPdu, msg4SchInfo->dlMsgInfo.dlMsgPduLen); - if(msg4SchInfo->dlMsgInfo.dlMsgPdu != NULLP) + msg4SchInfo->dlMsgPduLen = msg4TxPduLen; + MAC_ALLOC(msg4SchInfo->dlMsgPdu, msg4SchInfo->dlMsgPduLen); + if(msg4SchInfo->dlMsgPdu != NULLP) { - memcpy(msg4SchInfo->dlMsgInfo.dlMsgPdu, hqProcCb->tbInfo[0].tb, \ - msg4SchInfo->dlMsgInfo.dlMsgPduLen); + memcpy(msg4SchInfo->dlMsgPdu, hqProcCb->tbInfo[0].tb, \ + msg4SchInfo->dlMsgPduLen); } } else @@ -327,7 +326,6 @@ void fillMsg4Pdu(uint16_t cellId, DlMsgSchInfo *msg4SchInfo) void buildAndSendMuxPdu(SlotTimingInfo currTimingInfo) { uint8_t ueIdx; - uint8_t schInfoIdx; uint16_t cellIdx; MacDlSlot *currDlSlot = NULLP; SlotTimingInfo muxTimingInfo; @@ -342,14 +340,9 @@ void buildAndSendMuxPdu(SlotTimingInfo currTimingInfo) { if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]) { - for(schInfoIdx=0; schInfoIdxdlInfo.dlMsgAlloc[ueIdx]->numSchedInfo; schInfoIdx++) + if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status)&& (currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg)) { - if((currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].dlMsgInfo.isMsg4Pdu) && - ((currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].pduPres == PDSCH_PDU) || - (currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx].pduPres == BOTH))) - { - fillMsg4Pdu(currTimingInfo.cellId, &currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgSchedInfo[schInfoIdx]); - } + fillMsg4Pdu(currTimingInfo.cellId, currDlSlot->dlInfo.dlMsgAlloc[ueIdx]); } } }