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 is the entry point for DU APP */
20 #include "common_def.h"
25 #include "du_app_mac_inf.h"
26 #include "du_app_rlc_inf.h"
29 #include "du_mgr_main.h"
35 #include "O1Interface.h"
36 #include "ConfigInterface.h"
40 uint8_t rlcUlActvTsk (Pst *, Buffer *);
41 uint8_t rlcUlActvInit (Ent, Inst, Region, Reason);
42 uint8_t rlcDlActvTsk (Pst *, Buffer *);
43 uint8_t rlcDlActvInit (Ent, Inst, Region, Reason);
44 uint8_t rgActvTsk (Pst *, Buffer *);
45 uint8_t rgActvInit (Ent, Inst, Region, Reason);
46 uint8_t lwrMacActvTsk(Pst *, Buffer *);
47 uint8_t lwrMacActvInit(Ent, Inst, Region, Reason);
49 uint8_t phyStubActvTsk(Pst *, Buffer *);
50 uint8_t phyStubActvInit(Ent, Inst, Region, Reason);
54 DuCfgParams duCfgParam;
56 /*******************************************************************
58 * @brief Initializes DU APP
62 * Function : duAppInit
65 * - Registers and attaches TAPA tasks belonging to
68 * @params[in] system task ID
69 * @return ROK - success
72 * ****************************************************************/
73 uint8_t duAppInit(SSTskId sysTskId)
75 /* Register DU APP TAPA Task for DU */
76 if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
77 duActvInit, (ActvTsk)duActvTsk) != ROK)
81 /* Attach DU APP TAPA Task for DU */
82 if (ODU_ATTACH_TTSK((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
87 DU_LOG("\nINFO --> DU_APP : DU APP created and registered \
88 to %d sys task", sysTskId);
94 /*******************************************************************
96 * @brief update Rrm Policy at DU and process the slice cfg request
100 * Function : updateRrmPolicy
103 * - update Rrm Policy at DU and process the slice cfg request
105 * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
106 * @return true - success
109 * ****************************************************************/
110 uint8_t updateRrmPolicy(RrmPolicy rrmPolicy[], uint8_t policyNum, \
113 DuCellCb *cellCb = NULLP;
115 cpyRrmPolicyInDuCfgParams(rrmPolicy, policyNum, memberList, &duCfgParam.tempSliceCfg);
116 cellCb = duCb.actvCellLst[0];
120 if(cellCb->cellStatus == ACTIVATED)
122 if(duCb.sliceState == SLICE_INFO_NOT_AVAILABLE)
124 BuildAndSendSliceConfigReq(duCfgParam.tempSliceCfg.rrmPolicy, duCfgParam.tempSliceCfg.totalRrmPolicy,\
125 duCfgParam.tempSliceCfg.totalSliceCount);
129 BuildAndSendSliceReCfgReq(duCfgParam.tempSliceCfg.rrmPolicy, duCfgParam.tempSliceCfg.totalRrmPolicy,\
130 duCfgParam.tempSliceCfg.totalSliceCount);
136 /*******************************************************************
138 * @brief Bring the cell Up
142 * Function : bringCellUp
145 * - Bring the cell Up when requested from OAM
147 * @params[in] Cell Id
148 * @return true - success
151 * ****************************************************************/
153 bool bringCellUp(uint16_t cellId)
156 BuildAndSendF1SetupReq();
160 /*******************************************************************
162 * @brief Bring the cell Down
166 * Function : bringCellDown
169 * - Bring the cell Down when requested from OAM
171 * @params[in] Cell Id
172 * @return true - success
175 * ****************************************************************/
177 bool bringCellDown(uint16_t cellId)
179 BuildAndSendDUConfigUpdate(SERV_CELL_TO_DELETE);
184 /*******************************************************************
186 * @brief Initializes EGTP
190 * Function : egtpInit
193 * - Registers and attaches TAPA tasks belonging to
196 * @params[in] system task ID
197 * @return ROK - success
200 * ****************************************************************/
201 uint8_t egtpInit(SSTskId sysTskId)
203 /* Register DU APP TAPA Task for DU */
204 if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
205 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
209 /* Attach DU APP TAPA Task for DU */
210 if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
215 DU_LOG("\nINFO --> DU_APP : EGTP created and registered \
216 to %d sys task", sysTskId);
221 /*******************************************************************
223 * @brief Initializes SCTP task
227 * Function : sctpInit
230 * - Registers and attaches TAPA tasks for SCTP receiver
232 * @params[in] system task ID
233 * @return ROK - success
236 * ****************************************************************/
237 uint8_t sctpInit(SSTskId sysTskId)
239 /* Register SCTP TAPA Task */
240 if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
241 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
245 /* Attach SCTP TAPA Task */
246 if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
251 DU_LOG("\nINFO --> DU_APP : SCTP TAPA task created and registered to %d sys task",
255 /*******************************************************************
257 * @brief Initializes RLC DL, MAC TAPA task
261 * Function : rlcDlInit
264 * - Registers and attaches TAPA tasks for MAC and RLC DL
266 * @params[in] system task ID
267 * @return ROK - success
270 * ****************************************************************/
271 uint8_t rlcDlInit(SSTskId sysTskId)
273 /* Register RLC DL TAPA Task */
274 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
275 rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK)
279 /* Attach RLC DL Task */
280 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)1, sysTskId)!= ROK)
285 /* Register MAC TAPA Task */
286 if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
287 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
291 /* Attach MAC Task */
292 if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)0, sysTskId)!= ROK)
297 DU_LOG("\nINFO --> DU_APP : RLC DL and MAC TAPA task created and registered to \
298 %d sys task", sysTskId);
302 /*******************************************************************
304 * @brief Initializes RLC UL TAPA task
308 * Function : rlcUlInit
311 * - Registers and attaches TAPA task for RLC UL
313 * @params[in] system task ID
314 * @return ROK - success
317 * ****************************************************************/
318 uint8_t rlcUlInit(SSTskId sysTskId)
320 /* Register RLC UL TAPA Task */
321 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
322 rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
326 /* Attach RLC DL Task */
327 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK)
331 DU_LOG("\nINFO --> DU_APP : RLC UL TAPA task created and registered to \
332 %d sys task", sysTskId);
336 /*******************************************************************
338 * @brief Initializes Lower MAC receiver task
342 * Function : lwrMacInit
345 * - Registers and attaches TAPA tasks for Lower MAC receiver
347 * @params[in] system task ID
348 * @return ROK - success
351 * ****************************************************************/
352 uint8_t lwrMacInit(SSTskId sysTskId)
354 /* Register SCTP TAPA Task */
355 if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
356 lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK)
360 /* Attach SCTP TAPA Task */
361 if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK)
366 DU_LOG("\nINFO --> DU_APP : LWR MAC TAPA task created and registered to %d sys task",
371 #ifndef INTEL_WLS_MEM
372 /*******************************************************************
374 * @brief Initializes Phy stub slot indication generator task
378 * Function : phyStubInit
381 * - Registers and attaches TAPA tasks for Phy stub's slot
382 * indication generator
384 * @params[in] system task ID
385 * @return ROK - success
388 * ****************************************************************/
389 uint8_t phyStubInit(SSTskId sysTskId)
391 /* Register PHY stub slot indication TAPA Task */
392 if(ODU_REG_TTSK((Ent)ENTPHYSTUB, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
393 phyStubActvInit, (ActvTsk)phyStubActvTsk) != ROK)
397 /* Attach Phy stub slot indication TAPA Task */
398 if (ODU_ATTACH_TTSK((Ent)ENTPHYSTUB, (Inst)0, sysTskId)!= ROK)
403 DU_LOG("\nINFO --> DU_APP : PHY stub slot indication TAPA task created and registered to %d sys task",
409 /*******************************************************************
411 * @brief Initializes system and TAPA tasks
415 * Function : commonInit
418 * - Registers and attaches system and TAPA tasks
421 * @return ROK - success
424 * ****************************************************************/
427 /* Declare system task Ids */
428 SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk, phy_stub_slot_ind_stsk;
432 ODU_SET_PROC_ID(DU_PROC);
434 /* Intel L1 using core 0-15. ODU-High using 16-21 */
435 /* system task for DU APP */
436 if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
438 DU_LOG("\nERROR --> DU_APP : System Task creation for DU APP failed");
441 ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
443 /* system task for EGTP */
444 if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
446 DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed");
449 ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 17, 0);
451 /* system task for RLC_DL and MAC */
452 if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
454 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC DL/MAC failed");
457 pthread_attr_init(&attr);
458 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
459 ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
461 /* system task for RLC UL */
462 if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
464 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed");
467 ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 19, 0);
469 /* system task for SCTP receiver thread */
470 if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
472 DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed");
475 ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 20, 0);
477 /* system task for lower-mac receiver thread */
478 if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
480 DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed");
483 ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
485 #ifndef INTEL_WLS_MEM
486 /* system task for phy stub's slot indication generator thread */
487 if(ODU_CREATE_TASK(PRIOR0, &phy_stub_slot_ind_stsk) != ROK)
489 DU_LOG("\nERROR --> DU_APP : System Task creation for Phy stub slot indication generator failed. MAX STSK [%d]", SS_MAX_STSKS);
495 /* Create TAPA tasks */
496 if(duAppInit(du_app_stsk) != ROK)
498 DU_LOG("\nERROR --> DU_APP : DU APP TAPA Task initialization failed");
502 if(egtpInit(egtp_stsk) != ROK)
504 DU_LOG("\nERROR --> DU_APP : EGTP TAPA Task initialization failed");
508 if(sctpInit(sctp_stsk) != ROK)
510 DU_LOG("\nERROR --> DU_APP : SCTP TAPA Task initialization failed");
514 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
516 DU_LOG("\nERROR --> DU_APP : RLC DL Tapa Task initialization failed");
520 if(rlcUlInit(rlc_ul_stsk) != ROK)
522 DU_LOG("\nERROR --> DU_APP : RLC UL Tapa Task initialization failed");
526 if(lwrMacInit(lwr_mac_stsk) != ROK)
528 DU_LOG("\nERROR --> DU_APP : Lower MAC Tapa Task initialization failed");
532 #ifndef INTEL_WLS_MEM
533 if(phyStubInit(phy_stub_slot_ind_stsk) != ROK)
535 DU_LOG("\nERROR --> DU_APP : PHY stub slot indication Tapa Task initialization failed");
543 /*******************************************************************
545 * @brief Initializes the DU
553 * - Registers DU Layers
556 * @return ROK - success
559 * ****************************************************************/
563 if(commonInit() != ROK)
572 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
575 /*******************************************************************
577 * @brief Entry point for the DU APP
584 * - Read config params into duCfgParams
585 * - Initiate the init functions
588 * @return ROK - success
591 * ****************************************************************/
597 if(start_O1_module() != ROK)
600 //Initialize TAPA layers
606 //Read all the configs from du_utils.c into duCfgParams
610 //Send VES PNF registration message to SMO
611 sendPnfRegistration();
618 /**********************************************************************
620 **********************************************************************/