1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 #include "common_def.h"
20 #include "du_app_rlc_inf.h"
22 /*******************************************************************
24 * @brief Packs and Sends UE create Request from DUAPP to RLC
28 * Function : packDuRlcUeCreateReq
31 * Packs and Sends UE Create Request from DUAPP to RLC
34 * @params[in] Post structure pointer
36 * @return ROK - success
39 * ****************************************************************/
40 uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
44 if(pst->selector == ODU_SELECTOR_LWLC)
46 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
48 DU_LOG("\nRLC : Memory allocation failed at packDuRlcUeCreateReq");
51 /* pack the address of the structure */
52 CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
56 DU_LOG("\nRLC: Only LWLC supported for packDuRlcUeCreateReq");
60 return ODU_POST_TASK(pst,mBuf);
63 /*******************************************************************
65 * @brief Unpacks UE Create Request received from DU APP
69 * Function : unpackRlcUeCreateReq
72 * Unpacks UE Create Request received from DU APP
74 * @params[in] Pointer to Handler
75 * Post structure pointer
77 * @return ROK - success
80 * ****************************************************************/
81 uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf)
83 if(pst->selector == ODU_SELECTOR_LWLC)
86 /* unpack the address of the structure */
87 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
88 ODU_PUT_MSG_BUF(mBuf);
89 return (*func)(pst, ueCfg);
93 /* Nothing to do for other selectors */
94 DU_LOG("\nRLC: Only LWLC supported for UE Create Request ");
95 ODU_PUT_MSG_BUF(mBuf);
101 /*******************************************************************
103 * @brief Packs and Sends UE Cfg Response from RLC to DUAPP
107 * Function : packRlcDuUeCfgRsp
110 * Packs and Sends UE Cfg Rrsponse from RLC to DUAPP
113 * @params[in] Post structure pointer
115 * @return ROK - success
118 * ****************************************************************/
119 uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
121 Buffer *mBuf = NULLP;
123 if(pst->selector == ODU_SELECTOR_LWLC)
125 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
127 DU_LOG("\nRLC : Memory allocation failed at packRlcDuUeCfgRsp");
130 /* pack the address of the structure */
131 CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
135 DU_LOG("\nRLC: Only LWLC supported for packRlcDuUeCfgRsp");
139 return ODU_POST_TASK(pst,mBuf);
142 /*******************************************************************
144 * @brief Unpacks UE Cfg Response received from DU APP
148 * Function : unpackRlcUeCfgRsp
151 * Unpacks UE Cfg Response received from DU APP
153 * @params[in] Pointer to Handler
154 * Post structure pointer
156 * @return ROK - success
159 * ****************************************************************/
160 uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf)
162 if(pst->selector == ODU_SELECTOR_LWLC)
164 RlcUeCfgRsp *cfgRsp = NULLP;
165 /* unpack the address of the structure */
166 CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
167 ODU_PUT_MSG_BUF(mBuf);
168 return (*func)(pst, cfgRsp);
172 /* Nothing to do for other selectors */
173 DU_LOG("\nRLC: Only LWLC supported for UE Cfg Response ");
174 ODU_PUT_MSG_BUF(mBuf);
180 /*******************************************************************
182 * @brief Pack and send UL RRC message transfer from RLC to DU APP
186 * Function : packRlcUlRrcMsgToDu
189 * Pack and send UL RRC message transfer from RLC to DU APP
191 * @params[in] Post structure
192 * UL RRC Msg transfer info
193 * @return ROK - success
196 * ****************************************************************/
197 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
199 Buffer *mBuf = NULLP;
201 if(pst->selector == ODU_SELECTOR_LWLC)
203 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
205 DU_LOG("\nRLC : Memory allocation failed at packRlcUlRrcMsgToDu");
208 /* pack the address of the structure */
209 CMCHKPK(oduPackPointer,(PTR)ulRrcMsgInfo, mBuf);
210 return ODU_POST_TASK(pst,mBuf);
214 DU_LOG("\nRLC: Only LWLC supported for packRlcUlRrcMsgToDu");
219 /*******************************************************************
221 * @brief Unpack UL RRC Msg Transfer received at DU APP from RLC
225 * Function : unpackRlcUlRrcMsgToDu
228 * Unpack UL RRC Msg Transfer received at DU APP from RLC
231 * @return ROK - success
234 * ****************************************************************/
235 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf)
237 if(pst->selector == ODU_SELECTOR_LWLC)
239 RlcUlRrcMsgInfo *ulRrcMsgInfo;
240 /* unpack the address of the structure */
241 CMCHKUNPK(oduUnpackPointer, (PTR *)&ulRrcMsgInfo, mBuf);
242 ODU_PUT_MSG_BUF(mBuf);
243 return (*func)(pst, ulRrcMsgInfo);
247 /* Nothing to do for other selectors */
248 DU_LOG("\nRLC: Only LWLC supported for UL RRC Message transfer ");
249 ODU_PUT_MSG_BUF(mBuf);
255 /*******************************************************************
257 * @brief Pack and post DL RRC Message from DU APP to RLC
261 * Function : packDlRrcMsgToRlc
263 * Functionality: Pack and post DL RRC Message from DU APP to RLC
265 * @params[in] Post structure
266 * DL RRC Message info
267 * @return ROK - success
270 * ****************************************************************/
271 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
273 Buffer *mBuf = NULLP;
275 if(pst->selector == ODU_SELECTOR_LWLC)
277 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
279 DU_LOG("\nRLC : Memory allocation failed at packRlcDlRrcMsgToRlc");
282 /* pack the address of the structure */
283 CMCHKPK(oduPackPointer,(PTR)dlRrcMsgInfo, mBuf);
284 return ODU_POST_TASK(pst,mBuf);
288 DU_LOG("\nRLC: Only LWLC supported for packDlRrcMsgToRlc");
293 /*******************************************************************
295 * @brief Unpacks DL RRC Message info received at RLC from DU APP
299 * Function : unpackDlRrcMsgToRlc
302 * Unpacks the DL RRC Message info received at RLC from DU APP
304 * @params[in] Pointer to handler function
306 * Messae buffer to be unpacked
307 * @return ROK - success
310 * ****************************************************************/
311 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf)
313 if(pst->selector == ODU_SELECTOR_LWLC)
315 RlcDlRrcMsgInfo *dlRrcMsgInfo;
316 /* unpack the address of the structure */
317 CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgInfo, mBuf);
318 ODU_PUT_MSG_BUF(mBuf);
319 return (*func)(pst, dlRrcMsgInfo);
323 /* Nothing to do for other selectors */
324 DU_LOG("\nRLC: Only LWLC supported for UL RRC Message transfer ");
325 ODU_PUT_MSG_BUF(mBuf);
330 /*******************************************************************
332 * @brief packs RRC delivery report sending from RLC to DU APP
336 * Function : packRrcDeliveryReportToDu
339 * Unpacks the DL RRC Message info received at RLC from DU APP
341 * @params[in] Pointer to handler function
343 * Messae buffer to be unpacked
344 * @return ROK - success
347 * ****************************************************************/
348 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport)
350 Buffer *mBuf = NULLP;
352 if(pst->selector == ODU_SELECTOR_LWLC)
354 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
356 DU_LOG("\nRLC : Memory allocation failed at packRrcDeliveryReportToDu");
359 /* pack the address of the structure */
360 CMCHKPK(oduPackPointer,(PTR)rrcDeliveryReport, mBuf);
361 return ODU_POST_TASK(pst,mBuf);
365 DU_LOG("\nRLC: Only LWLC supported for packRrcDeliveryReportToDu");
370 /*******************************************************************
372 * @brief Unpacks RRC Delivery Report info received at DU APP from RIC
376 * Function : unpackRrcDeliveryReportToDu
379 * Unpacks RRC Delivery Report info received at DU APP from RIC
381 * @params[in] Pointer to handler function
383 * Messae buffer to be unpacked
384 * @return ROK - success
387 * ****************************************************************/
388 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func, Pst *pst, Buffer *mBuf)
390 if(pst->selector == ODU_SELECTOR_LWLC)
392 RrcDeliveryReport *rrcDeliveryReport;
393 /* unpack the address of the structure */
394 CMCHKUNPK(oduUnpackPointer, (PTR *)&rrcDeliveryReport, mBuf);
395 ODU_PUT_MSG_BUF(mBuf);
396 return (*func)(pst, rrcDeliveryReport);
400 /* Nothing to do for other selectors */
401 DU_LOG("\nRLC: Only LWLC supported for RRC delivery Message transfer ");
402 ODU_PUT_MSG_BUF(mBuf);
408 /*******************************************************************
410 * @brief Packs and Sends UE Reconfig Request from DUAPP to RLC
414 * Function : packDuRlcUeReconfigReq
417 * Packs and Sends UE Reconfig Request from DUAPP to RLC
420 * @params[in] Post structure pointer
422 * @return ROK - success
425 * ****************************************************************/
426 uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
428 Buffer *mBuf = NULLP;
430 if(pst->selector == ODU_SELECTOR_LWLC)
432 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
434 DU_LOG("\nRLC : Memory allocation failed at packDuRlcUeReconfigReq");
437 /* pack the address of the structure */
438 CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
442 DU_LOG("\nRLC: Only LWLC supported for packDuRlcUeReconfigReq");
446 return ODU_POST_TASK(pst,mBuf);
449 /*******************************************************************
450 * @brief Unpacks UE Reconfig Request received from DU APP
454 * Function : unpackRlcUeReconfigReq
457 * Unpacks UE Create Request received from DU APP
459 * @params[in] Pointer to Handler
460 * Post structure pointer
462 * @return ROK - success
465 * ****************************************************************/
466 uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf)
468 if(pst->selector == ODU_SELECTOR_LWLC)
471 /* unpack the address of the structure */
472 CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
473 ODU_PUT_MSG_BUF(mBuf);
474 return (*func)(pst, ueCfg);
478 /* Nothing to do for other selectors */
479 DU_LOG("\nRLC: Only LWLC supported for UE Create Request ");
480 ODU_PUT_MSG_BUF(mBuf);
485 /*******************************************************************
487 * @brief Pack and send DL RRC message Response from RLC to DU APP
491 * Function : packRlcDlRrcMsgRspToDu
494 * Pack and send DL RRC message Response from RLC to DU APP
496 * @params[in] Post structure
497 * DL RRC Msg Response
498 * @return ROK - success
501 * ****************************************************************/
502 uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp)
504 Buffer *mBuf = NULLP;
506 if(pst->selector == ODU_SELECTOR_LWLC)
508 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
510 DU_LOG("\nRLC : Memory allocation failed at packRlcDlRrcMsgRspToDu");
513 /* pack the address of the structure */
514 CMCHKPK(oduPackPointer,(PTR)dlRrcMsgRsp, mBuf);
515 return ODU_POST_TASK(pst,mBuf);
519 DU_LOG("\nRLC: Only LWLC supported for packRlcDlRrcMsgRspToDu");
524 /*******************************************************************
526 * @brief Unpack DL RRC Msg Response received at DU APP from RLC
530 * Function : unpackRlcDlRrcMsgRspToDu
533 * Unpack DL RRC Msg Response received at DU APP from RLC
536 * @return ROK - success
539 * ****************************************************************/
540 uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf)
542 if(pst->selector == ODU_SELECTOR_LWLC)
544 RlcDlRrcMsgRsp *dlRrcMsgRsp;
545 /* unpack the address of the structure */
546 CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgRsp, mBuf);
547 ODU_PUT_MSG_BUF(mBuf);
548 return (*func)(pst, dlRrcMsgRsp);
552 /* Nothing to do for other selectors */
553 DU_LOG("\nRLC: Only LWLC supported for DL RRC Message transfer ");
554 ODU_PUT_MSG_BUF(mBuf);
559 /*******************************************************************
561 * @brief Pack and send UL user data from RLC to DU APP
565 * Function : packRlcUlUserDataToDu
568 * Pack and send UL User Data from RLC to DU APP
570 * @params[in] Post structure
572 * @return ROK - success
575 * ****************************************************************/
576 uint8_t packRlcUlUserDataToDu(Pst *pst, RlcUlUserDatInfo *ulUserData)
578 Buffer *mBuf = NULLP;
580 if(pst->selector == ODU_SELECTOR_LWLC)
582 if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
584 DU_LOG("\nERROR --> RLC UL: Memory allocation failed at packRlcUlUserDataToDu");
587 /* pack the address of the structure */
588 CMCHKPK(oduPackPointer,(PTR)ulUserData, mBuf);
589 return ODU_POST_TASK(pst,mBuf);
593 DU_LOG("\nERROR --> RLC UL: Only LWLC supported for packRlcUlUserDataToDu");
598 /*******************************************************************
600 * @brief Unpack UL user data received at DU APP from RLC
604 * Function : unpackRlcUlUserDataToDu
607 * Unpack UL user data received at DU APP from RLC
610 * @return ROK - success
613 * ****************************************************************/
614 uint8_t unpackRlcUlUserDataToDu(RlcUlUserDataToDuFunc func, Pst *pst, Buffer *mBuf)
616 if(pst->selector == ODU_SELECTOR_LWLC)
618 RlcUlUserDatInfo *ulUserData;
619 /* unpack the address of the structure */
620 CMCHKUNPK(oduUnpackPointer, (PTR *)&ulUserData, mBuf);
621 ODU_PUT_MSG_BUF(mBuf);
622 return (*func)(pst, ulUserData);
626 /* Nothing to do for other selectors */
627 DU_LOG("\nERROR --> DU APP: Only LWLC supported for UL User data transfer ");
628 ODU_PUT_MSG_BUF(mBuf);
634 /**********************************************************************
636 ***********************************************************************/