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