f787284686ea00b9f5e7b9caa6940a36ab9c0136
[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  }
412
413 /*******************************************************************
414  *
415  * @brief Initializes SCH TAPA task
416  *
417  * @details
418  *
419  *    Function : schInit
420  *
421  *    Functionality:
422  *       - Registers and attaches TAPA tasks for SCH
423  *
424  * @params[in] system task ID
425  * @return ROK     - success
426  *         RFAILED - failure
427  *
428  * ****************************************************************/
429  uint8_t schInit(SSTskId sysTskId)
430  {
431    /* Register SCH TAPA Task */
432    if(ODU_REG_TTSK((Ent)ENTMAC, (Inst)SCH_INST_START, (Ttype)TTNORM, (Prior)PRIOR0,
433             schActvInit, (ActvTsk)schActvTsk) != ROK)
434    {
435       return RFAILED;
436    }
437    /* Attach SCH Task */
438    if (ODU_ATTACH_TTSK((Ent)ENTMAC, (Inst)SCH_INST_START, sysTskId)!= ROK)
439    {
440       return RFAILED;
441    }
442
443
444    DU_LOG("\nINFO   -->  DU_APP : SCH TAPA task created and registered to \
445          %d sys task", sysTskId);
446    return ROK;
447 }
448
449 /*******************************************************************
450  *
451  * @brief Initializes RLC UL TAPA task
452  *
453  * @details
454  *
455  *    Function : rlcUlInit
456  *
457  *    Functionality:
458  *       - Registers and attaches TAPA task for RLC UL
459  *
460  * @params[in] system task ID
461  * @return ROK     - success
462  *         RFAILED - failure
463  *
464  * ****************************************************************/
465 uint8_t rlcUlInit(SSTskId sysTskId)
466 {
467    /* Register RLC UL TAPA Task */
468    if(ODU_REG_TTSK((Ent)ENTRLC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
469             rlcUlActvInit, (ActvTsk)rlcUlActvTsk) != ROK)
470    {
471       return RFAILED;
472    }
473    /* Attach RLC DL Task */
474    if (ODU_ATTACH_TTSK((Ent)ENTRLC, (Inst)0, sysTskId)!= ROK)
475    {
476       return RFAILED;
477    }
478    DU_LOG("\nINFO   -->  DU_APP : RLC UL TAPA task created and registered to \
479    %d sys task", sysTskId);
480    return ROK;
481 }
482
483 /*******************************************************************
484  *
485  * @brief Initializes Lower MAC receiver task
486  *
487  * @details
488  *
489  *    Function : lwrMacInit
490  *
491  *    Functionality:
492  *       - Registers and attaches TAPA tasks for Lower MAC receiver
493  *
494  * @params[in] system task ID
495  * @return ROK     - success
496  *         RFAILED - failure
497  *
498  * ****************************************************************/
499 uint8_t lwrMacInit(SSTskId sysTskId)
500 {
501    /* Register SCTP TAPA Task */
502    if(ODU_REG_TTSK((Ent)ENTLWRMAC, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
503             lwrMacActvInit, (ActvTsk)lwrMacActvTsk) != ROK)
504    {
505       return RFAILED;
506    }
507    /* Attach SCTP TAPA Task */
508    if (ODU_ATTACH_TTSK((Ent)ENTLWRMAC, (Inst)0, sysTskId)!= ROK)
509    {
510       return RFAILED;
511    }
512
513    DU_LOG("\nINFO   -->  DU_APP : LWR MAC TAPA task created and registered to %d sys task",
514          sysTskId);
515    return ROK;
516 }
517
518 #ifndef INTEL_WLS_MEM
519 /*******************************************************************
520  *
521  * @brief Initializes Phy stub slot indication generator task
522  *
523  * @details
524  *
525  *    Function : phyStubInit
526  *
527  *    Functionality:
528  *       - Registers and attaches TAPA tasks for Phy stub's slot
529  *       indication generator
530  *
531  * @params[in] system task ID
532  * @return ROK     - success
533  *         RFAILED - failure
534  *
535  * ****************************************************************/
536 uint8_t phyStubInit(SSTskId sysTskId)
537 {
538    /* Register PHY stub slot indication TAPA Task */
539    if(ODU_REG_TTSK((Ent)ENTPHYSTUB, (Inst)0, (Ttype)TTNORM, (Prior)PRIOR0,
540             phyStubActvInit, (ActvTsk)phyStubActvTsk) != ROK)
541    {
542       return RFAILED;
543    }
544    /* Attach Phy stub slot indication TAPA Task */
545    if (ODU_ATTACH_TTSK((Ent)ENTPHYSTUB, (Inst)0, sysTskId)!= ROK)
546    {
547       return RFAILED;
548    }
549
550    DU_LOG("\nINFO   -->  DU_APP : PHY stub slot indication TAPA task created and registered to %d sys task",
551          sysTskId);
552    return ROK;
553 }
554 #endif
555
556 /*******************************************************************
557  *
558  * @brief Initializes system and TAPA tasks
559  *
560  * @details
561  *
562  *    Function : commonInit
563  *
564  *    Functionality:
565  *       - Registers and attaches system and TAPA tasks
566  *
567  * @params[in] void
568  * @return ROK     - success
569  *         RFAILED - failure
570  *
571  * ****************************************************************/
572 uint8_t commonInit()
573 {
574    /* Declare system task Ids */
575    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;
576
577    pthread_attr_t attr;
578
579    ODU_SET_PROC_ID(DU_PROC);
580
581    /* Intel L1 using core 0-15. ODU-High using 16-21 */
582    /* system task for DU APP */
583    if(ODU_CREATE_TASK(PRIOR0, &du_app_stsk) != ROK)
584    {
585       DU_LOG("\nERROR  -->  DU_APP : System Task creation for DU APP failed");
586       return RFAILED;
587    }
588    ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 16, 0);
589
590    /* system task for EGTP */
591    if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK)
592    {
593       DU_LOG("\nERROR  -->  DU_APP : System Task creation for EGTP failed");
594       return RFAILED;
595    }
596    ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 27, 0);
597
598    /* system task for RLC_DL and MAC */
599    if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK)
600    {
601       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC DL/MAC failed");
602       return RFAILED;
603    }
604    pthread_attr_init(&attr);
605    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
606    ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 18, 0);
607
608    /* system task for RLC UL */
609    if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK)
610    {
611       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC UL failed");
612       return RFAILED;
613    }
614    ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 22, 0);
615    
616    /* system task for SCH */
617    if(ODU_CREATE_TASK(PRIOR1, &sch_stsk) != ROK)
618    {
619       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCH failed");
620       return RFAILED;
621    }
622    ODU_SET_THREAD_AFFINITY(&sch_stsk, SS_AFFINITY_MODE_EXCL, 22, 0);
623
624    /* system task for SCTP receiver thread */
625    if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK)
626    {
627       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCTP failed");
628       return RFAILED;
629    }
630    ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 25, 0);
631
632    /* system task for lower-mac receiver thread */
633    if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK)
634    {
635       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Lower MAC failed");
636       return RFAILED;
637    }
638    ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 21, 0);
639
640 #ifndef INTEL_WLS_MEM
641    /* system task for phy stub's slot indication generator thread */
642    if(ODU_CREATE_TASK(PRIOR0, &phy_stub_slot_ind_stsk) != ROK)
643    {
644       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Phy stub slot indication generator failed. MAX STSK [%d]", SS_MAX_STSKS);
645       return RFAILED;
646    }
647
648 #endif
649
650    /* Create TAPA tasks */
651    if(duAppInit(du_app_stsk) != ROK)
652    {
653       DU_LOG("\nERROR  -->  DU_APP : DU APP TAPA Task initialization failed");
654       return RFAILED;
655    }
656
657    if(egtpInit(egtp_stsk) != ROK)
658    {
659       DU_LOG("\nERROR  -->  DU_APP : EGTP TAPA Task initialization failed");
660       return RFAILED;
661    }
662
663    if(sctpInit(sctp_stsk) != ROK)
664    {
665       DU_LOG("\nERROR  -->  DU_APP : SCTP TAPA Task initialization failed");
666       return RFAILED;
667    }
668
669    if(rlcDlInit(rlc_mac_cl_stsk) != ROK)
670    {
671       DU_LOG("\nERROR  -->  DU_APP : RLC DL Tapa Task initialization failed");
672       return RFAILED;
673    } 
674
675    if(rlcUlInit(rlc_ul_stsk) != ROK)
676    {
677      DU_LOG("\nERROR  -->  DU_APP : RLC UL Tapa Task initialization failed");
678      return RFAILED;
679    } 
680
681    if(schInit(sch_stsk) != ROK)
682    {
683       DU_LOG("\nERROR  -->  DU_APP : SCH Tapa Task initialization failed");
684       return RFAILED;
685    }
686
687    if(lwrMacInit(lwr_mac_stsk) != ROK)
688    {
689       DU_LOG("\nERROR  -->  DU_APP : Lower MAC Tapa Task initialization failed");
690       return RFAILED;
691    }
692
693 #ifndef INTEL_WLS_MEM
694    if(phyStubInit(phy_stub_slot_ind_stsk) != ROK)
695    {
696       DU_LOG("\nERROR  -->  DU_APP : PHY stub slot indication Tapa Task initialization failed");
697       return RFAILED;
698    }
699 #endif
700
701
702    return ROK;
703 }
704
705 /*******************************************************************
706  *
707  * @brief Initializes the DU
708  *
709  * @details
710  *
711  *    Function : duInit
712  *
713  *    Functionality:
714  *       - Calls commonInit
715  *       - Registers DU Layers
716  *
717  * @params[in] void
718  * @return ROK     - success
719  *         RFAILED - failure
720  *
721  * ****************************************************************/
722 uint8_t duInit()
723 {
724    int ret = ROK;
725    if(commonInit() != ROK)
726    {
727       ret = RFAILED;
728    } 
729    return ret;
730 }
731
732 void init_log()
733 {
734         openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
735 }
736
737 /*******************************************************************
738  *
739  * @brief Entry point for the DU APP 
740  *
741  * @details
742  *
743  *    Function : main
744  *
745  *    Functionality:
746  *      - Read config params into duCfgParams
747  *      - Initiate the init functions
748  *
749  * @params[in] void
750  * @return ROK     - success
751  *         RFAILED - failure
752  *
753  * ****************************************************************/
754 uint8_t tst(void)
755 {
756    init_log();
757 #ifdef O1_ENABLE
758    if(start_O1_module() != ROK)
759       return RFAILED;
760 #endif
761    //Initialize TAPA layers
762    if(duInit() != ROK)
763    {
764       return RFAILED;
765    } 
766
767    //Read all the configs from du_utils.c into duCfgParams
768 #ifndef O1_ENABLE
769    duReadCfg();
770 #endif
771
772 #ifdef O1_ENABLE
773    //Send VES PNF registration message to SMO
774    sendPnfRegistration();
775 #endif
776
777    return ROK;
778
779 }/* end of main()*/
780
781 /**********************************************************************
782          End of file
783 **********************************************************************/