From b4288f335897726a8aebf951a80089dbb6d16a04 Mon Sep 17 00:00:00 2001 From: svaidhya Date: Thu, 11 Jul 2024 12:29:45 +0530 Subject: [PATCH] [Epic-Id: ODUHIGH-576][Task-Id: ODUHIGH-594][SubTask-Id: ODUHIGH-612] | NFAPI_BRANCH | DL_TTI_REQ Change-Id: I856231bbb7c00ad92a59cfe9b5a85a75b0aba358 Signed-off-by: svaidhya --- src/5gnrmac/lwr_mac_fsm.c | 8 -- src/5gnrmac/lwr_mac_fsm.h | 9 ++ src/5gnrmac/lwr_mac_phy.c | 11 +- src/5gnrmac/nfapi_p7_clk.c | 14 +- src/5gnrmac/nfapi_p7_msg_hdl.c | 287 +++++++++++++++++++++++++++++++++++++ src/5gnrmac/nfapi_p7_msg_hdl.h | 1 + src/5gnrmac/nfapi_udp_p7.c | 1 + src/intel_fapi/nfapi_interface.h | 1 - src/pnf_stub/pnf_stub_p7_msg_hdl.c | 33 ++++- 9 files changed, 341 insertions(+), 24 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index 531c19496..f9445f2e4 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -43,14 +43,6 @@ #include "nfapi_common.h" #endif -#define MIB_SFN_BITMASK 0xFC -#define PDCCH_PDU_TYPE 0 -#define PDSCH_PDU_TYPE 1 -#define SSB_PDU_TYPE 3 -#define PRACH_PDU_TYPE 0 -#define PUSCH_PDU_TYPE 1 -#define PUCCH_PDU_TYPE 2 -#define PDU_PRESENT 1 #define SET_MSG_LEN(x, size) x += size /* Global variables */ diff --git a/src/5gnrmac/lwr_mac_fsm.h b/src/5gnrmac/lwr_mac_fsm.h index 667a512b5..14e4b4f96 100644 --- a/src/5gnrmac/lwr_mac_fsm.h +++ b/src/5gnrmac/lwr_mac_fsm.h @@ -29,6 +29,15 @@ #define CORESET_TYPE2 2 #define CORESET_TYPE3 3 +#define MIB_SFN_BITMASK 0xFC +#define PDCCH_PDU_TYPE 0 +#define PDSCH_PDU_TYPE 1 +#define SSB_PDU_TYPE 3 +#define PRACH_PDU_TYPE 0 +#define PUSCH_PDU_TYPE 1 +#define PUCCH_PDU_TYPE 2 +#define PDU_PRESENT 1 + #ifdef INTEL_WLS_MEM #define WLS_MEM_FREE_PRD 10 /* Free memory after 10 slot ind */ #endif diff --git a/src/5gnrmac/lwr_mac_phy.c b/src/5gnrmac/lwr_mac_phy.c index 4ac43cd24..1cc7ad736 100644 --- a/src/5gnrmac/lwr_mac_phy.c +++ b/src/5gnrmac/lwr_mac_phy.c @@ -37,6 +37,9 @@ #ifdef INTEL_WLS_MEM #include "wls_lib.h" #endif +#ifdef NFAPI_ENABLED +#include "nfapi_p7_msg_hdl.h" +#endif #ifdef INTEL_WLS_MEM CmLListCp wlsBlockToFreeList[WLS_MEM_FREE_PRD]; @@ -275,10 +278,8 @@ uint8_t LwrMacSendToL1(void *msg) { uint8_t ret = ROK; #ifdef INTEL_FAPI -#ifndef NFAPI_ENABLED uint32_t msgLen =0; p_fapi_api_queue_elem_t currMsg = NULLP; -#endif #ifdef CALL_FLOW_DEBUG_LOG char message[100]; @@ -375,7 +376,6 @@ uint8_t LwrMacSendToL1(void *msg) } } #else -#ifndef NFAPI_ENABLED p_fapi_api_queue_elem_t nextMsg = NULLP; /* FAPI header and vendor specific msgs are freed here. Only @@ -388,7 +388,11 @@ uint8_t LwrMacSendToL1(void *msg) if((currMsg->msg_type != FAPI_VENDOR_MSG_HEADER_IND) && \ (currMsg->msg_type != FAPI_VENDOR_MESSAGE)) { +#ifndef NFAPI_ENABLED l1ProcessFapiRequest(currMsg->msg_type, msgLen, currMsg); +#else + nfapiFillAndSendP7TransMsg(currMsg->msg_type, msgLen, currMsg); +#endif } else { @@ -397,7 +401,6 @@ uint8_t LwrMacSendToL1(void *msg) currMsg = nextMsg; } #endif -#endif #endif return ret; } diff --git a/src/5gnrmac/nfapi_p7_clk.c b/src/5gnrmac/nfapi_p7_clk.c index df0c77c02..8e1abf3c3 100644 --- a/src/5gnrmac/nfapi_p7_clk.c +++ b/src/5gnrmac/nfapi_p7_clk.c @@ -179,7 +179,7 @@ void nfapiGenerateTicks() vnfDb.vnfP7Info.p7SyncInfo.frameInfo.sfn++; vnfDb.vnfP7Info.p7SyncInfo.frameInfo.slot++; - DU_LOG("INFO --> VNF_NFAPI : Starting to generate slot indications t_ref:%llu, slotDur:%f, perTTi:%u, slotsPerFrame:%d, nanoSec:%d",\ + DU_LOG("INFO --> NFAPI_VNF : Starting to generate slot indications t_ref:%llu, slotDur:%f, perTTi:%u, slotsPerFrame:%d, nanoSec:%d",\ vnfDb.vnfP7Info.t_ref_ns, slotDur_ms, PER_TTI_TIME_USEC, NUM_SLOTS_PER_SUBFRAME, tti_req.tv_nsec); nfapiBuildAndSendDlNodeSync(); } @@ -187,14 +187,14 @@ void nfapiGenerateTicks() { CALC_NEXT_SFN_SLOT(vnfDb.vnfP7Info.p7SyncInfo.frameInfo); } -#if 0 - /*TODO: To enable when P5 messages are all done and implemented*/ - if(nfapiSendSlotIndToMac() != ROK) + if(vnfDb.vnfP7Info.p7SyncInfo.inSync == TRUE) { - DU_LOG("ERROR -> NFAPI_VNF: Memory Corruption issue while sending SLOT IND to MAC"); - break; + if(nfapiSendSlotIndToMac() != ROK) + { + DU_LOG("ERROR -> NFAPI_VNF: Memory Corruption issue while sending SLOT IND to MAC"); + break; + } } -#endif #ifdef ODU_SLOT_IND_DEBUG_LOG DU_LOG("VNF_NFAPI --> DEBUG: SFN/Slot:%d,%d",\ diff --git a/src/5gnrmac/nfapi_p7_msg_hdl.c b/src/5gnrmac/nfapi_p7_msg_hdl.c index a1b0ecb23..d82a244ae 100644 --- a/src/5gnrmac/nfapi_p7_msg_hdl.c +++ b/src/5gnrmac/nfapi_p7_msg_hdl.c @@ -23,12 +23,291 @@ #include "common_def.h" #include "mac_utils.h" #include "lwr_mac.h" +#include "lwr_mac_fsm.h" +#include "fapi_vendor_extension.h" #include "nfapi_interface.h" #include "nfapi_common.h" #include "nfapi_udp_p7.h" extern NfapiVnfDb vnfDb; +/*********************************************************************** + * + * @brief Pack parameters of Precoding and Beamforming + * + * @details + * + * Function : nfapiFillPrecodingBeamform + * + * Functionality: + * Pack parameters of Precoding and Beamforming and fill it in MsgBuffer + * of NFAPI + * + * @params[in] Buffer *mBuf, preCodingAndBeamforming + * @return void + * + * ********************************************************************/ + +void nfapiFillPrecodingBeamform(fapi_precoding_bmform_t *preCodingAndBeamforming, Buffer *mBuf) +{ + CMCHKPK(oduPackPostUInt16, preCodingAndBeamforming->numPrgs, mBuf); + CMCHKPK(oduPackPostUInt16, preCodingAndBeamforming->prgSize, mBuf); + CMCHKPK(oduPackPostUInt8, preCodingAndBeamforming->digBfInterfaces, mBuf); + for(uint8_t padIdx = 0; padIdx < 3; padIdx++) + { + CMCHKPK(oduPackPostUInt8, preCodingAndBeamforming->pad[padIdx], mBuf); + } + for(uint8_t prgIdx = 0; prgIdx < preCodingAndBeamforming->numPrgs; prgIdx++) + { + CMCHKPK(oduPackPostUInt16, preCodingAndBeamforming->pmi_bfi[prgIdx].pmIdx, mBuf); + for(uint8_t padIdx = 0; padIdx < 2; padIdx++) + { + CMCHKPK(oduPackPostUInt8, preCodingAndBeamforming->pmi_bfi[prgIdx].pad[padIdx], mBuf); + } + for(uint8_t digBfIdx = 0; digBfIdx < preCodingAndBeamforming->digBfInterfaces; digBfIdx++) + { + CMCHKPK(oduPackPostUInt16, preCodingAndBeamforming->pmi_bfi[prgIdx].beamIdx[digBfIdx].beamidx, mBuf); + } + } +} + +/*********************************************************************** + * + * @brief Fill P7 DL TTI REQ and send via UDP + * + * @details + * + * Function : nfapiBuildAndSendDlTtiReq + * + * Functionality: + * Fill P7 DL TTI REQ by packing each element of FAPI_DL_TTI_REQ + * + * @params[in] FapiMsgBody, MsgLength + * @return ROK - success + * RFAILED - failure + * + * ********************************************************************/ + +uint8_t nfapiBuildAndSendDlTtiReq(void *fapiMsg, uint32_t msgLen) +{ + Buffer *mBuf = NULLP; + uint8_t pduIdx = 0, freqIdx = 0, dciIndex = 0, ueGrpIdx = 0; + uint8_t numBytes = 0, ret = ROK; + + p_fapi_api_queue_elem_t dlTtiElem = (p_fapi_api_queue_elem_t)fapiMsg; + fapi_dl_tti_req_t *dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1); + + if(ODU_GET_MSG_BUF(MAC_MEM_REGION, MAC_POOL, &mBuf) != ROK) + { + DU_LOG("\nERROR --> NFAPI_VNF : Memory allocation failed in packPnfParamReq"); + return RFAILED; + } + + nfapiFillP7Hdr(mBuf,(sizeof(fapi_dl_tti_req_msg_body) + sizeof(nFapi_msg_header)), 0, 0); + nfapiFillMsgHdr(mBuf, vnfDb.vnfP7Info.p7SyncInfo.phyId, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_msg_body)); + + CMCHKPK(oduPackPostUInt16, dlTtiReq->sfn, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->slot, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->nPdus, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->nGroup, mBuf); + for(pduIdx = 0; pduIdx < dlTtiReq->nPdus; pduIdx++) + { + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pduType, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pduSize, mBuf); + switch(dlTtiReq->pdus[pduIdx].pduType) + { + case PDCCH_PDU_TYPE: + { + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.bwpSize, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.bwpStart, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.subCarrierSpacing, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.cyclicPrefix, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.startSymbolIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.durationSymbols, mBuf); + for(freqIdx = 0; freqIdx < 6; freqIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.freqDomainResource[freqIdx], mBuf); + } + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.cceRegMappingType, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.regBundleSize, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.interleaverSize, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.coreSetType, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.shiftIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.precoderGranularity, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.pad, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.numDlDci, mBuf); + for(dciIndex = 0; dciIndex < dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.numDlDci; dciIndex++) + { + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].rnti, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].scramblingId, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].scramblingRnti, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].cceIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].aggregationLevel, mBuf); + + nfapiFillPrecodingBeamform(&dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].pc_and_bform, mBuf); + + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].beta_pdcch_1_0, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].powerControlOffsetSS, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].payloadSizeBits, mBuf); + numBytes = dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].payloadSizeBits / 8; + if(dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].payloadSizeBits % 8) + numBytes += 1; + + for(uint8_t payloadIdx = 0; payloadIdx < numBytes; payloadIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdcch_pdu.dlDci[dciIndex].payload[payloadIdx], mBuf); + } + } + break; + } + case PDSCH_PDU_TYPE: + { + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.pduBitMap, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.rnti, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.pdu_index, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.bwpSize, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.bwpStart, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.subCarrierSpacing, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cyclicPrefix, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.nrOfCodeWords, mBuf); + for(uint8_t padIdx = 0; padIdx < 3; padIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.pad[padIdx], mBuf); + } + for(uint8_t cwIdx = 0; cwIdx < dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.nrOfCodeWords; cwIdx++) + { + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].targetCodeRate, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].qamModOrder, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].mcsIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].mcsTable, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].rvIndex, mBuf); + for(uint8_t padIdx = 0; padIdx < 2; padIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].pad[padIdx], mBuf); + } + CMCHKPK(oduPackPostUInt32, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.cwInfo[cwIdx].tbSize, mBuf); + } + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dataScramblingId, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.nrOfLayers, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.transmissionScheme, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.refPoint, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dmrsConfigType, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dlDmrsSymbPos, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.scid, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.numDmrsCdmGrpsNoData, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.resourceAlloc, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.pad1, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dlDmrsScramblingId, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dmrsPorts, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.rbStart, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.rbSize, mBuf); + for(uint8_t rbBitMapIdx = 0; rbBitMapIdx < 36; rbBitMapIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.rbBitmap[rbBitMapIdx], mBuf); + } + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.vrbToPrbMapping, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.startSymbIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.nrOfSymbols, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.ptrsPortIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.ptrsTimeDensity, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.ptrsFreqDensity, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.ptrsReOffset, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.nEpreRatioOfPdschToPtrs, mBuf); + + nfapiFillPrecodingBeamform(&dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.preCodingAndBeamforming, mBuf); + + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.powerControlOffset, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.powerControlOffsetSS, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.isLastCbPresent, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.isInlineTbCrc, mBuf); + CMCHKPK(oduPackPostUInt32, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dlTbCrc, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.mappingType, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.nrOfDmrsSymbols, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.dmrsAddPos, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.pdsch_pdu.pad2, mBuf); + break; + } + case SSB_PDU_TYPE: + { + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.physCellId, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.betaPss, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.ssbBlockIndex, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.ssbSubCarrierOffset, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.bchPayloadFlag, mBuf); + CMCHKPK(oduPackPostUInt16, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.ssbOffsetPointA, mBuf); + CMCHKPK(oduPackPostUInt32, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.bchPayload.bchPayload, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.bchPayload.phyMibPdu.dmrsTypeAPosition, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.bchPayload.phyMibPdu.pdcchConfigSib1, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.bchPayload.phyMibPdu.cellBarred, mBuf); + CMCHKPK(oduPackPostUInt8, dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.bchPayload.phyMibPdu.intraFreqReselection, mBuf); + + nfapiFillPrecodingBeamform(&dlTtiReq->pdus[pduIdx].pdu.ssb_pdu.preCodingAndBeamforming, mBuf); + + break; + } + default: + { + DU_LOG("\nERROR --> NFAPI_VNF: Incorrect pduType:%d", dlTtiReq->pdus[pduIdx].pduType); + ODU_PUT_MSG_BUF(mBuf); + return RFAILED; + } + } + } + for(ueGrpIdx = 0; ueGrpIdx < dlTtiReq->nGroup; ueGrpIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->ue_grp_info[ueGrpIdx].nUe, mBuf); + for(uint8_t padIdx = 0; padIdx < 3; padIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->ue_grp_info[ueGrpIdx].pad[padIdx], mBuf); + } + for(uint8_t ueIdx = 0; ueIdx < dlTtiReq->ue_grp_info[ueGrpIdx].nUe; ueIdx++) + { + CMCHKPK(oduPackPostUInt8, dlTtiReq->ue_grp_info[ueGrpIdx].pduIdx[ueIdx], mBuf); + } + } + + ret = nfapiP7UdpSendMsg(mBuf); + + return ret; +} + +/*********************************************************************** + * + * @brief Fill P7 Transparent Msgs and Build NFAPI msg and send via UDP + * + * @details + * + * Function : nfapiFillAndSendP7TransMsg + * + * Functionality: + * Fill P7 Transparent Msgs and Build NFAPI msg and send via UDP + * + * @params[in] : MsgType(P7 Transparent Msg), MsgLen and FAPI_MSG_BODY + * @return ROK - success + * RFAILED - failure + * + * ********************************************************************/ + +uint8_t nfapiFillAndSendP7TransMsg(uint8_t msgType, uint32_t msgLen, void *fapiP7Msg) +{ + switch(msgType) + { + case FAPI_DL_TTI_REQUEST: + { + DU_LOG("\nINFO --> NFAPI_VNF:DL_TTI_REQ received from LWR_MAC as FAPI_MSG_BODY"); + nfapiBuildAndSendDlTtiReq(fapiP7Msg, msgLen); + break; + } + default: + { + DU_LOG("\nERROR --> NFAPI_VNF: Incorrect MsgType:%d",msgType); + break; + } + } + LWR_MAC_FREE(fapiP7Msg, msgLen); + return ROK; +} + /******************************************************************* * * @brief Build and Sends DL_NODE_SYNC @@ -146,6 +425,14 @@ uint8_t nfapiP7ProcUlNodeSync(Buffer *mBuf) CMP_INFO(t3_sfnSlot, vnfDb.vnfP7Info.p7SyncInfo.frameInfo, cmpStatus); if(cmpStatus == 0) { + if(!vnfDb.vnfP7Info.p7SyncInfo.inSync) + { + if(nfapiSendSlotIndToMac() != ROK) + { + DU_LOG("\nERROR -> NFAPI_VNF: Memory Corruption issue while sending SLOT IND to MAC"); + return RFAILED; + } + } vnfDb.vnfP7Info.p7SyncInfo.inSync = TRUE; } else diff --git a/src/5gnrmac/nfapi_p7_msg_hdl.h b/src/5gnrmac/nfapi_p7_msg_hdl.h index 93a2c83c6..cad33f858 100644 --- a/src/5gnrmac/nfapi_p7_msg_hdl.h +++ b/src/5gnrmac/nfapi_p7_msg_hdl.h @@ -23,5 +23,6 @@ uint8_t nfapiBuildAndSendDlNodeSync(); uint8_t nfapiP7MsgHandler(Buffer *mBuf); +uint8_t nfapiFillAndSendP7TransMsg(uint8_t msgType, uint32_t msgLen, void *fapiP7Msg); #endif diff --git a/src/5gnrmac/nfapi_udp_p7.c b/src/5gnrmac/nfapi_udp_p7.c index 8a96d4098..7c67f8874 100644 --- a/src/5gnrmac/nfapi_udp_p7.c +++ b/src/5gnrmac/nfapi_udp_p7.c @@ -379,6 +379,7 @@ uint8_t nfapiP7UdpSendMsg(Buffer *mBuf) DU_LOG("DEBUG --> NFAPI_VNF : Sent NFAPI P7 Message [%ld]", numDataSent+1); numDataSent++; } + ODU_PUT_MSG_BUF(mBuf); return ROK; } diff --git a/src/intel_fapi/nfapi_interface.h b/src/intel_fapi/nfapi_interface.h index b2a9b91ba..449771292 100644 --- a/src/intel_fapi/nfapi_interface.h +++ b/src/intel_fapi/nfapi_interface.h @@ -320,7 +320,6 @@ typedef struct fapi_dl_tti_req_msg_body_t{ uint16_t slot; uint8_t nPdus; uint8_t nGroup; - uint8_t pad[2]; fapi_dl_tti_req_pdu_t pdus[FAPI_MAX_PDUS_PER_SLOT]; // 5G FAPI Table 3-35 fapi_ue_info_t ue_grp_info[FAPI_MAX_NUMBER_OF_GROUPS_PER_TTI]; }fapi_dl_tti_req_msg_body; diff --git a/src/pnf_stub/pnf_stub_p7_msg_hdl.c b/src/pnf_stub/pnf_stub_p7_msg_hdl.c index 003133a62..ad1079367 100644 --- a/src/pnf_stub/pnf_stub_p7_msg_hdl.c +++ b/src/pnf_stub/pnf_stub_p7_msg_hdl.c @@ -154,6 +154,28 @@ uint8_t pnfDlNodeSyncHandler(Buffer *mBuf) return ret; } +/********************************************************************************* + * + * @Function Name: pnfDlTtiReq + * + * + * @Functionality: + * Handles the P7 DL TTI REQ by unpacking the MsgBuffer received + * + * @Params [IN]: Message Buffer received at UDP NFAPI P7 Interface + * + * *******************************************************************************/ +uint8_t pnfDlTtiReq(Buffer *mBuf) +{ + fapi_dl_tti_req_msg_body fapiMsgBody; + + CMCHKPK(oduUnpackUInt16, &fapiMsgBody.sfn, mBuf); + CMCHKPK(oduUnpackUInt16, &fapiMsgBody.slot, mBuf); + CMCHKPK(oduUnpackUInt8, &fapiMsgBody.nPdus, mBuf); + DU_LOG("INFO --> NFAPI_PNF: DL_TTI_REQ SFN/SLOT:%d/%d, nPdu:%d",fapiMsgBody.sfn, fapiMsgBody.slot, fapiMsgBody.nPdus); + return ROK; +} + /********************************************************************************* * * @Function Name: pnfP7MsgHandler @@ -182,6 +204,13 @@ uint8_t pnfP7MsgHandler(Buffer *mBuf) ret = pnfDlNodeSyncHandler(mBuf); break; } + + case FAPI_DL_TTI_REQUEST: + { + DU_LOG("\nINFO --> NFAPI_PNF: DL_TTI_REQ recevied."); + ret = pnfDlTtiReq(mBuf); + break; + } default: { DU_LOG("ERROR --> NFAPI_PNF: Wrong MSGID of NFAPI P7 Message:%d",msgHdr.msg_id); @@ -190,10 +219,6 @@ uint8_t pnfP7MsgHandler(Buffer *mBuf) } } - if(ret == RFAILED) - { - return RFAILED; - } return ret; } -- 2.16.6