RLC DL AMD PDU changes [Issue-ID: ODUHIGH-290]
[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_DU 218
33 #define EVENT_UL_USER_DATA_TRANS_TO_DU 219
34
35 #define RB_ID_SRB 0
36 #define RB_ID_DRB 1
37
38 #define RB_TYPE_SRB 0        /* Signalling Radio Bearer */
39 #define RB_TYPE_DRB 1        /* Data Radio Bearer */
40
41 /* RLC Direction Config */
42 #define RLC_CFG_DIR_UL        1     /*!< Uplink direction */
43 #define RLC_CFG_DIR_DL        2     /*!< Downlink direction */
44 #define RLC_CFG_DIR_BOTH      3     /*!< Both Downlink and Uplink Direction*/
45
46
47 /* Logical Channel Type */
48 #define LCH_BCCH      1      /*!< BCCH Logical Channel */
49 #define LCH_PCCH      2      /*!< PCCH Logical Channel */
50 #define LCH_CCCH      3      /*!< CCCH Logical Channel */
51 #define LCH_DTCH      4      /*!< DTCH Logical Channel */
52 #define LCH_DCCH      5      /*!< DCCH Logical Channel */
53
54 typedef enum
55 {
56    TRANSMISSION_IN_PROGRESS,
57    TRANSMISSION_COMPLETE,
58    TRANSMISSION_FAILED
59 }DlMsgState;
60
61 typedef enum
62 {
63    RLC_CFG_REAS_NONE            ,  /*!< No Failure */
64    RLC_CFG_REAS_RB_CREAT_FAIL   ,  /*!< RB CB creation Failure */
65    RLC_CFG_REAS_UE_CREAT_FAIL   ,  /*!< UE CB creation Failure */
66    RLC_CFG_REAS_CELL_CREAT_FAIL ,  /*!< CELL CB creation Failure */
67    RLC_CFG_REAS_RB_PRSNT        ,  /*!< RB CB already present */
68    RLC_CFG_REAS_LCHTYPE_MIS     ,  /*!< Logical channel type mismatch */
69    RLC_CFG_REAS_RB_UNKWN        ,  /*!< RB Cb unknown */
70    RLC_CFG_REAS_UE_UNKWN        ,  /*!< UE Cb unknown */
71    RLC_CFG_REAS_CELL_UNKWN      ,  /*!< Cell Cb unknown */
72    RLC_CFG_REAS_RB_DEL_FAIL     ,  /*!< RB Cb Deletion Failure */
73    RLC_CFG_REAS_UE_DEL_FAIL     ,  /*!< UE Cb Deletion Failure */
74    RLC_CFG_REAS_RB_REEST_FAIL   ,  /*!< RB Cb Re establish Failure */
75    RLC_CFG_REAS_RB_MODE_MIS     ,  /*!< RB Cb Mode mismatch */
76    RLC_CFG_REAS_REEST_FAIL      ,  /*!< RB Cb Re-establishment Failed */
77    RLC_CFG_REAS_RECFG_FAIL      ,  /*!< RB Cb Re-configuration Failed */
78    RLC_CFG_REAS_INVALID_CFG     ,  /*!< Invalid Configuration Type */
79    RLC_CFG_REAS_SAME_UEID       ,  /*!< UE Ids match in ChngUeId Request */
80    RLC_CFG_REAS_CELL_DEL_FAIL   ,  /*!< Cell Cb Deletion Failure */
81    RLC_CFG_REAS_INVALID_LCHID   ,  /*!< Invalid LChId */
82    RLC_CFG_REAS_INVALID_DIR     ,  /*!< Invalid Direction */
83    RLC_CFG_REAS_UE_EXISTS       ,  /*!< UE ID already exists */
84    RLC_CFG_REAS_INVALID_SNLEN   ,  /*!< Invalid SN Length */
85    RLC_CFG_REAS_SNLEN_MIS       ,  /*!< SN Length mismatch */
86    RLC_CFG_REAS_INVALID_RGUSAP     /*!< Invalid RGU SAP ID */
87 }FailureReason;
88
89 typedef enum
90 {
91    RLC_AM,                    //Acknowledged Mode
92    RLC_UM_BI_DIRECTIONAL,     //UnAcknowledged Mode
93    RLC_UM_UNI_DIRECTIONAL_UL,
94    RLC_UM_UNI_DIRECTIONAL_DL
95 }RlcMode;
96
97 typedef enum
98 {
99    AM_SIZE_12 = 1,
100    AM_SIZE_18
101 }SnLenAm;
102
103 typedef enum
104 {
105    UM_SIZE_6 = 1,
106    UM_SIZE_12
107 }SnLenUm;
108
109 typedef enum
110 {
111    RE_ASM_0MS,
112    RE_ASM_5MS,
113    RE_ASM_10MS,
114    RE_ASM_15MS,
115    RE_ASM_20MS,
116    RE_ASM_25MS,
117    RE_ASM_30MS,
118    RE_ASM_35MS,
119    RE_ASM_40MS,
120    RE_ASM_45MS,
121    RE_ASM_50MS,
122    RE_ASM_55MS,
123    RE_ASM_60MS,
124    RE_ASM_65MS,
125    RE_ASM_70MS,
126    RE_ASM_75MS,
127    RE_ASM_80MS,
128    RE_ASM_85MS,
129    RE_ASM_90MS,
130    RE_ASM_95MS,
131    RE_ASM_100MS,
132    RE_ASM_105MS,
133    RE_ASM_110MS,
134    RE_ASM_115MS,
135    RE_ASM_120MS,
136    RE_ASM_125MS,
137    RE_ASM_130MS,
138    RE_ASM_135MS,
139    RE_ASM_140MS,
140    RE_ASM_145MS,
141    RE_ASM_150MS,
142    RE_ASM_155MS,
143    RE_ASM_160MS,
144    RE_ASM_165MS,
145    RE_ASM_170MS,
146    RE_ASM_175MS,
147    RE_ASM_180MS,
148    RE_ASM_185MS,
149    RE_ASM_190MS,
150    RE_ASM_195MS,
151    RE_ASM_200MS,
152    RE_ASM_SPARE1
153
154 }TReAssembleTmr;
155
156 typedef enum
157 {
158    PROH_0MS,
159    PROH_5MS,
160    PROH_10MS,
161    PROH_15MS,
162    PROH_20MS,
163    PROH_25MS,
164    PROH_30MS,
165    PROH_35MS,
166    PROH_40MS,
167    PROH_45MS,
168    PROH_50MS,
169    PROH_55MS,
170    PROH_60MS,
171    PROH_65MS,
172    PROH_70MS,
173    PROH_75MS,
174    PROH_80MS,
175    PROH_85MS,
176    PROH_90MS,
177    PROH_95MS,
178    PROH_100MS,
179    PROH_105MS,
180    PROH_110MS,
181    PROH_115MS,
182    PROH_120MS,
183    PROH_125MS,
184    PROH_130MS,
185    PROH_135MS,
186    PROH_140MS,
187    PROH_145MS,
188    PROH_150MS,
189    PROH_155MS,
190    PROH_160MS,
191    PROH_165MS,
192    PROH_170MS,
193    PROH_175MS,
194    PROH_180MS,
195    PROH_185MS,
196    PROH_190MS,
197    PROH_195MS,
198    PROH_200MS,
199    PROH_205MS,
200    PROH_210MS,
201    PROH_215MS,
202    PROH_220MS,
203    PROH_225MS,
204    PROH_230MS,
205    PROH_235MS,
206    PROH_240MS,
207    PROH_245MS,
208    PROH_250MS,
209    PROH_300MS,
210    PROH_350MS,
211    PROH_400MS,
212    PROH_450MS,
213    PROH_500MS,
214    PROH_800MS,
215    PROH_1000MS,
216    PROH_1200MS,
217    PROH_1600MS,
218    PROH_2000MS,
219    PROH_2400MS,
220    PROH_SPARE2,
221    PROH_SPARE1
222
223 }TStatProhTmr;
224
225 typedef enum
226 {
227    RLC_DU_APP_RSP_NOK,
228    RLC_DU_APP_RSP_OK
229 }RlcRsp;
230
231 typedef struct ulAmCfg
232 {
233    SnLenAm        snLenUl;              /* Sequence Number length in bits. Allowed values are 12 and 18 */
234    TReAssembleTmr reAssemTmr;           /* T_reassembling Timer in msec*/
235    TStatProhTmr   statProhTmr;          /* T_status_prohibit Timer in msec*/
236
237 }UlAmCfg;
238
239 typedef struct dlAmCfg
240 {
241    SnLenAm      snLenDl;             /* Sequence Number length in bits. Allowed values are 12 and 18 */
242    uint16_t     pollRetxTmr;         /* T_poll_retransmit Timer in msec */
243    int16_t      pollPdu;             /* Used to trigger a poll for every pollPdu.*/
244    int32_t      pollByte;            /* Poll_Byte in bytes. */
245    uint8_t      maxRetxTh;           /* Max_Retx_Threshold */
246  
247 }DlAmCfg;
248
249 typedef struct dlUmCfg
250 {
251    SnLenUm        snLenDlUm;             /* Sequence Number length in bits. Allowed values are 6 and 12 */
252
253 }DlUmCfg;
254
255 typedef struct ulUmCfg
256 {
257    SnLenUm        snLenUlUm;             /* Sequence Number length in bits. Allowed values are 6 and 12 */
258    TReAssembleTmr reAssemTmr;            /* T_reassembling Timer in msec*/
259
260 }UlUmCfg;
261
262 typedef struct amBearerCfg
263 {
264    UlAmCfg  ulAmCfg;
265    DlAmCfg  dlAmCfg;
266 }AmBearerCfg;
267
268 typedef struct umBiDirBearerCfg
269 {
270    UlUmCfg  ulUmCfg;
271    DlUmCfg  dlUmCfg;
272 }UmBiDirBearerCfg;
273
274 typedef struct umUniDirUlBearerCfg
275 {
276    UlUmCfg  ulUmCfg;
277 }UmUniDirUlBearerCfg;
278
279 typedef struct umUniDirDlBearerCfg
280 {
281    DlUmCfg  dlUmCfg;
282 }UmUniDirDlBearerCfg;
283
284 /* Spec Ref: 38.331, 6.3.2 RLC-BearerConfig */
285 typedef struct rlcBearerCfg
286 {
287    ConfigType   configType;
288    uint8_t      rbId;
289    uint8_t      rbType;
290    uint8_t      lcId;
291    uint8_t      lcType;
292    RlcMode      rlcMode;
293    union
294    {
295       AmBearerCfg         *amCfg;
296       UmBiDirBearerCfg    *umBiDirCfg;
297       UmUniDirUlBearerCfg *umUniDirUlCfg;
298       UmUniDirDlBearerCfg *umUniDirDlCfg;
299    }u;
300 }RlcBearerCfg;
301
302 typedef struct rlcUeCfg
303 {
304    uint16_t     cellId;
305    uint8_t      ueIdx;
306    uint8_t      numLcs;
307    RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
308    UeCfgState rlcUeCfgState; /* InActive / Completed */
309 }RlcUeCfg;
310
311 typedef struct rlcUeCfgRsp
312 {
313    uint16_t       cellId;
314    uint16_t       ueIdx;
315    RlcRsp         result;
316    FailureReason  reason;
317 }RlcUeCfgRsp;
318
319 /* UL RRC Message from RLC to DU APP */
320 typedef struct ulRrcMsgInfo
321 {
322    uint16_t   cellId;       /* Cell Id */
323    uint16_t   ueIdx;        /* UE Index */
324    uint8_t    lcId;         /* Logical channel Id */
325    uint16_t   msgLen;       /* RRC message length (in bytes) */
326    uint8_t    *rrcMsg;      /* RRC Message (UL-DCCH Message) */
327 }RlcUlRrcMsgInfo;
328
329 /* UL User Data from RLC to DU APP */
330 typedef struct ulUserDatInfo
331 {
332    uint16_t   cellId;       /* Cell Id */
333    uint16_t   ueIdx;        /* UE Index */
334    uint8_t    rbId;
335    uint16_t   msgLen;       /* User data length (in bytes) */
336    uint8_t    *userData;    /* User data (UL-DTCH Message) */
337 }RlcUlUserDatInfo;
338
339 /* DL RRC Message from DU APP to RLC */
340 typedef struct dlRrcMsgInfo
341 {
342    uint16_t   cellId;         /* Cell Id */
343    uint16_t   ueIdx;          /* UE index */
344    uint8_t    rbType;         /* Radio Bearer Type */
345    uint8_t    rbId;           /* Radio Bearer Id */
346    uint8_t    lcType;         /* Logical channel type */
347    uint8_t    lcId;           /* Logical channel Id */
348    bool       execDup;        /* Execution duplication enabled */
349    bool       deliveryStaRpt;  /* Reporting of delivery status by RLC to DU-APP enabled */
350    uint16_t   msgLen;         /* RRC Message length */
351    uint8_t    *rrcMsg;        /* RRC Message (DL-DCCH Message) */
352 }RlcDlRrcMsgInfo;
353
354 /* DL RRC Message Rsp From RLC to DU APP */
355 typedef struct dlRrcMsgRsp
356 {
357    uint16_t   cellId;         /* Cell Id */
358    uint16_t   crnti;          /* UE index */
359    DlMsgState state;         /* Dl RRC Msg State */
360 }RlcDlRrcMsgRsp;
361
362 /* RRC delivery message from RLC to DU APP */
363 typedef struct rrcDeliveryStatus
364 {
365    uint16_t  deliveryStatus;
366    uint16_t  triggeringMessage;
367 }RrcDeliveryStatus;
368
369 typedef struct rrcDeliveryReportInfo
370 {
371    uint16_t  cellId;
372    uint16_t  ueIdx;
373    uint8_t   srbId;
374    RrcDeliveryStatus  rrcDeliveryStatus;
375 }RrcDeliveryReport;
376
377 /* Function Pointers */
378 /* UE create Request from DU APP to RLC*/
379 typedef uint8_t (*DuRlcUeCreateReq) ARGS((
380    Pst           *pst,
381    RlcUeCfg      *ueCfg ));
382
383 /* UE Cfg Response from RLC to DU APP*/
384 typedef uint8_t (*RlcDuUeCfgRsp) ARGS((
385    Pst          *pst,
386    RlcUeCfgRsp  *ueCfgRsp));
387
388 /* UL RRC Message from RLC to DU APP */
389 typedef uint8_t (*RlcUlRrcMsgToDuFunc) ARGS((
390    Pst           *pst,
391    RlcUlRrcMsgInfo *ulRrcMsgInfo));
392
393 /* DL RRC Message from DU APP to RLC */
394 typedef uint8_t (*DuDlRrcMsgToRlcFunc) ARGS((
395    Pst           *pst,
396    RlcDlRrcMsgInfo *dlRrcMsgInfo));
397
398 /* RRC delivery message from RLC to DU APP */
399 typedef uint8_t (*RlcRrcDeliveryReportToDuFunc) ARGS((
400    Pst           *pst,
401    RrcDeliveryReport *rrcDeliveryReport));
402
403 typedef uint8_t (*DuRlcUeReconfigReq) ARGS((
404    Pst           *pst,
405    RlcUeCfg      *ueCfg ));
406
407 /* DL RRC Message from RLC to DU APP */
408 typedef uint8_t (*RlcDlRrcMsgRspToDuFunc) ARGS((
409    Pst           *pst,
410    RlcDlRrcMsgRsp *dlRrcMsgRsp));
411
412 /* UL User data from RLC to DU APP */
413 typedef uint8_t (*RlcUlUserDataToDuFunc) ARGS((
414    Pst           *pst,
415    RlcUlUserDatInfo *ulUserData));
416
417 /* Pack/Unpack function declarations */
418 uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
419 uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf);
420 uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp);
421 uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf);
422 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
423 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf);
424 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
425 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf);
426 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
427 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func,Pst *pst, Buffer *mBuf);
428 uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
429 uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf);
430 uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp);
431 uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf);
432 uint8_t packRlcUlUserDataToDu(Pst *pst, RlcUlUserDatInfo *ulUserData);
433 uint8_t unpackRlcUlUserDataToDu(RlcUlUserDataToDuFunc func, Pst *pst, Buffer *mBuf);
434
435 /* Event Handler function declarations */
436 uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
437 uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
438 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
439 uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
440 uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
441 uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
442 uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg);
443 uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData);
444
445 #endif /* RLC_INF_H */
446
447 /**********************************************************************
448          End of file
449 **********************************************************************/