88043ee17c6de668a3c80511fbc5c9f54876fc5d
[o-du/l2.git] / src / du_app / du_mgr_main.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /* This file is the entry point for DU APP */
20 #include "common_def.h"
21 #include "du_tmr.h"
22 #include "lrg.h"
23 #include "legtp.h"
24 #include "lrg.x"
25 #include "lkw.x"
26 #include "du_app_mac_inf.h"
27 #include "du_app_rlc_inf.h"
28 #include "du_e2ap_mgr.h"
29 #include "du_cfg.h"
30 #include "du_mgr.h"
31 #include "du_mgr_main.h"
32 #include "du_sctp.h"
33 #include "du_egtp.h"
34 #include "du_cell_mgr.h"
35 #include "du_f1ap_msg_hdl.h"
36
37 #ifdef O1_ENABLE
38
39 #include "O1Interface.h"
40 #include "CmInterface.h"
41 #endif
42
43 uint8_t rlcUlActvTsk (Pst *, Buffer *);
44 uint8_t rlcUlActvInit (Ent, Inst, Region, Reason);
45 uint8_t rlcDlActvTsk (Pst *, Buffer *);
46 uint8_t rlcDlActvInit (Ent, Inst, Region, Reason);
47 uint8_t macActvTsk (Pst *, Buffer *);
48 uint8_t macActvInit (Ent, Inst, Region, Reason);
49 uint8_t schActvTsk (Pst *, Buffer *);
50 uint8_t schActvInit(Ent, Inst, Region, Reason);
51 uint8_t lwrMacActvTsk(Pst *, Buffer *);
52 uint8_t lwrMacActvInit(Ent, Inst, Region, Reason);
53 #ifndef INTEL_WLS_MEM
54 uint8_t phyStubActvTsk(Pst *, Buffer *);
55 uint8_t phyStubActvInit(Ent, Inst, Region, Reason);
56 #endif
57
58 /* Global variable */
59 DuCfgParams duCfgParam;
60
61 #ifdef O1_ENABLE
62 extern NRCellDU cellParams;
63 #endif
64
65 /*******************************************************************
66  *
67  * @brief Initializes DU APP
68  *
69  * @details
70  *
71  *    Function : duAppInit
72  *
73  *    Functionality:
74  *       - Registers and attaches TAPA tasks belonging to 
75  *         DU_APP sys task
76  *
77  * @params[in] system task ID
78  * @return ROK     - success
79  *         RFAILED - failure
80  *
81  * ****************************************************************/
82 uint8_t duAppInit(SSTskId sysTskId)
83 {
84    /* Register DU APP TAPA Task for DU */
85    if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0,
86       duActvInit, (ActvTsk)duActvTsk) != ROK)
87    {
88       return RFAILED;
89    }
90    /* Attach DU APP TAPA Task for DU */
91    if (ODU_ATTACH_TTSK((Ent)ENTDUAPP, (Inst)0, sysTskId)!= ROK)
92    {
93       return RFAILED;
94    }
95
96    DU_LOG("\nINFO   -->  DU_APP : DU APP created and registered \
97    to %d sys task", sysTskId);
98    return ROK;
99 }
100
101 #ifdef O1_ENABLE
102
103 /*******************************************************************
104  *
105  * @brief update Rrm Policy at DU and process the slice cfg request
106  *
107  * @details
108  *
109  *    Function : setRrmPolicy 
110  *
111  *    Functionality:
112  *       - update Rrm Policy at DU and process the slice cfg request
113  *
114  * @params[in] RrmPolicy rrmPolicy[], uint8_t policyNum, uint8_t memberList
115  * @return true     - success
116  *         false    - failure
117  *
118  * ****************************************************************/
119
120 uint8_t setRrmPolicy(RrmPolicyList rrmPolicy[], uint8_t policyNum)
121 {
122    DU_LOG("\nINFO   -->  DU_APP : DU APP RRM number of policy %d,", \
123           policyNum);
124    for(uint8_t i=0; i<policyNum ; i++)
125    {
126       DU_LOG("\nINFO   -->  DU_APP : DU APP  id = %s",rrmPolicy[i].id);
127       DU_LOG("\nINFO   -->  DU_APP : DU APP  resourceType = %d", \
128                 rrmPolicy[i].resourceType);
129       DU_LOG("\nINFO   -->  DU_APP : DU APP  rRMPolicyMaxRatio = %d", \
130                 rrmPolicy[i].rRMPolicyMaxRatio);
131       DU_LOG("\nINFO   -->  DU_APP : DU APP  rRMPolicyMinRatio = %d", \
132                 rrmPolicy[i].rRMPolicyMinRatio);
133       DU_LOG("\nINFO   -->  DU_APP : DU APP  rRMPolicyDedicatedRatio = %d", \
134                 rrmPolicy[i].rRMPolicyDedicatedRatio);
135       DU_LOG("\nINFO   -->  DU_APP : DU APP  rRMMemberNum = %d", \
136                 rrmPolicy[i].rRMMemberNum);
137       for(uint8_t j=0; j<rrmPolicy[i].rRMMemberNum ; j++)
138       {
139          DU_LOG("\nINFO   -->  DU_APP : DU APP  mcc = %d%d%d", \
140                  rrmPolicy[i].rRMPolicyMemberList[j].mcc[0], \
141                  rrmPolicy[i].rRMPolicyMemberList[j].mcc[1], \
142                  rrmPolicy[i].rRMPolicyMemberList[j].mcc[2]);
143          DU_LOG("\nINFO   -->  DU_APP : DU APP  mnc = %d%d%d", \
144                    rrmPolicy[i].rRMPolicyMemberList[j].mnc[0], \
145                    rrmPolicy[i].rRMPolicyMemberList[j].mnc[1], \
146                    rrmPolicy[i].rRMPolicyMemberList[j].mnc[2]);
147
148          DU_LOG("\nINFO   -->  DU_APP : DU APP  sd = %d%d%d", \
149                    rrmPolicy[i].rRMPolicyMemberList[j].sd[0], \
150                    rrmPolicy[i].rRMPolicyMemberList[j].sd[1], \
151                    rrmPolicy[i].rRMPolicyMemberList[j].sd[2]);
152
153          DU_LOG("\nINFO   -->  DU_APP : DU APP  sst = %d\n", \
154                    rrmPolicy[i].rRMPolicyMemberList[j].sst);
155       }
156
157    }
158    DuCellCb *cellCb = NULLP;
159
160     cpyRrmPolicyInDuCfgParams(rrmPolicy, policyNum, &duCfgParam.tempSliceCfg);
161     cellCb = duCb.actvCellLst[0];
162
163     if(cellCb)
164     {
165        if(cellCb->cellStatus == ACTIVATED)
166        {
167            if(duCb.sliceState == SLICE_INFO_NOT_AVAILABLE)
168            {
169               BuildAndSendSliceConfigReq();
170            }
171            else 
172            {
173               BuildAndSendSliceRecfgReq();
174            }
175        }
176     }
177    return ROK;
178 }
179
180 /*******************************************************************
181  *
182  * @brief Bring the cell Up
183  *
184  * @details
185  *
186  *    Function : bringCellUp
187  *
188  *    Functionality:
189  *       - Bring the cell Up when requested from OAM
190  *
191  * @params[in] Cell Id
192  * @return true     - success
193  *         false    - failure
194  *
195  * ****************************************************************/
196
197 bool bringCellUp(uint16_t cellId)
198 {
199    duProcCfgComplete();
200    BuildAndSendF1SetupReq();
201    return true;
202 }
203
204 /*******************************************************************
205  *
206  * @brief configure cell parameters
207  *
208  * @details
209  *
210  *    Function : configurecell
211  *
212  *    Functionality:
213  *       - configure cell parameters
214  *
215  * @params[in] Cell Id
216  * @return true     - success
217  *         false    - failure
218  *
219  * ****************************************************************/
220
221 uint8_t setCellParam()
222 {
223    //Read all the configs from smo edit-config into cellParams
224    DU_LOG("\nO1 configurecell du_app enterd");
225    DU_LOG("\nDU_APP configurecell cellLocalId value:%d",cellParams.cellLocalId);
226    DU_LOG("\nDU_APP configurecell operationalState value:%d", \
227              cellParams.operationalState);
228    DU_LOG("\nDU_APP configurecell administrativeState value:%d", \
229              cellParams.administrativeState);
230    DU_LOG("\nDU_APP configurecell cellState value:%d",cellParams.cellState);
231    DU_LOG("\nDU_APP configurecell nRPCI value:%d",cellParams.nRPCI);
232    DU_LOG("\nDU_APP configurecell nRTAC value:%d",cellParams.nRTAC);
233    DU_LOG("\nDU_APP configurecell arfcnDL value:%d",cellParams.arfcnDL);
234    DU_LOG("\nDU_APP configurecell arfcnUL value:%d",cellParams.arfcnUL);
235    DU_LOG("\nDU_APP configurecell arfcnSUL value:%d",cellParams.arfcnSUL);
236    DU_LOG("\nDU_APP configurecell ssbFrequency value:%d",cellParams.ssbFrequency);
237    DU_LOG("\nDU_APP configurecell ssbPeriodicity value:%d", \
238              cellParams.ssbPeriodicity);
239    DU_LOG("\nDU_APP configurecell ssbSubCarrierSpacing value:%d", \
240              cellParams.ssbSubCarrierSpacing);
241    DU_LOG("\nDU_APP configurecell ssbOffset value:%d",cellParams.ssbOffset);
242    DU_LOG("\nDU_APP configurecell ssbDuration value:%d",cellParams.ssbDuration);
243    DU_LOG("\nDU_APP configurecell bSChannelBwUL value:%d", \
244              cellParams.bSChannelBwUL);
245    DU_LOG("\nDU_APP configurecell bSChannelBwDL value:%d", \
246              cellParams.bSChannelBwDL);
247    DU_LOG("\nDU_APP configurecell bSChannelBwSUL value:%d", \
248              cellParams.bSChannelBwSUL);
249    for (int i=0 ; i<MAX_SUPPORTED_PLMN; i++)
250    {
251
252        DU_LOG("\nINFO   -->  DU_APP : DU APP  mcellParams.plmnList[%d].mcc = %d%d%d", i,\
253                  cellParams.plmnList[i].mcc[0], \
254                  cellParams.plmnList[i].mcc[1], \
255                  cellParams.plmnList[i].mcc[2]);
256          DU_LOG("\nINFO   -->  DU_APP : DU APP  cellParams.plmnList[%d].mnc = %d%d%d", i,\
257                    cellParams.plmnList[i].mnc[0], \
258                    cellParams.plmnList[i].mnc[1], \
259                    cellParams.plmnList[i].mnc[2]);
260
261          DU_LOG("\nINFO   -->  DU_APP : DU APP  cellParams.plmnList[%d].sd = %d%d%d", i,\
262                    cellParams.plmnList[i].sd[0], \
263                    cellParams.plmnList[i].sd[1], \
264                    cellParams.plmnList[i].sd[2]);
265
266          DU_LOG("\nINFO   -->  DU_APP : DU APP  cellParams.plmnList[%d].sst = %d\n", i,\
267                    cellParams.plmnList[i].sst);
268
269    }
270
271    duReadCfg();
272    return ROK;
273 }
274 /*******************************************************************
275  *
276  * @brief Bring the cell Down
277  *
278  * @details
279  *
280  *    Function : bringCellDown
281  *
282  *    Functionality:
283  *       - Bring the cell Down when requested from OAM
284  *
285  * @params[in] Cell Id
286  * @return true     - success
287  *         false    - failure
288  *
289  * ****************************************************************/
290
291 bool bringCellDown(uint16_t cellId)
292 {
293    BuildAndSendDUConfigUpdate(SERV_CELL_TO_DELETE);
294    return true;
295 }
296 #endif
297
298 /*******************************************************************
299  *
300  * @brief Initializes EGTP
301  *
302  * @details
303  *
304  *    Function : egtpInit
305  *
306  *    Functionality:
307  *       - Registers and attaches TAPA tasks belonging to 
308  *         DU_APP sys task
309  *
310  * @params[in] system task ID
311  * @return ROK     - success
312  *         RFAILED - failure
313  *
314  * ****************************************************************/
315 uint8_t egtpInit(SSTskId sysTskId)
316 {
317    /* Register DU APP TAPA Task for DU */
318    if(ODU_REG_TTSK((Ent)ENTEGTP, (Inst)EGTP_INST, (Ttype)TTNORM, (Prior)PRIOR0,
319              egtpActvInit, (ActvTsk)egtpActvTsk) != ROK)
320    {
321       return RFAILED;
322    }
323    /* Attach DU APP TAPA Task for DU */
324    if (ODU_ATTACH_TTSK((Ent)ENTEGTP, (Inst)0, sysTskId)!= ROK)
325    {
326       return RFAILED;
327    }
328  
329     DU_LOG("\nINFO   -->  DU_APP : EGTP created and registered \
330     to %d sys task", sysTskId);
331     return ROK;
332 }
333  
334
335 /*******************************************************************
336  *
337  * @brief Initializes SCTP task
338  *
339  * @details
340  *
341  *    Function : sctpInit
342  *
343  *    Functionality:
344  *       - Registers and attaches TAPA tasks for SCTP receiver 
345  *
346  * @params[in] system task ID
347  * @return ROK     - success
348  *         RFAILED - failure
349  *
350  * ****************************************************************/
351 uint8_t sctpInit(SSTskId sysTskId)
352 {
353    /* Register SCTP TAPA Task */
354    if(ODU_REG_TTSK((Ent)ENTSCTP, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
355             sctpActvInit, (ActvTsk)sctpActvTsk) != ROK)
356    {
357       return RFAILED;
358    }
359    /* Attach SCTP TAPA Task */
360    if (ODU_ATTACH_TTSK((Ent)ENTSCTP, (Inst)SCTP_INST, sysTskId)!= ROK)
361    {
362       return RFAILED;
363    }
364
365    DU_LOG("\nINFO   -->  DU_APP : SCTP TAPA task created and registered to %d sys task", 
366          sysTskId);
367    return ROK;
368 }
369
370 /*******************************************************************
371  *
372  * @brief Initializes RLC DL, MAC TAPA task
373  *
374  * @details
375  *
376  *    Function : rlcDlInit
377  *
378  *    Functionality:
379  *       - Registers and attaches TAPA tasks for MAC and RLC DL
380  *
381  * @params[in] system task ID
382  * @return ROK     - success
383  *         RFAILED - failure
384  *
385  * ****************************************************************/
386 uint8_t rlcDlInit(SSTskId sysTskId)
387 {
388    /* Register RLC DL TAPA Task */
389    if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)1, (Ttype)TTNORM, (Prior)PRIOR0,
390             rlcDlActvInit, (ActvTsk)rlcDlActvTsk) != ROK)
391    {
392       return RFAILED;
393    }
394    /* Attach RLC DL Task */
395    if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)1, sysTskId)!= ROK)
396    {
397       return RFAILED;
398    }
399
400    /* Register MAC TAPA Task */
401    if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
402             macActvInit, (ActvTsk)macActvTsk) != ROK)
403    {
404       return RFAILED;
405    }
406    /* Attach MAC Task */
407    if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)0, sysTskId)!= ROK)
408    {
409       return RFAILED;
410    }
411    return ROK;
412  }
413
414 /*******************************************************************
415  *
416  * @brief Initializes SCH TAPA task
417  *
418  * @details
419  *
420  *    Function : schInit
421  *
422  *    Functionality:
423  *       - Registers and attaches TAPA tasks for SCH
424  *
425  * @params[in] system task ID
426  * @return ROK     - success
427  *         RFAILED - failure
428  *
429  * ****************************************************************/
430  uint8_t schInit(SSTskId sysTskId)
431  {
432    /* Register SCH TAPA Task */
433    if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)SCH_INST_START, (Ttype)TTNORM, (Prior)PRIOR0,
434             schActvInit, (ActvTsk)schActvTsk) != ROK)
435    {
436       return RFAILED;
437    }
438    /* Attach SCH Task */
439    if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)SCH_INST_START, sysTskId)!= ROK)
440    {
441       return RFAILED;
442    }
443
444
445    DU_LOG("\nINFO   -->  DU_APP : SCH TAPA task created and registered to \
446          %d sys task", sysTskId);
447    return ROK;
448 }
449
450 /*******************************************************************
451  *
452  * @brief Initializes RLC UL TAPA task
453  *
454  * @details
455  *
456  *    Function : rlcUlInit
457  *
458  *    Functionality:
459  *       - Registers and attaches TAPA task for RLC UL
460  *
461  * @params[in] system task ID
462  * @return ROK     - success
463  *         RFAILED - failure
464  *
465  * ****************************************************************/
466 uint8_t rlcUlInit(SSTskId sysTskId)
467 {
468    /* Register RLC UL TAPA Task */
469    if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
470             rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
471    {
472       return RFAILED;
473    }
474    /* Attach RLC DL Task */
475    if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK)
476    {
477       return RFAILED;
478    }
479    DU_LOG("\nINFO   -->  DU_APP : RLC UL TAPA task created and registered to \
480    %d sys task", sysTskId);
481    return ROK;
482 }
483
484 /*******************************************************************
485  *
486  * @brief Initializes Lower MAC receiver task
487  *
488  * @details
489  *
490  *    Function : lwrMacInit
491  *
492  *    Functionality:
493  *       - Registers and attaches TAPA tasks for Lower MAC receiver
494  *
495  * @params[in] system task ID
496  * @return ROK     - success
497  *         RFAILED - failure
498  *
499  * ****************************************************************/
500 uint8_t lwrMacInit(SSTskId sysTskId)
501 {
502    /* Register SCTP TAPA Task */
503    if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
504             lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK)
505    {
506       return RFAILED;
507    }
508    /* Attach SCTP TAPA Task */
509    if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK)
510    {
511       return RFAILED;
512    }
513
514    DU_LOG("\nINFO   -->  DU_APP : LWR MAC TAPA task created and registered to %d sys task",
515          sysTskId);
516    return ROK;
517 }
518
519 #ifndef INTEL_WLS_MEM
520 /*******************************************************************
521  *
522  * @brief Initializes Phy stub slot indication generator task
523  *
524  * @details
525  *
526  *    Function : phyStubInit
527  *
528  *    Functionality:
529  *       - Registers and attaches TAPA tasks for Phy stub's slot
530  *       indication generator
531  *
532  * @params[in] system task ID
533  * @return ROK     - success
534  *         RFAILED - failure
535  *
536  * ****************************************************************/
537 uint8_t phyStubInit(SSTskId sysTskId)
538 {
539    /* Register PHY stub slot indication TAPA Task */
540    if(ODU_REG_TTSK((Ent)ENTPHYSTUB, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
541             phyStubActvInit, (ActvTsk)phyStubActvTsk) != ROK)
542    {
543       return RFAILED;
544    }
545    /* Attach Phy stub slot indication TAPA Task */
546    if (ODU_ATTACH_TTSK((Ent)ENTPHYSTUB, (Inst)0, sysTskId)!= ROK)
547    {
548       return RFAILED;
549    }
550
551    DU_LOG("\nINFO   -->  DU_APP : PHY stub slot indication TAPA task created and registered to %d sys task",
552          sysTskId);
553    return ROK;
554 }
555 #endif
556
557 /*******************************************************************
558  *
559  * @brief Initializes system and TAPA tasks
560  *
561  * @details
562  *
563  *    Function : commonInit
564  *
565  *    Functionality:
566  *       - Registers and attaches system and TAPA tasks
567  *
568  * @params[in] void
569  * @return ROK     - success
570  *         RFAILED - failure
571  *
572  * ****************************************************************/
573 uint8_t commonInit()
574 {
575    /* Declare system task Ids */
576    SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, sch_stsk, lwr_mac_stsk, phy_stub_slot_ind_stsk;
577
578    pthread_attr_t attr;
579
580    ODU_SET_PROC_ID(DU_PROC);
581
582    /* Intel L1 using core 0-15. ODU-High using 16-21 */
583    /* system task for DU APP */
584    if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
585    {
586       DU_LOG("\nERROR  -->  DU_APP : System Task creation for DU APP failed");
587       return RFAILED;
588    }
589    //ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
590
591    /* system task for EGTP */
592    if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
593    {
594       DU_LOG("\nERROR  -->  DU_APP : System Task creation for EGTP failed");
595       return RFAILED;
596    }
597    //ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0);
598
599    /* system task for RLC_DL and MAC */
600    if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
601    {
602       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC DL/MAC failed");
603       return RFAILED;
604    }
605    pthread_attr_init(&attr);
606    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
607    //ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
608
609    /* system task for RLC UL */
610    if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
611    {
612       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC UL failed");
613       return RFAILED;
614    }
615    //ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0);
616    
617    /* system task for SCH */
618    if(ODU_CREATE_TASK(PRIOR1, &sch_stsk) != ROK)
619    {
620       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCH failed");
621       return RFAILED;
622    }
623    //ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0);
624
625    /* system task for SCTP receiver thread */
626    if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
627    {
628       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCTP failed");
629       return RFAILED;
630    }
631    //ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0);
632
633    /* system task for lower-mac receiver thread */
634    if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
635    {
636       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Lower MAC failed");
637       return RFAILED;
638    }
639    //ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
640
641 #ifndef INTEL_WLS_MEM
642    /* system task for phy stub's slot indication generator thread */
643    if(ODU_CREATE_TASK(PRIOR0, &phy_stub_slot_ind_stsk) != ROK)
644    {
645       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Phy stub slot indication generator failed. MAX STSK [%d]", SS_MAX_STSKS);
646       return RFAILED;
647    }
648
649 #endif
650
651    /* Create TAPA tasks */
652    if(duAppInit(du_app_stsk) != ROK)
653    {
654       DU_LOG("\nERROR  -->  DU_APP : DU APP TAPA Task initialization failed");
655       return RFAILED;
656    }
657
658    if(egtpInit(egtp_stsk) != ROK)
659    {
660       DU_LOG("\nERROR  -->  DU_APP : EGTP TAPA Task initialization failed");
661       return RFAILED;
662    }
663
664    if(sctpInit(sctp_stsk) != ROK)
665    {
666       DU_LOG("\nERROR  -->  DU_APP : SCTP TAPA Task initialization failed");
667       return RFAILED;
668    }
669
670    if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
671    {
672       DU_LOG("\nERROR  -->  DU_APP : RLC DL Tapa Task initialization failed");
673       return RFAILED;
674    } 
675
676    if(rlcUlInit(rlc_ul_stsk) != ROK)
677    {
678      DU_LOG("\nERROR  -->  DU_APP : RLC UL Tapa Task initialization failed");
679      return RFAILED;
680    } 
681
682    if(schInit(sch_stsk) != ROK)
683    {
684       DU_LOG("\nERROR  -->  DU_APP : SCH Tapa Task initialization failed");
685       return RFAILED;
686    }
687
688    if(lwrMacInit(lwr_mac_stsk) != ROK)
689    {
690       DU_LOG("\nERROR  -->  DU_APP : Lower MAC Tapa Task initialization failed");
691       return RFAILED;
692    }
693
694 #ifndef INTEL_WLS_MEM
695    if(phyStubInit(phy_stub_slot_ind_stsk) != ROK)
696    {
697       DU_LOG("\nERROR  -->  DU_APP : PHY stub slot indication Tapa Task initialization failed");
698       return RFAILED;
699    }
700 #endif
701
702
703    return ROK;
704 }
705
706 /*******************************************************************
707  *
708  * @brief Initializes the DU
709  *
710  * @details
711  *
712  *    Function : duInit
713  *
714  *    Functionality:
715  *       - Calls commonInit
716  *       - Registers DU Layers
717  *
718  * @params[in] void
719  * @return ROK     - success
720  *         RFAILED - failure
721  *
722  * ****************************************************************/
723 uint8_t duInit()
724 {
725    int ret = ROK;
726    if(commonInit() != ROK)
727    {
728       ret = RFAILED;
729    } 
730    return ret;
731 }
732
733 void init_log()
734 {
735         openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
736 }
737
738 /*******************************************************************
739  *
740  * @brief Entry point for the DU APP 
741  *
742  * @details
743  *
744  *    Function : main
745  *
746  *    Functionality:
747  *      - Read config params into duCfgParams
748  *      - Initiate the init functions
749  *
750  * @params[in] void
751  * @return ROK     - success
752  *         RFAILED - failure
753  *
754  * ****************************************************************/
755 uint8_t tst(void)
756 {
757    init_log();
758 #ifdef O1_ENABLE
759    if(start_O1_module() != ROK)
760       return RFAILED;
761 #endif
762    //Initialize TAPA layers
763    if(duInit() != ROK)
764    {
765       return RFAILED;
766    } 
767
768    //Read all the configs from du_utils.c into duCfgParams
769 #ifndef O1_ENABLE
770    duReadCfg();
771 #endif
772
773 #ifdef O1_ENABLE
774    //Send VES PNF registration message to SMO
775    sendPnfRegistration();
776 #endif
777
778    return ROK;
779
780 }/* end of main()*/
781
782 /**********************************************************************
783          End of file
784 **********************************************************************/