From: svaidhya Date: Mon, 3 Jun 2024 07:48:10 +0000 (+0530) Subject: [Epic-Id: ODUHIGH-576][Task-Id: ODUHIGH-594][SubTask-Id: ODUHIGH-605]|[NFAPI_Branch... X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=b6cd831a75d2b5ed6d6f7f00ed608cb360893df2;p=o-du%2Fl2.git [Epic-Id: ODUHIGH-576][Task-Id: ODUHIGH-594][SubTask-Id: ODUHIGH-605]|[NFAPI_Branch]|P7 Clock Creation Change-Id: I2f1a1869b733e54c74751347d4eb3b3d84bac3a7 Signed-off-by: svaidhya --- diff --git a/build/config/fdd_odu_config.xml b/build/config/fdd_odu_config.xml index fa9a6f421..5a6bc8a11 100644 --- a/build/config/fdd_odu_config.xml +++ b/build/config/fdd_odu_config.xml @@ -10,6 +10,7 @@ 25 21 23 + 24 1 1 diff --git a/build/config/tdd_odu_config.xml b/build/config/tdd_odu_config.xml index a2cfab87b..ec34fb798 100644 --- a/build/config/tdd_odu_config.xml +++ b/build/config/tdd_odu_config.xml @@ -10,6 +10,7 @@ 25 21 23 + 24 1 1 diff --git a/src/5gnrmac/lwr_mac_handle_phy.c b/src/5gnrmac/lwr_mac_handle_phy.c index cf51a7350..32445e436 100644 --- a/src/5gnrmac/lwr_mac_handle_phy.c +++ b/src/5gnrmac/lwr_mac_handle_phy.c @@ -41,7 +41,7 @@ SlotIndFunc sendSlotIndOpts[] = { packSlotInd, /* packing for loosely coupled */ - fapiMacSlotInd, /* packing for tightly coupled */ + procMacSlotInd, /* packing for tightly coupled */ packSlotInd /* packing for light weight loosly coupled */ }; diff --git a/src/5gnrmac/lwr_mac_upr_inf.h b/src/5gnrmac/lwr_mac_upr_inf.h index 304ff80a8..309e609e3 100644 --- a/src/5gnrmac/lwr_mac_upr_inf.h +++ b/src/5gnrmac/lwr_mac_upr_inf.h @@ -222,7 +222,7 @@ typedef uint8_t (*UciIndFunc)(Pst *pst, UciInd *uciInd); uint8_t packSlotInd (Pst *pst, SlotTimingInfo *slotInd); uint8_t unpackSlotInd(SlotIndFunc func, Pst *pst, Buffer *mBuf); -uint8_t fapiMacSlotInd(Pst *pst, SlotTimingInfo *slotInd); +uint8_t procMacSlotInd(Pst *pst, SlotTimingInfo *slotInd); uint8_t packRachInd(Pst *pst, RachInd *rachInd); uint8_t unpackRachInd(RachIndFunc func, Pst *pst, Buffer *mBuf); uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd); diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index 6f385c21a..9e205f1e3 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -30,6 +30,12 @@ #include "lwr_mac_fsm.h" #include "mac_utils.h" #include "lwr_mac_phy.h" +#ifdef NFAPI_ENABLED +#include "nfapi_interface.h" +#include "nfapi_vnf_fsm.h" + +extern NfapiVnfDb vnfDb; +#endif uint8_t ssbPeriodicity[6] = {5, 10, 20, 40, 80, 160}; @@ -177,6 +183,10 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) /*Ref : 3GPP 38.211 Table 4.2-1: SCS = (2 ^ numerology * 15kHz)*/ macCb.macCell[cellIdx]->numerology = log2(scsInKhz/BASE_SCS); +#ifdef NFAPI_ENABLED + vnfDb.numerology = macCb.macCell[cellIdx]->numerology; + vnfDb.cellId = macCellCfg->cellId; +#endif macCb.macCell[cellIdx]->numOfSlots = 10 * (1 << (macCb.macCell[cellIdx]->numerology)); memcpy(&macCb.macCell[cellIdx]->macCellCfg, macCellCfg, sizeof(MacCellCfg)); diff --git a/src/5gnrmac/mac_msg_router.c b/src/5gnrmac/mac_msg_router.c index 59d45be2a..253d4eabc 100755 --- a/src/5gnrmac/mac_msg_router.c +++ b/src/5gnrmac/mac_msg_router.c @@ -269,7 +269,7 @@ void MacHdlLwrMacEvents(Pst *pst, Buffer *mBuf) switch(pst->event) { case EVENT_SLOT_IND_TO_MAC: - unpackSlotInd(fapiMacSlotInd, pst, mBuf); + unpackSlotInd(procMacSlotInd, pst, mBuf); break; case EVENT_STOP_IND_TO_MAC: unpackStopInd(fapiMacStopInd, pst, mBuf); @@ -523,6 +523,21 @@ void callFlowMacActvTsk(Pst *pst) } break; } + case ENTP7CLK: + { + strcpy(sourceTask,"ENTP7CLK"); + switch(pst->event) + { + case EVENT_SLOT_IND_TO_MAC: + strcpy(message,"EVENT_SLOT_IND_TO_MAC"); + break; + default: + strcpy(message,"Invalid Event"); + break; + } + break; + } + default: { strcpy(sourceTask,"Invalid Source Entity Id"); @@ -570,6 +585,14 @@ uint8_t macActvTsk(Pst *pst, Buffer *mBuf) case ENTLWRMAC: MacHdlLwrMacEvents(pst, mBuf); break; + case ENTP7CLK: + { + if(pst->event == EVENT_SLOT_IND_TO_MAC) + { + unpackSlotInd(procMacSlotInd, pst, mBuf); + } + break; + } default: RG_FREE_MSG(mBuf); break; diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index cbcf1c347..008cce50c 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -500,11 +500,11 @@ uint8_t macProcSlotInd(SlotTimingInfo slotInd) } /* macProcSlotInd */ /** - * @brief Transmission time interval indication from PHY. + * @brief Transmission time interval indication from PHY/VNF. * * @details * - * Function : fapiMacSlotInd + * Function : procMacSlotInd * * This API is invoked by PHY to indicate TTI indication to MAC for a cell. * @@ -515,7 +515,7 @@ uint8_t macProcSlotInd(SlotTimingInfo slotInd) * -# ROK * -# RFAILED **/ -uint8_t fapiMacSlotInd(Pst *pst, SlotTimingInfo *slotInd) +uint8_t procMacSlotInd(Pst *pst, SlotTimingInfo *slotInd) { uint8_t ret = ROK; uint16_t cellIdx; @@ -590,7 +590,7 @@ uint8_t fapiMacSlotInd(Pst *pst, SlotTimingInfo *slotInd) #endif return ret; -} /* fapiMacSlotInd */ +} /* procMacSlotInd */ /********************************************************************** End of file diff --git a/src/5gnrmac/nfapi_common.h b/src/5gnrmac/nfapi_common.h index 22f843cd2..fe580920b 100644 --- a/src/5gnrmac/nfapi_common.h +++ b/src/5gnrmac/nfapi_common.h @@ -36,6 +36,11 @@ #define NFAPI_UDP_P7_INST 0 #define NFAPI_UDP_P7_PROC 0 #define EVTSTARTNFAPIP7POLL 2 +#define EVENT_NFAPI_P7_START_CLK 3 +#define NFAPI_P7_CLK_INST 0 +#define NFAPI_P7_CLK_PROC 0 +#define NFAPI_P7_CLK_MEM_REGION 6 +#define NFAPI_P7_CLK_POOL 2 #ifdef ODU_MEMORY_DEBUG_LOG #define NFAPI_UDP_P7_MEM_LOG(_macro, _file, _line, _func, _size, _datPtr)\ @@ -104,6 +109,30 @@ } \ } +#define NFAPI_P7_CLK_ALLOC_SHRABL_BUF(_buf, _size) \ +{ \ + if(SGetStaticBuffer(NFAPI_P7_CLK_MEM_REGION, NFAPI_P7_CLK_POOL, \ + (Data **)&_buf, (Size) _size, 0) == ROK) \ + { \ + NFAPI_UDP_P7_MEM_LOG("NFAPI_P7_CLK,ALLOC_SHRABL_BUF", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\ + memset((_buf), 0, _size); \ + } \ + else \ + { \ + (_buf) = NULLP; \ + } \ +} + +#define NFAPI_P7_CLK_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \ +{ \ + if (_buf != NULLP) \ + { \ + NFAPI_UDP_P7_MEM_LOG("NFAPI_P7_CLK,FREE_SHRABL_BUF", __FILE__, __LINE__, __FUNCTION__, _size, _buf);\ + (Void) SPutStaticBuffer(_region, _pool, \ + (Data *) _buf, (Size) _size, 0); \ + _buf = NULLP; \ + } \ +} /*Common Functions*/ void nfapiFillP5Hdr(Buffer *mBuf); @@ -114,5 +143,7 @@ void nFapiExtractMsgHdr(nFapi_msg_header *msgHdr, Buffer *mBuf); NfapiPnfEvent convertNfapiP5TagValToMsgId(uint16_t tagVal); uint8_t nfapiP7UdpRecvMsg(); - +void nfapiGenerateTicks(); +uint8_t nfapiSendSlotIndToMac(); +uint8_t nfapiTriggerP7Clock(); #endif diff --git a/src/5gnrmac/nfapi_p7_clk.c b/src/5gnrmac/nfapi_p7_clk.c new file mode 100644 index 000000000..d0c8f1b8b --- /dev/null +++ b/src/5gnrmac/nfapi_p7_clk.c @@ -0,0 +1,284 @@ +/******************************************************************************* + * ################################################################################ + * # Copyright (c) [2017-2019] [Radisys] + * # + * # + * # + * # Licensed under the Apache License, Version 2.0 (the "License"); + * # + * # you may not use this file except in compliance with the License. + * # + * # You may obtain a copy of the License at + * # + * # + * # + * # http://www.apache.org/licenses/LICENSE-2.0 + * # + * # + * # + * # Unless required by applicable law or agreed to in writing, software + * # + * # distributed under the License is distributed on an "AS IS" BASIS, + * # + * # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * # + * # See the License for the specific language governing permissions and + * # + * # limitations under the License. + * # + * ################################################################################ + * *******************************************************************************/ + + +/* This file is the entry point for NFAPI P7 CLOCK*/ + +#include "common_def.h" +#include "nfapi_interface.h" +#include "nfapi_common.h" +#include "lwr_mac_upr_inf.h" +#include "mac_utils.h" + +/************************************************************************** + * @brief Task Initiation callback function. + * + * @details + * + * Function : nfapiP7ClkActvInit + * + * Functionality: + * This function is supplied as one of parameters during UDP P7 + * task registration. SSI will invoke this function once, after + * it creates and attaches this TAPA Task to a system task. + * + * @param[in] Ent entity, the entity ID of this task. + * @param[in] Inst inst, the instance ID of this task. + * @param[in] Region region, the region ID registered for memory + * usage of this task. + * @param[in] Reason reason. + * @return ROK - success + * RFAILED - failure + ***************************************************************************/ +uint8_t nfapiP7ClkActvInit(Ent entity, Inst inst, Region region, Reason reason) +{ + return ROK; +} + +/************************************************************************** + * @brief Task Activation callback function. + * + * @details + * + * Function : nfapiP7ClkActvTsk + * + * Functionality: + * Primitives invoked by NFAPI P7 users/providers through + * a loosely coupled interface arrive here by means of + * SSI's message handling. This API is registered with + * SSI during the Task Registration of DU APP. + * + * @param[in] Pst *pst, Post structure of the primitive. + * @param[in] Buffer *mBuf, Packed primitive parameters in the + * buffer. + * @return ROK - success + * RFAILED - failure + * + ***************************************************************************/ +uint8_t nfapiP7ClkActvTsk(Pst *pst, Buffer *mBuf) +{ + uint8_t ret = ROK; + + switch(pst->srcEnt) + { + case ENTUDPP7: + { + switch(pst->event) + { + case EVENT_NFAPI_P7_START_CLK: + { + nfapiGenerateTicks(); + break; + } + default: + { + DU_LOG("\nERROR -> NFAPI_VNF: P7 CLOCK Act task received Incorrect event:%d",\ + pst->event); + ret = RFAILED; + break; + } + } + break; + } + default: + { + DU_LOG("\nERROR --> NFAPI_VNF: P7 CLOCK Act task received from wrong Entity:%d",\ + pst->srcEnt); + ret = RFAILED; + break; + } + } + + ODU_EXIT_TASK(); + return ret; +} + + +/******************************************************************* + * + * @brief Generates slot indications + * + * @details + * + * Function : GenerateTicks + * + * Functionality: Generates slot indications + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void nfapiGenerateTicks() +{ + float slotDur_ms = 1/pow(2,vnfDb.numerology); + struct timespec tti_req = {0}, currTime = {0}; + uint8_t ratio = 2; + uint32_t currTime_ns = 0; + + /* Currently the code takes longer that one slot indication to execute. + * Hence, multiplying slot time interval by 2 in order to give enough time + * for L2 to complete one slot processing. + * The ratio must be removed once code optimization is complete */ + + tti_req.tv_sec = 0; + tti_req.tv_nsec = slotDur_ms * 1000000L * ratio; + while(true) + { + if(vnfDb.cellId == 0xFFFF) + { + /*Still Cell not configured thus skipping Slot Ind*/ + continue; + } + if((vnfDb.vnfP7Info.p7SyncInfo.slot == 0xFF && vnfDb.vnfP7Info.p7SyncInfo.sfn == 0xFFFF)) + { + clock_gettime(CLOCK_REALTIME, &currTime); + currTime_ns = currTime.tv_sec * 1000000000 + currTime.tv_nsec; + vnfDb.vnfP7Info.t_ref_ns = currTime_ns; + DU_LOG("\nVNF_NFAPI : Starting to generate slot indications t_ref:%llu, slotDur:%f",\ + vnfDb.vnfP7Info.t_ref_ns, slotDur_ms); + } + vnfDb.vnfP7Info.p7SyncInfo.sfn++; + vnfDb.vnfP7Info.p7SyncInfo.slot++; +#if 0 + /*TODO: To enable when P5 messages are all done and implemented*/ + if(nfapiSendSlotIndToMac() != ROK) + { + DU_LOG("\nERROR -> NFAPI_VNF: Memory Corruption issue while sending SLOT IND to MAC"); + break; + } +#endif + +#ifdef ODU_SLOT_IND_DEBUG_LOG + DU_LOG("\nVNF_NFAPI --> DEBUG: SFN/Slot:%d,%d",\ + vnfDb.vnfP7Info.p7SyncInfo.sfn, vnfDb.vnfP7Info.p7SyncInfo.slot); +#endif + clock_nanosleep(CLOCK_REALTIME, 0, &tti_req, NULL); + } +} + +/******************************************************************* + * + * @brief Triggers and sends P7 Clock Event + * + * @details + * + * Function : nfapiTriggerP7Clock + * + * Functionality: + * Packs polling request and sends to P7 Clock Trigger + * + * @params[in] Post structure + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +uint8_t nfapiTriggerP7Clock() +{ + Pst nfapiP7Pst; + Buffer *mBuf; + + memset(&nfapiP7Pst, 0, sizeof(nfapiP7Pst)); + nfapiP7Pst.srcEnt = (Ent)ENTUDPP7; + nfapiP7Pst.srcInst = (Inst)NFAPI_UDP_P7_INST; + nfapiP7Pst.srcProcId = NFAPI_UDP_P7_PROC; + nfapiP7Pst.dstEnt = (Ent)ENTP7CLK; + nfapiP7Pst.dstInst = (Inst)NFAPI_P7_CLK_INST; + nfapiP7Pst.dstProcId = NFAPI_P7_CLK_PROC; + nfapiP7Pst.event = EVENT_NFAPI_P7_START_CLK; + nfapiP7Pst.selector = ODU_SELECTOR_LC; + nfapiP7Pst.pool = NFAPI_UDP_P7_POOL; + + if(ODU_GET_MSG_BUF(DFLT_REGION, nfapiP7Pst.pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> NFAPI_VNF : Failed to allocate memory"); + return RFAILED; + } + + ODU_POST_TASK(&nfapiP7Pst, mBuf); + return ROK; +} + +/******************************************************************* + * + * @brief Build and sends P7 Slot Indication to MAC + * + * @details + * + * Function : nfapiSendSlotIndToMac + * + * Functionality: + * Build and Packs Slot Ind to MAC for each SLot + * + * @params[in] Post structure + * @return ROK - success + * RFAILED - failure + * + *******************************************************************/ +uint8_t nfapiSendSlotIndToMac() +{ + Pst pst; + SlotTimingInfo *slotInd = {0}; + + NFAPI_P7_CLK_ALLOC_SHRABL_BUF(slotInd, sizeof(SlotTimingInfo)); + memset(&pst, 0, sizeof(Pst)); + if(slotInd) + { + slotInd->cellId = vnfDb.cellId; + slotInd->sfn = vnfDb.vnfP7Info.p7SyncInfo.sfn; + slotInd->slot = vnfDb.vnfP7Info.p7SyncInfo.slot; + pst.selector = ODU_SELECTOR_LWLC; + pst.srcEnt = ENTP7CLK; + pst.dstEnt = ENTMAC; + pst.dstInst = 0; + pst.srcInst = NFAPI_P7_CLK_INST; + pst.dstProcId = ODU_GET_PROCID(); + pst.srcProcId = NFAPI_P7_CLK_PROC; + pst.region = NFAPI_P7_CLK_MEM_REGION; + pst.pool = NFAPI_P7_CLK_POOL; + pst.event = EVENT_SLOT_IND_TO_MAC; + pst.route = 0; + pst.prior = 0; + pst.intfVer = 0; + if(packSlotInd(&pst, slotInd) != ROK) + { + DU_LOG("\nERROR --> NFAPI_VNF: Unable to Send Slot Ind to MAC"); + NFAPI_P7_CLK_FREE_SHRABL_BUF(pst.region, pst.pool, slotInd, sizeof(SlotTimingInfo)); + return RFAILED; + } + } + else + { + DU_LOG("\nERROR --> NFAPI_VNF: Memory allocation failed in procSlotInd"); + return RFAILED; + } + return ROK; +} diff --git a/src/5gnrmac/nfapi_p7_msg_hdl.c b/src/5gnrmac/nfapi_p7_msg_hdl.c new file mode 100644 index 000000000..82212edfa --- /dev/null +++ b/src/5gnrmac/nfapi_p7_msg_hdl.c @@ -0,0 +1,39 @@ +/******************************************************************************* +################################################################################ +# Copyright (c) [2017-2019] [Radisys] # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +*******************************************************************************/ + +/* This file is the entry point for P7 Msg Handling */ +/*Reference SCF225 version: 225.2.1 */ + +#include "common_def.h" +#include "nfapi_interface.h" +#include "nfapi_common.h" +#include "nfapi_vnf_fsm.h" + +extern NfapiVnfDb vnfDb; + +/*Following parameters can be referred to Table 4-1 Dl Node Sync Parameters*/ +void buildAndSendDlNodeSync() +{ + uint32_t t1 = 0; /*Offset from VNF SFN/Slot 0/0 to the DL Node Sync Tx*/ + int32_t delta_sfn_slot = 0; + + + +} + + diff --git a/src/5gnrmac/nfapi_udp_p7.c b/src/5gnrmac/nfapi_udp_p7.c index b3f93ed82..730fe8786 100644 --- a/src/5gnrmac/nfapi_udp_p7.c +++ b/src/5gnrmac/nfapi_udp_p7.c @@ -89,6 +89,7 @@ uint8_t udpP7ActvTsk(Pst *pst, Buffer *mBuf) DU_LOG("\nERROR -> NFAPI_VNF: UDP Act task received Incorrect event:%d",\ pst->event); ret = RFAILED; + break; } } break; @@ -99,6 +100,7 @@ uint8_t udpP7ActvTsk(Pst *pst, Buffer *mBuf) { case EVTSTARTNFAPIP7POLL: { + DU_LOG("\nINFO --> VNF_NFAPI:Start Polling"); nfapiP7UdpRecvMsg(); ODU_PUT_MSG_BUF(mBuf); break; @@ -288,6 +290,8 @@ uint8_t nfapiP7UdpOpenReq() nfapiP7Pst.pool= NFAPI_UDP_P7_POOL; packNfapiP7UdpStartPollingReq(&nfapiP7Pst); + /*Trigger P7 Clock as well */ + nfapiTriggerP7Clock(); return ret; } diff --git a/src/5gnrmac/nfapi_vnf_fsm.c b/src/5gnrmac/nfapi_vnf_fsm.c index 0dd85c29a..82f547a26 100644 --- a/src/5gnrmac/nfapi_vnf_fsm.c +++ b/src/5gnrmac/nfapi_vnf_fsm.c @@ -48,6 +48,9 @@ void nFapiVnfInit() memset(&vnfDb, 0, sizeof(NfapiVnfDb)); vnfDb.pnfStateAtVnf = PNF_STATE_IDLE; vnfDb.pnfEvent = 0; + vnfDb.vnfP7Info.p7SyncInfo.slot = 0xFF; + vnfDb.vnfP7Info.p7SyncInfo.sfn = 0xFFFF; + vnfDb.cellId = 0xFFFF; } diff --git a/src/5gnrmac/nfapi_vnf_fsm.h b/src/5gnrmac/nfapi_vnf_fsm.h index a20ef3290..7b12cc151 100644 --- a/src/5gnrmac/nfapi_vnf_fsm.h +++ b/src/5gnrmac/nfapi_vnf_fsm.h @@ -81,16 +81,15 @@ typedef struct nfapiSyncInfo uint32_t prev_t1; uint32_t prev_t2; uint32_t prev_t3; - uint8_t sfn; + uint16_t sfn; uint8_t slot; struct nfapiSyncInfo *next; }NfapiSyncInfo; typedef struct nfapiP7VnfInfo { - uint32_t sfnStartTime; - uint32_t slotStartTime; - NfapiSyncInfo *p7SyncInfo; + uint32_t t_ref_ns; /*Reference Time of SFN 0/0 in nanosec*/ + NfapiSyncInfo p7SyncInfo; }NfapiP7VnfInfo; typedef struct nfapiP5Info @@ -107,8 +106,9 @@ typedef struct nfapiVnfDb NfapiP5Info p5Info; NfapiTransportInfo p7TransInfo; NfapiPnfConfig pnfConfig; - NfapiSyncInfo vnfSynchInfo; - NfapiP7VnfInfo vnfP7Info; + NfapiP7VnfInfo vnfP7Info; + uint8_t numerology; + uint16_t cellId; }NfapiVnfDb; /* Global variables */ diff --git a/src/cm/ssi.h b/src/cm/ssi.h index ee2a508c5..1d1b7e8af 100755 --- a/src/cm/ssi.h +++ b/src/cm/ssi.h @@ -1408,6 +1408,9 @@ #define ENTF1AP 0xed /* ORAN F1AP */ #define ENTEGTP 0xee /* ORAN EGTP */ #endif //ORAN +#ifdef NFAPI_ENABLED +#define ENTP7CLK 0xef /* NFAPI P7 Ticks/Clock */ +#endif /* un-configured procId */ #ifdef SS_MULTIPLE_PROCS #define PROCNC 0xFFFF /* Processor not configured */ diff --git a/src/du_app/du_cfg.c b/src/du_app/du_cfg.c index cc1eb65d1..cf11003ce 100644 --- a/src/du_app/du_cfg.c +++ b/src/du_app/du_cfg.c @@ -4441,6 +4441,13 @@ uint8_t parseThreadAffinity(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, ThreadIn threads->udpP7CoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); #ifdef THREAD_AFFINITY ODU_SET_THREAD_AFFINITY(&threads->udpP7STskId, SS_AFFINITY_MODE_EXCL, threads->udpP7CoreId, 0); +#endif + } + if ((!xmlStrcmp(cur->name, (const xmlChar *)"NFAPI_P7_CLK_CORE")) && (cur->ns == ns)) + { + threads->nfapiP7ClkCoreId = atoi((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1)); +#ifdef THREAD_AFFINITY + ODU_SET_THREAD_AFFINITY(&threads->nfapiP7ClkSTskId, SS_AFFINITY_MODE_EXCL, threads->nfapiP7ClkCoreId, 0); #endif } #endif @@ -5636,6 +5643,7 @@ void printDuConfig() DU_LOG("Lower MAC CORE ID %d\n", duCfgParam.threadInfo.lwrMacCoreId); #ifdef NFAPI_ENABLED DU_LOG("UDP P7 CORE ID %d\n", duCfgParam.threadInfo.udpP7CoreId); + DU_LOG("NFAPI P7 CLK CORE ID %d\n", duCfgParam.threadInfo.nfapiP7ClkCoreId); #endif DU_LOG("MAX NUM DRB %d\n", duCfgParam.maxNumDrb); diff --git a/src/du_app/du_cfg.h b/src/du_app/du_cfg.h index 0bb98ca69..f5026d577 100644 --- a/src/du_app/du_cfg.h +++ b/src/du_app/du_cfg.h @@ -1166,6 +1166,8 @@ typedef struct threadInfo uint8_t lwrMacCoreId; SSTskId udpP7STskId; uint8_t udpP7CoreId; + SSTskId nfapiP7ClkSTskId; + uint8_t nfapiP7ClkCoreId; }ThreadInfo; typedef struct duCfgParams diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index 7b71fe772..127f28836 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -59,6 +59,8 @@ uint8_t phyStubActvInit(Ent, Inst, Region, Reason); #ifdef NFAPI_ENABLED uint8_t udpP7ActvTsk(Pst *, Buffer *); uint8_t udpP7ActvInit(Ent, Inst, Region, Reason); +uint8_t nfapiP7ClkActvTsk(Pst *, Buffer *); +uint8_t nfapiP7ClkActvInit(Ent, Inst, Region, Reason); #endif #endif @@ -595,6 +597,41 @@ uint8_t udpP7Init(SSTskId sysTskId) sysTskId); return ROK; } + +/******************************************************************* + * + * @brief Initializes NFAPI P7 CLK task + * + * @details + * + * Function : nfapiP7ClkInit + * + * Functionality: + * - Registers and attaches TAPA tasks for NFAPI P7 CLK + * + * @params[in] system task ID + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t nfapiP7ClkInit(SSTskId sysTskId) +{ + /* Register UDP P7 TAPA Task */ + if(ODU_REG_TTSK((Ent)ENTP7CLK, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0, + nfapiP7ClkActvInit, (ActvTsk)nfapiP7ClkActvTsk) != ROK) + { + return RFAILED; + } + /* Attach NFAPI P7 CLK TAPA Task */ + if (ODU_ATTACH_TTSK((Ent)ENTP7CLK, (Inst)0, sysTskId)!= ROK) + { + return RFAILED; + } + + DU_LOG("\nINFO --> DU_APP : NFAPI P7 CLK TAPA task created and registered to %d sys task", + sysTskId); + return ROK; +} #endif #endif @@ -699,6 +736,12 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : System Task creation for UDP P7 Interface failed. MAX STSK [%d]", SS_MAX_STSKS); return RFAILED; } + /* system task for NFAPI-P7-CLK thread */ + if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.nfapiP7ClkSTskId) != ROK) + { + DU_LOG("\nERROR --> DU_APP : System Task creation for NFAPI P7 CLK Interface failed. MAX STSK [%d]", SS_MAX_STSKS); + return RFAILED; + } #endif #endif @@ -758,6 +801,11 @@ uint8_t commonInit() DU_LOG("\nERROR --> DU_APP : UDP P7 Tapa Task initialization failed"); return RFAILED; } + if(nfapiP7ClkInit(duCfgParam.threadInfo.nfapiP7ClkSTskId) != ROK) + { + DU_LOG("\nERROR --> DU_APP : NFAPI P7 CLK Tapa Task initialization failed"); + return RFAILED; + } #endif #endif diff --git a/src/mt/mt_ss.c b/src/mt/mt_ss.c index 809785fbf..12ade91e3 100644 --- a/src/mt/mt_ss.c +++ b/src/mt/mt_ss.c @@ -528,6 +528,18 @@ SsRegCfg cfgRegInfo[SS_MAX_REGS] = { SS_POOL_STATIC, 0 } } } + , + { + SS_DFLT_REGION + 9, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + } #else #ifdef NFAPI_ENABLED , @@ -542,6 +554,18 @@ SsRegCfg cfgRegInfo[SS_MAX_REGS] = { SS_POOL_STATIC, 0 } } } + , + { + SS_DFLT_REGION + 9, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + } #endif #endif @@ -666,6 +690,19 @@ MtDynMemCfg mtDynMemoCfg = {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} } } + , + { + SS_DFLT_REGION + 9, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + } #else #ifdef NFAPI_ENABLED , @@ -681,6 +718,19 @@ MtDynMemCfg mtDynMemoCfg = {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} } } + , + { + SS_DFLT_REGION + 9, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + } #endif #endif #if ((defined (SPLIT_RLC_DL_TASK)) && (!defined (L2_L3_SPLIT))) @@ -876,6 +926,19 @@ MtMemCfg mtMemoCfg = {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ } } + , + { + SS_DFLT_REGION + 9, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + } #else #ifdef NFAPI_ENABLED , @@ -891,6 +954,19 @@ MtMemCfg mtMemoCfg = {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ } } + , + { + SS_DFLT_REGION + 9, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + } #endif #endif #endif /* SS_LOCKLESS_MEMORY */ diff --git a/src/mt/mt_ss.h b/src/mt/mt_ss.h index 8eff63aa4..1d146d5d0 100755 --- a/src/mt/mt_ss.h +++ b/src/mt/mt_ss.h @@ -64,10 +64,10 @@ #endif #else #ifndef INTEL_WLS_MEM -#define SS_MAX_STSKS 9 +#define SS_MAX_STSKS 10 #else #ifdef NFAPI_ENABLED -#define SS_MAX_STSKS 9 +#define SS_MAX_STSKS 10 #else #define SS_MAX_STSKS 8 #endif