cu link failure fix
[o-du/l2.git] / src / 5gnrrlc / kw_dl.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 for downlink and non real time tasks 
22     
23         Type:     C include file
24   
25         Desc:     This file contains helper macros for RLC downlink
26                   and non real time task
27  
28         File:     kw_dl.h
29   
30 *********************************************************************21*/
31 /** @file kw_dl.h
32 @brief RLC Downlink helper macros 
33 */
34
35 #ifndef __KW_DLH__
36 #define __KW_DLH__
37 #define KW_DL_INST 1
38 #define KW_MAX_RNG_DEQ_INDX 8
39
40 /* Below are the status used within RLC */
41 #define KW_SDU_OPAT_NOUPDATE 0
42 #define KW_SDU_OPAT_UPD_TX 1
43 #define KW_SDU_OPAT_UPD_RETX   2
44
45 /* Below are the status which needs to be updated to MAC */
46 #define KW_RGU_SDU_OPAT_NOUPDATE 0
47 #define KW_RGU_SDU_OPAT_UPDATE   1
48 #define KW_RGU_SDU_OPAT_BREACH   2
49
50 /* PDB Values for various QCI bearers : This value is considered 
51    after taking into account a 20ms delay at the network */
52 #define KW_PDB_VALUE_FOR_QCI1    80
53 #define KW_PDB_VALUE_FOR_QCI2    130
54 #define KW_PDB_VALUE_FOR_QCI3    30
55 #define KW_PDB_VALUE_FOR_QCI4    280
56 #define KW_PDB_VALUE_FOR_QCI5    80
57 #define KW_PDB_VALUE_FOR_QCI6    280
58 #define KW_PDB_VALUE_FOR_QCI7    80
59 #define KW_PDB_VALUE_FOR_QCI8    280
60 #define KW_PDB_VALUE_FOR_QCI9    280
61
62 #define KW_DATA_BITMASK          0x80 /* Data bitmask is used to fill D/C bit for data*/
63 /**
64  * @def KW_MEAS_IS_DL_IP_MEAS_ON_FOR_RB
65  *
66  *    This macro is used to check if DL IP throughput measurement is ON
67  *    or off for the passed rb
68  *
69  *    Returns TRUE (non-zero) if measurement is ON else FALSE (zero)
70  *
71  * @param[in] _gCb     RLC DL Cb
72  * @param[in] _rbCb    RLC downlink control block
73  *
74 */ 
75 #ifdef LTE_L2_MEAS
76 #define KW_MEAS_IS_DL_ANY_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
77      ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
78             (_gCb->u.dlCb->kwL2Cb.measOn[_rbCb->qci]))
79
80 #define KW_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
81      ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
82       (_gCb->u.dlCb->kwL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_DL_IP) && \
83       (_rbCb->rbL2Cb.measOn & LKW_L2MEAS_DL_IP))
84
85 #define KW_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
86      ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
87             (_gCb->u.dlCb->kwL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_DL_DELAY))
88
89 #define KW_MEAS_IS_DL_UU_LOSS_MEAS_ON_FOR_RB(_gCb, _rbCb)  \
90      ((_rbCb->rlcId.rbType == CM_LTE_DRB) && \
91             (_gCb->u.dlCb->kwL2Cb.measOn[_rbCb->qci] & LKW_L2MEAS_UU_LOSS))
92 #define KW_UPD_PDCP_L2_DLDELAY_STS(_kwCb, _kwRbCb, _delay)                     \
93 {                                                                              \
94    if(((_kwRbCb)->rlcId.rbType == CM_LTE_DRB) &&                               \
95       ((_kwCb)->u.dlCb->kwL2Cb.measOn[_kwRbCb->qci] & LKW_L2MEAS_DL_DELAY))    \
96    {                                                                           \
97       (_kwRbCb)->rbL2Cb.l2Sts[KW_L2MEAS_DL_DELAY]->dlPjSduDelay.sduDelay += _delay; \
98       (_kwRbCb)->rbL2Cb.l2Sts[KW_L2MEAS_DL_DELAY]->dlPjSduDelay.numSdus++; \
99    }                                                                    \
100 }
101
102 #define KW_UPD_L2_UU_LOSS_PKTS(_kwCb, _kwRbCb, _val)                         \
103 {                                                                 \
104    if(((_kwRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
105       ((_kwCb)->u.dlCb->kwL2Cb.measOn[_kwRbCb->qci] & LKW_L2MEAS_UU_LOSS))              \
106    {                                                              \
107       (_kwRbCb)->rbL2Cb.l2Sts[KW_L2MEAS_UU_LOSS]->uuLoss.dLoss += _val;     \
108    }                                                              \
109 }
110 #define KW_UPD_L2_UU_LOSS_POS_PKTS(_kwCb,_kwRbCb,_val)                         \
111 {                                                                 \
112    if(((_kwRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
113       ((_kwCb)->u.dlCb->kwL2Cb.measOn[_kwRbCb->qci] & LKW_L2MEAS_UU_LOSS))              \
114    {                                                              \
115       (_kwRbCb)->rbL2Cb.l2Sts[KW_L2MEAS_UU_LOSS]->uuLoss.posPkts += _val;     \
116    }                                                              \
117 }
118 /* Discard new changes starts */
119 #define KW_UPD_L2_DL_DISC_SDU_STS(_kwCb,_kwRbCb)                         \
120 {                                                                 \
121    if(((_kwRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
122       ((_kwCb)->u.dlCb->kwL2Cb.measOn[_kwRbCb->qci] & LKW_L2MEAS_DL_DISC))              \
123    {                                                              \
124       (_kwRbCb)->rbL2Cb.l2Sts[KW_L2MEAS_DL_DISC]->dlDisc.discSdus++;     \
125    }                                                              \
126 }                                              
127
128 #define KW_UPD_L2_DL_TOT_SDU_STS(_kwCb,_kwRbCb)                             \
129 {                                                                 \
130    if(((_kwRbCb)->rlcId.rbType == CM_LTE_DRB) &&                              \
131       ((_kwCb)->u.dlCb->kwL2Cb.measOn[_kwRbCb->qci] & LKW_L2MEAS_DL_DISC))   \
132    {                                                              \
133       (_kwRbCb)->rbL2Cb.l2Sts[KW_L2MEAS_DL_DISC]->dlDisc.totSdus++;      \
134    }                                                              \
135 }
136
137 #define KW_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(_kwCb, _kwRbCb)                 \
138 {                                                                 \
139    if(((_kwRbCb)->rlcId.rbType == CM_LTE_DRB) &&                    \
140       ((_kwCb)->u.dlCb->kwL2Cb.measOn[_kwRbCb->qci] & LKW_L2MEAS_DL_DISC))   \
141    {                                                              \
142       U32 idx1;                                                    \
143       for (idx1 = 0; idx1 < LKW_MAX_L2MEAS; idx1++)                  \
144       {                                                           \
145          if(_kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.measType & LKW_L2MEAS_DL_DISC)                 \
146          {                                                        \
147             if(_kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_kwRbCb)->qci].totDrbsPerQci > 0) \
148             {                                                                                               \
149                _kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_kwRbCb)->qci].totDrbsPerQci--;   \
150                if (_kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_kwRbCb)->qci].totDrbsPerQci == 0) \
151                {                                                                                                 \
152                   _kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.val.nonIpThMeas.qci[(_kwRbCb)->qci] = 0;                      \
153                   cmMemset((U8 *)&_kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_kwRbCb)->qci], 0,  \
154                      sizeof(_kwCb->u.dlCb->kwL2Cb.kwL2EvtCb[idx1].measCb.val.nonIpThMeas.measData[(_kwRbCb)->qci]));            \
155                }                                                                                                 \
156             }                                                                                                    \
157          }                                                                                                       \
158       }                                                                                                          \
159    }                                                                                                             \
160 }
161 #else
162 #define KW_UPD_PDCP_L2_DLDELAY_STS(_kwCb, _kwRbCb, _delay)
163 #define KW_MEAS_IS_DL_IP_MEAS_ON_FOR_RB(_gCb, _rbCb)
164 #define KW_MEAS_IS_DL_DELAY_MEAS_ON_FOR_RB(_gCb, _rbCb)
165 #define KW_UPD_L2_DL_DISC_SDU_STS(_kwCb,_kwRbCb)
166 #define KW_UPD_L2_DL_TOT_SDU_STS(_kwCb, _kwRbCb)
167 #define KW_UPD_L2_DECR_NONIP_PER_QCI_RB_COUNT(_kwCb, _kwRbCb)
168 #endif
169
170
171 #endif /* __KW_DLH__ */
172 \f  
173 /********************************************************************30**
174   
175          End of file
176 **********************************************************************/