pdcp.h 20.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.0  (the "License"); you may not use this file
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */
21

22
/*! \file LAYER2/PDCP_v10.1.0/pdcp.h
gauthier's avatar
gauthier committed
23
* \brief pdcp interface with RLC, RRC
24
25
26
27
28
* \author  Lionel GAUTHIER and Navid Nikaein
* \date 2009-2012
* \version 1.0
*/

29
30
31
32
33
/** @defgroup _pdcp PDCP 
* @ingroup _oai2
* @{
*/

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef __PDCP_H__
#    define __PDCP_H__
//-----------------------------------------------------------------------------
#    ifdef PDCP_C
#        define private_pdcp(x) x
#        define protected_pdcp(x) x
#        define public_pdcp(x) x
#    else
#        define private_pdcp(x)
#        define public_pdcp(x) extern x
#        ifdef PDCP_FIFO_C
#            define protected_pdcp(x) extern x
#        else
#            define protected_pdcp(x)
#        endif
#    endif

#    ifdef PDCP_FIFO_C
#        define private_pdcp_fifo(x) x
#        define protected_pdcp_fifo(x) x
#        define public_pdcp_fifo(x) x
#    else
#        define private_pdcp_fifo(x)
#        define public_pdcp_fifo(x) extern x
#        ifdef PDCP_C
#            define protected_pdcp_fifo(x) extern x
#        else
#            define protected_pdcp_fifo(x)
#        endif
#    endif
//-----------------------------------------------------------------------------
#ifndef NON_ACCESS_STRATUM
66
67
68
#include "UTIL/MEM/mem_block.h"
#include "UTIL/LISTS/list.h"
#include "COMMON/mac_rrc_primitives.h"
69
70
71
#endif //NON_ACCESS_STRATUM
//-----------------------------------------------------------------------------
#include "COMMON/platform_constants.h"
72
#include "COMMON/platform_types.h"
73
74
75
76
#include "DRB-ToAddMod.h"
#include "DRB-ToAddModList.h"
#include "SRB-ToAddMod.h"
#include "SRB-ToAddModList.h"
Cedric Roux's avatar
Cedric Roux committed
77
#if defined(Rel10) || defined(Rel14)
78
79
80
81
#include "MBMS-SessionInfoList-r9.h"
#include "PMCH-InfoList-r9.h"
#endif

82

gauthier's avatar
gauthier committed
83
84
extern pthread_t       pdcp_thread;
extern pthread_attr_t  pdcp_thread_attr;
85
extern pthread_mutex_t pdcp_mutex;
gauthier's avatar
gauthier committed
86
87
extern pthread_cond_t  pdcp_cond;
extern int             pdcp_instance_cnt;
88

89
90
91
92
93
#define PROTOCOL_PDCP_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] "

#define PROTOCOL_PDCP_CTXT_ARGS(CTXT_Pp, pDCP_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
          (pDCP_Pp->is_srb) ? "SRB" : "DRB",\
          pDCP_Pp->rb_id
94
int init_pdcp_thread(void);
95
96
void cleanup_pdcp_thread(void);

97
98
99
100
public_pdcp(uint64_t Pdcp_sfn[MAX_NUM_CCs]);
public_pdcp(frame_t Pdcp_frame[MAX_NUM_CCs]);
public_pdcp(sub_frame_t Pdcp_subframe[MAX_NUM_CCs]);
public_pdcp(uint16_t Pdcp_num_ues[MAX_NUM_CCs]);
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127


public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_rate_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_throughput_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);

public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_bytes_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_rate_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_goodput_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_s[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);

nikaeinn's avatar
nikaeinn committed
128
129
public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const  ctxt_pP));

130
131
132
133

/*Packet Probing for agent PDCP*/
//public_pdcp(uint64_t *pdcp_packet_counter);
//public_pdcp(uint64_t *pdcp_size_packet);
134
135


136
typedef struct pdcp_stats_s {
137
138
139
  time_stats_t pdcp_run;
  time_stats_t data_req;
  time_stats_t data_ind;
140
  time_stats_t apply_security; //
141
  time_stats_t validate_security;
142
  time_stats_t pdcp_ip;
143
  time_stats_t ip_pdcp; // separte thread
144
} pdcp_stats_t; // common to eNB and UE
145
146


147
148
typedef struct pdcp_s {
  //boolean_t     instanciated_instance;
gauthier's avatar
gauthier committed
149
  uint16_t       header_compression_profile;
150

151
152
153
  /* SR: added this flag to distinguish UE/eNB instance as pdcp_run for virtual
   * mode can receive data on NETLINK for eNB while eNB_flag = 0 and for UE when eNB_flag = 1
   */
gauthier's avatar
gauthier committed
154
  boolean_t is_ue;
155
  boolean_t is_srb;
156

157
158
159
160
 // used for eNB stats generation
  uint16_t uid[NUMBER_OF_UE_MAX]; // local to pdcp
  rnti_t rnti[NUMBER_OF_UE_MAX];

161
  /* Configured security algorithms */
gauthier's avatar
gauthier committed
162
163
  uint8_t cipheringAlgorithm;
  uint8_t integrityProtAlgorithm;
164

165
166
167
168
169
  /* User-Plane encryption key
   * Control-Plane RRC encryption key
   * Control-Plane RRC integrity key
   * These keys are configured by RRC layer
   */
gauthier's avatar
gauthier committed
170
171
172
  uint8_t *kUPenc;
  uint8_t *kRRCint;
  uint8_t *kRRCenc;
173

gauthier's avatar
gauthier committed
174
  uint8_t security_activated;
175

gauthier's avatar
gauthier committed
176
  rlc_mode_t rlc_mode;
gauthier's avatar
gauthier committed
177
178
  uint8_t status_report;
  uint8_t seq_num_size;
179

gauthier's avatar
gauthier committed
180
  logical_chan_id_t lcid;
181
  rb_id_t           rb_id;
182
183
184
185
186
  /*
   * Sequence number state variables
   *
   * TX and RX window
   */
gauthier's avatar
gauthier committed
187
188
  pdcp_sn_t next_pdcp_tx_sn;
  pdcp_sn_t next_pdcp_rx_sn;
189
  pdcp_sn_t next_pdcp_rx_sn_before_integrity;
190
191
192
  /*
   * TX and RX Hyper Frame Numbers
   */
gauthier's avatar
gauthier committed
193
194
  pdcp_hfn_t tx_hfn;
  pdcp_hfn_t rx_hfn;
195
  pdcp_hfn_offset_t rx_hfn_offset; // related to sn mismatch
196

197
198
199
  /*
   * SN of the last PDCP SDU delivered to upper layers
   */
gauthier's avatar
gauthier committed
200
  pdcp_sn_t  last_submitted_pdcp_rx_sn;
201
202
203
204
205
206

  /*
   * Following array is used as a bitmap holding missing sequence
   * numbers to generate a PDCP Control PDU for PDCP status
   * report (see 6.2.6)
   */
gauthier's avatar
gauthier committed
207
  uint8_t missing_pdu_bitmap[512];
208
209
210
211
212
  /*
   * This is intentionally signed since we need a 'NULL' value
   * which is not also a valid sequence number
   */
  short int first_missing_pdu;
213
214
215
  /*
   * decipher using a different rx_hfn
   */
216
217


218
219
} pdcp_t;

Cedric Roux's avatar
Cedric Roux committed
220
#if defined(Rel10) || defined(Rel14)
221
typedef struct pdcp_mbms_s {
gauthier's avatar
gauthier committed
222
223
  boolean_t instanciated_instance;
  rb_id_t   rb_id;
224
} pdcp_mbms_t;
gauthier's avatar
gauthier committed
225
#endif
226
227
228
229
230
231
232
233
234
/*
 * Following symbolic constant alters the behaviour of PDCP
 * and makes it linked to PDCP test code under targets/TEST/PDCP/
 *
 * For the version at SVN repository this should be UNDEFINED!
 * XXX And later this should be configured through the Makefile
 * under targets/TEST/PDCP/
 */

235
/*! \fn boolean_t pdcp_data_req(const protocol_ctxt_t* const  , srb_flag_t , rb_id_t , mui_t , confirm_t ,sdu_size_t , unsigned char* , pdcp_transmission_mode_t )
236
* \brief This functions handles data transfer requests coming either from RRC or from IP
237
238
* \param[in] ctxt_pP        Running context.
* \param[in] rab_id         Radio Bearer ID
239
* \param[in] muiP
240
241
* \param[in] confirmP
* \param[in] sdu_buffer_size Size of incoming SDU in bytes
242
243
* \param[in] sdu_buffer      Buffer carrying SDU
* \param[in] mode            flag to indicate whether the userplane data belong to the control plane or data plane or transparent
244
245
246
247
* \return TRUE on success, FALSE otherwise
* \note None
* @ingroup _pdcp
*/
248
public_pdcp(boolean_t pdcp_data_req(
249
              protocol_ctxt_t*  ctxt_pP,
250
251
252
253
254
255
256
              const srb_flag_t srb_flagP,
              const rb_id_t rb_id,
              const mui_t muiP,
              const confirm_t confirmP, \
              const sdu_size_t sdu_buffer_size,
              unsigned char* const sdu_buffer,
              const pdcp_transmission_mode_t mode));
257

258
/*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t)
259
* \brief This functions handles data transfer indications coming from RLC
260
* \param[in] ctxt_pP        Running context.
261
* \param[in] Shows if rb is SRB
262
263
264
265
266
267
268
269
270
* \param[in] Tells if MBMS traffic
* \param[in] rab_id Radio Bearer ID
* \param[in] sdu_buffer_size Size of incoming SDU in bytes
* \param[in] sdu_buffer Buffer carrying SDU
* \param[in] is_data_plane flag to indicate whether the userplane data belong to the control plane or data plane
* \return TRUE on success, FALSE otherwise
* \note None
* @ingroup _pdcp
*/
271
public_pdcp(boolean_t pdcp_data_ind(
272
273
274
275
276
277
              const protocol_ctxt_t* const  ctxt_pP,
              const srb_flag_t srb_flagP,
              const MBMS_flag_t MBMS_flagP,
              const rb_id_t rb_id,
              const sdu_size_t sdu_buffer_size,
              mem_block_t* const sdu_buffer));
278

279
/*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t)
280
* \brief This functions initializes relevant PDCP entity
281
* \param[in] ctxt_pP        Running context.
gauthier's avatar
gauthier committed
282
283
284
* \param[in] actionP flag for action: add, remove , modify
* \param[in] rb_idP Radio Bearer ID of relevant PDCP entity
* \param[in] security_modeP Radio Bearer ID of relevant PDCP entity
285
286
287
* \return none
* \note None
* @ingroup _pdcp
288
*/
289
public_pdcp(void rrc_pdcp_config_req (
290
291
292
293
294
              const protocol_ctxt_t* const  ctxt_pP,
              const srb_flag_t  srb_flagP,
              const uint32_t    actionP,
              const rb_id_t     rb_idP,
              const uint8_t     security_modeP);)
gauthier's avatar
gauthier committed
295

296
/*! \fn bool rrc_pdcp_config_asn1_req (const protocol_ctxt_t* const , SRB_ToAddModList_t* srb2add_list, DRB_ToAddModList_t* drb2add_list, DRB_ToReleaseList_t*  drb2release_list)
297
* \brief  Function for RRC to configure a Radio Bearer.
298
* \param[in]  ctxt_pP           Running context.
299
300
301
302
* \param[in]  index             index of UE or eNB depending on the eNB_flag
* \param[in]  srb2add_list      SRB configuration list to be created.
* \param[in]  drb2add_list      DRB configuration list to be created.
* \param[in]  drb2release_list  DRB configuration list to be released.
303
304
305
306
* \param[in]  security_mode     Security algorithm to apply for integrity/ciphering
* \param[in]  kRRCenc           RRC encryption key
* \param[in]  kRRCint           RRC integrity key
* \param[in]  kUPenc            User-Plane encryption key
307
* \param[in]  defaultDRB        Default DRB ID
308
309
* \return     A status about the processing, OK or error code.
*/
310
public_pdcp(
311
312
313
314
315
316
317
318
319
  boolean_t rrc_pdcp_config_asn1_req (
    const protocol_ctxt_t* const  ctxt_pP,
    SRB_ToAddModList_t  *const srb2add_list,
    DRB_ToAddModList_t  *const drb2add_list,
    DRB_ToReleaseList_t *const drb2release_list,
    const uint8_t                   security_modeP,
    uint8_t                  *const kRRCenc,
    uint8_t                  *const kRRCint,
    uint8_t                  *const kUPenc
Cedric Roux's avatar
Cedric Roux committed
320
#if defined(Rel10) || defined(Rel14)
321
    ,PMCH_InfoList_r9_t  *pmch_InfoList_r9
322
#endif
323
    ,rb_id_t                 *const defaultDRB 
324
  ));
325

326
/*! \fn boolean_t pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t  action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode)
327
* \brief  Function for RRC to configure a Radio Bearer.
328
* \param[in]  ctxt_pP           Running context.
gauthier's avatar
gauthier committed
329
330
331
* \param[in]  pdcp_pP            Pointer on PDCP structure.
* \param[in]  enb_mod_idP        Virtualized enb module identifier, Not used if eNB_flagP = 0.
* \param[in]  ue_mod_idP         Virtualized ue module identifier.
332
333
* \param[in]  frame              Frame index.
* \param[in]  eNB_flag           Flag to indicate eNB (1) or UE (0)
334
* \param[in]  srb_flagP          Flag to indicate SRB (1) or DRB (0)
335
336
337
338
339
340
* \param[in]  action             add, remove, modify a RB
* \param[in]  rb_id              radio bearer id
* \param[in]  rb_sn              sequence number for this radio bearer
* \param[in]  drb_report         set a pdcp report for this drb
* \param[in]  header_compression set the rohc profile
* \param[in]  security_mode      set the integrity and ciphering algs
341
342
343
* \param[in]  kRRCenc            RRC encryption key
* \param[in]  kRRCint            RRC integrity key
* \param[in]  kUPenc             User-Plane encryption key
344
345
* \return     A status about the processing, OK or error code.
*/
346
public_pdcp(boolean_t pdcp_config_req_asn1 (
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
              const protocol_ctxt_t* const  ctxt_pP,
              pdcp_t         *const pdcp_pP,
              const srb_flag_t       srb_flagP,
              const rlc_mode_t       rlc_mode,
              const uint32_t         action,
              const uint16_t         lc_id,
              const uint16_t         mch_id,
              const rb_id_t          rb_id,
              const uint8_t          rb_sn,
              const uint8_t          rb_report,
              const uint16_t         header_compression_profile,
              const uint8_t          security_mode,
              uint8_t         *const kRRCenc,
              uint8_t         *const kRRCint,
              uint8_t         *const kUPenc));
knopp's avatar
   
knopp committed
362
363


364
/*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const  ctxt_pP)
365
* \brief  Function for RRC to configure a Radio Bearer clear all PDCP resources for a particular UE
366
* \param[in]  ctxt_pP           Running context.
knopp's avatar
   
knopp committed
367
368
369
* \return     A status about the processing, OK or error code.
*/
public_pdcp(boolean_t pdcp_remove_UE(
370
              const protocol_ctxt_t* const  ctxt_pP));
knopp's avatar
   
knopp committed
371

372
/*! \fn void rrc_pdcp_config_release( const protocol_ctxt_t* const, rb_id_t)
373
* \brief This functions is unused
374
* \param[in]  ctxt_pP           Running context.
375
376
377
378
379
* \param[in] rab_id Radio Bearer ID of relevant PDCP entity
* \return none
* \note None
* @ingroup _pdcp
*/
380
//public_pdcp(void rrc_pdcp_config_release ( const protocol_ctxt_t* const  ctxt_pP, rb_id_t);)
381

382
/*! \fn void pdcp_run(const protocol_ctxt_t* const  ctxt_pP)
383
* \brief Runs PDCP entity to let it handle incoming/outgoing SDUs
384
* \param[in]  ctxt_pP           Running context.
385
386
387
388
* \return none
* \note None
* @ingroup _pdcp
*/
389
public_pdcp(void pdcp_run            (
390
              const protocol_ctxt_t* const  ctxt_pP);)
gauthier's avatar
gauthier committed
391
392
393
394
public_pdcp(int pdcp_module_init     (void);)
public_pdcp(void pdcp_module_cleanup (void);)
public_pdcp(void pdcp_layer_init     (void);)
public_pdcp(void pdcp_layer_cleanup  (void);)
395
#if defined(PDCP_USE_NETLINK_QUEUES)
gauthier's avatar
gauthier committed
396
public_pdcp(int pdcp_netlink_init    (void);)
397

398
399
400
#endif
#define PDCP2NW_DRIVER_FIFO 21
#define NW_DRIVER2PDCP_FIFO 22
401

402
protected_pdcp_fifo(int pdcp_fifo_flush_sdus                      (
403
                      const protocol_ctxt_t* const  ctxt_pP);)
404
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus_remaining_bytes (
405
                      const protocol_ctxt_t* const  ctxt_pP);)
406
protected_pdcp_fifo(int pdcp_fifo_read_input_sdus                 (
407
                      const protocol_ctxt_t* const  ctxt_pP);)
408
protected_pdcp_fifo(void pdcp_fifo_read_input_sdus_from_otg       (
409
                      const protocol_ctxt_t* const  ctxt_pP);)
410
411
412
413
414
415

//-----------------------------------------------------------------------------

/*
 * Following two types are utilized between NAS driver and PDCP
 */
416
417
418


typedef struct pdcp_data_req_header_s {
419
  rb_id_t             rb_id;
420
  sdu_size_t          data_size;
gauthier's avatar
gauthier committed
421
  signed int          inst;
gauthier's avatar
gauthier committed
422
  ip_traffic_type_t   traffic_type;
423
} pdcp_data_req_header_t;
424
425

typedef struct pdcp_data_ind_header_s {
426
  rb_id_t             rb_id;
427
  sdu_size_t          data_size;
gauthier's avatar
gauthier committed
428
  signed int          inst;
gauthier's avatar
gauthier committed
429
  ip_traffic_type_t   dummy_traffic_type;
430
431
} pdcp_data_ind_header_t;

432
struct pdcp_netlink_element_s {
433
  pdcp_data_req_header_t pdcp_read_header;
434

435
436
  /* Data part of the message */
  uint8_t *data;
437
438
};

439
440
#if 0
/*
441
 * Missing PDU information struct, a copy of this will be enqueued
442
443
444
 * into pdcp.missing_pdus for every missing PDU
 */
typedef struct pdcp_missing_pdu_info_t {
gauthier's avatar
gauthier committed
445
  pdcp_sn_t sequence_number;
446
447
448
449
450
451
452
453
454
455
456
} pdcp_missing_pdu_info_t;
#endif

/*
 * PDCP limit values
 */
#define PDCP_MAX_SDU_SIZE 8188 // octets, see 4.3.1 Services provided to upper layers
#define PDCP_MAX_SN_5BIT  31   // 2^5-1
#define PDCP_MAX_SN_7BIT  127  // 2^7-1
#define PDCP_MAX_SN_12BIT 4095 // 2^12-1

457
458
/*
 * Reordering_Window: half of the PDCP SN space
459
 */
460
461
462
463
#define REORDERING_WINDOW_SN_5BIT 16
#define REORDERING_WINDOW_SN_7BIT 64
#define REORDERING_WINDOW_SN_12BIT 2048

464
465
/*
 * SN size
466
467
468
469
 */
#define PDCP_SN_5BIT  5
#define PDCP_SN_7BIT  7
#define PDCP_SN_12BIT 12
470

471

472
protected_pdcp(signed int             pdcp_2_nas_irq;)
473
474
public_pdcp(pdcp_stats_t              UE_pdcp_stats[NUMBER_OF_UE_MAX];)
public_pdcp(pdcp_stats_t              eNB_pdcp_stats[NUMBER_OF_eNB_MAX];)
475
476
477
478
479
480
481
//protected_pdcp(pdcp_t                 pdcp_array_srb_ue[NUMBER_OF_UE_MAX][2];)
//protected_pdcp(pdcp_t                 pdcp_array_drb_ue[NUMBER_OF_UE_MAX][maxDRB];)
//public_pdcp(pdcp_t                    pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];)
//protected_pdcp(pdcp_t                 pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][maxDRB];)

// for UE code conly
protected_pdcp(rnti_t                 pdcp_UE_UE_module_id_to_rnti[NUMBER_OF_UE_MAX];)
482
483
protected_pdcp(rnti_t                 pdcp_eNB_UE_instance_to_rnti[NUMBER_OF_UE_MAX];) // for noS1 mode
protected_pdcp(unsigned int           pdcp_eNB_UE_instance_to_rnti_index;)
Cedric Roux's avatar
Cedric Roux committed
484
#if defined(Rel10) || defined(Rel14)
gauthier's avatar
gauthier committed
485
486
487
public_pdcp(pdcp_mbms_t               pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];)   // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_pdcp(pdcp_mbms_t               pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
#endif
488
489
490
491
492
493
494
495
496
protected_pdcp(sdu_size_t             pdcp_output_sdu_bytes_to_write;)
protected_pdcp(sdu_size_t             pdcp_output_header_bytes_to_write;)
protected_pdcp(list_t                 pdcp_sdu_list;)
protected_pdcp(int                    pdcp_sent_a_sdu;)
protected_pdcp(pdcp_data_req_header_t pdcp_input_header;)
protected_pdcp(unsigned char          pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE];)
protected_pdcp(sdu_size_t             pdcp_input_index_header;)
protected_pdcp(sdu_size_t             pdcp_input_sdu_size_read;)
protected_pdcp(sdu_size_t             pdcp_input_sdu_remaining_size_to_read;)
497

498
499
500
501
502
#define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \
   ((hash_key_t)mODULE_iD          | \
    (((hash_key_t)(rNTI))   << 8)  | \
    (((hash_key_t)(iS_eNB)) << 24) | \
    (((hash_key_t)(rB_iD))  << 25) | \
503
504
505
506
507
508
509
510
511
512
513
514
515
    (((hash_key_t)(iS_sRB)) << 33) | \
    (((hash_key_t)(0x55))   << 34))

// hash key to the same PDCP as indexed by PDCP_COLL_KEY_VALUE(... rB_iD, iS_sRB=0) where rB_iD
// is the default DRB ID. The hidden code 0x55 indicates the key is indexed by (rB_iD,is_sRB)
// whereas the hidden code 0xaa indicates the key is for default DRB only
#define PDCP_COLL_KEY_DEFAULT_DRB_VALUE(mODULE_iD, rNTI, iS_eNB) \
    ((hash_key_t)mODULE_iD          | \
     (((hash_key_t)(rNTI))   << 8)  | \
     (((hash_key_t)(iS_eNB)) << 24) | \
     (((hash_key_t)(0xff))   << 25) | \
     (((hash_key_t)(0x00))   << 33) | \
     (((hash_key_t)(0xaa))   << 34))
516
517
518
519
520
521
522
523
524
525
526
527

// service id max val is maxServiceCount = 16 (asn1_constants.h)

#define PDCP_COLL_KEY_MBMS_VALUE(mODULE_iD, rNTI, iS_eNB, sERVICE_ID, sESSION_ID) \
   ((hash_key_t)mODULE_iD              | \
    (((hash_key_t)(rNTI))       << 8)  | \
    (((hash_key_t)(iS_eNB))     << 24) | \
    (((hash_key_t)(sERVICE_ID)) << 32) | \
    (((hash_key_t)(sESSION_ID)) << 37) | \
    (((hash_key_t)(0x0000000000000001))  << 63))

public_pdcp(hash_table_t  *pdcp_coll_p;)
528
529

#endif
530
/*@}*/