[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | UE RLC Re-establishment...
[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 #define EVENT_RLC_UE_DELETE_REQ 220
35 #define EVENT_RLC_UE_DELETE_RSP 221
36 #define EVENT_RLC_SLICE_PM_TO_DU 222
37 #define EVENT_RLC_UE_REESTABLISH_REQ 223
38 #define EVENT_RLC_UE_REESTABLISH_RSP 224
39
40 #define RB_ID_SRB 0
41 #define RB_ID_DRB 1
42
43 /* RLC Direction Config */
44 #define RLC_CFG_DIR_UL        1     /*!< Uplink direction */
45 #define RLC_CFG_DIR_DL        2     /*!< Downlink direction */
46 #define RLC_CFG_DIR_BOTH      3     /*!< Both Downlink and Uplink Direction*/
47
48
49 /* Logical Channel Type */
50 #define LCH_BCCH      1      /*!< BCCH Logical Channel */
51 #define LCH_PCCH      2      /*!< PCCH Logical Channel */
52 #define LCH_CCCH      3      /*!< CCCH Logical Channel */
53 #define LCH_DTCH      4      /*!< DTCH Logical Channel */
54 #define LCH_DCCH      5      /*!< DCCH Logical Channel */
55
56 typedef enum
57 {
58    RB_TYPE_SRB,      /* Signalling Radio Bearer */
59    RB_TYPE_DRB       /* Data Radio Bearer */
60 }RlcRbType;  
61
62 typedef enum
63 {
64    TRANSMISSION_IN_PROGRESS,
65    TRANSMISSION_COMPLETE,
66    TRANSMISSION_FAILED
67 }DlMsgState;
68
69 typedef enum
70 {
71    RLC_CFG_REAS_NONE            ,  /*!< No Failure */
72    RLC_CFG_REAS_RB_CREAT_FAIL   ,  /*!< RB CB creation Failure */
73    RLC_CFG_REAS_UE_CREAT_FAIL   ,  /*!< UE CB creation Failure */
74    RLC_CFG_REAS_CELL_CREAT_FAIL ,  /*!< CELL CB creation Failure */
75    RLC_CFG_REAS_RB_PRSNT        ,  /*!< RB CB already present */
76    RLC_CFG_REAS_LCHTYPE_MIS     ,  /*!< Logical channel type mismatch */
77    RLC_CFG_REAS_RB_UNKWN        ,  /*!< RB Cb unknown */
78    RLC_CFG_REAS_UE_UNKWN        ,  /*!< UE Cb unknown */
79    RLC_CFG_REAS_CELL_UNKWN      ,  /*!< Cell Cb unknown */
80    RLC_CFG_REAS_RB_DEL_FAIL     ,  /*!< RB Cb Deletion Failure */
81    RLC_CFG_REAS_UE_DEL_FAIL     ,  /*!< UE Cb Deletion Failure */
82    RLC_CFG_REAS_RB_REEST_FAIL   ,  /*!< RB Cb Re establish Failure */
83    RLC_CFG_REAS_RB_MODE_MIS     ,  /*!< RB Cb Mode mismatch */
84    RLC_CFG_REAS_REEST_FAIL      ,  /*!< RB Cb Re-establishment Failed */
85    RLC_CFG_REAS_RECFG_FAIL      ,  /*!< RB Cb Re-configuration Failed */
86    RLC_CFG_REAS_INVALID_CFG     ,  /*!< Invalid Configuration Type */
87    RLC_CFG_REAS_SAME_UEID       ,  /*!< UE Ids match in ChngUeId Request */
88    RLC_CFG_REAS_CELL_DEL_FAIL   ,  /*!< Cell Cb Deletion Failure */
89    RLC_CFG_REAS_INVALID_LCHID   ,  /*!< Invalid LChId */
90    RLC_CFG_REAS_INVALID_DIR     ,  /*!< Invalid Direction */
91    RLC_CFG_REAS_UE_EXISTS       ,  /*!< UE ID already exists */
92    RLC_CFG_REAS_INVALID_SNLEN   ,  /*!< Invalid SN Length */
93    RLC_CFG_REAS_SNLEN_MIS       ,  /*!< SN Length mismatch */
94    RLC_CFG_REAS_INVALID_RGUSAP     /*!< Invalid RGU SAP ID */
95 }FailureReason;
96
97 typedef enum
98 {
99    RLC_AM,                    //Acknowledged Mode
100    RLC_UM_BI_DIRECTIONAL,     //UnAcknowledged Mode
101    RLC_UM_UNI_DIRECTIONAL_UL,
102    RLC_UM_UNI_DIRECTIONAL_DL
103 }RlcMode;
104
105 typedef enum
106 {
107    AM_SIZE_12 = 1,
108    AM_SIZE_18
109 }SnLenAm;
110
111 typedef enum
112 {
113    UM_SIZE_6 = 1,
114    UM_SIZE_12
115 }SnLenUm;
116
117 typedef enum
118 {
119    RLC_DU_APP_RSP_OK = 1,
120    RLC_DU_APP_RSP_NOK
121 }RlcRsp;
122
123 typedef struct ulAmCfg
124 {
125    SnLenAm        snLenUl;              /* Sequence Number length in bits. Allowed values are 12 and 18 */
126    int8_t         reAssemTmr;           /* T_reassembling Timer in msec*/
127    int16_t        statProhTmr;          /* T_status_prohibit Timer in msec*/
128
129 }UlAmCfg;
130
131 typedef struct dlAmCfg
132 {
133    SnLenAm      snLenDl;             /* Sequence Number length in bits. Allowed values are 12 and 18 */
134    uint16_t     pollRetxTmr;         /* T_poll_retransmit Timer in msec */
135    int16_t      pollPdu;             /* Used to trigger a poll for every pollPdu.*/
136    int32_t      pollByte;            /* Poll_Byte in bytes. */
137    uint8_t      maxRetxTh;           /* Max_Retx_Threshold */
138
139 }DlAmCfg;
140
141 typedef struct dlUmCfg
142 {
143    SnLenUm        snLenDlUm;             /* Sequence Number length in bits. Allowed values are 6 and 12 */
144
145 }DlUmCfg;
146
147 typedef struct ulUmCfg
148 {
149    SnLenUm        snLenUlUm;             /* Sequence Number length in bits. Allowed values are 6 and 12 */
150    int8_t         reAssemTmr;            /* T_reassembling Timer in msec*/
151
152 }UlUmCfg;
153
154 typedef struct amBearerCfg
155 {
156    UlAmCfg  ulAmCfg;
157    DlAmCfg  dlAmCfg;
158 }AmBearerCfg;
159
160 typedef struct umBiDirBearerCfg
161 {
162    UlUmCfg  ulUmCfg;
163    DlUmCfg  dlUmCfg;
164 }UmBiDirBearerCfg;
165
166 typedef struct umUniDirUlBearerCfg
167 {
168    UlUmCfg  ulUmCfg;
169 }UmUniDirUlBearerCfg;
170
171 typedef struct umUniDirDlBearerCfg
172 {
173    DlUmCfg  dlUmCfg;
174 }UmUniDirDlBearerCfg;
175
176 /* Spec Ref: 38.331, 6.3.2 RLC-BearerConfig */
177 typedef struct rlcBearerCfg
178 {
179    uint8_t      rbId;
180    RlcRbType    rbType;
181    uint8_t      lcId;
182    uint8_t      lcType;
183    Snssai       *snssai; 
184    RlcMode      rlcMode;
185    union
186    {
187       AmBearerCfg         *amCfg;
188       UmBiDirBearerCfg    *umBiDirCfg;
189       UmUniDirUlBearerCfg *umUniDirUlCfg;
190       UmUniDirDlBearerCfg *umUniDirDlCfg;
191    }u;
192    bool isLcAddModRspSent;
193 }RlcBearerCfg;
194
195 /*  Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.3 UE Reconfiguration */
196 typedef struct rlcUeRecfg
197 {
198    uint16_t       cellId;
199    uint8_t        ueId;
200    uint8_t        numLcsToAdd;
201    RlcBearerCfg   rlcLcCfgAdd[MAX_NUM_LC];
202    uint8_t        numLcsToMod;
203    RlcBearerCfg   rlcLcCfgMod[MAX_NUM_LC];
204    uint8_t        numLcsToRel;
205    RlcBearerCfg   rlcLcCfgRel[MAX_NUM_LC];
206 }RlcUeRecfg;
207
208 /*  Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.1 UE Create */
209 typedef struct rlcUeCfg
210 {
211    uint16_t       cellId;
212    uint8_t        ueId;
213    uint8_t        numLcsToAdd;
214    RlcBearerCfg   rlcLcCfgAdd[MAX_NUM_LC];
215 }RlcUeCfg;
216
217 /*  Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.2 UE Create Response */
218 typedef struct rlcUeCfgRsp
219 {
220    uint16_t       cellId;
221    uint16_t       ueId;
222    RlcRsp         result;
223    FailureReason  reason;
224 }RlcUeCfgRsp;
225
226 /*  Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.5 UE Delete Response */
227 typedef struct rlcUeDelete
228 {
229    uint16_t      cellId;
230    uint8_t       ueId;
231 }RlcUeDelete;
232
233 /*  Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.6 UE Delete Response */
234 typedef struct rlcUeDeleteRsp
235 {
236    uint16_t       cellId;
237    uint8_t        ueId;
238    CauseOfResult  status;
239 }RlcUeDeleteRsp;
240
241 /* Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.8 UL RRC Message Transfer*/
242 typedef struct ulRrcMsgInfo
243 {
244    uint16_t   cellId;       /* Cell Id */
245    uint16_t   ueId;         /* UE Id */
246    uint8_t    lcId;         /* Logical channel Id */
247    uint16_t   msgLen;       /* RRC message length (in bytes) */
248    uint8_t    *rrcMsg;      /* RRC Message (UL-DCCH Message) */
249 }RlcUlRrcMsgInfo;
250
251 /* Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.7 DL RRC Message Transfer */
252 typedef struct dlRrcMsgInfo
253 {
254    uint16_t   cellId;         /* Cell Id */
255    uint16_t   ueId;           /* UE Id */
256    uint8_t    lcId;           /* Logical channel Id {1...3} */
257    bool       execDup;        /* Execution duplication enabled */
258    bool       deliveryStaRpt;  /* Reporting of delivery status by RLC to DU-APP enabled */
259    uint16_t   msgLen;         /* RRC Message length */
260    uint8_t    *rrcMsg;        /* RRC Message (DL-DCCH Message) */
261 }RlcDlRrcMsgInfo;
262
263 /* UL User Data from RLC to DU APP */
264 typedef struct ulUserDatInfo
265 {
266    uint16_t   cellId;       /* Cell Id */
267    uint16_t   ueId;         /* UE Id */
268    uint8_t    rbId;
269    uint16_t   msgLen;       /* User data length (in bytes) */
270    uint8_t    *userData;    /* User data (UL-DTCH Message) */
271 }RlcUlUserDatInfo;
272
273 /* DL RRC Message Rsp From RLC to DU APP  */
274 typedef struct dlRrcMsgRsp
275 {
276    uint16_t   cellId;         /* Cell Id */
277    uint16_t   crnti;          /* UE index */
278    DlMsgState state;         /* Dl RRC Msg State */
279 }RlcDlRrcMsgRsp;
280
281 typedef struct
282 {
283   uint32_t sd:24;
284   uint8_t sst;
285 }SliceIdentifier;
286
287 /*Pm Metric for NW Slicing from RLC to DUAPP*/
288 typedef struct slicePm
289 {
290   SliceIdentifier networkSliceIdentifier;
291   double ThpDl;
292   double ThpUl;
293 }SlicePm;
294
295 typedef struct slicePmList
296 {
297    uint8_t numSlice;
298    SlicePm *sliceRecord;
299 }SlicePmList;
300
301 /* DL Data Message from DU APP to RLC */
302 typedef struct dlDataMsgInfo
303 {
304    uint16_t   cellId;         /* Cell Id */
305    uint16_t   ueId;           /* UE Id */
306    uint8_t    rbId;           /* Radio Bearer Id {4 .. MAC\7fX_NUM_DRB} */
307    uint16_t   msgLen;         /* Message length */
308    Buffer     *dlMsg;         /* DL Data */
309 }RlcDlUserDataInfo;
310
311 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.9 UL RRC Message Delivery Report */
312 typedef struct rrcDeliveryStatus
313 {
314    uint16_t  deliveryStatus;
315    uint16_t  triggeringMessage;
316 }RrcDeliveryStatus;
317
318 typedef struct rrcDeliveryReportInfo
319 {
320    uint16_t  cellId;
321    uint16_t  ueId;
322    uint8_t   srbId;
323    RrcDeliveryStatus  rrcDeliveryStatus;
324 }RrcDeliveryReport;
325
326 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.11 UE RLC Re-establishment Req */
327
328 typedef struct rlcUeReestablishReq
329 {  
330    uint16_t   cellId;         
331    uint16_t   ueId;           
332    uint8_t    numLcsToReestablish;
333    uint8_t    lcToReestablish[MAX_NUM_LC];  
334 }RlcUeReestablishReq;
335
336 /*Ref: ORAN_WG8.V7.0.0 Sec 11.2.5.12 UE RLC Re-establishment Rsp */
337 typedef struct rlcUeReestablishRsp 
338 {
339    uint16_t       cellId;
340    uint16_t        ueId;
341    CauseOfResult  status;
342 }RlcUeReestablishRsp;
343
344 /* Function Pointers */
345 /* UE create Request from DU APP to RLC*/
346 typedef uint8_t (*DuRlcUeCreateReq) ARGS((
347    Pst           *pst,
348    RlcUeCfg      *ueCfg ));
349
350 /* UE Cfg Response from RLC to DU APP*/
351 typedef uint8_t (*RlcDuUeCfgRsp) ARGS((
352    Pst          *pst,
353    RlcUeCfgRsp  *ueCfgRsp));
354
355 /* UE Delete Response from RLC to DU APP*/
356 typedef uint8_t (*RlcDuUeDeleteRsp) ARGS((
357    Pst          *pst,
358    RlcUeDeleteRsp  *ueDelRsp));
359
360 /* UL RRC Message from RLC to DU APP */
361 typedef uint8_t (*RlcUlRrcMsgToDuFunc) ARGS((
362    Pst           *pst,
363    RlcUlRrcMsgInfo *ulRrcMsgInfo));
364
365 /* DL RRC Message from DU APP to RLC */
366 typedef uint8_t (*DuDlRrcMsgToRlcFunc) ARGS((
367    Pst           *pst,
368    RlcDlRrcMsgInfo *dlRrcMsgInfo));
369
370 /* RRC delivery message from RLC to DU APP */
371 typedef uint8_t (*RlcRrcDeliveryReportToDuFunc) ARGS((
372    Pst           *pst,
373    RrcDeliveryReport *rrcDeliveryReport));
374
375 /* UE Reconfig Request from DU APP to RLC */
376 typedef uint8_t (*DuRlcUeReconfigReq) ARGS((
377    Pst           *pst,
378    RlcUeRecfg      *ueRecfg ));
379
380 /* UE Delete Request from DU APP to RLC */
381 typedef uint8_t (*DuRlcUeDeleteReq) ARGS((
382    Pst           *pst,
383    RlcUeDelete   *ueDelete));
384
385 /* DL RRC Message from RLC to DU APP */
386 typedef uint8_t (*RlcDlRrcMsgRspToDuFunc) ARGS((
387    Pst           *pst,
388    RlcDlRrcMsgRsp *dlRrcMsgRsp));
389
390 /* UL User data from RLC to DU APP */
391 typedef uint8_t (*RlcUlUserDataToDuFunc) ARGS((
392    Pst           *pst,
393    RlcUlUserDatInfo *ulUserData));
394
395 /* DL User Data from DU APP to RLC */
396 typedef uint8_t (*DuRlcDlUserDataToRlcFunc) ARGS((
397    Pst           *pst,
398    RlcDlUserDataInfo *dlDataMsg));
399
400 /* Slice Metrics from RLC to DU APP */
401 typedef uint8_t (*RlcSlicePmToDuFunc) ARGS((
402    Pst           *pst,
403    SlicePmList *sliceStats));
404
405 /* UE Re-establishment Request from DU APP to RLC */
406 typedef uint8_t (*DuRlcUeReestablishReq) ARGS((
407    Pst           *pst,
408    RlcUeReestablishReq   *ueReestablishReq));
409
410 /* UE Re-establishment Response from RLC to DU APP*/
411 typedef uint8_t (*RlcDuUeReestablishRsp) ARGS((
412    Pst          *pst,
413    RlcUeReestablishRsp  *ueDelRsp));
414
415 /* Pack/Unpack function declarations */
416 uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
417 uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf);
418 uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp);
419 uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf);
420 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
421 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf);
422 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
423 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf);
424 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
425 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func,Pst *pst, Buffer *mBuf);
426 uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeRecfg *ueCfg);
427 uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf);
428 uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp);
429 uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf);
430 uint8_t packRlcUlUserDataToDu(Pst *pst, RlcUlUserDatInfo *ulUserData);
431 uint8_t unpackRlcUlUserDataToDu(RlcUlUserDataToDuFunc func, Pst *pst, Buffer *mBuf);
432 uint8_t packRlcDlUserDataToRlc(Pst *pst, RlcDlUserDataInfo *dlDataMsg);
433 uint8_t unpackRlcDlUserDataToRlc(DuRlcDlUserDataToRlcFunc func, Pst *pst, Buffer *mBuf);
434 uint8_t packDuRlcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete);
435 uint8_t unpackRlcUeDeleteReq(DuRlcUeDeleteReq func, Pst *pst, Buffer *mBuf);
436 uint8_t packRlcDuUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *ueDeleteRsp);
437 uint8_t unpackRlcUeDeleteRsp(RlcDuUeDeleteRsp func, Pst *pst, Buffer *mBuf);
438 uint8_t packRlcDuSlicePm(Pst *pst, SlicePmList *sliceStats);
439 uint8_t unpackRlcSlicePm(RlcSlicePmToDuFunc func, Pst *pst, Buffer *mBuf);
440 uint8_t packDuRlcUeReestablishReq(Pst *pst, RlcUeReestablishReq *ueReestablish);
441 uint8_t unpackRlcUeReestablishReq(DuRlcUeReestablishReq func, Pst *pst, Buffer *mBuf);
442 uint8_t packRlcDuUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *ueReestablishRsp);
443 uint8_t unpackRlcUeReestablishRsp(RlcDuUeReestablishRsp func, Pst *pst, Buffer *mBuf);
444
445 /* Event Handler function declarations */
446 uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
447 uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
448 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
449 uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
450 uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
451 uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeRecfg *ueCfg);
452 uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg);
453 uint8_t DuProcRlcUlUserDataTrans(Pst *pst, RlcUlUserDatInfo *ulUserData);
454 uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo);
455 uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete);
456 uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp);
457 uint8_t DuProcRlcSliceMetrics(Pst *pst, SlicePmList *sliceStats);
458 uint8_t RlcProcUeReestablishReq(Pst *pst, RlcUeReestablishReq *ueReestablish);
459 uint8_t DuProcRlcUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *delRsp);
460 #endif /* RLC_INF_H */
461
462 /**********************************************************************
463          End of file
464 **********************************************************************/