f7d4e2af6dc77aede6fca82f03d1ed12849d0a37
[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 phyStubSlotIndSTskId;
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, &duCfgParam.threadInfo.duAppSTskId) != ROK)
585    {
586       DU_LOG("\nERROR  -->  DU_APP : System Task creation for DU APP failed");
587       return RFAILED;
588    }
589
590    /* system task for EGTP */
591    if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.egtpSTskId) != ROK)
592    {
593       DU_LOG("\nERROR  -->  DU_APP : System Task creation for EGTP failed");
594       return RFAILED;
595    }
596
597    /* system task for RLC_DL and MAC */
598    if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.rlcMacSTskId) != ROK)
599    {
600       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC DL/MAC failed");
601       return RFAILED;
602    }
603    pthread_attr_init(&attr);
604    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
605
606    /* system task for RLC UL */
607    if(ODU_CREATE_TASK(PRIOR1, &duCfgParam.threadInfo.rlcUlSTskId) != ROK)
608    {
609       DU_LOG("\nERROR  -->  DU_APP : System Task creation for RLC UL failed");
610       return RFAILED;
611    }
612    
613    /* system task for SCH */
614    if(ODU_CREATE_TASK(PRIOR1, &duCfgParam.threadInfo.schSTskId) != ROK)
615    {
616       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCH failed");
617       return RFAILED;
618    }
619
620    /* system task for SCTP receiver thread */
621    if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.sctpSTskId) != ROK)
622    {
623       DU_LOG("\nERROR  -->  DU_APP : System Task creation for SCTP failed");
624       return RFAILED;
625    }
626
627    /* system task for lower-mac receiver thread */
628    if(ODU_CREATE_TASK(PRIOR0, &duCfgParam.threadInfo.lwrMacSTskId) != ROK)
629    {
630       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Lower MAC failed");
631       return RFAILED;
632    }
633
634 #ifndef INTEL_WLS_MEM
635    /* system task for phy stub's slot indication generator thread */
636    if(ODU_CREATE_TASK(PRIOR0, &phyStubSlotIndSTskId) != ROK)
637    {
638       DU_LOG("\nERROR  -->  DU_APP : System Task creation for Phy stub slot indication generator failed. MAX STSK [%d]", SS_MAX_STSKS);
639       return RFAILED;
640    }
641
642 #endif
643
644    /* Create TAPA tasks */
645    if(duAppInit(duCfgParam.threadInfo.duAppSTskId) != ROK)
646    {
647       DU_LOG("\nERROR  -->  DU_APP : DU APP TAPA Task initialization failed");
648       return RFAILED;
649    }
650
651    if(egtpInit(duCfgParam.threadInfo.egtpSTskId) != ROK)
652    {
653       DU_LOG("\nERROR  -->  DU_APP : EGTP TAPA Task initialization failed");
654       return RFAILED;
655    }
656
657    if(sctpInit(duCfgParam.threadInfo.sctpSTskId) != ROK)
658    {
659       DU_LOG("\nERROR  -->  DU_APP : SCTP TAPA Task initialization failed");
660       return RFAILED;
661    }
662
663    if(rlcDlInit(duCfgParam.threadInfo.rlcMacSTskId) != ROK)
664    {
665       DU_LOG("\nERROR  -->  DU_APP : RLC DL Tapa Task initialization failed");
666       return RFAILED;
667    } 
668
669    if(rlcUlInit(duCfgParam.threadInfo.rlcUlSTskId) != ROK)
670    {
671      DU_LOG("\nERROR  -->  DU_APP : RLC UL Tapa Task initialization failed");
672      return RFAILED;
673    } 
674
675    if(schInit(duCfgParam.threadInfo.schSTskId) != ROK)
676    {
677       DU_LOG("\nERROR  -->  DU_APP : SCH Tapa Task initialization failed");
678       return RFAILED;
679    }
680
681    if(lwrMacInit(duCfgParam.threadInfo.lwrMacSTskId) != ROK)
682    {
683       DU_LOG("\nERROR  -->  DU_APP : Lower MAC Tapa Task initialization failed");
684       return RFAILED;
685    }
686
687 #ifndef INTEL_WLS_MEM
688    if(phyStubInit(phyStubSlotIndSTskId) != ROK)
689    {
690       DU_LOG("\nERROR  -->  DU_APP : PHY stub slot indication Tapa Task initialization failed");
691       return RFAILED;
692    }
693 #endif
694
695
696    return ROK;
697 }
698
699 /*******************************************************************
700  *
701  * @brief Initializes the DU
702  *
703  * @details
704  *
705  *    Function : duInit
706  *
707  *    Functionality:
708  *       - Calls commonInit
709  *       - Registers DU Layers
710  *
711  * @params[in] void
712  * @return ROK     - success
713  *         RFAILED - failure
714  *
715  * ****************************************************************/
716 uint8_t duInit()
717 {
718    int ret = ROK;
719    if(commonInit() != ROK)
720    {
721       ret = RFAILED;
722    } 
723    return ret;
724 }
725
726 void init_log()
727 {
728         openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
729 }
730
731 /*******************************************************************
732  *
733  * @brief Entry point for the DU APP 
734  *
735  * @details
736  *
737  *    Function : main
738  *
739  *    Functionality:
740  *      - Read config params into duCfgParams
741  *      - Initiate the init functions
742  *
743  * @params[in] void
744  * @return ROK     - success
745  *         RFAILED - failure
746  *
747  * ****************************************************************/
748 uint8_t tst(void)
749 {
750    init_log();
751 #ifdef O1_ENABLE
752    if(start_O1_module() != ROK)
753       return RFAILED;
754 #endif
755
756    memset(&duCfgParam, 0, sizeof(DuCfgParams));
757
758    //Initialize TAPA layers
759    if(duInit() != ROK)
760    {
761       return RFAILED;
762    } 
763
764    //Read all the configs from du_utils.c into duCfgParams
765 #ifndef O1_ENABLE
766    duReadCfg();
767 #endif
768
769 #ifdef O1_ENABLE
770    //Send VES PNF registration message to SMO
771    sendPnfRegistration();
772 #endif
773
774    return ROK;
775
776 }/* end of main()*/
777
778 /**********************************************************************
779          End of file
780 **********************************************************************/