7cf361f443928ba34424a19f2c92b87b5e8a1068
[scp/ocu/5gnr.git] / Include / cuupCommon.h
1 /******************************************************************************
2 ###############################################################################
3 #   Copyright (c) [2017-2020] [ICT/CAS]                                        #
4 #   Licensed under the ORAN Software License v1.0 (License)             #
5 ###############################################################################
6 ******************************************************************************/
7
8 #ifndef CU_UP_COMMON_H
9 #define CU_UP_COMMON_H
10
11 #include "vos_types.h"
12 #include "gnbServiceType.h"
13 #include "cuModuleCommon.h"
14 #include "cuModuleInterface.h"
15
16
17 #define CUUP_MAX_SESSION_NUM    256
18 #define CFG_OK                                  0
19 #define CFG_FAIL                                -1
20 #define SECURITY_PERFORMED              0
21 #define SECURITY_NOT_PERFORMED  1
22 #define CUUP_DL_HEAD_LEN                4       // SDAP MAX HEAD 1 + PDCP MAX HEAD +3
23 #define CUUP_UL_HEAD_LEN                0
24 #define AS_KEY_LEN                              4       //4 bytes
25
26 /**
27  * @brief calc function run time
28  */
29  #define CUUP_CALC_ELAPSED_TIME(func)                   \
30 ({                                                                              \
31     struct timeval start, end;                  \
32         INT64 diff;                                                     \
33     gettimeofday(&start,0);     \
34         func;                                                           \
35     gettimeofday(&end,0);                               \
36     diff = ( end.tv_sec*1000000L + end.tv_usec )                \
37         - ( start.tv_sec*1000000L + start.tv_usec );    \
38     vos_info_print("func %s spend time = %ld us\n",#func ,diff);\
39 })
40
41 /* brief UE E1AP ID */
42 typedef UINT32    CuupUeE1apId;
43
44 /* brief Session ID */
45 typedef UINT8    CuupSessionId;                 /* INTEGER (0 ..255) 38463 */
46
47 /* brief Data Radio Bearer ID */
48 typedef UINT8    CuupDrbId;
49
50 /* brief QFI */
51 typedef UINT8    CuupQFI;
52
53 typedef enum
54 {
55     PDU_SESSION_ADD,            /* SESSION TO SETUP */
56     PDU_SESSION_MOD,        /* SESSION TO MODIFY */
57     PDU_SESSION_DEL,        /* SESSION TO DELETE */
58     DRB_DEL,                            /* DRB TO DELETE */
59     UE_RELEASE
60 }UpcCfgType_e;
61
62 typedef struct
63 {
64         UINT64 ueE1apId;
65         UINT8  drbId;
66 }drbToDel_t;
67
68 typedef struct
69 {
70         UpcCfgType_e             cfgType;
71         UINT16                           pduSessionId;
72         INT8                             cfgResult;     //will be removed
73         UINT32                           nggtpuTeid;
74         TransLayerAddr_t         nggtpuAddr;
75         E1apCause_e                      failureCause;
76 }NguCfgResult_t;
77
78 typedef struct
79 {
80         UINT8           drbId;
81         E1apCause_e cause;
82 }DrbFailedCause_t;
83
84 typedef struct
85 {
86         UpcCfgType_e            cfgType;
87         UINT8                           secResPresent;
88         SecuResult_t            secuResult;
89         UINT16                          pduSessionId;
90         UINT8                           drbSetupSuccessNum;
91         UINT8                           drbSetupSuccessArray[MAX_DRB_NUM];
92         UINT8                           drbSetupFailNum;
93         DrbFailedCause_t        drbSetupFailedArray[MAX_DRB_NUM];
94         UINT8                           drbModifySuccessNum;
95         UINT8                           drbModifySuccessArray[MAX_DRB_NUM];
96         UINT8                           drbModifyFailNum;
97         DrbFailedCause_t        drbModifyFailedArray[MAX_DRB_NUM];
98         E1apCause_e                     pduSessionCause;
99 }PdcpuCfgResult_t;
100
101 typedef struct
102 {
103         UINT8  drbId;
104         UINT32 f1gtpuTeid;
105         TransLayerAddr_t gtpuAddr;
106 }Cuf1uSetupInfo_t;
107
108 typedef struct
109 {
110         UpcCfgType_e            cfgType;
111         UINT16                          pduSessionId;
112         UINT8                           drbSetupSuccessNum;
113         Cuf1uSetupInfo_t        drbSetupSuccessArray[MAX_DRB_NUM];
114         UINT8                           drbSetupFailNum;
115         DrbFailedCause_t        drbSetupFailedArray[MAX_DRB_NUM];
116         UINT8                           drbModifySuccessNum;
117         UINT8                           drbModifySuccessArray[MAX_DRB_NUM];
118         UINT8                           drbModifyFailNum;
119         DrbFailedCause_t        drbModifyFailedArray[MAX_DRB_NUM];
120         E1apCause_e                     pduSessionCause;
121 }Cuf1uCfgResult_t;
122
123 typedef enum
124 {
125         CUUP_BEARER_NORMAL,
126         CUUP_BERAER_SUSPEND,
127         CUUP_DETECT_DL_DATA  /* in suspend, ngu recv dl data */
128 }CuupBearerStatus_e;
129
130 typedef struct bearerCxtInactive_s
131 {
132     CuupUeE1apId ueId;
133     UINT8   tag;
134     union {
135         E1apDrbActivityList_t drbActivityList;
136         E1apPduSessionActivityList_t pduSessionActivityList;
137         E1apUeActivity_t ueActivity;
138     }u;
139 }BearerCxtInactive_t;
140 extern INT32 ifmUpcBearerCxtInactiveNotification(BearerCxtInactive_t *bearerCxtInactive);
141 extern INT32 ifmUpcDlDataNotification(UINT64 ueE1apId, UINT8 PPI);
142 #endif /* CU_UP_COMMON_H */
143