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 /********************************************************************20**
25 Desc: This file Contains the packing and unpacking functions for
30 *********************************************************************21*/
32 /* header include files (.h) */
33 #include "common_def.h"
34 #ifdef TENB_SPLIT_ARCH
39 #include "kwu.h" /* KWU defines */
41 /* extern (.x) include files */
42 #ifdef TENB_SPLIT_ARCH
51 #include "kwu.x" /* KWU */
55 /****************************************************************************
57 ***************************************************************************/
58 S16 cmPkKwuBndReq(Pst * pst,SuId suId,SpId spId)
65 if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
67 #if (ERRCLASS & ERRCLS_ADD_RES)
70 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
71 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
72 (ErrVal)EKWU001, (ErrVal)0, "SGetMsg() failed");
74 #endif /* ERRCLASS & ERRCLS_ADD_RES */
77 CMCHKPKLOG(SPkS16, spId, mBuf, EKWU002, pst);
78 CMCHKPKLOG(SPkS16, suId, mBuf, EKWU003, pst);
79 pst->event = (Event) KWU_EVT_BND_REQ;
80 return (SPstTsk(pst,mBuf));
84 S16 cmPkKwuBndCfm(Pst * pst,SuId suId,uint8_t status)
92 if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
94 #if (ERRCLASS & ERRCLS_ADD_RES)
97 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
98 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
99 (ErrVal)EKWU004, (ErrVal)0, "SGetMsg() failed");
101 #endif /* ERRCLASS & ERRCLS_ADD_RES */
105 CMCHKPKLOG(oduPackUInt8, status, mBuf, EKWU005, pst);
106 CMCHKPKLOG(SPkS16, suId, mBuf, EKWU006, pst);
107 pst->event = (Event) KWU_EVT_BND_CFM;
108 return (SPstTsk(pst,mBuf));
112 S16 cmPkKwuUbndReq(Pst * pst,SuId suId,Reason reason)
120 if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
122 #if (ERRCLASS & ERRCLS_ADD_RES)
125 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
126 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
127 (ErrVal)EKWU007, (ErrVal)0, "SGetMsg() failed");
129 #endif /* ERRCLASS & ERRCLS_ADD_RES */
132 CMCHKPKLOG(SPkS16, reason, mBuf, EKWU008, pst);
133 CMCHKPKLOG(SPkS16, suId, mBuf, EKWU009, pst);
135 pst->event = (Event) KWU_EVT_UBND_REQ;
136 return (SPstTsk(pst,mBuf));
137 } /* cmPkKwuUbndReq */
139 uint8_t cmPkRlcDatReqInfo(RlcDatReqInfo *param,Buffer *mBuf)
142 switch(param->lcType) {
143 case CM_LTE_LCH_CCCH:
144 CMCHKPK(cmPkLteRnti, param->tm.rnti, mBuf);
146 case CM_LTE_LCH_BCCH:
147 case CM_LTE_LCH_PCCH:
148 CMCHKPK(cmPkLteTimingInfo, ¶m->tm.tmg, mBuf);
150 CMCHKPK(oduPackUInt8, param->emtcDiReason,mBuf);
151 CMCHKPK(oduPackUInt8, param->pnb,mBuf);
154 case CM_LTE_LCH_DTCH:
155 case CM_LTE_LCH_DCCH:
160 CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
163 CMCHKPK(oduPackUInt32, param->sduId, mBuf);
164 CMCHKPK(cmPkLteRlcId, ¶m->rlcId, mBuf);
166 } /* cmPkRlcDatReqInfo */
169 uint8_t cmPkRlcDatReq(Pst * pst,RlcDatReqInfo* datReq,Buffer * mBuf)
172 #if (ERRCLASS & ERRCLS_ADD_RES)
177 RlcDatReqInfo* datReqInfo;
180 switch(pst->selector)
182 case ODU_SELECTOR_LWLC:
184 if(pst->srcEnt == ENTDUAPP)
186 /* When the Selector is LWLC, we need to allocate memory, copy
187 * the contents and pass the pointer of the allocated memory. The
188 * subsequent free would be done during the Unpack function of the
190 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&datReqInfo,
191 sizeof(RlcDatReqInfo),SS_SHARABLE_MEMORY)) != ROK)
193 #if (ERRCLASS & ERRCLS_ADD_RES)
196 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
197 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
198 (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
200 #endif /* ERRCLASS & ERRCLS_ADD_RES */
203 memcpy(datReqInfo,datReq,sizeof(RlcDatReqInfo));
204 CMCHKPK(oduPackPointer,(PTR)datReqInfo, mBuf);
208 CMCHKPK(oduPackPointer,(PTR)datReq, mBuf);
212 case ODU_SELECTOR_LC:
214 #if (ERRCLASS & ERRCLS_ADD_RES)
215 ret1 = cmPkRlcDatReqInfo( (datReq), mBuf);
219 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
220 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
221 (ErrVal)EKWU010, (ErrVal)ret1, "Packing failure");
225 cmPkRlcDatReqInfo( (datReq), mBuf);
226 #endif /* ERRCLASS & ERRCLS_ADD_RES */
227 if(pst->srcEnt == ENTNH)
229 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)datReq,
230 sizeof(RlcDatReqInfo),SS_SHARABLE_MEMORY) != ROK)
240 #if (ERRCLASS & ERRCLS_ADD_RES)
241 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
242 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
243 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
244 #endif /* ERRCLASS & ERRCLS_ADD_RES */
249 if(datReq->rlcId.rbType == CM_LTE_SRB)
251 pst->event = (Event) KWU_EVT_CPLANE_DAT_REQ;
255 pst->event = (Event) KWU_EVT_UPLANE_DAT_REQ;
258 pst->event = (Event) KWU_EVT_DAT_REQ;
260 return (SPstTsk(pst,mBuf));
262 if (pst->srcEnt == ENTPJ)
265 KwuDatReqDetl *kwuDatReqDetl = NULLP;
266 elem = SRngGetWIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
269 kwuDatReqDetl = (KwuDatReqDetl *) elem;
270 kwuDatReqDetl->spId = spId;
271 kwuDatReqDetl->lcType = datReq->lcType;
272 kwuDatReqDetl->sduId = datReq->sduId;
273 kwuDatReqDetl->rlcId = datReq->rlcId;
274 kwuDatReqDetl->mBuf = mBuf;
275 SRngIncrWIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
276 SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].pktRate++;
281 SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].pktDrop++;
288 switch(pst->selector)
291 case ODU_SELECTOR_LC:
293 ret1 = cmPkRlcDatReqInfo( (datReq), mBuf);
294 #if (ERRCLASS & ERRCLS_ADD_RES)
298 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
299 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
300 (ErrVal)EKWU010, (ErrVal)ret1, "Packing failure");
303 #endif /* ERRCLASS & ERRCLS_ADD_RES */
306 case ODU_SELECTOR_LWLC:
308 CMCHKPK(oduPackPointer,(PTR)datReq, mBuf);
314 CMCHKPKLOG(SPkS16, spId, mBuf, EKWU011, pst);
315 pst->event = (Event) KWU_EVT_DAT_REQ;
316 ret1 = SPstTsk(pst,mBuf);
317 if(pst->selector == ODU_SELECTOR_LC)
319 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)datReq,
320 sizeof(RlcDatReqInfo),SS_SHARABLE_MEMORY) != ROK)
329 } /* cmPkRlcDatReq */
332 uint8_t cmPkKwuDatIndInfo(KwuDatIndInfo *param,Buffer *mBuf)
335 CMCHKPK(oduPackUInt8, param->isOutOfSeq, mBuf);
337 CMCHKPK(cmPkLteRnti, param->tCrnti, mBuf);
339 CMCHKPK(cmPkLteRlcId, ¶m->rlcId, mBuf);
344 uint8_t cmPkKwuDatInd(Pst * pst,KwuDatIndInfo* datInd,Buffer * mBuf)
349 #ifdef TENB_SPLIT_ARCH
350 #ifdef SS_LOCKLESS_MEMORY
354 KwuDatIndInfo *datIndInfo = NULLP;
357 #ifdef TENB_SPLIT_ARCH
359 #ifdef SS_LOCKLESS_MEMORY
360 mInfo = (SsMsgInfo *)mBuf->b_rptr;
361 mInfo->region = pst->region;
362 #endif /* SS_LOCKLESS_MEMORY */
365 switch(pst->selector)
367 case ODU_SELECTOR_LWLC:
369 /* When the Selector is LWLC, we need to allocate memory, copy
370 * the contents and pass the pointer of the allocated memory. The
371 * subsequent free would be done during the Unpack function of the
373 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&datIndInfo,
374 sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY)) != ROK)
376 #if (ERRCLASS & ERRCLS_ADD_RES)
379 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
380 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
381 (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
383 #endif /* ERRCLASS & ERRCLS_ADD_RES */
387 memcpy(datIndInfo, datInd,sizeof(KwuDatIndInfo));
388 CMCHKPK(oduPackPointer,(PTR)datIndInfo, mBuf);
391 case ODU_SELECTOR_LC:
393 #if (ERRCLASS & ERRCLS_ADD_RES)
394 ret1 = cmPkKwuDatIndInfo( (datInd), mBuf);
398 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
399 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
400 (ErrVal)EKWU012, (ErrVal)ret1, "Packing failure");
404 cmPkKwuDatIndInfo( (datInd), mBuf);
405 #endif /* ERRCLASS & ERRCLS_ADD_RES */
410 #if (ERRCLASS & ERRCLS_ADD_RES)
411 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
412 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
413 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
414 #endif /* ERRCLASS & ERRCLS_ADD_RES */
418 pst->event = (Event) KWU_EVT_DAT_IND;
420 return (SPstTsk(pst,mBuf));
421 } /* cmPkKwuDatInd */
424 S16 cmPkKwuDatCfmInfo(KwuDatCfmInfo *param,Buffer *mBuf)
426 register uint32_t iter;
428 for(iter = 0; iter < param->numSduIds; iter++)
430 CMCHKPK(oduPackUInt32, param->sduIds[iter], mBuf);
432 CMCHKPK(oduPackUInt32, param->numSduIds, mBuf);
433 CMCHKPK(cmPkLteRlcId, ¶m->rlcId, mBuf);
435 } /* cmPkKwuDatCfmInfo */
438 S16 cmPkKwuDatCfm(Pst * pst,SuId suId,KwuDatCfmInfo* datCfm)
440 #if (ERRCLASS & ERRCLS_ADD_RES)
448 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
452 switch(pst->selector)
454 case ODU_SELECTOR_LWLC:
456 CMCHKPK(oduPackPointer,(PTR)datCfm, mBuf);
459 case ODU_SELECTOR_LC:
461 #if (ERRCLASS & ERRCLS_ADD_RES)
462 ret1 = cmPkKwuDatCfmInfo( (datCfm), mBuf);
466 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
467 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
468 (ErrVal)EKWU014, (ErrVal)ret1, "Packing failure");
472 cmPkKwuDatCfmInfo( (datCfm), mBuf);
473 #endif /* ERRCLASS & ERRCLS_ADD_RES */
474 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)datCfm,
475 sizeof(KwuDatCfmInfo),SS_SHARABLE_MEMORY) != ROK)
484 #if (ERRCLASS & ERRCLS_ADD_RES)
485 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
486 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
487 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
488 #endif /* ERRCLASS & ERRCLS_ADD_RES */
492 CMCHKPKLOG(SPkS16, suId, mBuf, EKWU015, pst);
493 pst->event = (Event) KWU_EVT_DAT_CFM;
495 return (SPstTsk(pst,mBuf));
496 } /* cmPkKwuDatCfm */
499 S16 cmPkKwuDiscSduReq(Pst * pst,SpId spId,KwuDiscSduInfo* discSdu)
505 KwuDiscSduInfo* discSduInfo = NULLP;
509 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
513 switch(pst->selector)
515 case ODU_SELECTOR_LWLC:
517 /* When the Selector is LWLC, we need to allocate memory, copy
518 * the contents and pass the pointer of the allocated memory. The
519 * subsequent free would be done during the Unpack function of the
521 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&discSduInfo,
522 sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY)) != ROK)
524 #if (ERRCLASS & ERRCLS_ADD_RES)
527 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
528 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
529 (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
531 #endif /* ERRCLASS & ERRCLS_ADD_RES */
535 memcpy(discSduInfo, discSdu,sizeof(KwuDiscSduInfo));
536 CMCHKPK(oduPackPointer,(PTR)discSduInfo, mBuf);
539 case ODU_SELECTOR_LC:
541 #if (ERRCLASS & ERRCLS_ADD_RES)
542 ret1 = cmPkKwuDiscSduInfo( (discSdu), mBuf);
546 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
547 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
548 (ErrVal)EKWU016, (ErrVal)ret1, "Packing failure");
552 cmPkKwuDiscSduInfo( (discSdu), mBuf);
553 #endif /* ERRCLASS & ERRCLS_ADD_RES */
558 CMCHKPKLOG(SPkS16, spId, mBuf, EKWU017, pst);
559 pst->event = (Event) KWU_EVT_DISC_SDU_REQ;
561 return (SPstTsk(pst,mBuf));
562 } /* cmPkKwuDiscSduReq */
565 S16 cmPkKwuStaIndInfo(KwuStaIndInfo *param,Buffer *mBuf)
570 for (i = (param->numSdu - 1); i >= 0; i--)
572 CMCHKPK(oduPackUInt32, param->sduId[(uint16_t)i], mBuf);
574 CMCHKPK(oduPackUInt32, param->numSdu, mBuf);
575 CMCHKPK(cmPkLteRlcId, ¶m->rlcId, mBuf);
579 S16 cmPkKwuFlowCntrlIndInfo(KwuFlowCntrlIndInfo *param,Buffer *mBuf)
582 CMCHKPK(oduPackUInt32, param->pktAdmitCnt, mBuf);
583 CMCHKPK(cmPkLteRlcId, ¶m->rlcId, mBuf);
586 } /* cmPkKwuFlowCntrlIndInfo */
588 S16 cmUnpkKwuFlowCntrlIndInfo(KwuFlowCntrlIndInfo *param,Buffer *mBuf)
591 CMCHKUNPK(cmUnpkLteRlcId, ¶m->rlcId, mBuf);
592 CMCHKUNPK(oduUnpackUInt32, ¶m->pktAdmitCnt, mBuf);
595 } /* cmUnpkKwuFlowCntrlIndInfo */
598 S16 cmPkKwuStaInd(Pst * pst,SuId suId,KwuStaIndInfo* staInd)
601 #if (ERRCLASS & ERRCLS_ADD_RES)
610 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
614 switch(pst->selector)
616 case ODU_SELECTOR_LWLC:
618 CMCHKPK(oduPackPointer,(PTR) staInd, mBuf);
621 case ODU_SELECTOR_LC:
623 #if (ERRCLASS & ERRCLS_ADD_RES)
624 ret1 = cmPkKwuStaIndInfo( (staInd), mBuf);
628 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
629 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
630 (ErrVal)EKWU018, (ErrVal)ret1, "Packing failure");
634 cmPkKwuStaIndInfo( (staInd), mBuf);
635 #endif /* ERRCLASS & ERRCLS_ADD_RES */
636 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)staInd,
637 sizeof(KwuStaIndInfo),SS_SHARABLE_MEMORY) != ROK)
646 #if (ERRCLASS & ERRCLS_ADD_RES)
647 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
648 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
649 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
654 CMCHKPKLOG(SPkS16, suId, mBuf, EKWU019, pst);
655 pst->event = (Event) KWU_EVT_STA_IND;
657 return (SPstTsk(pst,mBuf));
658 } /* cmPkKwuStaInd */
661 S16 cmPkKwuReEstCmpInd(Pst * pst,SuId suId,CmLteRlcId rlcId)
664 #if (ERRCLASS & ERRCLS_ADD_RES)
673 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
677 switch(pst->selector)
680 case ODU_SELECTOR_LC:
682 #if (ERRCLASS & ERRCLS_ADD_RES)
683 ret1 = cmPkLteRlcId( &rlcId, mBuf);
687 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
688 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
689 (ErrVal)EKWU018, (ErrVal)ret1, "Packing failure");
693 cmPkLteRlcId( &rlcId, mBuf);
694 #endif /* ERRCLASS & ERRCLS_ADD_RES */
700 CMCHKPKLOG(SPkS16, suId, mBuf, EKWU019, pst);
701 pst->event = (Event) KWU_EVT_REEST_CMP_IND;
703 return (SPstTsk(pst,mBuf));
704 } /* cmPkKwuReEstCmpInd */
706 /* kwu_c_001.main_3 added support for L2 Measurement */
707 S16 cmPkKwuDiscSduCfm(Pst *pst,SpId spId,KwuDiscSduInfo *discCfmSdu)
709 #if (ERRCLASS & ERRCLS_ADD_RES)
717 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
721 switch(pst->selector)
723 case ODU_SELECTOR_LWLC:
725 CMCHKPK(oduPackPointer,(PTR)discCfmSdu, mBuf);
728 case ODU_SELECTOR_LC:
730 #if (ERRCLASS & ERRCLS_ADD_RES)
731 ret1 = cmPkKwuDiscSduInfo((discCfmSdu), mBuf);
735 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
736 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
737 (ErrVal)ERRKWU, (ErrVal)ret1, "Packing failure");
741 cmPkKwuDiscSduInfo((discCfmSdu), mBuf);
742 #endif /* ERRCLASS & ERRCLS_ADD_RES */
743 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)discCfmSdu,
744 sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY) != ROK)
753 #if (ERRCLASS & ERRCLS_ADD_RES)
754 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
755 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
756 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
761 CMCHKPKLOG(SPkS16, spId, mBuf, ERRKWU, pst);
762 pst->event = (Event) KWU_EVT_DISC_SDU_CFM;
764 return (SPstTsk(pst,mBuf));
765 } /* cmPkKwuDiscSduCfm */
767 S16 cmPkKwuFlowCntrlInd(Pst *pst,SuId suId,KwuFlowCntrlIndInfo *flowCntrlIndInfo)
774 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
776 SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region,
778 (Data *)flowCntrlIndInfo,
779 sizeof(KwuFlowCntrlIndInfo),0);
783 switch(pst->selector)
785 case ODU_SELECTOR_LC:
787 cmPkKwuFlowCntrlIndInfo((flowCntrlIndInfo), mBuf);
789 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region,
791 (Data *)flowCntrlIndInfo,
792 sizeof(KwuFlowCntrlIndInfo),0) != ROK)
800 case ODU_SELECTOR_LWLC:
802 CMCHKPK(oduPackPointer,(PTR) flowCntrlIndInfo, mBuf);
808 CMCHKPKLOG(SPkS16, suId, mBuf, ERRKWU, pst);
809 pst->event = (Event) KWU_EVT_FLOW_CNTRL_IND;
811 return (SPstTsk(pst,mBuf));
812 } /* cmPkKwuFlowCntrlInd */
815 S16 cmPkKwuDatAckInfo(KwuDatAckInfo *param,Buffer *mBuf)
818 CMCHKPK(cmPkLteRlcId, ¶m->rlcId, mBuf);
819 CMCHKPK(oduPackUInt32, param->sduId, mBuf);
823 S16 cmPkKwuDatAckInd(Pst * pst,SuId suId,KwuDatAckInfo* datInd)
832 if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
836 ret1 = cmPkKwuDatAckInfo( (datInd), mBuf);
837 #if (ERRCLASS & ERRCLS_ADD_RES)
841 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
842 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
843 (ErrVal)ERRKWU, (ErrVal)ret1, "Packing failure");
846 #endif /* ERRCLASS & ERRCLS_ADD_RES */
847 if (SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)datInd,
848 sizeof(KwuDatAckInfo),SS_SHARABLE_MEMORY) != ROK)
854 CMCHKPKLOG(SPkS16, suId, mBuf, ERRKWU, pst);
855 pst->event = (Event) KWU_EVT_DAT_ACK_IND;
857 return (SPstTsk(pst,mBuf));
858 } /* cmPkKwuDatAckInd */
859 #endif /* LTE_L2_MEAS */
862 S16 cmUnpkKwuBndReq(KwuBndReq func,Pst *pst,Buffer *mBuf)
867 CMCHKUNPKLOG(SUnpkS16, &suId, mBuf, EKWU020, pst);
868 CMCHKUNPKLOG(SUnpkS16, &spId, mBuf, EKWU021, pst);
871 return ((*func)(pst, suId, spId));
875 S16 cmUnpkKwuBndCfm(KwuBndCfm func,Pst *pst,Buffer *mBuf)
881 CMCHKUNPKLOG(SUnpkS16, &suId, mBuf, EKWU022, pst);
882 CMCHKUNPKLOG(oduUnpackUInt8, &status, mBuf, EKWU023, pst);
885 return ((*func)(pst, suId, status));
889 S16 cmUnpkKwuUbndReq(KwuUbndReq func,Pst *pst,Buffer *mBuf)
895 CMCHKUNPKLOG(SUnpkS16, &spId, mBuf, EKWU024, pst);
896 CMCHKUNPKLOG(SUnpkS16, &reason, mBuf, EKWU025, pst);
899 return ((*func)(pst, spId, reason));
900 } /* cmUnpkKwuUbndReq */
903 S16 cmUnpkRlcDatReqInfo(RlcDatReqInfo *param,Buffer *mBuf)
907 CMCHKUNPK(cmUnpkLteRlcId, ¶m->rlcId, mBuf);
908 CMCHKUNPK(oduUnpackUInt32, ¶m->sduId, mBuf);
911 CMCHKUNPK(cmUnpkLteLcType, ¶m->lcType, mBuf);
912 switch(param->lcType) {
913 case CM_LTE_LCH_BCCH:
914 case CM_LTE_LCH_PCCH:
916 CMCHKUNPK(oduUnpackUInt8,¶m->pnb , mBuf);
917 CMCHKUNPK(oduUnpackUInt8,¶m->emtcDiReason , mBuf);
919 CMCHKUNPK(cmUnpkLteTimingInfo, ¶m->tm.tmg, mBuf);
922 case CM_LTE_LCH_CCCH:
923 CMCHKUNPK(cmUnpkLteRnti, ¶m->tm.rnti, mBuf);
925 case CM_LTE_LCH_DTCH:
926 case CM_LTE_LCH_DCCH:
936 S16 cmUnpkKwuDatReq(KwuDatReq func,Pst *pst,Buffer *mBuf)
938 #if(ERRCLASS & ERRCLS_DEBUG)
942 RlcDatReqInfo *datReq = NULLP;
943 RlcDatReqInfo datReqTmp;
946 switch(pst->selector)
948 case ODU_SELECTOR_LWLC:
950 CMCHKUNPK(oduUnpackPointer,(PTR *) &datReq, mBuf);
953 case ODU_SELECTOR_LC:
955 /* Allocate the memory statically as there is no free
958 memset(datReq, 0, sizeof(RlcDatReqInfo));
959 #if(ERRCLASS & ERRCLS_DEBUG)
960 ret1 = cmUnpkRlcDatReqInfo( (datReq), mBuf);
964 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
965 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
966 (ErrVal)EKWU027, (ErrVal)ret1, "Unpacking failure");
970 cmUnpkRlcDatReqInfo( (datReq), mBuf);
971 #endif /* ERRCLASS & ERRCLS_DEBUG */
976 #if (ERRCLASS & ERRCLS_ADD_RES)
977 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
978 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
979 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
984 retVal = (*func)(pst, datReq, mBuf);
985 /* If LWLC is configured, we need to
986 * free the memory here. */
987 if(pst->selector == ODU_SELECTOR_LWLC)
989 retVal = SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)datReq,
990 sizeof(RlcDatReqInfo),SS_SHARABLE_MEMORY);
993 } /* cmUnpkKwuDatReq */
996 uint8_t cmUnpkKwuDatIndInfo(KwuDatIndInfo *param,Buffer *mBuf)
999 CMCHKUNPK(cmUnpkLteRlcId, ¶m->rlcId, mBuf);
1002 CMCHKUNPK(cmUnpkLteRnti, ¶m->tCrnti, mBuf);
1004 CMCHKUNPK(oduUnpackUInt8, ¶m->isOutOfSeq, mBuf);
1009 uint8_t cmUnpkKwuDatInd(KwuDatInd func,Pst *pst,Buffer *mBuf)
1011 S16 ret1 = ROK, retVal;
1012 KwuDatIndInfo *datInd = NULLP;
1013 KwuDatIndInfo datIndTmp;
1016 switch(pst->selector)
1018 case ODU_SELECTOR_LWLC:
1020 CMCHKUNPK(oduUnpackPointer,(PTR *) &datInd, mBuf);
1023 case ODU_SELECTOR_LC:
1025 /*SGetStaticBuffer used as RRC has an equivalent free but PDCP
1026 * doesn't free any memory */
1027 if(pst->dstEnt != ENTPJ)
1029 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&datInd,
1030 sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY)) != ROK)
1032 #if (ERRCLASS & ERRCLS_ADD_RES)
1035 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1036 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1037 (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
1039 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1045 datInd = &datIndTmp;
1048 ret1 = cmUnpkKwuDatIndInfo( (datInd), mBuf);
1049 #if(ERRCLASS & ERRCLS_DEBUG)
1053 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1054 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1055 (ErrVal)EKWU029, (ErrVal)ret1, "Unpacking failure");
1058 #endif /* ERRCLASS & ERRCLS_DEBUG */
1063 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1064 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1065 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1068 retVal = (*func)(pst, datInd, mBuf);
1069 /* If LWLC is configured and the destination entity is PDCP, we need to
1070 * free the memory here. */
1071 if((pst->selector == ODU_SELECTOR_LWLC) && (pst->dstEnt == ENTPJ))
1073 retVal = SPutStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)datInd,
1074 sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY);
1077 } /* cmUnpkKwuDatInd */
1080 S16 cmUnpkKwuDatCfmInfo(KwuDatCfmInfo *param,Buffer *mBuf)
1084 CMCHKUNPK(cmUnpkLteRlcId, ¶m->rlcId, mBuf);
1085 CMCHKUNPK(oduUnpackUInt32, ¶m->numSduIds, mBuf);
1087 #ifdef L2_L3_SPLIT /*Work Around */
1088 if (param->numSduIds >= KWU_MAX_DAT_CFM)
1089 param->numSduIds = KWU_MAX_DAT_CFM;
1091 for(iter = param->numSduIds -1; iter >= 0 ; iter--)
1093 CMCHKUNPK(oduUnpackUInt32, ¶m->sduIds[iter], mBuf);
1098 S16 cmUnpkKwuDatCfm(KwuDatCfm func,Pst *pst,Buffer *mBuf)
1102 KwuDatCfmInfo *datCfm = NULLP;
1105 CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1107 switch(pst->selector)
1109 case ODU_SELECTOR_LWLC:
1111 CMCHKUNPK(oduUnpackPointer,(PTR *) &datCfm, mBuf);
1114 case ODU_SELECTOR_LC:
1116 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&datCfm,\
1117 sizeof(KwuDatCfmInfo),SS_SHARABLE_MEMORY)) != ROK)
1119 #if (ERRCLASS & ERRCLS_ADD_RES)
1122 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1123 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1124 (ErrVal)EKWU030, (ErrVal)0, "SGetMsg() failed");
1126 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1130 memset(datCfm, 0, sizeof(KwuDatCfmInfo));
1131 ret1 = cmUnpkKwuDatCfmInfo( (datCfm), mBuf);
1132 #if(ERRCLASS & ERRCLS_DEBUG)
1136 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1137 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1138 (ErrVal)EKWU031, (ErrVal)ret1, "Unpacking failure");
1141 #endif /* ERRCLASS & ERRCLS_DEBUG */
1145 #if (ERRCLASS & ERRCLS_ADD_RES)
1146 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1147 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1148 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1156 return ((*func)(pst, suId, datCfm));
1157 } /* cmUnpkKwuDatCfm */
1160 S16 cmUnpkKwuDiscSduReq(KwuDiscSduReq func,Pst *pst,Buffer *mBuf)
1164 KwuDiscSduInfo *discSdu = NULLP;
1167 CMCHKUNPK(SUnpkS16, &(spId), mBuf);
1168 switch(pst->selector)
1170 case ODU_SELECTOR_LWLC:
1172 CMCHKUNPK(oduUnpackPointer,(PTR *) &discSdu, mBuf);
1175 case ODU_SELECTOR_LC:
1177 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&discSdu,\
1178 sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY)) != ROK)
1180 #if (ERRCLASS & ERRCLS_ADD_RES)
1182 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1183 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1184 (ErrVal)EKWU032, (ErrVal)0, "SGetMsg() failed");
1186 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1190 memset(discSdu, 0, sizeof(KwuDiscSduInfo));
1191 ret1 = cmUnpkKwuDiscSduInfo( (discSdu), mBuf);
1192 #if(ERRCLASS & ERRCLS_DEBUG)
1196 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1197 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1198 (ErrVal)EKWU033, (ErrVal)ret1, "Unpacking failure");
1201 #endif /* ERRCLASS & ERRCLS_DEBUG */
1205 #if (ERRCLASS & ERRCLS_ADD_RES)
1206 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1207 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1208 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1215 return ((*func)(pst, spId, discSdu));
1216 } /* cmUnpkKwuDiscSduReq */
1219 S16 cmUnpkKwuStaIndInfo(KwuStaIndInfo *param,Buffer *mBuf)
1223 CMCHKUNPK(cmUnpkLteRlcId, ¶m->rlcId, mBuf);
1224 CMCHKUNPK(oduUnpackUInt32, ¶m->numSdu, mBuf);
1225 for (i = 0; i < param->numSdu; i++)
1227 CMCHKUNPK(oduUnpackUInt32, ¶m->sduId[i], mBuf);
1231 } /* cmUnpkKwuStaIndInfo */
1234 S16 cmUnpkKwuStaInd(KwuStaInd func,Pst *pst,Buffer *mBuf)
1238 KwuStaIndInfo *staInd = NULLP;
1241 CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1243 switch(pst->selector)
1245 case ODU_SELECTOR_LWLC:
1247 CMCHKUNPK(oduUnpackPointer,(PTR *)&staInd, mBuf);
1250 case ODU_SELECTOR_LC:
1252 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&staInd,\
1253 sizeof(KwuStaIndInfo),SS_SHARABLE_MEMORY)) != ROK)
1255 #if (ERRCLASS & ERRCLS_ADD_RES)
1258 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1259 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1260 (ErrVal)EKWU034, (ErrVal)0, "SGetMsg() failed");
1262 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1266 memset(staInd, 0, sizeof(KwuStaIndInfo));
1268 ret1 = cmUnpkKwuStaIndInfo( (staInd), mBuf);
1269 #if(ERRCLASS & ERRCLS_DEBUG)
1273 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1274 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1275 (ErrVal)EKWU035, (ErrVal)ret1, "Unpacking failure");
1278 #endif /* ERRCLASS & ERRCLS_DEBUG */
1283 #if(ERRCLASS & ERRCLS_DEBUG)
1284 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1285 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1286 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1292 return ((*func)(pst, suId, staInd));
1293 } /* cmUnpkKwuStaInd */
1296 S16 cmUnpkKwuReEstCmpInd(KwuReEstCmpInd func,Pst *pst,Buffer *mBuf)
1298 #if(ERRCLASS & ERRCLS_DEBUG)
1304 memset(&rlcId, 0, sizeof(CmLteRlcId));
1305 CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1306 switch(pst->selector)
1309 case ODU_SELECTOR_LC:
1311 #if(ERRCLASS & ERRCLS_DEBUG)
1312 ret1 = cmUnpkLteRlcId( &rlcId, mBuf);
1316 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1317 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1318 (ErrVal)EKWU035, (ErrVal)ret1, "Unpacking failure");
1322 cmUnpkLteRlcId( &rlcId, mBuf);
1323 #endif /* ERRCLASS & ERRCLS_DEBUG */
1330 return ((*func)(pst, suId, rlcId));
1331 } /* cmUnpkKwuReEstCmpInd */
1333 /* kwu_c_001.main_3 added support for L2 Measurement */
1334 S16 cmUnpkKwuDiscSduCfm(KwuDiscSduCfm func,Pst *pst,Buffer *mBuf)
1338 KwuDiscSduInfo *discSdu = NULLP;
1341 CMCHKUNPK(SUnpkS16, &(spId), mBuf);
1343 switch(pst->selector)
1345 case ODU_SELECTOR_LWLC:
1347 CMCHKUNPK(oduUnpackPointer,(PTR *) &discSdu, mBuf);
1350 case ODU_SELECTOR_LC:
1352 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&discSdu,\
1353 sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY)) != ROK)
1355 #if (ERRCLASS & ERRCLS_ADD_RES)
1358 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1359 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1360 (ErrVal)ERRKWU, (ErrVal)0, "SGetMsg() failed");
1362 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1365 memset(discSdu, 0, sizeof(KwuDiscSduInfo));
1367 ret1 = cmUnpkKwuDiscSduInfo( (discSdu), mBuf);
1368 #if(ERRCLASS & ERRCLS_DEBUG)
1372 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1373 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1374 (ErrVal)ERRKWU, (ErrVal)0, "SGetMsg() failed");
1376 #endif /* ERRCLASS & ERRCLS_DEBUG */
1381 #if(ERRCLASS & ERRCLS_DEBUG)
1382 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1383 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1384 (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1390 return ((*func)(pst, spId, discSdu));
1391 } /* cmUnpkKwuDiscSduCfm */
1392 S16 cmUnpkKwuFlowCntrlInd(KwuFlowCntrlInd func,Pst *pst,Buffer *mBuf)
1395 KwuFlowCntrlIndInfo *flowCntrlInfo = NULLP;
1397 CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1398 switch(pst->selector)
1401 case ODU_SELECTOR_LC:
1403 if(SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region,
1405 (Data **)&flowCntrlInfo,
1406 sizeof(KwuFlowCntrlIndInfo),0) != ROK)
1412 cmUnpkKwuFlowCntrlIndInfo(flowCntrlInfo, mBuf);
1416 case ODU_SELECTOR_LWLC:
1418 CMCHKUNPK(oduUnpackPointer,(PTR *) &flowCntrlInfo, mBuf);
1426 return ((*func)(pst, suId, flowCntrlInfo));
1427 } /* cmUnpkKwuFlowCntrlInd */
1430 S16 cmUnpkKwuDatAckInfo(KwuDatAckInfo *param,Buffer *mBuf)
1433 CMCHKUNPK(oduUnpackUInt32, ¶m->sduId, mBuf);
1434 CMCHKUNPK(cmUnpkLteRlcId, ¶m->rlcId, mBuf);
1440 S16 cmUnpkKwuDatAckInd(KwuDatAckInd func,Pst *pst,Buffer *mBuf)
1444 KwuDatAckInfo *datInd = NULLP;
1447 if((ret1 = SGetStaticBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&datInd,\
1448 sizeof(KwuDatAckInfo),SS_SHARABLE_MEMORY)) != ROK)
1450 #if (ERRCLASS & ERRCLS_ADD_RES)
1453 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1454 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1455 (ErrVal)ERRKWU, (ErrVal)0, "SGetMsg() failed");
1457 #endif /* ERRCLASS & ERRCLS_ADD_RES */
1461 memset(datInd, 0, sizeof(KwuDatAckInfo));
1463 CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1464 ret1 = cmUnpkKwuDatAckInfo( (datInd), mBuf);
1465 #if(ERRCLASS & ERRCLS_DEBUG)
1469 SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1470 __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1471 (ErrVal)ERRKWU, (ErrVal)ret1, "Unpacking failure");
1474 #endif /* ERRCLASS & ERRCLS_DEBUG */
1476 return ((*func)(pst, suId, datInd));
1477 } /* cmUnpkKwuDatAckInd */
1478 #endif /* LTE_L2_MEAS */
1481 /**********************************************************************
1483 **********************************************************************/