From: pborla Date: Tue, 10 Sep 2024 09:28:47 +0000 (+0530) Subject: Changes in fapi dl_tti, ul_tti msg as per OAI code base X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=cde248543434a17975855ea4d73ee0695d38c747;p=o-du%2Fl2.git Changes in fapi dl_tti, ul_tti msg as per OAI code base Change-Id: I6a327c6f330b26612bb129bcb75aa15a1f776f84 Signed-off-by: pborla --- diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index b72e29904..8fbc10f9a 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -2718,9 +2718,10 @@ uint8_t lwr_mac_procStopReqEvt(SlotTimingInfo slotInfo, p_fapi_api_queue_elem_t fapi_stop_req_t *stopReq; p_fapi_api_queue_elem_t stopReqElem; +#ifndef OAI_TESTING vendorMsg->sfn = slotInfo.sfn; vendorMsg->slot = slotInfo.slot; - +#endif /* Fill FAPI stop req */ LWR_MAC_ALLOC(stopReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_stop_req_t))); if(!stopReqElem) @@ -3532,6 +3533,7 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_ /* Calculating PDU length. Considering only one dl dci pdu for now */ dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdcch_pdu_t); +#ifndef OAI_TESTING /* Filling Vendor message PDU */ dlTtiVendorPdu->pdu_type = FAPI_PDCCH_PDU_TYPE; dlTtiVendorPdu->pdu_size = sizeof(fapi_vendor_dl_pdcch_pdu_t); @@ -3541,6 +3543,7 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_ dlTtiVendorPdu->pdu.pdcch_pdu.dl_dci[dciIndex].epre_ratio_of_pdcch_to_ssb = 0; dlTtiVendorPdu->pdu.pdcch_pdu.dl_dci[dciIndex].epre_ratio_of_dmrs_to_ssb = 0; } +#endif } return ROK; @@ -3708,6 +3711,7 @@ void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_pdu dlTtiReqPdu->pduSize = sizeof(fapi_dl_pdsch_pdu_t); +#ifndef OAI_TESTING /* DL TTI Request vendor message */ dlTtiVendorPdu->pdu_type = FAPI_PDSCH_PDU_TYPE; dlTtiVendorPdu->pdu_size = sizeof(fapi_vendor_dl_pdsch_pdu_t); @@ -3716,6 +3720,7 @@ void fillPdschPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, fapi_vendor_dl_tti_req_pdu { dlTtiVendorPdu->pdu.pdsch_pdu.tx_ru_idx[i] =0; } +#endif } } @@ -4089,293 +4094,358 @@ uint8_t fillDlMsgTxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, DlMsg uint16_t fillDlTtiReq(SlotTimingInfo currTimingInfo) { #ifdef CALL_FLOW_DEBUG_LOG - DU_LOG("\nCall Flow: ENTMAC -> ENTLWRMAC : DL_TTI_REQUEST\n"); + DU_LOG("\nCall Flow: ENTMAC -> ENTLWRMAC : DL_TTI_REQUEST\n"); #endif #ifdef INTEL_FAPI - uint8_t idx =0; - uint8_t nPdu = 0; - uint8_t numPduEncoded = 0; - uint8_t ueIdx; - uint16_t cellIdx =0; - uint16_t pduIndex = 0; + uint8_t idx =0; + uint8_t nPdu = 0; + uint8_t numPduEncoded = 0; + uint8_t ueIdx; + uint16_t cellIdx =0; + uint16_t pduIndex = 0; + + SlotTimingInfo dlTtiReqTimingInfo; + MacDlSlot *currDlSlot = NULLP; + MacCellCfg macCellCfg; + RntiType rntiType; + fapi_dl_tti_req_t *dlTtiReq = NULLP; + fapi_msg_header_t *msgHeader = NULLP; + p_fapi_api_queue_elem_t dlTtiElem; + p_fapi_api_queue_elem_t headerElem; + p_fapi_api_queue_elem_t prevElem; + if(lwrMacCb.phyState == PHY_STATE_RUNNING) + { + GET_CELL_IDX(currTimingInfo.cellId, cellIdx); + /* consider phy delay */ + ADD_DELTA_TO_TIME(currTimingInfo,dlTtiReqTimingInfo,gConfigInfo.gPhyDeltaDl, macCb.macCell[cellIdx]->numOfSlots); + dlTtiReqTimingInfo.cellId = currTimingInfo.cellId; + + macCellCfg = macCb.macCell[cellIdx]->macCellCfg; + + currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlTtiReqTimingInfo.slot]; - SlotTimingInfo dlTtiReqTimingInfo; - MacDlSlot *currDlSlot = NULLP; - MacCellCfg macCellCfg; - RntiType rntiType; - fapi_dl_tti_req_t *dlTtiReq = NULLP; - fapi_msg_header_t *msgHeader = NULLP; - p_fapi_api_queue_elem_t dlTtiElem; - p_fapi_api_queue_elem_t headerElem; - p_fapi_api_queue_elem_t prevElem; - if(lwrMacCb.phyState == PHY_STATE_RUNNING) - { - GET_CELL_IDX(currTimingInfo.cellId, cellIdx); - /* consider phy delay */ - ADD_DELTA_TO_TIME(currTimingInfo,dlTtiReqTimingInfo,gConfigInfo.gPhyDeltaDl, macCb.macCell[cellIdx]->numOfSlots); - dlTtiReqTimingInfo.cellId = currTimingInfo.cellId; - - macCellCfg = macCb.macCell[cellIdx]->macCellCfg; - - currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlTtiReqTimingInfo.slot]; - - /* Vendor Message */ - fapi_vendor_msg_t *vendorMsg; - p_fapi_api_queue_elem_t vendorMsgQElem; - /* Allocte And fill Vendor msg */ - LWR_MAC_ALLOC(vendorMsgQElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t))); - if(!vendorMsgQElem) - { - DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for vendor msg in config req"); - return RFAILED; - } - FILL_FAPI_LIST_ELEM(vendorMsgQElem, NULLP, FAPI_VENDOR_MESSAGE, 1, sizeof(fapi_vendor_msg_t)); - vendorMsg = (fapi_vendor_msg_t *)(vendorMsgQElem + 1); - fillMsgHeader(&vendorMsg->header, FAPI_VENDOR_MESSAGE, sizeof(fapi_vendor_msg_t)); - - LWR_MAC_ALLOC(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t))); - if(dlTtiElem) - { - FILL_FAPI_LIST_ELEM(dlTtiElem, NULLP, FAPI_DL_TTI_REQUEST, 1, \ - sizeof(fapi_dl_tti_req_t)); - /* Fill message header */ - LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t))); - if(!headerElem) - { - DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for header in DL TTI req"); - LWR_MAC_FREE(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t))); - return RFAILED; - } - - FILL_FAPI_LIST_ELEM(headerElem, dlTtiElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \ - sizeof(fapi_msg_header_t)); - msgHeader = (fapi_msg_header_t *)(headerElem + 1); - msgHeader->num_msg = 2; - msgHeader->handle = 0; - - /* Fill Dl TTI Request */ - dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1); - memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t)); - fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_t)); - - dlTtiReq->sfn = dlTtiReqTimingInfo.sfn; - dlTtiReq->slot = dlTtiReqTimingInfo.slot; - dlTtiReq->nPdus = calcDlTtiReqPduCount(currDlSlot); /* get total Pdus */ - nPdu = dlTtiReq->nPdus; - - vendorMsg->p7_req_vendor.dl_tti_req.num_pdus = nPdu; - vendorMsg->p7_req_vendor.dl_tti_req.sym = 0; - - dlTtiReq->nGroup = 0; - if(dlTtiReq->nPdus > 0) - { - if(currDlSlot->dlInfo.isBroadcastPres) - { - if(currDlSlot->dlInfo.brdcstAlloc.ssbTransmissionMode) - { - if(dlTtiReq->pdus != NULLP) - { - for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++) - { - fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\ - currDlSlot, idx, dlTtiReq->sfn); - numPduEncoded++; - } - } - DU_LOG("\033[1;31m"); - DU_LOG("\nDEBUG --> LWR_MAC: MIB sent.."); - DU_LOG("\033[0m"); - } - - if(currDlSlot->dlInfo.brdcstAlloc.sib1TransmissionMode) - { - /* Filling SIB1 param */ - if(numPduEncoded != nPdu) - { - if(currDlSlot->dlInfo.brdcstAlloc.crnti == SI_RNTI) - rntiType = SI_RNTI_TYPE; - - /* PDCCH PDU */ - fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - currDlSlot, -1, rntiType, CORESET_TYPE0, MAX_NUM_UE); - numPduEncoded++; - - /* PDSCH PDU */ - fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci[0].pdschCfg, - currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp, - pduIndex); - dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex; - pduIndex++; - numPduEncoded++; - } - DU_LOG("\033[1;34m"); - DU_LOG("\nDEBUG --> LWR_MAC: SIB1 sent..."); - DU_LOG("\033[0m"); - } - } - - if(currDlSlot->pageAllocInfo != NULLP) - { - /* Filling DL Paging Alloc param */ - if(numPduEncoded != nPdu) - { - rntiType = P_RNTI_TYPE; - fillPagePdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], \ - currDlSlot->pageAllocInfo, &macCellCfg); - numPduEncoded++; - fillPagePdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - currDlSlot->pageAllocInfo, pduIndex, &macCellCfg); - dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex; - pduIndex++; - numPduEncoded++; - } - DU_LOG("\033[1;34m"); - DU_LOG("\nDEBUG --> LWR_MAC: PAGE sent..."); - DU_LOG("\033[0m"); - } - - for(ueIdx=0; ueIdxdlInfo.rarAlloc[ueIdx] != NULLP) - { - /* Filling RAR param */ - rntiType = RA_RNTI_TYPE; - if(currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdcchCfg) - { - fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - currDlSlot, -1, rntiType, CORESET_TYPE0, ueIdx); - numPduEncoded++; - MAC_FREE(currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdcchCfg, sizeof(PdcchCfg)); - } - if(currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdschCfg) - { - fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdschCfg, - currDlSlot->dlInfo.rarAlloc[ueIdx]->bwp, - pduIndex); - numPduEncoded++; - pduIndex++; - - DU_LOG("\033[1;32m"); - DU_LOG("\nDEBUG --> LWR_MAC: RAR sent..."); - DU_LOG("\033[0m"); - } - } - - if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx] != NULLP) - { - if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg) \ - { - rntiType = C_RNTI_TYPE; - fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], - currDlSlot, idx, rntiType, currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg->coresetCfg.coreSetType, ueIdx); - numPduEncoded++; - } +#ifndef OAI_TESTING + /* Vendor Message */ + fapi_vendor_msg_t *vendorMsg; + p_fapi_api_queue_elem_t vendorMsgQElem; + /* Allocte And fill Vendor msg */ + LWR_MAC_ALLOC(vendorMsgQElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t))); + if(!vendorMsgQElem) + { + DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for vendor msg in config req"); + return RFAILED; + } + FILL_FAPI_LIST_ELEM(vendorMsgQElem, NULLP, FAPI_VENDOR_MESSAGE, 1, sizeof(fapi_vendor_msg_t)); + vendorMsg = (fapi_vendor_msg_t *)(vendorMsgQElem + 1); + fillMsgHeader(&vendorMsg->header, FAPI_VENDOR_MESSAGE, sizeof(fapi_vendor_msg_t)); +#endif + LWR_MAC_ALLOC(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t))); + if(dlTtiElem) + { + FILL_FAPI_LIST_ELEM(dlTtiElem, NULLP, FAPI_DL_TTI_REQUEST, 1, \ + sizeof(fapi_dl_tti_req_t)); + /* Fill message header */ + LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t))); + if(!headerElem) + { + DU_LOG("\nERROR --> LWR_MAC: Memory allocation failed for header in DL TTI req"); + LWR_MAC_FREE(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t))); + return RFAILED; + } + + FILL_FAPI_LIST_ELEM(headerElem, dlTtiElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \ + sizeof(fapi_msg_header_t)); + msgHeader = (fapi_msg_header_t *)(headerElem + 1); + msgHeader->num_msg = 2; + msgHeader->handle = 0; + + /* Fill Dl TTI Request */ + dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1); + memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t)); + fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_t)); + + dlTtiReq->sfn = dlTtiReqTimingInfo.sfn; + dlTtiReq->slot = dlTtiReqTimingInfo.slot; + dlTtiReq->nPdus = calcDlTtiReqPduCount(currDlSlot); /* get total Pdus */ + nPdu = dlTtiReq->nPdus; - if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdu != NULLP) - { - if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg) - { - fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], \ - currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg,\ - currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->bwp, pduIndex); - numPduEncoded++; - pduIndex++; - - DU_LOG("\033[1;32m"); - if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status)) - { - DU_LOG("\nDEBUG --> LWR_MAC: MSG4 sent..."); - MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status, sizeof(bool)); - } - else - { - DU_LOG("\nDEBUG --> LWR_MAC: DL MSG sent..."); - } - DU_LOG("\033[0m"); - } +#ifndef OAI_TESTING + vendorMsg->p7_req_vendor.dl_tti_req.num_pdus = nPdu; + vendorMsg->p7_req_vendor.dl_tti_req.sym = 0; +#endif + dlTtiReq->nGroup = 0; + if(dlTtiReq->nPdus > 0) + { + if(currDlSlot->dlInfo.isBroadcastPres) + { + if(currDlSlot->dlInfo.brdcstAlloc.ssbTransmissionMode) + { + if(dlTtiReq->pdus != NULLP) + { + for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++) + { + fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\ + currDlSlot, idx, dlTtiReq->sfn); + numPduEncoded++; + } + } + DU_LOG("\033[1;31m"); + DU_LOG("\nDEBUG --> LWR_MAC: MIB sent.."); + DU_LOG("\033[0m"); + } + + if(currDlSlot->dlInfo.brdcstAlloc.sib1TransmissionMode) + { + /* Filling SIB1 param */ + if(numPduEncoded != nPdu) + { + if(currDlSlot->dlInfo.brdcstAlloc.crnti == SI_RNTI) + rntiType = SI_RNTI_TYPE; - } - MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg,sizeof(PdcchCfg)); - /* else - { - MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc[ueIdx], sizeof(DlMsgAlloc)); - currDlSlot->dlInfo.dlMsgAlloc[ueIdx] = NULLP; - } - */ - } - } - - dlTtiReq->ue_grp_info[dlTtiReq->nGroup].nUe = MAX_NUM_UE_PER_TTI; - dlTtiReq->nGroup++; +#ifndef OAI_TESTING + /* PDCCH PDU */ + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], + currDlSlot, -1, rntiType, CORESET_TYPE0, MAX_NUM_UE); +#else + /* PDCCH PDU */ + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, currDlSlot, -1, rntiType, CORESET_TYPE0, MAX_NUM_UE); +#endif + numPduEncoded++; + +#ifndef OAI_TESTING + /* PDSCH PDU */ + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], + &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci[0].pdschCfg, + currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp, pduIndex); +#else + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdcchCfg->dci[0].pdschCfg, + currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp, pduIndex); +#endif + dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex; + pduIndex++; + numPduEncoded++; + } + DU_LOG("\033[1;34m"); + DU_LOG("\nDEBUG --> LWR_MAC: SIB1 sent..."); + DU_LOG("\033[0m"); + } + } + + if(currDlSlot->pageAllocInfo != NULLP) + { + /* Filling DL Paging Alloc param */ + if(numPduEncoded != nPdu) + { + rntiType = P_RNTI_TYPE; +#ifndef OAI_TESTING + fillPagePdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], \ + currDlSlot->pageAllocInfo, &macCellCfg); +#else + fillPagePdcchPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, currDlSlot->pageAllocInfo, &macCellCfg); +#endif + numPduEncoded++; +#ifndef OAI_TESTING + fillPagePdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], + currDlSlot->pageAllocInfo, pduIndex, &macCellCfg); +#else + fillPagePdschPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, currDlSlot->pageAllocInfo, pduIndex, &macCellCfg); +#endif + dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex; + pduIndex++; + numPduEncoded++; + } + DU_LOG("\033[1;34m"); + DU_LOG("\nDEBUG --> LWR_MAC: PAGE sent..."); + DU_LOG("\033[0m"); + } + + for(ueIdx=0; ueIdxdlInfo.rarAlloc[ueIdx] != NULLP) + { + /* Filling RAR param */ + rntiType = RA_RNTI_TYPE; + if(currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdcchCfg) + { +#ifndef OAI_TESTING + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], + currDlSlot, -1, rntiType, CORESET_TYPE0, ueIdx); +#else + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, currDlSlot, -1, rntiType, CORESET_TYPE0, ueIdx); +#endif + numPduEncoded++; + MAC_FREE(currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdcchCfg, sizeof(PdcchCfg)); + } + if(currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdschCfg) + { +#ifndef OAI_TESTING + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], + currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdschCfg, currDlSlot->dlInfo.rarAlloc[ueIdx]->bwp, pduIndex); +#else + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, + currDlSlot->dlInfo.rarAlloc[ueIdx]->rarPdschCfg, currDlSlot->dlInfo.rarAlloc[ueIdx]->bwp, pduIndex); +#endif + numPduEncoded++; + pduIndex++; + + DU_LOG("\033[1;32m"); + DU_LOG("\nDEBUG --> LWR_MAC: RAR sent..."); + DU_LOG("\033[0m"); + } + } + + if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx] != NULLP) + { + if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg) \ + { + rntiType = C_RNTI_TYPE; +#ifndef OAI_TESTING + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], + currDlSlot, idx, rntiType, currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg->coresetCfg.coreSetType, ueIdx); +#else + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, + currDlSlot, idx, rntiType, currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg->coresetCfg.coreSetType, ueIdx); +#endif + numPduEncoded++; + } + + if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdu != NULLP) + { + if(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg) + { +#ifndef OAI_TESTING + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], &vendorMsg->p7_req_vendor.dl_tti_req.pdus[numPduEncoded], \ + currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg,\ + currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->bwp, pduIndex); +#else + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], NULLP, currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdschCfg,\ + currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->bwp, pduIndex); +#endif + numPduEncoded++; + pduIndex++; + + DU_LOG("\033[1;32m"); + if((macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status)) + { + DU_LOG("\nDEBUG --> LWR_MAC: MSG4 sent..."); + MAC_FREE(macCb.macCell[cellIdx]->macRaCb[ueIdx].macMsg4Status, sizeof(bool)); + } + else + { + DU_LOG("\nDEBUG --> LWR_MAC: DL MSG sent..."); + } + DU_LOG("\033[0m"); + } + + } + MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc[ueIdx]->dlMsgPdcchCfg,sizeof(PdcchCfg)); + /* else + { + MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc[ueIdx], sizeof(DlMsgAlloc)); + currDlSlot->dlInfo.dlMsgAlloc[ueIdx] = NULLP; + } + */ + } + } + + dlTtiReq->ue_grp_info[dlTtiReq->nGroup].nUe = MAX_NUM_UE_PER_TTI; + dlTtiReq->nGroup++; #ifdef ODU_SLOT_IND_DEBUG_LOG - DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request"); + DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request"); #endif - /* Intel L1 expects UL_TTI.request following DL_TTI.request */ - fillUlTtiReq(currTimingInfo, dlTtiElem, &(vendorMsg->p7_req_vendor.ul_tti_req)); - msgHeader->num_msg++; - - /* Intel L1 expects UL_DCI.request following DL_TTI.request */ - fillUlDciReq(dlTtiReqTimingInfo, dlTtiElem->p_next, &(vendorMsg->p7_req_vendor.ul_dci_req)); - msgHeader->num_msg++; - - /* send Tx-DATA req message */ - sendTxDataReq(dlTtiReqTimingInfo, currDlSlot, dlTtiElem->p_next->p_next, &(vendorMsg->p7_req_vendor.tx_data_req)); - if(dlTtiElem->p_next->p_next->p_next) - { - msgHeader->num_msg++; - prevElem = dlTtiElem->p_next->p_next->p_next; - } - else - prevElem = dlTtiElem->p_next->p_next; - } - else - { + /* Intel L1 expects UL_TTI.request following DL_TTI.request */ +#ifndef OAI_TESTING + fillUlTtiReq(currTimingInfo, dlTtiElem, &(vendorMsg->p7_req_vendor.ul_tti_req)); +#else + fillUlTtiReq(currTimingInfo, dlTtiElem, NULLP); +#endif + msgHeader->num_msg++; + + /* Intel L1 expects UL_DCI.request following DL_TTI.request */ +#ifndef OAI_TESTING + fillUlDciReq(dlTtiReqTimingInfo, dlTtiElem->p_next, &(vendorMsg->p7_req_vendor.ul_dci_req)); +#else + fillUlDciReq(dlTtiReqTimingInfo, dlTtiElem->p_next, NULLP); +#endif + msgHeader->num_msg++; + + /* send Tx-DATA req message */ + +#ifndef OAI_TESTING + sendTxDataReq(dlTtiReqTimingInfo, currDlSlot, dlTtiElem->p_next->p_next, &(vendorMsg->p7_req_vendor.tx_data_req)); +#else + sendTxDataReq(dlTtiReqTimingInfo, currDlSlot, dlTtiElem->p_next->p_next, NULLP); +#endif + if(dlTtiElem->p_next->p_next->p_next) + { + msgHeader->num_msg++; + prevElem = dlTtiElem->p_next->p_next->p_next; + } + else + prevElem = dlTtiElem->p_next->p_next; + } + else + { #ifdef ODU_SLOT_IND_DEBUG_LOG - DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request"); + DU_LOG("\nDEBUG --> LWR_MAC: Sending DL TTI Request"); #endif - /* Intel L1 expects UL_TTI.request following DL_TTI.request */ - fillUlTtiReq(currTimingInfo, dlTtiElem, &(vendorMsg->p7_req_vendor.ul_tti_req)); - msgHeader->num_msg++; - - /* Intel L1 expects UL_DCI.request following DL_TTI.request */ - fillUlDciReq(dlTtiReqTimingInfo, dlTtiElem->p_next, &(vendorMsg->p7_req_vendor.ul_dci_req)); - msgHeader->num_msg++; - - prevElem = dlTtiElem->p_next->p_next; - } - - if(macCb.macCell[cellIdx]->state == CELL_TO_BE_STOPPED) - { - /* Intel L1 expects UL_DCI.request following DL_TTI.request */ - lwr_mac_procStopReqEvt(currTimingInfo, prevElem, &(vendorMsg->stop_req_vendor)); - msgHeader->num_msg++; - macCb.macCell[cellIdx]->state = CELL_STOP_IN_PROGRESS; - prevElem = prevElem->p_next; - } - prevElem->p_next = vendorMsgQElem; - LwrMacSendToL1(headerElem); - memset(currDlSlot, 0, sizeof(MacDlSlot)); - return ROK; - } - else - { - DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for DL TTI Request"); - memset(currDlSlot, 0, sizeof(MacDlSlot)); - return RFAILED; - } - } - else - { - lwr_mac_procInvalidEvt(&currTimingInfo); - return RFAILED; - } + /* Intel L1 expects UL_TTI.request following DL_TTI.request */ +#ifndef OAI_TESTING + fillUlTtiReq(currTimingInfo, dlTtiElem, &(vendorMsg->p7_req_vendor.ul_tti_req)); +#else + fillUlTtiReq(currTimingInfo, dlTtiElem, NULLP); #endif - return ROK; + msgHeader->num_msg++; + + /* Intel L1 expects UL_DCI.request following DL_TTI.request */ +#ifndef OAI_TESTING + fillUlDciReq(dlTtiReqTimingInfo, dlTtiElem->p_next, &(vendorMsg->p7_req_vendor.ul_dci_req)); +#else + fillUlDciReq(dlTtiReqTimingInfo, dlTtiElem->p_next, NULLP); +#endif + msgHeader->num_msg++; + + prevElem = dlTtiElem->p_next->p_next; + } + + if(macCb.macCell[cellIdx]->state == CELL_TO_BE_STOPPED) + { + /* Intel L1 expects UL_DCI.request following DL_TTI.request */ +#ifndef OAI_TESTING + lwr_mac_procStopReqEvt(currTimingInfo, prevElem, &(vendorMsg->stop_req_vendor)); +#else + lwr_mac_procStopReqEvt(currTimingInfo, prevElem, NULLP); +#endif + msgHeader->num_msg++; + macCb.macCell[cellIdx]->state = CELL_STOP_IN_PROGRESS; + prevElem = prevElem->p_next; + } +#ifndef OAI_TESTING + prevElem->p_next = vendorMsgQElem; +#else + prevElem->p_next = NULLP; +#endif + LwrMacSendToL1(headerElem); + memset(currDlSlot, 0, sizeof(MacDlSlot)); + return ROK; + } + else + { + DU_LOG("\nERROR --> LWR_MAC: Failed to allocate memory for DL TTI Request"); + memset(currDlSlot, 0, sizeof(MacDlSlot)); + return RFAILED; + } + } + else + { + lwr_mac_procInvalidEvt(&currTimingInfo); + return RFAILED; + } +#endif + return ROK; } /******************************************************************* @@ -4427,8 +4497,9 @@ uint16_t sendTxDataReq(SlotTimingInfo currTimingInfo, MacDlSlot *dlSlot, p_fapi_ memset(txDataReq, 0, sizeof(fapi_tx_data_req_t)); fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, sizeof(fapi_tx_data_req_t)); +#ifndef OAI_TESTING vendorTxDataReq->sym = 0; - +#endif txDataReq->sfn = currTimingInfo.sfn; txDataReq->slot = currTimingInfo.slot; if(dlSlot->dlInfo.brdcstAlloc.sib1TransmissionMode) @@ -4835,8 +4906,10 @@ uint16_t fillUlTtiReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t pre ulTtiReq->sfn = ulTtiReqTimingInfo.sfn; ulTtiReq->slot = ulTtiReqTimingInfo.slot; ulTtiReq->nPdus = getnPdus(ulTtiReq, currUlSlot); +#ifndef OAI_TESTING vendorUlTti->num_ul_pdu = ulTtiReq->nPdus; vendorUlTti->sym = 0; +#endif ulTtiReq->nGroup = 0; if(ulTtiReq->nPdus > 0) { @@ -4861,7 +4934,11 @@ uint16_t fillUlTtiReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t pre DU_LOG("\nDEBUG --> LWR_MAC: UL_TTI_REQ, PUSCH PDU ueId:%d", ueIdx); #endif pduIdx++; +#ifndef OAI_TESTING fillPuschPdu(&ulTtiReq->pdus[pduIdx], &vendorUlTti->ul_pdus[pduIdx], &macCellCfg, &currUlSlot->ulSchInfo.schPuschInfo[ueIdx]); +#else + fillPuschPdu(&ulTtiReq->pdus[pduIdx], NULLP, &macCellCfg, &currUlSlot->ulSchInfo.schPuschInfo[ueIdx]); +#endif ulTtiReq->nUlsch++; } } @@ -4871,7 +4948,11 @@ uint16_t fillUlTtiReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t pre if(currUlSlot->ulSchInfo.schPucchInfo[ueIdx].crnti != 0) { pduIdx++; +#ifndef OAI_TESTING fillPucchPdu(&ulTtiReq->pdus[pduIdx], &vendorUlTti->ul_pdus[pduIdx], &macCellCfg, &currUlSlot->ulSchInfo.schPucchInfo[ueIdx]); +#else + fillPucchPdu(&ulTtiReq->pdus[pduIdx], NULLP, &macCellCfg, &currUlSlot->ulSchInfo.schPucchInfo[ueIdx]); +#endif ulTtiReq->nUlcch++; } } @@ -5141,40 +5222,46 @@ uint16_t fillUlDciReq(SlotTimingInfo currTimingInfo, p_fapi_api_queue_elem_t pre memcpy(&ulDciReqTimingInfo, &currTimingInfo, sizeof(SlotTimingInfo)); currDlSlot = &macCb.macCell[cellIdx]->dlSlot[ulDciReqTimingInfo.slot % macCb.macCell[cellIdx]->numOfSlots]; - LWR_MAC_ALLOC(ulDciElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_ul_dci_req_t))); - if(ulDciElem) - { - FILL_FAPI_LIST_ELEM(ulDciElem, NULLP, FAPI_UL_DCI_REQUEST, 1, \ - sizeof(fapi_ul_dci_req_t)); - ulDciReq = (fapi_ul_dci_req_t *)(ulDciElem +1); - memset(ulDciReq, 0, sizeof(fapi_ul_dci_req_t)); - fillMsgHeader(&ulDciReq->header, FAPI_UL_DCI_REQUEST, sizeof(fapi_ul_dci_req_t)); - - ulDciReq->sfn = ulDciReqTimingInfo.sfn; - ulDciReq->slot = ulDciReqTimingInfo.slot; - if(currDlSlot->dlInfo.ulGrant != NULLP) - { + LWR_MAC_ALLOC(ulDciElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_ul_dci_req_t))); + if(ulDciElem) + { + FILL_FAPI_LIST_ELEM(ulDciElem, NULLP, FAPI_UL_DCI_REQUEST, 1, \ + sizeof(fapi_ul_dci_req_t)); + ulDciReq = (fapi_ul_dci_req_t *)(ulDciElem +1); + memset(ulDciReq, 0, sizeof(fapi_ul_dci_req_t)); + fillMsgHeader(&ulDciReq->header, FAPI_UL_DCI_REQUEST, sizeof(fapi_ul_dci_req_t)); + + ulDciReq->sfn = ulDciReqTimingInfo.sfn; + ulDciReq->slot = ulDciReqTimingInfo.slot; + if(currDlSlot->dlInfo.ulGrant != NULLP) + { +#ifndef OAI_TESTING vendorUlDciReq->sym = 0; - ulDciReq->numPdus = 1; // No. of PDCCH PDUs vendorUlDciReq->num_pdus = ulDciReq->numPdus; +#endif + ulDciReq->numPdus = 1; // No. of PDCCH PDUs if(ulDciReq->numPdus > 0) { /* Fill PDCCH configuration Pdu */ +#ifndef OAI_TESTING fillUlDciPdcchPdu(&ulDciReq->pdus[numPduEncoded], &vendorUlDciReq->pdus[numPduEncoded], &currDlSlot->dlInfo, CORESET_TYPE1); +#else + fillUlDciPdcchPdu(&ulDciReq->pdus[numPduEncoded], NULLP, &currDlSlot->dlInfo, CORESET_TYPE1); +#endif numPduEncoded++; - /* free UL GRANT at SCH */ - MAC_FREE(currDlSlot->dlInfo.ulGrant, sizeof(DciInfo)); + /* free UL GRANT at SCH */ + MAC_FREE(currDlSlot->dlInfo.ulGrant, sizeof(DciInfo)); } #ifdef ODU_SLOT_IND_DEBUG_LOG - DU_LOG("\nDEBUG --> LWR_MAC: Sending UL DCI Request"); + DU_LOG("\nDEBUG --> LWR_MAC: Sending UL DCI Request"); #endif - } - prevElem->p_next = ulDciElem; + } + prevElem->p_next = ulDciElem; } } else { - lwr_mac_procInvalidEvt(&currTimingInfo); + lwr_mac_procInvalidEvt(&currTimingInfo); } #endif return ROK;