JIRA ID:[ODUHIGH-296]-Dl Data Changes from DUAPP to RLC
[o-du/l2.git] / src / cm / du_app_rlc_inf.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 /* Defines APIs exchanged between du_app and cl module of RLC */
20 #ifndef __RLC_INF_H__
21 #define __RLC_INF_H__
22
23 /* Events */
24 #define EVENT_RLC_UE_CREATE_REQ  210
25 #define EVENT_RLC_UE_CREATE_RSP 211    /*!< Config Confirm */
26 #define EVENT_UL_RRC_MSG_TRANS_TO_DU  212
27 #define EVENT_DL_RRC_MSG_TRANS_TO_RLC 213
28 #define EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU 214
29 #define EVENT_RLC_UE_RECONFIG_REQ  215
30 #define EVENT_RLC_UE_RECONFIG_RSP  216
31 #define EVENT_DL_RRC_MSG_RSP_TO_DU 217
32 #define EVENT_DL_USER_DATA_TRANS_TO_RLC 218
33 #define EVENT_UL_USER_DATA_TRANS_TO_DU 219
34
35
36 #define RB_ID_SRB 0
37 #define RB_ID_DRB 1
38
39 #define RB_TYPE_SRB 0        /* Signalling Radio Bearer */
40 #define RB_TYPE_DRB 1        /* Data Radio Bearer */
41
42 /* RLC Direction Config */
43 #define RLC_CFG_DIR_UL        1     /*!< Uplink direction */
44 #define RLC_CFG_DIR_DL        2     /*!< Downlink direction */
45 #define RLC_CFG_DIR_BOTH      3     /*!< Both Downlink and Uplink Direction*/
46
47
48 /* Logical Channel Type */
49 #define LCH_BCCH      1      /*!< BCCH Logical Channel */
50 #define LCH_PCCH      2      /*!< PCCH Logical Channel */
51 #define LCH_CCCH      3      /*!< CCCH Logical Channel */
52 #define LCH_DTCH      4      /*!< DTCH Logical Channel */
53 #define LCH_DCCH      5      /*!< DCCH Logical Channel */
54
55 typedef enum
56 {
57    TRANSMISSION_IN_PROGRESS,
58    TRANSMISSION_COMPLETE,
59    TRANSMISSION_FAILED
60 }DlMsgState;
61
62 typedef enum
63 {
64    RLC_CFG_REAS_NONE            ,  /*!< No Failure */
65    RLC_CFG_REAS_RB_CREAT_FAIL   ,  /*!< RB CB creation Failure */
66    RLC_CFG_REAS_UE_CREAT_FAIL   ,  /*!< UE CB creation Failure */
67    RLC_CFG_REAS_CELL_CREAT_FAIL ,  /*!< CELL CB creation Failure */
68    RLC_CFG_REAS_RB_PRSNT        ,  /*!< RB CB already present */
69    RLC_CFG_REAS_LCHTYPE_MIS     ,  /*!< Logical channel type mismatch */
70    RLC_CFG_REAS_RB_UNKWN        ,  /*!< RB Cb unknown */
71    RLC_CFG_REAS_UE_UNKWN        ,  /*!< UE Cb unknown */
72    RLC_CFG_REAS_CELL_UNKWN      ,  /*!< Cell Cb unknown */
73    RLC_CFG_REAS_RB_DEL_FAIL     ,  /*!< RB Cb Deletion Failure */
74    RLC_CFG_REAS_UE_DEL_FAIL     ,  /*!< UE Cb Deletion Failure */
75    RLC_CFG_REAS_RB_REEST_FAIL   ,  /*!< RB Cb Re establish Failure */
76    RLC_CFG_REAS_RB_MODE_MIS     ,  /*!< RB Cb Mode mismatch */
77    RLC_CFG_REAS_REEST_FAIL      ,  /*!< RB Cb Re-establishment Failed */
78    RLC_CFG_REAS_RECFG_FAIL      ,  /*!< RB Cb Re-configuration Failed */
79    RLC_CFG_REAS_INVALID_CFG     ,  /*!< Invalid Configuration Type */
80    RLC_CFG_REAS_SAME_UEID       ,  /*!< UE Ids match in ChngUeId Request */
81    RLC_CFG_REAS_CELL_DEL_FAIL   ,  /*!< Cell Cb Deletion Failure */
82    RLC_CFG_REAS_INVALID_LCHID   ,  /*!< Invalid LChId */
83    RLC_CFG_REAS_INVALID_DIR     ,  /*!< Invalid Direction */
84    RLC_CFG_REAS_UE_EXISTS       ,  /*!< UE ID already exists */
85    RLC_CFG_REAS_INVALID_SNLEN   ,  /*!< Invalid SN Length */
86    RLC_CFG_REAS_SNLEN_MIS       ,  /*!< SN Length mismatch */
87    RLC_CFG_REAS_INVALID_RGUSAP     /*!< Invalid RGU SAP ID */
88 }FailureReason;
89
90 typedef enum
91 {
92    RLC_AM,                    //Acknowledged Mode
93    RLC_UM_BI_DIRECTIONAL,     //UnAcknowledged Mode
94    RLC_UM_UNI_DIRECTIONAL_UL,
95    RLC_UM_UNI_DIRECTIONAL_DL
96 }RlcMode;
97
98 typedef enum
99 {
100    AM_SIZE_12 = 1,
101    AM_SIZE_18
102 }SnLenAm;
103
104 typedef enum
105 {
106    UM_SIZE_6 = 1,
107    UM_SIZE_12
108 }SnLenUm;
109
110 typedef enum
111 {
112    RLC_DU_APP_RSP_NOK,
113    RLC_DU_APP_RSP_OK
114 }RlcRsp;
115
116 typedef struct ulAmCfg
117 {
118    SnLenAm        snLenUl;              /* Sequence Number length in bits. Allowed values are 12 and 18 */
119    int8_t         reAssemTmr;           /* T_reassembling Timer in msec*/
120    int16_t        statProhTmr;          /* T_status_prohibit Timer in msec*/
121
122 }UlAmCfg;
123
124 typedef struct dlAmCfg
125 {
126    SnLenAm      snLenDl;             /* Sequence Number length in bits. Allowed values are 12 and 18 */
127    uint16_t     pollRetxTmr;         /* T_poll_retransmit Timer in msec */
128    int16_t      pollPdu;             /* Used to trigger a poll for every pollPdu.*/
129    int32_t      pollByte;            /* Poll_Byte in bytes. */
130    uint8_t      maxRetxTh;           /* Max_Retx_Threshold */
131  
132 }DlAmCfg;
133
134 typedef struct dlUmCfg
135 {
136    SnLenUm        snLenDlUm;             /* Sequence Number length in bits. Allowed values are 6 and 12 */
137
138 }DlUmCfg;
139
140 typedef struct ulUmCfg
141 {
142    SnLenUm        snLenUlUm;             /* Sequence Number length in bits. Allowed values are 6 and 12 */
143    int8_t         reAssemTmr;            /* T_reassembling Timer in msec*/
144
145 }UlUmCfg;
146
147 typedef struct amBearerCfg
148 {
149    UlAmCfg  ulAmCfg;
150    DlAmCfg  dlAmCfg;
151 }AmBearerCfg;
152
153 typedef struct umBiDirBearerCfg
154 {
155    UlUmCfg  ulUmCfg;
156    DlUmCfg  dlUmCfg;
157 }UmBiDirBearerCfg;
158
159 typedef struct umUniDirUlBearerCfg
160 {
161    UlUmCfg  ulUmCfg;
162 }UmUniDirUlBearerCfg;
163
164 typedef struct umUniDirDlBearerCfg
165 {
166    DlUmCfg  dlUmCfg;
167 }UmUniDirDlBearerCfg;
168
169 /* Spec Ref: 38.331, 6.3.2 RLC-BearerConfig */
170 typedef struct rlcBearerCfg
171 {
172    ConfigType   configType;
173    uint8_t      rbId;
174    uint8_t      rbType;
175    uint8_t      lcId;
176    uint8_t      lcType;
177    RlcMode      rlcMode;
178    union
179    {
180       AmBearerCfg         *amCfg;
181       UmBiDirBearerCfg    *umBiDirCfg;
182       UmUniDirUlBearerCfg *umUniDirUlCfg;
183       UmUniDirDlBearerCfg *umUniDirDlCfg;
184    }u;
185 }RlcBearerCfg;
186
187 typedef struct rlcUeCfg
188 {
189    uint16_t     cellId;
190    uint8_t      ueIdx;
191    uint8_t      numLcs;
192    RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
193    UeCfgState rlcUeCfgState; /* InActive / Completed */
194 }RlcUeCfg;
195
196 typedef struct rlcUeCfgRsp
197 {
198    uint16_t       cellId;
199    uint16_t       ueIdx;
200    RlcRsp         result;
201    FailureReason  reason;
202 }RlcUeCfgRsp;
203
204 /* UL RRC Message from RLC to DU APP */
205 typedef struct ulRrcMsgInfo
206 {
207    uint16_t   cellId;       /* Cell Id */
208    uint16_t   ueIdx;        /* UE Index */
209    uint8_t    lcId;         /* Logical channel Id */
210    uint16_t   msgLen;       /* RRC message length (in bytes) */
211    uint8_t    *rrcMsg;      /* RRC Message (UL-DCCH Message) */
212 }RlcUlRrcMsgInfo;
213
214 /* UL User Data from RLC to DU APP */
215 typedef struct ulUserDatInfo
216 {
217    uint16_t   cellId;       /* Cell Id */
218    uint16_t   ueIdx;        /* UE Index */
219    uint8_t    rbId;
220    uint16_t   msgLen;       /* User data length (in bytes) */
221    uint8_t    *userData;    /* User data (UL-DTCH Message) */
222 }RlcUlUserDatInfo;
223
224 /* DL RRC Message from DU APP to RLC */
225 typedef struct dlRrcMsgInfo
226 {
227    uint16_t   cellId;         /* Cell Id */
228    uint16_t   ueIdx;          /* UE index */
229    uint8_t    rbType;         /* Radio Bearer Type */
230    uint8_t    rbId;           /* Radio Bearer Id */
231    uint8_t    lcType;         /* Logical channel type */
232    uint8_t    lcId;           /* Logical channel Id */
233    bool       execDup;        /* Execution duplication enabled */
234    bool       deliveryStaRpt;  /* Reporting of delivery status by RLC to DU-APP enabled */
235    uint16_t   msgLen;         /* RRC Message length */
236    uint8_t    *rrcMsg;        /* RRC Message (DL-DCCH Message) */
237 }RlcDlRrcMsgInfo;
238
239 /* DL RRC Message Rsp From RLC to DU APP */
240 typedef struct dlRrcMsgRsp
241 {
242    uint16_t   cellId;         /* Cell Id */
243    uint16_t   crnti;          /* UE index */
244    DlMsgState state;         /* Dl RRC Msg State */
245 }RlcDlRrcMsgRsp;
246
247 /* RRC delivery message from RLC to DU APP */
248 typedef struct rrcDeliveryStatus
249 {
250    uint16_t  deliveryStatus;
251    uint16_t  triggeringMessage;
252 }RrcDeliveryStatus;
253
254 typedef struct rrcDeliveryReportInfo
255 {
256    uint16_t  cellId;
257    uint16_t  ueIdx;
258    uint8_t   srbId;
259    RrcDeliveryStatus  rrcDeliveryStatus;
260 }RrcDeliveryReport;
261
262 /* DL Data Message from DU APP to RLC */
263 typedef struct dlDataMsgInfo
264 {
265    uint16_t   cellId;         /* Cell Id */
266    uint16_t   ueIdx;          /* UE index */
267    uint8_t    rbId;           /* Radio Bearer Id */
268    uint16_t   msgLen;         /* Message length */
269    Buffer     *dlMsg;         /* DL Data */
270 }RlcDlUserDataInfo;
271
272 /* Function Pointers */
273 /* UE create Request from DU APP to RLC*/
274 typedef uint8_t (*DuRlcUeCreateReq) ARGS((
275    Pst           *pst,
276    RlcUeCfg      *ueCfg ));
277
278 /* UE Cfg Response from RLC to DU APP*/
279 typedef uint8_t (*RlcDuUeCfgRsp) ARGS((
280    Pst          *pst,
281    RlcUeCfgRsp  *ueCfgRsp));
282
283 /* UL RRC Message from RLC to DU APP */
284 typedef uint8_t (*RlcUlRrcMsgToDuFunc) ARGS((
285    Pst           *pst,
286    RlcUlRrcMsgInfo *ulRrcMsgInfo));
287
288 /* DL RRC Message from DU APP to RLC */
289 typedef uint8_t (*DuDlRrcMsgToRlcFunc) ARGS((
290    Pst           *pst,
291    RlcDlRrcMsgInfo *dlRrcMsgInfo));
292
293 /* RRC delivery message from RLC to DU APP */
294 typedef uint8_t (*RlcRrcDeliveryReportToDuFunc) ARGS((
295    Pst           *pst,
296    RrcDeliveryReport *rrcDeliveryReport));
297
298 typedef uint8_t (*DuRlcUeReconfigReq) ARGS((
299    Pst           *pst,
300    RlcUeCfg      *ueCfg ));
301
302 /* DL RRC Message from RLC to DU APP */
303 typedef uint8_t (*RlcDlRrcMsgRspToDuFunc) ARGS((
304    Pst           *pst,
305    RlcDlRrcMsgRsp *dlRrcMsgRsp));
306
307 /* UL User data from RLC to DU APP */
308 typedef uint8_t (*RlcUlUserDataToDuFunc) ARGS((
309    Pst           *pst,
310    RlcUlUserDatInfo *ulUserData));
311
312 /* DL User Data from DU APP to RLC */
313 typedef uint8_t (*DuRlcDlUserDataToRlcFunc) ARGS((
314    Pst           *pst,
315    RlcDlUserDataInfo *dlDataMsg));
316
317 /* Pack/Unpack function declarations */
318 uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
319 uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf);
320 uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp);
321 uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf);
322 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
323 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf);
324 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
325 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf);
326 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
327 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func,Pst *pst, Buffer *mBuf);
328 uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
329 uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf);
330 uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp);
331 uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf);
332 uint8_t packRlcUlUserDataToDu(Pst *pst, RlcUlUserDatInfo *ulUserData);
333 uint8_t unpackRlcUlUserDataToDu(RlcUlUserDataToDuFunc func, Pst *pst, Buffer *mBuf);
334 uint8_t packRlcDlUserDataToRlc(Pst *pst, RlcDlUserDataInfo *dlDataMsg);
335 uint8_t unpackRlcDlUserDataToRlc(DuRlcDlUserDataToRlcFunc func, Pst *pst, Buffer *mBuf);
336
337 /* Event Handler function declarations */
338 uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
339 uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
340 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
341 uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
342 uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
343 uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
344 uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg);
345 uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData);
346 uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo);
347
348 #endif /* RLC_INF_H */
349
350 /**********************************************************************
351          End of file
352 **********************************************************************/