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);
50 DuCfgParams duCfgParam;
52 /*******************************************************************
54 * @brief Initializes DU APP
58 * Function : duAppInit
61 * - Registers and attaches TAPA tasks belonging to
64 * @params[in] system task ID
65 * @return ROK - success
68 * ****************************************************************/
69 uint8_t duAppInit(SSTskId sysTskId)
71 /* Register DU APP TAPA Task for DU */
72 if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
73 duActvInit, (ActvTsk)duActvTsk) != ROK)
77 /* Attach DU APP TAPA Task for DU */
78 if (ODU_ATTACH_TTSK((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
83 DU_LOG("\nINFO --> DU_APP : DU APP created and registered \
84 to %d sys task", sysTskId);
89 /*******************************************************************
91 * @brief Bring the cell Up
95 * Function : bringCellUp
98 * - Bring the cell Up when requested from OAM
100 * @params[in] Cell Id
101 * @return true - success
104 * ****************************************************************/
106 bool bringCellUp(uint16_t cellId)
111 /*******************************************************************
113 * @brief Bring the cell Down
117 * Function : bringCellDown
120 * - Bring the cell Down when requested from OAM
122 * @params[in] Cell Id
123 * @return true - success
126 * ****************************************************************/
128 bool bringCellDown(uint16_t cellId)
134 /*******************************************************************
136 * @brief Initializes EGTP
140 * Function : egtpInit
143 * - Registers and attaches TAPA tasks belonging to
146 * @params[in] system task ID
147 * @return ROK - success
150 * ****************************************************************/
151 uint8_t egtpInit(SSTskId sysTskId)
153 /* Register DU APP TAPA Task for DU */
154 if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
155 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
159 /* Attach DU APP TAPA Task for DU */
160 if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
165 DU_LOG("\nINFO --> DU_APP : EGTP created and registered \
166 to %d sys task", sysTskId);
171 /*******************************************************************
173 * @brief Initializes SCTP task
177 * Function : sctpInit
180 * - Registers and attaches TAPA tasks for SCTP receiver
182 * @params[in] system task ID
183 * @return ROK - success
186 * ****************************************************************/
187 uint8_t sctpInit(SSTskId sysTskId)
189 /* Register SCTP TAPA Task */
190 if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
191 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
195 /* Attach SCTP TAPA Task */
196 if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
201 DU_LOG("\nINFO --> DU_APP : SCTP TAPA task created and registered to %d sys task",
205 /*******************************************************************
207 * @brief Initializes RLC DL, MAC TAPA task
211 * Function : rlcDlInit
214 * - Registers and attaches TAPA tasks for MAC and RLC DL
216 * @params[in] system task ID
217 * @return ROK - success
220 * ****************************************************************/
221 uint8_t rlcDlInit(SSTskId sysTskId)
223 /* Register RLC DL TAPA Task */
224 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
225 rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK)
229 /* Attach RLC DL Task */
230 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)1, sysTskId)!= ROK)
235 /* Register MAC TAPA Task */
236 if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
237 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
241 /* Attach MAC Task */
242 if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)0, sysTskId)!= ROK)
247 DU_LOG("\nINFO --> DU_APP : RLC DL and MAC TAPA task created and registered to \
248 %d sys task", sysTskId);
252 /*******************************************************************
254 * @brief Initializes RLC UL TAPA task
258 * Function : rlcUlInit
261 * - Registers and attaches TAPA task for RLC UL
263 * @params[in] system task ID
264 * @return ROK - success
267 * ****************************************************************/
268 uint8_t rlcUlInit(SSTskId sysTskId)
270 /* Register RLC UL TAPA Task */
271 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
272 rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
276 /* Attach RLC DL Task */
277 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK)
281 DU_LOG("\nINFO --> DU_APP : RLC UL TAPA task created and registered to \
282 %d sys task", sysTskId);
286 /*******************************************************************
288 * @brief Initializes Lower MAC receiver task
292 * Function : lwrMacInit
295 * - Registers and attaches TAPA tasks for Lower MAC receiver
297 * @params[in] system task ID
298 * @return ROK - success
301 * ****************************************************************/
302 uint8_t lwrMacInit(SSTskId sysTskId)
304 /* Register SCTP TAPA Task */
305 if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
306 lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK)
310 /* Attach SCTP TAPA Task */
311 if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK)
316 DU_LOG("\nINFO --> DU_APP : LWR MAC TAPA task created and registered to %d sys task",
321 /*******************************************************************
323 * @brief Initializes system and TAPA tasks
327 * Function : commonInit
330 * - Registers and attaches system and TAPA tasks
333 * @return ROK - success
336 * ****************************************************************/
339 /* Declare system task Ids */
340 SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk;
344 ODU_SET_PROC_ID(DU_PROC);
346 /* Intel L1 using core 0-15. ODU-High using 16-21 */
347 /* system task for DU APP */
348 if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
350 DU_LOG("\nERROR --> DU_APP : System Task creation for DU APP failed");
353 ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
355 /* system task for EGTP */
356 if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
358 DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed");
361 ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 17, 0);
363 /* system task for RLC_DL and MAC */
364 if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
366 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC DL/MAC failed");
369 pthread_attr_init(&attr);
370 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
371 ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
373 /* system task for RLC UL */
374 if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
376 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed");
379 ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 19, 0);
381 /* system task for SCTP receiver thread */
382 if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
384 DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed");
387 ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 20, 0);
389 /* system task for lower-mac receiver thread */
390 if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
392 DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed");
395 ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
397 /* Create TAPA tasks */
398 if(duAppInit(du_app_stsk) != ROK)
400 DU_LOG("\nERROR --> DU_APP : DU APP TAPA Task initialization failed");
404 if(egtpInit(egtp_stsk) != ROK)
406 DU_LOG("\nERROR --> DU_APP : EGTP TAPA Task initialization failed");
410 if(sctpInit(sctp_stsk) != ROK)
412 DU_LOG("\nERROR --> DU_APP : SCTP TAPA Task initialization failed");
416 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
418 DU_LOG("\nERROR --> DU_APP : RLC DL Tapa Task initialization failed");
422 if(rlcUlInit(rlc_ul_stsk) != ROK)
424 DU_LOG("\nERROR --> DU_APP : RLC UL Tapa Task initialization failed");
428 if(lwrMacInit(lwr_mac_stsk) != ROK)
430 DU_LOG("\nERROR --> DU_APP : Lower MAC Tapa Task initialization failed");
437 /*******************************************************************
439 * @brief Initializes the DU
447 * - Registers DU Layers
450 * @return ROK - success
453 * ****************************************************************/
457 if(commonInit() != ROK)
466 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
469 /*******************************************************************
471 * @brief Entry point for the DU APP
478 * - Read config params into duCfgParams
479 * - Initiate the init functions
482 * @return ROK - success
485 * ****************************************************************/
491 if(start_O1_module() != ROK)
494 //Initialize TAPA layers
500 //Read all the configs from du_utils.c into duCfgParams
506 /**********************************************************************
508 **********************************************************************/