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);
93 /*******************************************************************
95 * @brief Bring the cell Up
99 * Function : bringCellUp
102 * - Bring the cell Up when requested from OAM
104 * @params[in] Cell Id
105 * @return true - success
108 * ****************************************************************/
110 bool bringCellUp(uint16_t cellId)
113 BuildAndSendF1SetupReq();
117 /*******************************************************************
119 * @brief Bring the cell Down
123 * Function : bringCellDown
126 * - Bring the cell Down when requested from OAM
128 * @params[in] Cell Id
129 * @return true - success
132 * ****************************************************************/
134 bool bringCellDown(uint16_t cellId)
136 BuildAndSendDUConfigUpdate(SERV_CELL_TO_DELETE);
141 /*******************************************************************
143 * @brief Initializes EGTP
147 * Function : egtpInit
150 * - Registers and attaches TAPA tasks belonging to
153 * @params[in] system task ID
154 * @return ROK - success
157 * ****************************************************************/
158 uint8_t egtpInit(SSTskId sysTskId)
160 /* Register DU APP TAPA Task for DU */
161 if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
162 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
166 /* Attach DU APP TAPA Task for DU */
167 if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
172 DU_LOG("\nINFO --> DU_APP : EGTP created and registered \
173 to %d sys task", sysTskId);
178 /*******************************************************************
180 * @brief Initializes SCTP task
184 * Function : sctpInit
187 * - Registers and attaches TAPA tasks for SCTP receiver
189 * @params[in] system task ID
190 * @return ROK - success
193 * ****************************************************************/
194 uint8_t sctpInit(SSTskId sysTskId)
196 /* Register SCTP TAPA Task */
197 if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
198 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
202 /* Attach SCTP TAPA Task */
203 if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
208 DU_LOG("\nINFO --> DU_APP : SCTP TAPA task created and registered to %d sys task",
212 /*******************************************************************
214 * @brief Initializes RLC DL, MAC TAPA task
218 * Function : rlcDlInit
221 * - Registers and attaches TAPA tasks for MAC and RLC DL
223 * @params[in] system task ID
224 * @return ROK - success
227 * ****************************************************************/
228 uint8_t rlcDlInit(SSTskId sysTskId)
230 /* Register RLC DL TAPA Task */
231 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
232 rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK)
236 /* Attach RLC DL Task */
237 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)1, sysTskId)!= ROK)
242 /* Register MAC TAPA Task */
243 if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
244 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
248 /* Attach MAC Task */
249 if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)0, sysTskId)!= ROK)
254 DU_LOG("\nINFO --> DU_APP : RLC DL and MAC TAPA task created and registered to \
255 %d sys task", sysTskId);
259 /*******************************************************************
261 * @brief Initializes RLC UL TAPA task
265 * Function : rlcUlInit
268 * - Registers and attaches TAPA task for RLC UL
270 * @params[in] system task ID
271 * @return ROK - success
274 * ****************************************************************/
275 uint8_t rlcUlInit(SSTskId sysTskId)
277 /* Register RLC UL TAPA Task */
278 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
279 rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
283 /* Attach RLC DL Task */
284 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK)
288 DU_LOG("\nINFO --> DU_APP : RLC UL TAPA task created and registered to \
289 %d sys task", sysTskId);
293 /*******************************************************************
295 * @brief Initializes Lower MAC receiver task
299 * Function : lwrMacInit
302 * - Registers and attaches TAPA tasks for Lower MAC receiver
304 * @params[in] system task ID
305 * @return ROK - success
308 * ****************************************************************/
309 uint8_t lwrMacInit(SSTskId sysTskId)
311 /* Register SCTP TAPA Task */
312 if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
313 lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK)
317 /* Attach SCTP TAPA Task */
318 if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK)
323 DU_LOG("\nINFO --> DU_APP : LWR MAC TAPA task created and registered to %d sys task",
328 #ifndef INTEL_WLS_MEM
329 /*******************************************************************
331 * @brief Initializes Phy stub slot indication generator task
335 * Function : phyStubInit
338 * - Registers and attaches TAPA tasks for Phy stub's slot
339 * indication generator
341 * @params[in] system task ID
342 * @return ROK - success
345 * ****************************************************************/
346 uint8_t phyStubInit(SSTskId sysTskId)
348 /* Register PHY stub slot indication TAPA Task */
349 if(ODU_REG_TTSK((Ent)ENTPHYSTUB, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
350 phyStubActvInit, (ActvTsk)phyStubActvTsk) != ROK)
354 /* Attach Phy stub slot indication TAPA Task */
355 if (ODU_ATTACH_TTSK((Ent)ENTPHYSTUB, (Inst)0, sysTskId)!= ROK)
360 DU_LOG("\nINFO --> DU_APP : PHY stub slot indication TAPA task created and registered to %d sys task",
366 /*******************************************************************
368 * @brief Initializes system and TAPA tasks
372 * Function : commonInit
375 * - Registers and attaches system and TAPA tasks
378 * @return ROK - success
381 * ****************************************************************/
384 /* Declare system task Ids */
385 SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk, phy_stub_slot_ind_stsk;
389 ODU_SET_PROC_ID(DU_PROC);
391 /* Intel L1 using core 0-15. ODU-High using 16-21 */
392 /* system task for DU APP */
393 if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
395 DU_LOG("\nERROR --> DU_APP : System Task creation for DU APP failed");
398 ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
400 /* system task for EGTP */
401 if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
403 DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed");
406 ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 17, 0);
408 /* system task for RLC_DL and MAC */
409 if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
411 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC DL/MAC failed");
414 pthread_attr_init(&attr);
415 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
416 ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
418 /* system task for RLC UL */
419 if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
421 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed");
424 ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 19, 0);
426 /* system task for SCTP receiver thread */
427 if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
429 DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed");
432 ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 20, 0);
434 /* system task for lower-mac receiver thread */
435 if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
437 DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed");
440 ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
442 #ifndef INTEL_WLS_MEM
443 /* system task for phy stub's slot indication generator thread */
444 if(ODU_CREATE_TASK(PRIOR0, &phy_stub_slot_ind_stsk) != ROK)
446 DU_LOG("\nERROR --> DU_APP : System Task creation for Phy stub slot indication generator failed. MAX STSK [%d]", SS_MAX_STSKS);
452 /* Create TAPA tasks */
453 if(duAppInit(du_app_stsk) != ROK)
455 DU_LOG("\nERROR --> DU_APP : DU APP TAPA Task initialization failed");
459 if(egtpInit(egtp_stsk) != ROK)
461 DU_LOG("\nERROR --> DU_APP : EGTP TAPA Task initialization failed");
465 if(sctpInit(sctp_stsk) != ROK)
467 DU_LOG("\nERROR --> DU_APP : SCTP TAPA Task initialization failed");
471 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
473 DU_LOG("\nERROR --> DU_APP : RLC DL Tapa Task initialization failed");
477 if(rlcUlInit(rlc_ul_stsk) != ROK)
479 DU_LOG("\nERROR --> DU_APP : RLC UL Tapa Task initialization failed");
483 if(lwrMacInit(lwr_mac_stsk) != ROK)
485 DU_LOG("\nERROR --> DU_APP : Lower MAC Tapa Task initialization failed");
489 #ifndef INTEL_WLS_MEM
490 if(phyStubInit(phy_stub_slot_ind_stsk) != ROK)
492 DU_LOG("\nERROR --> DU_APP : PHY stub slot indication Tapa Task initialization failed");
500 /*******************************************************************
502 * @brief Initializes the DU
510 * - Registers DU Layers
513 * @return ROK - success
516 * ****************************************************************/
520 if(commonInit() != ROK)
529 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
532 /*******************************************************************
534 * @brief Entry point for the DU APP
541 * - Read config params into duCfgParams
542 * - Initiate the init functions
545 * @return ROK - success
548 * ****************************************************************/
554 if(start_O1_module() != ROK)
557 //Initialize TAPA layers
563 //Read all the configs from du_utils.c into duCfgParams
567 //Send VES PNF registration message to SMO
568 sendPnfRegistration();
575 /**********************************************************************
577 **********************************************************************/