UL data path changes at Phy stub, RLC UL UM and DU APP [Issue-ID: ODUHIGH-262]
[o-du/l2.git] / src / 5gnrrlc / kw.h
index 74a1a0f..d57dd95 100755 (executable)
 {                                                     \
    SPutMsg(_sdu->mBuf);                               \
    cmLListDelFrm(_sduQ,&_sdu->lstEnt);                \
-   RLC_FREE_WC(_cb,_sdu, sizeof(RlcSdu));               \
+   RLC_FREE(_cb,_sdu, sizeof(RlcSdu));               \
 }
 
 #define RLC_FREE(_cb,_buf, _size)                          \
       _buf = NULLP;                                       \
 }
 
-#define RLC_FREE_BUF(_buf)           \
-{                                   \
-      SPutMsg(_buf);                \
-      _buf = NULLP;                 \
-}
-
 #else
 
 #define RLC_FREE_SHRABL_BUF(_region, _pool,_buf, _size)    \
    }                                                      \
 }
 
-#define RLC_FREE_BUF(_buf)           \
-{                                   \
-   if (_buf != NULLP)               \
-   {                                \
-      SPutMsg(_buf);                \
-   }                                \
-      _buf = NULLP;                 \
-}
 #endif
 
-
-
-
-#define RLC_FREE_WC(_cb,_buf, _size)                       \
-{                                                         \
-      (Void) SPutSBuf(_cb->init.region, _cb->init.pool,   \
-            (Data *) _buf, (Size) _size);                 \
-      _buf = NULLP; /*assigning NULLP after free*/ \
-}
-
 /* kw002.201 Freeing from region of pst */
 #define RLC_PST_FREE(_region, _pool, _buf, _size)          \
 {                                                         \
 }
 #endif
 
-#define RLC_FREE_BUF_WC(_buf)    SPutMsg((_buf));
-
 #define RLC_MEM_CPY(_dst, _src, _size)  memcpy(_dst, _src, _size); 
 
 #define RLC_MEM_ZERO(_buf, _size) memset((_buf), 0, _size);
 #define RLC_TRANS_ID_LST_BKT_SIZE    10 
 #define RLC_MAX_RB                   32
 
+/* RLC Mode defines */
+#define RLC_MODE_TM 1
+#define RLC_MODE_UM 2
+#define RLC_MODE_AM 3
+
 /* Direction defines */
 #define RLC_DIR_UL        1     /*!< Unlink direction */
 #define RLC_DIR_DL        2     /*!< Downlink direction */
 #define RLC_TMR_LEN                     10
 #define RLC_MAX_UM_TMR                  1
 #define RLC_MAX_AM_TMR                  3
-#define RLC_EVT_UMUL_REORD_TMR          1
-#define RLC_EVT_AMUL_REORD_TMR          2
-#define RLC_EVT_AMUL_STA_PROH_TMR       3
-#define RLC_EVT_AMDL_POLL_RETX_TMR      4
-#define RLC_EVT_WAIT_BNDCFM             5
+
+/* Timer events */
+#define EVENT_RLC_UMUL_REASSEMBLE_TMR     1
+#define EVENT_RLC_AMUL_REORD_TMR          2
+#define EVENT_RLC_AMUL_STA_PROH_TMR       3
+#define EVENT_RLC_AMDL_POLL_RETX_TMR      4
+#define EVENT_RLC_WAIT_BNDCFM             5
 /* kw005.201 added support for L2 Measurement */
 #ifdef LTE_L2_MEAS
-#define RLC_EVT_L2_TMR                  6
+#define EVENT_RLC_L2_TMR                  6
 #endif /* LTE_L2_MEAS */
 
 /*******************************************************************************
 #define RLC_UMUL     rbCb->m.umUl 
 
 /* Sequence Number length defines */
-#define RLC_UM_CFG_5BIT_SN_LEN      1 /**< UM 5-bit Sequence number length 
+#define RLC_UM_CFG_6BIT_SN_LEN      1 /**< UM 6-bit Sequence number length 
                                           in bytes*/   
-#define RLC_UM_CFG_10BIT_SN_LEN     2 /**< UM 10-bit Sequence number length 
+#define RLC_UM_CFG_12BIT_SN_LEN     2 /**< UM 12-bit Sequence number length 
                                           in bytes*/
 /* 5GNR */
 /* Sequence Number length defines */
 /*******************************************************************************
  *                              AMM Defines 
  ******************************************************************************/ 
-#define AMDL                           rbCb->m.amDl 
-#define AMUL                           rbCb->m.amUl
+#define RLC_AMDL                           rbCb->m.amDl 
+#define RLC_AMUL                           rbCb->m.amUl
 
 /* PDU Types */
 #define RLC_DATA_PDU  1
 #define RLC_SN_POS_12BIT                0x0F
 #define RLC_SN_POS_18BIT                0x03
 #define RLC_AM_GET_WIN_SZ(_snLen)       ((RLC_AM_CFG_12BIT_SN_LEN == (_snLen)) ? (2048) : (131072)) /* 5GNR */
-#define RLC_RCV_BUF_BIN_SIZE 512   /* Could be increased to avoid the search time.
-                                      with the memory trade-off */
-#define RLC_TX_BUF_BIN_SIZE 512   /* Could be increased to avoid the search time.
-                                      with the memory trade-off */
+#define RLC_RCV_BUF_BIN_SIZE 512   /* receive buffer size */
+#define RLC_TX_BUF_BIN_SIZE 512   /* receive buffer size */
 
 #define RLC_SDU_LST                     1
 #define RLC_SEG_LST                     2
       nod = NULLP;                             \
 }                                                          
 
-                                                           
 #define RLC_LLIST_FIRST_RETX(lstCp, nod)        \
 {                                              \
    CmLList *tmpNode;                           \
    cmLListInsCrnt(&lstCp, nodeToIns);          \
 }
 
-#define RLC_LLIST_DEL_RECBUF(_recBuf)                       \
+#define RLC_LLIST_DEL_RECBUF(_recBuf)                      \
 {                                                          \
-   RlcSeg  *_seg = NULLP;                                   \
-   RLC_LLIST_FIRST_SEG(_recBuf->segLst, _seg);              \
+   RlcSeg  *_seg = NULLP;                                  \
+   RLC_LLIST_FIRST_SEG(_recBuf->segLst, _seg);             \
    while (_seg)                                            \
    {                                                       \
       cmLListDelFrm(&_recBuf->segLst, &_seg->lstEnt);      \
-      RLC_FREE(_seg, sizeof(RlcSeg));                        \
-      RLC_LLIST_NEXT_SEG(_recBuf->segLst, _seg);            \
+      RLC_FREE(_seg, sizeof(RlcSeg));                      \
+      RLC_LLIST_NEXT_SEG(_recBuf->segLst, _seg);           \
    }                                                       \
 }
 
+#define RLC_UMM_LLIST_FIRST_SEG(lstCp, nod)         \
+{                                              \
+   CmLList *tmpNode;                           \
+   if((tmpNode=cmLListFirst(&lstCp)))            \
+      nod = (RlcUmSeg *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+} /*!< um mode first segment of linked list*/
+
+#define RLC_UMM_LLIST_NEXT_SEG(lstCp, nod)          \
+{                                              \
+   CmLList *tmpNode;                           \
+   (lstCp).crnt = &((nod)->lstEnt);            \
+   if((tmpNode = cmLListNext(&lstCp)))           \
+      nod = (RlcUmSeg *)tmpNode->node;            \
+   else                                        \
+      nod = NULLP;                             \
+}/*!< next segment in um mode linked list*/
+
 #define MODAMT(x, y, z,_snModMask)   \
 {                         \
    y = (x - z) & _snModMask;   \
 #endif
 
 #define RLC_AM_IS_POLL_BIT_SET(_amDl) \
-  (AMDL.pollSn == ((AMDL.txNext - 1) & AMDL.snModMask))
+  (RLC_AMDL.pollSn == ((RLC_AMDL.txNext - 1) & RLC_AMDL.snModMask))
 
 #define RLC_FILL_CNTRL_INFO(cntrlInfo, _val, _len, _idx, _eb)\
 {                                                           \
 /* Update poll bit in the buffer */
 #define RLC_UPD_POLL_BIT(_gCb, _retx, _poll)                \
 {                                                          \
-   U8 fHdr;                                                \
+   uint8_t fHdr;                                                \
                                                            \
    if (_poll != _retx->amHdr.p)                            \
    {                                                       \
@@ -980,7 +977,7 @@ do                                                          \
 #define RLC_PRNT_MEMINFO(_cb)                                  \
 do                                                            \
 {                                                             \
-   U32  _memInfo;                                             \
+   uint32_t  _memInfo;                                             \
    if(_cb->init.dbgMask & (RLC_DBGMASK_MEM_INFO))              \
    {                                                          \
      RLC_PRNT_HLINE(_cb,("\nMemory Information:\n"));          \