MAC Clean-up [Issue-ID: ODUHIGH-212]
[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 (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
51       {
52          return RFAILED;
53       }
54
55       /* pack the address of the structure */
56       CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf);
57
58       DU_LOG("\nDU-APP : MAC CELL config sent");
59       return SPstTsk(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    U16 ret = ROK;
85    MacCellCfg *macCellCfg;
86
87    if(pst->selector == ODU_SELECTOR_LWLC)
88    {
89       /* unpack the address of the structure */
90       CMCHKUNPK(cmUnpkPtr, (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 (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
125       {
126          return RFAILED;
127       }
128
129       /* pack the transaction ID in CNF structure */
130       CMCHKPK(SPkU16, macCellCfgCfm->cellId, mBuf);
131       CMCHKPK(SPkU8, macCellCfgCfm->rsp, mBuf);
132
133       return SPstTsk(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(SUnpkU8, &(macCellCfgCfm.rsp), mBuf);
168       CMCHKUNPK(SUnpkU16, &(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 : packMacCellStartReq
185  *
186  *    Functionality:
187  *      Packs and Sends Cell Start Request to MAC
188  *
189  * @params[in] Post structure pointer
190  *             MacCellStartInfo pointer
191  * @return ROK     - success
192  *         RFAILED - failure
193  *
194  * ****************************************************************/
195 uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
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 (SGetMsg(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(cmPkPtr,(PTR)cellStartInfo, mBuf);
215
216    }
217    return SPstTsk(pst,mBuf);
218 }
219
220 /*******************************************************************
221  *
222  * @brief Unpacks MAC Cell Start Request from DU APP
223  *
224  * @details
225  *
226  *    Function : unpackMaCellStartReq
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  *             Cell Start Request Info Pointer
234  * @return ROK     - success
235  *         RFAILED - failure
236  *
237  * ****************************************************************/
238 uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf)
239 {
240    MacCellStartInfo  *cellStartInfo;
241
242    if(pst->selector == ODU_SELECTOR_LWLC)
243    {
244       /* unpack the address of the structure */
245       CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStartInfo, mBuf);
246       SPutMsg(mBuf); 
247       return (*func)(pst, cellStartInfo);
248    }
249    else
250    {
251       /* Nothing to do for loose coupling */
252       SPutMsg(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 : packMacCellStopReq
264  *
265  *    Functionality:
266  *       Packs and Send cell stop request to MAC
267  *
268  * @params[in] Post structure pointer
269  *             Cell stop info structure 
270  * @return ROK     - success
271  *         RFAILED - failure
272  *
273  * ****************************************************************/
274 uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
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 (SGetMsg(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(cmPkPtr,(PTR)cellStopInfo, mBuf);
293
294       return SPstTsk(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 : unpackMaCellStopReq 
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 unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf)
318 {
319    MacCellStopInfo  *cellStopInfo;
320
321    if(pst->selector == ODU_SELECTOR_LWLC)
322    {
323       /* unpack the address of the structure */
324       CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStopInfo, mBuf);
325       SPutMsg(mBuf);
326       return (*func)(pst, cellStopInfo);
327    }
328    else
329    {
330       /* Nothing to do for loose coupling */
331       SPutMsg(mBuf);
332       return ROK;
333    }
334 }
335
336 /*******************************************************************
337  *
338  * @brief Packs and Sends slot ind from MAC to DUAPP
339  *
340  * @details
341  *
342  *    Function : packMacSlotInd
343  *
344  *    Functionality:
345  *       Packs and Sends slot ind from MAC to DUAPP
346  *
347  * @params[in] Post structure pointer
348  *             Slot Info pointer              
349  * @return ROK     - success
350  *         RFAILED - failure
351  *
352  * ****************************************************************/
353 uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo )
354 {
355    Buffer *mBuf = NULLP;
356
357    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
358    {
359       DU_LOG("\nDU APP : Memory allocation failed for cell start req pack");
360       return RFAILED;
361    }
362
363    if(pst->selector == ODU_SELECTOR_LC)
364    {
365       CMCHKPK(SPkU16, slotInfo->cellId, mBuf);
366       CMCHKPK(SPkU16, slotInfo->sfn, mBuf);
367       CMCHKPK(SPkU16, slotInfo->slot, mBuf);
368
369       CM_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotIndInfo));
370       slotInfo = NULL;
371    }
372    else if(pst->selector == ODU_SELECTOR_LWLC)
373    {
374       /* pack the address of the structure */
375       CMCHKPK(cmPkPtr,(PTR)slotInfo, mBuf);
376    }
377    else
378    {
379       SPutMsg(mBuf);
380    }
381
382    return SPstTsk(pst,mBuf);
383 }
384
385 /*******************************************************************
386  *
387  * @brief Unpacks slot indication from MAC
388  *
389  * @details
390  *
391  *    Function : unpackMacSlotInd
392  *
393  *    Functionality:
394  *         Unpacks slot indication from MAC
395  *
396  * @params[in] Pointer to Handler
397  *             Post structure pointer
398  *             Message Buffer
399  * @return ROK     - success
400  *         RFAILED - failure
401  *
402  * ****************************************************************/
403 uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf)
404 {
405    if(pst->selector == ODU_SELECTOR_LWLC)
406    {
407       SlotIndInfo *slotInfo;
408
409       /* unpack the address of the structure */
410       CMCHKUNPK(cmUnpkPtr, (PTR *)&slotInfo, mBuf);
411       SPutMsg(mBuf);
412       return (*func)(pst, slotInfo);
413    }
414    else if(pst->selector == ODU_SELECTOR_LC)
415    {
416       SlotIndInfo slotInfo;
417
418       CMCHKUNPK(SUnpkU16, &(slotInfo.slot), mBuf);
419       CMCHKUNPK(SUnpkU16, &(slotInfo.sfn), mBuf);
420       CMCHKUNPK(SUnpkU16, &(slotInfo.cellId), mBuf);
421
422       SPutMsg(mBuf);
423       return (*func)(pst, &slotInfo);
424
425    }
426    else
427    {
428       /* Nothing to do for loose coupling */
429       SPutMsg(mBuf);
430       return ROK;
431    }
432    return ROK;
433 }
434
435 /*******************************************************************
436  *
437  * @brief Packs and Sends stop ind from MAC to DUAPP
438  *
439  * @details
440  *
441  *    Function : packMacStopInd
442  *
443  *    Functionality:
444  *       Packs and Sends stop ind from MAC to DUAPP
445  *
446  * @params[in] Post structure pointer
447  * @return ROK     - success
448  *         RFAILED - failure
449  *
450  * ****************************************************************/
451 uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId)
452 {
453    Buffer *mBuf = NULLP;
454
455    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
456    {
457       DU_LOG("\nDU APP : Memory allocation failed for stop Ind pack");
458       return RFAILED;
459    }
460
461    if(pst->selector == ODU_SELECTOR_LC)
462    {
463       /*pack the payload here*/
464       DU_LOG("\nDU APP : Packed CellId");
465       CMCHKPK(SPkU16, cellStopId->cellId, mBuf);
466       CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellStopId, sizeof(MacCellStopInfo));
467       cellStopId = NULL;
468    }
469    else if(pst->selector == ODU_SELECTOR_LWLC)
470    {
471       /* pack the address of the structure */
472       CMCHKPK(cmPkPtr,(PTR)cellStopId, mBuf);
473    }
474    else
475    {
476       SPutMsg(mBuf);
477    }
478
479    return SPstTsk(pst,mBuf);
480 }
481
482 /*******************************************************************
483  *
484  * @brief Unpacks stop indication from MAC
485  *
486  * @details
487  *
488  *    Function : unpackMacStopInd
489  *
490  *    Functionality:
491  *         Unpacks stop indication from MAC
492  *
493  * @params[in] Pointer to Handler
494  *             Post structure pointer
495  *             Message Buffer
496  * @return ROK     - success
497  *         RFAILED - failure
498  *
499  * ****************************************************************/
500 uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
501 {
502    if(pst->selector == ODU_SELECTOR_LWLC)
503    {
504       MacCellStopInfo *cellStopId;
505       /* unpack the address of the structure */
506       CMCHKUNPK(cmUnpkPtr, (PTR *)&cellStopId, mBuf);
507       SPutMsg(mBuf);
508       return (*func)(pst, cellStopId);
509    }
510    else if(pst->selector == ODU_SELECTOR_LC)
511    {
512       MacCellStopInfo cellStopId;
513       CMCHKUNPK(SUnpkU16, &(cellStopId.cellId), mBuf);
514
515       SPutMsg(mBuf);
516       return (*func)(pst, &cellStopId);
517
518    }
519    else
520    {
521       /* Nothing to do for loose coupling */
522       SPutMsg(mBuf);
523       return ROK;
524    }
525    return ROK;
526 }
527
528 /*******************************************************************
529  *
530  * @brief Packs and Sends UL CCCH Ind from MAC to DUAPP
531  *
532  * @details
533  *
534  *    Function : packMacUlCcchInd
535  *
536  *    Functionality:
537  *       Packs and Sends UL CCCH Ind from MAC to DUAPP
538  *
539  * @params[in] Post structure pointer
540  *             UL CCCH Ind pointer              
541  * @return ROK     - success
542  *         RFAILED - failure
543  *
544  * ****************************************************************/
545 uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
546 {
547    Buffer *mBuf = NULLP;
548
549    if(pst->selector == ODU_SELECTOR_LWLC)
550    {
551       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
552       {
553          DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
554          return RFAILED;
555       }
556       /* pack the address of the structure */
557       CMCHKPK(cmPkPtr,(PTR)ulCcchIndInfo, mBuf);
558    }
559    else
560    {
561       DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind ");
562       return RFAILED;
563    }
564
565    return SPstTsk(pst,mBuf);
566 }
567
568 /*******************************************************************
569  *
570  * @brief Unpacks UL CCCH indication from MAC
571  *
572  * @details
573  *
574  *    Function : unpackMacUlCcchInd
575  *
576  *    Functionality:
577  *         Unpacks UL CCCH indication from MAC
578  *
579  * @params[in] Pointer to Handler
580  *             Post structure pointer
581  *             Message Buffer
582  * @return ROK     - success
583  *         RFAILED - failure
584  *
585  * ****************************************************************/
586 uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
587 {
588    if(pst->selector == ODU_SELECTOR_LWLC)
589    {
590       UlCcchIndInfo *ulCcchIndInfo;
591
592       /* unpack the address of the structure */
593       CMCHKUNPK(cmUnpkPtr, (PTR *)&ulCcchIndInfo, mBuf);
594       SPutMsg(mBuf);
595       return (*func)(pst, ulCcchIndInfo);
596    }
597    else
598    {
599       /* Nothing to do for other selectors */
600       DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
601       SPutMsg(mBuf);
602    }
603    return RFAILED;
604 }
605
606 /*******************************************************************
607  *
608  * @brief Packs and Sends DL CCCH Ind from DUAPP to MAC
609  *
610  * @details
611  *
612  *    Function : packMacDlCcchInd
613  *
614  *    Functionality:
615  *       Packs and Sends DL CCCH Ind from DUAPP to MAC
616  *
617  *
618  * @params[in] Post structure pointer
619  *             DL CCCH Ind pointer              
620  * @return ROK     - success
621  *         RFAILED - failure
622  *
623  * ****************************************************************/
624 uint8_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
625 {
626    Buffer *mBuf = NULLP;
627
628    if(pst->selector == ODU_SELECTOR_LWLC)
629    {
630       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
631       {
632          DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
633          return RFAILED;
634       }
635       /* pack the address of the structure */
636       CMCHKPK(cmPkPtr,(PTR)dlCcchIndInfo, mBuf);
637    }
638    else
639    {
640       DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind ");
641       return RFAILED;
642    }
643
644    return SPstTsk(pst,mBuf);
645 }
646
647 /*******************************************************************
648  *
649  * @brief Unpacks DL CCCH indication from DU APP
650  *
651  * @details
652  *
653  *    Function : unpackMacDlCcchInd
654  *
655  *    Functionality:
656  *         Unpacks DL CCCH indication from DU APP
657  *
658  * @params[in] Pointer to Handler
659  *             Post structure pointer
660  *             Message Buffer
661  * @return ROK     - success
662  *         RFAILED - failure
663  *
664  * ****************************************************************/
665 uint8_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
666 {
667    if(pst->selector == ODU_SELECTOR_LWLC)
668    {
669       DlCcchIndInfo *dlCcchIndInfo;
670
671       /* unpack the address of the structure */
672       CMCHKUNPK(cmUnpkPtr, (PTR *)&dlCcchIndInfo, mBuf);
673       SPutMsg(mBuf);
674       return (*func)(pst, dlCcchIndInfo);
675    }
676    else
677    {
678       /* Nothing to do for other selectors */
679       DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
680       SPutMsg(mBuf);
681    }
682
683    return RFAILED;
684 }
685
686 /*******************************************************************
687  *
688  * @brief Packs and Sends UE create Request from DUAPP to MAC
689  *
690  * @details
691  *
692  *    Function : packDuMacUeCreateReq
693  *
694  *    Functionality:
695  *       Packs and Sends UE Create Request from DUAPP to MAC
696  *
697  *
698  * @params[in] Post structure pointer
699  *             MacUeCfg pointer              
700  * @return ROK     - success
701  *         RFAILED - failure
702  *
703  * ****************************************************************/
704 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg)
705 {
706    Buffer *mBuf = NULLP;
707
708    if(pst->selector == ODU_SELECTOR_LWLC)
709    {
710       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
711       {
712          DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCreateReq");
713          return RFAILED;
714       }
715       /* pack the address of the structure */
716       CMCHKPK(cmPkPtr,(PTR)ueCfg, mBuf);
717    }
718    else
719    {
720       DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCreateReq");
721       return RFAILED;
722    }
723
724    return SPstTsk(pst,mBuf);
725 }
726
727 /*******************************************************************
728  *
729  * @brief Unpacks UE Create Request received from DU APP
730  *
731  * @details
732  *
733  *    Function : unpackMacUeCreateReq
734  *
735  *    Functionality:
736  *         Unpacks UE Create Request received from DU APP
737  *
738  * @params[in] Pointer to Handler
739  *             Post structure pointer
740  *             Message Buffer
741  * @return ROK     - success
742  *         RFAILED - failure
743  *
744  * ****************************************************************/
745 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
746 {
747    if(pst->selector == ODU_SELECTOR_LWLC)
748    {
749       MacUeCfg *ueCfg;
750
751       /* unpack the address of the structure */
752       CMCHKUNPK(cmUnpkPtr, (PTR *)&ueCfg, mBuf);
753       SPutMsg(mBuf);
754       return (*func)(pst, ueCfg);
755    }
756    else
757    {
758       /* Nothing to do for other selectors */
759       DU_LOG("\n Only LWLC supported for UE Create Request ");
760       SPutMsg(mBuf);
761    }
762
763    return RFAILED;
764 }
765
766 /*******************************************************************
767  *
768  * @brief Pack and send UE config response from MAC to DU APP
769  *
770  * @details
771  *
772  *    Function : packDuMacUeCreateRsp
773  *
774  *    Functionality:
775  *       Pack and send UE config response from MAC to DU APP
776  *
777  * @params[in] 
778  * @return ROK     - success
779  *         RFAILED - failure
780  *
781  * ****************************************************************/
782 uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
783 {
784    Buffer *mBuf = NULLP;
785
786    if(pst->selector == ODU_SELECTOR_LWLC)
787    {
788       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
789       {
790          DU_LOG("\nMAC : Memory allocation failed at packDuMacUeCfgRsp");
791          return RFAILED;
792       }
793       /* pack the address of the structure */
794       CMCHKPK(cmPkPtr,(PTR)cfgRsp, mBuf);
795    }
796    else
797    {
798       DU_LOG("\nMAC: Only LWLC supported for packDuMacUeCfgRsp");
799       return RFAILED;
800    }
801
802    return SPstTsk(pst,mBuf);
803 }
804
805 /*******************************************************************
806  *
807  * @brief Unpack UE Config Response from MAC to DU APP
808  *
809  * @details
810  *
811  *    Function : unpackDuMacUeCreateRsp
812  *
813  *    Functionality: Unpack UE Config Response from MAC to DU APP
814  *
815  * @params[in] 
816  * @return ROK     - success
817  *         RFAILED - failure
818  *
819  * ****************************************************************/
820 uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf)
821 {
822    if(pst->selector == ODU_SELECTOR_LWLC)
823    {
824       MacUeCfgRsp *cfgRsp;
825
826       /* unpack the address of the structure */
827       CMCHKUNPK(cmUnpkPtr, (PTR *)&cfgRsp, mBuf);
828       SPutMsg(mBuf);
829       return (*func)(pst, cfgRsp);
830    }
831
832    SPutMsg(mBuf);
833    return RFAILED;
834 }
835
836 /**********************************************************************
837   End of file
838  **********************************************************************/