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