EGTP receiver thread creation
[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
22 /**************************************************************************
23  * @brief Function to pack Loose Coupled 
24  *        MAC cell config parameters required by MAC
25  *
26  * @details
27  *
28  *      Function : packMacCellCfg
29  *
30  *      Functionality:
31  *           packs the macCellCfg parameters
32  *
33  * @param[in] Pst     *pst, Post structure of the primitive.
34  * @param[in] MacCellCfg  *macCellCfg, mac cell config parameters.
35  * @return ROK     - success
36  *         RFAILED - failure
37  *
38  ***************************************************************************/
39 uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
40 {
41    if(pst->selector == ODU_SELECTOR_LC)
42    {
43       /* we are now implemented only light wieght lossely coupled interface */
44       return RFAILED;
45    }
46    else if(pst->selector == ODU_SELECTOR_LWLC)
47    {
48       Buffer *mBuf = NULLP;
49
50       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) 
51       {
52          return RFAILED;
53       }
54
55       /* pack the address of the structure */
56       CMCHKPK(oduPackPointer,(PTR)macCellCfg, mBuf);
57
58       DU_LOG("\nDU-APP : MAC CELL config sent");
59       return ODU_POST_TASK(pst,mBuf);
60    } 
61    return ROK;
62 }
63
64 /**************************************************************************
65  * @brief Function to pack Loose Coupled 
66  *        MAC cell config parameters required by MAC
67  *
68  * @details
69  *
70  *      Function : unpackDuMacCellCfg
71  *
72  *      Functionality:
73  *           packs the macCellCfg parameters
74  *
75  * @param[in] DuMacCellCfgReq func; function pointer
76  * @param[in] Pst     *pst, Post structure of the primitive.
77  * @param[in] Buffer *mBuf
78  * @return ROK     - success
79  *         RFAILED - failure
80  *
81  ***************************************************************************/
82 uint8_t  unpackDuMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf)
83 {
84    uint16_t ret = ROK;
85    MacCellCfg *macCellCfg;
86
87    if(pst->selector == ODU_SELECTOR_LWLC)
88    {
89       /* unpack the address of the structure */
90       CMCHKUNPK(oduUnpackPointer, (PTR *)&macCellCfg, mBuf);
91       ret = (*func)(pst, macCellCfg);
92    }
93    else
94    {
95       /* only LWLC is implemented now */
96       ret = ROK;
97    }
98
99    return ret;
100 }
101
102 /**************************************************************************
103  * @brief Function to pack Loose Coupled 
104  *        MAC cell config confirm message
105  *
106  * @details
107  *
108  *      Function : packMacCellCfgCfm
109  *
110  *      Functionality:
111  *           packs the transaction ID  
112  *
113  * @param[in] Pst     *pst, Post structure of the primitive.
114  * @param[in] MacCellCfgCfm  *macCellCfgCfm, mac cell config confirm.
115  * @return ROK     - success
116  *         RFAILED - failure
117  *
118  ***************************************************************************/
119 uint8_t  packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
120 {
121    if(pst->selector == ODU_SELECTOR_LC)
122    {
123       Buffer *mBuf = NULLP;
124       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) 
125       {
126          return RFAILED;
127       }
128
129       /* pack the transaction ID in CNF structure */
130       CMCHKPK(oduUnpackUInt16, macCellCfgCfm->cellId, mBuf);
131       CMCHKPK(oduUnpackUInt8, macCellCfgCfm->rsp, mBuf);
132
133       return ODU_POST_TASK(pst,mBuf);
134    }
135    else if(pst->selector == ODU_SELECTOR_LWLC)
136    {
137       /* only LC is supported */
138       return RFAILED;
139    }
140    return ROK;
141 }
142
143 /**************************************************************************
144  * @brief Function to pack MAC cell config confirm message
145  *
146  * @details
147  *
148  *      Function : unpackMacCellCfgCfm
149  *
150  *      Functionality:
151  *           packs the transaction ID  
152  *
153  * @param[in] DuMacCellCfgCfm func; function pointer
154  * @param[in] Pst     *pst, Post structure of the primitive.
155  * @param[in] Buffer *mBuf
156  * @return ROK     - success
157  *         RFAILED - failure
158  *
159  ***************************************************************************/
160 uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf)
161 {
162    MacCellCfgCfm macCellCfgCfm;
163
164    if(pst->selector == ODU_SELECTOR_LC)
165    {
166       /* unpack the transaction ID in CNF structure */
167       CMCHKUNPK(oduPackUInt8, &(macCellCfgCfm.rsp), mBuf);
168       CMCHKUNPK(oduPackUInt16, &(macCellCfgCfm.cellId), mBuf);
169       return (*func)(pst, &macCellCfgCfm);
170    }
171    else
172    {
173       /* only loose coupling is suported */
174       return ROK;
175    }
176 }
177
178 /*******************************************************************
179  *
180  * @brief Packs and Send Cell Start Request to MAC
181  *
182  * @details
183  *
184  *    Function : packMacCellStart
185  *
186  *    Functionality:
187  *      Packs and Sends Cell Start Request to MAC
188  *
189  * @params[in] Post structure pointer
190  *             Cell Id
191  * @return ROK     - success
192  *         RFAILED - failure
193  *
194  * ****************************************************************/
195 uint8_t packMacCellStart(Pst *pst, OduCellId *cellId)
196 {
197    Buffer *mBuf = NULLP;
198
199    if(pst->selector == ODU_SELECTOR_LC)
200    {
201       /* Loose coupling not supported */
202       return RFAILED;
203    }
204    else if(pst->selector == ODU_SELECTOR_LWLC)
205    {
206
207       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
208       {
209          DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
210          return RFAILED;
211       }
212
213       /* pack the address of the structure */
214       CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
215
216    }
217    return ODU_POST_TASK(pst,mBuf);
218 }
219
220 /*******************************************************************
221  *
222  * @brief Unpacks MAC Cell Start Request from DU APP
223  *
224  * @details
225  *
226  *    Function : unpackMaCellStart
227  *
228  *    Functionality:
229  *      Unpacks MAC Cell Start Request from DU APP
230  *
231  * @params[in] Function pointer of cell start request handler
232  *             Post structure pointer
233  *             Message Buffer
234  * @return ROK     - success
235  *         RFAILED - failure
236  *
237  * ****************************************************************/
238 uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf)
239 {
240    OduCellId  *cellId;
241
242    if(pst->selector == ODU_SELECTOR_LWLC)
243    {
244       /* unpack the address of the structure */
245       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
246       ODU_PUT_MSG_BUF(mBuf); 
247       return (*func)(pst, cellId);
248    }
249    else
250    {
251       /* Nothing to do for loose coupling */
252       ODU_PUT_MSG_BUF(mBuf);
253       return ROK;
254    }
255 }
256
257 /*******************************************************************
258  *
259  * @brief Packs and Send cell stop request to MAC
260  *
261  * @details
262  *
263  *    Function : packMacCellStop
264  *
265  *    Functionality:
266  *       Packs and Send cell stop request to MAC
267  *
268  * @params[in] Post structure pointer
269  *             Cell Id 
270  * @return ROK     - success
271  *         RFAILED - failure
272  *
273  * ****************************************************************/
274 uint8_t packMacCellStop(Pst *pst, OduCellId  *cellId)
275 {
276    if(pst->selector == ODU_SELECTOR_LC)
277    {
278       /* Loose coupling not supported */
279       return RFAILED;
280    }
281    else if(pst->selector == ODU_SELECTOR_LWLC)
282    {
283       Buffer *mBuf = NULLP;
284
285       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
286       {
287          DU_LOG("\nDU APP : Memory allocation failed for cell stop req pack");
288          return RFAILED;
289       }
290
291       /* pack the address of the structure */
292       CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
293
294       return ODU_POST_TASK(pst,mBuf);
295    }
296    return ROK;
297 }
298
299 /*******************************************************************
300  *
301  * @brief Unpacks cell stop request from DU APP 
302  *
303  * @details
304  *
305  *    Function : unpackMaCellStop 
306  *
307  *    Functionality:
308  *       Unpacks cell stop request from DU APP 
309  *
310  * @params[in] Handler function pointer
311  *             Post structure pointer
312  *             Message Buffer
313  * @return ROK     - success
314  *         RFAILED - failure
315  *
316  * ****************************************************************/
317 uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf)
318 {
319    OduCellId *cellId;
320    
321    if(pst->selector == ODU_SELECTOR_LWLC)
322    {
323       /* unpack the address of the structure */
324       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
325       ODU_PUT_MSG_BUF(mBuf);
326       return (*func)(pst, cellId);
327    }
328    else
329    {
330       /* Nothing to do for loose coupling */
331       ODU_PUT_MSG_BUF(mBuf);
332       return ROK;
333    }
334 }
335
336 /*******************************************************************
337  *
338  * @brief Packs and Sends cell up ind from MAC to DUAPP
339  *
340  * @details
341  *
342  *    Function : packMacCellUpInd
343  *
344  *    Functionality:
345  *       Packs and Sends cell up ind from MAC to DUAPP
346  *
347  * @params[in] Post structure pointer
348  *             Cell Id
349  * @return ROK     - success
350  *         RFAILED - failure
351  *
352  * ****************************************************************/
353 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId)
354 {
355    Buffer *mBuf = NULLP;
356
357    if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
358    {
359       DU_LOG("\nDU APP : Memory allocation failed for packMacCellUpInd");
360       return RFAILED;
361    }
362
363    if(pst->selector == ODU_SELECTOR_LC)
364    {
365       CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf);
366       CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
367       cellId = NULL;
368    }
369    else if(pst->selector == ODU_SELECTOR_LWLC)
370    {
371       /* pack the address of the structure */
372       CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
373    }
374    else
375    {
376       ODU_PUT_MSG_BUF(mBuf);
377    }
378
379    return ODU_POST_TASK(pst, mBuf);
380 }
381
382 /*******************************************************************
383  *
384  * @brief Unpacks cell up indication from MAC
385  *
386  * @details
387  *
388  *    Function : unpackMacCellUpInd
389  *
390  *    Functionality:
391  *         Unpacks cell up indication from MAC
392  *
393  * @params[in] Pointer to Handler
394  *             Post structure pointer
395  *             Message Buffer
396  * @return ROK     - success
397  *         RFAILED - failure
398  *
399  * ****************************************************************/
400 uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf)
401 {
402    if(pst->selector == ODU_SELECTOR_LWLC)
403    {
404       OduCellId *cellId;
405
406       /* unpack the address of the structure */
407       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
408       ODU_PUT_MSG_BUF(mBuf);
409       return (*func)(pst, cellId);
410    }
411    else if(pst->selector == ODU_SELECTOR_LC)
412    {
413       OduCellId cellId;
414       CMCHKUNPK(oduPackUInt16, &cellId.cellId, mBuf);
415       ODU_PUT_MSG_BUF(mBuf);
416       return (*func)(pst, &cellId);
417    }
418    else
419    {
420       /* Nothing to do for loose coupling */
421       ODU_PUT_MSG_BUF(mBuf);
422       return ROK;
423    }
424    return ROK;
425 }
426
427 /*******************************************************************
428  *
429  * @brief Packs and Sends stop ind from MAC to DUAPP
430  *
431  * @details
432  *
433  *    Function : packMacStopInd
434  *
435  *    Functionality:
436  *       Packs and Sends stop ind from MAC to DUAPP
437  *
438  * @params[in] Post structure pointer
439  * @return ROK     - success
440  *         RFAILED - failure
441  *
442  * ****************************************************************/
443 uint8_t packMacStopInd(Pst *pst, OduCellId *cellId)
444 {
445    Buffer *mBuf = NULLP;
446
447    if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
448    {
449       DU_LOG("\nDU APP : Memory allocation failed for stop Ind pack");
450       return RFAILED;
451    }
452
453    if(pst->selector == ODU_SELECTOR_LC)
454    {
455       /*pack the payload here*/
456       DU_LOG("\nDU APP : Packed CellId");
457       CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf);
458       CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
459       cellId = NULL;
460    }
461    else if(pst->selector == ODU_SELECTOR_LWLC)
462    {
463       /* pack the address of the structure */
464       CMCHKPK(oduPackPointer,(PTR)cellId, mBuf);
465    }
466    else
467    {
468       ODU_PUT_MSG_BUF(mBuf);
469    }
470
471    return ODU_POST_TASK(pst,mBuf);
472 }
473
474 /*******************************************************************
475  *
476  * @brief Unpacks stop indication from MAC
477  *
478  * @details
479  *
480  *    Function : unpackMacStopInd
481  *
482  *    Functionality:
483  *         Unpacks stop indication from MAC
484  *
485  * @params[in] Pointer to Handler
486  *             Post structure pointer
487  *             Message Buffer
488  * @return ROK     - success
489  *         RFAILED - failure
490  *
491  * ****************************************************************/
492 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
493 {
494    if(pst->selector == ODU_SELECTOR_LWLC)
495    {
496       OduCellId *cellId;
497       /* unpack the address of the structure */
498       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
499       ODU_PUT_MSG_BUF(mBuf);
500       return (*func)(pst, cellId);
501    }
502    else if(pst->selector == ODU_SELECTOR_LC)
503    {
504       OduCellId cellId;
505       CMCHKUNPK(oduPackUInt16, &(cellId.cellId), mBuf);
506
507       ODU_PUT_MSG_BUF(mBuf);
508       return (*func)(pst, &cellId);
509
510    }
511    else
512    {
513       /* Nothing to do for loose coupling */
514       ODU_PUT_MSG_BUF(mBuf);
515       return ROK;
516    }
517    return ROK;
518 }
519
520 /*******************************************************************
521  *
522  * @brief Packs and Sends UL CCCH Ind from MAC to DUAPP
523  *
524  * @details
525  *
526  *    Function : packMacUlCcchInd
527  *
528  *    Functionality:
529  *       Packs and Sends UL CCCH Ind from MAC to DUAPP
530  *
531  * @params[in] Post structure pointer
532  *             UL CCCH Ind pointer              
533  * @return ROK     - success
534  *         RFAILED - failure
535  *
536  * ****************************************************************/
537 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
538 {
539    Buffer *mBuf = NULLP;
540
541    if(pst->selector == ODU_SELECTOR_LWLC)
542    {
543       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
544       {
545          DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
546          return RFAILED;
547       }
548       /* pack the address of the structure */
549       CMCHKPK(oduPackPointer,(PTR)ulCcchIndInfo, mBuf);
550    }
551    else
552    {
553       DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind ");
554       return RFAILED;
555    }
556
557    return ODU_POST_TASK(pst,mBuf);
558 }
559
560 /*******************************************************************
561  *
562  * @brief Unpacks UL CCCH indication from MAC
563  *
564  * @details
565  *
566  *    Function : unpackMacUlCcchInd
567  *
568  *    Functionality:
569  *         Unpacks UL CCCH indication from MAC
570  *
571  * @params[in] Pointer to Handler
572  *             Post structure pointer
573  *             Message Buffer
574  * @return ROK     - success
575  *         RFAILED - failure
576  *
577  * ****************************************************************/
578 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
579 {
580    if(pst->selector == ODU_SELECTOR_LWLC)
581    {
582       UlCcchIndInfo *ulCcchIndInfo;
583
584       /* unpack the address of the structure */
585       CMCHKUNPK(oduUnpackPointer, (PTR *)&ulCcchIndInfo, mBuf);
586       ODU_PUT_MSG_BUF(mBuf);
587       return (*func)(pst, ulCcchIndInfo);
588    }
589    else
590    {
591       /* Nothing to do for other selectors */
592       DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
593       ODU_PUT_MSG_BUF(mBuf);
594    }
595    return RFAILED;
596 }
597
598 /*******************************************************************
599  *
600  * @brief Packs and Sends DL CCCH Ind from DUAPP to MAC
601  *
602  * @details
603  *
604  *    Function : packMacDlCcchInd
605  *
606  *    Functionality:
607  *       Packs and Sends DL CCCH Ind from DUAPP to MAC
608  *
609  *
610  * @params[in] Post structure pointer
611  *             DL CCCH Ind pointer              
612  * @return ROK     - success
613  *         RFAILED - failure
614  *
615  * ****************************************************************/
616 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
617 {
618    Buffer *mBuf = NULLP;
619
620    if(pst->selector == ODU_SELECTOR_LWLC)
621    {
622       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
623       {
624          DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
625          return RFAILED;
626       }
627       /* pack the address of the structure */
628       CMCHKPK(oduPackPointer,(PTR)dlCcchIndInfo, mBuf);
629    }
630    else
631    {
632       DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind ");
633       return RFAILED;
634    }
635
636    return ODU_POST_TASK(pst,mBuf);
637 }
638
639 /*******************************************************************
640  *
641  * @brief Unpacks DL CCCH indication from DU APP
642  *
643  * @details
644  *
645  *    Function : unpackMacDlCcchInd
646  *
647  *    Functionality:
648  *         Unpacks DL CCCH indication from DU APP
649  *
650  * @params[in] Pointer to Handler
651  *             Post structure pointer
652  *             Message Buffer
653  * @return ROK     - success
654  *         RFAILED - failure
655  *
656  * ****************************************************************/
657 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
658 {
659    if(pst->selector == ODU_SELECTOR_LWLC)
660    {
661       DlCcchIndInfo *dlCcchIndInfo;
662
663       /* unpack the address of the structure */
664       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlCcchIndInfo, mBuf);
665       ODU_PUT_MSG_BUF(mBuf);
666       return (*func)(pst, dlCcchIndInfo);
667    }
668    else
669    {
670       /* Nothing to do for other selectors */
671       DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
672       ODU_PUT_MSG_BUF(mBuf);
673    }
674
675    return RFAILED;
676 }
677
678 /*******************************************************************
679  *
680  * @brief Packs and Sends UE create Request from DUAPP to MAC
681  *
682  * @details
683  *
684  *    Function : packDuMacUeCreateReq
685  *
686  *    Functionality:
687  *       Packs and Sends UE Create Request from DUAPP to MAC
688  *
689  *
690  * @params[in] Post structure pointer
691  *             MacUeCfg pointer              
692  * @return ROK     - success
693  *         RFAILED - failure
694  *
695  * ****************************************************************/
696 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
697 {
698    Buffer *mBuf = NULLP;
699
700    if(pst->selector == ODU_SELECTOR_LWLC)
701    {
702       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
703       {
704          DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq");
705          return RFAILED;
706       }
707       /* pack the address of the structure */
708       CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
709    }
710    else
711    {
712       DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCreateReq");
713       return RFAILED;
714    }
715
716    return ODU_POST_TASK(pst,mBuf);
717 }
718
719 /*******************************************************************
720  *
721  * @brief Unpacks UE Create Request received from DU APP
722  *
723  * @details
724  *
725  *    Function : unpackMacUeCreateReq
726  *
727  *    Functionality:
728  *         Unpacks UE Create Request received from DU APP
729  *
730  * @params[in] Pointer to Handler
731  *             Post structure pointer
732  *             Message Buffer
733  * @return ROK     - success
734  *         RFAILED - failure
735  *
736  * ****************************************************************/
737 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
738 {
739    if(pst->selector == ODU_SELECTOR_LWLC)
740    {
741       MacUeCfg *ueCfg;
742
743       /* unpack the address of the structure */
744       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
745       ODU_PUT_MSG_BUF(mBuf);
746       return (*func)(pst, ueCfg);
747    }
748    else
749    {
750       /* Nothing to do for other selectors */
751       DU_LOG("\n Only LWLC supported for UE Create Request ");
752       ODU_PUT_MSG_BUF(mBuf);
753    }
754
755    return RFAILED;
756 }
757
758 /*******************************************************************
759  *
760  * @brief Pack and send UE config response from MAC to DU APP
761  *
762  * @details
763  *
764  *    Function : packDuMacUeCfgRsp
765  *
766  *    Functionality:
767  *       Pack and send UE config response from MAC to DU APP
768  *
769  * @params[in] 
770  * @return ROK     - success
771  *         RFAILED - failure
772  *
773  * ****************************************************************/
774 uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
775 {
776    Buffer *mBuf = NULLP;
777
778    if(pst->selector == ODU_SELECTOR_LWLC)
779    {
780       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
781       {
782          DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp");
783          return RFAILED;
784       }
785       /* pack the address of the structure */
786       CMCHKPK(oduPackPointer,(PTR)cfgRsp, mBuf);
787    }
788    else
789    {
790       DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCfgRsp");
791       return RFAILED;
792    }
793
794    return ODU_POST_TASK(pst,mBuf);
795 }
796
797 /*******************************************************************
798  *
799  * @brief Unpack UE Config Response from MAC to DU APP
800  *
801  * @details
802  *
803  *    Function : unpackDuMacUeCfgRsp
804  *
805  *    Functionality: Unpack UE Config Response from MAC to DU APP
806  *
807  * @params[in] 
808  * @return ROK     - success
809  *         RFAILED - failure
810  *
811  * ****************************************************************/
812 uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf)
813 {
814    if(pst->selector == ODU_SELECTOR_LWLC)
815    {
816       MacUeCfgRsp *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  *             MacUeCfg pointer              
842  * @return ROK     - success
843  *         RFAILED - failure
844  *
845  * ****************************************************************/
846 uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *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("\nMAC : 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("\nMAC: Only LWLC supported for packDuMacUeReconfigReq");
863       return RFAILED;
864    }
865
866    return ODU_POST_TASK(pst,mBuf);
867 }
868 /*******************************************************************
869  *
870  * @brief Unpacks UE Reconfig Request received from DU APP
871  *
872  * @details
873  *
874  *    Function : unpackMacUeReconfigReq
875  *
876  *    Functionality:
877  *         Unpacks UE Reconfig Request received from DU APP
878  *
879  * @params[in] Pointer to Handler
880  *             Post structure pointer
881  *             Message Buffer
882  * @return ROK     - success
883  *         RFAILED - failure
884  *
885  * ****************************************************************/
886 uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf)
887 {
888    if(pst->selector == ODU_SELECTOR_LWLC)
889    {
890       MacUeCfg *ueCfg;
891
892       /* unpack the address of the structure */
893       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
894       ODU_PUT_MSG_BUF(mBuf);
895       return (*func)(pst, ueCfg);
896    }
897    else
898    {
899       /* Nothing to do for other selectors */
900       DU_LOG("\n Only LWLC supported for UE Create Request ");
901       ODU_PUT_MSG_BUF(mBuf);
902    }
903
904    return RFAILED;
905 }
906
907 /**********************************************************************
908   End of file
909  **********************************************************************/