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