cu link failure fix
[o-du/l2.git] / src / 5gnrrlc / kw.h
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:     LTE RLC file 
22     
23         Type:     C include file
24   
25         Desc:     This file contain the hash definations for RLC 
26  
27         File:     kw.h
28   
29 *********************************************************************21*/
30 /** @file kw.h
31 @brief RLC Hash definitions
32 */
33
34 #ifndef __KWH__
35 #define __KWH__
36 #include "rl_interface.h"
37 #include "rl_common.h"
38
39 \f 
40 #define KWLAYERNAME   "LTE RLC"     /* Layer Name */
41
42 #define EKWxxx 1
43 #define EMG099 1
44 #define EMG102 2
45 #define EMG103 3
46 #define EMG104 4
47
48 /* RLC-SPLIT Activity */
49 #define KW_ONE       1
50 #define KW_BIT0      0x01
51 #define KW_BIT1      0x02
52 #define KW_BIT2      0x04
53 #define KW_BIT3      0x08
54
55 #define KW_2K_BYTE   2048
56
57 /* RLC RB flag bits */
58 #define KW_RB_REESTABLISH_DL  KW_BIT0
59 #define KW_RB_REESTABLISH_UL  KW_BIT1
60 #define KW_RB_DELETE_DL       KW_BIT2
61 #define KW_RB_DELETE_UL       KW_BIT3
62
63
64 #define KW_MOD_1024           0x3FF  /* used for MOD 1024 */
65
66
67 \f 
68 /************************************************************************
69  *                            SAP States
70  ************************************************************************/
71
72 #define KW_SAP_NOT_CFG        0     /*!< SAP Not Configured */
73 #define KW_SAP_CFG            1     /*!< SAP Configured but not not bound */
74 #define KW_SAP_BND            2     /*!< SAP Bound */
75 #define KW_SAP_BINDING        3     /*!< SAP Bind initiated */
76 #define KW_SAP_UBND           4     /*!< SAP Unbind */
77
78 #define KW_MAX_SAP_BND_RETRY  3     /*!< Maximum SAP Bin Retries */
79
80 #define KW_MAX_UE             0xffffffff  /*!< Maximum number of UEs. */
81
82 /* Maximum number of Saps */
83 #define KW_MAX_UDXSAPS        1     /*!< Maximum number of UDX Saps */
84 #define KW_MAX_KWUSAPS        2     /*!< Maximum number of KWU Saps. */
85 #define KW_MAX_CKWSAPS        1     /*!< Maximum number of CKW Saps. */
86 /*MCELL changes*/
87 #define KW_MAX_RGUSAPS        4//5     /*!< Maximum number of RGU Saps. */
88
89 #define KW_MAX_RGUSAP_TMR     1     /*!< Maximum number of RGU SAP Timers. */
90
91 #define KW_UI_RRC             0     /*!< Upper interface RRC sap Id. */
92 #define KW_UI_PDCP            1     /*!< Upper interface PDCP sap Id. */
93
94 #ifdef LTE_L2_MEAS
95 /* TODO. This works for FDD only. For TDD the array dimension
96  * should be changed according to the number of Harq Procs */
97 #define KW_MAX_TB_PER_UE      64    /*!< Maximum number of tbCb for UE */
98 #define KW_INVALID_TBID       KW_MAX_TB_PER_UE
99 #endif
100 /*******************************************************************************
101  *                              Memory related Defines 
102  ******************************************************************************/
103 #ifdef MCCABE_COV
104 /* Allocate function */
105 #define KW_ALLOC(_cb,_buf, _size)                                   \
106 {                                                                   \
107    SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf,       \
108                 (Size) _size);                                     \
109       cmMemset((U8 *)(_buf), 0, _size);                             \
110 }
111
112 #define KW_RMV_SDU(_cb,_sduQ,_sdu)                    \
113 {                                                     \
114    SPutMsg(_sdu->mBuf);                               \
115    cmLListDelFrm(_sduQ,&_sdu->lstEnt);                \
116    KW_FREE_WC(_cb,_sdu, sizeof(KwSdu));               \
117 }
118
119 #define KW_FREE(_cb,_buf, _size)                          \
120 {                                                         \
121       (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
122             (Data *) _buf, (Size) _size);                 \
123       _buf = NULLP;                                       \
124 }
125
126 #define KW_FREE_BUF(_buf)           \
127 {                                   \
128       SPutMsg(_buf);                \
129       _buf = NULLP;                 \
130 }
131
132 #else
133
134 #define KW_FREE_SHRABL_BUF(_region, _pool,_buf, _size)    \
135 {                                                         \
136    if (_buf != NULLP)                                     \
137    {                                                      \
138       (Void) SPutStaticBuffer(_region, _pool,             \
139             (Data *) _buf, (Size) _size, 0);                 \
140       _buf = NULLP;                                       \
141    }                                                      \
142 }
143
144 #define KW_FREE_SHRABL_BUF_WC(_region, _pool,_buf, _size) \
145 {                                                         \
146   (Void) SPutStaticBuffer(_region, _pool,                 \
147         (Data *) _buf, (Size) _size, 0);                 \
148   _buf = NULLP;                                       \
149 }
150
151 #define KW_ALLOC_SHRABL_BUF_WC(_region, _pool,_buf, _size)           \
152 {                                                                    \
153  SGetStaticBuffer(_region, _pool, (Data **)&_buf,                    \
154                 (Size) _size, 0);                                    \
155 }
156
157 #define KW_ALLOC_SHRABL_BUF(_region, _pool,_buf, _size)              \
158 {                                                                    \
159  if (SGetStaticBuffer(_region, _pool, (Data **)&_buf,                \
160                 (Size) _size, 0) == ROK)                                \
161    {                                                                 \
162       cmMemset((U8 *)(_buf), 0, _size);                              \
163    }                                                                 \
164    else                                                              \
165    {                                                                 \
166       (_buf) = NULLP;                                                \
167    }                                                                 \
168 }
169 /* Allocate function */
170 #define KW_ALLOC(_cb,_buf, _size)                                    \
171 {                                                                    \
172  if (SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf,      \
173                 (Size) _size) == ROK)                                \
174    {                                                                 \
175       cmMemset((U8 *)(_buf), 0, _size);                              \
176    }                                                                 \
177    else                                                              \
178    {                                                                 \
179       (_buf) = NULLP;                                                \
180    }                                                                 \
181 }
182
183 #define KW_ALLOC_WC(_cb,_buf, _size)  \
184            SGetSBuf(_cb->init.region, _cb->init.pool, (Data **)&_buf, (Size) _size)     
185
186 #define KW_RMV_SDU(_cb,_sduQ,_sdu)              \
187 {                                               \
188    if(_sdu->mBuf)                               \
189    {                                            \
190       SPutMsg(_sdu->mBuf);    \
191    }                                            \
192    cmLListDelFrm(_sduQ,&_sdu->lstEnt);          \
193    KW_FREE(_cb,_sdu, sizeof(KwSdu));            \
194 }
195
196 #define KW_FREE(_cb,_buf, _size)                          \
197 {                                                         \
198    if (_buf != NULLP)                                     \
199    {                                                      \
200       (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
201             (Data *) _buf, (Size) _size);                 \
202       _buf = NULLP;                                       \
203    }                                                      \
204 }
205
206 #define KW_FREE_BUF(_buf)           \
207 {                                   \
208    if (_buf != NULLP)               \
209    {                                \
210       SPutMsg(_buf);                \
211    }                                \
212       _buf = NULLP;                 \
213 }
214 #endif
215
216
217
218
219 #define KW_FREE_WC(_cb,_buf, _size)                       \
220 {                                                         \
221       (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
222             (Data *) _buf, (Size) _size);                 \
223       _buf = NULLP; /*assigning NULLP after free*/ \
224 }
225
226 /* kw002.201 Freeing from region of pst */
227 #define KW_PST_FREE(_region, _pool, _buf, _size)          \
228 {                                                         \
229    if (_buf != NULLP)                                     \
230    {                                                      \
231       (Void) SPutSBuf(_region, _pool,                     \
232                       (Data *) _buf, (Size) _size);       \
233       _buf = NULLP;                                       \
234    }                                                      \
235 }
236
237 #ifdef XEON_SPECIFIC_CHANGES
238 #ifdef SS_LOCKLESS_MEMORY
239 #define KW_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
240 {                                                                  \
241    if (_buf != NULLP)                                              \
242    {                                                               \
243       (Void) SPutStaticBuffer(_region, _pool,                      \
244                       (Data *) _buf, (Size) _size, 0);             \
245       _buf = NULLP;                                                \
246    }                                                               \
247 }
248
249 #define KW_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
250 {                                                                        \
251  SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
252                 (Size) _size, 0);                                        \
253 }
254
255 #else
256
257 #define KW_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
258 {                                                                  \
259    if (_buf != NULLP)                                              \
260    {                                                               \
261       (Void) SPutSBuf(_region, _pool,                      \
262                       (Data *) _buf, (Size) _size);             \
263       _buf = NULLP;                                                \
264    }                                                               \
265 }
266
267 #define KW_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
268 {                                                                        \
269  SGetSBuf(_region, _pool, (Data **)&_buf,      \
270                 (Size) _size);                                        \
271 }
272 #endif /* SS_LOCKLESS_MEMORY */
273
274 #else 
275
276 #define KW_SHRABL_STATIC_BUF_FREE(_region, _pool, _buf, _size)     \
277 {                                                                  \
278    if (_buf != NULLP)                                              \
279    {                                                               \
280       (Void) SPutStaticBuffer(_region, _pool,                      \
281                       (Data *) _buf, (Size) _size, 0);             \
282       _buf = NULLP;                                                \
283    }                                                               \
284 }
285
286 #define KW_SHRABL_STATIC_BUF_ALLOC(_region, _pool, _buf, _size)     \
287 {                                                                        \
288  SGetStaticBuffer(_region, _pool, (Data **)&_buf,      \
289                 (Size) _size, 0);                                        \
290 }
291 #endif
292
293 #define KW_FREE_BUF_WC(_buf)    SPutMsg((_buf));
294
295 #define KW_MEM_CPY(_dst, _src, _size)  cmMemcpy((U8*)_dst, (U8 *)_src, _size); 
296
297 #define KW_MEM_ZERO(_buf, _size) cmMemset((U8 *)(_buf), 0, _size);
298
299 #define KW_GET_MEM_REGION(_cb) (_cb->init.region)
300
301 #define KW_GET_MEM_POOL(_cb) (_cb->init.pool)
302
303 #define KW_GET_MEM_POOL_ADDRESS(_cb) (&_cb->init.pool)
304
305 /* Memset to value */
306 #define KW_MEM_SET(_arg, _val, _size) cmMemset((U8 *)_arg, (U8)_val, _size); 
307
308 /* Alarms */
309 /* Send an alarm for sapId events */
310 /* kw005.201 added support for L2 Measurement */
311 #ifdef LTE_L2_MEAS
312 #define KW_GETSDUIDX(_sduIdx) \
313 {\
314    _sduIdx = (((_sduIdx)+1) % KW_L2MEAS_MAX_OUTSTNGSDU);\
315 }
316 #define KW_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
317 { \
318    kwLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0, 0); \
319 }
320 #define KW_SEND_UEID_ALARM(_cb,_ueId, _qci, _evnt, _cause) \
321 { \
322    kwLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId, _qci); \
323 }
324 #else /* LTE_L2_MEAS */
325 #define KW_SEND_SAPID_ALARM(_cb,_sapId, _evnt, _cause) \
326 { \
327    kwLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, _sapId, 0); \
328 }
329 #define KW_SEND_UEID_ALARM(_cb,_ueId, _evnt, _cause) \
330 { \
331    kwLmmSendAlarm(_cb,LCM_CATEGORY_INTERFACE, _evnt, _cause, 0, _ueId); \
332 }
333 #endif /* LTE_L2_MEAS */
334
335 /*******************************************************************************
336  *                              Common Defines 
337  ******************************************************************************/
338
339 /* RLC Configuration parameters */
340 #define KW_MAX_UL_LI                (2 * KW_MAX_LI)
341 /*macro KW_MAX_DL_LI is moved to kw_env.h file */
342 #define KW_MAX_DAT                  KW_MAXIMUM_DAT
343 /*macro KW_MAX_PDU is moved to kw_env.h file */
344 #define KW_MAX_RB_PER_CELL          10
345 #define KW_MAX_SRB_PER_UE           3
346 #define KW_MAX_DRB_PER_UE           32
347 #define KW_MAX_LCH_PER_UE           12
348 #define KW_MAX_LCH_PER_CELL         6
349 #define KW_MAX_NUM_RB               24
350 #define KW_MAX_UE                   0xffffffff 
351 #define KW_UE_LIST_BUCKET_SIZE      128 
352 #define KW_CELL_LIST_BUCKET_SIZE    10 
353 #define KW_TRANS_ID_LST_BKT_SIZE    10 
354 #define KW_MAX_RB                   32
355
356 /* Direction defines */
357 #define KW_DIR_UL        1     /*!< Unlink direction */
358 #define KW_DIR_DL        2     /*!< Downlink direction */
359 #define KW_DIR_BOTH      3     /*!< Both Downlink and Unlink */
360
361 #define KW_DEF_SEQ_NUM 0 /**< Sequence number to pick in case of duplicate
362                               entries in hash list searches*/
363
364 /**
365  * @def KW_MIN
366  *
367  *    Macro to find the miniumum of two numbers
368  *
369  * @param[in] x    First number
370  * @param[in] y    Second number
371  *
372 */
373 #define KW_MIN(x,y) (x) < (y) ? (x) : (y)
374
375 /**
376  * @def KW_GET_KWCB
377  *
378  *    Macro to the RLC instance
379  *
380  * @param[in] _inst    Instance Id
381  *
382 */
383 #define KW_GET_KWCB(_inst) kwCb[_inst]                              
384
385 #define KW_ADD_SDU            1     /*!< Add SDU. */
386 #define KW_DEL_SDU            2     /*!< Delete SDU. */
387
388 #define KW_CFM_NOK            0     /*!< Do not send DatCfm */
389 #define KW_CFM_OK             1     /*!< Send DatCfm */
390
391 /* Set the unsolictated Status flag */
392 #define KW_SET_USTA_FLAG(_kwCb, _value) \
393 { \
394    _kwCb->init.usta = _value; \
395 }
396
397 /* Macros to get the init parameters */
398 #define KW_GET_DBG_MASK(_kwCb) (_kwCb->init.dbgMask)
399 #define KW_GET_LMPST_MEM_POOL(_kwCb) (_kwCb->init.lmPst.pool)
400 #define KW_GET_LMPST_MEM_REGION(_kwCb) (_kwCb->init.lmPst.region)
401
402 /* Macros for configuration module */
403 #define KW_CFG_FILL_CFG_CFM(_entCfm, _rbId, _rbType, _status, _reason)  \
404 {                                                              \
405    _entCfm->rbId  = _rbId;                                     \
406    _entCfm->rbType = _rbType;                                  \
407    _entCfm->status.status = _status;                           \
408    _entCfm->status.reason = _reason;                           \
409
410
411 /**
412  * @def KW_VALIDATE_UE_RBID
413  *
414  *    This macro validates whether the _rbId passed is valid or not. It checks
415  *    if the _rbId is within the maximum value depending on the _rbType.
416  *    Returns TRUE if valid else FALSE
417  *
418  * @param[in] _rbType    Type of the Radio Bearer; SRB or DRB
419  * @param[in] _rbId      RB Id of the RB to be validated
420  *
421 */ 
422 #define KW_VALIDATE_UE_RBID(_rbType, _rbId)                     \
423        ((_rbType == CM_LTE_SRB && _rbId < KW_MAX_SRB_PER_UE) || \
424        (_rbType == CM_LTE_DRB && _rbId < KW_MAX_DRB_PER_UE))
425
426 /*******************************************************************************
427  *                              UIM Defines 
428  ******************************************************************************/
429 #if (ERRCLASS & ERRCLS_INT_PAR)
430 #define KW_VALDATE_SAP(_cb,_chkSpId, _sap, _ret)                             \
431 {                                                                            \
432    if (_chkSpId != _sap->spId)                                               \
433    {                                                                         \
434       KWLOGERROR(_cb,ERRCLS_DEBUG, EKWxxx, (ErrVal) RFAILED,                 \
435             "Sap Id Validation Failed.");                                    \
436       _ret = RFAILED;                                                        \
437    }                                                                         \
438    /* SAP state validation */                                                \
439    if(_sap->state != KW_SAP_BND)                                             \
440    {                                                                         \
441       KWLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED,               \
442             "Sap State Invalid.");                                           \
443       KW_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
444       _ret = RFAILED;                                                        \
445    }                                                                         \
446 }
447 #else /* ERRCLASS & ERRCLS_INT_PAR */
448 #define KW_VALDATE_SAP(_cb,_chkSpId, _sap, _ret)                             \
449 {                                                                            \
450    /* SAP state validation */                                                \
451    if(_sap->state != KW_SAP_BND)                                             \
452    {                                                                         \
453       KWLOGERROR(_cb,ERRCLS_INT_PAR, EKWXXX, (ErrVal) RFAILED,               \
454             "Sap State Invalid.");                                           \
455       KW_SEND_SAPID_ALARM(_cb,0, LCM_EVENT_UI_INV_EVT, LCM_CAUSE_INV_STATE); \
456       _ret = RFAILED;                                                        \
457    }                                                                         \
458 }
459 #endif /* ERRCLASS & ERRCLS_INT_PAR */
460
461 /*******************************************************************************
462  *                              Timer Defines 
463  ******************************************************************************/
464 #define KW_TMR_LEN                     10
465 #define KW_MAX_UM_TMR                  1
466 #define KW_MAX_AM_TMR                  3
467 #define KW_EVT_UMUL_REORD_TMR          1
468 #define KW_EVT_AMUL_REORD_TMR          2
469 #define KW_EVT_AMUL_STA_PROH_TMR       3
470 #define KW_EVT_AMDL_POLL_RETX_TMR      4
471 #define KW_EVT_WAIT_BNDCFM             5
472 /* kw005.201 added support for L2 Measurement */
473 #ifdef LTE_L2_MEAS
474 #define KW_EVT_L2_TMR                  6
475 #endif /* LTE_L2_MEAS */
476
477 /*******************************************************************************
478  *                              DBM Defines 
479  ******************************************************************************/
480 /**
481  * @def KW_DBM_GET_RBCB_FROM_UECB
482  *
483  *    This macro makes _rbCb point to the RB in _ueCb based on the passed 
484  *    _rbId and _rbType. _rbCb can point to NULLP
485  *
486  * @param[in] _rbId      RB Id of the RB to be fetched
487  * @param[in] _rbType    Type of the RB, SRB or DRB
488  * @param[in] _ueCb      Pointer to the UECb for which to get the RB
489  * @param[out] _rbCb     Pointer to the found RbCb
490  *
491 */
492 #define KW_DBM_GET_RBCB_FROM_UECB(_rbId, _rbType, _ueCb, _rbCb)            \
493            (_rbCb) = ((_rbType) == CM_LTE_SRB) ? (_ueCb)->srbCb[(_rbId)] : \
494                                                  (_ueCb)->drbCb[(_rbId)];     
495 /**
496  * @def KW_DBM_GET_CELL_RBCB
497  *
498  *    This macro makes _rbCb point to the RB in the _rbCbLst. 
499  *    _rbCb can point to NULLP
500  *
501  * @param[in] _rbId         RB Id of the RB to be fetched
502  * @param[in] _rbCbLst      Pointer to array of RBCbs
503  * @param[out] _rbCb        Pointer to the found RbCb
504  *
505 */
506 #define KW_DBM_GET_CELL_RBCB(_rbId, _rbCbLst, _rbCb) \
507            (_rbCb) = (_rbCbLst)[(_rbId)]; 
508
509 /*******************************************************************************
510  *                              UMM Defines 
511  ******************************************************************************/
512 #define KW_UMDL     rbCb->m.umDl 
513 #define KW_UMUL     rbCb->m.umUl 
514
515 /* Sequence Number length defines */
516 #define KW_UM_CFG_5BIT_SN_LEN      1 /**< UM 5-bit Sequence number length 
517                                           in bytes*/   
518 #define KW_UM_CFG_10BIT_SN_LEN     2 /**< UM 10-bit Sequence number length 
519                                           in bytes*/
520 /* 5GNR */
521 /* Sequence Number length defines */
522 #define KW_AM_CFG_12BIT_SN_LEN      1 /**< AM 12-bit Sequence number length 
523                                           in bytes*/   
524 #define KW_AM_CFG_18BIT_SN_LEN      2 /**< AM 18-bit Sequence number length 
525                                           in bytes*/
526
527 /**
528  * @def KW_RMV_MAC_HDR_SZ
529  *
530  *    If PDU size is greater than 127, MAC header would be 3 bytes else 2 bytes
531  *
532  * @param[in,out] _pduSz        Size of the pdu 
533  *
534 */
535 #define KW_RMV_MAC_HDR_SZ(_pduSz) (_pduSz) -= ((_pduSz) > 127) ? 3 : 2;
536
537 /**
538  * @def KW_UM_GET_VALUE
539  *
540  *    This macro is used to calculate the value of UM state variables used 
541  *    in comparisons.  VR(UH) - UM Window Size is taken as the base modulus.
542  *    Returns the modifed value
543  *
544  * @param[in] _val               Value of the state variable 
545  * @param[in] _kwUmUl        Um Uplink control block
546  *
547 */ 
548 #define KW_UM_GET_VALUE(_val,_kwUmUl)  \
549      (((_val) - ((_kwUmUl).vrUh - (_kwUmUl).umWinSz)) & ((_kwUmUl).modBitMask))
550      
551 /*******************************************************************************
552  *                              AMM Defines 
553  ******************************************************************************/ 
554 #define AMDL                           rbCb->m.amDl 
555 #define AMUL                           rbCb->m.amUl
556
557 /* PDU Types */
558 #define KW_DATA_PDU  1
559 #define KW_CNTRL_PDU 0
560
561 #define KW_FI_FIRST_SEG                0x02
562 #define KW_FI_LAST_SEG                 0x01
563 #define KW_SI_FIRST_SEG                0x01
564 #define KW_SI_LAST_SEG                 0x02
565 #define KW_SI_MID_SEG                  0x03
566
567 #define KW_POLL_SET                    0x40 /* 01000000 */
568 #define KW_POLL_UNSET                  0xbf /* 10111111 */
569 #define KW_AM_WIN_SZ                   512
570 #define KW_MAX_NACK_CNT                100
571 /*KW_MAX_CNTRL_FIELDS (Maximum size of Status Pdu) 
572  *  = MAX_NACK_CNT * sizeof(NACK_SN,E1,E2,E3,soStart,soEnd, nackRange)
573  * for 18 bit SN + Fixed Header*/
574 #define KW_MAX_CNTRL_FIELDS            ((KW_MAX_NACK_CNT * 8) + 3)  
575
576 /* Each LI(Length Indicator) holds approx 1+1/2 byte and some other fields thus keeping Header Size equal to twice of MAX LI */
577 /* 5GNR_RLC: Need to change value of HDRSZ as per number of PDUs going in one datReq */
578 #define KW_MAX_HDRSZ                         5 
579 #define KW_AM_PDU_FIXED_HDRSZ                2
580 #define KW_AM_PDU_12BIT_SN_HDRSZ             2
581 #define KW_AM_PDU_18BIT_SN_HDRSZ             3
582 #define KW_AM_SEG_12BIT_SN_WITH_SO_HDRSZ     4
583 #define KW_AM_SEG_18BIT_SN_WITH_SO_HDRSZ     5
584 #define KW_AM_SEG_12BIT_SN_WITHOUT_SO_HDRSZ  2
585 #define KW_AM_SEG_18BIT_SN_WITHOUT_SO_HDRSZ  3
586 #define KW_EXTN_HDRSZ                  2
587 #define KW_CNTRL_PDU_FIXED_HDRSZ       3
588 #define KW_MAC_HDR_SZ2                 2
589 #define KW_MAC_HDR_SZ3                 3
590 #define KW_BYTE_LEN                    8
591 #define KW_2BYTE_LEN                   16
592 #define KW_E1_LEN                      1
593 #define KW_NACK_E1E2_LEN               12
594 #define KW_SO_LEN                      15
595 #define KW_DC_LEN                      1
596 #define KW_CPT_LEN                     3
597 #define KW_RF_LEN                      1
598 #define KW_P_LEN                       1
599 #define KW_FI_LEN                      2
600 #define KW_SI_LEN                      2
601 #define KW_E_LEN                       1
602 #define KW_SN_LEN                      10
603 #define KW_SN_LEN_12BITS               12
604 #define KW_SN_LEN_18BITS               18
605 #define KW_LSF_LEN                     1
606 #define KW_LI_LEN                      11
607 #define KW_STA_PDU_R_BITS_ACKSN_12BITS 7  /* 5GNR : Num Reserved bits in STATUS PDU */
608 #define KW_STA_PDU_R_BITS_ACKSN_18BITS 1
609 #define KW_STA_PDU_R_BITS_NACKSN_12BITS 1
610 #define KW_STA_PDU_R_BITS_NACKSN_18BITS 3
611 #define KW_NACK_RANGE_LEN               8
612 #define KW_SO_LEN_5GNR                  16
613
614 #define KW_DC_POS                      0x80
615 #define KW_DC_SHT                      7      
616 #define KW_POLL_POS                    0x40 /* 5GNR */
617 #define KW_POLL_SHT                    6    /* 5GNR */
618 #define KW_SI_POS                      0x30 /* 5GNR */
619 #define KW_SI_SHT                      4    /* 5GNR */
620 #define KW_SN_POS_12BIT                0x0F
621 #define KW_SN_POS_18BIT                0x03
622 #define KW_AM_GET_WIN_SZ(_snLen)       ((KW_AM_CFG_12BIT_SN_LEN == (_snLen)) ? (2048) : (131072)) /* 5GNR */
623 #define KW_RCV_BUF_BIN_SIZE 512   /* Could be increased to avoid the search time.
624                                       with the memory trade-off */
625 #define KW_TX_BUF_BIN_SIZE 512   /* Could be increased to avoid the search time.
626                                       with the memory trade-off */
627
628 #define KW_SDU_LST                     1
629 #define KW_SEG_LST                     2
630 #define KW_RETX_LST                    3
631 #define KW_ALL_BYTES_MISSING           0xffff
632
633 #define KW_MAX_PDU_MAP                 30       /*!< Maximum PDU Map. */
634
635 #define KW_LLIST_FIRST_SDU(lstCp, nod)          \
636 {                                               \
637    CmLList *tmpNode;                            \
638    /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/      \
639    /*if (tmpNode != NULLP)*/                        \
640    if((tmpNode=cmLListFirst(&lstCp)))            \
641       nod = (KwSdu *)tmpNode->node;             \
642    else                                         \
643       nod = NULLP;                              \
644 }                                                          
645
646                                                            
647 #define KW_LLIST_FIRST_SEG(lstCp, nod)         \
648 {                                              \
649    CmLList *tmpNode;                           \
650    /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/     \
651    /*if (tmpNode != NULLP)*/                       \
652    if((tmpNode=cmLListFirst(&lstCp)))            \
653       nod = (KwSeg *)tmpNode->node;            \
654    else                                        \
655       nod = NULLP;                             \
656 }                                                          
657
658                                                            
659 #define KW_LLIST_FIRST_RETX(lstCp, nod)        \
660 {                                              \
661    CmLList *tmpNode;                           \
662    /*CM_LLIST_FIRST_NODE(&(lstCp), tmpNode);*/     \
663    /*if (tmpNode != NULLP)*/                       \
664    if((tmpNode=cmLListFirst(&lstCp)))            \
665       nod = (KwRetx *)tmpNode->node;           \
666    else                                        \
667       nod = NULLP;                             \
668 }
669
670 #define KW_LLIST_NEXT_SDU(lstCp, nod)          \
671 {                                              \
672    CmLList *tmpNode;                           \
673    /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
674    /*if (tmpNode != NULLP)  */                     \
675    if((tmpNode = cmLListNext(&lstCp)))          \
676       nod = (KwSdu *)tmpNode->node;            \
677    else                                        \
678       nod = NULLP;                             \
679 }                                              
680
681
682 #define KW_LLIST_NEXT_SEG(lstCp, nod)          \
683 {                                              \
684    CmLList *tmpNode;                           \
685    (lstCp).crnt = &((nod)->lstEnt);            \
686    /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
687    /*if (tmpNode != NULLP)*/                       \
688    if((tmpNode = cmLListNext(&lstCp)))           \
689       nod = (KwSeg *)tmpNode->node;            \
690    else                                        \
691       nod = NULLP;                             \
692 }      
693
694                                         
695 #define KW_LLIST_NEXT_RETX(lstCp, nod)         \
696 {                                              \
697    CmLList *tmpNode;                           \
698    /*CM_LLIST_NEXT_NODE(&(lstCp), tmpNode);*/      \
699    /*if (tmpNode != NULLP) */                      \
700    if ((tmpNode = cmLListNext(&lstCp)))          \
701       nod = (KwRetx *)tmpNode->node;           \
702    else                                        \
703       nod = NULLP;                             \
704 }
705
706
707 #define KW_LLIST_LAST_RETX(lstCp, nod)         \
708 {                                              \
709    CmLList *tempNode = NULLP;                  \
710    cmLListLast(&lstCp);                        \
711    tempNode = cmLListCrnt(&lstCp);             \
712    if (tempNode != NULLP)                      \
713       nod = (KwRetx *)tempNode->node;          \
714    else                                        \
715       nod = NULLP;                             \
716 }
717
718 #define KW_LLIST_LAST_SEG(lstCp, nod)          \
719 {                                              \
720    CmLList *tempNode = NULLP;                  \
721    cmLListLast(&lstCp);                        \
722    tempNode = cmLListCrnt(&lstCp);             \
723    if (tempNode != NULLP)                      \
724       nod = (KwSeg *)tempNode->node;           \
725    else                                        \
726       nod = NULLP;                             \
727 }
728
729 #define KW_LLIST_LAST_SDU(lstCp, nod)          \
730 {                                              \
731    CmLList *tempNode = NULLP;                  \
732    cmLListLast(&lstCp);                        \
733    tempNode = cmLListCrnt(&lstCp);             \
734    if (tempNode != NULLP)                      \
735       nod = (KwSdu *)tempNode->node;           \
736    else                                        \
737       nod = NULLP;                             \
738 }
739
740 #define CM_LLIST_INS_AFT_CRNT(lstCp, nod)      \
741 {                                              \
742    CmLList *nodeToIns = &nod->lstEnt;\
743    nodeToIns->node = (PTR) nod;\
744    cmLListInsAfterCrnt(&lstCp, nodeToIns);     \
745 }
746
747 #define CM_LLIST_INS_BEF_CRNT(lstCp, nod)      \
748 {                                              \
749    CmLList *nodeToIns = &nod->lstEnt;          \
750    nodeToIns->node = (PTR) nod;                \
751    cmLListInsCrnt(&lstCp, nodeToIns);          \
752 }
753
754 #define KW_LLIST_DEL_RECBUF(_recBuf)                       \
755 {                                                          \
756    KwSeg  *_seg = NULLP;                                   \
757    KW_LLIST_FIRST_SEG(_recBuf->segLst, _seg);              \
758    while (_seg)                                            \
759    {                                                       \
760       cmLListDelFrm(&_recBuf->segLst, &_seg->lstEnt);      \
761       KW_FREE(_seg, sizeof(KwSeg));                        \
762       KW_LLIST_NEXT_SEG(_recBuf->segLst, _seg);            \
763    }                                                       \
764 }
765
766 #define MODAMT(x, y, z,_snModMask)   \
767 {                         \
768    y = (x - z) & _snModMask;   \
769 }                                                         
770
771 #define MODAMR(x, y, z , _snModMask)   \
772 {                         \
773    y = (x - z) & (_snModMask);   \
774 }
775
776 /**
777  * @def KW_AM_IS_TRANS_WIN_STALLED
778  *
779  *    This macro is used to check if the AM transmit window is stalled or not.
780  *    The tramist window is stalled when the distance between txNext and txNextAck
781  *    is greater than equal to Window Size. Actually it should never be greater 
782  *    than Window Size.
783  *    Returns TRUE if the window is stalled else FALSE
784  *
785  * @param[in] _amDl     AM Downlink control block
786  *
787 */ 
788 #define KW_AM_IS_TRANS_WIN_STALLED(_amDl)  \
789      ((((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask) >= (KW_AM_GET_WIN_SZ(_amDl->snLen)))
790
791 #ifdef TENB_STATS
792 #define KW_AM_TRANS_WIN_SIZE(_amDl)  \
793      (((_amDl)->txNext - (_amDl)->txNextAck) & _amDl->snModMask)
794 #endif
795
796 #define KW_AM_IS_POLL_BIT_SET(_amDl) \
797   (AMDL.pollSn == ((AMDL.txNext - 1) & AMDL.snModMask))
798
799 #define KW_FILL_CNTRL_INFO(cntrlInfo, _val, _len, _idx, _eb)\
800 {                                                           \
801    cntrlInfo.val = _val;                                    \
802    cntrlInfo.len = _len;                                    \
803    cntrlInfo.idx = _idx;                                    \
804    cntrlInfo.emtBits = _eb;                                 \
805 }
806 #define KW_FILL_PREV_IDX(cntrlInfo, _e1Idx, _e1eb, _idx, _eb) \
807 {                                                                     \
808   _e1Idx = cntrlInfo.e1Idx;                                           \
809   _e1eb  = cntrlInfo.e1eb;                                            \
810   _idx   = cntrlInfo.idx;                                             \
811   _eb    = cntrlInfo.emtBits;                                         \
812 }
813
814 #define KW_FILL_HDR_ARGS(hdrInfo, _val, _len)  \
815 {                                              \
816    hdrInfo.val = _val;                         \
817    hdrInfo.len = _len;                         \
818 }
819
820 /* kw003.201 - This macro provides the header size other than the */
821 /*             fixed header of 2 bytes for each AMD PDU or 4 bytes*/
822 /*             for an AM PDU segment                              */
823 #define KW_AM_EXTN_HDRSZ(_numLi, _eHdrSz)       \
824 {                                               \
825    if ((_numLi - 1) % 2)                        \
826    {                                            \
827       _eHdrSz = ((3 * (_numLi - 2)) >> 1) + 2;  \
828    }                                            \
829    else                                         \
830    {                                            \
831       _eHdrSz = (3 * (_numLi - 1)) >> 1;        \
832    }                                            \
833 }
834
835 /* Update poll bit in the buffer */
836 #define KW_UPD_POLL_BIT(_gCb, _retx, _poll)                \
837 {                                                          \
838    U8 fHdr;                                                \
839                                                            \
840    if (_poll != _retx->amHdr.p)                            \
841    {                                                       \
842       /* Get the first byte of the buffer */               \
843       SRemPreMsg((Data *)&fHdr, _retx->seg);               \
844       if (_poll == TRUE)                                   \
845       {                                                    \
846          fHdr = fHdr | KW_POLL_SET;                        \
847       }                                                    \
848       else                                                 \
849       {                                                    \
850          fHdr = fHdr & KW_POLL_UNSET;                      \
851       }                                                    \
852       /* Concatenated updated hdr to the mBuf */           \
853       SAddPreMsg ((Data)fHdr, _retx->seg);                 \
854    }                                                       \
855    /* Update poll bit in the hdrInfo */                    \
856    _retx->amHdr.p = _poll;                                 \
857 }
858
859 #define KW_AM_ELIMINATE_EXTN_HDR(_pduSz, _sduSz, _numLi)   \
860 {                                                          \
861    if ( (_pduSz > _sduSz) && (_sduSz < 2048) )             \
862    {                                                       \
863       _pduSz -= (_numLi % 2) ? 1 : 2;                      \
864    }                                                       \
865 }
866 /**
867  * @def KW_AM_CHK_SN_WITHIN_RECV_WINDOW
868  *
869  *    This macro is used to check if a Sequence Number falls within the AM
870  *    reception window or not.
871  *    The condition is VR(R) <= SN < VR(MR), which are subtracting the base
872  *    modulus becomes 0 <= (SN - VR(R)) % SNLen < (VR(MR) - VR(R)) % SnLen
873  *    NOTE: Careful with the parantheses
874  *
875  *    Returns TRUE if within the window; FALSE otherwise
876  *
877  * @param[in] _sn       The sequence number to be checked
878  * @param[in] _amUl     AM Uplink control block
879  *
880 */
881 #define KW_AM_CHK_SN_WITHIN_RECV_WINDOW(_sn, _amUl)          \
882   ((((_sn) - (_amUl->rxNext)) & (_amUl->snModMask)) < (((_amUl->vrMr) - (_amUl->rxNext)) & (_amUl->snModMask))) 
883
884 #define KW_POWER(x, y)  x << (y-1); 
885
886 #ifndef L2_OPTMZ
887 #define kwCpyMsg(_cb,x, y) \
888       (SAddMsgRef((x), KW_GET_MEM_REGION(_cb), KW_GET_MEM_POOL(_cb), (y)))
889 #else
890 /* L2 optimization for mUe/Tti: Removing dup buf*/
891 #define kwCpyMsg(_cb,x, y) \
892       (SIncMsgRef((x), KW_GET_MEM_REGION(_cb), KW_GET_MEM_POOL(_cb), (y)))
893 #endif
894
895 //      printf("Copy Msg %x \n",x);
896
897 /*******************************************************************************
898  *                              Debugging Defines 
899  ******************************************************************************/
900 #define KW_DBG_SUB_MASK   DBGMASK_MI             /**< Use for sub-mask */
901 #define KW_DBGMASK_DETAIL (KW_DBG_SUB_MASK << 0) /**< Parameters, It will give
902                                                       in depth info */
903 #define KW_DBGMASK_BRIEF  (KW_DBG_SUB_MASK << 1) /**< Info, It will give info at
904                                                     entry and exit places along
905                                                    with certain state changes */
906 #define KW_DBGMASK_ERROR  (KW_DBG_SUB_MASK << 2) /**< Error information */
907 #define KW_DBGMASK_FATAL  (KW_DBG_SUB_MASK << 3) /**< FATAL errors like memory
908                                                     resource failure etc., */
909
910 #define KW_DBG_MDL_MASK (KW_DBG_SUB_MASK << 4)
911
912 #define KW_DBGMASK_TM         (KW_DBG_MDL_MASK << 0)    /**< TM */
913 #define KW_DBGMASK_UM         (KW_DBG_MDL_MASK << 1)    /**< UM */
914 #define KW_DBGMASK_AM         (KW_DBG_MDL_MASK << 2)    /**< AM */
915 #define KW_DBGMASK_DL         (KW_DBG_MDL_MASK << 3)    /**< DL */
916 #define KW_DBGMASK_UL         (KW_DBG_MDL_MASK << 4)    /**< UL */
917 #define KW_DBGMASK_CFG        (KW_DBG_MDL_MASK << 5)    /**< CFG */
918 #define KW_DBGMASK_LMM        (KW_DBG_MDL_MASK << 6)    /**< LMM */
919 #define KW_DBGMASK_INF        (KW_DBG_MDL_MASK << 7)    /**< UI, LI */
920 #define KW_DBGMASK_DUT        (KW_DBG_MDL_MASK << 8)    /**< DBM, UTL, TMR */
921 #define KW_DBGMASK_MBUF_PRNT  (KW_DBG_MDL_MASK << 9)    /**< MBUF, useful in
922                                                              integrated 
923                                                              testing */
924 #define KW_DBGMASK_MEM_INFO   (KW_DBG_MDL_MASK << 10)   /**< Print SSI memory
925                                                              information*/
926 #define KW_DBGMASK_UDX        (KW_DBG_MDL_MASK << 11)   /**< UDX interface */
927
928 #ifdef DEBUGP
929 #define KW_PRNT_BORDER                                   \
930 do                                                       \
931 {                                                        \
932    KW_PRNT((_kwPBuf, "\n==========================\n")); \
933 }while(0)
934
935 #define KW_PRNT_HLINE(_cb,_pMsg)                                              \
936 {                                                                             \
937    sprintf((_cb)->init.prntBuf, "[RLC_LAYER: %s:%d]::", __FILE__, __LINE__);  \
938    SPrint((_cb)->init.prntBuf);                                               \
939    KW_PRNT_TSTAMP(_cb);                                                       \
940    sprintf((_cb)->init.prntBuf, _pMsg);                                       \
941    SPrint((_cb)->init.prntBuf);                                               \
942 }
943
944 #define KW_PRNT(_cb,_prntbuf)  \
945 {                              \
946    sprintf _prntbuf;           \
947    SPrint(_cb->init.prntBuf);  \
948 }
949
950 #define KW_PRINT_TO_BUFFER(_cb,...)                             \
951 {                                                               \
952    snprintf((_cb)->init.prntBuf, PRNTSZE, "[%s]::", __func__);  \
953    SPrint((_cb)->init.prntBuf);                                 \
954    snprintf(_cb->init.prntBuf, PRNTSZE,__VA_ARGS__);            \
955    SPrint(_cb->init.prntBuf);                                   \
956 }
957
958 #define KW_PRNT_TSTAMP(_cb)                                   \
959 {                                                             \
960    S8 _buf[60];                                               \
961    DateTime dt;                                               \
962    cmMemset((U8 *)(&dt), 0, sizeof(DateTime));                \
963    SGetDateTime(&dt);                                         \
964    sprintf(_buf, "date: %02d/%02d/%04d time: %02d:%02d:%02d", \
965      (int)dt.month,(int)dt.day,(int)dt.year + 1900,           \
966      (int)dt.hour,(int)dt.min,(int)dt.sec);                   \
967    KW_PRNT(_cb,(_cb->init.prntBuf,("[%s]", _buf)));           \
968 }
969
970 #define KW_PRNT_MBUF(_cb,_mBufPtr)                          \
971 do                                                          \
972 {                                                           \
973    if(_cb->init.dbgMask & (KW_DBGMASK_MBUF_PRNT))           \
974    {                                                        \
975      KW_PRNT_HLINE(_cb,("\nMessage Buffer Contents:\n"));   \
976      SPrntMsg ((Buffer *)_mBufPtr, 0, 0);                   \
977    }                                                        \
978 }while(0)
979
980 #define KW_PRNT_MEMINFO(_cb)                                  \
981 do                                                            \
982 {                                                             \
983    U32  _memInfo;                                             \
984    if(_cb->init.dbgMask & (KW_DBGMASK_MEM_INFO))              \
985    {                                                          \
986      KW_PRNT_HLINE(_cb,("\nMemory Information:\n"));          \
987      SRegInfoShow(0, &_memInfo);                              \
988    }                                                          \
989 }while(0)
990
991 #define KWDBGP_INTERNAL(_cb,_mask,...)           \
992 do                                               \
993 {                                                \
994    if (!((_cb->init.dbgMask & _mask) ^ _mask))   \
995    {                                             \
996       KW_PRINT_TO_BUFFER(_cb, __VA_ARGS__);      \
997    }                                             \
998 }while(0)
999
1000 #define KWDBGP_ERROR(_cb, ...) \
1001    KWDBGP_INTERNAL(_cb,(KW_DBGMASK_ERROR | KW_MODULE),__VA_ARGS__)
1002
1003 #define KWDBGP_DETAIL(_cb, ...) \
1004    KWDBGP_INTERNAL(_cb,(KW_DBGMASK_DETAIL | KW_MODULE),__VA_ARGS__)
1005
1006 #define KWDBGP_BRIEF(_cb, ...) \
1007    KWDBGP_INTERNAL(_cb,(KW_DBGMASK_BRIEF | KW_MODULE),__VA_ARGS__)   
1008    
1009 #else  /* DEBUGP */ 
1010 #define KW_PRNT_HLINE(_cb,_pMsg)
1011 #define KW_PRNT(_cb,_prntbuf)
1012 #define KW_PRNT_TSTAMP(_cb)
1013 #define KW_PRNT_MBUF(_cb,_mBufPtr)
1014 #define KW_PRNT_MEMINFO(_cb)
1015 #define KWDBGP(_cb,_mask, _arg)
1016 #define KWDBGP_ERROR(_cb, ...) 
1017 #define KWDBGP_DETAIL(_cb, ...)
1018 #define KWDBGP_BRIEF(_cb, ...)
1019 #endif /* DEBUGP */
1020
1021 /*******************************************************************************
1022  *                              LMM Defines 
1023  ******************************************************************************/
1024 #define KW_LMM_RB_STS_INC(_cb)    (_cb)->genSts.numOfRb++;
1025
1026 #define KW_LMM_RB_STS_DEC(_cb)    (_cb)->genSts.numOfRb--;
1027
1028 #if defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION)
1029 #define KW_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
1030 {\
1031    _Sap->pst.selector = _cfg->selector; \
1032    _Sap->pst.route = _cfg->route; \
1033    _Sap->pst.prior =  _cfg->priority; \
1034    _Sap->pst.region = _gCb->init.region;\
1035    _Sap->pst.pool = _gCb->init.pool;\
1036    _Sap->pst.dstProcId = _cfg->procId; \
1037    _Sap->pst.dstEnt = _cfg->ent; \
1038    _Sap->pst.dstInst = _cfg->inst; \
1039    _Sap->pst.srcProcId = _gCb->init.procId; \
1040    _Sap->pst.srcEnt = _gCb->init.ent; \
1041    _Sap->pst.srcInst = _gCb->init.inst; \
1042    _Sap->pst.event = EVTNONE; \
1043    _Sap->spId = _cfg->sapId; \
1044    _Sap->state = KW_SAP_CFG; \
1045 }
1046 #else /* defined(SS_MULTICORE_SUPPORT) && defined(SS_M_PROTO_REGION) */
1047 #define KW_FILL_SAP_HELPER(_Sap, _cfg, _gCb)\
1048 {\
1049    _Sap->pst.selector = _cfg->selector; \
1050    _Sap->pst.route = _cfg->route; \
1051    _Sap->pst.prior =  _cfg->priority; \
1052    _Sap->pst.region = _cfg->mem.region;\
1053    _Sap->pst.pool = _cfg->mem.pool;\
1054    _Sap->pst.dstProcId = _cfg->procId;\
1055    _Sap->pst.dstEnt = _cfg->ent;\
1056    _Sap->pst.dstInst = _cfg->inst;\
1057    _Sap->pst.srcProcId = _gCb->init.procId;\
1058    _Sap->pst.srcEnt = _gCb->init.ent;\
1059    _Sap->pst.srcInst = _gCb->init.inst;\
1060    _Sap->pst.event = EVTNONE;\
1061    _Sap->spId = _cfg->sapId;\
1062    _Sap->state = KW_SAP_CFG;\
1063 }
1064 #endif
1065
1066 /*******************************************************************************
1067  *                              UDX Defines 
1068  ******************************************************************************/
1069 #define KW_GET_DL_SAPCB(_cb, _rbCb) (_cb->u.dlCb->udxDlSap + _rbCb->udxSapId)
1070 #define KW_GET_UDX_SAP(_cb) (_cb->u.ulCb->udxUlSap)
1071
1072 /* kw005.201 added support for L2 Measurement */
1073 #ifdef LTE_L2_MEAS
1074 #define KW_L2_MAX_TIMERS        1
1075 #define KW_QCI_LIST_BUCKET_SIZE 10
1076 #define KW_TB_LIST_BUCKET_SIZE  10
1077 #define KW_MAX_L2MEAS_EVT       10
1078 /* L2 Measurement index to be used in rbCb to store measData */                                       
1079 #define KW_L2MEAS_ACT_UE       0                                       
1080 #define KW_L2MEAS_DL_DELAY     1                                       
1081 #define KW_L2MEAS_DL_DISC      2
1082 #define KW_L2MEAS_UU_LOSS      3
1083 #define KW_L2MEAS_DL_IP        4
1084 #define KW_L2MEAS_UL_IP        5
1085 #endif /* LTE_L2_MEAS */
1086
1087 #define KW_RDWR_LOCK(_lockPtr)
1088 #define KW_RDWR_UNLOCK(_lockPtr)
1089 #define KW_TIME_DIFF(t1,t2)                  \
1090    (t1<t2 ? ((0xffffffff - t2) + t1 ): (t1 - t2)) 
1091
1092 #endif /* __KWH__ */
1093 \f  
1094 /********************************************************************30**
1095   
1096          End of file
1097 **********************************************************************/