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