f0c8f3c5d5b636286060ccfc1451aabcd4d6ec26
[o-du/l2.git] / src / cm / du_app_mac_inf.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 #include "common_def.h"
20 #include "du_app_mac_inf.h"
21 /********************* Global Variable ********************/
22 uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */
23
24 /**************************************************************************
25  * @brief Function to pack Loose Coupled 
26  *        MAC cell config parameters required by MAC
27  *
28  * @details
29  *
30  *      Function : packMacCellCfg
31  *
32  *      Functionality:
33  *           packs the macCellCfg parameters
34  *
35  * @param[in] Pst     *pst, Post structure of the primitive.
36  * @param[in] MacCellCfg  *macCellCfg, mac cell config parameters.
37  * @return ROK     - success
38  *         RFAILED - failure
39  *
40  ***************************************************************************/
41 uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
42 {
43    if(pst->selector == ODU_SELECTOR_LC)
44    {
45       /* we are now implemented only light wieght lossely coupled interface */
46       return RFAILED;
47    }
48    else if(pst->selector == ODU_SELECTOR_LWLC)
49    {
50       Buffer *mBuf = NULLP;
51
52       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) 
53       {
54          return RFAILED;
55       }
56
57       /* pack the address of the structure */
58       CMCHKPK(oduPackPointer,(PTR)macCellCfg, mBuf);
59
60       DU_LOG("\nDEBUG  -->  DU-APP : MAC CELL config sent");
61       return ODU_POST_TASK(pst,mBuf);
62    } 
63    return ROK;
64 }
65
66 /**************************************************************************
67  * @brief Function to pack Loose Coupled 
68  *        MAC cell config parameters required by MAC
69  *
70  * @details
71  *
72  *      Function : unpackDuMacCellCfg
73  *
74  *      Functionality:
75  *           packs the macCellCfg parameters
76  *
77  * @param[in] DuMacCellCfgReq func; function pointer
78  * @param[in] Pst     *pst, Post structure of the primitive.
79  * @param[in] Buffer *mBuf
80  * @return ROK     - success
81  *         RFAILED - failure
82  *
83  ***************************************************************************/
84 uint8_t  unpackDuMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf)
85 {
86    uint16_t ret = ROK;
87    MacCellCfg *macCellCfg;
88
89    if(pst->selector == ODU_SELECTOR_LWLC)
90    {
91       /* unpack the address of the structure */
92       CMCHKUNPK(oduUnpackPointer, (PTR *)&macCellCfg, mBuf);
93       ret = (*func)(pst, macCellCfg);
94    }
95    else
96    {
97       /* only LWLC is implemented now */
98       ret = ROK;
99    }
100
101    return ret;
102 }
103
104 /**************************************************************************
105  * @brief Function to pack Loose Coupled 
106  *        MAC cell config confirm message
107  *
108  * @details
109  *
110  *      Function : packMacCellCfgCfm
111  *
112  *      Functionality:
113  *           packs the transaction ID  
114  *
115  * @param[in] Pst     *pst, Post structure of the primitive.
116  * @param[in] MacCellCfgCfm  *macCellCfgCfm, mac cell config confirm.
117  * @return ROK     - success
118  *         RFAILED - failure
119  *
120  ***************************************************************************/
121 uint8_t  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
122 {
123    if(pst->selector == ODU_SELECTOR_LC)
124    {
125       Buffer *mBuf = NULLP;
126       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) 
127       {
128          return RFAILED;
129       }
130
131       /* pack the transaction ID in CNF structure */
132       CMCHKPK(oduUnpackUInt16, macCellCfgCfm->cellId, mBuf);
133       CMCHKPK(oduUnpackUInt8, macCellCfgCfm->rsp, mBuf);
134
135       return ODU_POST_TASK(pst,mBuf);
136    }
137    else if(pst->selector == ODU_SELECTOR_LWLC)
138    {
139       /* only LC is supported */
140       return RFAILED;
141    }
142    return ROK;
143 }
144
145 /**************************************************************************
146  * @brief Function to pack MAC cell config confirm message
147  *
148  * @details
149  *
150  *      Function : unpackMacCellCfgCfm
151  *
152  *      Functionality:
153  *           packs the transaction ID  
154  *
155  * @param[in] DuMacCellCfgCfm func; function pointer
156  * @param[in] Pst     *pst, Post structure of the primitive.
157  * @param[in] Buffer *mBuf
158  * @return ROK     - success
159  *         RFAILED - failure
160  *
161  ***************************************************************************/
162 uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf)
163 {
164    MacCellCfgCfm macCellCfgCfm;
165
166    if(pst->selector == ODU_SELECTOR_LC)
167    {
168       /* unpack the transaction ID in CNF structure */
169       CMCHKUNPK(oduPackUInt8, &(macCellCfgCfm.rsp), mBuf);
170       CMCHKUNPK(oduPackUInt16, &(macCellCfgCfm.cellId), mBuf);
171       return (*func)(pst, &macCellCfgCfm);
172    }
173    else
174    {
175       /* only loose coupling is suported */
176       return ROK;
177    }
178 }
179
180 /*******************************************************************
181  *
182  * @brief Packs and Send Cell Start Request to MAC
183  *
184  * @details
185  *
186  *    Function : packMacCellStart
187  *
188  *    Functionality:
189  *      Packs and Sends Cell Start Request to MAC
190  *
191  * @params[in] Post structure pointer
192  *             Cell Id
193  * @return ROK     - success
194  *         RFAILED - failure
195  *
196  * ****************************************************************/
197 uint8_t packMacCellStart(Pst *pst, CellStartInfo *cellStart)
198 {
199    Buffer *mBuf = NULLP;
200
201    if(pst->selector == ODU_SELECTOR_LC)
202    {
203       /* Loose coupling not supported */
204       return RFAILED;
205    }
206    else if(pst->selector == ODU_SELECTOR_LWLC)
207    {
208
209       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
210       {
211          DU_LOG("\nERROR  --> DU APP : Memory allocation failed for cell start req pack");
212          return RFAILED;
213       }
214
215       /* pack the address of the structure */
216       CMCHKPK(oduPackPointer,(PTR)cellStart, mBuf);
217
218    }
219    return ODU_POST_TASK(pst,mBuf);
220 }
221
222 /*******************************************************************
223  *
224  * @brief Unpacks MAC Cell Start Request from DU APP
225  *
226  * @details
227  *
228  *    Function : unpackMaCellStart
229  *
230  *    Functionality:
231  *      Unpacks MAC Cell Start Request from DU APP
232  *
233  * @params[in] Function pointer of cell start request handler
234  *             Post structure pointer
235  *             Message Buffer
236  * @return ROK     - success
237  *         RFAILED - failure
238  *
239  * ****************************************************************/
240 uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf)
241 {
242    CellStartInfo  *cellStart;
243
244    if(pst->selector == ODU_SELECTOR_LWLC)
245    {
246       /* unpack the address of the structure */
247       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStart, mBuf);
248       ODU_PUT_MSG_BUF(mBuf); 
249       return (*func)(pst, cellStart);
250    }
251    else
252    {
253       /* Nothing to do for loose coupling */
254       ODU_PUT_MSG_BUF(mBuf);
255       return ROK;
256    }
257 }
258
259 /*******************************************************************
260  *
261  * @brief Packs and Send cell stop request to MAC
262  *
263  * @details
264  *
265  *    Function : packMacCellStop
266  *
267  *    Functionality:
268  *       Packs and Send cell stop request to MAC
269  *
270  * @params[in] Post structure pointer
271  *             Cell Id 
272  * @return ROK     - success
273  *         RFAILED - failure
274  *
275  * ****************************************************************/
276 uint8_t packMacCellStop(Pst *pst, CellStopInfo *cellStop)
277 {
278    if(pst->selector == ODU_SELECTOR_LC)
279    {
280       /* Loose coupling not supported */
281       return RFAILED;
282    }
283    else if(pst->selector == ODU_SELECTOR_LWLC)
284    {
285       Buffer *mBuf = NULLP;
286
287       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
288       {
289          DU_LOG("\nERROR  --> DU APP : Memory allocation failed for cell stop req pack");
290          return RFAILED;
291       }
292
293       /* pack the address of the structure */
294       CMCHKPK(oduPackPointer,(PTR)cellStop, mBuf);
295
296       return ODU_POST_TASK(pst,mBuf);
297    }
298    return ROK;
299 }
300
301 /*******************************************************************
302  *
303  * @brief Unpacks cell stop request from DU APP 
304  *
305  * @details
306  *
307  *    Function : unpackMaCellStop 
308  *
309  *    Functionality:
310  *       Unpacks cell stop request from DU APP 
311  *
312  * @params[in] Handler function pointer
313  *             Post structure pointer
314  *             Message Buffer
315  * @return ROK     - success
316  *         RFAILED - failure
317  *
318  * ****************************************************************/
319 uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf)
320 {
321    CellStopInfo *cellStop;
322    
323    if(pst->selector == ODU_SELECTOR_LWLC)
324    {
325       /* unpack the address of the structure */
326       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStop, mBuf);
327       ODU_PUT_MSG_BUF(mBuf);
328       return (*func)(pst, cellStop);
329    }
330    else
331    {
332       /* Nothing to do for loose coupling */
333       ODU_PUT_MSG_BUF(mBuf);
334       return ROK;
335    }
336 }
337
338 /*******************************************************************
339  *
340  * @brief Packs and Sends cell up ind from MAC to DUAPP
341  *
342  * @details
343  *
344  *    Function : packMacCellUpInd
345  *
346  *    Functionality:
347  *       Packs and Sends cell up ind from MAC to DUAPP
348  *
349  * @params[in] Post structure pointer
350  *             Cell Id
351  * @return ROK     - success
352  *         RFAILED - failure
353  *
354  * ****************************************************************/
355 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId)
356 {
357    Buffer *mBuf = NULLP;
358
359    if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
360    {
361       DU_LOG("\nERROR  --> DU APP : Memory allocation failed for packMacCellUpInd");
362       return RFAILED;
363    }
364
365    if(pst->selector == ODU_SELECTOR_LC)
366    {
367       CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf);
368       CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
369       cellId = NULL;
370    }
371    else if(pst->selector == ODU_SELECTOR_LWLC)
372    {
373       /* pack the address of the structure */
374       CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
375    }
376    else
377    {
378       ODU_PUT_MSG_BUF(mBuf);
379    }
380
381    return ODU_POST_TASK(pst, mBuf);
382 }
383
384 /*******************************************************************
385  *
386  * @brief Unpacks cell up indication from MAC
387  *
388  * @details
389  *
390  *    Function : unpackMacCellUpInd
391  *
392  *    Functionality:
393  *         Unpacks cell up indication from MAC
394  *
395  * @params[in] Pointer to Handler
396  *             Post structure pointer
397  *             Message Buffer
398  * @return ROK     - success
399  *         RFAILED - failure
400  *
401  * ****************************************************************/
402 uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf)
403 {
404    if(pst->selector == ODU_SELECTOR_LWLC)
405    {
406       OduCellId *cellId;
407
408       /* unpack the address of the structure */
409       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
410       ODU_PUT_MSG_BUF(mBuf);
411       return (*func)(pst, cellId);
412    }
413    else if(pst->selector == ODU_SELECTOR_LC)
414    {
415       OduCellId cellId;
416       CMCHKUNPK(oduPackUInt16, &cellId.cellId, mBuf);
417       ODU_PUT_MSG_BUF(mBuf);
418       return (*func)(pst, &cellId);
419    }
420    else
421    {
422       /* Nothing to do for loose coupling */
423       ODU_PUT_MSG_BUF(mBuf);
424       return ROK;
425    }
426    return ROK;
427 }
428
429 /*******************************************************************
430  *
431  * @brief Packs and Sends stop ind from MAC to DUAPP
432  *
433  * @details
434  *
435  *    Function : packMacStopInd
436  *
437  *    Functionality:
438  *       Packs and Sends stop ind from MAC to DUAPP
439  *
440  * @params[in] Post structure pointer
441  * @return ROK     - success
442  *         RFAILED - failure
443  *
444  * ****************************************************************/
445 uint8_t packMacStopInd(Pst *pst, OduCellId *cellId)
446 {
447    Buffer *mBuf = NULLP;
448
449    if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
450    {
451       DU_LOG("\nERROR  --> DU APP : Memory allocation failed for stop Ind pack");
452       return RFAILED;
453    }
454
455    if(pst->selector == ODU_SELECTOR_LC)
456    {
457       /*pack the payload here*/
458       CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf);
459       CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
460       cellId = NULL;
461    }
462    else if(pst->selector == ODU_SELECTOR_LWLC)
463    {
464       /* pack the address of the structure */
465       CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
466    }
467    else
468    {
469       ODU_PUT_MSG_BUF(mBuf);
470    }
471
472    return ODU_POST_TASK(pst,mBuf);
473 }
474
475 /*******************************************************************
476  *
477  * @brief Unpacks stop indication from MAC
478  *
479  * @details
480  *
481  *    Function : unpackMacStopInd
482  *
483  *    Functionality:
484  *         Unpacks stop indication from MAC
485  *
486  * @params[in] Pointer to Handler
487  *             Post structure pointer
488  *             Message Buffer
489  * @return ROK     - success
490  *         RFAILED - failure
491  *
492  * ****************************************************************/
493 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
494 {
495    if(pst->selector == ODU_SELECTOR_LWLC)
496    {
497       OduCellId *cellId=NULLP;
498       /* unpack the address of the structure */
499       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
500       ODU_PUT_MSG_BUF(mBuf);
501       return (*func)(pst, cellId);
502    }
503    else if(pst->selector == ODU_SELECTOR_LC)
504    {
505       OduCellId cellId;
506       CMCHKUNPK(oduPackUInt16, &(cellId.cellId), mBuf);
507
508       ODU_PUT_MSG_BUF(mBuf);
509       return (*func)(pst, &cellId);
510
511    }
512    else
513    {
514       /* Nothing to do for loose coupling */
515       ODU_PUT_MSG_BUF(mBuf);
516       return ROK;
517    }
518    return ROK;
519 }
520
521 /*******************************************************************
522  *
523  * @brief Packs and Sends UL CCCH Ind from MAC to DUAPP
524  *
525  * @details
526  *
527  *    Function : packMacUlCcchInd
528  *
529  *    Functionality:
530  *       Packs and Sends UL CCCH Ind from MAC to DUAPP
531  *
532  * @params[in] Post structure pointer
533  *             UL CCCH Ind pointer              
534  * @return ROK     - success
535  *         RFAILED - failure
536  *
537  * ****************************************************************/
538 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
539 {
540    Buffer *mBuf = NULLP;
541
542    if(pst->selector == ODU_SELECTOR_LWLC)
543    {
544       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
545       {
546          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packMacUlCcchInd");
547          return RFAILED;
548       }
549       /* pack the address of the structure */
550       CMCHKPK(oduPackPointer,(PTR)ulCcchIndInfo, mBuf);
551    }
552    else
553    {
554       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for UL CCCH Ind ");
555       return RFAILED;
556    }
557
558    return ODU_POST_TASK(pst,mBuf);
559 }
560
561 /*******************************************************************
562  *
563  * @brief Unpacks UL CCCH indication from MAC
564  *
565  * @details
566  *
567  *    Function : unpackMacUlCcchInd
568  *
569  *    Functionality:
570  *         Unpacks UL CCCH indication from MAC
571  *
572  * @params[in] Pointer to Handler
573  *             Post structure pointer
574  *             Message Buffer
575  * @return ROK     - success
576  *         RFAILED - failure
577  *
578  * ****************************************************************/
579 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
580 {
581    if(pst->selector == ODU_SELECTOR_LWLC)
582    {
583       UlCcchIndInfo *ulCcchIndInfo;
584
585       /* unpack the address of the structure */
586       CMCHKUNPK(oduUnpackPointer, (PTR *)&ulCcchIndInfo, mBuf);
587       ODU_PUT_MSG_BUF(mBuf);
588       return (*func)(pst, ulCcchIndInfo);
589    }
590    else
591    {
592       /* Nothing to do for other selectors */
593       DU_LOG("\nERROR  -->  MAC : Only LWLC supported for UL CCCH Ind ");
594       ODU_PUT_MSG_BUF(mBuf);
595    }
596    return RFAILED;
597 }
598
599 /*******************************************************************
600  *
601  * @brief Packs and Sends DL CCCH Ind from DUAPP to MAC
602  *
603  * @details
604  *
605  *    Function : packMacDlCcchInd
606  *
607  *    Functionality:
608  *       Packs and Sends DL CCCH Ind from DUAPP to MAC
609  *
610  *
611  * @params[in] Post structure pointer
612  *             DL CCCH Ind pointer              
613  * @return ROK     - success
614  *         RFAILED - failure
615  *
616  * ****************************************************************/
617 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
618 {
619    Buffer *mBuf = NULLP;
620
621    if(pst->selector == ODU_SELECTOR_LWLC)
622    {
623       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
624       {
625          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packMacDlCcchInd");
626          return RFAILED;
627       }
628       /* pack the address of the structure */
629       CMCHKPK(oduPackPointer,(PTR)dlCcchIndInfo, mBuf);
630    }
631    else
632    {
633       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for DL CCCH Ind ");
634       return RFAILED;
635    }
636
637    return ODU_POST_TASK(pst,mBuf);
638 }
639
640 /*******************************************************************
641  *
642  * @brief Unpacks DL CCCH indication from DU APP
643  *
644  * @details
645  *
646  *    Function : unpackMacDlCcchInd
647  *
648  *    Functionality:
649  *         Unpacks DL CCCH indication from DU APP
650  *
651  * @params[in] Pointer to Handler
652  *             Post structure pointer
653  *             Message Buffer
654  * @return ROK     - success
655  *         RFAILED - failure
656  *
657  * ****************************************************************/
658 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
659 {
660    if(pst->selector == ODU_SELECTOR_LWLC)
661    {
662       DlCcchIndInfo *dlCcchIndInfo;
663
664       /* unpack the address of the structure */
665       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlCcchIndInfo, mBuf);
666       ODU_PUT_MSG_BUF(mBuf);
667       return (*func)(pst, dlCcchIndInfo);
668    }
669    else
670    {
671       /* Nothing to do for other selectors */
672       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for DL CCCH Ind ");
673       ODU_PUT_MSG_BUF(mBuf);
674    }
675
676    return RFAILED;
677 }
678
679 /*******************************************************************
680  *
681  * @brief Packs and Sends UE create Request from DUAPP to MAC
682  *
683  * @details
684  *
685  *    Function : packDuMacUeCreateReq
686  *
687  *    Functionality:
688  *       Packs and Sends UE Create Request from DUAPP to MAC
689  *
690  *
691  * @params[in] Post structure pointer
692  *             MacUeCreateReq pointer              
693  * @return ROK     - success
694  *         RFAILED - failure
695  *
696  * ****************************************************************/
697 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCreateReq *ueCfg)
698 {
699    Buffer *mBuf = NULLP;
700
701    if(pst->selector == ODU_SELECTOR_LWLC)
702    {
703       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
704       {
705          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeCreateReq");
706          return RFAILED;
707       }
708       /* pack the address of the structure */
709       CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
710    }
711    else
712    {
713       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeCreateReq");
714       return RFAILED;
715    }
716
717    return ODU_POST_TASK(pst,mBuf);
718 }
719
720 /*******************************************************************
721  *
722  * @brief Unpacks UE Create Request received from DU APP
723  *
724  * @details
725  *
726  *    Function : unpackMacUeCreateReq
727  *
728  *    Functionality:
729  *         Unpacks UE Create Request received from DU APP
730  *
731  * @params[in] Pointer to Handler
732  *             Post structure pointer
733  *             Message Buffer
734  * @return ROK     - success
735  *         RFAILED - failure
736  *
737  * ****************************************************************/
738 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
739 {
740    if(pst->selector == ODU_SELECTOR_LWLC)
741    {
742       MacUeCreateReq *ueCfg;
743
744       /* unpack the address of the structure */
745       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
746       ODU_PUT_MSG_BUF(mBuf);
747       return (*func)(pst, ueCfg);
748    }
749    else
750    {
751       /* Nothing to do for other selectors */
752       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for UE Create Request ");
753       ODU_PUT_MSG_BUF(mBuf);
754    }
755
756    return RFAILED;
757 }
758
759 /*******************************************************************
760  *
761  * @brief Pack and send UE create response from MAC to DU APP
762  *
763  * @details
764  *
765  *    Function : packDuMacUeCreateRsp
766  *
767  *    Functionality:
768  *       Pack and send UE create response from MAC to DU APP
769  *
770  * @params[in] 
771  * @return ROK     - success
772  *         RFAILED - failure
773  *
774  * ****************************************************************/
775 uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCreateRsp *cfgRsp)
776 {
777    Buffer *mBuf = NULLP;
778
779    if(pst->selector == ODU_SELECTOR_LWLC)
780    {
781       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
782       {
783          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeCreateRsp");
784          return RFAILED;
785       }
786       /* pack the address of the structure */
787       CMCHKPK(oduPackPointer,(PTR)cfgRsp, mBuf);
788    }
789    else
790    {
791       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeCreateRsp");
792       return RFAILED;
793    }
794
795    return ODU_POST_TASK(pst,mBuf);
796 }
797 /*******************************************************************
798  *
799  * @brief Unpack UE Create Response from MAC to DU APP
800  *
801  * @details
802  *
803  *    Function :unpackDuMacUeCreateRsp 
804  *
805  *    Functionality: Unpack UE Create Response from MAC to DU APP
806  *
807  * @params[in] 
808  * @return ROK     - success
809  *         RFAILED - failure
810  *
811  * ****************************************************************/
812 uint8_t unpackDuMacUeCreateRsp(MacDuUeCreateRspFunc func, Pst *pst, Buffer *mBuf)
813 {
814    if(pst->selector == ODU_SELECTOR_LWLC)
815    {
816       MacUeCreateRsp *cfgRsp = NULLP;
817
818       /* unpack the address of the structure */
819       CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
820       ODU_PUT_MSG_BUF(mBuf);
821       return (*func)(pst, cfgRsp);
822    }
823
824    ODU_PUT_MSG_BUF(mBuf);
825    return RFAILED;
826 }
827
828 /*******************************************************************
829  *
830  * @brief Packs and Sends UE Reconig Request from DUAPP to MAC
831  *
832  * @details
833  *
834  *    Function : packDuMacUeReconfigReq
835  *
836  *    Functionality:
837  *       Packs and Sends UE Reconfig Request from DUAPP to MAC
838  *
839  *
840  * @params[in] Post structure pointer
841  *             MacUeRecfg pointer              
842  * @return ROK     - success
843  *         RFAILED - failure
844  *
845  * ****************************************************************/
846 uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeRecfg *ueCfg)
847 {
848    Buffer *mBuf = NULLP;
849
850    if(pst->selector == ODU_SELECTOR_LWLC)
851    {
852       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
853       {
854          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeReconfigReq");
855          return RFAILED;
856       }
857       /* pack the address of the structure */
858       CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
859    }
860    else
861    {
862       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeReconfigReq");
863       return RFAILED;
864    }
865
866    return ODU_POST_TASK(pst,mBuf);
867 }
868
869 /*******************************************************************
870  *
871  * @brief Unpacks UE Reconfig Request received from DU APP
872  *
873  * @details
874  *
875  *    Function : unpackMacUeReconfigReq
876  *
877  *    Functionality:
878  *         Unpacks UE Reconfig Request received from DU APP
879  *
880  * @params[in] Pointer to Handler
881  *             Post structure pointer
882  *             Message Buffer
883  * @return ROK     - success
884  *         RFAILED - failure
885  *
886  * ****************************************************************/
887 uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf)
888 {
889    if(pst->selector == ODU_SELECTOR_LWLC)
890    {
891       MacUeRecfg *ueRecfg;
892
893       /* unpack the address of the structure */
894       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueRecfg, mBuf);
895       ODU_PUT_MSG_BUF(mBuf);
896       return (*func)(pst, ueRecfg);
897    }
898    else
899    {
900       /* Nothing to do for other selectors */
901       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for UE Create Request ");
902       ODU_PUT_MSG_BUF(mBuf);
903    }
904
905    return RFAILED;
906 }
907
908 /*******************************************************************
909  *
910  * @brief Pack and send UE Reconfig response from MAC to DU APP
911  *
912  * @details
913  *
914  *    Function : packDuMacUeRecfgRsp
915  *
916  *    Functionality:
917  *       Pack and send UE Reconfig response from MAC to DU APP
918  *
919  * @params[in] 
920  * @return ROK     - success
921  *         RFAILED - failure
922  *
923  * ****************************************************************/
924 uint8_t packDuMacUeRecfgRsp(Pst *pst, MacUeRecfgRsp *recfgRsp)
925 {
926    Buffer *mBuf = NULLP;
927
928    if(pst->selector == ODU_SELECTOR_LWLC)
929    {
930       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
931       {
932          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeRecfgRsp");
933          return RFAILED;
934       }
935       /* pack the address of the structure */
936       CMCHKPK(oduPackPointer,(PTR)recfgRsp, mBuf);
937    }
938    else
939    {
940       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeRecfgRsp");
941       return RFAILED;
942    }
943
944    return ODU_POST_TASK(pst,mBuf);
945 }
946
947 /*******************************************************************
948  *
949  * @brief Unpack UE ReConfig Response from MAC to DU APP
950  *
951  * @details
952  *
953  *    Function :unpackDuMacUeRecfgRsp 
954  *
955  *    Functionality: Unpack UE ReConfig Response from MAC to DU APP
956  *
957  * @params[in] 
958  * @return ROK     - success
959  *         RFAILED - failure
960  *
961  * ****************************************************************/
962 uint8_t unpackDuMacUeRecfgRsp(MacDuUeRecfgRspFunc func, Pst *pst, Buffer *mBuf)
963 {
964    if(pst->selector == ODU_SELECTOR_LWLC)
965    {
966       MacUeRecfgRsp *recfgRsp = NULLP;
967
968       /* unpack the address of the structure */
969       CMCHKUNPK(oduUnpackPointer, (PTR *)&recfgRsp, mBuf);
970       ODU_PUT_MSG_BUF(mBuf);
971       return (*func)(pst, recfgRsp);
972    }
973
974    ODU_PUT_MSG_BUF(mBuf);
975    return RFAILED;
976 }
977
978 /*******************************************************************
979  *
980  * @brief Packs and Sends RACH Resource request from DUAPP to MAC
981  *
982  * @details
983  *
984  *    Function : packDuMacRachRsrcReq
985  *
986  *    Functionality:
987  *       Packs and Sends RACH Resource request from DU APP to MAC
988  *
989  *
990  * @params[in] Post structure pointer
991  *             MacRachRsrcReq pointer              
992  * @return ROK     - success
993  *         RFAILED - failure
994  *
995  * ****************************************************************/
996 uint8_t packDuMacRachRsrcReq(Pst *pst, MacRachRsrcReq *rachRsrcReq)
997 {
998    Buffer *mBuf = NULLP;
999
1000    if(pst->selector == ODU_SELECTOR_LWLC)
1001    {
1002       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1003       {
1004          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacRachRsrcReq,");
1005          return RFAILED;
1006       }
1007       /* pack the address of the structure */
1008       CMCHKPK(oduPackPointer, (PTR)rachRsrcReq, mBuf);
1009    }
1010    else
1011    {
1012       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacRachRsrcReq");
1013       return RFAILED;
1014    }
1015
1016    return ODU_POST_TASK(pst,mBuf);
1017 }
1018
1019 /*******************************************************************
1020  *
1021  * @brief Unpacks RACH resource Request received from DU APP
1022  *
1023  * @details
1024  *
1025  *    Function : unpackMacRachRsrcReq
1026  *
1027  *    Functionality:
1028  *         Unpacks RACH resource Request received from DU APP
1029  *
1030  * @params[in] Pointer to Handler
1031  *             Post structure pointer
1032  *             Message Buffer
1033  * @return ROK     - success
1034  *         RFAILED - failure
1035  *
1036  * ****************************************************************/
1037 uint8_t unpackMacRachRsrcReq(DuMacRachRsrcReq func, Pst *pst, Buffer *mBuf)
1038 {
1039    if(pst->selector == ODU_SELECTOR_LWLC)
1040    {
1041       MacRachRsrcReq *rachRsrcReq;
1042
1043       /* unpack the address of the structure */
1044       CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcReq, mBuf);
1045       ODU_PUT_MSG_BUF(mBuf);
1046       return (*func)(pst, rachRsrcReq);
1047    }
1048    else
1049    {
1050       /* Nothing to do for other selectors */
1051       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for RACH resource Request ");
1052       ODU_PUT_MSG_BUF(mBuf);
1053    }
1054
1055    return RFAILED;
1056 }
1057
1058 /*******************************************************************
1059  *
1060  * @brief Packs and Sends RACH Resource release from DUAPP to MAC
1061  *
1062  * @details
1063  *
1064  *    Function : packDuMacRachRsrcRel
1065  *
1066  *    Functionality:
1067  *       Packs and Sends RACH Resource release from DU APP to MAC
1068  *
1069  *
1070  * @params[in] Post structure pointer
1071  *             MacRachRsrcRel pointer              
1072  * @return ROK     - success
1073  *         RFAILED - failure
1074  *
1075  * ****************************************************************/
1076 uint8_t packDuMacRachRsrcRel(Pst *pst, MacRachRsrcRel *rachRsrcRel)
1077 {
1078    Buffer *mBuf = NULLP;
1079
1080    if(pst->selector == ODU_SELECTOR_LWLC)
1081    {
1082       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1083       {
1084          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacRachRsrcRel");
1085          return RFAILED;
1086       }
1087       /* pack the address of the structure */
1088       CMCHKPK(oduPackPointer, (PTR)rachRsrcRel, mBuf);
1089    }
1090    else
1091    {
1092       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacRachRsrcRel");
1093       return RFAILED;
1094    }
1095
1096    return ODU_POST_TASK(pst,mBuf);
1097 }
1098
1099 /*******************************************************************
1100  *
1101  * @brief Unpacks RACH Resource Release received from DU APP
1102  *
1103  * @details
1104  *
1105  *    Function : unpackMacRachRsrcRel
1106  *
1107  *    Functionality:
1108  *         Unpacks RACH Resource Release received from DU APP
1109  *
1110  * @params[in] Pointer to Handler
1111  *             Post structure pointer
1112  *             Message Buffer
1113  * @return ROK     - success
1114  *         RFAILED - failure
1115  *
1116  * ****************************************************************/
1117 uint8_t unpackMacRachRsrcRel(DuMacRachRsrcRel func, Pst *pst, Buffer *mBuf)
1118 {
1119    if(pst->selector == ODU_SELECTOR_LWLC)
1120    {
1121       MacRachRsrcRel *rachRsrcRel;
1122
1123       /* unpack the address of the structure */
1124       CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcRel, mBuf);
1125       ODU_PUT_MSG_BUF(mBuf);
1126       return (*func)(pst, rachRsrcRel);
1127    }
1128    else
1129    {
1130       /* Nothing to do for other selectors */
1131       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for RACH Resource Release ");
1132       ODU_PUT_MSG_BUF(mBuf);
1133    }
1134
1135    return RFAILED;
1136 }
1137
1138 /*******************************************************************
1139  *
1140  * @brief Packs and Sends RACH Resource response from MAC to DU APP
1141  *
1142  * @details
1143  *
1144  *    Function : packDuMacRachRsrcRsp
1145  *
1146  *    Functionality:
1147  *       Packs and Sends RACH Resource response from MAC to DU APP
1148  *
1149  *
1150  * @params[in] Post structure pointer
1151  *             MacRachRsrcRsp pointer              
1152  * @return ROK     - success
1153  *         RFAILED - failure
1154  *
1155  * ****************************************************************/
1156 uint8_t packDuMacRachRsrcRsp(Pst *pst, MacRachRsrcRsp *rachRsrcRsp)
1157 {
1158    Buffer *mBuf = NULLP;
1159
1160    if(pst->selector == ODU_SELECTOR_LWLC)
1161    {
1162       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1163       {
1164          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacRachRsrcRsp");
1165          return RFAILED;
1166       }
1167       /* pack the address of the structure */
1168       CMCHKPK(oduPackPointer, (PTR)rachRsrcRsp, mBuf);
1169    }
1170    else
1171    {
1172       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacRachRsrcRsp");
1173       return RFAILED;
1174    }
1175
1176    return ODU_POST_TASK(pst,mBuf);
1177 }
1178
1179 /*******************************************************************
1180  *
1181  * @brief Unpacks RACH resource Response received from MAC
1182  *
1183  * @details
1184  *
1185  *    Function : unpackDuMacRachRsrcRsp
1186  *
1187  *    Functionality:
1188  *         Unpacks RACH resource Response received from MAC
1189  *
1190  * @params[in] Pointer to Handler
1191  *             Post structure pointer
1192  *             Message Buffer
1193  * @return ROK     - success
1194  *         RFAILED - failure
1195  *
1196  * ****************************************************************/
1197 uint8_t unpackDuMacRachRsrcRsp(MacDuRachRsrcRspFunc func, Pst *pst, Buffer *mBuf)
1198 {
1199    if(pst->selector == ODU_SELECTOR_LWLC)
1200    {
1201       MacRachRsrcRsp *rachRsrcRsp;
1202
1203       /* unpack the address of the structure */
1204       CMCHKUNPK(oduUnpackPointer, (PTR *)&rachRsrcRsp, mBuf);
1205       ODU_PUT_MSG_BUF(mBuf);
1206       return (*func)(pst, rachRsrcRsp);
1207    }
1208    else
1209    {
1210       /* Nothing to do for other selectors */
1211       DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for RACH resource Response ");
1212       ODU_PUT_MSG_BUF(mBuf);
1213    }
1214
1215    return RFAILED;
1216 }
1217 /*******************************************************************
1218 *
1219 * @brief Packs and Sends UE Delete Request from DUAPP to MAC
1220 *
1221 * @details
1222 *
1223 *    Function : packDuMacUeDeleteReq
1224 *
1225 *    Functionality:
1226 *       Packs and Sends UE Delete Request from DUAPP to MAC
1227 *
1228 *
1229 * @params[in] Post structure pointer
1230 *             MacUeDelete pointer
1231 * @return ROK     - success
1232 *         RFAILED - failure
1233 *
1234 * ****************************************************************/
1235 uint8_t packDuMacUeDeleteReq(Pst *pst, MacUeDelete *ueDel)
1236 {
1237     Buffer *mBuf = NULLP;
1238
1239     if(pst->selector == ODU_SELECTOR_LWLC)
1240     {
1241        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1242        {
1243           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeDeleteReq");
1244           return RFAILED;
1245        }
1246        /* pack the address of the structure */
1247        CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
1248     }
1249     else
1250     {
1251        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeDeleteReq");
1252        return RFAILED;
1253     }
1254
1255     return ODU_POST_TASK(pst,mBuf);
1256 }
1257 /*******************************************************************
1258 *
1259 * @brief Unpacks UE Delete Request received from DU APP
1260 *
1261 * @details
1262 *
1263 *    Function : unpackMacUeDeleteReq 
1264 *
1265 *    Functionality:
1266 *         Unpacks UE Delete Request received from DU APP
1267 *
1268 * @params[in] Pointer to Handler
1269 *             Post structure pointer
1270 *             Message Buffer
1271 * @return ROK     - success
1272 *         RFAILED - failure
1273 *
1274 * ****************************************************************/
1275 uint8_t unpackMacUeDeleteReq(DuMacUeDeleteReq func, Pst *pst, Buffer *mBuf)
1276 {
1277     if(pst->selector == ODU_SELECTOR_LWLC)
1278     {
1279        MacUeDelete *ueDelete;
1280
1281        /* unpack the address of the structure */
1282        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf);
1283        ODU_PUT_MSG_BUF(mBuf);
1284        return (*func)(pst, ueDelete);
1285     }
1286     else
1287     {
1288        /* Nothing to do for other selectors */
1289        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for UE Delete Request ");
1290        ODU_PUT_MSG_BUF(mBuf);
1291     }
1292
1293     return RFAILED;
1294 }
1295 /*******************************************************************
1296  *
1297  * @brief Pack and send UE delete response from MAC to DU APP
1298  *
1299  * @details
1300  *
1301  *    Function : packDuMacUeDeleteRsp
1302  *
1303  *    Functionality:
1304  *       Pack and send UE  delete response from MAC to DU APP
1305  *
1306  * @params[in]
1307  * @return ROK     - success
1308  *         RFAILED - failure
1309  *
1310  * ****************************************************************/
1311 uint8_t packDuMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
1312 {
1313    Buffer *mBuf = NULLP;
1314    
1315    if(pst->selector == ODU_SELECTOR_LWLC)
1316    {
1317       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1318       {
1319          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeDeleteRsp");
1320          return RFAILED;
1321       }
1322       /* pack the address of the structure */
1323       CMCHKPK(oduPackPointer,(PTR)deleteRsp, mBuf);
1324    }
1325    else
1326    {
1327       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeDeleteRsp");
1328       return RFAILED;
1329    }
1330    
1331    return ODU_POST_TASK(pst,mBuf);
1332    
1333 }
1334
1335 /*******************************************************************
1336 *
1337 * @brief Unpack UE Config Response from MAC to DU APP
1338 *
1339 * @details
1340 *
1341 *    Function :unpackDuMacUeDeleteRsp 
1342 *
1343 *    Functionality: Unpack UE Config Response from MAC to DU APP
1344 *
1345 * @params[in]
1346 * @return ROK     - success
1347 *         RFAILED - failure
1348 *
1349 * ****************************************************************/
1350 uint8_t unpackDuMacUeDeleteRsp(MacDuUeDeleteRspFunc func, Pst *pst, Buffer *mBuf)
1351 {
1352     if(pst->selector == ODU_SELECTOR_LWLC)
1353     {
1354        MacUeDeleteRsp *ueDeleteRsp = NULLP;
1355
1356        /* unpack the address of the structure */
1357        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDeleteRsp, mBuf);
1358        ODU_PUT_MSG_BUF(mBuf);
1359        return (*func)(pst, ueDeleteRsp);
1360     }
1361
1362     ODU_PUT_MSG_BUF(mBuf);
1363     return RFAILED;
1364 }
1365
1366 /*******************************************************************
1367  *
1368  * @brief Unpacks Cell Delete Request received from DU APP
1369  *
1370  * @details
1371  *
1372  *    Function : unpackMacCellDeleteReq
1373  *
1374  *    Functionality:
1375  *         Unpacks Cell Delete Request received from DU APP
1376  *
1377  * @params[in] Pointer to Handler
1378  *             Post structure pointer
1379  *             Message Buffer
1380  * @return ROK     - success
1381  *         RFAILED - failure
1382  *
1383  * ****************************************************************/
1384
1385 uint8_t unpackMacCellDeleteReq(DuMacCellDeleteReq func, Pst *pst, Buffer *mBuf)
1386 {
1387    if(pst->selector == ODU_SELECTOR_LWLC)
1388    {
1389       MacCellDeleteReq *cellDelete=NULLP;
1390
1391       /* unpack the address of the structure */
1392       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellDelete, mBuf);
1393       ODU_PUT_MSG_BUF(mBuf);
1394       return (*func)(pst, cellDelete);
1395    }
1396    else
1397    {
1398       /* Nothing to do for other
1399        * selectors */
1400       DU_LOG("\nERROR  -->  DU APP : unpackMacCellDeleteReq(): Only LWLC supported for CELL Delete Request ");
1401       ODU_PUT_MSG_BUF(mBuf);
1402    }
1403
1404    return RFAILED;
1405 }
1406
1407 /*******************************************************************
1408  *
1409  * @brief Pack and send Cell delete request to MAC
1410  *
1411  * @details
1412  *
1413  *    Function : packDuMacCellDeleteReq
1414  *
1415  *    Functionality:
1416  *       Pack and send Cell delete request to MAC
1417  *
1418  * @params[in] Post structure
1419  *             MacCellDelete *cellDelete;
1420  * @return ROK     - success
1421  *         RFAILED - failure
1422  *
1423  * ****************************************************************/
1424
1425 uint8_t packDuMacCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete)
1426 {
1427    Buffer *mBuf = NULLP;
1428
1429    if(pst->selector == ODU_SELECTOR_LWLC)
1430    {
1431       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1432       {
1433          DU_LOG("\nERROR  --> MAC : packDuMacCellDeleteReq(): Memory allocation failed ");
1434          return RFAILED;
1435       }
1436       CMCHKPK(oduPackPointer,(PTR)cellDelete, mBuf);
1437       return ODU_POST_TASK(pst,mBuf);
1438    }
1439    else
1440    {
1441       DU_LOG("\nERROR  -->  MAC: packDuMacCellDeleteReq(): Only LWLC supported ");
1442    }
1443    return RFAILED;
1444 }
1445
1446 /*******************************************************************
1447  *
1448  * @brief Pack and send CELL delete response from MAC to DU APP
1449  *
1450  * @details
1451  *
1452  *    Function : packDuMacCellDeleteRsp
1453  *
1454  *    Functionality:
1455  *       Pack and send CELL  delete response from MAC to DU APP
1456  *
1457  * @params[in] Pst *pst, MacCellDeleteRsp *deleteRsp
1458  * @return ROK     - success
1459  *         RFAILED - failure
1460  *
1461  * ****************************************************************/
1462
1463 uint8_t packDuMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *cellDeleteRsp)
1464 {
1465    Buffer *mBuf = NULLP;
1466
1467    if(pst->selector == ODU_SELECTOR_LWLC)
1468    {
1469       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1470       {
1471          DU_LOG("\nERROR  --> MAC : packDuMacCellDeleteRsp(): Memory allocation failed ");
1472          return RFAILED;
1473       }
1474       CMCHKPK(oduPackPointer,(PTR)cellDeleteRsp, mBuf);
1475    }
1476    else
1477    {
1478       DU_LOG("\nERROR  -->  MAC: packDuMacCellDeleteRsp(): Only LWLC supported ");
1479       return RFAILED;
1480    }
1481
1482    return ODU_POST_TASK(pst,mBuf);
1483
1484 }
1485
1486 /*******************************************************************
1487  *
1488  * @brief Unpack cell delete response from MAC to DU APP
1489  *
1490  * @details
1491  *
1492  *    Function : unpackDuMacCellDeleteRsp
1493  *
1494  *    Functionality: Unpack cell delete response from MAC to DU APP
1495  *
1496  * @params[in] MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf
1497  * @return ROK     - success
1498  *         RFAILED - failure
1499  *
1500  * ****************************************************************/
1501
1502 uint8_t unpackDuMacCellDeleteRsp(MacDuCellDeleteRspFunc func, Pst *pst, Buffer *mBuf)
1503 {
1504    if(pst->selector == ODU_SELECTOR_LWLC)
1505    {
1506       MacCellDeleteRsp *cellDeleteRsp = NULLP;
1507
1508       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellDeleteRsp, mBuf);
1509       ODU_PUT_MSG_BUF(mBuf);
1510       return (*func)(pst, cellDeleteRsp);
1511    }
1512    else
1513    {  
1514       DU_LOG("\nERROR  -->  DU APP : unpackDuMacCellDeleteRsp(): Only LWLC supported ");
1515       ODU_PUT_MSG_BUF(mBuf);
1516    }
1517    return RFAILED;
1518 }
1519
1520 /*******************************************************************
1521  *
1522  * @brief Pack and send Slice Cfg request from MAC to DU APP
1523  *
1524  * @details
1525  *
1526  *    Function : packDuMacSliceCfgReq
1527  *
1528  *    Functionality:
1529  *       Pack and send Slice Cfg request from MAC to DU APP
1530  *
1531  * @params[in] Pst *pst, MacSliceCfgReq *sliceCfgReq
1532  * @return ROK     - success
1533  *         RFAILED - failure
1534  *
1535  * ****************************************************************/
1536
1537 uint8_t packDuMacSliceCfgReq(Pst *pst, MacSliceCfgReq *sliceCfgReq)
1538 {
1539    Buffer *mBuf = NULLP;
1540
1541    if(pst->selector == ODU_SELECTOR_LWLC)
1542    {
1543       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1544       {
1545          DU_LOG("\nERROR  --> MAC : Memory allocation failed in packDuMacSliceCfgReq");
1546          return RFAILED;
1547       }
1548       CMCHKPK(oduPackPointer,(PTR)sliceCfgReq, mBuf);
1549    }
1550    else
1551    {
1552       DU_LOG("\nERROR  -->  MAC: Only LWLC supported in packDuMacSliceCfgReq");
1553       return RFAILED;
1554    }
1555
1556    return ODU_POST_TASK(pst,mBuf);
1557
1558 }
1559 /*******************************************************************
1560 *
1561 * @brief Unpacks Slice Cfg request received from DU APP
1562 *
1563 * @details
1564 *
1565 *    Function : unpackMacSliceCfgReq 
1566 *
1567 *    Functionality:
1568 *         Unpacks Slice Cfg Request received from DU APP
1569 *
1570 * @params[in] Pointer to Handler
1571 *             Post structure pointer
1572 *             Message Buffer
1573 * @return ROK     - success
1574 *         RFAILED - failure
1575 *
1576 * ****************************************************************/
1577 uint8_t unpackMacSliceCfgReq(DuMacSliceCfgReq func, Pst *pst, Buffer *mBuf)
1578 {
1579     if(pst->selector == ODU_SELECTOR_LWLC)
1580     {
1581        MacSliceCfgReq *sliceCfgReq;
1582        /* unpack the address of the structure */
1583        CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceCfgReq, mBuf);
1584        ODU_PUT_MSG_BUF(mBuf);
1585        return (*func)(pst, sliceCfgReq);
1586     }
1587     else
1588     {
1589        /* Nothing to do for other selectors */
1590        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Slice Cfg Request ");
1591        ODU_PUT_MSG_BUF(mBuf);
1592     }
1593
1594     return RFAILED;
1595 }
1596
1597 /*******************************************************************
1598  *
1599  * @brief Pack and send Slice config response from MAC to DU APP
1600  *
1601  * @details
1602  *
1603  *    Function : packDuMacSliceCfgRsp
1604  *
1605  *    Functionality:
1606  *       Pack and send Slice config response from MAC to DU APP
1607  *
1608  * @params[in] 
1609  * @return ROK     - success
1610  *         RFAILED - failure
1611  *
1612  * ****************************************************************/
1613 uint8_t packDuMacSliceCfgRsp(Pst *pst, MacSliceCfgRsp *cfgRsp)
1614 {
1615    Buffer *mBuf = NULLP;
1616
1617    if(pst->selector == ODU_SELECTOR_LWLC)
1618    {
1619       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1620       {
1621          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacSliceCfgRsp");
1622          return RFAILED;
1623       }
1624       /* pack the address of the structure */
1625       CMCHKPK(oduPackPointer,(PTR)cfgRsp, mBuf);
1626    }
1627    else
1628    {
1629       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacSliceCfgRsp");
1630       return RFAILED;
1631    }
1632
1633    return ODU_POST_TASK(pst,mBuf);
1634 }
1635
1636 /*******************************************************************
1637  *
1638  * @brief Unpack Slice Config Response from MAC to DU APP
1639  *
1640  * @details
1641  *
1642  *    Function :unpackDuMacSliceCfgRsp 
1643  *
1644  *    Functionality: Unpack Slice Config Response from MAC to DU APP
1645  *
1646  * @params[in] 
1647  * @return ROK     - success
1648  *         RFAILED - failure
1649  *
1650  * ****************************************************************/
1651 uint8_t unpackDuMacSliceCfgRsp(MacDuSliceCfgRspFunc func, Pst *pst, Buffer *mBuf)
1652 {
1653    if(pst->selector == ODU_SELECTOR_LWLC)
1654    {
1655       MacSliceCfgRsp *cfgRsp = NULLP;
1656
1657       /* unpack the address of the structure */
1658       CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
1659       ODU_PUT_MSG_BUF(mBuf);
1660       return (*func)(pst, cfgRsp);
1661    }
1662
1663    ODU_PUT_MSG_BUF(mBuf);
1664    return RFAILED;
1665 }
1666
1667
1668 /*******************************************************************
1669  *
1670  * @brief Pack and send Slice ReCfg request from MAC to DU APP
1671  *
1672  * @details
1673  *
1674  *    Function : packDuMacSliceRecfgReq
1675  *
1676  *    Functionality:
1677  *       Pack and send Slice ReCfg request from MAC to DU APP
1678  *
1679  * @params[in] Pst *pst, MacSliceRecfgReq *sliceRecfgReq
1680  * @return ROK     - success
1681  *         RFAILED - failure
1682  *
1683  * ****************************************************************/
1684
1685 uint8_t packDuMacSliceRecfgReq(Pst *pst, MacSliceRecfgReq *sliceRecfgReq)
1686 {
1687    Buffer *mBuf = NULLP;
1688
1689    if(pst->selector == ODU_SELECTOR_LWLC)
1690    {
1691       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1692       {
1693          DU_LOG("\nERROR  --> MAC : Memory allocation failed in packDuMacSliceRecfgReq");
1694          return RFAILED;
1695       }
1696       CMCHKPK(oduPackPointer,(PTR)sliceRecfgReq, mBuf);
1697    }
1698    else
1699    {
1700       DU_LOG("\nERROR  -->  MAC: Only LWLC supported in packDuMacSliceRecfgReq");
1701       return RFAILED;
1702    }
1703
1704    return ODU_POST_TASK(pst,mBuf);
1705
1706 }
1707 /*******************************************************************
1708 *
1709 * @brief Unpacks Slice ReCfg request received from DU APP
1710 *
1711 * @details
1712 *
1713 *    Function : unpackMacSliceCfgReq 
1714 *
1715 *    Functionality:
1716 *         Unpacks Slice ReCfg Request received from DU APP
1717 *
1718 * @params[in] Pointer to Handler
1719 *             Post structure pointer
1720 *             Message Buffer
1721 * @return ROK     - success
1722 *         RFAILED - failure
1723 *
1724 * ****************************************************************/
1725 uint8_t unpackMacSliceRecfgReq(DuMacSliceRecfgReq func, Pst *pst, Buffer *mBuf)
1726 {
1727     if(pst->selector == ODU_SELECTOR_LWLC)
1728     {
1729        MacSliceRecfgReq *sliceRecfgReq;
1730        /* unpack the address of the structure */
1731        CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceRecfgReq, mBuf);
1732        ODU_PUT_MSG_BUF(mBuf);
1733        return (*func)(pst, sliceRecfgReq);
1734     }
1735     else
1736     {
1737        /* Nothing to do for other selectors */
1738        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Slice ReCfg Request ");
1739        ODU_PUT_MSG_BUF(mBuf);
1740     }
1741
1742     return RFAILED;
1743 }
1744
1745 /*******************************************************************
1746  *
1747  * @brief Pack and send Slice config response from MAC to DU APP
1748  *
1749  * @details
1750  *
1751  *    Function : packDuMacSliceRecfgRsp
1752  *
1753  *    Functionality:
1754  *       Pack and send Slice config response from MAC to DU APP
1755  *
1756  * @params[in] 
1757  * @return ROK     - success
1758  *         RFAILED - failure
1759  *
1760  * ****************************************************************/
1761 uint8_t packDuMacSliceRecfgRsp(Pst *pst, MacSliceRecfgRsp *sliceRecfgRsp)
1762 {
1763    Buffer *mBuf = NULLP;
1764
1765    if(pst->selector == ODU_SELECTOR_LWLC)
1766    {
1767       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1768       {
1769          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacSliceRecfgRsp");
1770          return RFAILED;
1771       }
1772       /* pack the address of the structure */
1773       CMCHKPK(oduPackPointer,(PTR)sliceRecfgRsp, mBuf);
1774    }
1775    else
1776    {
1777       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacSliceRecfgRsp");
1778       return RFAILED;
1779    }
1780
1781    return ODU_POST_TASK(pst,mBuf);
1782 }
1783
1784 /*******************************************************************
1785  *
1786  * @brief Unpack Slice ReConfig Response from MAC to DU APP
1787  *
1788  * @details
1789  *
1790  *    Function :unpackDuMacSliceRecfgRsp 
1791  *
1792  *    Functionality: Unpack Slice ReConfig Response from MAC to DU APP
1793  *
1794  * @params[in] 
1795  * @return ROK     - success
1796  *         RFAILED - failure
1797  *
1798  * ****************************************************************/
1799 uint8_t unpackDuMacSliceRecfgRsp(MacDuSliceRecfgRspFunc func, Pst *pst, Buffer *mBuf)
1800 {
1801    if(pst->selector == ODU_SELECTOR_LWLC)
1802    {
1803       MacSliceRecfgRsp *sliceRecfgRsp = NULLP;
1804
1805       /* unpack the address of the structure */
1806       CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceRecfgRsp, mBuf);
1807       ODU_PUT_MSG_BUF(mBuf);
1808       return (*func)(pst, sliceRecfgRsp);
1809    }
1810
1811    ODU_PUT_MSG_BUF(mBuf);
1812    return RFAILED;
1813 }
1814
1815 /*******************************************************************
1816  *
1817  * @brief Pack and send Slot ind from MAC to DU APP
1818  *
1819  * @details
1820  *
1821  *    Function : packMacSlotInd
1822  *
1823  *    Functionality:
1824  *       Pack and send Slot ind from MAC to DU APP
1825  *
1826  * @params[in] Pst *pst, SlotTimingInfo *slotIndInfo 
1827  * @return ROK     - success
1828  *         RFAILED - failure
1829  *
1830  * ****************************************************************/
1831 uint8_t packMacSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo)
1832 {
1833    Buffer *mBuf = NULLP;
1834
1835    if(pst->selector == ODU_SELECTOR_LWLC)
1836    {
1837       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1838       {
1839          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packMacSlotInd");
1840          return RFAILED;
1841       }
1842       /* pack the address of the structure */
1843       CMCHKPK(oduPackPointer,(PTR)slotIndInfo, mBuf);
1844    }
1845    else
1846    {
1847       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packMacSlotInd");
1848       return RFAILED;
1849    }
1850
1851    return ODU_POST_TASK(pst,mBuf);
1852 }
1853
1854 /*******************************************************************
1855  *
1856  * @brief Unpack Slot indication from MAC to DU APP
1857  *
1858  * @details
1859  *
1860  *    Function :unpackDuMacSlotInd 
1861  *
1862  *    Functionality: Unpack Slot Indication from MAC to DU APP
1863  *
1864  * @params[in] DuMacSlotInd func, Pst *pst, Buffer *mBuf 
1865  * @return ROK     - success
1866  *         RFAILED - failure
1867  *
1868  * ****************************************************************/
1869 uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
1870 {
1871    if(pst->selector == ODU_SELECTOR_LWLC)
1872    {
1873       SlotTimingInfo *slotIndInfo;
1874       
1875       /* unpack the address of the structure */
1876       CMCHKUNPK(oduUnpackPointer, (PTR *)&slotIndInfo, mBuf);
1877       ODU_PUT_MSG_BUF(mBuf);
1878       return (*func)(pst, slotIndInfo);
1879    }
1880
1881    ODU_PUT_MSG_BUF(mBuf);
1882    return RFAILED;
1883 }
1884
1885 /*******************************************************************
1886  *
1887  * @brief Pack and send Dl Pcch indication to MAC
1888  *
1889  * @details
1890  *
1891  *    Function : packDuMacDlPcchInd
1892  *
1893  *    Functionality:
1894  *       Pack and send Dl Pcch indication to MAC
1895  *
1896  * @params[in] Post structure
1897  *             DlPcchInd *pcchInd;
1898  * @return ROK     - success
1899  *         RFAILED - failure
1900  *
1901  * ****************************************************************/
1902
1903 uint8_t packDuMacDlPcchInd(Pst *pst, DlPcchInd *pcchInd)
1904 {
1905    Buffer *mBuf = NULLP;
1906
1907    if(pst->selector == ODU_SELECTOR_LWLC)
1908    {
1909       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1910       {
1911          DU_LOG("\nERROR  --> MAC : packDuMacDlPcchInd(): Memory allocation failed ");
1912          return RFAILED;
1913       }
1914       CMCHKPK(oduPackPointer,(PTR)pcchInd, mBuf);
1915       return ODU_POST_TASK(pst,mBuf);
1916    }
1917    else
1918    {
1919       DU_LOG("\nERROR  -->  MAC: packDuMacDlPcchInd(): Only LWLC supported ");
1920    }
1921    return RFAILED;
1922 }
1923
1924 /*******************************************************************
1925  *
1926  * @brief Unpacks downlink pcch indication received from DU APP
1927  *
1928  * @details
1929  *
1930  *    Function : unpackMacDlPcchInd
1931  *
1932  *    Functionality:
1933  *         Unpacks downlink pcch indication received from DU APP
1934  *
1935  * @params[in] Pointer to Handler
1936  *             Post structure pointer
1937  *             Message Buffer
1938  * @return ROK     - success
1939  *         RFAILED - failure
1940  *
1941  * ****************************************************************/
1942
1943 uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf)
1944 {
1945    if(pst->selector == ODU_SELECTOR_LWLC)
1946    {
1947       DlPcchInd *pcchInd=NULLP;
1948
1949       /* unpack the address of the structure */
1950       CMCHKUNPK(oduUnpackPointer, (PTR *)&pcchInd, mBuf);
1951       ODU_PUT_MSG_BUF(mBuf);
1952       return (*func)(pst, pcchInd);
1953    }
1954    else
1955    {
1956       /* Nothing to do for other selectors */
1957       DU_LOG("\nERROR  -->  DU APP : unpackMacDlPcchInd(): Only LWLC supported");
1958       ODU_PUT_MSG_BUF(mBuf);
1959    }
1960
1961    return RFAILED;
1962 }
1963
1964 /*******************************************************************
1965 *
1966 * @brief Packs and Sends UE Reset Request from DUAPP to MAC
1967 *
1968 * @details
1969 *
1970 *    Function : packDuMacUeResetReq
1971 *
1972 *    Functionality:
1973 *       Packs and Sends UE Reset Request from DUAPP to MAC
1974 *
1975 *
1976 * @params[in] Post structure pointer
1977 *             MacUeResetReq pointer
1978 * @return ROK     - success
1979 *         RFAILED - failure
1980 *
1981 * ****************************************************************/
1982 uint8_t packDuMacUeResetReq(Pst *pst, MacUeResetReq *ueDel)
1983 {
1984     Buffer *mBuf = NULLP;
1985
1986     if(pst->selector == ODU_SELECTOR_LWLC)
1987     {
1988        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1989        {
1990           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeResetReq");
1991           return RFAILED;
1992        }
1993        /* pack the address of the structure */
1994        CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
1995     }
1996     else
1997     {
1998        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeResetReq");
1999        return RFAILED;
2000     }
2001     return ODU_POST_TASK(pst,mBuf);
2002 }
2003
2004 /*******************************************************************
2005 *
2006 * @brief Unpacks UE Reset Request received from DU APP
2007 *
2008 * @details
2009 *
2010 *    Function : unpackMacUeResetReq 
2011 *
2012 *    Functionality:
2013 *         Unpacks UE Reset Request received from DU APP
2014 *
2015 * @params[in] Pointer to Handler
2016 *             Post structure pointer
2017 *             Message Buffer
2018 * @return ROK     - success
2019 *         RFAILED - failure
2020 *
2021 * ****************************************************************/
2022 uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf)
2023 {
2024     if(pst->selector == ODU_SELECTOR_LWLC)
2025     {
2026        MacUeResetReq *ueReset;
2027
2028        /* unpack the address of the structure */
2029        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueReset, mBuf);
2030        ODU_PUT_MSG_BUF(mBuf);
2031        return (*func)(pst, ueReset);
2032     }
2033     else
2034     {
2035        /* Nothing to do for other selectors */
2036        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for UE Reset Request ");
2037        ODU_PUT_MSG_BUF(mBuf);
2038     }
2039
2040     return RFAILED;
2041 }
2042
2043 /*******************************************************************
2044  *
2045  * @brief Pack and send UE reset response from MAC to DU APP
2046  *
2047  * @details
2048  *
2049  *    Function : packDuMacUeResetRsp
2050  *
2051  *    Functionality:
2052  *       Pack and send UE  reset response from MAC to DU APP
2053  *
2054  * @params[in]
2055  * @return ROK     - success
2056  *         RFAILED - failure
2057  *
2058  * ****************************************************************/
2059 uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp)
2060 {
2061    Buffer *mBuf = NULLP;
2062    
2063    if(pst->selector == ODU_SELECTOR_LWLC)
2064    {
2065       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2066       {
2067          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeResetRsp");
2068          return RFAILED;
2069       }
2070       /* pack the address of the structure */
2071       CMCHKPK(oduPackPointer,(PTR)resetRsp, mBuf);
2072    }
2073    else
2074    {
2075       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeResetRsp");
2076       return RFAILED;
2077    }
2078    
2079    return ODU_POST_TASK(pst,mBuf);
2080 }
2081
2082 /*******************************************************************
2083 *
2084 * @brief Unpack UE Config Response from MAC to DU APP
2085 *
2086 * @details
2087 *
2088 *    Function :unpackDuMacUeResetRsp 
2089 *
2090 *    Functionality: Unpack UE Config Response from MAC to DU APP
2091 *
2092 * @params[in]
2093 * @return ROK     - success
2094 *         RFAILED - failure
2095 *
2096 * ****************************************************************/
2097 uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf)
2098 {
2099     if(pst->selector == ODU_SELECTOR_LWLC)
2100     {
2101        MacUeResetRsp *ueResetRsp = NULLP;
2102
2103        /* unpack the address of the structure */
2104        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueResetRsp, mBuf);
2105        ODU_PUT_MSG_BUF(mBuf);
2106        return (*func)(pst, ueResetRsp);
2107     }
2108
2109     ODU_PUT_MSG_BUF(mBuf);
2110     return RFAILED;
2111 }
2112
2113 /*******************************************************************
2114  *
2115  * @brief Pack and send UE Sync Status Indication from MAC to DU APP
2116  *
2117  * @details
2118  *
2119  *    Function : packDuMacUeSyncStatusInd
2120  *
2121  *    Functionality:
2122  *       Pack and send UE Sync Status Indication from MAC to DU APP
2123  *
2124  * @params[in]
2125  * @return ROK     - success
2126  *         RFAILED - failure
2127  *
2128  * ****************************************************************/
2129 uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *SyncStatusInd)
2130 {
2131    Buffer *mBuf = NULLP;
2132    
2133    if(pst->selector == ODU_SELECTOR_LWLC)
2134    {
2135       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2136       {
2137          DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeSyncStatusInd");
2138          return RFAILED;
2139       }
2140       /* pack the address of the structure */
2141       CMCHKPK(oduPackPointer,(PTR)SyncStatusInd, mBuf);
2142    }
2143    else
2144    {
2145       DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeSyncStatusInd");
2146       return RFAILED;
2147    }
2148    
2149    return ODU_POST_TASK(pst,mBuf);
2150 }
2151
2152 /*******************************************************************
2153 *
2154 * @brief Unpack UE Config Response from MAC to DU APP
2155 *
2156 * @details
2157 *
2158 *    Function :unpackDuMacUeSyncStatusInd 
2159 *
2160 *    Functionality: Unpack UE Config Response from MAC to DU APP
2161 *
2162 * @params[in]
2163 * @return ROK     - success
2164 *         RFAILED - failure
2165 *
2166 * ****************************************************************/
2167 uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf)
2168 {
2169     if(pst->selector == ODU_SELECTOR_LWLC)
2170     {
2171        MacUeSyncStatusInd *ueSyncStatusInd = NULLP;
2172
2173        /* unpack the address of the structure */
2174        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueSyncStatusInd, mBuf);
2175        ODU_PUT_MSG_BUF(mBuf);
2176        return (*func)(pst, ueSyncStatusInd);
2177     }
2178
2179     ODU_PUT_MSG_BUF(mBuf);
2180     return RFAILED;
2181 }
2182
2183 /*******************************************************************
2184 *
2185 * @brief Packs and Sends Dl Broadcast Request from DUAPP to MAC
2186 *
2187 * @details
2188 *
2189 *    Function : packDuMacDlBroadcastReq
2190 *
2191 *    Functionality:
2192 *       Packs and Sends Dl Broadcast Request from DUAPP to MAC
2193 *
2194 *
2195 * @params[in] Post structure pointer
2196 *             MacDlBroadcastReq pointer
2197 * @return ROK     - success
2198 *         RFAILED - failure
2199 *
2200 * ****************************************************************/
2201 uint8_t packDuMacDlBroadcastReq(Pst *pst, MacDlBroadcastReq *ueDel)
2202 {
2203     Buffer *mBuf = NULLP;
2204
2205     if(pst->selector == ODU_SELECTOR_LWLC)
2206     {
2207        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2208        {
2209           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacDlBroadcastReq");
2210           return RFAILED;
2211        }
2212        /* pack the address of the structure */
2213        CMCHKPK(oduPackPointer,(PTR)ueDel, mBuf);
2214     }
2215     else
2216     {
2217        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacDlBroadcastReq");
2218        return RFAILED;
2219     }
2220     return ODU_POST_TASK(pst,mBuf);
2221 }
2222
2223 /*******************************************************************
2224 *
2225 * @brief Unpacks Dl Broadcast Request received from DU APP
2226 *
2227 * @details
2228 *
2229 *    Function : unpackMacDlBroadcastReq 
2230 *
2231 *    Functionality:
2232 *         Unpacks Dl Broadcast Request received from DU APP
2233 *
2234 * @params[in] Pointer to Handler
2235 *             Post structure pointer
2236 *             Message Buffer
2237 * @return ROK     - success
2238 *         RFAILED - failure
2239 *
2240 * ****************************************************************/
2241 uint8_t unpackMacDlBroadcastReq(DuMacDlBroadcastReq func, Pst *pst, Buffer *mBuf)
2242 {
2243     if(pst->selector == ODU_SELECTOR_LWLC)
2244     {
2245        MacDlBroadcastReq *dlBroadcast;
2246
2247        /* unpack the address of the structure */
2248        CMCHKUNPK(oduUnpackPointer, (PTR *)&dlBroadcast, mBuf);
2249        ODU_PUT_MSG_BUF(mBuf);
2250        return (*func)(pst, dlBroadcast);
2251     }
2252     else
2253     {
2254        /* Nothing to do for other selectors */
2255        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Dl Broadcast Request ");
2256        ODU_PUT_MSG_BUF(mBuf);
2257     }
2258
2259     return RFAILED;
2260 }
2261 /*******************************************************************
2262  *
2263  * @brief Searches for first unset bit in ueBitMap
2264  *
2265  * @details
2266  *
2267  *    Function : getFreeBitFromUeBitMap
2268  *
2269  *    Functionality: Searches for first unset bit in ueBitMap of
2270  *       a cell. Search starts from LSB to MSB. Returns index of the
2271  *       free bit, considering LSB at index 0 and increasing index
2272  *       towards MSB.
2273  *
2274  * @params[in] Cell Id
2275  * @return Index of free bit - success 
2276  *         -1 - failure
2277  *
2278  * ****************************************************************/
2279 int8_t getFreeBitFromUeBitMap(uint16_t cellId)
2280 {
2281    uint8_t  bitIdx = 0;  /* bit position */
2282    uint16_t cellIdx = 0; /* Index to acces ueBitMapPerCell[] */
2283    uint64_t mask = 1;    /* bit mask */
2284
2285    GET_CELL_IDX(cellId, cellIdx);
2286    while(bitIdx < 64) 
2287    {   
2288       /* Find the first unset bit in Bit Map */
2289       if((ueBitMapPerCell[cellIdx] & (mask << bitIdx)) == 0)
2290       {   
2291          SET_ONE_BIT(bitIdx, ueBitMapPerCell[cellIdx]);
2292          return bitIdx;
2293       }   
2294       else
2295          bitIdx++;
2296    }   
2297    return -1; 
2298 }
2299
2300 /*******************************************************************
2301  *
2302  * @brief Unset a previously set bit in UeBitMap
2303  *
2304  * @details
2305  *
2306  *    Function : unsetBitInUeBitMap
2307  *
2308  *    Functionality: Searches for bit at given index and unset it.
2309  *
2310  * @params[in] Cell Id
2311  *             Bit Index
2312  * @return void 
2313  *
2314  * ****************************************************************/
2315 void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos)
2316 {
2317     uint16_t cellIdx;
2318
2319    GET_CELL_IDX(cellId, cellIdx);
2320    UNSET_ONE_BIT(bitPos, ueBitMapPerCell[cellIdx]);
2321 }
2322
2323 /*******************************************************************
2324 *
2325 * @brief Packs and Sends Statistics Request from DUAPP to MAC
2326 *
2327 * @details
2328 *
2329 *    Function : packDuMacStatsReq
2330 *
2331 *    Functionality:
2332 *       Packs and Sends statistics request from DUAPP to MAC
2333 *
2334 *
2335 * @params[in] Post structure pointer
2336 *             StatsReq pointer
2337 * @return ROK     - success
2338 *         RFAILED - failure
2339 *
2340 * ****************************************************************/
2341 uint8_t packDuMacStatsReq(Pst *pst, MacStatsReq *statsReq)
2342 {
2343     Buffer *mBuf = NULLP;
2344
2345     if(pst->selector == ODU_SELECTOR_LWLC)
2346     {
2347        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2348        {
2349           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsReq");
2350           return RFAILED;
2351        }
2352        /* pack the address of the structure */
2353        CMCHKPK(oduPackPointer,(PTR)statsReq, mBuf);
2354     }
2355     else
2356     {
2357        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsReq");
2358        return RFAILED;
2359     }
2360     return ODU_POST_TASK(pst,mBuf);
2361 }
2362
2363 /*******************************************************************
2364 *
2365 * @brief Unpacks Statistics Request received from DU APP
2366 *
2367 * @details
2368 *
2369 *    Function : unpackMacStatsReq 
2370 *
2371 *    Functionality:
2372 *         Unpacks Statistics Request received from DU APP
2373 *
2374 * @params[in] Pointer to Handler
2375 *             Post structure pointer
2376 *             Message Buffer
2377 * @return ROK     - success
2378 *         RFAILED - failure
2379 *
2380 * ****************************************************************/
2381 uint8_t unpackMacStatsReq(DuMacStatsReqFunc func, Pst *pst, Buffer *mBuf)
2382 {
2383     if(pst->selector == ODU_SELECTOR_LWLC)
2384     {
2385        MacStatsReq *statsReq;
2386
2387        /* unpack the address of the structure */
2388        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsReq, mBuf);
2389        ODU_PUT_MSG_BUF(mBuf);
2390        return (*func)(pst, statsReq);
2391     }
2392     else
2393     {
2394        /* Nothing to do for other selectors */
2395        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Request ");
2396        ODU_PUT_MSG_BUF(mBuf);
2397     }
2398
2399     return RFAILED;
2400 }
2401
2402 /*******************************************************************
2403 *
2404 * @brief Packs and Sends Statistics Response from MAC to DUAPP
2405 *
2406 * @details
2407 *
2408 *    Function : packDuMacStatsRsp
2409 *
2410 *    Functionality:
2411 *       Packs and Sends statistics response from MAC to DUAPP
2412 *
2413 *
2414 * @params[in] Post structure pointer
2415 *             StatsRsp pointer
2416 * @return ROK     - success
2417 *         RFAILED - failure
2418 *
2419 * ****************************************************************/
2420 uint8_t packDuMacStatsRsp(Pst *pst, MacStatsRsp *statsRsp)
2421 {
2422     Buffer *mBuf = NULLP;
2423
2424     if(pst->selector == ODU_SELECTOR_LWLC)
2425     {
2426        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2427        {
2428           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsRsp");
2429           return RFAILED;
2430        }
2431        /* pack the address of the structure */
2432        CMCHKPK(oduPackPointer,(PTR)statsRsp, mBuf);
2433     }
2434     else
2435     {
2436        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsRsp");
2437        return RFAILED;
2438     }
2439     return ODU_POST_TASK(pst,mBuf);
2440 }
2441
2442 /*******************************************************************
2443 *
2444 * @brief Unpacks Statistics Response received from MAC
2445 *
2446 * @details
2447 *
2448 *    Function : unpackDuMacStatsRsp
2449 *
2450 *    Functionality:
2451 *         Unpacks Statistics Response received from MAC
2452 *
2453 * @params[in] Pointer to Handler
2454 *             Post structure pointer
2455 *             Message Buffer
2456 * @return ROK     - success
2457 *         RFAILED - failure
2458 *
2459 * ****************************************************************/
2460 uint8_t unpackDuMacStatsRsp(MacDuStatsRspFunc func, Pst *pst, Buffer *mBuf)
2461 {
2462     if(pst->selector == ODU_SELECTOR_LWLC)
2463     {
2464        MacStatsRsp *statsRsp;
2465
2466        /* unpack the address of the structure */
2467        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsRsp, mBuf);
2468        ODU_PUT_MSG_BUF(mBuf);
2469        return (*func)(pst, statsRsp);
2470     }
2471     else
2472     {
2473        /* Nothing to do for other selectors */
2474        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Response ");
2475        ODU_PUT_MSG_BUF(mBuf);
2476     }
2477
2478     return RFAILED;
2479 }
2480
2481 /*******************************************************************
2482 *
2483 * @brief Packs and Sends Statistics Indication from MAC to DUAPP
2484 *
2485 * @details
2486 *
2487 *    Function : packDuMacStatsInd
2488 *
2489 *    Functionality:
2490 *       Packs and Sends statistics response from MAC to DUAPP
2491 *
2492 *
2493 * @params[in] Post structure pointer
2494 *             StatsInd pointer
2495 * @return ROK     - success
2496 *         RFAILED - failure
2497 *
2498 * ****************************************************************/
2499 uint8_t packDuMacStatsInd(Pst *pst, MacStatsInd *statsInd)
2500 {
2501     Buffer *mBuf = NULLP;
2502
2503     if(pst->selector == ODU_SELECTOR_LWLC)
2504     {
2505        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2506        {
2507           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsInd");
2508           return RFAILED;
2509        }
2510        /* pack the address of the structure */
2511        CMCHKPK(oduPackPointer,(PTR)statsInd, mBuf);
2512     }
2513     else
2514     {
2515        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsInd");
2516        return RFAILED;
2517     }
2518     return ODU_POST_TASK(pst,mBuf);
2519 }
2520
2521 /*******************************************************************
2522 *
2523 * @brief Unpacks Statistics Indication received from MAC
2524 *
2525 * @details
2526 *
2527 *    Function : unpackDuMacStatsInd
2528 *
2529 *    Functionality:
2530 *         Unpacks Statistics Indication received from MAC
2531 *
2532 * @params[in] Pointer to Handler
2533 *             Post structure pointer
2534 *             Message Buffer
2535 * @return ROK     - success
2536 *         RFAILED - failure
2537 *
2538 * ****************************************************************/
2539 uint8_t unpackDuMacStatsInd(MacDuStatsIndFunc func, Pst *pst, Buffer *mBuf)
2540 {
2541     if(pst->selector == ODU_SELECTOR_LWLC)
2542     {
2543        MacStatsInd *statsInd;
2544
2545        /* unpack the address of the structure */
2546        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsInd, mBuf);
2547        ODU_PUT_MSG_BUF(mBuf);
2548        return (*func)(pst, statsInd);
2549     }
2550     else
2551     {
2552        /* Nothing to do for other selectors */
2553        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Indication ");
2554        ODU_PUT_MSG_BUF(mBuf);
2555     }
2556
2557     return RFAILED;
2558 }
2559
2560 /*******************************************************************
2561 *
2562 * @brief Packs and Sends Statistics Delete Request from DUAPP to MAC
2563 *
2564 * @details
2565 *
2566 *    Function : packDuMacStatsDeleteReq
2567 *
2568 *    Functionality:
2569 *       Packs and Sends statistics Delete Request from DUAPP to MAC
2570 *
2571 *
2572 * @params[in] Post structure pointer
2573 *             StatsDeleteReq pointer
2574 * @return ROK     - success
2575 *         RFAILED - failure
2576 *
2577 * ****************************************************************/
2578 uint8_t packDuMacStatsDeleteReq(Pst *pst, MacStatsDeleteReq *statsDeleteReq)
2579 {
2580     Buffer *mBuf = NULLP;
2581
2582     if(pst->selector == ODU_SELECTOR_LWLC)
2583     {
2584        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2585        {
2586           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsDeleteReq");
2587           return RFAILED;
2588        }
2589        /* pack the address of the structure */
2590        CMCHKPK(oduPackPointer,(PTR)statsDeleteReq, mBuf);
2591     }
2592     else
2593     {
2594        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsDeleteReq");
2595        return RFAILED;
2596     }
2597     return ODU_POST_TASK(pst,mBuf);
2598 }
2599
2600 /*******************************************************************
2601 *
2602 * @brief Unpacks Statistics Delete Request received from DU APP
2603 *
2604 * @details
2605 *
2606 *    Function : unpackMacStatsDeleteReq
2607 *
2608 *    Functionality:
2609 *         Unpacks Statistics Delete Request received from DU APP
2610 *
2611 * @params[in] Pointer to Handler
2612 *             Post structure pointer
2613 *             Message Buffer
2614 * @return ROK     - success
2615 *         RFAILED - failure
2616 *
2617 * ****************************************************************/
2618 uint8_t unpackMacStatsDeleteReq(DuMacStatsDeleteReqFunc func, Pst *pst, Buffer *mBuf)
2619 {
2620     if(pst->selector == ODU_SELECTOR_LWLC)
2621     {
2622        MacStatsDeleteReq *statsDeleteReq;
2623
2624        /* unpack the address of the structure */
2625        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsDeleteReq, mBuf);
2626        ODU_PUT_MSG_BUF(mBuf);
2627        return (*func)(pst, statsDeleteReq);
2628     }
2629     else
2630     {
2631        /* Nothing to do for other selectors */
2632        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Delete Request ");
2633        ODU_PUT_MSG_BUF(mBuf);
2634     }
2635
2636     return RFAILED;
2637 }
2638
2639 /*******************************************************************
2640 *
2641 * @brief Packs and Sends Statistics Delete Response from MAC to DUAPP
2642 *
2643 * @details
2644 *
2645 *    Function : packDuMacStatsDeleteRsp
2646 *
2647 *    Functionality:
2648 *       Packs and Sends Statistics Delete Response from MAC to DUAPP
2649 *
2650 *
2651 * @params[in] Post structure pointer
2652 *             StatsDeleteRsp pointer
2653 * @return ROK     - success
2654 *         RFAILED - failure
2655 *
2656 * ****************************************************************/
2657 uint8_t packDuMacStatsDeleteRsp(Pst *pst, MacStatsDeleteRsp *statsRsp)
2658 {
2659     Buffer *mBuf = NULLP;
2660
2661     if(pst->selector == ODU_SELECTOR_LWLC)
2662     {
2663        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2664        {
2665           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsDeleteRsp");
2666           return RFAILED;
2667        }
2668        /* pack the address of the structure */
2669        CMCHKPK(oduPackPointer,(PTR)statsRsp, mBuf);
2670     }
2671     else
2672     {
2673        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsDeleteRsp");
2674        return RFAILED;
2675     }
2676     return ODU_POST_TASK(pst,mBuf);
2677 }
2678
2679 /*******************************************************************
2680 *
2681 * @brief Unpacks Statistics Delete Response received from MAC
2682 *
2683 * @details
2684 *
2685 *    Function : unpackDuMacStatsDeleteRsp
2686 *
2687 *    Functionality:
2688 *         Unpacks Statistics Delete Response received from MAC
2689 *
2690 * @params[in] Pointer to Handler
2691 *             Post structure pointer
2692 *             Message Buffer
2693 * @return ROK     - success
2694 *         RFAILED - failure
2695 *
2696 * ****************************************************************/
2697 uint8_t unpackDuMacStatsDeleteRsp(MacDuStatsDeleteRspFunc func, Pst *pst, Buffer *mBuf)
2698 {
2699     if(pst->selector == ODU_SELECTOR_LWLC)
2700     {
2701        MacStatsDeleteRsp *statsRsp;
2702
2703        /* unpack the address of the structure */
2704        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsRsp, mBuf);
2705        ODU_PUT_MSG_BUF(mBuf);
2706        return (*func)(pst, statsRsp);
2707     }
2708     else
2709     {
2710        /* Nothing to do for other selectors */
2711        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Delete Response ");
2712        ODU_PUT_MSG_BUF(mBuf);
2713     }
2714
2715     return RFAILED;
2716 }
2717
2718 /*******************************************************************
2719 *
2720 * @brief Packs and Sends Statistics Modification Request from DUAPP to MAC
2721 *
2722 * @details
2723 *
2724 *    Function : packDuMacStatsModificationReq
2725 *
2726 *    Functionality:
2727 *       Packs and Sends statistics Modification request from DUAPP to MAC
2728 *
2729 *
2730 * @params[in] Post structure pointer
2731 *             StatsModificationReq pointer
2732 * @return ROK     - success
2733 *         RFAILED - failure
2734 *
2735 * ****************************************************************/
2736 uint8_t packDuMacStatsModificationReq(Pst *pst, MacStatsModificationReq *statsModificationReq)
2737 {
2738     Buffer *mBuf = NULLP;
2739
2740     if(pst->selector == ODU_SELECTOR_LWLC)
2741     {
2742        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2743        {
2744           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsModificationReq");
2745           return RFAILED;
2746        }
2747        /* pack the address of the structure */
2748        CMCHKPK(oduPackPointer,(PTR)statsModificationReq, mBuf);
2749     }
2750     else
2751     {
2752        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsModificationReq");
2753        return RFAILED;
2754     }
2755     return ODU_POST_TASK(pst,mBuf);
2756 }
2757
2758 /*******************************************************************
2759 *
2760 * @brief Unpacks Statistics Modification Request received from DU APP
2761 *
2762 * @details
2763 *
2764 *    Function : unpackMacStatsModificationReq
2765 *
2766 *    Functionality:
2767 *         Unpacks Statistics Modification Request received from DU APP
2768 *
2769 * @params[in] Pointer to Handler
2770 *             Post structure pointer
2771 *             Message Buffer
2772 * @return ROK     - success
2773 *         RFAILED - failure
2774 *
2775 * ****************************************************************/
2776 uint8_t unpackMacStatsModificationReq(DuMacStatsModificationReqFunc func, Pst *pst, Buffer *mBuf)
2777 {
2778     if(pst->selector == ODU_SELECTOR_LWLC)
2779     {
2780        MacStatsModificationReq *statsModificationReq=NULLP;
2781
2782        /* unpack the address of the structure */
2783        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsModificationReq, mBuf);
2784        ODU_PUT_MSG_BUF(mBuf);
2785        return (*func)(pst, statsModificationReq);
2786     }
2787     else
2788     {
2789        /* Nothing to do for other selectors */
2790        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Modification Request ");
2791        ODU_PUT_MSG_BUF(mBuf);
2792     }
2793
2794     return RFAILED;
2795 }
2796
2797 /*******************************************************************
2798 *
2799 * @brief Packs and Sends Statistics Modification Response from MAC to DUAPP
2800 *
2801 * @details
2802 *
2803 *    Function : packDuMacStatsModificationRsp
2804 *
2805 *    Functionality:
2806 *       Packs and Sends statistics Modification response from MAC to DUAPP
2807 *
2808 *
2809 * @params[in] Post structure pointer
2810 *             StatsModificationRsp pointer
2811 * @return ROK     - success
2812 *         RFAILED - failure
2813 *
2814 * ****************************************************************/
2815 uint8_t packDuMacStatsModificationRsp(Pst *pst, MacStatsModificationRsp *statsModificationRsp)
2816 {
2817     Buffer *mBuf = NULLP;
2818
2819     if(pst->selector == ODU_SELECTOR_LWLC)
2820     {
2821        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
2822        {
2823           DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacStatsModificationRsp");
2824           return RFAILED;
2825        }
2826        /* pack the address of the structure */
2827        CMCHKPK(oduPackPointer,(PTR)statsModificationRsp, mBuf);
2828     }
2829     else
2830     {
2831        DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacStatsModificationRsp");
2832        return RFAILED;
2833     }
2834     return ODU_POST_TASK(pst,mBuf);
2835 }
2836
2837 /*******************************************************************
2838 *
2839 * @brief Unpacks Statistics Modification Response received from MAC
2840 *
2841 * @details
2842 *
2843 *    Function : unpackDuMacStatsModificationRsp
2844 *
2845 *    Functionality:
2846 *         Unpacks Statistics Modification Response received from MAC
2847 *
2848 * @params[in] Pointer to Handler
2849 *             Post structure pointer
2850 *             Message Buffer
2851 * @return ROK     - success
2852 *         RFAILED - failure
2853 *
2854 * ****************************************************************/
2855 uint8_t unpackDuMacStatsModificationRsp(MacDuStatsModificationRspFunc func, Pst *pst, Buffer *mBuf)
2856 {
2857     if(pst->selector == ODU_SELECTOR_LWLC)
2858     {
2859        MacStatsModificationRsp *statsModificationRsp=NULLP;
2860
2861        /* unpack the address of the structure */
2862        CMCHKUNPK(oduUnpackPointer, (PTR *)&statsModificationRsp, mBuf);
2863        ODU_PUT_MSG_BUF(mBuf);
2864        return (*func)(pst, statsModificationRsp);
2865     }
2866     else
2867     {
2868        /* Nothing to do for other selectors */
2869        DU_LOG("\nERROR  -->  DU APP : Only LWLC supported for Statistics Modification Response ");
2870        ODU_PUT_MSG_BUF(mBuf);
2871     }
2872
2873     return RFAILED;
2874 }
2875
2876 /**********************************************************************
2877   End of file
2878  **********************************************************************/