From: svaidhya Date: Fri, 25 Jul 2025 10:36:21 +0000 (+0000) Subject: [ODUHIGH-557][ODUHIGH-647] MSG2 Issue: LDPC issue and RAPID mismatch at OAI-UE X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F42%2F14742%2F1;p=o-du%2Fl2.git [ODUHIGH-557][ODUHIGH-647] MSG2 Issue: LDPC issue and RAPID mismatch at OAI-UE Change-Id: I3bf9f4552b814d409c256a17347d749e8ab7717b Signed-off-by: svaidhya --- diff --git a/build/config/tdd_odu_config.xml b/build/config/tdd_odu_config.xml index 63101989d..9b29bb646 100644 --- a/build/config/tdd_odu_config.xml +++ b/build/config/tdd_odu_config.xml @@ -395,9 +395,9 @@ 1 273 - 623400 + 626772 273 - 623400 + 626772 2 2 @@ -486,14 +486,14 @@ 0 0 - 3 - 11 + 1 + 13 0 0 - 3 - 11 + 1 + 13 @@ -535,7 +535,7 @@ 2 12 - 1 + 2147483648 0 @@ -564,13 +564,13 @@ 1 - 1 + 13 0 12 0 - 1 + 2 63 64 273 diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index 5744c0e93..ccf06fa60 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -2598,7 +2598,7 @@ void packConfigReq(fapi_config_req_t *configReq, uint8_t *mBuf, uint32_t *len) uint8_t *out = mBuf; uint32_t msgLen = 0; uint16_t totalTlv = 0; - uint16_t tlvSize=10;//uint16_t [5] + uint16_t tlvSize=10; uint16_t value[5] = {0,273,0,0,0}; CMCHKPKLEN(oduPackPostUInt8, configReq->header.numMsg, &out, &msgLen); @@ -2607,7 +2607,7 @@ void packConfigReq(fapi_config_req_t *configReq, uint8_t *mBuf, uint32_t *len) CMCHKPKLEN(oduPackPostUInt32, configReq->header.length, &out, &msgLen); totalTlv = configReq->number_of_tlvs; - uint8_t randmTlvCnt= 25; //This value is randomly assigned + uint8_t randmTlvCnt= 131; //This value is randomly assigned CMCHKPKLEN(oduPackPostUInt8, randmTlvCnt, &out, &msgLen); for(uint16_t idx=0;idxpdu.pdsch_pdu.nrOfSymbols = pdschInfo->pdschTimeAlloc.numSymb; dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffset = pdschInfo->txPdschPower.powerControlOffset; dlTtiReqPdu->pdu.pdsch_pdu.powerControlOffsetSS = pdschInfo->txPdschPower.powerControlOffsetSS; -#ifdef OAI_TESTING - dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = 1; - dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.numPrgs = reverseBytes16(0); - dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.prgSize = reverseBytes16(0); +#ifdef OAI_TESTING + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.digBfInterfaces = pdschInfo->beamPdschInfo.digBfInterfaces; + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.numPrgs = reverseBytes16(pdschInfo->beamPdschInfo.numPrgs); + dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.prgSize = reverseBytes16(pdschInfo->beamPdschInfo.prgSize); dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0].pmIdx = reverseBytes16(pdschInfo->beamPdschInfo.prg[0].pmIdx); dlTtiReqPdu->pdu.pdsch_pdu.preCodingAndBeamforming.pmi_bfi[0].beamIdx[0].beamidx = reverseBytes16(pdschInfo->beamPdschInfo.prg[0].beamIdx[0]); + dlTtiReqPdu->pdu.pdsch_pdu.maintParamV3.ldpcBaseGraph=2; dlTtiReqPdu->pdu.pdsch_pdu.maintParamV3.tbSizeLbrmBytes=reverseBytes32(57376); #else @@ -4911,6 +4912,7 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, RarInfo uint8_t tlvPaddingLen =get_tlv_padding(rarInfo->rarPduLen); uint16_t totalLen= rarInfo->rarPduLen +tlvPaddingLen; + pduDesc[pduIndex].pdu_length = totalLen; pduDesc[pduIndex].pdu_length = reverseBytes32(pduDesc[pduIndex].pdu_length); @@ -5934,7 +5936,7 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, fapi_vendor_ul_tti_req_pdu { if(ulTtiReqPdu != NULLP) { -// memset(&ulTtiReqPdu->pdu.pusch_pdu, 0, sizeof(fapi_ul_pusch_pdu_t)); + memset(&ulTtiReqPdu->pdu.pusch_pdu, 0, sizeof(fapi_ul_pusch_pdu_t)); #ifdef OAI_TESTING ulTtiReqPdu->pduType = reverseBytes16(PUSCH_PDU_TYPE); ulTtiReqPdu->pduSize = reverseBytes16(sizeof(fapi_ul_pusch_pdu_t)); @@ -5944,10 +5946,10 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, fapi_vendor_ul_tti_req_pdu /* TODO : Fill handle in raCb when scheduling pusch and access here */ ulTtiReqPdu->pdu.pusch_pdu.bwpSize = reverseBytes16(macCellCfg->cellCfg.initialUlBwp.bwp.numPrb); ulTtiReqPdu->pdu.pusch_pdu.bwpStart = reverseBytes16(macCellCfg->cellCfg.initialUlBwp.bwp.firstPrb); - ulTtiReqPdu->pdu.pusch_pdu.targetCodeRate = reverseBytes16(308); - ulTtiReqPdu->pdu.pusch_pdu.dataScramblingId = reverseBytes16(macCellCfg->cellId); + ulTtiReqPdu->pdu.pusch_pdu.targetCodeRate = reverseBytes16(puschInfo->tbInfo.tgtCodeRate); + ulTtiReqPdu->pdu.pusch_pdu.dataScramblingId = reverseBytes16(0); ulTtiReqPdu->pdu.pusch_pdu.ulDmrsSymbPos = reverseBytes16(1024); - ulTtiReqPdu->pdu.pusch_pdu.ulDmrsScramblingId = reverseBytes16(macCellCfg->cellId); + ulTtiReqPdu->pdu.pusch_pdu.ulDmrsScramblingId = reverseBytes16(0); ulTtiReqPdu->pdu.pusch_pdu.puschIdentity = reverseBytes16(0); ulTtiReqPdu->pdu.pusch_pdu.dmrsPorts = reverseBytes16(1); ulTtiReqPdu->pdu.pusch_pdu.rbStart = reverseBytes16(puschInfo->fdAlloc.resAlloc.type1.startPrb); @@ -6003,8 +6005,6 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, fapi_vendor_ul_tti_req_pdu ulTtiReqPdu->pdu.pusch_pdu.puschData.tbSize = reverseBytes32(puschInfo->tbInfo.tbSize); /* numCb is 0 for new transmission */ ulTtiReqPdu->pdu.pusch_pdu.puschData.numCb = reverseBytes16(0); - - #else ulTtiReqPdu->pdu.pusch_pdu.puschData.tbSize = (puschInfo->tbInfo.tbSize); /* numCb is 0 for new transmission */ @@ -6018,7 +6018,6 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, fapi_vendor_ul_tti_req_pdu puschInfo->dmrsAddPos; #endif /* UL TTI Vendor PDU */ -#ifndef OAI_TESTING ulTtiVendorPdu->pdu_type = FAPI_PUSCH_PDU_TYPE; ulTtiVendorPdu->pdu.pusch_pdu.nr_of_antenna_ports=1; ulTtiVendorPdu->pdu.pusch_pdu.nr_of_rx_ru=1; @@ -6026,7 +6025,6 @@ void fillPuschPdu(fapi_ul_tti_req_pdu_t *ulTtiReqPdu, fapi_vendor_ul_tti_req_pdu { ulTtiVendorPdu->pdu.pusch_pdu.rx_ru_idx[i]=0; } -#endif #endif } } @@ -6345,6 +6343,8 @@ uint16_t fillUlTtiReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t pre } } } + ulTtiReq->ueGrpInfo[ulTtiReq->nGroup].nUe = MAX_NUM_UE_PER_TTI; + ulTtiReq->nGroup++; } uint32_t bufferLen=0; uint8_t mBuf[2500]; diff --git a/src/5gnrmac/mac_mux.c b/src/5gnrmac/mac_mux.c index ae289adb3..038ab2852 100644 --- a/src/5gnrmac/mac_mux.c +++ b/src/5gnrmac/mac_mux.c @@ -204,6 +204,7 @@ void fillRarPdu(RarInfo *rarInfo) + (bwpSize - 1 - rbStart); } +#ifndef OAI_TESTING /* Calculating frequency domain resource allocation field size * and packing frequency domain resource allocation accordingly * Spec 38.213 Sec 8.3 @@ -236,6 +237,10 @@ void fillRarPdu(RarInfo *rarInfo) } } +#else + packBytes(rarPdu, &bytePos, &bitPos, msg3FreqResource, FREQ_RSRC_ALLOC_SIZE); +#endif + /* Packing time domain resource allocation for UL grant */ packBytes(rarPdu, &bytePos, &bitPos, rarInfo->ulGrant.k2Index, TIME_RSRC_ALLOC_SIZE); @@ -252,10 +257,6 @@ void fillRarPdu(RarInfo *rarInfo) packBytes(rarPdu, &bytePos, &bitPos, 0, paddingSize); #endif - printf("\n SANG: RAR PDU\n"); - for(bytePos = 0; bytePos < rarInfo->rarPduLen; bytePos++) - printf("[%d]:0x%x\n",bytePos, rarPdu[bytePos]); - } /************************************************* diff --git a/src/5gnrsch/sch_rach.c b/src/5gnrsch/sch_rach.c index 8cd0bdfcd..240759660 100644 --- a/src/5gnrsch/sch_rach.c +++ b/src/5gnrsch/sch_rach.c @@ -422,12 +422,15 @@ SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t crnti, uint8_t k2Index, S { SchCellCb *cell = NULLP; SchUlSlotInfo *schUlSlotInfo = NULLP; - uint8_t mcs = DEFAULT_MCS; + uint8_t mcs = 1; uint8_t startSymb = 0, ueId = 0; uint8_t symbLen = 0; uint16_t startRb = 0; uint16_t numRb = 0; uint16_t tbSize = 0; + uint16_t msg3PduLen = 8; /* 6 bytes msg3 and 2 bytes header */ + uint16_t tgtCodeRate = 0; + uint8_t qam = 0; cell = schCb[schInst].cells[schInst]; if(cell == NULL) @@ -442,9 +445,35 @@ SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t crnti, uint8_t k2Index, S symbLen = cell->cellCfg.ulCfgCommon.schInitialUlBwp.puschCommon.timeDomRsrcAllocList[k2Index].symbolLength; startRb = MAX_NUM_RB; - tbSize = schCalcTbSize(8); /* 6 bytes msg3 and 2 bytes header */ + +#ifndef OAI_TESTING + tbSize = schCalcTbSize(msg3PduLen); /* 6 bytes msg3 and 2 bytes header */ numRb = schCalcNumPrb(tbSize, mcs, symbLen); numRb++; /* allocating 1 extra RB for now */ + tbSize = 0; /* since nPrb has been incremented, recalculating tbSize */ + tbSize = schCalcTbSizeFromNPrb(numRb, mcs, NUM_PDSCH_SYMBOL, NULLP, NULLP); + tbSize = tbSize / 8 ; /*bits to byte conversion*/ +#else + numRb = 1; + do + { + if(numRb < cell->cellCfg.ulCfgCommon.schInitialUlBwp.bwp.freqAlloc.numPrb) + { + numRb++; + } + else + { + if(mcs < 10) + { + mcs++; + } + else + break; + } + tbSize = (schCalcTbSizeFromNPrb(numRb, mcs, NUM_PDSCH_SYMBOL, &tgtCodeRate, &qam) >> 3); + }while(tbSize < msg3PduLen); +#endif + allocatePrbUl(cell, msg3SlotTime, startSymb, symbLen, &startRb, numRb); /* Fill PUSCH scheduling details in Slot structure */ @@ -456,9 +485,6 @@ SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t crnti, uint8_t k2Index, S return NULLP; } cell->schUlSlotInfo[msg3SlotTime.slot]->puschPres = true; - tbSize = 0; /* since nPrb has been incremented, recalculating tbSize */ - tbSize = schCalcTbSizeFromNPrb(numRb, mcs, NUM_PDSCH_SYMBOL, NULLP, NULLP); - tbSize = tbSize / 8 ; /*bits to byte conversion*/ schUlSlotInfo->schPuschInfo[ueId - 1]->harqProcId = msg3HqProc->procId; schUlSlotInfo->schPuschInfo[ueId - 1]->crnti = crnti; @@ -467,12 +493,17 @@ SchPuschInfo* schAllocMsg3Pusch(Inst schInst, uint16_t crnti, uint8_t k2Index, S schUlSlotInfo->schPuschInfo[ueId - 1]->fdAlloc.resAlloc.type1.numPrb = numRb; schUlSlotInfo->schPuschInfo[ueId - 1]->tdAlloc.startSymb = startSymb; schUlSlotInfo->schPuschInfo[ueId - 1]->tdAlloc.numSymb = symbLen; - schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.qamOrder = QPSK_MODULATION; /* QPSK modulation */ +#ifndef OAI_TESTING + schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.qamOrder = QPSK_MODULATION; /* QPSK modulation */ +#else + schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.qamOrder = qam; +#endif schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.mcs = mcs; schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.mcsTable = SCH_MCS_TABLE_QAM_64; schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.ndi = NEW_TRANSMISSION; /* new transmission */ schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.rv = 0; schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.tbSize = tbSize; + schUlSlotInfo->schPuschInfo[ueId - 1]->tbInfo.tgtCodeRate = tgtCodeRate; #ifdef INTEL_FAPI schUlSlotInfo->schPuschInfo[ueId - 1]->dmrsMappingType = DMRS_MAP_TYPE_A; /* Setting Type-A */ schUlSlotInfo->schPuschInfo[ueId - 1]->nrOfDmrsSymbols = NUM_DMRS_SYMBOLS; @@ -909,12 +940,15 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl { uint8_t coreset0Idx = 0; uint8_t firstSymbol = 0, numSymbols = 0; - uint8_t mcs = DEFAULT_MCS; /* MCS fixed to 4 */ + uint8_t mcs; uint8_t dmrsStartSymbol, startSymbol, numSymbol ; uint16_t numRbs = 0; uint16_t tbSize = 0; uint16_t offsetToPointA = 0; uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0}; + uint16_t targetCodeRate = 0; + uint8_t qam = 0; + uint8_t rarPduLen = 0; PdschCfg *pdsch; SchBwpDlCfg *initialBwp = &cell->cellCfg.dlCfgCommon.schInitialDlBwp; @@ -997,13 +1031,34 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl pdsch->numCodewords = 1; for(cwCount = 0; cwCount < pdsch->numCodewords; cwCount++) { - pdsch->codeword[cwCount].targetCodeRate = 1570; - pdsch->codeword[cwCount].qamModOrder = 2; - pdsch->codeword[cwCount].mcsIndex = 1; /* mcs configured to 4 */ - pdsch->codeword[cwCount].mcsTable = 0; /* notqam256 */ + rarPduLen = RAR_PAYLOAD_SIZE + TX_PAYLOAD_HDR_LEN; + mcs = 1; + pdsch->pdschFreqAlloc.numPrb = 0; + qam = 0; + targetCodeRate = 0; + do + { + if(pdsch->pdschFreqAlloc.numPrb < bwp->freqAlloc.numPrb) + { + pdsch->pdschFreqAlloc.numPrb++; + } + else + { + if(mcs < 10) + { + mcs++; + } + else + break; + } + tbSize = (schCalcTbSizeFromNPrb(pdsch->pdschFreqAlloc.numPrb, mcs, 13, &targetCodeRate, &qam) >> 3); + }while(rarPduLen > tbSize); + + pdsch->codeword[cwCount].targetCodeRate = targetCodeRate; + pdsch->codeword[cwCount].qamModOrder = qam; + pdsch->codeword[cwCount].mcsIndex = mcs; + pdsch->codeword[cwCount].mcsTable = 0; pdsch->codeword[cwCount].rvIndex = 0; - /* RAR PDU length and FAPI payload header length */ - tbSize = schCalcTbSize(RAR_PAYLOAD_SIZE + TX_PAYLOAD_HDR_LEN); pdsch->codeword[cwCount].tbSize = tbSize; } pdsch->dataScramblingId = cell->cellCfg.phyCellId; @@ -1021,17 +1076,12 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl pdsch->dmrs.dmrsAddPos = DMRS_ADDITIONAL_POS; pdsch->pdschTimeAlloc.rowIndex = k0Index; + pdsch->pdschTimeAlloc.startSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].startSymbol; -#ifdef OAI_TESTING - pdsch->pdschTimeAlloc.startSymb = 1; -#endif pdsch->pdschTimeAlloc.numSymb = initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol; - pdsch->pdschFreqAlloc.vrbPrbMapping = 0; /* non-interleaved */ pdsch->pdschFreqAlloc.resourceAllocType = 1; /* RAT type-1 RIV format */ pdsch->pdschFreqAlloc.startPrb = 0; - pdsch->pdschFreqAlloc.numPrb = \ - schCalcNumPrb(tbSize, mcs, initialBwp->pdschCommon.timeDomRsrcAllocList[k0Index].lengthSymbol); /* Find total symbols occupied including DMRS */ dmrsStartSymbol = findDmrsStartSymbol(pdsch->dmrs.dlDmrsSymbPos); @@ -1047,6 +1097,10 @@ uint8_t schFillRar(SchCellCb *cell, SlotTimingInfo rarTime, uint16_t ueId, RarAl { startSymbol = dmrsStartSymbol; numSymbol = pdsch->dmrs.nrOfDmrsSymbols + pdsch->pdschTimeAlloc.numSymb; + if(numSymbol >= MAX_SYMB_PER_SLOT) + { + numSymbol = (MAX_SYMB_PER_SLOT - 1); + } } /* Allocate the number of PRBs required for RAR PDSCH */ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index b42aad5d6..e65790047 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -101,7 +101,12 @@ #define MAX_NUM_DL_DATA_TO_UL_ACK 15 #define QPSK_MODULATION 2 +#ifndef OAI_TESTING #define RAR_PAYLOAD_SIZE 10 /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */ +#else +#define RAR_PAYLOAD_SIZE 9 /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 9 bytes long */ +#endif + #ifdef OAI_TESTING #define TX_PAYLOAD_HDR_LEN 0 /* OAI L1 requires */ #else @@ -1291,6 +1296,7 @@ typedef struct tbInfo uint8_t ndi; /* NDI */ uint8_t rv; /* Redundancy Version */ uint16_t tbSize; /* TB Size */ + uint16_t tgtCodeRate; uint8_t qamOrder; /* Modulation Order */ SchMcsTable mcsTable; /* MCS Table */ }TbInfo;