macCellCfg
[o-du/l2.git] / src / 5gnrmac / rg_dux.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  
21      Name:     LTE-MAC layer
22   
23      Type:     C source file
24   
25      Desc:     C source code for Entry point fucntions
26   
27      File:    rg_dux.c 
28   
29 **********************************************************************/
30
31 /** @file rg_dux.c
32 @brief This module handles de-multiplexing of the data recieved at MAC.
33 */
34
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=176;
37 static int RLOG_MODULE_ID=4096;
38 /* header include files -- defines (.h) */
39 #include "envopt.h"        /* environment options */
40 #include "envdep.h"        /* environment dependent */
41 #include "envind.h"        /* environment independent */
42   
43 #include "gen.h"           /* general */
44 #include "ssi.h"           /* system services */
45
46 #include "cm_lte.h"        /* Common LTE */
47 #include "cm_tkns.h"       /* Common Token Defines */
48 #include "cm_llist.h"      /* Common Link List Defines */
49 #include "cm_hash.h"       /* Common Hash List Defines */
50 #include "cm_mblk.h"       /* common memory link list library */
51
52 #include "rg_env.h"        /* MAC Environment Defines */
53 #include "tfu.h"           /* CRG Interface defines */
54 #include "crg.h"           /* CRG Interface defines */
55 #include "rg_sch_inf.h"           /* RGR Interface defines */
56 #include "rgu.h"           /* RGU Interface defines */
57 #include "lrg.h"           /* LRG Interface defines */
58
59 #include "rg.h"            /* MAC defines */
60 #include "rg_err.h"        /* MAC error defines */
61
62 /* header/extern include files (.x) */
63 #include "gen.x"           /* general */
64 #include "ssi.x"           /* system services */
65 #include "cm5.x"           /* common timers */
66 #include "cm_lib.x"        /* common library */
67 #include "cm_lte.x"        /* Common LTE */
68 #include "cm_tkns.x"       /* Common Token Definitions */
69 #include "cm_llist.x"      /* Common Link List Definitions */
70 #include "cm_lib.x"        /* Common Library Definitions */
71 #include "cm_hash.x"       /* Common Hash List Definitions */
72 #include "cm_mblk.x"       /* common memory link list library */
73
74 #include "rgu.x"           /* RGU types */
75 #include "tfu.x"           /* CRG Interface includes */
76 #include "crg.x"           /* CRG Interface includes */
77 #include "rg_sch_inf.x"    /* SCH Interface includes */
78 #include "rg_prg.x"        /* PRG interface includes */
79 #include "rgu.x"           /* RGU Interface includes */
80 #include "lrg.x"           /* LRG Interface includes */
81
82 #include "du_app_mac_inf.h"
83 #include "rg.x"            /* MAC includes */
84
85 /* local defines */
86
87 /* local typedefs */
88  
89 /* local externs */
90  
91 /* forward references */
92
93 #define RG_DUX_ALLOC(_pdu, _size, _dataPtr, _ret) {\
94    _ret = cmGetMem((Ptr)&_pdu->memCp, _size, (Ptr *)&_dataPtr); \
95 }
96
97 #define RG_INIT_SDU(_sdu, _lcId, _len) {\
98    (_sdu)->lcId = (_lcId); \
99    (_sdu)->len = (_len); \
100    (_sdu)->mBuf = NULLP; \
101    (_sdu)->sduLstEnt.next = NULLP; \
102    (_sdu)->sduLstEnt.prev = NULLP; \
103    (_sdu)->sduLstEnt.node = (PTR)(_sdu); \
104 }
105
106 #define RG_EXT_BS(_bsr, _bs1, _bs2, _bs3, _bs4)  {\
107    _bs1 = _bsr[0] >> 2; \
108    _bs2 = (((_bsr[0] & 0x3) << 4) | (_bsr[1] >> 4)); \
109    _bs3 = (((_bsr[1] & 0x0F) << 2) | (_bsr[2] >> 6)); \
110    _bs4 = _bsr[2] & 0x3F; \
111 }
112
113 #define RG_UNPACK_LONG_BSR(_bsr, _mBuf, _ret) {\
114    _ret = SRemPreMsgMult((_bsr), 3, (_mBuf)); \
115 }
116
117 #define RG_UNPACK_SHORT_BSR(_bsr, _mBuf, _ret) {\
118    _ret = SUnpkU8((_bsr), (_mBuf)); \
119 }
120
121 #define RG_UNPACK_TRUNC_BSR(_bsr, _mBuf, _ret) {\
122    _ret = SUnpkU8((_bsr), (_mBuf)); \
123 }
124
125 #define RG_UNPACK_PHR(_phr, _mBuf, _ret) {\
126    _ret = SUnpkU8((_phr), (_mBuf)); \
127 }
128
129 #define RG_UNPACK_CRNTI(_rnti, _mBuf, _ret) {\
130    Data _unpkArray[2];\
131    *_rnti = 0;\
132    _ret = SRemPreMsgMult(_unpkArray, (MsgLen) 2, _mBuf);\
133    if (_ret == ROK)\
134    {\
135       *_rnti = (U16) PutHiByte(*_rnti, (U8) _unpkArray[0]);\
136       *_rnti = (U16) PutLoByte(*_rnti, (U8) _unpkArray[1]);\
137    }\
138 }
139
140 /* For EXT PHR DEMUX */
141 #define RG_UNPACK_EXT_PHR_CI(_ci, _mBuf, _ret) {\
142    _ret = SUnpkU8((_ci), (_mBuf)); \
143 }
144
145 #define RG_UNPACK_EXT_PHR(_extPhr, _mBuf, _ret) {\
146    _ret = SUnpkU8((_extPhr), (_mBuf)); \
147 }
148
149
150
151 /**
152  * @brief Handles the insertion of SDU in to PDU.
153  *
154  * @details
155  *
156  *     Function: rgDUXInsSdu
157  *     
158  *     This API handles the insertion of SDU in to PDU.
159  *     
160  *     Processing Steps: 
161  *      - Append the sdu to the sduLst of pdu.
162  *
163  *  @param[in]  Inst        inst
164  *  @param[out] *pdu
165  *  @param[in]  lcId
166  *  @param[in]  sduLen
167  *  @param[out] *err
168  *  @return  S16
169  *      -# ROK 
170  *      -# RFAILED 
171  **/
172 #ifdef ANSI
173 PRIVATE S16 rgDUXInsSdu
174 (
175 Inst        inst,
176 RgMacPdu    *pdu,
177 RgMacSdu    **sdu,
178 U8          lcId,
179 U16         sduLen,
180 RgErrInfo   *err
181 )
182 #else
183 PRIVATE S16 rgDUXInsSdu(inst,pdu, sdu, lcId, sduLen, err)
184 Inst        inst;
185 RgMacPdu    *pdu;
186 RgMacSdu    **sdu,
187 U8          lcId;
188 U16         sduLen;
189 RgErrInfo   *err;
190 #endif
191 {
192    S16         ret;
193    RgMacSdu    *sduAloc = NULLP;
194
195    TRC2(rgDUXInsSdu)
196
197    RG_DUX_ALLOC(pdu, sizeof(RgMacSdu), sduAloc, ret);
198    if(ret != ROK)
199    {
200       RLOG1(L_ERROR, "Allocation of RgSubHdr failed for LCID:%d",lcId);
201       err->errCause = RGERR_DUX_MEM_EXHAUST;
202       RETVALUE(RFAILED);
203    }
204    *sdu = sduAloc; 
205    RG_INIT_SDU(sduAloc, lcId, sduLen);
206    cmLListAdd2Tail(&pdu->sduLst, &sduAloc->sduLstEnt);
207    RETVALUE(ROK);
208 }
209
210 /**
211  * @brief Handles extracting the CE sub headers from the MAC PDU.
212  *
213  * @details
214  *
215  *     Function: rgDUXExtSubHdr
216  *     
217  *     This API handles extracting the  sub headers from the MAC PDU.
218  *     
219  *     Processing Steps: 
220  *      - Extract the each sub header.
221  *
222  *  @param[in]  Inst        inst
223  *  @param[out]  *pdu
224  *  @param[in]  *mBuf
225  *  @param[out] *lcId
226  *  @param[out] *len
227  *  @param[out] *err
228  *  @return  S16
229  *      -# ROK 
230  *      -# RFAILED 
231  **/
232 #ifdef ANSI
233 PRIVATE S16 rgDUXExtSubHdr
234 (
235 Inst        inst,
236 RgMacPdu    *pdu,
237 Buffer      *mBuf,
238 U8          *lcId,
239 U16         *len,
240 RgErrInfo   *err
241 )
242 #else
243 PRIVATE S16 rgDUXExtSubHdr(inst,pdu, mBuf, lcId,
244 len, err)
245 Inst        inst;
246 RgMacPdu    *pdu;
247 Buffer      *mBuf;
248 U8          *lcId;
249 U16         *len;
250 RgErrInfo   *err;
251 #endif
252 {
253    U8             byte;
254    U8             fmt=0;
255  
256    TRC2(rgDUXExtSubHdr)
257
258    *len = 0;   
259    if(SUnpkU8(&byte,mBuf) != ROK)
260    {
261       RLOG0(L_ERROR, "SUnpkU8 failed");
262       err->errCause = RGERR_DUX_UNPACK_FAILURE;
263       RETVALUE(RFAILED);
264    }
265    /* Extract the lcid */
266    RG_EXT_LCID(*lcId, byte);
267
268    /*note: RG_EXT_PHR_LCID currently not considered */
269    if(*lcId <= RG_DEDLC_MAX_LCID)
270    {  /* variable size MAC Sub PDU */
271       RG_EXT_FORMT_BIT(fmt,byte);
272       if(SUnpkU8(&byte, mBuf) != ROK)
273       {
274          RLOG0(L_ERROR, "SUnpkU8 failed");
275          err->errCause = RGERR_DUX_UNPACK_FAILURE;
276          RETVALUE(RFAILED);
277       }
278       *len = byte;
279       if(fmt)
280       {
281          if(SUnpkU8(&byte,mBuf) != ROK)
282          {
283             RLOG0(L_ERROR, "SUnpkU8 failed");
284             err->errCause = RGERR_DUX_UNPACK_FAILURE;
285             RETVALUE(RFAILED);
286          }
287          *len = (*len << 8) | byte;
288       }
289    }
290    RETVALUE(ROK);
291 } /* rgDUXExtSubHdr */
292
293 /**
294  * @brief Handles extracting the CEs from the MAC PDU.
295  *
296  * @details
297  *
298  *     Function: rgDUXExtCe
299  *     
300  *     This API handles extracting the CEs from the MAC PDU.
301  *     
302  *     Processing Steps: 
303  *      - Based on the ce sub header extract the ce.
304  *
305  *  @param[in]  Inst        inst
306  *  @param[in,out]  *pdu
307  *  @param[out] *ceInfo
308  *  @param[in]  *mBuf
309  *  @param[in] lcId
310  *  @param[in] subPduLen
311  *  @param[out] *err
312  *  @return  S16
313  *      -# ROK 
314  *      -# RFAILED 
315  **/
316 #ifdef ANSI
317 PRIVATE S16 rgDUXExtCe
318 (
319 Inst        inst,
320 RgMacPdu    *pdu,
321 RgInfCeInfo  *ceInfo,
322 Buffer       *mBuf,
323 U8          lcId,
324 U16         subPduLen,
325 RgErrInfo    *err
326 )
327 #else
328 PRIVATE S16 rgDUXExtCe(inst,pdu, ceInfo, mBuf,lcId,subPduLen, err)
329 Inst        inst;
330 RgMacPdu    *pdu;
331 RgInfCeInfo  *ceInfo;
332 Buffer       *mBuf;
333 U8          lcId;
334 U16         subPduLen;
335 RgErrInfo    *err;
336 #endif
337 {
338    S16            ret;
339
340    TRC2(rgDUXExtCe);
341
342    switch(lcId)
343    {
344       case RG_EXT_PHR_LCID:
345          {
346             U8 Ci;
347             U8 sCellIdx;
348             U8 extPhrOctet;
349             U8 extPhrPCmax;
350             RgInfExtPhrCEInfo *extPhr;
351
352             RG_UNPACK_EXT_PHR_CI(&Ci,mBuf,ret);
353             if(ret != ROK)
354             {
355                RLOG1(L_ERROR,"Unpacking of EXT PHR failed LCID:%d",lcId);
356                err->errCause = RGERR_DUX_UNPACK_FAILURE;
357                RETVALUE(RFAILED);
358             }
359
360             /* Not handling Type 2 PHR report as simultaneous PUSCH/PUCCH
361                is not supported as of now */
362             extPhr = &ceInfo->ces.extPhr;
363             extPhr->numServCells = 0;
364
365             /* Setting first BIT as PCELL field even though reserved is always
366                reported by UE */
367             Ci |= 0x1;
368             for (sCellIdx = 0; (Ci && sCellIdx < CM_LTE_MAX_CELLS); sCellIdx++)
369             {
370                if (Ci & 0x1)
371                {
372                   extPhr->servCellPhr[extPhr->numServCells].sCellIdx = sCellIdx;
373                   RG_UNPACK_EXT_PHR(&extPhrOctet,mBuf,ret);
374                   if(ret != ROK)
375                   {
376                      RLOG1(L_ERROR,"Unpacking of EXT PHR failed LCID:%d",lcId);
377                      err->errCause = RGERR_DUX_UNPACK_FAILURE;
378                      RETVALUE(RFAILED);
379                   }
380
381                   /* extPhrOctet: Bits : 7 6 5 4 3 2 1 0
382                    *                     P V x x x x x x
383                    *                         <6x Bit phr>
384                    */
385                   /* P : P Back off applied or not */
386                   extPhr->servCellPhr[extPhr->numServCells].phr = (extPhrOctet & 0x3F);
387                   extPhr->servCellPhr[extPhr->numServCells].pBackOff = 
388                      ((extPhrOctet >> 7) & 0x01);
389
390                   /* V: Virtual PCMAX or Real Tx PCMAX */
391                   if (extPhrOctet & 0x40)
392                   {
393                      extPhr->servCellPhr[extPhr->numServCells].pCmax = RG_REF_PCMAX;
394                   }
395                   else
396                   {
397                      RG_UNPACK_EXT_PHR(&extPhrPCmax,mBuf,ret);
398                      if(ret != ROK)
399                      {
400                         RLOG1(L_ERROR,"Unpacking of EXT PHR failed LCID:%d",lcId);
401                         err->errCause = RGERR_DUX_UNPACK_FAILURE;
402                         RETVALUE(RFAILED);
403                      }
404                      extPhr->servCellPhr[extPhr->numServCells].pCmax = (extPhrPCmax & 0x3F);
405                   }
406                   extPhr->numServCells++;
407                }
408                Ci >>= 1;
409             }
410
411             ceInfo->bitMask |= RG_EXT_PHR_CE_PRSNT;
412          }
413          break;
414
415       case RG_PHR_LCID:
416          {
417             RG_UNPACK_PHR(&ceInfo->ces.phr,mBuf,ret);
418             if(ret != ROK)
419             {
420                RLOG1(L_ERROR,"Unpacking of PHR failed LCID:%d",lcId);
421                err->errCause = RGERR_DUX_UNPACK_FAILURE;
422                RETVALUE(RFAILED);
423             }
424             ceInfo->bitMask |= RG_PHR_CE_PRSNT;
425          }
426          break;
427       case RG_TRUNC_BSR_LCID:
428          {
429             RG_UNPACK_TRUNC_BSR(&ceInfo->ces.bsr.truncBsr,mBuf,ret);
430             if(ret != ROK)
431             {
432                RLOG1(L_ERROR,"Unpacking of Trunc BSR failed LCID:%d",lcId);
433                err->errCause = RGERR_DUX_UNPACK_FAILURE;
434                RETVALUE(RFAILED);
435             }
436             ceInfo->bitMask |= RG_TRUNC_BSR_CE_PRSNT;
437          }
438          break;
439       case RG_SHORT_BSR_LCID:
440          {
441             RG_UNPACK_SHORT_BSR(&ceInfo->ces.bsr.shortBsr,mBuf,ret);
442             if(ret != ROK)
443             {
444                RLOG1(L_ERROR,"Unpacking of Short BSR failed LCID:%d",lcId);
445                err->errCause = RGERR_DUX_UNPACK_FAILURE;
446                RETVALUE(RFAILED);
447             }
448             ceInfo->bitMask |= RG_SHORT_BSR_CE_PRSNT;
449          }
450          break;
451       case RG_LONG_BSR_LCID:
452          {
453             U8 longBsr[3] = {0}; /* KW_FIXX */
454             RG_UNPACK_LONG_BSR(longBsr,mBuf,ret);
455             if(ret != ROK)
456             {
457                RLOG1(L_ERROR,"Unpacking of Long BSR failed LCID:%d",lcId);
458                err->errCause = RGERR_DUX_UNPACK_FAILURE;
459                RETVALUE(RFAILED);
460             }
461             RG_EXT_BS(longBsr, 
462                   ceInfo->ces.bsr.longBsr.bs1, 
463                   ceInfo->ces.bsr.longBsr.bs2, 
464                   ceInfo->ces.bsr.longBsr.bs3, 
465                   ceInfo->ces.bsr.longBsr.bs4);
466             ceInfo->bitMask |= RG_LONG_BSR_CE_PRSNT;
467          }
468          break;
469       case RG_CRNTI_LCID:
470          {
471             RG_UNPACK_CRNTI(&ceInfo->ces.cRnti,mBuf,ret);
472             if(ret != ROK)
473             {
474                RLOG1(L_ERROR,"Unpacking of C-RNTI failed LCID:%d",lcId);
475                err->errCause = RGERR_DUX_UNPACK_FAILURE;
476                RETVALUE(RFAILED);
477             }
478             ceInfo->bitMask |= RG_CRNTI_CE_PRSNT;
479          }
480          break;
481       default:
482          RLOG1(L_ERROR, "Invalid LCID:%u received",lcId); 
483          err->errCause = RGERR_DUX_INV_LCID_RX;
484          RETVALUE(RFAILED);
485    }
486    RETVALUE(ROK);
487 } /* rgDUXExtCe  */
488
489
490 /**
491  * @brief Handles extracting the SDU from the MAC PDU.
492  *
493  * @details
494  *
495  *     Function: rgDUXExtSdu
496  *     
497  *     This API handles extracting the SDU corresponding to a logical channel.
498  *     
499  *     Processing Steps: 
500  *      - Based on the length stored in the sub header extract the SDU.
501  *
502  *  @param[in]  Inst        inst
503  *  @param[in,out]  *pdu
504  *  @param[out] *ceInfo
505  *  @param[in]  *mBuf
506  *  @param[in] lcId
507  *  @param[in] subPduLen
508  *  @param[out] *err
509  *  @return  S16
510  *      -# ROK 
511  *      -# RFAILED 
512  **/
513 #ifdef ANSI
514 PRIVATE S16 rgDUXExtSdu
515 (
516 Inst        inst,
517 RgMacPdu    *pdu,
518 RgInfCeInfo  *ceInfo,
519 Buffer      **mBuf,
520 U8          lcId,
521 U16         subPduLen,
522 RgErrInfo   *err
523 )
524 #else
525 PRIVATE S16 rgDUXExtSdu(inst,pdu, ceInfo,mBuf,lcId,subPduLen,err)
526 Inst        inst;
527 RgMacPdu    *pdu;
528 RgInfCeInfo  *ceInfo;
529 Buffer      **mBuf;
530 U8          lcId;
531 U16         subPduLen;
532 RgErrInfo   *err;
533 #endif
534 {
535    S16         ret;
536    Buffer      *tmpBuf1;
537    Buffer      *tmpBuf2 = NULLP;
538    RgMacSdu    *sdu;
539
540    TRC2(rgDUXExtSdu)
541
542    if(lcId == RG_CCCH_LCID)
543    {
544       ceInfo->bitMask |= RG_CCCH_SDU_PRSNT;
545    }
546
547    if(rgDUXInsSdu(inst,pdu, &sdu,lcId, subPduLen, err) != ROK)
548    {
549       RG_FREE_MSG(*mBuf);
550       RETVALUE(RFAILED);
551    }
552
553    tmpBuf1 = *mBuf;
554    {
555       ret = SSegMsg(tmpBuf1,subPduLen,&tmpBuf2);
556       if((ret != ROK) && (!((ret == ROKDNA) )))
557       {
558          RG_FREE_MSG(tmpBuf1);
559          RLOG0(L_ERROR,"SSegMsg failed");
560          err->errCause = RGERR_DUX_RLC_PDU_CREAT_FAIL;
561          RETVALUE(RFAILED);
562       }
563       sdu->mBuf = tmpBuf1;
564       *mBuf = tmpBuf2;
565    }
566    RETVALUE(ROK);
567 }   /* rgDUXExtSdu */
568
569 /**
570  * @brief Handles de-multiplexing of the data recieved at MAC.
571  *
572  * @details
573  *
574  *     Function: rgDUXDemuxData
575  *     
576  *     This API handles de-multiplexing of the data recieved at MAC.
577  *     
578  *     Invoked by: rgTOMTfuDatInd of TOM 
579  *     
580  *     Processing Steps: 
581  *      - De-multiplex the mBuf
582  *
583  *  @param[in]  Inst        inst
584  *  @param[in]  *pdu 
585  *  @param[in]  *mBuf 
586  *  @param[out] *err 
587  *  @return  S16
588  *      -# ROK 
589  *      -# RFAILED 
590  **/
591 #ifdef ANSI
592 PUBLIC S16 rgDUXDemuxData
593 (
594 Inst          inst,
595 RgMacPdu      *pdu,
596 RgInfCeInfo   *ceInfo,
597 Buffer        **mBuf,
598 RgErrInfo     *err
599 )
600 #else
601 PUBLIC S16 rgDUXDemuxData(inst,pdu, ceInfo, mBuf, err)
602 Inst          inst;
603 RgMacPdu      *pdu;
604 RgInfCeInfo   *ceInfo;
605 Buffer        **mBuf;
606 RgErrInfo     *err;
607 #endif
608 {
609    U8          lcId;
610    U16          subPduLen;
611    MsgLen      len;  
612    TRC2(rgDUXDemuxData)
613
614    ceInfo->bitMask = 0x0000;
615
616    /* Initialize the sdu list */
617    cmLListInit(&pdu->sduLst);
618
619    if(*mBuf == NULLP) 
620    {
621       RLOG0(L_ERROR, "Null Buffer Recevived");
622       RETVALUE(RFAILED);
623    }
624    do
625    {
626       /* UL Message format  order : 
627            PduSubHdr+SubPDU,PduSubHdr+SubPDU,...CeSubHdr+Ce,CeSubPdu+Ce,...,PADSubHdr+PAD */
628       /* Extract the Sub headers */
629       if(rgDUXExtSubHdr(inst,pdu, *mBuf, &lcId, 
630                &subPduLen, err) != ROK)
631       {
632          RG_FREE_MSG(*mBuf);          
633          RLOG0(L_ERROR, "Failed to extract pad sub headers");
634          RETVALUE(RFAILED);
635       }
636       if(lcId == RG_PAD_LCID)
637       { /*at end of MAC PDU,  Padding started */ 
638          RG_FREE_MSG(*mBuf);          
639          RETVALUE(ROK);
640       }
641       if(lcId <= RG_DEDLC_MAX_LCID)
642       {
643          /* Extract the sdus */
644          if(rgDUXExtSdu(inst,pdu,ceInfo, mBuf,lcId,subPduLen, err) != ROK)
645          {
646             /* Fix : syed rgDUXExtSdu would have segmented mBuf and hence
647              * will be responsible for freeing mBuf */
648             *mBuf = NULLP;
649             RLOG0(L_ERROR, "failed to Extract the sdus");
650             RETVALUE(RFAILED);
651          }
652          if(*mBuf == NULLP) /* if message read completes then return */
653          {
654             RETVALUE(ROK);
655          }
656       }
657       else
658       {
659          /* Extract the ces */
660          if(rgDUXExtCe(inst,pdu,ceInfo,*mBuf, lcId,subPduLen, err) != ROK)
661          {
662             RG_FREE_MSG(*mBuf);       
663             RLOG0(L_ERROR, " failed to Extract the ces");
664             RETVALUE(RFAILED);
665          }
666       }
667       if(SFndLenMsg(*mBuf,&len) != ROK)
668       {
669          RG_FREE_MSG(*mBuf);
670          RLOG0(L_ERROR,"mBuf length check failed");
671          err->errCause = RGERR_DUX_UNPACK_FAILURE;
672          RETVALUE(RFAILED);
673       }
674    }while(len);
675
676    RG_FREE_MSG(*mBuf);
677    RETVALUE(ROK);
678 }  /* rgDUXDemuxData */
679
680 /**********************************************************************
681  
682          End of file
683 **********************************************************************/