1 /******************************************************************************
3 * Copyright (c) 2020 ICT/CAS.
5 * Licensed under the O-RAN Software License, Version 1.0 (the "Software License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * https://www.o-ran.org/software
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.
17 *******************************************************************************/
20 #ifndef NR_PDCP_COMMON_H
21 #define NR_PDCP_COMMON_H
23 #include "vos_types.h"
24 #include "vos_linklist.h"
26 #include "gnbCommon.h"
31 #define PDCP_INFINITY 1
32 #define PDCP_DISCARD_TIMER_INFINITY 2
33 #define ROHC_BUFFER_SIZE 8096//1024
34 #define PDCP_MAC_I_LEN 4
35 #define PDCP_SN_12_HEAD_LEN 2
36 #define PDCP_SN_18_HEAD_LEN 3
37 #define MAX_PDCP_SN_12 0x1000
38 #define MAX_PDCP_SN_18 0x40000
39 #define SN_12_WINDOW_SIZE 2048
40 #define SN_18_WINDOW_SIZE 131072
41 #define REORDER_TIMER_NUM 36
42 #define DISCARD_TIMER_NUM 15
45 // TODO: the number of node is not sure yet
46 #define PDCP_MAX_NODE_NUM 10
47 #define PDCP_SPARED -1
50 #define INACTIVE_ENC_STATE 0
51 #define ACTIVE_ENC_STATE 1
52 #define MIDDLE_ENC_STATE 3 /* for srb */
55 #define INACTIVE_INT_STATE 0
56 #define ACTIVE_INT_STATE 1
59 typedef plist pdcpcList;
62 typedef UINT8 PdcpSrbId;
63 typedef UINT16 PdcpUeIdx;
64 typedef UINT8 PdcpCellId;
67 typedef UINT8 PdcpBool_t;
77 /* the direction of data transmission */
88 PDCP_CTRL_PDU = 0, /* control pdu */
89 PDCP_DATA_PDU = 1 /* data pdu */
93 /* pdcp control pdu type */
96 PDCP_CTRL_PDU_SR = 0, /*status report*/
97 PDCP_CTRL_PDU_RF = 1, /*rohc feedback*/
98 PDCP_CTRL_PDU_RESERVED1 = 2,
99 PDCP_CTRL_PDU_RESERVED2 = 3,
100 PDCP_CTRL_PDU_RESERVED3 = 4,
101 PDCP_CTRL_PDU_RESERVED4 = 5,
102 PDCP_CTRL_PDU_RESERVED5 = 6,
103 PDCP_CTRL_PDU_RESERVED6 = 7
107 /* integrity algorithm */
121 /* ciphering algorithm */
136 /* For all srbs and drbs per ue */
138 UINT32 k_gnb[8]; /* 256 bit */
139 UINT32 k_up_enc[4]; /* 128 bit */
140 UINT32 k_cp_enc[4]; /* 128 bit */
141 UINT32 k_up_int[4]; /* 128 bit */
142 UINT32 k_cp_int[4]; /* 128 bit */
143 UINT32 nh[8]; /* Next Hop parameter 256 bit */
144 UINT8 ncc; /* maximum: 3bit */
145 UINT8 enc_algorithm; /* Encryption Algorithm */
146 UINT8 int_algorithm; /* Integrity Algorithm */
147 UINT8 enc_active_flag; /* define whether the encryption function has been activated */
148 UINT8 int_active_flag; /* define whether the integrity protection function has been activated */
149 UINT8 nh_ind; /* 1: nh existed 0: not existed */
168 DISCARD_MS1500 = 1500,
169 DISCARD_INFINITY = PDCP_DISCARD_TIMER_INFINITY
179 typedef enum pdcpRlcMode
181 TM_MODE = 1, /*!< RLC TM Mode */
182 UM_MODE, /*!< RLC UM Mode */
183 AM_MODE, /*!< RLC AM Mode */
188 PdcpBool_t profile0x0001;
189 PdcpBool_t profile0x0002;
190 PdcpBool_t profile0x0003;
191 PdcpBool_t profile0x0004;
192 PdcpBool_t profile0x0005;
193 PdcpBool_t profile0x0006;
194 PdcpBool_t profile0x0101;
195 PdcpBool_t profile0x0102;
196 PdcpBool_t profile0x0103;
197 PdcpBool_t profile0x0104;
202 ROHCProfiles_t rohcProfiles;
207 PdcpBool_t profile0x0006;
239 INFINITY = PDCP_INFINITY,
240 SPARE8 = PDCP_SPARED,
241 SPARE7 = PDCP_SPARED,
242 SPARE6 = PDCP_SPARED,
243 SPARE5 = PDCP_SPARED,
244 SPARE4 = PDCP_SPARED,
245 SPARE3 = PDCP_SPARED,
246 SPARE2 = PDCP_SPARED,
252 ULSPILT_THRESHOLD ulspiltThreshold;
253 }UlDataSplitThreshold;
256 PrimaryPath primaryPath;
257 UlDataSplitThreshold ulDataSplitThreshold;
258 PdcpBool_t duplication;
259 }MoreThanOneRLCContext;
289 REORDER_MS1000 = 1000,
290 REORDER_MS1250 = 1250,
291 REORDER_MS1500 = 1500,
292 REORDER_MS1750 = 1750,
293 REORDER_MS2000 = 2000,
294 REORDER_MS2250 = 2250,
295 REORDER_MS2500 = 2500,
296 REORDER_MS2750 = 2750,
297 REORDER_MS3000 = 3000,
298 REORDER_SPARE28 = PDCP_SPARED,
299 REORDER_SPARE27 = PDCP_SPARED,
300 REORDER_SPARE26 = PDCP_SPARED,
301 REORDER_SPARE25 = PDCP_SPARED,
302 REORDER_SPARE24 = PDCP_SPARED,
303 REORDER_SPARE23 = PDCP_SPARED,
304 REORDER_SPARE22 = PDCP_SPARED,
305 REORDER_SPARE21 = PDCP_SPARED,
306 REORDER_SPARE20 = PDCP_SPARED,
307 REORDER_SPARE19 = PDCP_SPARED,
308 REORDER_SPARE18 = PDCP_SPARED,
309 REORDER_SPARE17 = PDCP_SPARED,
310 REORDER_SPARE16 = PDCP_SPARED,
311 REORDER_SPARE15 = PDCP_SPARED,
312 REORDER_SPARE14 = PDCP_SPARED,
313 REORDER_SPARE13 = PDCP_SPARED,
314 REORDER_SPARE12 = PDCP_SPARED,
315 REORDER_SPARE11 = PDCP_SPARED,
316 REORDER_SPARE10 = PDCP_SPARED,
317 REORDER_SPARE09 = PDCP_SPARED,
318 REORDER_SPARE08 = PDCP_SPARED,
319 REORDER_SPARE07 = PDCP_SPARED,
320 REORDER_SPARE06 = PDCP_SPARED,
321 REORDER_SPARE05 = PDCP_SPARED,
322 REORDER_SPARE04 = PDCP_SPARED,
323 REORDER_SPARE03 = PDCP_SPARED,
324 REORDER_SPARE02 = PDCP_SPARED,
325 REORDER_SPARE01 = PDCP_SPARED
329 UINT32 rxCount; /* count value calculated of per data packet */
346 /* get sn value when sn size is 12 bits */
347 #define GET_SN_12_SN(p) ((p) & 0x00000fff)
349 /* get sn value when sn size is 18 bits */
350 #define GET_SN_18_SN(p) ((p) & 0x0003ffff)
352 /* get hfn value when sn size is 12 bits */
353 #define GET_HFN_12_SN(p) (((p) & 0xfffff000) >> 12)
355 /* get hfn value when sn size is 18 bits */
356 #define GET_HFN_18_SN(p) (((p) & 0xfffc0000) >> 18)
358 /* get count value when sn size is 12 bits */
359 #define GET_COUNT_12_SN(a,b) ((((a) & 0x000fffff)<<12)|((b) & 0x00000fff))
361 /* get count value when sn size is 18 bits */
362 #define GET_COUNT_18_SN(a,b) ((((a) & 0x00003fff)<<18)|((b) & 0x00003ffff))
367 #endif /* NR_PDCP_COMMON_H */