SIB1 optional parameters, Cell start request, stop request and slot indication
[o-du/l2.git] / src / cm / kwu.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 /********************************************************************20**
20   
21         Name:    KWU Interface
22     
23         Type:    C file
24   
25         Desc:    This file Contains the packing and unpacking functions for
26                  KWU Interface
27  
28         File:    kwu.c
29   
30 *********************************************************************21*/
31 \f
32 /* header include files (.h) */
33 #include "envopt.h"        /* environment options */
34 #include "envdep.h"        /* environment dependent */
35 #include "envind.h"        /* environment independent */
36
37 #include "gen.h"           /* general */
38 #include "ssi.h"           /* system services */
39 #include "cm5.h"           /* common timer defines */
40 #include "cm_tkns.h"       /* common tokens defines */
41 #include "cm_mblk.h"       /* common memory allocation library defines */
42 #include "cm_llist.h"      /* common link list  defines  */
43 #include "cm_hash.h"       /* common hash list  defines */
44 #include "cm_lte.h"        /* common LTE defines */
45 #ifdef TENB_SPLIT_ARCH
46 #include "ss_queue.h"
47 #include "ss_task.h"
48 #include "ss_msg.h"
49 #endif
50 #include "kwu.h"           /* KWU defines */
51
52 /* extern (.x) include files */
53 #include "gen.x"           /* general */
54 #include "ssi.x"           /* system services */
55
56 #include "cm5.x"           /* common timer library */
57 #include "cm_tkns.x"       /* common tokens */
58 #include "cm_mblk.x"       /* common memory allocation */
59 #include "cm_llist.x"      /* common link list */
60 #include "cm_hash.x"       /* common hash list */
61 #include "cm_lte.x"        /* common LTE includes */
62 #include "cm_lib.x"        /* common memory allocation library */
63 #ifdef TENB_SPLIT_ARCH
64 #include "ss_queue.x"
65 #include "ss_task.x"
66 #include "ss_msg.x"
67 #endif
68 #ifdef SS_RBUF
69 #include "ss_rbuf.h"
70 #include "ss_rbuf.x"
71 #endif /*SS_RBUF*/
72 #include "kwu.x"           /* KWU */
73
74 #ifdef LCKWU
75 \f
76 /****************************************************************************
77  *                      Packing Functions
78  ***************************************************************************/
79 #ifdef ANSI
80 PUBLIC S16 cmPkKwuBndReq
81 (
82 Pst * pst,
83 SuId suId,
84 SpId spId
85 )
86 #else
87 PUBLIC S16 cmPkKwuBndReq(pst, suId, spId)
88 Pst * pst;
89 SuId suId;
90 SpId spId;
91 #endif
92 {
93    S16    ret1;
94    Buffer *mBuf;
95
96    TRC3(cmPkKwuBndReq)
97
98    mBuf = NULLP;
99
100    if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
101    {
102 #if (ERRCLASS & ERRCLS_ADD_RES)
103       if(ret1 != ROK)
104       {
105          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
106                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
107                (ErrVal)EKWU001, (ErrVal)0, "SGetMsg() failed");
108       }
109 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
110       RETVALUE(ret1);
111    }
112    CMCHKPKLOG(SPkS16, spId, mBuf, EKWU002, pst);
113    CMCHKPKLOG(SPkS16, suId, mBuf, EKWU003, pst);
114    pst->event = (Event) KWU_EVT_BND_REQ;
115    RETVALUE(SPstTsk(pst,mBuf));
116 }
117
118 \f
119 #ifdef ANSI
120 PUBLIC S16 cmPkKwuBndCfm
121 (
122 Pst * pst,
123 SuId suId,
124 U8 status
125 )
126 #else
127 PUBLIC S16 cmPkKwuBndCfm(pst, suId, status)
128 Pst * pst;
129 SuId suId;
130 U8 status;
131 #endif
132 {
133    S16    ret1;
134    Buffer *mBuf;
135
136    TRC3(cmPkKwuBndCfm)
137
138    mBuf = NULLP;
139
140    if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
141    {
142 #if (ERRCLASS & ERRCLS_ADD_RES)
143       if(ret1 != ROK)
144       {
145          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
146                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
147                (ErrVal)EKWU004, (ErrVal)0, "SGetMsg() failed");
148       }
149 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
150       RETVALUE(ret1);
151    }
152
153    CMCHKPKLOG(SPkU8, status, mBuf, EKWU005, pst);
154    CMCHKPKLOG(SPkS16, suId, mBuf, EKWU006, pst);
155    pst->event = (Event) KWU_EVT_BND_CFM;
156    RETVALUE(SPstTsk(pst,mBuf));
157 }
158
159 \f
160 #ifdef ANSI
161 PUBLIC S16 cmPkKwuUbndReq
162 (
163 Pst * pst,
164 SuId suId,
165 Reason reason
166 )
167 #else
168 PUBLIC S16 cmPkKwuUbndReq(pst, suId, reason)
169 Pst * pst;
170 SuId suId;
171 Reason reason;
172 #endif
173 {
174    S16 ret1;
175    Buffer *mBuf;
176
177    TRC3(cmPkKwuUbndReq)
178
179    mBuf = NULLP;
180
181    if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
182    {
183 #if (ERRCLASS & ERRCLS_ADD_RES)
184       if(ret1 != ROK)
185       {
186          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
187                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
188                (ErrVal)EKWU007, (ErrVal)0, "SGetMsg() failed");
189       }
190 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
191       RETVALUE(ret1);
192    }
193    CMCHKPKLOG(SPkS16, reason, mBuf, EKWU008, pst);
194    CMCHKPKLOG(SPkS16, suId, mBuf, EKWU009, pst);
195
196    pst->event = (Event) KWU_EVT_UBND_REQ;
197    RETVALUE(SPstTsk(pst,mBuf));
198 } /* cmPkKwuUbndReq */
199
200 #ifdef ANSI
201 PUBLIC S16 cmPkKwuDatReqInfo
202 (
203 KwuDatReqInfo *param,
204 Buffer *mBuf
205 )
206 #else
207 PUBLIC S16 cmPkKwuDatReqInfo(param, mBuf)
208 KwuDatReqInfo *param;
209 Buffer *mBuf;
210 #endif
211 {
212
213    TRC3(cmPkKwuDatReqInfo);
214
215 #ifdef CCPU_OPT
216    switch(param->lcType) {
217       case CM_LTE_LCH_CCCH:
218          CMCHKPK(cmPkLteRnti, param->tm.rnti, mBuf);
219          break;
220       case CM_LTE_LCH_BCCH:
221       case  CM_LTE_LCH_PCCH:
222          CMCHKPK(cmPkLteTimingInfo, &param->tm.tmg, mBuf);
223 #ifdef EMTC_ENABLE
224          CMCHKPK(SPkU8, param->emtcDiReason,mBuf);
225          CMCHKPK(SPkU8, param->pnb,mBuf);
226 #endif
227          break;
228       case CM_LTE_LCH_DTCH:
229       case CM_LTE_LCH_DCCH:
230          break;
231       default :
232          RETVALUE(RFAILED);
233    }
234    CMCHKPK(cmPkLteLcType, param->lcType, mBuf);
235
236 #endif
237    CMCHKPK(SPkU32, param->sduId, mBuf);
238    CMCHKPK(cmPkLteRlcId, &param->rlcId, mBuf);
239    RETVALUE(ROK);
240 } /* cmPkKwuDatReqInfo */
241
242 \f
243 #ifdef ANSI
244 PUBLIC S16 cmPkKwuDatReq
245 (
246 Pst * pst,
247 KwuDatReqInfo* datReq,
248 Buffer * mBuf
249 )
250 #else
251 PUBLIC S16 cmPkKwuDatReq(pst, datReq, mBuf)
252 Pst * pst;
253 KwuDatReqInfo* datReq;
254 Buffer * mBuf;
255 #endif
256 {
257 #ifdef LCKWU
258 #if (ERRCLASS & ERRCLS_ADD_RES)
259 #endif
260 #endif /* LCKWU */
261    S16 ret1 = ROK;
262 #ifndef SS_RBUF
263    KwuDatReqInfo* datReqInfo;
264 #endif
265     TRC3(cmPkKwuDatReq)
266 #ifndef SS_RBUF
267    switch(pst->selector)
268    {
269      case KWU_SEL_LWLC:
270         {
271            if(pst->srcEnt == ENTDUAPP)
272            {
273              /* When the Selector is LWLC, we need to allocate memory, copy
274               * the contents and pass the pointer of the allocated memory. The
275               * subsequent free would be done during the Unpack function of the
276               * primitive. */
277             if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&datReqInfo,
278                         sizeof(KwuDatReqInfo),SS_SHARABLE_MEMORY)) != ROK)
279             {
280 #if (ERRCLASS & ERRCLS_ADD_RES)
281                if(ret1 != ROK)
282                {
283                   SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
284                         __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
285                         (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
286                }
287 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
288                RETVALUE(ret1);
289             }
290             cmMemcpy((U8*)datReqInfo,(U8*)datReq,sizeof(KwuDatReqInfo));
291             CMCHKPK(cmPkPtr,(PTR)datReqInfo, mBuf);
292            }
293            else
294            {
295             CMCHKPK(cmPkPtr,(PTR)datReq, mBuf);
296            }
297         }
298         break;
299      case KWU_SEL_LC:
300         {
301 #if (ERRCLASS & ERRCLS_ADD_RES)
302            ret1 = cmPkKwuDatReqInfo( (datReq), mBuf);
303            if(ret1 != ROK)
304            {
305               SPutMsg(mBuf);
306               SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
307                     __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
308                     (ErrVal)EKWU010, (ErrVal)ret1, "Packing failure");
309               RETVALUE( ret1 );
310            }
311 #else
312            cmPkKwuDatReqInfo( (datReq), mBuf);
313 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
314            if(pst->srcEnt == ENTNH)
315            {
316               if (SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,
317                        sizeof(KwuDatReqInfo),SS_SHARABLE_MEMORY) != ROK)
318               {
319                  SPutMsg(mBuf);
320                  RETVALUE(RFAILED);
321               }
322            }
323         }
324         break;
325      default:
326           SPutMsg(mBuf);
327 #if (ERRCLASS & ERRCLS_ADD_RES)
328           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
329                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
330                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
331 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
332           RETVALUE(RFAILED);
333    }
334
335 #ifdef L2_L3_SPLIT
336     if(datReq->rlcId.rbType == CM_LTE_SRB)
337     {
338        pst->event = (Event) KWU_EVT_CPLANE_DAT_REQ;
339     }
340     else
341     {
342        pst->event = (Event) KWU_EVT_UPLANE_DAT_REQ;
343     }
344 #else
345     pst->event = (Event) KWU_EVT_DAT_REQ;
346 #endif
347     RETVALUE(SPstTsk(pst,mBuf));
348 #else
349    if (pst->srcEnt == ENTPJ)
350    {
351       Void *elem = NULLP;
352       KwuDatReqDetl *kwuDatReqDetl = NULLP;
353       elem = SRngGetWIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
354       if (NULLP != elem)
355       {
356          kwuDatReqDetl = (KwuDatReqDetl *) elem;
357          kwuDatReqDetl->spId = spId;
358          kwuDatReqDetl->lcType = datReq->lcType;
359          kwuDatReqDetl->sduId = datReq->sduId;
360          kwuDatReqDetl->rlcId = datReq->rlcId;
361          kwuDatReqDetl->mBuf = mBuf;
362          SRngIncrWIndx(SS_RNG_BUF_DLPDCP_TO_DLRLC);
363          SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].pktRate++;
364          ret1 = ROK;
365       }
366       else
367       {
368          SsRngInfoTbl[SS_RNG_BUF_DLPDCP_TO_DLRLC].pktDrop++;
369          SPutMsg(mBuf);
370          ret1 = RFAILED;
371       }
372    }
373    else
374    {
375       switch(pst->selector)
376       {
377 #ifdef LCKWU
378          case KWU_SEL_LC:
379             {
380                ret1 = cmPkKwuDatReqInfo( (datReq), mBuf);
381 #if (ERRCLASS & ERRCLS_ADD_RES)
382                if(ret1 != ROK)
383                {
384                   SPutMsg(mBuf);
385                   SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
386                         __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
387                         (ErrVal)EKWU010, (ErrVal)ret1, "Packing failure");
388                   RETVALUE( ret1 );
389                }
390 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
391             }
392             break;
393          case KWU_SEL_LWLC:
394             {
395                CMCHKPK(cmPkPtr,(PTR)datReq, mBuf);
396             }
397             break;
398 #endif /* LCKWU */
399       }
400
401       CMCHKPKLOG(SPkS16, spId, mBuf, EKWU011, pst);
402       pst->event = (Event) KWU_EVT_DAT_REQ;
403       ret1 = SPstTsk(pst,mBuf);
404       if(pst->selector == KWU_SEL_LC)
405       {
406          if (SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,
407                   sizeof(KwuDatReqInfo),SS_SHARABLE_MEMORY) != ROK)
408          {
409             SPutMsg(mBuf);
410             RETVALUE(RFAILED);
411          }
412       }
413    }
414    RETVALUE(ret1);
415 #endif
416 } /* cmPkKwuDatReq */
417
418 \f
419 #ifdef ANSI
420 PUBLIC S16 cmPkKwuDatIndInfo
421 (
422 KwuDatIndInfo *param,
423 Buffer *mBuf
424 )
425 #else
426 PUBLIC S16 cmPkKwuDatIndInfo(param, mBuf)
427 KwuDatIndInfo *param;
428 Buffer *mBuf;
429 #endif
430 {
431    TRC3(cmPkKwuDatIndInfo);
432
433    CMCHKPK(SPkU8, param->isOutOfSeq, mBuf);
434 #ifdef CCPU_OPT
435    CMCHKPK(cmPkLteRnti, param->tCrnti, mBuf);
436 #endif
437    CMCHKPK(cmPkLteRlcId, &param->rlcId, mBuf);
438    RETVALUE(ROK);
439 }
440
441 \f
442 #ifdef ANSI
443 PUBLIC S16 cmPkKwuDatInd
444 (
445 Pst * pst,
446 KwuDatIndInfo* datInd,
447 Buffer * mBuf
448 )
449 #else
450 PUBLIC S16 cmPkKwuDatInd(pst, datInd, mBuf)
451 Pst * pst;
452 KwuDatIndInfo* datInd;
453 Buffer * mBuf;
454 #endif
455 {
456 #ifdef LCKWU
457     S16 ret1 = ROK;
458 #endif /* LCKWU */
459 #ifdef TENB_SPLIT_ARCH
460 #ifdef SS_LOCKLESS_MEMORY
461     SsMsgInfo   *mInfo; 
462 #endif
463 #endif
464     KwuDatIndInfo *datIndInfo = NULLP;
465
466     TRC3(cmPkKwuDatInd)
467
468 #ifdef TENB_SPLIT_ARCH
469     /* SSI_CHANGES: */
470 #ifdef SS_LOCKLESS_MEMORY
471     mInfo = (SsMsgInfo *)mBuf->b_rptr;
472     mInfo->region = pst->region;
473 #endif /* SS_LOCKLESS_MEMORY */
474 #endif
475
476     switch(pst->selector)
477     {
478        case KWU_SEL_LWLC:
479           {
480              /* When the Selector is LWLC, we need to allocate memory, copy
481               * the contents and pass the pointer of the allocated memory. The
482               * subsequent free would be done during the Unpack function of the
483               * primitive. */
484             if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&datIndInfo,
485                         sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY)) != ROK)
486             {
487 #if (ERRCLASS & ERRCLS_ADD_RES)
488                if(ret1 != ROK)
489                {
490                   SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
491                         __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
492                         (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
493                }
494 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
495                RETVALUE(ret1);
496             }
497
498             cmMemcpy((U8*)datIndInfo,(U8*)datInd,sizeof(KwuDatIndInfo));
499             CMCHKPK(cmPkPtr,(PTR)datIndInfo, mBuf);
500           }
501           break;
502        case KWU_SEL_LC:
503           {
504 #if (ERRCLASS & ERRCLS_ADD_RES)
505              ret1 = cmPkKwuDatIndInfo( (datInd), mBuf);
506              if(ret1 != ROK)
507              {
508                 SPutMsg(mBuf);
509                 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
510                       __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
511                       (ErrVal)EKWU012, (ErrVal)ret1, "Packing failure");
512                 RETVALUE( ret1 );
513              }
514 #else
515              cmPkKwuDatIndInfo( (datInd), mBuf);
516 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
517           }
518           break;
519        default:
520           SPutMsg(mBuf);
521 #if (ERRCLASS & ERRCLS_ADD_RES)
522           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
523                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
524                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
525 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
526           RETVALUE(RFAILED);
527     }
528
529     pst->event = (Event) KWU_EVT_DAT_IND;
530
531     RETVALUE(SPstTsk(pst,mBuf));
532 } /* cmPkKwuDatInd */
533
534 \f
535 #ifdef ANSI
536 PUBLIC S16 cmPkKwuDatCfmInfo
537 (
538 KwuDatCfmInfo *param,
539 Buffer *mBuf
540 )
541 #else
542 PUBLIC S16 cmPkKwuDatCfmInfo(param, mBuf)
543 KwuDatCfmInfo *param;
544 Buffer *mBuf;
545 #endif
546 {
547    register U32 iter;
548
549    TRC3(cmPkKwuDatCfmInfo);
550    for(iter = 0; iter < param->numSduIds; iter++)
551    {
552       CMCHKPK(SPkU32, param->sduIds[iter], mBuf);
553    }
554    CMCHKPK(SPkU32, param->numSduIds, mBuf);
555    CMCHKPK(cmPkLteRlcId, &param->rlcId, mBuf);
556    RETVALUE(ROK);
557 } /* cmPkKwuDatCfmInfo */
558
559 \f
560 #ifdef ANSI
561 PUBLIC S16 cmPkKwuDatCfm
562 (
563 Pst * pst,
564 SuId suId,
565 KwuDatCfmInfo* datCfm
566 )
567 #else
568 PUBLIC S16 cmPkKwuDatCfm(pst, suId, datCfm)
569 Pst * pst;
570 SuId suId;
571 KwuDatCfmInfo* datCfm;
572 #endif
573 {
574 #if (ERRCLASS & ERRCLS_ADD_RES)
575    S16 ret1= ROK;
576 #endif 
577    Buffer *mBuf;
578
579    TRC3(cmPkKwuDatCfm)
580
581    mBuf = NULLP;
582
583    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
584       RETVALUE(RFAILED);
585    }
586
587    switch(pst->selector)
588    {
589       case KWU_SEL_LWLC:
590          {
591             CMCHKPK(cmPkPtr,(PTR)datCfm, mBuf);
592          }
593          break;
594       case KWU_SEL_LC:
595          {
596 #if (ERRCLASS & ERRCLS_ADD_RES)
597             ret1 = cmPkKwuDatCfmInfo( (datCfm), mBuf);
598             if(ret1 != ROK)
599             {
600                SPutMsg(mBuf);
601                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
602                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
603                      (ErrVal)EKWU014, (ErrVal)ret1, "Packing failure");
604                RETVALUE( ret1 );
605             }
606 #else
607             cmPkKwuDatCfmInfo( (datCfm), mBuf);
608 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
609             if (SPutStaticBuffer(pst->region, pst->pool, (Data *)datCfm,
610                      sizeof(KwuDatCfmInfo),SS_SHARABLE_MEMORY) != ROK)
611             {
612                SPutMsg(mBuf);
613                RETVALUE(RFAILED);
614             }
615          }
616          break;
617       default:
618           SPutMsg(mBuf);
619 #if (ERRCLASS & ERRCLS_ADD_RES)
620           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
621                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
622                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
623 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
624           RETVALUE(RFAILED);
625    }
626
627     CMCHKPKLOG(SPkS16, suId, mBuf, EKWU015, pst);
628     pst->event = (Event) KWU_EVT_DAT_CFM;
629
630     RETVALUE(SPstTsk(pst,mBuf));
631 } /* cmPkKwuDatCfm */
632
633 \f
634 #ifdef ANSI
635 PUBLIC S16 cmPkKwuDiscSduReq
636 (
637 Pst * pst,
638 SpId spId,
639 KwuDiscSduInfo* discSdu
640 )
641 #else
642 PUBLIC S16 cmPkKwuDiscSduReq(pst, spId, discSdu)
643 Pst * pst;
644 SpId spId;
645 KwuDiscSduInfo* discSdu;
646 #endif
647 {
648 #ifdef LCKWU
649    S16 ret1;
650 #endif /* LCKWU */
651    Buffer *mBuf;
652    KwuDiscSduInfo* discSduInfo = NULLP;
653
654    TRC3(cmPkKwuDiscSduReq)
655    mBuf = NULLP;
656
657    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
658       RETVALUE(RFAILED);
659    }
660
661    switch(pst->selector)
662    {
663       case KWU_SEL_LWLC:
664          {
665             /* When the Selector is LWLC, we need to allocate memory, copy
666              * the contents and pass the pointer of the allocated memory. The
667              * subsequent free would be done during the Unpack function of the
668              * primitive. */
669            if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&discSduInfo,
670                        sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY)) != ROK)
671            {
672 #if (ERRCLASS & ERRCLS_ADD_RES)
673               if(ret1 != ROK)
674               {
675                  SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
676                        __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
677                         (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
678               }
679 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
680               RETVALUE(ret1);
681            }
682             
683            cmMemcpy((U8*)discSduInfo,(U8*)discSdu,sizeof(KwuDiscSduInfo));
684            CMCHKPK(cmPkPtr,(PTR)discSduInfo, mBuf);
685          }
686          break;
687       case KWU_SEL_LC:
688          {
689 #if (ERRCLASS & ERRCLS_ADD_RES)
690             ret1 = cmPkKwuDiscSduInfo( (discSdu), mBuf);
691             if(ret1 != ROK)
692             {
693                SPutMsg(mBuf);
694                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
695                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
696                      (ErrVal)EKWU016, (ErrVal)ret1, "Packing failure");
697                RETVALUE( ret1 );
698             }
699 #else
700             cmPkKwuDiscSduInfo( (discSdu), mBuf);
701 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
702              break;
703           }
704     }
705
706     CMCHKPKLOG(SPkS16, spId, mBuf, EKWU017, pst);
707     pst->event = (Event) KWU_EVT_DISC_SDU_REQ;
708
709     RETVALUE(SPstTsk(pst,mBuf));
710 } /* cmPkKwuDiscSduReq */
711
712 \f
713 #ifdef ANSI
714 PUBLIC S16 cmPkKwuStaIndInfo
715 (
716 KwuStaIndInfo *param,
717 Buffer *mBuf
718 )
719 #else
720 PUBLIC S16 cmPkKwuStaIndInfo(param, mBuf)
721 KwuStaIndInfo *param;
722 Buffer *mBuf;
723 #endif
724 {
725    S16 i;
726
727    TRC3(cmPkKwuStaIndInfo);
728
729    for (i = (param->numSdu - 1); i >= 0; i--)
730    {
731       CMCHKPK(SPkU32, param->sduId[(U16)i], mBuf);
732    }
733    CMCHKPK(SPkU32, param->numSdu, mBuf);
734    CMCHKPK(cmPkLteRlcId, &param->rlcId, mBuf);
735    RETVALUE(ROK);
736 }
737
738 #ifdef ANSI
739 PUBLIC S16 cmPkKwuFlowCntrlIndInfo
740 (
741 KwuFlowCntrlIndInfo *param,
742 Buffer              *mBuf
743 )
744 #else
745 PUBLIC S16 cmPkKwuFlowCntrlIndInfo(param, mBuf)
746 KwuFlowCntrlIndInfo  *param;
747 Buffer               *mBuf;
748 #endif
749 {
750    TRC3(cmPkKwuFlowCntrlIndInfo);
751
752    CMCHKPK(SPkU32, param->pktAdmitCnt, mBuf);   
753    CMCHKPK(cmPkLteRlcId, &param->rlcId, mBuf);
754
755    RETVALUE(ROK);
756 } /* cmPkKwuFlowCntrlIndInfo */
757
758 #ifdef ANSI
759 PUBLIC S16 cmUnpkKwuFlowCntrlIndInfo
760 (
761 KwuFlowCntrlIndInfo *param,
762 Buffer              *mBuf
763 )
764 #else
765 PUBLIC S16 cmUnpkKwuFlowCntrlIndInfo(param, mBuf)
766 KwuFlowCntrlIndInfo  *param;
767 Buffer               *mBuf;
768 #endif
769 {
770    TRC3(cmUnpkKwuFlowCntrlIndInfo);
771    
772    CMCHKUNPK(cmUnpkLteRlcId, &param->rlcId, mBuf);
773    CMCHKUNPK(SUnpkU32, &param->pktAdmitCnt, mBuf);
774   
775    RETVALUE(ROK);
776 } /* cmUnpkKwuFlowCntrlIndInfo */
777
778 \f
779 #ifdef ANSI
780 PUBLIC S16 cmPkKwuStaInd
781 (
782 Pst * pst,
783 SuId suId,
784 KwuStaIndInfo* staInd
785 )
786 #else
787 PUBLIC S16 cmPkKwuStaInd(pst, suId, staInd)
788 Pst * pst;
789 SuId suId;
790 KwuStaIndInfo* staInd;
791 #endif
792 {
793 #ifdef LCKWU
794 #if (ERRCLASS & ERRCLS_ADD_RES)
795    S16 ret1 = ROK;
796 #endif
797 #endif /* LCKWU */
798    Buffer *mBuf;
799
800    TRC3(cmPkKwuStaInd)
801
802    mBuf = NULLP;
803
804    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
805       RETVALUE(RFAILED);
806    }
807
808     switch(pst->selector)
809     {
810        case KWU_SEL_LWLC:
811           {
812              CMCHKPK(cmPkPtr,(PTR) staInd, mBuf);
813           }
814           break;
815        case KWU_SEL_LC:
816           {
817 #if (ERRCLASS & ERRCLS_ADD_RES)
818              ret1 = cmPkKwuStaIndInfo( (staInd), mBuf);
819              if(ret1 != ROK)
820              {
821                 SPutMsg(mBuf);
822                 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
823                       __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
824                       (ErrVal)EKWU018, (ErrVal)ret1, "Packing failure");
825                 RETVALUE( ret1 );
826              }
827 #else
828              cmPkKwuStaIndInfo( (staInd), mBuf);
829 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
830              if (SPutStaticBuffer(pst->region, pst->pool, (Data *)staInd,
831                       sizeof(KwuStaIndInfo),SS_SHARABLE_MEMORY) != ROK)
832              {
833                 SPutMsg(mBuf);
834                 RETVALUE(RFAILED);
835              }
836           }
837           break;
838        default:
839           SPutMsg(mBuf);
840 #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, "pst->selector is invalid\n");
844 #endif
845           RETVALUE(RFAILED);
846     }
847
848     CMCHKPKLOG(SPkS16, suId, mBuf, EKWU019, pst);
849     pst->event = (Event) KWU_EVT_STA_IND;
850
851     RETVALUE(SPstTsk(pst,mBuf));
852 } /* cmPkKwuStaInd */
853
854 \f
855 #ifdef ANSI
856 PUBLIC S16 cmPkKwuReEstCmpInd
857 (
858 Pst * pst,
859 SuId suId,
860 CmLteRlcId rlcId
861 )
862 #else
863 PUBLIC S16 cmPkKwuReEstCmpInd(pst, suId, rlcId)
864 Pst * pst;
865 SuId suId;
866 CmLteRlcId rlcId;
867 #endif
868 {
869 #ifdef LCKWU
870 #if (ERRCLASS & ERRCLS_ADD_RES)
871    S16 ret1;
872 #endif
873 #endif /* LCKWU */
874    Buffer *mBuf;
875
876    TRC3(cmPkKwuReEstCmpInd)
877
878    mBuf = NULLP;
879
880    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
881       RETVALUE(RFAILED);
882    }
883
884     switch(pst->selector)
885     {
886 #ifdef LCKWU
887        case KWU_SEL_LC:
888           {
889 #if (ERRCLASS & ERRCLS_ADD_RES)
890              ret1 = cmPkLteRlcId( &rlcId, mBuf);
891              if(ret1 != ROK)
892              {
893                 SPutMsg(mBuf);
894                 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
895                       __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
896                       (ErrVal)EKWU018, (ErrVal)ret1, "Packing failure");
897                 RETVALUE( ret1 );
898              }
899 #else
900              cmPkLteRlcId( &rlcId, mBuf);
901 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
902              break;
903           }
904 #endif /* LCKWU */
905     }
906
907     CMCHKPKLOG(SPkS16, suId, mBuf, EKWU019, pst);
908     pst->event = (Event) KWU_EVT_REEST_CMP_IND;
909
910     RETVALUE(SPstTsk(pst,mBuf));
911 } /* cmPkKwuReEstCmpInd */
912
913 /* kwu_c_001.main_3 added support for L2 Measurement */
914 #ifdef ANSI
915 PUBLIC S16 cmPkKwuDiscSduCfm
916 (
917 Pst            *pst,
918 SpId           spId,
919 KwuDiscSduInfo *discCfmSdu
920 )
921 #else
922 PUBLIC S16 cmPkKwuDiscSduCfm(pst, spId, discCfmSdu)
923 Pst            *pst;
924 SpId           spId;
925 KwuDiscSduInfo *discCfmSdu;
926 #endif
927 {
928 #if (ERRCLASS & ERRCLS_ADD_RES)
929    S16 ret1 = ROK;
930 #endif
931    Buffer *mBuf;
932
933    TRC3(cmPkKwuDiscSduCfm)
934
935    mBuf = NULLP;
936
937    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
938       RETVALUE(RFAILED);
939    }
940
941    switch(pst->selector)
942    {
943       case KWU_SEL_LWLC:
944          {
945             CMCHKPK(cmPkPtr,(PTR)discCfmSdu, mBuf);
946          }
947          break;
948       case KWU_SEL_LC:
949          {
950 #if (ERRCLASS & ERRCLS_ADD_RES)
951             ret1 = cmPkKwuDiscSduInfo((discCfmSdu), mBuf);
952             if(ret1 != ROK)
953             {
954                SPutMsg(mBuf);
955                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
956                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
957                      (ErrVal)ERRKWU, (ErrVal)ret1, "Packing failure");
958                RETVALUE( ret1 );
959             }
960 #else
961             cmPkKwuDiscSduInfo((discCfmSdu), mBuf);
962 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
963             if (SPutStaticBuffer(pst->region, pst->pool, (Data *)discCfmSdu,
964                      sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY) != ROK)
965             {
966                SPutMsg(mBuf);
967                RETVALUE(RFAILED);
968             }
969          }
970          break;
971       default:
972          SPutMsg(mBuf);
973 #if (ERRCLASS & ERRCLS_ADD_RES)
974          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
975                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
976                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
977 #endif
978           RETVALUE(RFAILED);
979    }
980
981    CMCHKPKLOG(SPkS16, spId, mBuf, ERRKWU, pst);
982    pst->event = (Event) KWU_EVT_DISC_SDU_CFM;
983
984    RETVALUE(SPstTsk(pst,mBuf));
985 } /* cmPkKwuDiscSduCfm */
986 \f
987 #ifdef ANSI
988 PUBLIC S16 cmPkKwuFlowCntrlInd
989 (
990 Pst            *pst,
991 SuId           suId,
992 KwuFlowCntrlIndInfo *flowCntrlIndInfo
993 )
994 #else
995 PUBLIC S16 cmPkKwuFlowCntrlInd(pst, suId, flowCntrlIndInfo)
996 Pst            *pst;
997 SuId           suId;
998 KwuFlowCntrlIndInfo *flowCntrlIndInfo;
999 #endif
1000 {
1001    Buffer *mBuf;
1002
1003    TRC3(cmPkKwuFlowCntrlInd)
1004
1005    mBuf = NULLP;
1006
1007    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
1008    {
1009       SPutStaticBuffer(pst->region, 
1010                pst->pool, 
1011                (Data *)flowCntrlIndInfo,
1012                sizeof(KwuFlowCntrlIndInfo),0);
1013       RETVALUE(RFAILED);
1014    }
1015 #ifdef LCKWU
1016    switch(pst->selector)
1017    {
1018       case KWU_SEL_LC:
1019       {
1020          cmPkKwuFlowCntrlIndInfo((flowCntrlIndInfo), mBuf);
1021
1022          if (SPutStaticBuffer(pst->region, 
1023                       pst->pool, 
1024                       (Data *)flowCntrlIndInfo,
1025                       sizeof(KwuFlowCntrlIndInfo),0) != ROK)
1026          {
1027             SPutMsg(mBuf);
1028             RETVALUE(RFAILED);
1029          }
1030       }
1031       break;
1032       
1033       case KWU_SEL_LWLC:
1034       {
1035          CMCHKPK(cmPkPtr,(PTR) flowCntrlIndInfo, mBuf);
1036       }
1037       break;
1038    }
1039 #endif
1040
1041    CMCHKPKLOG(SPkS16, suId, mBuf, ERRKWU, pst);
1042    pst->event = (Event) KWU_EVT_FLOW_CNTRL_IND;
1043
1044    RETVALUE(SPstTsk(pst,mBuf));
1045 } /* cmPkKwuFlowCntrlInd */
1046
1047 #ifdef LTE_L2_MEAS
1048 #ifdef ANSI
1049 PUBLIC S16 cmPkKwuDatAckInfo
1050 (
1051 KwuDatAckInfo *param,
1052 Buffer *mBuf
1053 )
1054 #else
1055 PUBLIC S16 cmPkKwuDatAckInfo(param, mBuf)
1056 KwuDatAckInfo *param;
1057 Buffer *mBuf;
1058 #endif
1059 {
1060    TRC3(cmPkKwuDatAckIndInfo);
1061
1062    CMCHKPK(cmPkLteRlcId, &param->rlcId, mBuf);
1063    CMCHKPK(SPkU32, param->sduId, mBuf);
1064    RETVALUE(ROK);
1065 }
1066
1067 #ifdef ANSI
1068 PUBLIC S16 cmPkKwuDatAckInd
1069 (
1070 Pst * pst,
1071 SuId suId,
1072 KwuDatAckInfo* datInd
1073 )
1074 #else
1075 PUBLIC S16 cmPkKwuDatAckInd(pst, suId, datInd)
1076 Pst * pst;
1077 SuId suId;
1078 KwuDatAckInfo* datInd;
1079 #endif
1080 {
1081     S16 ret1;
1082
1083    Buffer *mBuf;
1084
1085    TRC3(cmPkKwuDatAckInd);
1086
1087    mBuf = NULLP;
1088
1089    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
1090       RETVALUE(RFAILED);
1091    }
1092
1093    ret1 = cmPkKwuDatAckInfo( (datInd), mBuf);
1094 #if (ERRCLASS & ERRCLS_ADD_RES)
1095    if(ret1 != ROK)
1096    {
1097       SPutMsg(mBuf);
1098       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1099             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1100             (ErrVal)ERRKWU, (ErrVal)ret1, "Packing failure");
1101       RETVALUE( ret1 );
1102    }
1103 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1104    if (SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd,
1105             sizeof(KwuDatAckInfo),SS_SHARABLE_MEMORY) != ROK)
1106    {
1107       SPutMsg(mBuf);
1108       RETVALUE(RFAILED);
1109    }
1110
1111    CMCHKPKLOG(SPkS16, suId, mBuf, ERRKWU, pst);
1112    pst->event = (Event) KWU_EVT_DAT_ACK_IND;
1113
1114    RETVALUE(SPstTsk(pst,mBuf));
1115 } /* cmPkKwuDatAckInd */
1116 #endif /* LTE_L2_MEAS */
1117
1118 \f
1119 #ifdef ANSI
1120 PUBLIC S16 cmUnpkKwuBndReq
1121 (
1122 KwuBndReq func,
1123 Pst *pst,
1124 Buffer *mBuf
1125 )
1126 #else
1127 PUBLIC S16 cmUnpkKwuBndReq(func, pst, mBuf)
1128 KwuBndReq func;
1129 Pst *pst;
1130 Buffer *mBuf;
1131 #endif
1132 {
1133    SuId suId = 0;
1134    SpId spId = 0;
1135
1136    TRC3(cmUnpkKwuBndReq)
1137
1138    CMCHKUNPKLOG(SUnpkS16, &suId, mBuf, EKWU020, pst);
1139    CMCHKUNPKLOG(SUnpkS16, &spId, mBuf, EKWU021, pst);
1140    SPutMsg(mBuf);
1141
1142    RETVALUE((*func)(pst, suId, spId));
1143 }
1144
1145 \f
1146 #ifdef ANSI
1147 PUBLIC S16 cmUnpkKwuBndCfm
1148 (
1149 KwuBndCfm func,
1150 Pst *pst,
1151 Buffer *mBuf
1152 )
1153 #else
1154 PUBLIC S16 cmUnpkKwuBndCfm(func, pst, mBuf)
1155 KwuBndCfm func;
1156 Pst *pst;
1157 Buffer *mBuf;
1158 #endif
1159 {
1160    SuId suId = 0;
1161    U8 status = 0;
1162
1163    TRC3(cmUnpkKwuBndCfm)
1164
1165    CMCHKUNPKLOG(SUnpkS16, &suId, mBuf, EKWU022, pst);
1166    CMCHKUNPKLOG(SUnpkU8, &status, mBuf, EKWU023, pst);
1167    SPutMsg(mBuf);
1168
1169    RETVALUE((*func)(pst, suId, status));
1170 }
1171
1172 \f
1173 #ifdef ANSI
1174 PUBLIC S16 cmUnpkKwuUbndReq
1175 (
1176 KwuUbndReq func,
1177 Pst *pst,
1178 Buffer *mBuf
1179 )
1180 #else
1181 PUBLIC S16 cmUnpkKwuUbndReq(func, pst, mBuf)
1182 KwuUbndReq func;
1183 Pst *pst;
1184 Buffer *mBuf;
1185 #endif
1186 {
1187    SpId spId = 0;
1188    Reason reason = 0;
1189    
1190    TRC3(cmUnpkKwuUbndReq)
1191
1192    CMCHKUNPKLOG(SUnpkS16, &spId, mBuf, EKWU024, pst);
1193    CMCHKUNPKLOG(SUnpkS16, &reason, mBuf, EKWU025, pst);
1194    SPutMsg(mBuf);
1195
1196    RETVALUE((*func)(pst, spId, reason));
1197 } /* cmUnpkKwuUbndReq */
1198
1199 \f
1200 #ifdef ANSI
1201 PUBLIC S16 cmUnpkKwuDatReqInfo
1202 (
1203 KwuDatReqInfo *param,
1204 Buffer *mBuf
1205 )
1206 #else
1207 PUBLIC S16 cmUnpkKwuDatReqInfo(param, mBuf)
1208 KwuDatReqInfo *param;
1209 Buffer *mBuf;
1210 #endif
1211 {
1212
1213    TRC3(cmUnpkKwuDatReqInfo);
1214
1215    CMCHKUNPK(cmUnpkLteRlcId, &param->rlcId, mBuf);
1216    CMCHKUNPK(SUnpkU32, &param->sduId, mBuf);
1217
1218 #ifdef CCPU_OPT
1219    CMCHKUNPK(cmUnpkLteLcType, &param->lcType, mBuf);
1220    switch(param->lcType) {
1221       case CM_LTE_LCH_BCCH:
1222       case  CM_LTE_LCH_PCCH:
1223 #ifdef EMTC_ENABLE
1224          CMCHKUNPK(SUnpkU8,&param->pnb , mBuf);
1225          CMCHKUNPK(SUnpkU8,&param->emtcDiReason , mBuf);
1226 #endif         
1227          CMCHKUNPK(cmUnpkLteTimingInfo, &param->tm.tmg, mBuf);
1228
1229          break;
1230       case CM_LTE_LCH_CCCH:
1231          CMCHKUNPK(cmUnpkLteRnti, &param->tm.rnti, mBuf);
1232          break;
1233       case CM_LTE_LCH_DTCH:
1234       case CM_LTE_LCH_DCCH:
1235          break;
1236       default :
1237          RETVALUE(RFAILED);
1238    }
1239 #endif
1240    RETVALUE(ROK);
1241 }
1242
1243 \f
1244 #ifdef ANSI
1245 PUBLIC S16 cmUnpkKwuDatReq
1246 (
1247 KwuDatReq func,
1248 Pst *pst,
1249 Buffer *mBuf
1250 )
1251 #else
1252 PUBLIC S16 cmUnpkKwuDatReq(func, pst, mBuf)
1253 KwuDatReq func;
1254 Pst *pst;
1255 Buffer *mBuf;
1256 #endif
1257 {
1258 #if(ERRCLASS & ERRCLS_DEBUG)
1259    S16 ret1 = ROK; 
1260 #endif
1261    S16 retVal;
1262    SpId          spId = 0;
1263    KwuDatReqInfo *datReq = NULLP;
1264    KwuDatReqInfo datReqTmp;
1265
1266    TRC3(cmUnpkKwuDatReq)
1267
1268    switch(pst->selector)
1269    {
1270       case KWU_SEL_LWLC:
1271          {
1272             CMCHKUNPK(cmUnpkPtr,(PTR *) &datReq, mBuf);
1273          }
1274          break;
1275       case KWU_SEL_LC:
1276          {
1277             /* Allocate the memory statically  as there is no free 
1278              * in RLC */
1279             datReq = &datReqTmp;
1280             cmMemset((U8 *)datReq, 0, sizeof(KwuDatReqInfo));
1281 #if(ERRCLASS & ERRCLS_DEBUG)
1282             ret1 = cmUnpkKwuDatReqInfo( (datReq), mBuf);
1283             if(ret1 != ROK)
1284             {
1285                SPutMsg(mBuf);
1286                SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1287                      __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1288                      (ErrVal)EKWU027, (ErrVal)ret1, "Unpacking failure");
1289                RETVALUE( ret1 );
1290             }
1291 #else
1292             cmUnpkKwuDatReqInfo( (datReq), mBuf);
1293 #endif /* ERRCLASS & ERRCLS_DEBUG */
1294          }
1295          break;
1296       default:
1297          SPutMsg(mBuf);
1298 #if (ERRCLASS & ERRCLS_ADD_RES)
1299          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1300                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1301                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1302 #endif
1303          RETVALUE(RFAILED);
1304    }
1305
1306    retVal = (*func)(pst, datReq, mBuf);
1307    /* If LWLC is configured, we need to
1308     * free the memory here. */
1309    if(pst->selector == KWU_SEL_LWLC)
1310    {
1311       retVal = SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,
1312             sizeof(KwuDatReqInfo),SS_SHARABLE_MEMORY);
1313    }
1314    RETVALUE(retVal);
1315 } /* cmUnpkKwuDatReq */
1316
1317 \f
1318 #ifdef ANSI
1319 PUBLIC S16 cmUnpkKwuDatIndInfo
1320 (
1321 KwuDatIndInfo *param,
1322 Buffer *mBuf
1323 )
1324 #else
1325 PUBLIC S16 cmUnpkKwuDatIndInfo(param, mBuf)
1326 KwuDatIndInfo *param;
1327 Buffer *mBuf;
1328 #endif
1329 {
1330    TRC3(cmUnpkKwuDatIndInfo);
1331
1332    CMCHKUNPK(cmUnpkLteRlcId, &param->rlcId, mBuf);
1333
1334 #ifdef CCPU_OPT
1335    CMCHKUNPK(cmUnpkLteRnti, &param->tCrnti, mBuf);
1336 #endif
1337    CMCHKUNPK(SUnpkU8, &param->isOutOfSeq, mBuf);
1338    RETVALUE(ROK);
1339 }
1340
1341 \f
1342 #ifdef ANSI
1343 PUBLIC S16 cmUnpkKwuDatInd
1344 (
1345 KwuDatInd func,
1346 Pst *pst,
1347 Buffer *mBuf
1348 )
1349 #else
1350 PUBLIC S16 cmUnpkKwuDatInd(func, pst, mBuf)
1351 KwuDatInd func;
1352 Pst *pst;
1353 Buffer *mBuf;
1354 #endif
1355 {
1356     S16 ret1 = ROK, retVal;
1357     KwuDatIndInfo *datInd = NULLP;
1358     KwuDatIndInfo datIndTmp;
1359     
1360     TRC3(cmUnpkKwuDatInd)
1361
1362     switch(pst->selector)
1363     {
1364       case KWU_SEL_LWLC:
1365          {
1366             CMCHKUNPK(cmUnpkPtr,(PTR *) &datInd, mBuf);
1367          }
1368          break;
1369       case KWU_SEL_LC:
1370          {
1371             /*SGetStaticBuffer used as RRC has an equivalent free but PDCP
1372              * doesn't free any memory */
1373             if(pst->dstEnt != ENTPJ)
1374             {
1375                if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&datInd,
1376                            sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY)) != ROK)
1377                {
1378 #if (ERRCLASS & ERRCLS_ADD_RES)
1379        if(ret1 != ROK)
1380        {
1381           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1382                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1383                (ErrVal)EKWU028, (ErrVal)0, "SGetMsg() failed");
1384        }
1385 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1386                   RETVALUE(ret1);
1387                }
1388             }
1389             else
1390             {
1391                datInd = &datIndTmp;
1392             }
1393
1394             ret1 = cmUnpkKwuDatIndInfo( (datInd), mBuf);
1395 #if(ERRCLASS & ERRCLS_DEBUG)
1396           if(ret1 != ROK)
1397           {
1398              SPutMsg(mBuf);
1399              SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1400                    __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1401                   (ErrVal)EKWU029, (ErrVal)ret1, "Unpacking failure");
1402              RETVALUE( ret1 );
1403           }
1404 #endif /* ERRCLASS & ERRCLS_DEBUG */
1405          }
1406          break;
1407       default:
1408          SPutMsg(mBuf);
1409          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1410                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1411                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1412          RETVALUE(RFAILED);
1413     }
1414     retVal = (*func)(pst, datInd, mBuf);
1415     /* If LWLC is configured and the destination entity is PDCP, we need to
1416      * free the memory here. */
1417     if((pst->selector == KWU_SEL_LWLC) && (pst->dstEnt == ENTPJ))
1418     {
1419        retVal = SPutStaticBuffer(pst->region, pst->pool, (Data *)datInd,
1420                 sizeof(KwuDatIndInfo),SS_SHARABLE_MEMORY);
1421     }
1422     RETVALUE(retVal);
1423 } /* cmUnpkKwuDatInd */
1424
1425 \f
1426 #ifdef ANSI
1427 PUBLIC S16 cmUnpkKwuDatCfmInfo
1428 (
1429 KwuDatCfmInfo *param,
1430 Buffer *mBuf
1431 )
1432 #else
1433 PUBLIC S16 cmUnpkKwuDatCfmInfo(param, mBuf)
1434 KwuDatCfmInfo *param;
1435 Buffer *mBuf;
1436 #endif
1437 {
1438    register S32 iter;
1439    TRC3(cmUnpkKwuDatCfmInfo);
1440
1441    CMCHKUNPK(cmUnpkLteRlcId, &param->rlcId, mBuf);
1442    CMCHKUNPK(SUnpkU32, &param->numSduIds, mBuf);
1443
1444 #ifdef L2_L3_SPLIT /*Work Around */
1445    if (param->numSduIds >= KWU_MAX_DAT_CFM)
1446       param->numSduIds = KWU_MAX_DAT_CFM;
1447 #endif
1448    for(iter = param->numSduIds -1; iter >= 0 ; iter--)
1449    {
1450       CMCHKUNPK(SUnpkU32, &param->sduIds[iter], mBuf);
1451    }
1452    RETVALUE(ROK);
1453 }
1454
1455 #ifdef ANSI
1456 PUBLIC S16 cmUnpkKwuDatCfm
1457 (
1458 KwuDatCfm func,
1459 Pst *pst,
1460 Buffer *mBuf
1461 )
1462 #else
1463 PUBLIC S16 cmUnpkKwuDatCfm(func, pst, mBuf)
1464 KwuDatCfm func;
1465 Pst *pst;
1466 Buffer *mBuf;
1467 #endif
1468 {
1469    S16 ret1 = ROK;
1470    SuId          suId = 0;
1471    KwuDatCfmInfo *datCfm = NULLP;
1472
1473    TRC3(cmUnpkKwuDatCfm)
1474
1475    CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1476
1477    switch(pst->selector)
1478    {
1479       case KWU_SEL_LWLC:
1480          {
1481             CMCHKUNPK(cmUnpkPtr,(PTR *) &datCfm, mBuf);
1482          }
1483          break;
1484       case KWU_SEL_LC:
1485          {
1486             if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&datCfm,\
1487                         sizeof(KwuDatCfmInfo),SS_SHARABLE_MEMORY)) != ROK)
1488             {
1489 #if (ERRCLASS & ERRCLS_ADD_RES)
1490        if(ret1 != ROK)
1491        {
1492           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1493                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1494                (ErrVal)EKWU030, (ErrVal)0, "SGetMsg() failed");
1495        }
1496 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1497                RETVALUE(ret1);
1498             }
1499
1500             cmMemset((U8 *)datCfm, 0, sizeof(KwuDatCfmInfo));
1501             ret1 = cmUnpkKwuDatCfmInfo( (datCfm), mBuf);
1502 #if(ERRCLASS & ERRCLS_DEBUG)
1503           if(ret1 != ROK)
1504           {
1505              SPutMsg(mBuf);
1506              SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1507                    __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1508                   (ErrVal)EKWU031, (ErrVal)ret1, "Unpacking failure");
1509              RETVALUE( ret1 );
1510           }
1511 #endif /* ERRCLASS & ERRCLS_DEBUG */
1512          }
1513          break;
1514       default:
1515 #if (ERRCLASS & ERRCLS_ADD_RES)
1516           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1517                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1518                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1519 #endif
1520           SPutMsg(mBuf);
1521           RETVALUE(RFAILED);
1522    }
1523
1524    SPutMsg(mBuf);
1525
1526    RETVALUE((*func)(pst, suId, datCfm));
1527 } /* cmUnpkKwuDatCfm */
1528
1529 \f
1530 #ifdef ANSI
1531 PUBLIC S16 cmUnpkKwuDiscSduReq
1532 (
1533 KwuDiscSduReq func,
1534 Pst *pst,
1535 Buffer *mBuf
1536 )
1537 #else
1538 PUBLIC S16 cmUnpkKwuDiscSduReq(func, pst, mBuf)
1539 KwuDiscSduReq func;
1540 Pst *pst;
1541 Buffer *mBuf;
1542 #endif
1543 {
1544    S16 ret1 = ROK;
1545    SpId          spId = 0;
1546    KwuDiscSduInfo *discSdu = NULLP;
1547
1548
1549    CMCHKUNPK(SUnpkS16, &(spId), mBuf);
1550    switch(pst->selector)
1551    {
1552       case KWU_SEL_LWLC:
1553          {
1554             CMCHKUNPK(cmUnpkPtr,(PTR *) &discSdu, mBuf);
1555          }
1556          break;
1557       case KWU_SEL_LC:
1558          {
1559             if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&discSdu,\
1560                         sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY)) != ROK)
1561             {
1562 #if (ERRCLASS & ERRCLS_ADD_RES)
1563                /*MBUF_FIXX*/
1564                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1565                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1566                      (ErrVal)EKWU032, (ErrVal)0, "SGetMsg() failed");
1567
1568 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1569                RETVALUE(ret1);
1570             }
1571
1572             cmMemset((U8 *)discSdu, 0, sizeof(KwuDiscSduInfo));
1573             ret1 = cmUnpkKwuDiscSduInfo( (discSdu), mBuf);
1574 #if(ERRCLASS & ERRCLS_DEBUG)
1575             if(ret1 != ROK)
1576             {
1577                SPutMsg(mBuf);
1578                SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1579                      __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1580                      (ErrVal)EKWU033, (ErrVal)ret1, "Unpacking failure");
1581                RETVALUE( ret1 );
1582             }
1583 #endif /* ERRCLASS & ERRCLS_DEBUG */
1584             break;
1585          }
1586       default:
1587 #if (ERRCLASS & ERRCLS_ADD_RES)
1588           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1589                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1590                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1591 #endif
1592           SPutMsg(mBuf);
1593           RETVALUE(RFAILED);
1594    }
1595    SPutMsg(mBuf);
1596
1597    RETVALUE((*func)(pst, spId, discSdu));
1598 } /* cmUnpkKwuDiscSduReq */
1599
1600 \f
1601 #ifdef ANSI
1602 PUBLIC S16 cmUnpkKwuStaIndInfo
1603 (
1604 KwuStaIndInfo *param,
1605 Buffer *mBuf
1606 )
1607 #else
1608 PUBLIC S16 cmUnpkKwuStaIndInfo(param, mBuf)
1609 KwuStaIndInfo *param;
1610 Buffer *mBuf;
1611 #endif
1612 {
1613    U32 i;
1614
1615    TRC3(cmUnpkKwuStaIndInfo);
1616
1617    CMCHKUNPK(cmUnpkLteRlcId, &param->rlcId, mBuf);
1618    CMCHKUNPK(SUnpkU32, &param->numSdu, mBuf);
1619    for (i = 0; i < param->numSdu; i++)
1620    {
1621       CMCHKUNPK(SUnpkU32, &param->sduId[i], mBuf);
1622    }
1623
1624    RETVALUE(ROK);
1625 } /* cmUnpkKwuStaIndInfo */
1626
1627 \f
1628 #ifdef ANSI
1629 PUBLIC S16 cmUnpkKwuStaInd
1630 (
1631 KwuStaInd func,
1632 Pst *pst,
1633 Buffer *mBuf
1634 )
1635 #else
1636 PUBLIC S16 cmUnpkKwuStaInd(func, pst, mBuf)
1637 KwuStaInd func;
1638 Pst *pst;
1639 Buffer *mBuf;
1640 #endif
1641 {
1642    S16 ret1 = ROK;
1643    SuId          suId = 0;
1644    KwuStaIndInfo *staInd = NULLP;
1645
1646    TRC3(cmUnpkKwuStaInd)
1647
1648    CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1649    
1650    switch(pst->selector)
1651    {
1652       case KWU_SEL_LWLC:
1653          {
1654             CMCHKUNPK(cmUnpkPtr,(PTR *)&staInd, mBuf);
1655          }
1656          break;
1657       case KWU_SEL_LC:
1658          {
1659             if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&staInd,\
1660                         sizeof(KwuStaIndInfo),SS_SHARABLE_MEMORY)) != ROK)
1661             {
1662 #if (ERRCLASS & ERRCLS_ADD_RES)
1663                if(ret1 != ROK)
1664                {
1665                   SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1666                         __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1667                         (ErrVal)EKWU034, (ErrVal)0, "SGetMsg() failed");
1668                }
1669 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1670                RETVALUE(ret1);
1671             }
1672
1673             cmMemset((U8 *)staInd, 0, sizeof(KwuStaIndInfo));
1674
1675             ret1 = cmUnpkKwuStaIndInfo( (staInd), mBuf);
1676 #if(ERRCLASS & ERRCLS_DEBUG)
1677             if(ret1 != ROK)
1678             {
1679                SPutMsg(mBuf);
1680                SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1681                      __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1682                      (ErrVal)EKWU035, (ErrVal)ret1, "Unpacking failure");
1683                RETVALUE( ret1 );
1684             }
1685 #endif /* ERRCLASS & ERRCLS_DEBUG */
1686          }
1687          break;
1688       default:
1689           SPutMsg(mBuf);
1690 #if(ERRCLASS & ERRCLS_DEBUG)
1691           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1692                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1693                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1694 #endif
1695           RETVALUE(RFAILED);
1696    }
1697    SPutMsg(mBuf);
1698
1699    RETVALUE((*func)(pst, suId, staInd));
1700 } /* cmUnpkKwuStaInd */
1701
1702 \f
1703 #ifdef ANSI
1704 PUBLIC S16 cmUnpkKwuReEstCmpInd
1705 (
1706 KwuReEstCmpInd func,
1707 Pst *pst,
1708 Buffer *mBuf
1709 )
1710 #else
1711 PUBLIC S16 cmUnpkKwuReEstCmpInd(func, pst, mBuf)
1712 KwuReEstCmpInd func;
1713 Pst *pst;
1714 Buffer *mBuf;
1715 #endif
1716 {
1717 #if(ERRCLASS & ERRCLS_DEBUG)
1718    S16 ret1;
1719 #endif
1720    SuId          suId = 0;
1721    CmLteRlcId    rlcId;
1722
1723    TRC3(cmUnpkKwuReEstCmpInd)
1724
1725    cmMemset((U8 *)&rlcId, 0, sizeof(CmLteRlcId));
1726
1727    CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1728    switch(pst->selector)
1729    {
1730 #ifdef LCKWU
1731       case KWU_SEL_LC:
1732          {
1733 #if(ERRCLASS & ERRCLS_DEBUG)
1734             ret1 = cmUnpkLteRlcId( &rlcId, mBuf);
1735             if(ret1 != ROK)
1736             {
1737                SPutMsg(mBuf);
1738                SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1739                      __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1740                      (ErrVal)EKWU035, (ErrVal)ret1, "Unpacking failure");
1741                RETVALUE( ret1 );
1742             }
1743 #else
1744             cmUnpkLteRlcId( &rlcId, mBuf);
1745 #endif /* ERRCLASS & ERRCLS_DEBUG */
1746             break;
1747          }
1748 #endif /* LCKWU */
1749    }
1750    SPutMsg(mBuf);
1751
1752    RETVALUE((*func)(pst, suId, rlcId));
1753 } /* cmUnpkKwuReEstCmpInd */
1754
1755 /* kwu_c_001.main_3 added support for L2 Measurement */
1756 #ifdef ANSI
1757 PUBLIC S16 cmUnpkKwuDiscSduCfm
1758 (
1759 KwuDiscSduCfm  func,
1760 Pst            *pst,
1761 Buffer         *mBuf
1762 )
1763 #else
1764 PUBLIC S16 cmUnpkKwuDiscSduCfm(func, pst, mBuf)
1765 KwuDiscSduCfm  func;
1766 Pst            *pst;
1767 Buffer         *mBuf;
1768 #endif
1769 {
1770    S16 ret1 = ROK;
1771    SpId          spId = 0;
1772    KwuDiscSduInfo *discSdu = NULLP;
1773
1774    TRC3(cmUnpkKwuDiscSduCfm);
1775
1776    CMCHKUNPK(SUnpkS16, &(spId), mBuf);
1777
1778    switch(pst->selector)
1779    {
1780       case KWU_SEL_LWLC:
1781          {
1782             CMCHKUNPK(cmUnpkPtr,(PTR *) &discSdu, mBuf);
1783          }
1784          break;
1785       case KWU_SEL_LC:
1786          {
1787             if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&discSdu,\
1788                         sizeof(KwuDiscSduInfo),SS_SHARABLE_MEMORY)) != ROK)
1789             {
1790 #if (ERRCLASS & ERRCLS_ADD_RES)
1791       if(ret1 != ROK)
1792       {
1793          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1794                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1795                (ErrVal)ERRKWU, (ErrVal)0, "SGetMsg() failed");
1796       }
1797 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1798                RETVALUE(ret1);
1799             }
1800             cmMemset((U8 *)discSdu, 0, sizeof(KwuDiscSduInfo));
1801
1802    ret1 = cmUnpkKwuDiscSduInfo( (discSdu), mBuf);
1803 #if(ERRCLASS & ERRCLS_DEBUG)
1804             if(ret1 != ROK)
1805             {
1806                SPutMsg(mBuf);
1807                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1808                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1809                      (ErrVal)ERRKWU, (ErrVal)0, "SGetMsg() failed");
1810             }
1811 #endif /* ERRCLASS & ERRCLS_DEBUG */
1812          }
1813          break;
1814       default:
1815           SPutMsg(mBuf);
1816 #if(ERRCLASS & ERRCLS_DEBUG)
1817           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1818                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1819                (ErrVal)ERRKWU, (ErrVal)ret1, "pst->selector is invalid\n");
1820 #endif
1821           RETVALUE(RFAILED);
1822    }
1823    SPutMsg(mBuf);
1824
1825    RETVALUE((*func)(pst, spId, discSdu));
1826 } /* cmUnpkKwuDiscSduCfm */
1827 #ifdef ANSI
1828 PUBLIC S16 cmUnpkKwuFlowCntrlInd
1829 (
1830 KwuFlowCntrlInd  func,
1831 Pst            *pst,
1832 Buffer         *mBuf
1833 )
1834 #else
1835 PUBLIC S16 cmUnpkKwuFlowCntrlInd(func, pst, mBuf)
1836 KwuFlowCntrlInd  func;
1837 Pst            *pst;
1838 Buffer         *mBuf;
1839 #endif
1840 {
1841    SuId   suId;
1842    KwuFlowCntrlIndInfo *flowCntrlInfo = NULLP;
1843
1844    TRC3(cmUnpkKwuFlowCntrlInd);
1845    
1846    CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1847    switch(pst->selector)
1848    {
1849 #ifdef LCKWU
1850       case KWU_SEL_LC:
1851       {
1852          if(SGetStaticBuffer(pst->region, 
1853                      pst->pool, 
1854                      (Data **)&flowCntrlInfo,
1855                      sizeof(KwuFlowCntrlIndInfo),0) != ROK)
1856          {
1857             SPutMsg(mBuf);
1858             RETVALUE(RFAILED);
1859          }
1860
1861          cmUnpkKwuFlowCntrlIndInfo(flowCntrlInfo, mBuf);
1862       }
1863       break;
1864
1865       case KWU_SEL_LWLC:
1866       {
1867          CMCHKUNPK(cmUnpkPtr,(PTR *) &flowCntrlInfo, mBuf);
1868       }
1869       break;
1870 #endif
1871    }
1872
1873    SPutMsg(mBuf);
1874
1875    RETVALUE((*func)(pst, suId, flowCntrlInfo));
1876 } /* cmUnpkKwuFlowCntrlInd */
1877 #ifdef LTE_L2_MEAS
1878 \f
1879 #ifdef ANSI
1880 PUBLIC S16 cmUnpkKwuDatAckInfo
1881 (
1882 KwuDatAckInfo *param,
1883 Buffer *mBuf
1884 )
1885 #else
1886 PUBLIC S16 cmUnpkKwuDatAckInfo(param, mBuf)
1887 KwuDatAckInfo *param;
1888 Buffer *mBuf;
1889 #endif
1890 {
1891    TRC3(cmUnpkKwuDatAckInfo);
1892
1893    CMCHKUNPK(SUnpkU32, &param->sduId, mBuf);
1894    CMCHKUNPK(cmUnpkLteRlcId, &param->rlcId, mBuf);
1895
1896    RETVALUE(ROK);
1897 }
1898
1899 \f
1900 #ifdef ANSI
1901 PUBLIC S16 cmUnpkKwuDatAckInd
1902 (
1903 KwuDatAckInd func,
1904 Pst *pst,
1905 Buffer *mBuf
1906 )
1907 #else
1908 PUBLIC S16 cmUnpkKwuDatAckInd(func, pst, mBuf)
1909 KwuDatAckInd func;
1910 Pst *pst;
1911 Buffer *mBuf;
1912 #endif
1913 {
1914     S16 ret1;
1915     SuId          suId = 0;
1916     KwuDatAckInfo *datInd = NULLP;
1917     
1918     TRC3(cmUnpkKwuDatAckInd);
1919
1920     if((ret1 = SGetStaticBuffer(pst->region, pst->pool, (Data **)&datInd,\
1921                 sizeof(KwuDatAckInfo),SS_SHARABLE_MEMORY)) != ROK)
1922     {
1923 #if (ERRCLASS & ERRCLS_ADD_RES)
1924        if(ret1 != ROK)
1925        {
1926           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1927                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1928                 (ErrVal)ERRKWU, (ErrVal)0, "SGetMsg() failed");
1929        }
1930 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1931        RETVALUE(ret1);
1932     }
1933
1934     cmMemset((U8 *)datInd, 0, sizeof(KwuDatAckInfo));
1935
1936     CMCHKUNPK(SUnpkS16, &(suId), mBuf);
1937     ret1 = cmUnpkKwuDatAckInfo( (datInd), mBuf);
1938 #if(ERRCLASS & ERRCLS_DEBUG)
1939     if(ret1 != ROK)
1940     {
1941        SPutMsg(mBuf);
1942        SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1943              __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1944              (ErrVal)ERRKWU, (ErrVal)ret1, "Unpacking failure");
1945        RETVALUE( ret1 );
1946     }
1947 #endif /* ERRCLASS & ERRCLS_DEBUG */
1948
1949     RETVALUE((*func)(pst, suId, datInd));
1950 } /* cmUnpkKwuDatAckInd */
1951 #endif /* LTE_L2_MEAS */
1952 #endif /* LCKWU */
1953
1954 /**********************************************************************
1955          End of file
1956  **********************************************************************/