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"
44 #include "du_msg_hdl.h"
48 #include "AlarmInterface.h"
49 #include "CmInterface.h"
50 #include "PmInterface.h"
55 uint8_t numRlcDlSaps = 0;
57 uint8_t numRlcMacSaps = 0;
59 uint8_t macCfgInst = 0;
61 packMacCellCfgReq packMacCellCfgOpts[] =
63 packMacCellCfg, /* packing for loosely coupled */
64 MacProcCellCfgReq, /* packing for tightly coupled */
65 packMacCellCfg, /* packing for light weight loosly coupled */
68 DuMacCellStart packMacCellStartOpts[] =
70 packMacCellStart, /* Loose coupling */
71 MacProcCellStart, /* TIght coupling */
72 packMacCellStart /* Light weight-loose coupling */
75 DuMacCellStop packMacCellStopOpts[] =
77 packMacCellStop, /* Loose coupling */
78 MacProcCellStop, /* TIght coupling */
79 packMacCellStop /* Light weight-loose coupling */
82 DuMacSliceCfgReq packMacSliceCfgReqOpts[] =
84 packDuMacSliceCfgReq, /* Loose coupling */
85 MacProcSliceCfgReq, /* TIght coupling */
86 packDuMacSliceCfgReq /* Light weight-loose coupling */
90 DuMacSliceRecfgReq packMacSliceRecfgReqOpts[] =
92 packDuMacSliceRecfgReq, /* Loose coupling */
93 MacProcSliceRecfgReq, /* TIght coupling */
94 packDuMacSliceRecfgReq /* Light weight-loose coupling */
97 DuMacStatsReqFunc packMacStatsReqOpts[]=
99 packDuMacStatsReq, /* Loose Coupling */
100 MacProcStatsReq, /* Tight Coupling */
101 packDuMacStatsReq /* Light weight-loose coupling */
104 DuMacStatsDeleteReqFunc packMacStatsDeleteReqOpts[]=
106 packDuMacStatsDeleteReq, /* Loose Coupling */
107 MacProcStatsDeleteReq, /* Tight Coupling */
108 packDuMacStatsDeleteReq /* Light weight-loose coupling */
111 DuMacStatsModificationReqFunc packMacStatsModificationReqOpts[]=
113 packDuMacStatsModificationReq, /* Loose Coupling */
114 MacProcStatsModificationReq, /* Tight Coupling */
115 packDuMacStatsModificationReq /* Light weight-loose coupling */
118 /**************************************************************************
119 * @brief Function to fill configs required by RLC
123 * Function : duBuildRlcCfg
126 * Initiates general Configs towards RLC
128 * @param[in] Inst Specifies if RLC UL or RLC DL instance
129 * @return ROK - success
132 ***************************************************************************/
133 uint8_t duBuildRlcCfg(Inst inst)
136 RlcGenCfg *genCfg = NULLP;
139 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
140 DU_SET_ZERO(&pst, sizeof(Pst));
142 genCfg = &(rlcMngmt.t.cfg.s.gen);
144 /*----------- Fill General Configuration Parameters ---------*/
145 genCfg->maxUe = MAX_NUM_UE;
146 genCfg->maxKwuSaps = 2;
147 genCfg->maxUdxSaps = 1;
148 genCfg->rlcMode = (inst == RLC_UL_INST) ?
149 LKW_RLC_MODE_UL : LKW_RLC_MODE_DL;
151 genCfg->maxRguSaps = DEFAULT_CELLS;
153 /*----------- Fill lmPst
154 * Parameters ---------*/
155 genCfg->lmPst.dstProcId = DU_PROC;
156 genCfg->lmPst.srcProcId = DU_PROC;
157 genCfg->lmPst.dstEnt = ENTDUAPP;
158 genCfg->lmPst.dstInst = DU_INST;
159 genCfg->lmPst.srcEnt = ENTRLC;
160 genCfg->lmPst.srcInst = inst;
161 genCfg->lmPst.prior = PRIOR0;
162 genCfg->lmPst.route = RTESPEC;
163 genCfg->lmPst.region = (inst == RLC_UL_INST) ?
164 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
165 genCfg->lmPst.pool = RLC_POOL;
166 genCfg->lmPst.selector = ODU_SELECTOR_LC;
169 rlcMngmt.hdr.msgType = TCFG;
170 rlcMngmt.hdr.msgLen = 0;
171 rlcMngmt.hdr.entId.ent = ENTRLC;
172 rlcMngmt.hdr.entId.inst = (Inst)0;
173 rlcMngmt.hdr.elmId.elmnt = STGEN;
174 rlcMngmt.hdr.seqNmb = 0;
175 rlcMngmt.hdr.version = 0;
176 rlcMngmt.hdr.transId = 0;
177 rlcMngmt.hdr.response.prior = PRIOR0;
178 rlcMngmt.hdr.response.route = RTESPEC;
179 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
180 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
181 rlcMngmt.hdr.response.mem.pool = DU_POOL;
182 rlcMngmt.hdr.response.selector = ODU_SELECTOR_LC;
185 pst.selector = ODU_SELECTOR_LC;
186 pst.srcEnt = ENTDUAPP;
189 pst.dstProcId = DU_PROC;
190 pst.srcProcId = DU_PROC;
191 pst.region = duCb.init.region;
193 DU_LOG("\nDEBUG --> DU_APP : RLC Gen Cfg Req sent for inst %d", inst);
195 /* Send the request to RLC */
196 packRlcConfigReq(&pst, &rlcMngmt);
201 /**************************************************************************
202 * @brief Function to fill configs required by RLC
206 * Function : duBuildRlcLsapCfg
209 * Initiates general Configs towards RLC
211 * @param[in] Inst Specifies if RLC UL or RLC DL instance
212 * @return ROK - success
215 ***************************************************************************/
216 uint8_t duBuildRlcLsapCfg(Ent ent, Inst inst, uint8_t lsapInst)
220 RlcSapCfg *lSap = NULLP;
223 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
224 DU_SET_ZERO(&pst, sizeof(Pst));
227 rlcMngmt.hdr.msgType = TCFG;
228 rlcMngmt.hdr.entId.ent = ENTRLC;
229 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
230 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
232 rlcMngmt.hdr.response.mem.pool = RLC_POOL;
235 pst.selector = ODU_SELECTOR_LC;
236 pst.srcEnt = ENTDUAPP;
238 pst.dstProcId = DU_PROC;
240 pst.srcProcId = DU_PROC;
241 pst.region = duCb.init.region;
242 lSap = &(rlcMngmt.t.cfg.s.sap);
244 lSap->mem.region = (inst == RLC_UL_INST) ?
245 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
246 lSap->mem.pool = RLC_POOL;
248 lSap->bndTmrIntvl = 10;
249 lSap->priority = PRIOR0;
250 lSap->route = RTESPEC;
253 lSap->procId = DU_PROC;
255 lSap->inst = lsapInst;
256 lSap->sapId = lsapInst; /* SapId will be stored as suId in MAC */
257 lSap->selector = (inst == RLC_UL_INST) ? ODU_SELECTOR_LWLC : ODU_SELECTOR_TC;
258 rlcMngmt.hdr.elmId.elmnt = STRGUSAP;
259 DU_LOG("\nDEBUG --> DU_APP : RLC MAC Lower Sap Cfg Req sent for inst %d", inst);
264 lSap->procId = DU_PROC;
266 lSap->inst = (inst == RLC_UL_INST) ?
267 RLC_DL_INST : RLC_UL_INST;
269 lSap->selector = ODU_SELECTOR_LC;
270 rlcMngmt.hdr.elmId.elmnt = STUDXSAP;
271 DU_LOG("\nDEBUG --> DU_APP : RLC DL/UL Lower Sap Cfg Req sent for inst %d", inst);
274 packRlcConfigReq(&pst, &rlcMngmt);
278 /**************************************************************************
279 * @brief Function to fill configs required by RLC
283 * Function : duBuildRlcUsapCfg
286 * Initiates general Configs towards RLC
288 * @param[in] Inst Specifies if RLC UL or RLC DL instance
289 * @return ROK - success
292 ***************************************************************************/
293 uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst)
296 RlcSapCfg *uSap = NULLP;
299 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
300 DU_SET_ZERO(&pst, sizeof(Pst));
302 uSap = &(rlcMngmt.t.cfg.s.sap);
304 uSap->selector = ODU_SELECTOR_LC;
305 uSap->mem.region = (inst == RLC_UL_INST) ?
306 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
307 uSap->mem.pool = RLC_POOL;
310 uSap->procId = DU_PROC;
314 uSap->inst = (inst == RLC_UL_INST) ?
315 RLC_DL_INST : RLC_UL_INST;
316 uSap->bndTmrIntvl = 1000;
317 uSap->priority = PRIOR0;
318 uSap->route = RTESPEC;
321 rlcMngmt.hdr.msgType = TCFG;
322 rlcMngmt.hdr.entId.ent = ENTRLC;
323 rlcMngmt.hdr.elmId.elmnt = STUDXSAP;
324 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
325 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
327 rlcMngmt.hdr.response.mem.pool = RLC_POOL;
330 pst.selector = ODU_SELECTOR_LC;
331 pst.srcEnt = ENTDUAPP;
333 pst.dstProcId = DU_PROC;
335 pst.srcProcId = DU_PROC;
336 pst.region = duCb.init.region;
338 DU_LOG("\nDEBUG --> DU_APP : RLC Kwu Upper Sap Cfg Req sent for inst %d", inst);
339 packRlcConfigReq(&pst, &rlcMngmt);
344 /**************************************************************************
345 * @brief Function to populate internal DS of DU APP
349 * Function : duProcCfgComplete
352 * Populates internal data structures of DU APP after
353 * receiving configurations.
356 * @return ROK - success
359 ***************************************************************************/
360 uint8_t duProcCfgComplete()
364 for(idx=0; idx< DEFAULT_CELLS; idx++)
366 DuCellCb *cell = NULLP;
367 DU_ALLOC(cell, sizeof(DuCellCb));
370 DU_LOG("\nERROR --> DU_APP : Memory Allocation failed in duProcCfgComplete");
376 memset(cell, 0, sizeof(DuCellCb));
377 cell->cellId = NR_CELL_ID; //++cellId;
378 memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
379 cell->cellInfo.nrEcgi.plmn.mcc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[0];
380 cell->cellInfo.nrEcgi.plmn.mcc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[1];
381 cell->cellInfo.nrEcgi.plmn.mcc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[2];
382 cell->cellInfo.nrEcgi.plmn.mnc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[0];
383 cell->cellInfo.nrEcgi.plmn.mnc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[1];
384 cell->cellInfo.nrEcgi.plmn.mnc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[2];
385 cell->cellInfo.nrEcgi.cellId = cell->cellId;
386 cell->cellInfo.nrPci = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.nrPci;
387 cell->cellInfo.fiveGsTac = duCfgParam.srvdCellLst[0].duCellInfo.tac;
388 memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
389 for(idx1=0; idx1<MAX_PLMN; idx1++)
391 cell->cellInfo.plmn[idx1].mcc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[0];
392 cell->cellInfo.plmn[idx1].mcc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[1];
393 cell->cellInfo.plmn[idx1].mcc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mcc[2];
394 cell->cellInfo.plmn[idx1].mnc[0] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[0];
395 cell->cellInfo.plmn[idx1].mnc[1] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[1];
396 cell->cellInfo.plmn[idx1].mnc[2] = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].plmn.mnc[2];
398 cell->cellInfo.maxUe = MAX_NUM_UE;
399 cell->cellStatus = CELL_OUT_OF_SERVICE;
400 gConfigInfo.gCellStatus = CELL_DOWN;
401 duCb.cfgCellLst[duCb.numCfgCells] = cell;
407 //Start layer configs
408 ret = duSendRlcUlCfg();
412 /**************************************************************************
413 * @brief Function to invoke DU Layer Configs
417 * Function : duSendRlcUlCfg
420 * Initiates Configs towards layers of DU
423 * @return ROK - success
426 ***************************************************************************/
427 uint8_t duSendRlcUlCfg()
431 duBuildRlcCfg((Inst)RLC_UL_INST);
432 for(cellIdx = 0; cellIdx < DEFAULT_CELLS; cellIdx++)
434 duBuildRlcLsapCfg(ENTMAC, (Inst)RLC_UL_INST, cellIdx);
436 duBuildRlcLsapCfg(ENTRLC, (Inst)RLC_UL_INST, 0);
441 /**************************************************************************
442 * @brief Function to invoke DU Layer Configs
446 * Function : duSendRlcDlCfg
449 * Initiates Configs towards layers of DU
452 * @return ROK - success
455 ***************************************************************************/
456 uint8_t duSendRlcDlCfg()
460 duBuildRlcCfg((Inst)RLC_DL_INST);
461 duBuildRlcUsapCfg(STUDXSAP, ENTRLC, (Inst)RLC_DL_INST);
462 for(cellIdx = 0; cellIdx < DEFAULT_CELLS; cellIdx++)
464 duBuildRlcLsapCfg(ENTMAC, (Inst)RLC_DL_INST, cellIdx);
469 /**************************************************************************
470 * @brief Function to handle Config Confirm from RLC
474 * Function : DuHdlRlcCfgComplete
477 * Handles Gen Config Confirm from RLC
479 * @param[in] Pst *pst, Post structure of the primitive.
480 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC
481 * @return ROK - success
484 ***************************************************************************/
485 uint8_t DuHdlRlcCfgComplete(Pst *pst, RlcMngmt *cfm)
488 if (pst->srcInst == RLC_UL_INST)
490 ret = duProcRlcUlCfgComplete(pst, cfm);
494 ret = duProcRlcDlCfgComplete(pst, cfm);
499 /**************************************************************************
500 * @brief Function to handle Control Config Confirm from RLC
504 * Function : duHdlRlcCntrlCfgComplete
507 * Handles Control Config Confirm from RLC
509 * @param[in] Pst *pst, Post structure of the primitive.
510 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC
511 * @return ROK - success
514 ***************************************************************************/
515 uint8_t duHdlRlcCntrlCfgComplete(Pst *pst, RlcMngmt *cntrl)
519 if (cntrl->cfm.status == LCM_PRIM_OK)
521 switch (cntrl->hdr.elmId.elmnt)
525 if (pst->srcInst == RLC_DL_INST)
527 DU_LOG("\nDEBUG --> DU_APP : BIND OF RLC DL TO MAC (RGU) SAP SUCCESSFUL");
529 if(macCfgInst < DEFAULT_CELLS)
532 duBindUnbindRlcToMacSap((Inst) RLC_DL_INST, ABND);
536 duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
541 DU_LOG("\nDEBUG --> DU_APP : BIND OF RLC UL TO MAC (RGU) SAP SUCCESSFUL");
543 if(macCfgInst < DEFAULT_CELLS)
545 duBindUnbindRlcToMacSap((Inst) RLC_UL_INST, ABND);
559 /**************************************************************************
560 * @brief Function to handle Config Confirm from RLC UL
564 * Function : duHdlRlcUlCfgComplete
567 * Handles Config Confirm from RLC UL
569 * @param[in] Pst *pst, Post structure of the primitive.
570 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC UL
571 * @return ROK - success
574 ***************************************************************************/
575 uint8_t duProcRlcUlCfgComplete(Pst *pst, RlcMngmt *cfm)
579 DU_LOG("\nDEBUG --> DU_APP : RLC UL Cfg Status %d", cfm->cfm.status);
580 if (cfm->cfm.status == LCM_PRIM_OK)
582 switch(cfm->hdr.elmId.elmnt)
586 rlcUlCfg |= RLC_GEN_CFG;
592 if(numRlcMacSaps == DEFAULT_CELLS)
594 rlcUlCfg |= RLC_MAC_SAP_CFG;
601 rlcUlCfg |= RLC_UDX_SAP_CFG;
608 DU_LOG("\nDEBUG --> DU_APP : RLC UL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
609 if(rlcUlCfg == DU_RLC_UL_CONFIGURED)
613 //Start configuration of RLC DL
620 DU_LOG("\nERROR --> DU_APP : Config confirm NOK from RLC UL");
626 /**************************************************************************
627 * @brief Function to handle Config Confirm from RLC DL
631 * Function : duHdlRlcDlCfgComplete
634 * Handles Config Confirm from RLC DL
636 * @param[in] Pst *pst, Post structure of the primitive.
637 * @param[in] RlcMngmt *cfm, Unpacked primitive info received from RLC DL
638 * @return ROK - success
641 ***************************************************************************/
642 uint8_t duProcRlcDlCfgComplete(Pst *pst, RlcMngmt *cfm)
644 DU_LOG("\nDEBUG --> DU_APP : RLC DL Cfg Status %d", cfm->cfm.status);
645 if (cfm->cfm.status == LCM_PRIM_OK)
647 switch(cfm->hdr.elmId.elmnt)
651 rlcDlCfg |= RLC_GEN_CFG;
657 if(numRlcMacSaps == DEFAULT_CELLS)
659 rlcDlCfg |= RLC_MAC_SAP_CFG;
666 rlcDlCfg |= RLC_UDX_SAP_CFG;
674 DU_LOG("\nDEBUG --> DU_APP : RLC DL Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
675 if(rlcDlCfg == DU_RLC_DL_CONFIGURED)
678 //Start configuration of MAC
685 DU_LOG("\nERROR --> DU_APP : Config confirm NOK from RLC DL");
690 /**************************************************************************
691 * @brief Function to send configs to MAC
695 * Function : duSendMacCfg
698 * Initiates Configs towards MAC layer
701 * @return ROK - success
704 ***************************************************************************/
705 uint8_t duSendMacCfg()
708 duBuildMacUsapCfg(RLC_UL_INST);
709 duBuildMacUsapCfg(RLC_DL_INST);
714 /**************************************************************************
715 * @brief Function to fill gen config required by MAC
719 * Function : duBuildMacGenCfg
722 * Initiates general Configs towards MAC
725 * @return ROK - success
728 ***************************************************************************/
729 uint8_t duBuildMacGenCfg()
732 RgGenCfg *genCfg=NULLP;
735 DU_SET_ZERO(&pst, sizeof(Pst));
736 DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
738 genCfg = &(rgMngmt.t.cfg.s.genCfg);
740 /*----------- Fill General Configuration Parameters ---------*/
741 genCfg->mem.region = MAC_MEM_REGION;
742 genCfg->mem.pool = MAC_POOL;
744 genCfg->numRguSaps = 2;
746 genCfg->lmPst.dstProcId = DU_PROC;
747 genCfg->lmPst.srcProcId = DU_PROC;
748 genCfg->lmPst.dstEnt = ENTDUAPP;
749 genCfg->lmPst.dstInst = 0;
750 genCfg->lmPst.srcEnt = ENTMAC;
751 genCfg->lmPst.srcInst = macCfgInst;
752 genCfg->lmPst.prior = PRIOR0;
753 genCfg->lmPst.route = RTESPEC;
754 genCfg->lmPst.region = MAC_MEM_REGION;
755 genCfg->lmPst.pool = MAC_POOL;
756 genCfg->lmPst.selector = ODU_SELECTOR_LC;
759 rgMngmt.hdr.msgType = TCFG;
760 rgMngmt.hdr.msgLen = 0;
761 rgMngmt.hdr.entId.ent = ENTMAC;
762 rgMngmt.hdr.entId.inst = (Inst)0;
763 rgMngmt.hdr.elmId.elmnt = STGEN;
764 rgMngmt.hdr.seqNmb = 0;
765 rgMngmt.hdr.version = 0;
766 rgMngmt.hdr.transId = 0;
768 rgMngmt.hdr.response.prior = PRIOR0;
769 rgMngmt.hdr.response.route = RTESPEC;
770 rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
771 rgMngmt.hdr.response.mem.pool = MAC_POOL;
772 rgMngmt.hdr.response.selector = ODU_SELECTOR_LC;
775 pst.selector = ODU_SELECTOR_LC;
776 pst.srcEnt = ENTDUAPP;
778 pst.dstInst = macCfgInst;
779 pst.dstProcId = DU_PROC;
780 pst.srcProcId = DU_PROC;
781 pst.region = duCb.init.region;
783 DU_LOG("\nDEBUG --> DU_APP : MAC Gen Cfg Req sent");
785 /* Send the request to MAC */
786 cmPkLrgCfgReq(&pst, &rgMngmt);
791 /**************************************************************************
792 * @brief Function to fill USAP config required by MAC
796 * Function : duBuildMacUsapCfg
799 * Initiates USAP Configs towards MAC
801 * @param[in] SpId Specifies if RLC UL or RLC DL instance
802 * @return ROK - success
805 ***************************************************************************/
806 uint8_t duBuildMacUsapCfg(SpId sapId)
809 RgUpSapCfg *uSap = NULLP;
812 DU_SET_ZERO(&pst, sizeof(Pst));
813 DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
815 uSap = &(rgMngmt.t.cfg.s.rguSap);
817 uSap->mem.region = MAC_MEM_REGION;
818 uSap->mem.pool = MAC_POOL;
821 uSap->procId = DU_PROC;
824 uSap->prior = PRIOR0;
825 uSap->route = RTESPEC;
826 uSap->selector = ODU_SELECTOR_LC ;
829 rgMngmt.hdr.msgType = TCFG;
830 rgMngmt.hdr.entId.ent = ENTMAC;
831 rgMngmt.hdr.entId.inst = (Inst)0;
832 rgMngmt.hdr.elmId.elmnt = STRGUSAP;
833 rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
834 rgMngmt.hdr.response.mem.pool = MAC_POOL;
837 pst.selector = ODU_SELECTOR_LC;
838 pst.srcEnt = ENTDUAPP;
840 pst.dstInst = macCfgInst;
841 pst.dstProcId = DU_PROC;
842 pst.srcProcId = DU_PROC;
843 pst.region = duCb.init.region;
845 DU_LOG("\nDEBUG --> DU_APP : MAC Rgu USap Cfg Req sent");
847 /* Send the request to MAC */
848 cmPkLrgCfgReq(&pst, &rgMngmt);
853 /**************************************************************************
854 * @brief Function to handle Config Confirm from MAC
858 * Function : duHdlMacCfgComplete
861 * Handles Gen Config Confirm from MAC
863 * @param[in] Pst *pst, Post structure of the primitive.
864 * @param[in] RgMngmt *cfm, Unpacked primitive info received from MAC
865 * @return ROK - success
868 ***************************************************************************/
869 uint8_t duHdlMacCfgComplete(Pst *pst, RgMngmt *cfm)
873 if (cfm->cfm.status == LCM_PRIM_OK)
875 switch (cfm->hdr.elmId.elmnt)
879 macCfg |= MAC_GEN_CFG;
884 macCfg |= MAC_SAP_CFG;
891 DU_LOG("\nDEBUG --> DU_APP : MAC Cfg Cfm received for the element %d ",cfm->hdr.elmId.elmnt);
892 if(macCfg == MAC_CONFIGURED && numRlcMacSaps == MAX_MAC_SAP)
895 DU_LOG("\nDEBUG --> DU_APP : Completed sending Configs");
897 duBindUnbindRlcToMacSap(RLC_DL_INST, ABND);
903 DU_LOG("\nERROR --> DU_APP : Config confirm NOK from MAC");
909 /**************************************************************************
910 * @brief Function to bind/unbind RLC to MAC SAP
914 * Function : duBindUnbindRlcToMacSap
917 * Initiates Bind/Unbind from RLC to MAC
919 * @param[in] Inst Specifies if RLC UL or RLC DL instance
920 * @param[in] action Specifies if action is bind or unbind
921 * @return ROK - success
924 ***************************************************************************/
925 uint8_t duBindUnbindRlcToMacSap(uint8_t inst, uint8_t action)
927 RlcCntrl *cntrl = NULLP;
932 DU_SET_ZERO(&rlcMngmt, sizeof(RlcMngmt));
933 DU_SET_ZERO(&pst, sizeof(Pst));
937 DU_LOG("\nDEBUG --> DU_APP : Cntrl Req to RLC inst %d to bind MAC sap", inst);
941 DU_LOG("\nDEBUG --> DU_APP : Cntrl Req to RLC inst %d to unbind MAC sap", inst);
943 cntrl = &(rlcMngmt.t.cntrl);
945 cntrl->action = action;
946 cntrl->subAction = DU_ZERO_VAL;
947 cntrl->s.sapCntrl.suId = macCfgInst;
948 cntrl->s.sapCntrl.spId = inst;
951 rlcMngmt.hdr.msgType = TCNTRL;
952 rlcMngmt.hdr.entId.ent = ENTRLC;
953 rlcMngmt.hdr.entId.inst = inst;
954 rlcMngmt.hdr.elmId.elmnt = 186; /* ambiguous defines in lkw.h and lrg.h so direct hardcoded*/
955 rlcMngmt.hdr.response.mem.region = (inst == RLC_UL_INST) ?
956 RLC_UL_MEM_REGION:RLC_DL_MEM_REGION;
957 rlcMngmt.hdr.response.mem.pool = RLC_POOL;
960 pst.selector = ODU_SELECTOR_LC;
961 pst.srcEnt = ENTDUAPP;
963 pst.dstProcId = DU_PROC;
965 pst.srcProcId = DU_PROC;
966 pst.region = duCb.init.region;
968 cmPkLkwCntrlReq(&pst, &rlcMngmt);
972 /*******************************************************************
974 * @brief Handles SCTP notifications
978 * Function : duSctpNtfyHdl
981 * Handles SCTP notification
983 * @params[in] Message Buffer
986 * @return ROK - success
989 * ****************************************************************/
991 uint8_t duSctpNtfyHdl(Buffer *mBuf, CmInetSctpNotification *ntfy)
993 if(f1Params.assocId == ntfy->u.assocChange.assocId)
995 if(BuildAndSendF1SetupReq() != ROK)
1000 else if(ricParams.assocId == ntfy->u.assocChange.assocId)
1006 DU_LOG("\nERROR --> DU_APP : Invalid assocId %d received", ntfy->u.assocChange.assocId);
1012 /*******************************************************************
1014 * @brief Fills Pst struct for ENTEGTP
1018 * Function : duFillEgtpPst
1021 * Fills Pst struct for ENTEGTP
1024 * @return ROK - success
1027 * ****************************************************************/
1028 uint8_t duFillEgtpPst(Pst *pst, Event event)
1030 memset(pst, 0, sizeof(Pst));
1031 pst->srcEnt = (Ent)ENTDUAPP;
1032 pst->srcInst = (Inst)DU_INST;
1033 pst->srcProcId = DU_PROC;
1034 pst->dstEnt = (Ent)ENTEGTP;
1035 pst->dstInst = (Inst)EGTP_INST;
1036 pst->dstProcId = pst->srcProcId;
1038 pst->selector = ODU_SELECTOR_LC;
1045 /*******************************************************************
1047 * @brief Function to configure EGTP
1051 * Function : duBuildEgtpCfgReq
1054 * Function to configure EGTP
1057 * @return ROK - success
1060 * ****************************************************************/
1062 uint8_t duBuildEgtpCfgReq()
1067 DU_LOG("\nDEBUG --> DU_APP : Sending EGTP config request");
1069 memset(&egtpCfg, 0, sizeof(EgtpConfig));
1070 memcpy(&egtpCfg, &duCfgParam.egtpParams, sizeof(EgtpConfig));
1072 duFillEgtpPst(&pst, EVTCFGREQ);
1073 packEgtpCfgReq(&pst, egtpCfg);
1078 /*******************************************************************
1080 * @brief Function to configure EGTP
1084 * Function : duBuildEgtpCfgReq
1087 * Function to configure EGTP
1090 * @return ROK - success
1093 * ****************************************************************/
1094 uint8_t duHdlEgtpCfgComplete(CmStatus cfm)
1098 if(cfm.status == LCM_PRIM_OK)
1100 DU_LOG("\nDEBUG --> DU_APP : EGTP configuraton complete");
1101 duSendEgtpSrvOpenReq();
1105 DU_LOG("\nERROR --> DU_APP : EGTP configuraton failed");
1112 /*******************************************************************
1114 * @brief Sends server open request to EGTP
1118 * Function : duSendEgtpSrvOpenReq
1121 * Sends server open request to EGTP
1124 * @return ROK - success
1127 * ****************************************************************/
1129 uint8_t duSendEgtpSrvOpenReq()
1133 DU_LOG("\nDEBUG --> DU_APP : Sending EGTP server open request");
1135 duFillEgtpPst(&pst, EVTSRVOPENREQ);
1136 packEgtpSrvOpenReq(&pst);
1141 /*******************************************************************
1143 * @brief Handles server open confirmation
1147 * Function : duHdlEgtpSrvOpenComplete
1150 * Handles server open confirmation
1153 * @return ROK - success
1156 *****************************************************************/
1158 uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm)
1162 if(cfm.status == LCM_PRIM_OK)
1164 DU_LOG("\nDEBUG --> DU_APP : EGTP server opened successfully");
1168 DU_LOG("\nERROR --> DU_APP : EGTP server opening failed");
1175 /*******************************************************************
1177 * @brief Sends tunnel management request
1181 * Function : duSendEgtpTnlMgmtReq
1184 * Builds and sends tunnel management request to EGTP
1186 * @params[in] Action
1187 * Local tunnel endpoint id
1188 * Remote tunnel endpoint id
1189 * @return ROK - success
1192 * ****************************************************************/
1194 uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdTobeMod, GtpTnlCfg *ueCbTnlCfg)
1200 DU_LOG("\nDEBUG --> DU_APP : Sending EGTP tunnel management request for teId [%d]", ueCbTnlCfg->teId);
1202 /* ADD/MOD/DEL per tunnel */
1203 tnlEvt.action = action;
1204 tnlEvt.remTeid = ueCbTnlCfg->teId;
1205 if(action != EGTP_TNL_MGMT_ADD)
1207 tnlEvt.lclTeid = teIdTobeMod;
1211 tnlEvt.lclTeid = ueCbTnlCfg->teId;
1213 duFillEgtpPst(&pst, EVTTNLMGMTREQ);
1214 ret = egtpTnlMgmtReq(&pst, tnlEvt);
1218 /*******************************************************************
1220 * @brief Handles Tunnel management confirm
1224 * Function : duHdlEgtpTnlMgmtCfm
1227 * Handles tunnel management confirm received from Egtp
1229 * @params[in] Tunnel Event
1230 * @return ROK - success
1233 * ****************************************************************/
1234 uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm)
1238 if(tnlEvtCfm.cfmStatus.status == LCM_PRIM_OK)
1240 DU_LOG("\nDEBUG --> DU_APP: Tunnel management confirm OK");
1244 DU_LOG("\nERROR --> DU_APP: Tunnel management failed");
1251 /*******************************************************************
1253 * @brief Sends UL user data over to EGTP
1257 * Function : duSendEgtpDatInd
1259 * Functionality: Sends UL user data over to EGTP
1261 * @params[in] UL data buffer
1262 * @return ROK - success
1265 * ****************************************************************/
1266 uint8_t duSendEgtpDatInd(Buffer *mBuf)
1270 /* Fill EGTP header */
1271 egtpMsg.msgHdr.msgType = EGTPU_MSG_GPDU;
1272 egtpMsg.msgHdr.nPdu.pres = FALSE;
1273 egtpMsg.msgHdr.seqNum.pres = FALSE;
1274 egtpMsg.msgHdr.extHdr.udpPort.pres = FALSE;
1275 egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
1276 egtpMsg.msgHdr.teId = 1;
1279 egtpHdlDatInd(egtpMsg);
1285 /**************************************************************************
1286 * @brief Function to send configs to SCH
1290 * Function : duSendSchCfg
1293 * Sends general config to Scheduler via MAC layer
1296 * @return ROK - success
1299 ***************************************************************************/
1300 uint8_t duSendSchCfg()
1303 RgSchInstCfg *cfg = NULLP;
1306 DU_SET_ZERO(&pst, sizeof(Pst));
1307 DU_SET_ZERO(&rgMngmt, sizeof(RgMngmt));
1309 cfg = &(rgMngmt.t.cfg.s.schInstCfg);
1311 /* Filling of Instance Id */
1312 cfg->instId = DEFAULT_CELLS + 1;
1313 /* Filling of Gen config */
1314 cfg->genCfg.mem.region = MAC_MEM_REGION;
1315 cfg->genCfg.mem.pool = MAC_POOL;
1316 cfg->genCfg.tmrRes = 1;
1319 cfg->genCfg.forceCntrlSrbBoOnPCel = FALSE;
1320 cfg->genCfg.isSCellActDeactAlgoEnable = TRUE;
1322 cfg->genCfg.startCellId = 1;
1323 cfg->genCfg.lmPst.dstProcId = DU_PROC;
1324 cfg->genCfg.lmPst.srcProcId = DU_PROC;
1325 cfg->genCfg.lmPst.dstEnt = ENTDUAPP;
1326 cfg->genCfg.lmPst.dstInst = DU_INST;
1327 cfg->genCfg.lmPst.srcEnt = ENTMAC;
1328 cfg->genCfg.lmPst.srcInst = DEFAULT_CELLS + 1;
1329 cfg->genCfg.lmPst.prior = PRIOR0;
1330 cfg->genCfg.lmPst.route = RTESPEC;
1331 cfg->genCfg.lmPst.region = MAC_MEM_REGION;
1332 cfg->genCfg.lmPst.pool = MAC_POOL;
1333 cfg->genCfg.lmPst.selector = ODU_SELECTOR_LC;
1336 rgMngmt.hdr.msgType = TCFG;
1337 rgMngmt.hdr.entId.ent = ENTMAC;
1338 rgMngmt.hdr.entId.inst = DU_INST;
1339 rgMngmt.hdr.elmId.elmnt = STSCHINST;
1340 rgMngmt.hdr.response.mem.region = MAC_MEM_REGION;
1341 rgMngmt.hdr.response.mem.pool = MAC_POOL;
1344 pst.selector = ODU_SELECTOR_LC;
1345 pst.srcEnt = ENTDUAPP;
1346 pst.dstEnt = ENTMAC;
1347 pst.dstProcId = DU_PROC;
1348 pst.srcProcId = DU_PROC;
1349 pst.srcInst = DU_INST;
1351 pst.region = duCb.init.region;
1352 pst.event = (Event) EVTMACSCHGENCFGREQ;
1354 DU_LOG("\nDEBUG --> DU_APP : MAC Sch Cfg sent");
1356 /* Send the request to MAC */
1357 cmPkLrgSchCfgReq(&pst, &rgMngmt);
1363 /**************************************************************************
1364 * @brief Function to configure SCTP params and
1365 * responsible for F1 and E2 interfaces
1369 * Function : duLayerConfigComplete
1372 * Configures SCTP Params and responsible for handling
1373 * F1 and E2 interface.
1376 * @return ROK - success
1379 ***************************************************************************/
1380 uint8_t duLayerConfigComplete()
1384 DU_LOG("\nINFO --> DU_APP : Configuring all Layer is complete");
1386 if((ret = duSctpCfgReq(duCfgParam.sctpParams)) != ROK)
1388 DU_LOG("\nERROR --> DU_APP : Failed configuring Sctp Params");
1391 if((ret = duSctpAssocReq(F1_INTERFACE)) != ROK)
1393 DU_LOG("\nERROR --> DU_APP : Failed to send AssocReq F1");
1396 if((ret = duSctpAssocReq(E2_INTERFACE)) != ROK)
1398 DU_LOG("\nERROR --> DU_APP : Failed to send AssocReq E2");
1405 /**************************************************************************
1406 * @brief Function to handle SCH Config Confirm from MAC
1410 * Function : duHdlSchCfgComplete
1413 * Handles Scheduler Gen Config Confirm from MAC
1415 * @param[in] Pst *pst, Post structure of the primitive.
1416 * @param[in] RgMngmt *cfm, Unpacked primitive info received from MAC
1417 * @return ROK - success
1420 ***************************************************************************/
1421 uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm)
1423 if (cfm->cfm.status == LCM_PRIM_OK)
1425 switch (cfm->hdr.elmId.elmnt)
1429 DU_LOG("\nDEBUG --> DU_APP : Received SCH CFG CFM at DU APP");
1436 duLayerConfigComplete();
1437 duBuildEgtpCfgReq();
1441 /**************************************************************************
1442 * @brief Function to fill and send MacCellconfig
1446 * Function : duBuildAndSendMacCellCfg
1449 * Initiates MAC Configs towards MAC
1452 * @return ROK - success
1455 ***************************************************************************/
1456 uint8_t duBuildAndSendMacCellCfg(uint16_t cellId)
1459 MacCellCfg *duMacCellCfg = NULLP;
1461 DU_ALLOC_SHRABL_BUF(duMacCellCfg, sizeof(MacCellCfg));
1462 if(duMacCellCfg == NULLP)
1467 /* store the address in the duCellCb so that we can free on confirm msg */
1468 if(duCb.actvCellLst[cellId-1])
1469 duCb.actvCellLst[cellId-1]->duMacCellCfg = duMacCellCfg;
1472 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duMacCellCfg, sizeof(MacCellCfg));
1476 /* copy the mac config structure from duCfgParams */
1477 memcpy(duMacCellCfg,&duCfgParam.macCellCfg,sizeof(MacCellCfg));
1480 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_CONFIG_REQ);
1482 /* Send MAC cell config to MAC */
1483 return (*packMacCellCfgOpts[pst.selector])(&pst, duMacCellCfg);
1486 /**************************************************************************
1487 * @brief Function to Handle MAC cell config confirm
1491 * Function : duHandleMacCellCfgCfm
1494 * Initiates general Configs towards MAC
1497 * @return ROK - success
1500 ***************************************************************************/
1501 uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
1503 uint8_t actvCellIdx = 0;
1506 for(actvCellIdx = 0; actvCellIdx < MAX_NUM_CELL; actvCellIdx++)
1508 if((duCb.actvCellLst[actvCellIdx]) && (macCellCfgCfm->cellId == duCb.actvCellLst[actvCellIdx]->cellId))
1510 duCb.actvCellLst[actvCellIdx]->duMacCellCfg = NULLP;
1513 if(macCellCfgCfm->rsp == ROK)
1515 /* Build and send GNB-DU config update */
1516 ret = BuildAndSendDUConfigUpdate(SERV_CELL_TO_MODIFY);
1518 /* Build and Send Cell Start Req to MAC */
1519 ret = duBuildAndSendMacCellStart();
1523 /* TODO : Action to be taken if cell configuration fails.
1524 * Should CU be informed? */
1526 DU_LOG("\nERROR --> DU_APP : Mac cell cfg failed");
1532 /*******************************************************************
1534 * @brief Builds and sends cell start request to MAC
1538 * Function : duBuildAndSendMacCellStart
1541 * Builds and sends cell start request to MAC
1544 * @return ROK - success
1547 * ****************************************************************/
1548 uint8_t duBuildAndSendMacCellStart()
1551 CellStartInfo *cellStart = NULL;
1553 DU_LOG("\nINFO --> DU APP : Building and Sending cell start request to MAC");
1555 /* Send Cell Start Request to MAC */
1556 DU_ALLOC_SHRABL_BUF(cellStart, sizeof(CellStartInfo));
1559 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building cell start request");
1563 for(uint8_t id = 0; id < MAX_NUM_CELL; id++)
1565 if(duCb.actvCellLst[id])
1567 cellStart->cellId = duCb.actvCellLst[id]->cellId;
1570 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START);
1572 return (*packMacCellStartOpts[pst.selector])(&pst, cellStart);
1578 /*******************************************************************
1580 * @brief Builds and sends cell stop request to MAC
1584 * Function : duBuildAndSendMacCellStop
1587 * Builds and sends cell stop request to MAC
1590 * @return ROK - success
1593 * ****************************************************************/
1594 uint8_t duBuildAndSendMacCellStop(uint16_t cellId)
1598 CellStopInfo *cellStop = NULL;
1600 DU_LOG("\nINFO --> DU APP : Building and Sending cell stop request to MAC");
1602 GET_CELL_IDX(cellId, cellIdx);
1603 if(duCb.actvCellLst[cellIdx] != NULLP)
1605 /* Send Cell Stop Request to MAC */
1606 DU_ALLOC_SHRABL_BUF(cellStop, sizeof(CellStopInfo));
1609 DU_LOG("\nERROR --> DU APP : Memory alloc failed while building cell stop request");
1612 memset(cellStop, 0, sizeof(CellStopInfo));
1613 cellStop->cellId = duCb.actvCellLst[cellIdx]->cellId;
1616 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP);
1618 return (*packMacCellStopOpts[pst.selector])(&pst, cellStop);
1622 DU_LOG("\nERROR --> DU APP : duBuildAndSendMacCellStop(): cellId[%d] doesnot exists", cellId);
1628 /*******************************************************************
1630 * @brief Handles stop indication from MAC
1634 * Function : duHandleStopInd
1637 * Handles stop indication from MAC
1639 * @params[in] Post structure pointer
1640 * @return ROK - success
1643 * ****************************************************************/
1644 uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId)
1646 DuCellCb *cellCb = NULLP;
1648 if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL)
1650 DU_LOG("\nERROR --> DU APP : Invalid Cell Id %d in duHandleStopInd()", cellId->cellId);
1653 if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
1656 if((cellCb->cellStatus == ACTIVATED) || (cellCb->cellStatus == DELETION_IN_PROGRESS))
1658 DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is DOWN", cellId->cellId);
1659 if(sendCellDeleteReqToMac(cellId->cellId) == RFAILED)
1661 DU_LOG("\nERROR --> DU APP : duHandleStopInd(): Failed to send Cell delete req to MAC for\
1662 cellId[%d]", cellId->cellId);
1668 DU_LOG("\nINFO --> DU APP : Raise cell down alarm for cell id=%d", cellId->cellId);
1669 raiseCellAlrm(CELL_DOWN_ALARM_ID, cellId->cellId);
1670 setCellOpState(cellId->cellId, DISABLED, INACTIVE);
1674 if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
1675 DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellId, sizeof(OduCellId));
1677 cellCb->cellStatus = CELL_OUT_OF_SERVICE; //TODO: cell status must be set to OOS after all UE and cell cleanup which is not
1683 /*******************************************************************
1685 * @brief Handles slot indication from MAC
1689 * Function : duHandleUlCcchInd
1692 * Handles UL CCCH indication from MAC
1694 * @params[in] Post structure pointer
1695 * UL CCCH Ind pointer
1696 * @return ROK - success
1699 * ****************************************************************/
1700 uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
1703 DU_LOG("\nINFO --> DU APP : UL CCCH Indication received");
1705 return (duProcUlCcchInd(ulCcchIndInfo));
1708 /*******************************************************************
1710 * @brief Process UL RRC Message from RLC
1714 * Function : DuProcRlcUlRrcMsgTrans
1716 * Functionality: Process UL RRC Message from RLC
1718 * @params[in] Post structure
1719 * UL RRC Message Info
1720 * @return ROK - success
1723 * ****************************************************************/
1724 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
1727 DuCellCb *cellCb = NULLP;
1728 DuUeCb *ueCb = NULLP;
1730 duGetCellCb(ulRrcMsgInfo->cellId, &cellCb);
1733 if(ulRrcMsgInfo->ueId > 0)
1735 if(cellCb->ueCb[ulRrcMsgInfo->ueId -1].gnbDuUeF1apId == ulRrcMsgInfo->ueId)
1736 ueCb = &cellCb->ueCb[ulRrcMsgInfo->ueId -1];
1740 /* If UL message is received for a UE in handover, it signifies that UE is now
1741 * attached to GNB. Hence marking this UE as active and requesting MAC to
1742 * release the dedicated RACH resources */
1743 if(ueCb->ueState == UE_HANDIN_IN_PROGRESS)
1745 ueCb->ueState = UE_ACTIVE;
1746 cellCb->numActvUes++;
1748 /* Release RACH resources */
1749 memset(&ueCb->cfraResource, 0, sizeof(MacCfraResource));
1750 if(duBuildAndSendRachRsrcRelToMac(ulRrcMsgInfo->cellId, ueCb) != ROK)
1752 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Failed to send RACH resource release to MAC");
1756 if(BuildAndSendULRRCMessageTransfer(ueCb, ulRrcMsgInfo->lcId, ulRrcMsgInfo->msgLen, ulRrcMsgInfo->rrcMsg) != ROK)
1758 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Failed to build and send UL RRC Message Transfer");
1764 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : UE ID [%d] not found", ulRrcMsgInfo->ueId);
1770 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Invalid UE ID [%d]", ulRrcMsgInfo->ueId);
1776 DU_LOG("\nERROR --> DU_APP : DuProcRlcUlRrcMsgTrans() : Cell ID [%d] not found", ulRrcMsgInfo->cellId);
1780 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo->rrcMsg, ulRrcMsgInfo->msgLen);
1781 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulRrcMsgInfo, sizeof(RlcUlRrcMsgInfo));
1785 /*******************************************************************
1787 * @brief Process RRC delivery report from RLC
1791 * Function : DuProcRlcRrcDeliveryReport
1793 * Functionality: Process RRC delivery Message from RLC
1795 * @params[in] Post structure
1796 * UL RRC Message Info
1797 * @return ROK - success
1800 * ****************************************************************/
1801 uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport)
1803 DuCellCb *cellCb = NULLP;
1805 uint8_t ret = RFAILED;
1807 if(duGetCellCb(rrcDeliveryReport->cellId, &cellCb) != ROK)
1810 ueCb = cellCb->ueCb[rrcDeliveryReport->ueId -1];
1811 ret = BuildAndSendRrcDeliveryReport(ueCb.gnbCuUeF1apId, ueCb.gnbDuUeF1apId,rrcDeliveryReport);
1813 DU_FREE_SHRABL_BUF(pst->region, pst->pool, rrcDeliveryReport, sizeof(RrcDeliveryReport));
1817 /*******************************************************************
1819 * @brief Process UL user data from RLC
1823 * Function : DuProcRlcUlUserDataTrans
1825 * Functionality: Process UL user data from RLC
1827 * @params[in] Post structure
1829 * @return ROK - success
1832 * ****************************************************************/
1833 uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData)
1839 DU_LOG("\nDEBUG --> DU APP : Received UL user data");
1841 /* Fill EGTP header */
1842 egtpMsg.msgHdr.msgType = EGTPU_MSG_GPDU;
1843 egtpMsg.msgHdr.nPdu.pres = FALSE;
1844 egtpMsg.msgHdr.seqNum.pres = FALSE;
1845 egtpMsg.msgHdr.extHdr.udpPort.pres = FALSE;
1846 egtpMsg.msgHdr.extHdr.pdcpNmb.pres = FALSE;
1848 /* Fetch EGTP tunnel info */
1849 for(teIdx = 0; teIdx < duCb.numTeId; teIdx++)
1851 /*TODO: If multiple Cell Support is enables then CellId also needs to be validated alongwith ueId and DrbId*/
1852 if((duCb.upTnlCfg[teIdx] != NULLP) && (duCb.upTnlCfg[teIdx]->ueId == ulUserData->ueId) && \
1853 (duCb.upTnlCfg[teIdx]->drbId == ulUserData->rbId))
1855 if(duCb.upTnlCfg[teIdx]->tnlCfg1)
1857 egtpMsg.msgHdr.teId = duCb.upTnlCfg[teIdx]->tnlCfg1->teId; /*As we are supporting only 1 tunnel per DRB*/
1863 if (ODU_GET_MSG_BUF(DU_APP_MEM_REGION, DU_POOL, &mBuf) != ROK)
1865 DU_LOG("\nERROR --> DU APP : Failed to allocated buffer memory in DuProcRlcUlUserDataTrans");
1866 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData->userData, ulUserData->msgLen);
1867 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData, sizeof(RlcUlUserDatInfo));
1870 oduCpyFixBufToMsg(ulUserData->userData, mBuf, ulUserData->msgLen);
1871 ODU_PRINT_MSG(mBuf, 0, 0);
1873 egtpHdlDatInd(egtpMsg);
1875 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData->userData, ulUserData->msgLen);
1876 DU_FREE_SHRABL_BUF(pst->region, pst->pool, ulUserData, sizeof(RlcUlUserDatInfo));
1880 /*******************************************************************
1882 * @brief process the slice cfg rsp received from MAC
1886 * Function : DuProcMacSliceCfgRsp
1888 * Functionality: process the slice cfg rsp received from MAC
1890 * @params[in] Post structure, MacSliceCfgRsp *cfgRsp
1892 * @return ROK - success
1895 **********************************************************************/
1896 uint8_t DuProcMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp)
1900 if(cfgRsp->rsp == MAC_DU_APP_RSP_OK)
1902 duCb.sliceState = SLICE_CONFIGURED;
1903 DU_LOG("\nINFO --> DU_APP : Slice configured successfully ");
1907 DU_LOG("\nERROR --> DU_APP : Slice not available");
1909 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(MacSliceCfgRsp));
1914 /*******************************************************************
1916 * @brief Fill the slice configration and rrm policy related
1917 * information received form O1
1921 * Function : BuildAndSendSliceConfigReq
1923 * Functionality: Fill the slice configration and rrm policy related
1925 * @params[in] RrmPolicy *rrmPolicy[], uint8_t totalRrmPolicy, uint8_t
1928 * @return ROK - success
1931 * ****************************************************************/
1932 uint8_t BuildAndSendSliceConfigReq()
1935 MacSliceCfgReq *sliceCfgReq;
1937 DU_ALLOC_SHRABL_BUF(sliceCfgReq, sizeof(MacSliceCfgReq));
1938 if(sliceCfgReq == NULLP)
1940 DU_LOG("\nERROR --> DU_APP : Memory allocation failed in BuildAndSendSliceConfigReq");
1945 memcpy(sliceCfgReq, &duCfgParam.tempSliceCfg, sizeof(MacSliceCfgReq));
1946 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_SLICE_CFG_REQ);
1948 DU_LOG("\nDEBUG --> DU_APP : Sending Slice Cfg Request to MAC ");
1949 if((*packMacSliceCfgReqOpts[pst.selector])(&pst, sliceCfgReq) == RFAILED)
1951 DU_LOG("\nERROR --> DU_APP : Failed to send Slice Cfg Req to MAC");
1952 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, sliceCfgReq, sizeof(MacSliceCfgReq));
1958 /*******************************************************************
1960 * @brief Fill the slice configration and rrm policy related
1961 * information received form O1
1965 * Function : BuildAndSendSliceRecfgReq
1967 * Functionality: Fill the slice configration and rrm policy related
1969 * @params[in] RrmPolicy rrmPolicy[], uint8_t totalSliceCount
1971 * @return ROK - success
1974 * ****************************************************************/
1975 uint8_t BuildAndSendSliceRecfgReq()
1978 MacSliceRecfgReq *sliceRecfgReq = NULLP;
1980 DU_LOG("\nINFO --> DU_APP : Slice ReConfiguration Request received");
1982 DU_ALLOC_SHRABL_BUF(sliceRecfgReq, sizeof(MacSliceRecfgReq));
1983 if(sliceRecfgReq == NULLP)
1985 DU_LOG("\nERROR --> DU_APP : Memory allocation failed to BuildAndSendSliceRecfgReq");
1990 memcpy(sliceRecfgReq, &duCfgParam.tempSliceCfg, sizeof(MacSliceRecfgReq));
1992 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_SLICE_RECFG_REQ);
1994 DU_LOG("\nDEBUG --> DU_APP: Sending Slice ReCfg Request to MAC ");
1995 if( (*packMacSliceRecfgReqOpts[pst.selector])(&pst, sliceRecfgReq) == RFAILED)
1997 DU_LOG("\nERROR --> DU_APP: Failed to send Slice ReCfg Req to MAC");
1998 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, sliceRecfgReq, sizeof(MacSliceRecfgReq));
2003 /*******************************************************************
2005 * @brief process the slice ReCfg rsp received from MAC
2009 * Function : DuProcMacSliceRecfgRsp
2011 * Functionality: process the slice ReCfg rsp received from MAC
2013 * @params[in] Post structure, MacSliceRecfgRsp *ReCfgRsp
2015 * @return ROK - success
2018 **********************************************************************/
2019 uint8_t DuProcMacSliceRecfgRsp(Pst *pst, MacSliceRecfgRsp *recfgRsp)
2023 if(recfgRsp->rsp == MAC_DU_APP_RSP_OK)
2025 duCb.sliceState = SLICE_RECONFIGURED;
2026 DU_LOG("\nINFO --> DU_APP : Slice Reconfigured successfully ");
2030 DU_LOG("\nERROR --> DU_APP : Slice not available");
2032 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, recfgRsp, sizeof(MacSliceCfgRsp));
2037 /*******************************************************************
2039 * @brief Handles received Slice Metrics from RLC and forward it to O1
2043 * Function : DuProcRlcSliceMetrics
2046 * Handles received Slice Metrics from RLC and forward it to O1
2048 * @params[in] Post structure pointer
2049 * SlicePmList *sliceStats
2051 * @return ROK - success
2054 * ****************************************************************/
2055 uint8_t DuProcRlcSliceMetrics(Pst *pst, SlicePmList *sliceStats)
2057 uint8_t sliceRecord = 0;
2059 DU_LOG("\nDEBUG --> DU APP : Received Slice Metrics");
2060 if(sliceStats == NULLP)
2062 DU_LOG("\nERROR --> DU APP : Empty Metrics");
2066 for(sliceRecord = 0; sliceRecord < sliceStats->numSlice; sliceRecord++)
2068 DU_LOG("\nINFO --> DU_APP: SliceId[SST-SD]:%d-%d, DlTput %.5lf, UlTput:%.5lf", sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier.sst,\
2069 sliceStats->sliceRecord[sliceRecord].networkSliceIdentifier.sd,sliceStats->sliceRecord[sliceRecord].ThpDl,\
2070 sliceStats->sliceRecord[sliceRecord].ThpUl);
2075 sendSliceMetric((SliceMetricList*) sliceStats);
2079 DU_FREE_SHRABL_BUF(pst->region, pst->pool,sliceStats->sliceRecord, (sliceStats->numSlice) * (sizeof(SlicePm)));
2080 DU_FREE_SHRABL_BUF(pst->region, pst->pool,sliceStats, sizeof(SlicePmList));
2086 /*******************************************************************
2088 * @brief Send Statistics request to MAC
2092 * Function : BuildAndSendStatsReqToMac()
2094 * Functionality: Send Statistics Request To Mac
2098 * @return ROK - success
2101 * ****************************************************************/
2102 uint8_t BuildAndSendStatsReqToMac(RicSubscription *ricSubscriptionInfo)
2105 MacStatsReq *macStatsReq = NULLP;
2107 /* Fill MAC statistics request */
2108 DU_ALLOC_SHRABL_BUF(macStatsReq, sizeof(MacStatsReq));
2109 if(macStatsReq == NULLP)
2111 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsReq in BuildAndSendStatsReqToMac");
2115 /* Fill E2 Subscription Info in MAC Statistics Request and send to MAC */
2116 if(fillRicSubsInMacStatsReq(macStatsReq, ricSubscriptionInfo) == ROK)
2118 DU_LOG("\nDEBUG --> DU_APP: Sending Statistics Request to MAC ");
2119 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATISTICS_REQ);
2121 if( (*packMacStatsReqOpts[pst.selector])(&pst, macStatsReq) == ROK)
2124 DU_LOG("\nERROR --> DU_APP: Failed to send Statistics Request to MAC");
2127 DU_LOG("\nERROR --> DU_APP: No Statistics group found valid. Hence statistics request is not sent to MAC");
2128 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsReq, sizeof(MacStatsReq));
2132 /*******************************************************************
2134 * @brief Send Statistics request to DU layers
2138 * Function : BuildAndSendStatsReq()
2140 * Functionality: Check if there is an update in statistics
2141 * reporting configuration. If so, send the update to
2144 * @params[in] Subscription Info
2146 * @return ROK - success
2149 * ****************************************************************/
2150 uint8_t BuildAndSendStatsReq(RicSubscription *ricSubscriptionInfo)
2152 /* Build and sent subscription information to MAC in Statistics Request */
2153 if(BuildAndSendStatsReqToMac(ricSubscriptionInfo) != ROK)
2155 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsReqToMac()");
2159 /* TODO : When KPI collection from RLC will be supported, this function will be
2160 * called to configure KPIs to be colled */
2162 if(BuildAndSendStatsReqToRlc() != ROK)
2164 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsReqToRlc()");
2172 /*******************************************************************
2174 * @brief Process statistics response from MAC
2178 * Function : DuProcMacStatsRsp
2180 * Functionality: Processes statistics configuration response
2181 * from MAC. If configuration is succsessful, DUAPP starts
2182 * reporting period timer for this subscription request
2187 * @return ROK - success
2190 * ****************************************************************/
2191 uint8_t DuProcMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
2193 uint8_t ret = RFAILED;
2194 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsRsp: Received Statistics Response from MAC");
2200 DU_LOG("\n Subscription Id [%ld]", statsRsp->subscriptionId);
2202 DU_LOG("\n Number of Accepted Groups [%d]", statsRsp->numGrpAccepted);
2203 for(idx=0; idx<statsRsp->numGrpAccepted; idx++)
2205 DU_LOG("\n Group Id [%d]", statsRsp->statsGrpAcceptedList[idx]);
2208 DU_LOG("\n Number of Rejected Groups [%d]", statsRsp->numGrpRejected);
2209 for(idx=0; idx<statsRsp->numGrpRejected; idx++)
2211 DU_LOG("\n Group Id [%d]", statsRsp->statsGrpRejectedList[idx].groupId);
2215 /* Check the list of accepted and rejected statistics group and send
2216 * Ric subscription response/failure accordingly */
2217 if((ret = e2ProcStatsRsp(statsRsp)) != ROK)
2219 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsRsp: Failed in %s at line %d", __func__, __LINE__);
2222 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsRsp, sizeof(MacStatsRsp));
2226 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsRsp: Received NULL Pointer");
2231 /*******************************************************************
2233 * @brief Process statistics indication from MAC
2237 * Function : DuProcMacStatsInd
2239 * Functionality: Processes statistics indication from MAC.
2243 * @return ROK - success
2246 * ****************************************************************/
2247 uint8_t DuProcMacStatsInd(Pst *pst, MacStatsInd *statsInd)
2249 uint8_t ret = RFAILED;
2254 DU_LOG("\nDEBUG --> DU_APP : DuProcMacStatsInd: Received Statistics Indication");
2255 DU_LOG("\n Subscription Id [%ld]", statsInd->subscriptionId);
2256 DU_LOG("\n Group Id [%d]", statsInd->groupId);
2257 for(int idx = 0; idx < statsInd->numStats; idx++)
2259 DU_LOG("\n Meas type [%d] Meas Value [%lf]", statsInd->measuredStatsList[idx].type,\
2260 statsInd->measuredStatsList[idx].value);
2264 /* Extract statistics from statistics indication message and store in E2 DB */
2265 if((ret = e2ProcStatsInd(statsInd)) != ROK)
2267 DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__);
2270 /* Free statistics indication */
2271 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsInd, sizeof(MacStatsInd));
2275 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsInd: Received NULL Pointer");
2280 /*******************************************************************
2282 * @brief Process statistics delete response from MAC
2286 * Function : DuProcMacStatsDeleteRsp
2288 * Functionality: Processes statistics delete response
2293 * Mac stats delete rsp
2295 * @return ROK - success
2298 * ****************************************************************/
2300 uint8_t DuProcMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsDeleteRsp)
2302 uint8_t ret = RFAILED;
2303 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsDeleteRsp: Received Statistics Response from MAC");
2307 /* numStatsGroup == 0, received a response for complete ric
2308 * subscription deletion else, received a response
2309 * for RIC_SUBS_MOD_REQ's actionToBeDeleted*/
2310 if(statsDeleteRsp->numStatsGroupDeleted ==0)
2312 if((ret = e2ProcStatsDeleteRsp(statsDeleteRsp)) != ROK)
2314 DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__);
2319 if((ret = e2ProcActionDeleteRsp(statsDeleteRsp)) != ROK)
2321 DU_LOG("\nINFO --> DU_APP : Failed in %s at line %d", __func__, __LINE__);
2324 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsDeleteRsp, sizeof(MacStatsDeleteRsp));
2328 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsDeleteRsp: Received NULL Pointer");
2333 /*******************************************************************
2335 * @brief Send Statistics delete req to MAC
2339 * Function : BuildAndSendStatsDeleteReqToMac()
2341 * Functionality: Send Statistics delete req To Mac
2346 * @return ROK - success
2349 * ****************************************************************/
2350 uint8_t BuildAndSendStatsDeleteReqToMac(RicSubscription *ricSubscriptionInfo, bool deleteAllStats)
2353 uint8_t actionIdx=0;
2354 CmLList *actionNode=NULLP;
2355 ActionInfo *actionDb = NULLP;
2356 E2FailureCause failureCause;
2357 MacStatsDeleteReq *macStatsDelete = NULLP;
2359 /* Fill MAC statistics delete */
2360 DU_ALLOC_SHRABL_BUF(macStatsDelete, sizeof(MacStatsDeleteReq));
2361 if(macStatsDelete == NULLP)
2363 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsDelete in BuildAndSendStatsDeleteReqToMac");
2364 failureCause.causeType = E2_MISCELLANEOUS;
2365 failureCause.cause = E2_MISCELLANEOUS_CAUSE_UNSPECIFIED;
2367 if(BuildAndSendRicSubscriptionDeleteFailure(ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId, failureCause) != ROK)
2369 DU_LOG("\nERROR --> E2AP : e2ProcStatsDeleteRsp: failed to build and send ric subs delete failure");
2375 memset(macStatsDelete, 0, sizeof(MacStatsDeleteReq));
2376 /* Generate subscription ID using RIC Request ID and RAN Function ID */
2377 encodeSubscriptionId(&macStatsDelete->subscriptionId, ricSubscriptionInfo->ranFuncId, ricSubscriptionInfo->requestId);
2379 /* If deleteAllStats is true, then we don't need to fill in the
2380 * statsGrpIdToBeDelList with action details; otherwise, we must fill in the
2381 * statsGrpIdToBeDelList with action-related data that is set to CONFIG_DEL.*/
2385 CM_LLIST_FIRST_NODE(&ricSubscriptionInfo->actionSequence, actionNode);
2388 actionDb = (ActionInfo*)(actionNode->node);
2389 if(actionDb->action == CONFIG_DEL)
2391 macStatsDelete->statsGrpIdToBeDelList[actionIdx] = actionDb->actionId;
2394 actionNode= actionNode->next;
2396 macStatsDelete->numStatsGroupToBeDeleted=actionIdx;
2399 DU_LOG("\nDEBUG --> DU_APP: Sending Statistics delete req to MAC ");
2400 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATS_DELETE_REQ);
2402 if( (*packMacStatsDeleteReqOpts[pst.selector])(&pst, macStatsDelete) != ROK)
2404 DU_LOG("\nERROR --> DU_APP: Failed to send Statistics delete req to MAC");
2405 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsDelete, sizeof(MacStatsDeleteReq));
2413 /*******************************************************************
2415 * @brief Statistics delete to DU layers
2419 * Function : BuildAndSendStatsDeleteReq()
2421 * Functionality: Statistics delete to DU layers
2427 * @return ROK - success
2430 * ****************************************************************/
2431 uint8_t BuildAndSendStatsDeleteReq(RicSubscription *ricSubscriptionInfo, bool deleteAllStats)
2433 /* Build and sent subscription information to MAC in Statistics delete */
2434 if(BuildAndSendStatsDeleteReqToMac(ricSubscriptionInfo, deleteAllStats) != ROK)
2436 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsDeleteReqToMac()");
2442 /*******************************************************************
2444 * @brief Send Statistics Modification request to MAC
2448 * Function : BuildAndSendStatsModificationReqToMac()
2450 * Functionality: Send Statistics Modification Request To Mac
2452 * @params[in] Ric subscription info
2454 * @return ROK - success
2457 * ****************************************************************/
2458 uint8_t BuildAndSendStatsModificationReqToMac(RicSubscription *ricSubscriptionInfo)
2461 MacStatsModificationReq *macStatsModificationReq = NULLP;
2463 /* Fill MAC statistics modification request */
2464 DU_ALLOC_SHRABL_BUF(macStatsModificationReq, sizeof(MacStatsModificationReq));
2465 if(macStatsModificationReq == NULLP)
2467 DU_LOG("\nERROR --> DU_APP : Memory allocation failed for macStatsModificationReq in BuildAndSendStatsModificationReqToMac");
2471 /* Fill E2 Subscription Info in MAC Statistics Modification Request and send to MAC */
2472 if(fillRicSubsInMacStatsModificationReq(macStatsModificationReq, ricSubscriptionInfo) == ROK)
2474 DU_LOG("\nDEBUG --> DU_APP: Sending Statistics Modification Request to MAC ");
2475 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_STATISTICS_MODIFY_REQ);
2477 if( (*packMacStatsModificationReqOpts[pst.selector])(&pst, macStatsModificationReq) == ROK)
2480 DU_LOG("\nERROR --> DU_APP: Failed to send Statistics Modification Request to MAC");
2483 DU_LOG("\nERROR --> DU_APP: No Statistics group found valid. Hence statistics Modification request is not sent to MAC");
2484 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macStatsModificationReq, sizeof(MacStatsModificationReq));
2488 /*******************************************************************
2490 * @brief Send Statistics Modification request to DU layers
2494 * Function : BuildAndSendStatsModificationReq()
2496 * Functionality: Check if there is an update in statistics
2497 * reporting configuration. If so, send the update Modification to
2500 * @params[in] Subscription Info
2502 * @return ROK - success
2505 * ****************************************************************/
2506 uint8_t BuildAndSendStatsModificationReq(RicSubscription *ricSubscriptionInfo)
2508 /* Build and sent subscription information to MAC in Statistics Modification Request */
2509 if(BuildAndSendStatsModificationReqToMac(ricSubscriptionInfo) != ROK)
2511 DU_LOG("\nERROR --> DU_APP : Failed at BuildAndSendStatsModificationReqToMac()");
2518 /*******************************************************************
2520 * @brief Process statistics modification response from MAC
2524 * Function : DuProcMacStatsModificationRsp
2526 * Functionality: Processes statistics modification configuration
2527 * response from MAC. If configuration is succsessful, DUAPP starts
2528 * reporting period timer for this subscription request
2533 * MAC stats modification rsp
2535 * @return ROK - success
2538 * ****************************************************************/
2539 uint8_t DuProcMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp)
2541 uint8_t ret = RFAILED;
2542 DU_LOG("\nINFO --> DU_APP : DuProcMacStatsModificationRsp: Received Statistics Modification Response from MAC");
2544 if(statsModificationRsp)
2548 DU_LOG("\n Subscription Id [%ld]", statsModificationRsp->subscriptionId);
2550 DU_LOG("\n Number of Accepted Groups [%d]", statsModificationRsp->numGrpAccepted);
2551 for(idx=0; idx<statsModificationRsp->numGrpAccepted; idx++)
2553 DU_LOG("\n Group Id [%d]", statsModificationRsp->statsGrpAcceptedList[idx]);
2556 DU_LOG("\n Number of Rejected Groups [%d]", statsModificationRsp->numGrpRejected);
2557 for(idx=0; idx<statsModificationRsp->numGrpRejected; idx++)
2559 DU_LOG("\n Group Id [%d]", statsModificationRsp->statsGrpRejectedList[idx].groupId);
2562 if((ret = e2ProcStatsModificationRsp(statsModificationRsp)) != ROK)
2564 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsModificationRsp: Failed in %s at line %d", __func__, __LINE__);
2566 DU_FREE_SHRABL_BUF(pst->region, pst->pool, statsModificationRsp, sizeof(MacStatsModificationRsp));
2570 DU_LOG("\nERROR --> DU_APP : DuProcMacStatsModificationRsp: Received NULL Pointer");
2575 /**********************************************************************
2577 **********************************************************************/