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