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"
33 uint8_t rlcUlActvTsk (Pst *, Buffer *);
34 uint8_t rlcUlActvInit (Ent, Inst, Region, Reason);
35 uint8_t rlcDlActvTsk (Pst *, Buffer *);
36 uint8_t rlcDlActvInit (Ent, Inst, Region, Reason);
37 uint8_t rgActvTsk (Pst *, Buffer *);
38 uint8_t rgActvInit (Ent, Inst, Region, Reason);
39 uint8_t lwrMacActvTsk(Pst *, Buffer *);
40 uint8_t lwrMacActvInit(Ent, Inst, Region, Reason);
43 DuCfgParams duCfgParam;
45 /*******************************************************************
47 * @brief Initializes DU APP
51 * Function : duAppInit
54 * - Registers and attaches TAPA tasks belonging to
57 * @params[in] system task ID
58 * @return ROK - success
61 * ****************************************************************/
62 uint8_t duAppInit(SSTskId sysTskId)
64 /* Register DU APP TAPA Task for DU */
65 if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
66 duActvInit, (ActvTsk)duActvTsk) != ROK)
70 /* Attach DU APP TAPA Task for DU */
71 if (ODU_ATTACH_TTSK((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
76 DU_LOG("\nINFO --> DU_APP : DU APP created and registered \
77 to %d sys task", sysTskId);
81 /*******************************************************************
83 * @brief Initializes EGTP
90 * - Registers and attaches TAPA tasks belonging to
93 * @params[in] system task ID
94 * @return ROK - success
97 * ****************************************************************/
98 uint8_t egtpInit(SSTskId sysTskId)
100 /* Register DU APP TAPA Task for DU */
101 if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
102 egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
106 /* Attach DU APP TAPA Task for DU */
107 if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
112 DU_LOG("\nINFO --> DU_APP : EGTP created and registered \
113 to %d sys task", sysTskId);
118 /*******************************************************************
120 * @brief Initializes SCTP task
124 * Function : sctpInit
127 * - Registers and attaches TAPA tasks for SCTP receiver
129 * @params[in] system task ID
130 * @return ROK - success
133 * ****************************************************************/
134 uint8_t sctpInit(SSTskId sysTskId)
136 /* Register SCTP TAPA Task */
137 if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
138 sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
142 /* Attach SCTP TAPA Task */
143 if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
148 DU_LOG("\nINFO --> DU_APP : SCTP TAPA task created and registered to %d sys task",
152 /*******************************************************************
154 * @brief Initializes RLC DL, MAC TAPA task
158 * Function : rlcDlInit
161 * - Registers and attaches TAPA tasks for MAC and RLC DL
163 * @params[in] system task ID
164 * @return ROK - success
167 * ****************************************************************/
168 uint8_t rlcDlInit(SSTskId sysTskId)
170 /* Register RLC DL TAPA Task */
171 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
172 rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK)
176 /* Attach RLC DL Task */
177 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)1, sysTskId)!= ROK)
182 /* Register MAC TAPA Task */
183 if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
184 rgActvInit, (ActvTsk)rgActvTsk) != ROK)
188 /* Attach MAC Task */
189 if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)0, sysTskId)!= ROK)
194 DU_LOG("\nINFO --> DU_APP : RLC DL and MAC TAPA task created and registered to \
195 %d sys task", sysTskId);
199 /*******************************************************************
201 * @brief Initializes RLC UL TAPA task
205 * Function : rlcUlInit
208 * - Registers and attaches TAPA task for RLC UL
210 * @params[in] system task ID
211 * @return ROK - success
214 * ****************************************************************/
215 uint8_t rlcUlInit(SSTskId sysTskId)
217 /* Register RLC UL TAPA Task */
218 if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
219 rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
223 /* Attach RLC DL Task */
224 if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK)
228 DU_LOG("\nINFO --> DU_APP : RLC UL TAPA task created and registered to \
229 %d sys task", sysTskId);
233 /*******************************************************************
235 * @brief Initializes Lower MAC receiver task
239 * Function : lwrMacInit
242 * - Registers and attaches TAPA tasks for Lower MAC receiver
244 * @params[in] system task ID
245 * @return ROK - success
248 * ****************************************************************/
249 uint8_t lwrMacInit(SSTskId sysTskId)
251 /* Register SCTP TAPA Task */
252 if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
253 lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK)
257 /* Attach SCTP TAPA Task */
258 if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK)
263 DU_LOG("\nINFO --> DU_APP : LWR MAC TAPA task created and registered to %d sys task",
268 /*******************************************************************
270 * @brief Initializes system and TAPA tasks
274 * Function : commonInit
277 * - Registers and attaches system and TAPA tasks
280 * @return ROK - success
283 * ****************************************************************/
286 /* Declare system task Ids */
287 SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk;
291 ODU_SET_PROC_ID(DU_PROC);
293 /* Intel L1 using core 0-15. ODU-High using 16-21 */
294 /* system task for DU APP */
295 if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
297 DU_LOG("\nERROR --> DU_APP : System Task creation for DU APP failed");
300 ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
302 /* system task for EGTP */
303 if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
305 DU_LOG("\nERROR --> DU_APP : System Task creation for EGTP failed");
308 ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 17, 0);
310 /* system task for RLC_DL and MAC */
311 if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
313 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC DL/MAC failed");
316 pthread_attr_init(&attr);
317 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
318 ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
320 /* system task for RLC UL */
321 if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
323 DU_LOG("\nERROR --> DU_APP : System Task creation for RLC UL failed");
326 ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 19, 0);
328 /* system task for SCTP receiver thread */
329 if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
331 DU_LOG("\nERROR --> DU_APP : System Task creation for SCTP failed");
334 ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 20, 0);
336 /* system task for lower-mac receiver thread */
337 if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
339 DU_LOG("\nERROR --> DU_APP : System Task creation for Lower MAC failed");
342 ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
344 /* Create TAPA tasks */
345 if(duAppInit(du_app_stsk) != ROK)
347 DU_LOG("\nERROR --> DU_APP : DU APP TAPA Task initialization failed");
351 if(egtpInit(egtp_stsk) != ROK)
353 DU_LOG("\nERROR --> DU_APP : EGTP TAPA Task initialization failed");
357 if(sctpInit(sctp_stsk) != ROK)
359 DU_LOG("\nERROR --> DU_APP : SCTP TAPA Task initialization failed");
363 if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
365 DU_LOG("\nERROR --> DU_APP : RLC DL Tapa Task initialization failed");
369 if(rlcUlInit(rlc_ul_stsk) != ROK)
371 DU_LOG("\nERROR --> DU_APP : RLC UL Tapa Task initialization failed");
375 if(lwrMacInit(lwr_mac_stsk) != ROK)
377 DU_LOG("\nERROR --> DU_APP : Lower MAC Tapa Task initialization failed");
384 /*******************************************************************
386 * @brief Initializes the DU
394 * - Registers DU Layers
397 * @return ROK - success
400 * ****************************************************************/
404 if(commonInit() != ROK)
413 openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
416 /*******************************************************************
418 * @brief Entry point for the DU APP
425 * - Read config params into duCfgParams
426 * - Initiate the init functions
429 * @return ROK - success
432 * ****************************************************************/
437 //Initialize TAPA layers
443 //Read all the configs from du_utils.c into duCfgParams
449 /**********************************************************************
451 **********************************************************************/