1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains message handling functionality for DU APP */
20 #include "common_def.h"
29 #include "du_app_mac_inf.h"
30 #include "du_app_rlc_inf.h"
31 #include "du_e2ap_mgr.h"
32 #include "du_e2ap_msg_hdl.h"
34 #include "du_app_rlc_inf.h"
38 #include "du_f1ap_msg_hdl.h"
39 #include "du_ue_mgr.h"
43 #include "du_cell_mgr.h"
47 #include "AlarmInterface.h"
48 #include "CmInterface.h"
49 #include "PmInterface.h"
54 uint8_t numRlcDlSaps = 0;
56 uint8_t numRlcMacSaps = 0;
58 uint8_t macCfgInst = 0;
60 DuCfgParams duCfgParam;
61 uint8_t packRlcConfigReq(Pst *pst, RlcMngmt *cfg);
62 uint8_t cmPkLkwCntrlReq(Pst *pst, RlcMngmt *cfg);
63 uint8_t cmPkLrgCfgReq(Pst *pst, RgMngmt *cfg);
64 uint8_t egtpHdlDatInd(EgtpMsg egtpMsg);
65 uint8_t BuildAndSendDUConfigUpdate();
66 uint16_t getTransId();
67 uint8_t cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg);
68 uint8_t sendCellDeleteReqToMac(uint16_t cellId);
69 uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo);
71 packMacCellCfgReq packMacCellCfgOpts[] =
73 packMacCellCfg, /* packing for loosely coupled */
74 MacProcCellCfgReq, /* packing for tightly coupled */
75 packMacCellCfg, /* packing for light weight loosly coupled */
78 DuMacCellStart packMacCellStartOpts[] =
80 packMacCellStart, /* Loose coupling */
81 MacProcCellStart, /* TIght coupling */
82 packMacCellStart /* Light weight-loose coupling */
85 DuMacCellStop packMacCellStopOpts[] =
87 packMacCellStop, /* Loose coupling */
88 MacProcCellStop, /* TIght coupling */
89 packMacCellStop /* Light weight-loose coupling */
92 DuMacSliceCfgReq packMacSliceCfgReqOpts[] =
94 packDuMacSliceCfgReq, /* Loose coupling */
95 MacProcSliceCfgReq, /* TIght coupling */
96 packDuMacSliceCfgReq /* Light weight-loose coupling */
100 DuMacSliceRecfgReq packMacSliceRecfgReqOpts[] =
102 packDuMacSliceRecfgReq, /* Loose coupling */
103 MacProcSliceRecfgReq, /* TIght coupling */
104 packDuMacSliceRecfgReq /* Light weight-loose coupling */
107 DuMacStatsReqFunc packMacStatsReqOpts[]=
109 packDuMacStatsReq, /* Loose Coupling */
110 MacProcStatsReq, /* Tight Coupling */
111 packDuMacStatsReq /* Light weight-loose coupling */
114 DuMacStatsDeleteReqFunc packMacStatsDeleteReqOpts[]=
116 packDuMacStatsDeleteReq, /* Loose Coupling */
117 MacProcStatsDeleteReq, /* Tight Coupling */
118 packDuMacStatsDeleteReq /* Light weight-loose coupling */
121 DuMacStatsModificationReqFunc packMacStatsModificationReqOpts[]=
123 packDuMacStatsModificationReq, /* Loose Coupling */
124 MacProcStatsModificationReq, /* Tight Coupling */
125 packDuMacStatsModificationReq /* Light weight-loose coupling */
128 /**************************************************************************
129 * @brief Function to fill configs required by RLC
133 * Function : duBuildRlcCfg
136 * Initiates general Configs towards RLC
138 * @param[in] Inst Specifies if RLC UL or RLC DL instance
139 * @return ROK - success
142 ***************************************************************************/
143 uint8_t duBuildRlcCfg(Inst inst)
146 RlcGenCfg *genCfg = NULLP;
149 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
150 DU_SET_ZERO(&pst, sizeof(Pst));
152 genCfg = &(rlcMngmt.t.cfg.s.gen);
154 /*----------- Fill General Configuration Parameters ---------*/
155 genCfg->maxUe = duCfgParam.maxUe;
156 genCfg->maxKwuSaps = 2;
157 genCfg->maxUdxSaps = 1;
158 genCfg->rlcMode = (inst == RLC_UL_INST) ?
159 LKW_RLC_MODE_UL : LKW_RLC_MODE_DL;
161 genCfg->maxRguSaps = DEFAULT_CELLS;
163 /*----------- Fill lmPst
164 * Parameters ---------*/
165 genCfg->lmPst.dstProcId = DU_PROC;
166 genCfg->lmPst.srcProcId = DU_PROC;
167 genCfg->lmPst.dstEnt = ENTDUAPP;
168 genCfg->lmPst.dstInst = DU_INST;
169 genCfg->lmPst.srcEnt = ENTRLC;
170 genCfg->lmPst.srcInst = inst;
171 genCfg->lmPst.prior = PRIOR0;
172 genCfg->lmPst.route = RTESPEC;
173 genCfg->lmPst.region = (inst == RLC_UL_INST) ?
174 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
175 genCfg->lmPst.pool = RLC_POOL;
176 genCfg->lmPst.selector = ODU_SELECTOR_LC;
179 rlcMngmt.hdr.msgType = TCFG;
180 rlcMngmt.hdr.msgLen = 0;
181 rlcMngmt.hdr.entId.ent = ENTRLC;
182 rlcMngmt.hdr.entId.inst = (Inst)0;
183 rlcMngmt.hdr.elmId.elmnt = STGEN;
184 rlcMngmt.hdr.seqNmb = 0;
185 rlcMngmt.hdr.version = 0;
186 rlcMngmt.hdr.transId = 0;
187 rlcMngmt.hdr.response.prior = PRIOR0;
188 rlcMngmt.hdr.response.route = RTESPEC;
189 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
190 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
191 rlcMngmt.hdr.response.mem.pool = DU_POOL;
192 rlcMngmt.hdr.response.selector = ODU_SELECTOR_LC;
195 pst.selector = ODU_SELECTOR_LC;
196 pst.srcEnt = ENTDUAPP;
199 pst.dstProcId = DU_PROC;
200 pst.srcProcId = DU_PROC;
201 pst.region = duCb.init.region;
203 DU_LOG("\nDEBUG --> DU_APP : RLC Gen Cfg Req sent for inst %d", inst);
205 /* Send the request to RLC */
206 packRlcConfigReq(&pst, &rlcMngmt);
211 /**************************************************************************
212 * @brief Function to fill configs required by RLC
216 * Function : duBuildRlcLsapCfg
219 * Initiates general Configs towards RLC
221 * @param[in] Inst Specifies if RLC UL or RLC DL instance
222 * @return ROK - success
225 ***************************************************************************/
226 uint8_t duBuildRlcLsapCfg(Ent ent, Inst inst, uint8_t lsapInst)
230 RlcSapCfg *lSap = NULLP;
233 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
234 DU_SET_ZERO(&pst, sizeof(Pst));
237 rlcMngmt.hdr.msgType = TCFG;
238 rlcMngmt.hdr.entId.ent = ENTRLC;
239 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
240 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
242 rlcMngmt.hdr.response.mem.pool = RLC_POOL;
245 pst.selector = ODU_SELECTOR_LC;
246 pst.srcEnt = ENTDUAPP;
248 pst.dstProcId = DU_PROC;
250 pst.srcProcId = DU_PROC;
251 pst.region = duCb.init.region;
252 lSap = &(rlcMngmt.t.cfg.s.sap);
254 lSap->mem.region = (inst == RLC_UL_INST) ?
255 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
256 lSap->mem.pool = RLC_POOL;
258 lSap->bndTmrIntvl = 10;
259 lSap->priority = PRIOR0;
260 lSap->route = RTESPEC;
263 lSap->procId = DU_PROC;
265 lSap->inst = lsapInst;
266 lSap->sapId = lsapInst; /* SapId will be stored as suId in MAC */
267 lSap->selector = (inst == RLC_UL_INST) ? ODU_SELECTOR_LWLC : ODU_SELECTOR_TC;
268 rlcMngmt.hdr.elmId.elmnt = STRGUSAP;
269 DU_LOG("\nDEBUG --> DU_APP : RLC MAC Lower Sap Cfg Req sent for inst %d", inst);
274 lSap->procId = DU_PROC;
276 lSap->inst = (inst == RLC_UL_INST) ?
277 RLC_DL_INST : RLC_UL_INST;
279 lSap->selector = ODU_SELECTOR_LC;
280 rlcMngmt.hdr.elmId.elmnt = STUDXSAP;
281 DU_LOG("\nDEBUG --> DU_APP : RLC DL/UL Lower Sap Cfg Req sent for inst %d", inst);
284 packRlcConfigReq(&pst, &rlcMngmt);
288 /**************************************************************************
289 * @brief Function to fill configs required by RLC
293 * Function : duBuildRlcUsapCfg
296 * Initiates general Configs towards RLC
298 * @param[in] Inst Specifies if RLC UL or RLC DL instance
299 * @return ROK - success
302 ***************************************************************************/
303 uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst)
306 RlcSapCfg *uSap = NULLP;
309 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
310 DU_SET_ZERO(&pst, sizeof(Pst));
312 uSap = &(rlcMngmt.t.cfg.s.sap);
314 uSap->selector = ODU_SELECTOR_LC;
315 uSap->mem.region = (inst == RLC_UL_INST) ?
316 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
317 uSap->mem.pool = RLC_POOL;
320 uSap->procId = DU_PROC;
324 uSap->inst = (inst == RLC_UL_INST) ?
325 RLC_DL_INST : RLC_UL_INST;
326 uSap->bndTmrIntvl = 1000;
327 uSap->priority = PRIOR0;
328 uSap->route = RTESPEC;
331 rlcMngmt.hdr.msgType = TCFG;
332 rlcMngmt.hdr.entId.ent = ENTRLC;
333 rlcMngmt.hdr.elmId.elmnt = STUDXSAP;
334 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
335 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
337 rlcMngmt.hdr.response.mem.pool = RLC_POOL;
340 pst.selector = ODU_SELECTOR_LC;
341 pst.srcEnt = ENTDUAPP;
343 pst.dstProcId = DU_PROC;
345 pst.srcProcId = DU_PROC;
346 pst.region = duCb.init.region;
348 DU_LOG("\nDEBUG --> DU_APP : RLC Kwu Upper Sap Cfg Req sent for inst %d", inst);
349 packRlcConfigReq(&pst, &rlcMngmt);
354 /**************************************************************************
355 * @brief Function to populate internal DS of DU APP
359 * Function : duProcCfgComplete
362 * Populates internal data structures of DU APP after
363 * receiving configurations.
366 * @return ROK - success
369 ***************************************************************************/
370 uint8_t duProcCfgComplete()
374 for(idx=0; idx< DEFAULT_CELLS; idx++)
376 DuCellCb *cell = NULLP;
377 DU_ALLOC(cell, sizeof(DuCellCb));
380 DU_LOG("\nERROR --> DU_APP : Memory Allocation failed in duProcCfgComplete");
386 memset(cell, 0, sizeof(DuCellCb));
387 cell->cellId = NR_CELL_ID; //++cellId;
388 memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
389 cell->cellInfo.nrEcgi.plmn.mcc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[0];
390 cell->cellInfo.nrEcgi.plmn.mcc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[1];
391 cell->cellInfo.nrEcgi.plmn.mcc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[2];
392 cell->cellInfo.nrEcgi.plmn.mnc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[0];
393 cell->cellInfo.nrEcgi.plmn.mnc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[1];
394 cell->cellInfo.nrEcgi.plmn.mnc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[2];
395 cell->cellInfo.nrEcgi.cellId = cell->cellId;
396 cell->cellInfo.nrPci = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
397 cell->cellInfo.fiveGsTac = duCfgParam.srvdCellLst[0].duCellInfo.tac;
398 memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
399 for(idx1=0; idx1<MAX_PLMN; idx1++)
401 cell->cellInfo.plmn[idx1].mcc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[0];
402 cell->cellInfo.plmn[idx1].mcc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[1];
403 cell->cellInfo.plmn[idx1].mcc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[2];
404 cell->cellInfo.plmn[idx1].mnc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[0];
405 cell->cellInfo.plmn[idx1].mnc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[1];
406 cell->cellInfo.plmn[idx1].mnc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[2];
408 cell->cellInfo.maxUe = duCfgParam.maxUe;
409 cell->cellStatus = CELL_OUT_OF_SERVICE;
410 gCellStatus = CELL_DOWN;
411 duCb.cfgCellLst[duCb.numCfgCells] = cell;
417 //Start layer configs
418 ret = duSendRlcUlCfg();
422 /**************************************************************************
423 * @brief Function to invoke DU Layer Configs
427 * Function : duSendRlcUlCfg
430 * Initiates Configs towards layers of DU
433 * @return ROK - success
436 ***************************************************************************/
437 uint8_t duSendRlcUlCfg()
441 duBuildRlcCfg((Inst)RLC_UL_INST);
442 for(cellIdx = 0; cellIdx < DEFAULT_CELLS; cellIdx++)
444 duBuildRlcLsapCfg(ENTMAC, (Inst)RLC_UL_INST, cellIdx);
446 duBuildRlcLsapCfg(ENTRLC, (Inst)RLC_UL_INST, 0);
451 /**************************************************************************
452 * @brief Function to invoke DU Layer Configs
456 * Function : duSendRlcDlCfg
459 * Initiates Configs towards layers of DU
462 * @return ROK - success
465 ***************************************************************************/
466 uint8_t duSendRlcDlCfg()
470 duBuildRlcCfg((Inst)RLC_DL_INST);
471 duBuildRlcUsapCfg(STUDXSAP, ENTRLC, (Inst)RLC_DL_INST);
472 for(cellIdx = 0; cellIdx < DEFAULT_CELLS; cellIdx++)
474 duBuildRlcLsapCfg(ENTMAC, (Inst)RLC_DL_INST, cellIdx);
479 /**************************************************************************
480 * @brief Function to handle Config Confirm from RLC
484 * Function : DuHdlRlcCfgComplete
487 * Handles Gen Config Confirm from RLC
489 * @param[in] Pst *pst, Post structure of the primitive.
490 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC
491 * @return ROK - success
494 ***************************************************************************/
495 uint8_t DuHdlRlcCfgComplete(Pst *pst, RlcMngmt *cfm)
498 if (pst->srcInst == RLC_UL_INST)
500 ret = duProcRlcUlCfgComplete(pst, cfm);
504 ret = duProcRlcDlCfgComplete(pst, cfm);
509 /**************************************************************************
510 * @brief Function to handle Control Config Confirm from RLC
514 * Function : duHdlRlcCntrlCfgComplete
517 * Handles Control Config Confirm from RLC
519 * @param[in] Pst *pst, Post structure of the primitive.
520 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC
521 * @return ROK - success
524 ***************************************************************************/
525 uint8_t duHdlRlcCntrlCfgComplete(Pst *pst, RlcMngmt *cntrl)
529 if (cntrl->cfm.status == LCM_PRIM_OK)
531 switch (cntrl->hdr.elmId.elmnt)
535 if (pst->srcInst == RLC_DL_INST)
537 DU_LOG("\nDEBUG --> DU_APP : BIND OF RLC DL TO MAC (RGU) SAP SUCCESSFUL");
539 if(macCfgInst < DEFAULT_CELLS)
542 duBindUnbindRlcToMacSap((Inst) RLC_DL_INST, ABND);
546 duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
551 DU_LOG("\nDEBUG --> DU_APP : BIND OF RLC UL TO MAC (RGU) SAP SUCCESSFUL");
553 if(macCfgInst < DEFAULT_CELLS)
555 duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
569 /**************************************************************************
570 * @brief Function to handle Config Confirm from RLC UL
574 * Function : duHdlRlcUlCfgComplete
577 * Handles Config Confirm from RLC UL
579 * @param[in] Pst *pst, Post structure of the primitive.
580 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC UL
581 * @return ROK - success
584 ***************************************************************************/
585 uint8_t duProcRlcUlCfgComplete(Pst *pst, RlcMngmt *cfm)
589 DU_LOG("\nDEBUG --> DU_APP : RLC UL Cfg Status %d", cfm->cfm.status);
590 if (cfm->cfm.status == LCM_PRIM_OK)
592 switch(cfm->hdr.elmId.elmnt)
596 rlcUlCfg |= RLC_GEN_CFG;
602 if(numRlcMacSaps == DEFAULT_CELLS)
604 rlcUlCfg |= RLC_MAC_SAP_CFG;
611 rlcUlCfg |= RLC_UDX_SAP_CFG;
618 DU_LOG("\nDEBUG --> DU_APP : RLC UL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
619 if(rlcUlCfg == DU_RLC_UL_CONFIGURED)
623 //Start configuration of RLC DL
630 DU_LOG("\nERROR --> DU_APP : Config confirm NOK from RLC UL");
636 /**************************************************************************
637 * @brief Function to handle Config Confirm from RLC DL
641 * Function : duHdlRlcDlCfgComplete
644 * Handles Config Confirm from RLC DL
646 * @param[in] Pst *pst, Post structure of the primitive.
647 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC DL
648 * @return ROK - success
651 ***************************************************************************/
652 uint8_t duProcRlcDlCfgComplete(Pst *pst, RlcMngmt *cfm)
654 DU_LOG("\nDEBUG --> DU_APP : RLC DL Cfg Status %d", cfm->cfm.status);
655 if (cfm->cfm.status == LCM_PRIM_OK)
657 switch(cfm->hdr.elmId.elmnt)
661 rlcDlCfg |= RLC_GEN_CFG;
667 if(numRlcMacSaps == DEFAULT_CELLS)
669 rlcDlCfg |= RLC_MAC_SAP_CFG;
676 rlcDlCfg |= RLC_UDX_SAP_CFG;
684 DU_LOG("\nDEBUG --> DU_APP : RLC DL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
685 if(rlcDlCfg == DU_RLC_DL_CONFIGURED)
688 //Start configuration of MAC
695 DU_LOG("\nERROR --> DU_APP : Config confirm NOK from RLC DL");
700 /**************************************************************************
701 * @brief Function to send configs to MAC
705 * Function : duSendMacCfg
708 * Initiates Configs towards MAC layer
711 * @return ROK - success
714 ***************************************************************************/
715 uint8_t duSendMacCfg()
718 duBuildMacUsapCfg(RLC_UL_INST);
719 duBuildMacUsapCfg(RLC_DL_INST);
724 /**************************************************************************
725 * @brief Function to fill gen config required by MAC
729 * Function : duBuildMacGenCfg
732 * Initiates general Configs towards MAC
735 * @return ROK - success
738 ***************************************************************************/
739 uint8_t duBuildMacGenCfg()
742 RgGenCfg *genCfg=NULLP;
745 DU_SET_ZERO(&pst, sizeof(Pst));
746 DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
748 genCfg = &(rgMngmt.t.cfg.s.genCfg);
750 /*----------- Fill General Configuration Parameters ---------*/
751 genCfg->mem.region = MAC_MEM_REGION;
752 genCfg->mem.pool = MAC_POOL;
754 genCfg->numRguSaps = 2;
756 genCfg->lmPst.dstProcId = DU_PROC;
757 genCfg->lmPst.srcProcId = DU_PROC;
758 genCfg->lmPst.dstEnt = ENTDUAPP;
759 genCfg->lmPst.dstInst = 0;
760 genCfg->lmPst.srcEnt = ENTMAC;
761 genCfg->lmPst.srcInst = macCfgInst;
762 genCfg->lmPst.prior = PRIOR0;
763 genCfg->lmPst.route = RTESPEC;
764 genCfg->lmPst.region = MAC_MEM_REGION;
765 genCfg->lmPst.pool = MAC_POOL;
766 genCfg->lmPst.selector = ODU_SELECTOR_LC;
769 rgMngmt.hdr.msgType = TCFG;
770 rgMngmt.hdr.msgLen = 0;
771 rgMngmt.hdr.entId.ent = ENTMAC;
772 rgMngmt.hdr.entId.inst = (Inst)0;
773 rgMngmt.hdr.elmId.elmnt = STGEN;
774 rgMngmt.hdr.seqNmb = 0;
775 rgMngmt.hdr.version = 0;
776 rgMngmt.hdr.transId = 0;
778 rgMngmt.hdr.response.prior = PRIOR0;
779 rgMngmt.hdr.response.route = RTESPEC;
780 rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
781 rgMngmt.hdr.response.mem.pool = MAC_POOL;
782 rgMngmt.hdr.response.selector = ODU_SELECTOR_LC;
785 pst.selector = ODU_SELECTOR_LC;
786 pst.srcEnt = ENTDUAPP;
788 pst.dstInst = macCfgInst;
789 pst.dstProcId = DU_PROC;
790 pst.srcProcId = DU_PROC;
791 pst.region = duCb.init.region;
793 DU_LOG("\nDEBUG --> DU_APP : MAC Gen Cfg Req sent");
795 /* Send the request to MAC */
796 cmPkLrgCfgReq(&pst, &rgMngmt);
801 /**************************************************************************
802 * @brief Function to fill USAP config required by MAC
806 * Function : duBuildMacUsapCfg
809 * Initiates USAP Configs towards MAC
811 * @param[in] SpId Specifies if RLC UL or RLC DL instance
812 * @return ROK - success
815 ***************************************************************************/
816 uint8_t duBuildMacUsapCfg(SpId sapId)
819 RgUpSapCfg *uSap = NULLP;
822 DU_SET_ZERO(&pst, sizeof(Pst));
823 DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
825 uSap = &(rgMngmt.t.cfg.s.rguSap);
827 uSap->mem.region = MAC_MEM_REGION;
828 uSap->mem.pool = MAC_POOL;
831 uSap->procId = DU_PROC;
834 uSap->prior = PRIOR0;
835 uSap->route = RTESPEC;
836 uSap->selector = ODU_SELECTOR_LC ;
839 rgMngmt.hdr.msgType = TCFG;
840 rgMngmt.hdr.entId.ent = ENTMAC;
841 rgMngmt.hdr.entId.inst = (Inst)0;
842 rgMngmt.hdr.elmId.elmnt = STRGUSAP;
843 rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
844 rgMngmt.hdr.response.mem.pool = MAC_POOL;
847 pst.selector = ODU_SELECTOR_LC;
848 pst.srcEnt = ENTDUAPP;
850 pst.dstInst = macCfgInst;
851 pst.dstProcId = DU_PROC;
852 pst.srcProcId = DU_PROC;
853 pst.region = duCb.init.region;
855 DU_LOG("\nDEBUG --> DU_APP : MAC Rgu USap Cfg Req sent");
857 /* Send the request to MAC */
858 cmPkLrgCfgReq(&pst, &rgMngmt);
863 /**************************************************************************
864 * @brief Function to handle Config Confirm from MAC
868 * Function : duHdlMacCfgComplete
871 * Handles Gen Config Confirm from MAC
873 * @param[in] Pst *pst, Post structure of the primitive.
874 * @param[in] RgMngmt *cfm, Unpacked primitive info received from MAC
875 * @return ROK - success
878 ***************************************************************************/
879 uint8_t duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm)
883 if (cfm->cfm.status == LCM_PRIM_OK)
885 switch (cfm->hdr.elmId.elmnt)
889 macCfg |= MAC_GEN_CFG;
894 macCfg |= MAC_SAP_CFG;
901 DU_LOG("\nDEBUG --> DU_APP : MAC Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
902 if(macCfg == MAC_CONFIGURED && numRlcMacSaps == MAX_MAC_SAP)
905 DU_LOG("\nDEBUG --> DU_APP : Completed sending Configs");
907 duBindUnbindRlcToMacSap(RLC_DL_INST, ABND);
913 DU_LOG("\nERROR --> DU_APP : Config confirm NOK from MAC");
919 /**************************************************************************
920 * @brief Function to bind/unbind RLC to MAC SAP
924 * Function : duBindUnbindRlcToMacSap
927 * Initiates Bind/Unbind from RLC to MAC
929 * @param[in] Inst Specifies if RLC UL or RLC DL instance
930 * @param[in] action Specifies if action is bind or unbind
931 * @return ROK - success
934 ***************************************************************************/
935 uint8_t duBindUnbindRlcToMacSap(uint8_t inst, uint8_t action)
937 RlcCntrl *cntrl = NULLP;
942 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
943 DU_SET_ZERO(&pst, sizeof(Pst));
947 DU_LOG("\nDEBUG --> DU_APP : Cntrl Req to RLC inst %d to bind MAC sap", inst);
951 DU_LOG("\nDEBUG --> DU_APP : Cntrl Req to RLC inst %d to unbind MAC sap", inst);
953 cntrl = &(rlcMngmt.t.cntrl);
955 cntrl->action = action;
956 cntrl->subAction = DU_ZERO_VAL;
957 cntrl->s.sapCntrl.suId = macCfgInst;
958 cntrl->s.sapCntrl.spId = inst;
961 rlcMngmt.hdr.msgType = TCNTRL;
962 rlcMngmt.hdr.entId.ent = ENTRLC;
963 rlcMngmt.hdr.entId.inst = inst;
964 rlcMngmt.hdr.elmId.elmnt = 186; /* ambiguous defines in lkw.h and lrg.h so direct hardcoded*/
965 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
966 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
967 rlcMngmt.hdr.response.mem.pool = RLC_POOL;
970 pst.selector = ODU_SELECTOR_LC;
971 pst.srcEnt = ENTDUAPP;
973 pst.dstProcId = DU_PROC;
975 pst.srcProcId = DU_PROC;
976 pst.region = duCb.init.region;
978 cmPkLkwCntrlReq(&pst, &rlcMngmt);
982 /*******************************************************************
984 * @brief Handles SCTP notifications
988 * Function : duSctpNtfyHdl
991 * Handles SCTP notification
993 * @params[in] Message Buffer
996 * @return ROK - success
999 * ****************************************************************/
1001 uint8_t duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy)
1003 if(f1Params.assocId == ntfy->u.assocChange.assocId)
1005 if(BuildAndSendF1SetupReq() != ROK)
1010 else if(ricParams.assocId == ntfy->u.assocChange.assocId)
1016 DU_LOG("\nERROR --> DU_APP : Invalid assocId %d received", ntfy->u.assocChange.assocId);
1022 /*******************************************************************
1024 * @brief Fills Pst struct for ENTEGTP
1028 * Function : duFillEgtpPst
1031 * Fills Pst struct for ENTEGTP
1034 * @return ROK - success
1037 * ****************************************************************/
1038 uint8_t duFillEgtpPst(Pst *pst, Event event)
1040 memset(pst, 0, sizeof(Pst));
1041 pst->srcEnt = (Ent)ENTDUAPP;
1042 pst->srcInst = (Inst)DU_INST;
1043 pst->srcProcId = DU_PROC;
1044 pst->dstEnt = (Ent)ENTEGTP;
1045 pst->dstInst = (Inst)EGTP_INST;
1046 pst->dstProcId = pst->srcProcId;
1048 pst->selector = ODU_SELECTOR_LC;
1055 /*******************************************************************
1057 * @brief Function to configure EGTP
1061 * Function : duBuildEgtpCfgReq
1064 * Function to configure EGTP
1067 * @return ROK - success
1070 * ****************************************************************/
1072 uint8_t duBuildEgtpCfgReq()
1077 DU_LOG("\nDEBUG --> DU_APP : Sending EGTP config request");
1079 memset(&egtpCfg, 0, sizeof(EgtpConfig));
1080 memcpy(&egtpCfg, &duCfgParam.egtpParams, sizeof(EgtpConfig));
1082 duFillEgtpPst(&pst, EVTCFGREQ);
1083 packEgtpCfgReq(&pst, egtpCfg);
1088 /*******************************************************************
1090 * @brief Function to configure EGTP
1094 * Function : duBuildEgtpCfgReq
1097 * Function to configure EGTP
1100 * @return ROK - success
1103 * ****************************************************************/
1104 uint8_t duHdlEgtpCfgComplete(CmStatus cfm)
1108 if(cfm.status == LCM_PRIM_OK)
1110 DU_LOG("\nDEBUG --> DU_APP : EGTP configuraton complete");
1111 duSendEgtpSrvOpenReq();
1115 DU_LOG("\nERROR --> DU_APP : EGTP configuraton failed");
1122 /*******************************************************************
1124 * @brief Sends server open request to EGTP
1128 * Function : duSendEgtpSrvOpenReq
1131 * Sends server open request to EGTP
1134 * @return ROK - success
1137 * ****************************************************************/
1139 uint8_t duSendEgtpSrvOpenReq()
1143 DU_LOG("\nDEBUG --> DU_APP : Sending EGTP server open request");
1145 duFillEgtpPst(&pst, EVTSRVOPENREQ);
1146 packEgtpSrvOpenReq(&pst);
1151 /*******************************************************************
1153 * @brief Handles server open confirmation
1157 * Function : duHdlEgtpSrvOpenComplete
1160 * Handles server open confirmation
1163 * @return ROK - success
1166 *****************************************************************/
1168 uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm)
1172 if(cfm.status == LCM_PRIM_OK)
1174 DU_LOG("\nDEBUG --> DU_APP : EGTP server opened successfully");
1178 DU_LOG("\nERROR --> DU_APP : EGTP server opening failed");
1185 /*******************************************************************
1187 * @brief Sends tunnel management request
1191 * Function : duSendEgtpTnlMgmtReq
1194 * Builds and sends tunnel management request to EGTP
1196 * @params[in] Action
1197 * Local tunnel endpoint id
1198 * Remote tunnel endpoint id
1199 * @return ROK - success
1202 * ****************************************************************/
1204 uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdTobeMod, GtpTnlCfg *ueCbTnlCfg)
1210 DU_LOG("\nDEBUG --> DU_APP : Sending EGTP tunnel management request for teId [%d]", ueCbTnlCfg->teId);
1212 /* ADD/MOD/DEL per tunnel */
1213 tnlEvt.action = action;
1214 tnlEvt.remTeid = ueCbTnlCfg->teId;
1215 if(action != EGTP_TNL_MGMT_ADD)
1217 tnlEvt.lclTeid = teIdTobeMod;
1221 tnlEvt.lclTeid = ueCbTnlCfg->teId;
1223 duFillEgtpPst(&pst, EVTTNLMGMTREQ);
1224 ret = egtpTnlMgmtReq(&pst, tnlEvt);
1228 /*******************************************************************
1230 * @brief Handles Tunnel management confirm
1234 * Function : duHdlEgtpTnlMgmtCfm
1237 * Handles tunnel management confirm received from Egtp
1239 * @params[in] Tunnel Event
1240 * @return ROK - success
1243 * ****************************************************************/
1244 uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm)
1248 if(tnlEvtCfm.cfmStatus.status == LCM_PRIM_OK)
1250 DU_LOG("\nDEBUG --> DU_APP: Tunnel management confirm OK");
1254 DU_LOG("\nERROR --> DU_APP: Tunnel management failed");
1261 /*******************************************************************
1263 * @brief Sends UL user data over to EGTP
1267 * Function : duSendEgtpDatInd
1269 * Functionality: Sends UL user data over to EGTP
1271 * @params[in] UL data buffer
1272 * @return ROK - success
1275 * ****************************************************************/
1276 uint8_t duSendEgtpDatInd(Buffer *mBuf)
1280 /* Fill EGTP header */
1281 egtpMsg.msgHdr.msgType = EGTPU_MSG_GPDU;
1282 egtpMsg.msgHdr.nPdu.pres = FALSE;
1283 egtpMsg.msgHdr.seqNum.pres = FALSE;
1284 egtpMsg.msgHdr.extHdr.udpPort.pres = FALSE;
1285 egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
1286 egtpMsg.msgHdr.teId = 1;
1289 egtpHdlDatInd(egtpMsg);
1295 /**************************************************************************
1296 * @brief Function to send configs to SCH
1300 * Function : duSendSchCfg
1303 * Sends general config to Scheduler via MAC layer
1306 * @return ROK - success
1309 ***************************************************************************/
1310 uint8_t duSendSchCfg()
1313 RgSchInstCfg *cfg = NULLP;
1316 DU_SET_ZERO(&pst, sizeof(Pst));
1317 DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
1319 cfg = &(rgMngmt.t.cfg.s.schInstCfg);
1321 /* Filling of Instance Id */
1322 cfg->instId = DEFAULT_CELLS + 1;
1323 /* Filling of Gen config */
1324 cfg->genCfg.mem.region = MAC_MEM_REGION;
1325 cfg->genCfg.mem.pool = MAC_POOL;
1326 cfg->genCfg.tmrRes = 1;
1329 cfg->genCfg.forceCntrlSrbBoOnPCel = FALSE;
1330 cfg->genCfg.isSCellActDeactAlgoEnable = TRUE;
1332 cfg->genCfg.startCellId = 1;
1333 cfg->genCfg.lmPst.dstProcId = DU_PROC;
1334 cfg->genCfg.lmPst.srcProcId = DU_PROC;
1335 cfg->genCfg.lmPst.dstEnt = ENTDUAPP;
1336 cfg->genCfg.lmPst.dstInst = DU_INST;
1337 cfg->genCfg.lmPst.srcEnt = ENTMAC;
1338 cfg->genCfg.lmPst.srcInst = DEFAULT_CELLS + 1;
1339 cfg->genCfg.lmPst.prior = PRIOR0;
1340 cfg->genCfg.lmPst.route = RTESPEC;
1341 cfg->genCfg.lmPst.region = MAC_MEM_REGION;
1342 cfg->genCfg.lmPst.pool = MAC_POOL;
1343 cfg->genCfg.lmPst.selector = ODU_SELECTOR_LC;
1346 rgMngmt.hdr.msgType = TCFG;
1347 rgMngmt.hdr.entId.ent = ENTMAC;
1348 rgMngmt.hdr.entId.inst = DU_INST;
1349 rgMngmt.hdr.elmId.elmnt = STSCHINST;
1350 rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
1351 rgMngmt.hdr.response.mem.pool = MAC_POOL;
1354 pst.selector = ODU_SELECTOR_LC;
1355 pst.srcEnt = ENTDUAPP;
1356 pst.dstEnt = ENTMAC;
1357 pst.dstProcId = DU_PROC;
1358 pst.srcProcId = DU_PROC;
1359 pst.srcInst = DU_INST;
1361 pst.region = duCb.init.region;
1362 pst.event = (Event) EVTMACSCHGENCFGREQ;
1364 DU_LOG("\nDEBUG --> DU_APP : MAC Sch Cfg sent");
1366 /* Send the request to MAC */
1367 cmPkLrgSchCfgReq(&pst, &rgMngmt);
1373 /**************************************************************************
1374 * @brief Function to configure SCTP params and
1375 * responsible for F1 and E2 interfaces
1379 * Function : duLayerConfigComplete
1382 * Configures SCTP Params and responsible for handling
1383 * F1 and E2 interface.
1386 * @return ROK - success
1389 ***************************************************************************/
1390 uint8_t duLayerConfigComplete()
1394 DU_LOG("\nINFO --> DU_APP : Configuring all Layer is complete");
1396 if((ret = duSctpCfgReq(duCfgParam.sctpParams)) != ROK)
1398 DU_LOG("\nERROR --> DU_APP : Failed configuring Sctp Params");
1401 if((ret = duSctpAssocReq(F1_INTERFACE)) != ROK)
1403 DU_LOG("\nERROR --> DU_APP : Failed to send AssocReq F1");
1406 if((ret = duSctpAssocReq(E2_INTERFACE)) != ROK)
1408 DU_LOG("\nERROR --> DU_APP : Failed to send AssocReq E2");
1415 /**************************************************************************
1416 * @brief Function to handle SCH Config Confirm from MAC
1420 * Function : duHdlSchCfgComplete
1423 * Handles Scheduler Gen Config Confirm from MAC
1425 * @param[in] Pst *pst, Post structure of the primitive.
1426 * @param[in] RgMngmt *cfm, Unpacked primitive info received from MAC
1427 * @return ROK - success
1430 ***************************************************************************/
1431 uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm)
1433 if (cfm->cfm.status == LCM_PRIM_OK)
1435 switch (cfm->hdr.elmId.elmnt)
1439 DU_LOG("\nDEBUG --> DU_APP : Received SCH CFG CFM at DU APP");
1446 duLayerConfigComplete();
1447 duBuildEgtpCfgReq();
1451 /**************************************************************************
1452 * @brief Function to fill and send MacCellconfig
1456 * Function : duBuildAndSendMacCellCfg
1459 * Initiates MAC Configs towards MAC
1462 * @return ROK - success
1465 ***************************************************************************/
1466 uint8_t duBuildAndSendMacCellCfg(uint16_t cellId)
1469 MacCellCfg *duMacCellCfg = NULLP;
1471 DU_ALLOC_SHRABL_BUF(duMacCellCfg, sizeof(MacCellCfg));
1472 if(duMacCellCfg == NULLP)
1477 /* store the address in the duCellCb so that we can free on confirm msg */
1478 if(duCb.actvCellLst[cellId-1])
1479 duCb.actvCellLst[cellId-1]->duMacCellCfg = duMacCellCfg;
1482 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duMacCellCfg, sizeof(MacCellCfg));
1486 /* copy the mac config structure from duCfgParams */
1487 memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg));
1490 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_CONFIG_REQ);
1492 /* Send MAC cell config to MAC */
1493 return (*packMacCellCfgOpts[pst.selector])(&pst, duMacCellCfg);
1496 /**************************************************************************
1497 * @brief Function to Handle MAC cell config confirm
1501 * Function : duHandleMacCellCfgCfm
1504 * Initiates general Configs towards MAC
1507 * @return ROK - success
1510 ***************************************************************************/
1511 uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
1513 uint8_t actvCellIdx = 0;
1516 for(actvCellIdx = 0; actvCellIdx < MAX_NUM_CELL; actvCellIdx++)
1518 if((duCb.actvCellLst[actvCellIdx]) && (macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId))
1520 duCb.actvCellLst[actvCellIdx]->duMacCellCfg = NULLP;
1523 if(macCellCfgCfm->rsp == ROK)
1525 /* Build and send GNB-DU config update */
1526 ret = BuildAndSendDUConfigUpdate(SERV_CELL_TO_MODIFY);
1528 /* Build and Send Cell Start Req to MAC */
1529 ret = duBuildAndSendMacCellStart();
1533 /* TODO : Action to be taken if cell configuration fails.
1534 * Should CU be informed? */
1536 DU_LOG("\nERROR --> DU_APP : Mac cell cfg failed");
1542 /*******************************************************************
1544 * @brief Builds and sends cell start request to MAC
1548 * Function : duBuildAndSendMacCellStart
1551 * Builds and sends cell start request to MAC
1554 * @return ROK - success
1557 * ****************************************************************/
1558 uint8_t duBuildAndSendMacCellStart()
1561 CellStartInfo *cellStart = NULL;
1563 DU_LOG("\nINFO --> DU APP : Building and Sending cell start request to MAC");
1565 /* Send Cell Start Request to MAC */
1566 DU_ALLOC_SHRABL_BUF(cellStart, sizeof(CellStartInfo));
1569 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building cell start request");
1573 for(uint8_t id = 0; id < MAX_NUM_CELL; id++)
1575 if(duCb.actvCellLst[id])
1577 cellStart->cellId = duCb.actvCellLst[id]->cellId;
1580 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START);
1582 return (*packMacCellStartOpts[pst.selector])(&pst, cellStart);
1588 /*******************************************************************
1590 * @brief Builds and sends cell stop request to MAC
1594 * Function : duBuildAndSendMacCellStop
1597 * Builds and sends cell stop request to MAC
1600 * @return ROK - success
1603 * ****************************************************************/
1604 uint8_t duBuildAndSendMacCellStop(uint16_t cellId)
1608 CellStopInfo *cellStop = NULL;
1610 DU_LOG("\nINFO --> DU APP : Building and Sending cell stop request to MAC");
1612 GET_CELL_IDX(cellId, cellIdx);
1613 if(duCb.actvCellLst[cellIdx] != NULLP)
1615 /* Send Cell Stop Request to MAC */
1616 DU_ALLOC_SHRABL_BUF(cellStop, sizeof(CellStopInfo));
1619 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building cell stop request");
1622 memset(cellStop, 0, sizeof(CellStopInfo));
1623 cellStop->cellId = duCb.actvCellLst[cellIdx]->cellId;
1626 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP);
1628 return (*packMacCellStopOpts[pst.selector])(&pst, cellStop);
1632 DU_LOG("\nERROR --> DU APP : duBuildAndSendMacCellStop(): cellId[%d] doesnot exists", cellId);
1638 /*******************************************************************
1640 * @brief Handles stop indication from MAC
1644 * Function : duHandleStopInd
1647 * Handles stop indication from MAC
1649 * @params[in] Post structure pointer
1650 * @return ROK - success
1653 * ****************************************************************/
1654 uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId)
1656 DuCellCb *cellCb = NULLP;
1658 if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL)
1660 DU_LOG("\nERROR --> DU APP : Invalid Cell Id %d in duHandleStopInd()", cellId->cellId);
1663 if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
1666 if((cellCb->cellStatus == ACTIVATED) || (cellCb->cellStatus == DELETION_IN_PROGRESS))
1668 DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is DOWN", cellId->cellId);
1669 if(sendCellDeleteReqToMac(cellId->cellId) == RFAILED)
1671 DU_LOG("\nERROR --> DU APP : duHandleStopInd(): Failed to send Cell delete req to MAC for\
1672 cellId[%d]", cellId->cellId);
1678 DU_LOG("\nINFO --> DU APP : Raise cell down alarm for cell id=%d", cellId->cellId);
1679 raiseCellAlrm(CELL_DOWN_ALARM_ID, cellId->cellId);
1680 setCellOpState(cellId->cellId, DISABLED, INACTIVE);
1684 if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
1685 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellId, sizeof(OduCellId));
1687 cellCb->cellStatus = CELL_OUT_OF_SERVICE; //TODO: cell status must be set to OOS after all UE and cell cleanup which is not
1693 /*******************************************************************
1695 * @brief Handles slot indication from MAC
1699 * Function : duHandleUlCcchInd
1702 * Handles UL CCCH indication from MAC
1704 * @params[in] Post structure pointer
1705 * UL CCCH Ind pointer
1706 * @return ROK - success
1709 * ****************************************************************/
1710 uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
1713 DU_LOG("\nINFO --> DU APP : UL CCCH Indication received");
1715 return (duProcUlCcchInd(ulCcchIndInfo));
1718 /*******************************************************************
1720 * @brief Process UL RRC Message from RLC
1724 * Function : DuProcRlcUlRrcMsgTrans
1726 * Functionality: Process UL RRC Message from RLC
1728 * @params[in] Post structure
1729 * UL RRC Message Info
1730 * @return ROK - success
1733 * ****************************************************************/
1734 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
1737 DuCellCb *cellCb = NULLP;
1738 DuUeCb *ueCb = NULLP;
1740 duGetCellCb(ulRrcMsgInfo->cellId, &cellCb);
1743 if(ulRrcMsgInfo->ueId > 0)
1745 if(cellCb->ueCb[ulRrcMsgInfo->ueId -1].gnbDuUeF1apId == ulRrcMsgInfo->ueId)
1746 ueCb = &cellCb->ueCb[ulRrcMsgInfo->ueId -1];
1750 /* If UL message is received for a UE in handover, it signifies that UE is now
1751 * attached to GNB. Hence marking this UE as active and requesting MAC to
1752 * release the dedicated RACH resources */
1753 if(ueCb->ueState == UE_HANDIN_IN_PROGRESS)
1755 ueCb->ueState = UE_ACTIVE;
1756 cellCb->numActvUes++;
1758 /* Release RACH resources */
1759 memset(&ueCb->cfraResource, 0, sizeof(MacCfraResource));
1760 if(duBuildAndSendRachRsrcRelToMac(ulRrcMsgInfo->cellId, ueCb) != ROK)
1762 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Failed to send RACH resource release to MAC");
1766 if(BuildAndSendULRRCMessageTransfer(ueCb, ulRrcMsgInfo->lcId, ulRrcMsgInfo->msgLen, ulRrcMsgInfo->rrcMsg) != ROK)
1768 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Failed to build and send UL RRC Message Transfer");
1774 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : UE ID [%d] not found", ulRrcMsgInfo->ueId);
1780 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Invalid UE ID [%d]", ulRrcMsgInfo->ueId);
1786 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Cell ID [%d] not found", ulRrcMsgInfo->cellId);
1790 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo->rrcMsg, ulRrcMsgInfo->msgLen);
1791 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
1795 /*******************************************************************
1797 * @brief Process RRC delivery report from RLC
1801 * Function : DuProcRlcRrcDeliveryReport
1803 * Functionality: Process RRC delivery Message from RLC
1805 * @params[in] Post structure
1806 * UL RRC Message Info
1807 * @return ROK - success
1810 * ****************************************************************/
1811 uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport)
1813 DuCellCb *cellCb = NULLP;
1815 uint8_t ret = RFAILED;
1817 if(duGetCellCb(rrcDeliveryReport->cellId, &cellCb) != ROK)
1820 ueCb = cellCb->ueCb[rrcDeliveryReport->ueId -1];
1821 ret = BuildAndSendRrcDeliveryReport(ueCb.gnbCuUeF1apId, ueCb.gnbDuUeF1apId,rrcDeliveryReport);
1823 DU_FREE_SHRABL_BUF(pst->region, pst->pool, rrcDeliveryReport, sizeof(RrcDeliveryReport));
1827 /*******************************************************************
1829 * @brief Process UL user data from RLC
1833 * Function : DuProcRlcUlUserDataTrans
1835 * Functionality: Process UL user data from RLC
1837 * @params[in] Post structure
1839 * @return ROK - success
1842 * ****************************************************************/
1843 uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData)
1849 DU_LOG("\nDEBUG --> DU APP : Received UL user data");
1851 /* Fill EGTP header */
1852 egtpMsg.msgHdr.msgType = EGTPU_MSG_GPDU;
1853 egtpMsg.msgHdr.nPdu.pres = FALSE;
1854 egtpMsg.msgHdr.seqNum.pres = FALSE;
1855 egtpMsg.msgHdr.extHdr.udpPort.pres = FALSE;
1856 egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
1858 /* Fetch EGTP tunnel info */
1859 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
1861 /*TODO: If multiple Cell Support is enables then CellId also needs to be validated alongwith ueId and DrbId*/
1862 if((duCb.upTnlCfg[teIdx] != NULLP) && (duCb.upTnlCfg[teIdx]->ueId == ulUserData->ueId) && \
1863 (duCb.upTnlCfg[teIdx]->drbId == ulUserData->rbId))
1865 if(duCb.upTnlCfg[teIdx]->tnlCfg1)
1867 egtpMsg.msgHdr.teId = duCb.upTnlCfg[teIdx]->tnlCfg1->teId; /*As we are supporting only 1 tunnel per DRB*/
1873 if (ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK)
1875 DU_LOG("\nERROR --> DU APP : Failed to allocated buffer memory in DuProcRlcUlUserDataTrans");
1876 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData->userData, ulUserData->msgLen);
1877 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData, sizeof(RlcUlUserDatInfo));
1880 oduCpyFixBufToMsg(ulUserData->userData, mBuf, ulUserData->msgLen);
1881 ODU_PRINT_MSG(mBuf, 0, 0);
1883 egtpHdlDatInd(egtpMsg);
1885 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData->userData, ulUserData->msgLen);
1886 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData, sizeof(RlcUlUserDatInfo));
1890 /*******************************************************************
1892 * @brief process the slice cfg rsp received from MAC
1896 * Function : DuProcMacSliceCfgRsp
1898 * Functionality: process the slice cfg rsp received from MAC
1900 * @params[in] Post structure, MacSliceCfgRsp *cfgRsp
1902 * @return ROK - success
1905 **********************************************************************/
1906 uint8_t DuProcMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp)
1910 if(cfgRsp->rsp == MAC_DU_APP_RSP_OK)
1912 duCb.sliceState = SLICE_CONFIGURED;
1913 DU_LOG("\nINFO --> DU_APP : Slice configured successfully ");
1917 DU_LOG("\nERROR --> DU_APP : Slice not available");
1919 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacSliceCfgRsp));
1924 /*******************************************************************
1926 * @brief Fill the slice configration and rrm policy related
1927 * information received form O1
1931 * Function : BuildAndSendSliceConfigReq
1933 * Functionality: Fill the slice configration and rrm policy related
1935 * @params[in] RrmPolicy *rrmPolicy[], uint8_t totalRrmPolicy, uint8_t
1938 * @return ROK - success
1941 * ****************************************************************/
1942 uint8_t BuildAndSendSliceConfigReq()
1945 MacSliceCfgReq *sliceCfgReq;
1947 DU_ALLOC_SHRABL_BUF(sliceCfgReq, sizeof(MacSliceCfgReq));
1948 if(sliceCfgReq == NULLP)
1950 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in BuildAndSendSliceConfigReq");
1955 memcpy(sliceCfgReq, &duCfgParam.tempSliceCfg, sizeof(MacSliceCfgReq));
1956 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_SLICE_CFG_REQ);
1958 DU_LOG("\nDEBUG --> DU_APP : Sending Slice Cfg Request to MAC ");
1959 if((*packMacSliceCfgReqOpts[pst.selector])(&pst, sliceCfgReq) == RFAILED)
1961 DU_LOG("\nERROR --> DU_APP : Failed to send Slice Cfg Req to MAC");
1962 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, sliceCfgReq, sizeof(MacSliceCfgReq));
1968 /*******************************************************************
1970 * @brief Fill the slice configration and rrm policy related
1971 * information received form O1
1975 * Function : BuildAndSendSliceRecfgReq
1977 * Functionality: Fill the slice configration and rrm policy related
1979 * @params[in] RrmPolicy rrmPolicy[], uint8_t totalSliceCount
1981 * @return ROK - success
1984 * ****************************************************************/
1985 uint8_t BuildAndSendSliceRecfgReq()
1988 MacSliceRecfgReq *sliceRecfgReq = NULLP;
1990 DU_LOG("\nINFO --> DU_APP : Slice ReConfiguration Request received");
1992 DU_ALLOC_SHRABL_BUF(sliceRecfgReq, sizeof(MacSliceRecfgReq));
1993 if(sliceRecfgReq == NULLP)
1995 DU_LOG("\nERROR --> DU_APP : Memory allocation failed to BuildAndSendSliceRecfgReq");
2000 memcpy(sliceRecfgReq, &duCfgParam.tempSliceCfg, sizeof(MacSliceRecfgReq));
2002 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_SLICE_RECFG_REQ);
2004 DU_LOG("\nDEBUG --> DU_APP: Sending Slice ReCfg Request to MAC ");
2005 if( (*packMacSliceRecfgReqOpts[pst.selector])(&pst, sliceRecfgReq) == RFAILED)
2007 DU_LOG("\nERROR --> DU_APP: Failed to send Slice ReCfg Req to MAC");
2008 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, sliceRecfgReq, sizeof(MacSliceRecfgReq));
2013 /*******************************************************************
2015 * @brief process the slice ReCfg rsp received from MAC
2019 * Function : DuProcMacSliceRecfgRsp
2021 * Functionality: process the slice ReCfg rsp received from MAC
2023 * @params[in] Post structure, MacSliceRecfgRsp *ReCfgRsp
2025 * @return ROK - success
2028 **********************************************************************/
2029 uint8_t DuProcMacSliceRecfgRsp(Pst *pst, MacSliceRecfgRsp *recfgRsp)
2033 if(recfgRsp->rsp == MAC_DU_APP_RSP_OK)
2035 duCb.sliceState = SLICE_RECONFIGURED;
2036 DU_LOG("\nINFO --> DU_APP : Slice Reconfigured successfully ");
2040 DU_LOG("\nERROR --> DU_APP : Slice not available");
2042 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, recfgRsp, sizeof(MacSliceCfgRsp));
2047 /*******************************************************************
2049 * @brief Handles received Slice Metrics from RLC and forward it to O1
2053 * Function : DuProcRlcSliceMetrics
2056 * Handles received Slice Metrics from RLC and forward it to O1
2058 * @params[in] Post structure pointer
2059 * SlicePmList *sliceStats
2061 * @return ROK - success
2064 * ****************************************************************/
2065 uint8_t DuProcRlcSliceMetrics(Pst *pst, SlicePmList *sliceStats)
2067 uint8_t sliceRecord = 0;
2069 DU_LOG("\nDEBUG --> DU APP : Received Slice Metrics");
2070 if(sliceStats == NULLP)
2072 DU_LOG("\nERROR --> DU APP : Empty Metrics");
2076 for(sliceRecord = 0; sliceRecord < sliceStats->numSlice; sliceRecord++)
2078 DU_LOG("\nINFO --> DU_APP: SliceId[SST-SD]:%d-%d, DlTput %.5lf, UlTput:%.5lf", sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier.sst,\
2079 sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier.sd,sliceStats->sliceRecord[sliceRecord].ThpDl,\
2080 sliceStats->sliceRecord[sliceRecord].ThpUl);
2085 sendSliceMetric((SliceMetricList*) sliceStats);
2089 DU_FREE_SHRABL_BUF(pst->region, pst->pool,sliceStats->sliceRecord, (sliceStats->numSlice) * (sizeof(SlicePm)));
2090 DU_FREE_SHRABL_BUF(pst->region, pst->pool,sliceStats, sizeof(SlicePmList));
2096 /*******************************************************************
2098 * @brief Send Statistics request to MAC
2102 * Function : BuildAndSendStatsReqToMac()
2104 * Functionality: Send Statistics Request To Mac
2108 * @return ROK - success
2111 * ****************************************************************/
2112 uint8_t BuildAndSendStatsReqToMac(RicSubscription *ricSubscriptionInfo)
2115 MacStatsReq *macStatsReq = NULLP;
2117 /* Fill MAC statistics request */
2118 DU_ALLOC_SHRABL_BUF(macStatsReq, sizeof(MacStatsReq));
2119 if(macStatsReq == NULLP)
2121 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsReq in BuildAndSendStatsReqToMac");
2125 /* Fill E2 Subscription Info in MAC Statistics Request and send to MAC */
2126 if(fillRicSubsInMacStatsReq(macStatsReq, ricSubscriptionInfo) == ROK)
2128 DU_LOG("\nDEBUG --> DU_APP: Sending Statistics Request to MAC ");
2129 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATISTICS_REQ);
2131 if( (*packMacStatsReqOpts[pst.selector])(&pst, macStatsReq) == ROK)
2134 DU_LOG("\nERROR --> DU_APP: Failed to send Statistics Request to MAC");
2137 DU_LOG("\nERROR --> DU_APP: No Statistics group found valid. Hence statistics request is not sent to MAC");
2138 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsReq, sizeof(MacStatsReq));
2142 /*******************************************************************
2144 * @brief Send Statistics request to DU layers
2148 * Function : BuildAndSendStatsReq()
2150 * Functionality: Check if there is an update in statistics
2151 * reporting configuration. If so, send the update to
2154 * @params[in] Subscription Info
2156 * @return ROK - success
2159 * ****************************************************************/
2160 uint8_t BuildAndSendStatsReq(RicSubscription *ricSubscriptionInfo)
2162 /* Build and sent subscription information to MAC in Statistics Request */
2163 if(BuildAndSendStatsReqToMac(ricSubscriptionInfo) != ROK)
2165 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsReqToMac()");
2169 /* TODO : When KPI collection from RLC will be supported, this function will be
2170 * called to configure KPIs to be colled */
2172 if(BuildAndSendStatsReqToRlc() != ROK)
2174 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsReqToRlc()");
2182 /*******************************************************************
2184 * @brief Process statistics response from MAC
2188 * Function : DuProcMacStatsRsp
2190 * Functionality: Processes statistics configuration response
2191 * from MAC. If configuration is succsessful, DUAPP starts
2192 * reporting period timer for this subscription request
2197 * @return ROK - success
2200 * ****************************************************************/
2201 uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
2203 uint8_t ret = RFAILED;
2204 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsRsp: Received Statistics Response from MAC");
2210 DU_LOG("\n Subscription Id [%ld]", statsRsp->subscriptionId);
2212 DU_LOG("\n Number of Accepted Groups [%d]", statsRsp->numGrpAccepted);
2213 for(idx=0; idx<statsRsp->numGrpAccepted; idx++)
2215 DU_LOG("\n Group Id [%d]", statsRsp->statsGrpAcceptedList[idx]);
2218 DU_LOG("\n Number of Rejected Groups [%d]", statsRsp->numGrpRejected);
2219 for(idx=0; idx<statsRsp->numGrpRejected; idx++)
2221 DU_LOG("\n Group Id [%d]", statsRsp->statsGrpRejectedList[idx].groupId);
2225 /* Check the list of accepted and rejected statistics group and send
2226 * Ric subscription response/failure accordingly */
2227 if((ret = e2ProcStatsRsp(statsRsp)) != ROK)
2229 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsRsp: Failed in %s at line %d", __func__, __LINE__);
2232 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsRsp, sizeof(MacStatsRsp));
2236 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsRsp: Received NULL Pointer");
2241 /*******************************************************************
2243 * @brief Process statistics indication from MAC
2247 * Function : DuProcMacStatsInd
2249 * Functionality: Processes statistics indication from MAC.
2253 * @return ROK - success
2256 * ****************************************************************/
2257 uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsInd)
2259 uint8_t ret = RFAILED;
2264 DU_LOG("\nDEBUG --> DU_APP : DuProcMacStatsInd: Received Statistics Indication");
2265 DU_LOG("\n Subscription Id [%ld]", statsInd->subscriptionId);
2266 DU_LOG("\n Group Id [%d]", statsInd->groupId);
2267 for(int idx = 0; idx < statsInd->numStats; idx++)
2269 DU_LOG("\n Meas type [%d] Meas Value [%lf]", statsInd->measuredStatsList[idx].type,\
2270 statsInd->measuredStatsList[idx].value);
2274 /* Extract statistics from statistics indication message and store in E2 DB */
2275 if((ret = e2ProcStatsInd(statsInd)) != ROK)
2277 DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__);
2280 /* Free statistics indication */
2281 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsInd, sizeof(MacStatsInd));
2285 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsInd: Received NULL Pointer");
2290 /*******************************************************************
2292 * @brief Process statistics delete response from MAC
2296 * Function : DuProcMacStatsDeleteRsp
2298 * Functionality: Processes statistics delete response
2303 * Mac stats delete rsp
2305 * @return ROK - success
2308 * ****************************************************************/
2310 uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp)
2312 uint8_t ret = RFAILED;
2313 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsDeleteRsp: Received Statistics Response from MAC");
2317 /* numStatsGroup == 0, received a response for complete ric
2318 * subscription deletion else, received a response
2319 * for RIC_SUBS_MOD_REQ's actionToBeDeleted*/
2320 if(statsDeleteRsp->numStatsGroupDeleted ==0)
2322 if((ret = e2ProcStatsDeleteRsp(statsDeleteRsp)) != ROK)
2324 DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__);
2329 /* TODO calling ric sub modification action to be deleted functions */
2331 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsDeleteRsp, sizeof(MacStatsDeleteRsp));
2335 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsDeleteRsp: Received NULL Pointer");
2340 /*******************************************************************
2342 * @brief Send Statistics delete req to MAC
2346 * Function : BuildAndSendStatsDeleteReqToMac()
2348 * Functionality: Send Statistics delete req To Mac
2353 * @return ROK - success
2356 * ****************************************************************/
2357 uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo, bool deleteAllStats)
2360 uint8_t actionIdx=0;
2361 CmLList *actionNode=NULLP;
2362 ActionInfo *actionDb = NULLP;
2363 E2FailureCause failureCause;
2364 MacStatsDeleteReq *macStatsDelete = NULLP;
2366 /* Fill MAC statistics delete */
2367 DU_ALLOC_SHRABL_BUF(macStatsDelete, sizeof(MacStatsDeleteReq));
2368 if(macStatsDelete == NULLP)
2370 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsDelete in BuildAndSendStatsDeleteReqToMac");
2371 failureCause.causeType = E2_MISCELLANEOUS;
2372 failureCause.cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED;
2374 if(BuildAndSendRicSubscriptionDeleteFailure(ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId, failureCause) != ROK)
2376 DU_LOG("\nERROR --> E2AP : e2ProcStatsDeleteRsp: failed to build and send ric subs delete failure");
2382 memset(macStatsDelete, 0, sizeof(MacStatsDeleteReq));
2383 /* Generate subscription ID using RIC Request ID and RAN Function ID */
2384 encodeSubscriptionId(&macStatsDelete->subscriptionId, ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId);
2386 /* If deleteAllStats is true, then we don't need to fill in the
2387 * statsGrpIdToBeDelList with action details; otherwise, we must fill in the
2388 * statsGrpIdToBeDelList with action-related data that is set to CONFIG_DEL.*/
2392 CM_LLIST_FIRST_NODE(&ricSubscriptionInfo->actionSequence, actionNode);
2395 actionDb = (ActionInfo*)(actionNode->node);
2396 if(actionDb->action == CONFIG_DEL)
2398 macStatsDelete->statsGrpIdToBeDelList[actionIdx] = actionDb->actionId;
2402 macStatsDelete->numStatsGroupToBeDeleted=actionIdx;
2405 DU_LOG("\nDEBUG --> DU_APP: Sending Statistics delete req to MAC ");
2406 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATS_DELETE_REQ);
2408 if( (*packMacStatsDeleteReqOpts[pst.selector])(&pst, macStatsDelete) != ROK)
2410 DU_LOG("\nERROR --> DU_APP: Failed to send Statistics delete req to MAC");
2411 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsDelete, sizeof(MacStatsDeleteReq));
2419 /*******************************************************************
2421 * @brief Statistics delete to DU layers
2425 * Function : BuildAndSendStatsDeleteReq()
2427 * Functionality: Statistics delete to DU layers
2429 * @params[in] Subscription Info
2431 * @return ROK - success
2434 * ****************************************************************/
2435 uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo)
2437 /* Build and sent subscription information to MAC in Statistics delete */
2438 if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo, true) != ROK)
2440 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsDeleteReqToMac()");
2446 /*******************************************************************
2448 * @brief Send Statistics Modification request to MAC
2452 * Function : BuildAndSendStatsModificationReqToMac()
2454 * Functionality: Send Statistics Modification Request To Mac
2456 * @params[in] Ric subscription info
2458 * @return ROK - success
2461 * ****************************************************************/
2462 uint8_t BuildAndSendStatsModificationReqToMac(RicSubscription *ricSubscriptionInfo)
2465 MacStatsModificationReq *macStatsModificationReq = NULLP;
2467 /* Fill MAC statistics modification request */
2468 DU_ALLOC_SHRABL_BUF(macStatsModificationReq, sizeof(MacStatsModificationReq));
2469 if(macStatsModificationReq == NULLP)
2471 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsModificationReq in BuildAndSendStatsModificationReqToMac");
2475 /* Fill E2 Subscription Info in MAC Statistics Modification Request and send to MAC */
2476 if(fillRicSubsInMacStatsModificationReq(macStatsModificationReq, ricSubscriptionInfo) == ROK)
2478 DU_LOG("\nDEBUG --> DU_APP: Sending Statistics Modification Request to MAC ");
2479 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATISTICS_MODIFY_REQ);
2481 if( (*packMacStatsModificationReqOpts[pst.selector])(&pst, macStatsModificationReq) == ROK)
2484 DU_LOG("\nERROR --> DU_APP: Failed to send Statistics Modification Request to MAC");
2487 DU_LOG("\nERROR --> DU_APP: No Statistics group found valid. Hence statistics Modification request is not sent to MAC");
2488 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsModificationReq, sizeof(MacStatsModificationReq));
2492 /*******************************************************************
2494 * @brief Send Statistics Modification request to DU layers
2498 * Function : BuildAndSendStatsModificationReq()
2500 * Functionality: Check if there is an update in statistics
2501 * reporting configuration. If so, send the update Modification to
2504 * @params[in] Subscription Info
2506 * @return ROK - success
2509 * ****************************************************************/
2510 uint8_t BuildAndSendStatsModificationReq(RicSubscription *ricSubscriptionInfo)
2512 /* Build and sent subscription information to MAC in Statistics Modification Request */
2513 if(BuildAndSendStatsModificationReqToMac(ricSubscriptionInfo) != ROK)
2515 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsModificationReqToMac()");
2522 /*******************************************************************
2524 * @brief Process statistics modification response from MAC
2528 * Function : DuProcMacStatsModificationRsp
2530 * Functionality: Processes statistics modification configuration
2531 * response from MAC. If configuration is succsessful, DUAPP starts
2532 * reporting period timer for this subscription request
2537 * MAC stats modification rsp
2539 * @return ROK - success
2542 * ****************************************************************/
2543 uint8_t DuProcMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp)
2545 uint8_t ret = RFAILED;
2546 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsModificationRsp: Received Statistics Modification Response from MAC");
2548 if(statsModificationRsp)
2552 DU_LOG("\n Subscription Id [%ld]", statsModificationRsp->subscriptionId);
2554 DU_LOG("\n Number of Accepted Groups [%d]", statsModificationRsp->numGrpAccepted);
2555 for(idx=0; idx<statsModificationRsp->numGrpAccepted; idx++)
2557 DU_LOG("\n Group Id [%d]", statsModificationRsp->statsGrpAcceptedList[idx]);
2560 DU_LOG("\n Number of Rejected Groups [%d]", statsModificationRsp->numGrpRejected);
2561 for(idx=0; idx<statsModificationRsp->numGrpRejected; idx++)
2563 DU_LOG("\n Group Id [%d]", statsModificationRsp->statsGrpRejectedList[idx].groupId);
2568 /* Check the list of accepted and rejected statistics group and send
2569 * Ric subscription modification response/failure accordingly */
2570 if((ret = e2ProcStatsModificationRsp(statsModificationRsp)) != ROK)
2572 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsModificationRsp: Failed in %s at line %d", __func__, __LINE__);
2575 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsModificationRsp, sizeof(MacStatsModificationRsp));
2579 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsModificationRsp: Received NULL Pointer");
2584 /**********************************************************************
2586 **********************************************************************/