Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
14dd67a8
Commit
14dd67a8
authored
Dec 19, 2019
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save commit
parent
68209767
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
764 additions
and
6 deletions
+764
-6
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+3
-0
openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c
openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c
+74
-0
openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h
openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h
+63
-0
openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
+70
-0
openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h
openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h
+38
-0
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+268
-6
openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
+190
-0
openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h
openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h
+58
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
14dd67a8
...
...
@@ -1529,6 +1529,9 @@ set(NR_RLC_SRC
set
(
NR_PDCP_SRC
${
OPENAIR2_DIR
}
/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
${
OPENAIR2_DIR
}
/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
${
OPENAIR2_DIR
}
/LAYER2/nr_pdcp/nr_pdcp_entity.c
${
OPENAIR2_DIR
}
/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
)
set
(
L2_SRC
...
...
openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c
0 → 100644
View file @
14dd67a8
/*
* 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.1 (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
*/
#include "nr_pdcp_entity.h"
#include "nr_pdcp_entity_drb_am.h"
#include "LOG/log.h"
nr_pdcp_entity_t
*
new_nr_pdcp_entity_srb
(
int
rb_id
,
void
(
*
deliver_sdu
)(
void
*
deliver_sdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
),
void
*
deliver_sdu_data
,
void
(
*
deliver_pdu
)(
void
*
deliver_pdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
),
void
*
deliver_pdu_data
)
{
abort
();
}
nr_pdcp_entity_t
*
new_nr_pdcp_entity_drb_am
(
int
rb_id
,
void
(
*
deliver_sdu
)(
void
*
deliver_sdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
),
void
*
deliver_sdu_data
,
void
(
*
deliver_pdu
)(
void
*
deliver_pdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
),
void
*
deliver_pdu_data
)
{
nr_pdcp_entity_drb_am_t
*
ret
;
ret
=
calloc
(
1
,
sizeof
(
nr_pdcp_entity_drb_am_t
));
if
(
ret
==
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: out of memory
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
ret
->
common
.
recv_pdu
=
nr_pdcp_entity_drb_am_recv_pdu
;
ret
->
common
.
recv_sdu
=
nr_pdcp_entity_drb_am_recv_sdu
;
ret
->
common
.
set_integrity_key
=
nr_pdcp_entity_drb_am_set_integrity_key
;
ret
->
common
.
delete
=
nr_pdcp_entity_drb_am_delete
;
ret
->
common
.
deliver_sdu
=
deliver_sdu
;
ret
->
common
.
deliver_sdu_data
=
deliver_sdu_data
;
ret
->
common
.
deliver_pdu
=
deliver_pdu
;
ret
->
common
.
deliver_pdu_data
=
deliver_pdu_data
;
ret
->
rb_id
=
rb_id
;
ret
->
common
.
maximum_nr_pdcp_sn
=
4095
;
return
(
nr_pdcp_entity_t
*
)
ret
;
}
openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h
0 → 100644
View file @
14dd67a8
/*
* 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.1 (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
*/
#ifndef _NR_PDCP_ENTITY_H_
#define _NR_PDCP_ENTITY_H_
typedef
struct
nr_pdcp_entity_t
{
/* functions provided by the PDCP module */
void
(
*
recv_pdu
)(
struct
nr_pdcp_entity_t
*
entity
,
char
*
buffer
,
int
size
);
void
(
*
recv_sdu
)(
struct
nr_pdcp_entity_t
*
entity
,
char
*
buffer
,
int
size
,
int
sdu_id
);
void
(
*
delete
)(
struct
nr_pdcp_entity_t
*
entity
);
void
(
*
set_integrity_key
)(
struct
nr_pdcp_entity_t
*
entity
,
char
*
key
);
/* callbacks provided to the PDCP module */
void
(
*
deliver_sdu
)(
void
*
deliver_sdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
);
void
*
deliver_sdu_data
;
void
(
*
deliver_pdu
)(
void
*
deliver_pdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
);
void
*
deliver_pdu_data
;
int
tx_hfn
;
int
next_nr_pdcp_tx_sn
;
int
maximum_nr_pdcp_sn
;
}
nr_pdcp_entity_t
;
nr_pdcp_entity_t
*
new_nr_pdcp_entity_srb
(
int
rb_id
,
void
(
*
deliver_sdu
)(
void
*
deliver_sdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
),
void
*
deliver_sdu_data
,
void
(
*
deliver_pdu
)(
void
*
deliver_pdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
),
void
*
deliver_pdu_data
);
nr_pdcp_entity_t
*
new_nr_pdcp_entity_drb_am
(
int
rb_id
,
void
(
*
deliver_sdu
)(
void
*
deliver_sdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
),
void
*
deliver_sdu_data
,
void
(
*
deliver_pdu
)(
void
*
deliver_pdu_data
,
struct
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
),
void
*
deliver_pdu_data
);
#endif
/* _NR_PDCP_ENTITY_H_ */
openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
0 → 100644
View file @
14dd67a8
/*
* 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.1 (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
*/
#include "nr_pdcp_entity_drb_am.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void
nr_pdcp_entity_drb_am_recv_pdu
(
nr_pdcp_entity_t
*
_entity
,
char
*
buffer
,
int
size
)
{
nr_pdcp_entity_drb_am_t
*
entity
=
(
nr_pdcp_entity_drb_am_t
*
)
_entity
;
if
(
size
<
3
)
abort
();
if
(
!
(
buffer
[
0
]
&
0x80
))
{
printf
(
"%s:%d:%s: fatal
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
entity
->
common
.
deliver_sdu
(
entity
->
common
.
deliver_sdu_data
,
(
nr_pdcp_entity_t
*
)
entity
,
buffer
+
2
,
size
-
2
);
}
void
nr_pdcp_entity_drb_am_recv_sdu
(
nr_pdcp_entity_t
*
_entity
,
char
*
buffer
,
int
size
,
int
sdu_id
)
{
nr_pdcp_entity_drb_am_t
*
entity
=
(
nr_pdcp_entity_drb_am_t
*
)
_entity
;
int
sn
;
char
buf
[
size
+
2
];
sn
=
entity
->
common
.
next_nr_pdcp_tx_sn
;
entity
->
common
.
next_nr_pdcp_tx_sn
++
;
if
(
entity
->
common
.
next_nr_pdcp_tx_sn
>
entity
->
common
.
maximum_nr_pdcp_sn
)
{
entity
->
common
.
next_nr_pdcp_tx_sn
=
0
;
entity
->
common
.
tx_hfn
++
;
}
buf
[
0
]
=
0x80
|
((
sn
>>
8
)
&
0x0f
);
buf
[
1
]
=
sn
&
0xff
;
memcpy
(
buf
+
2
,
buffer
,
size
);
entity
->
common
.
deliver_pdu
(
entity
->
common
.
deliver_pdu_data
,
(
nr_pdcp_entity_t
*
)
entity
,
buf
,
size
+
2
,
sdu_id
);
}
void
nr_pdcp_entity_drb_am_set_integrity_key
(
nr_pdcp_entity_t
*
_entity
,
char
*
key
)
{
/* nothing to do */
}
void
nr_pdcp_entity_drb_am_delete
(
nr_pdcp_entity_t
*
_entity
)
{
nr_pdcp_entity_drb_am_t
*
entity
=
(
nr_pdcp_entity_drb_am_t
*
)
_entity
;
free
(
entity
);
}
openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.h
0 → 100644
View file @
14dd67a8
/*
* 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.1 (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
*/
#ifndef _NR_PDCP_ENTITY_DRB_AM_H_
#define _NR_PDCP_ENTITY_DRB_AM_H_
#include "nr_pdcp_entity.h"
typedef
struct
{
nr_pdcp_entity_t
common
;
int
rb_id
;
}
nr_pdcp_entity_drb_am_t
;
void
nr_pdcp_entity_drb_am_recv_pdu
(
nr_pdcp_entity_t
*
entity
,
char
*
buffer
,
int
size
);
void
nr_pdcp_entity_drb_am_recv_sdu
(
nr_pdcp_entity_t
*
entity
,
char
*
buffer
,
int
size
,
int
sdu_id
);
void
nr_pdcp_entity_drb_am_set_integrity_key
(
nr_pdcp_entity_t
*
entity
,
char
*
key
);
void
nr_pdcp_entity_drb_am_delete
(
nr_pdcp_entity_t
*
entity
);
#endif
/* _NR_PDCP_ENTITY_DRB_AM_H_ */
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
View file @
14dd67a8
...
...
@@ -19,6 +19,8 @@
* contact@openairinterface.org
*/
#include "nr_pdcp_ue_manager.h"
/* from OAI */
#include "pdcp.h"
...
...
@@ -27,12 +29,120 @@
exit(1); \
} while (0)
static
nr_pdcp_ue_manager_t
*
nr_pdcp_ue_manager
;
/* necessary globals for OAI, not used internally */
hash_table_t
*
pdcp_coll_p
;
static
uint64_t
pdcp_optmask
;
/****************************************************************************/
/* rlc_data_req queue - begin */
/****************************************************************************/
static
void
init_nr_rlc_data_req_queue
(
void
)
{
}
/****************************************************************************/
/* rlc_data_req queue - end */
/****************************************************************************/
#include "LAYER2/MAC/mac_extern.h"
void
nr_ip_over_LTE_DRB_preconfiguration
(
void
)
{
TODO
;
// Addition for the use-case of 4G stack on top of 5G-NR.
// We need to configure pdcp and rlc instances without having an actual
// UE RRC Connection. In order to be able to test the NR PHY with some injected traffic
// on top of the LTE stack.
protocol_ctxt_t
ctxt
;
LTE_DRB_ToAddModList_t
*
DRB_configList
=
NULL
;
DRB_configList
=
CALLOC
(
1
,
sizeof
(
LTE_DRB_ToAddModList_t
));
struct
LTE_LogicalChannelConfig
*
DRB_lchan_config
=
NULL
;
struct
LTE_RLC_Config
*
DRB_rlc_config
=
NULL
;
struct
LTE_PDCP_Config
*
DRB_pdcp_config
=
NULL
;
struct
LTE_PDCP_Config__rlc_UM
*
PDCP_rlc_UM
=
NULL
;
struct
LTE_DRB_ToAddMod
*
DRB_config
=
NULL
;
struct
LTE_LogicalChannelConfig__ul_SpecificParameters
*
DRB_ul_SpecificParameters
=
NULL
;
long
*
logicalchannelgroup_drb
;
//Static preconfiguration of DRB
DRB_config
=
CALLOC
(
1
,
sizeof
(
*
DRB_config
));
DRB_config
->
eps_BearerIdentity
=
CALLOC
(
1
,
sizeof
(
long
));
// allowed value 5..15, value : x+4
*
(
DRB_config
->
eps_BearerIdentity
)
=
1
;
//ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation
// DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id;
// 1 + drb_identiy_index;
DRB_config
->
drb_Identity
=
1
;
DRB_config
->
logicalChannelIdentity
=
CALLOC
(
1
,
sizeof
(
long
));
*
(
DRB_config
->
logicalChannelIdentity
)
=
DRB_config
->
drb_Identity
+
2
;
//(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
DRB_rlc_config
=
CALLOC
(
1
,
sizeof
(
*
DRB_rlc_config
));
DRB_config
->
rlc_Config
=
DRB_rlc_config
;
DRB_pdcp_config
=
CALLOC
(
1
,
sizeof
(
*
DRB_pdcp_config
));
DRB_config
->
pdcp_Config
=
DRB_pdcp_config
;
DRB_pdcp_config
->
discardTimer
=
CALLOC
(
1
,
sizeof
(
long
));
*
DRB_pdcp_config
->
discardTimer
=
LTE_PDCP_Config__discardTimer_infinity
;
DRB_pdcp_config
->
rlc_AM
=
NULL
;
DRB_pdcp_config
->
rlc_UM
=
NULL
;
DRB_rlc_config
->
present
=
LTE_RLC_Config_PR_um_Bi_Directional
;
DRB_rlc_config
->
choice
.
um_Bi_Directional
.
ul_UM_RLC
.
sn_FieldLength
=
LTE_SN_FieldLength_size10
;
DRB_rlc_config
->
choice
.
um_Bi_Directional
.
dl_UM_RLC
.
sn_FieldLength
=
LTE_SN_FieldLength_size10
;
DRB_rlc_config
->
choice
.
um_Bi_Directional
.
dl_UM_RLC
.
t_Reordering
=
LTE_T_Reordering_ms35
;
// PDCP
PDCP_rlc_UM
=
CALLOC
(
1
,
sizeof
(
*
PDCP_rlc_UM
));
DRB_pdcp_config
->
rlc_UM
=
PDCP_rlc_UM
;
PDCP_rlc_UM
->
pdcp_SN_Size
=
LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits
;
DRB_pdcp_config
->
headerCompression
.
present
=
LTE_PDCP_Config__headerCompression_PR_notUsed
;
DRB_lchan_config
=
CALLOC
(
1
,
sizeof
(
*
DRB_lchan_config
));
DRB_config
->
logicalChannelConfig
=
DRB_lchan_config
;
DRB_ul_SpecificParameters
=
CALLOC
(
1
,
sizeof
(
*
DRB_ul_SpecificParameters
));
DRB_lchan_config
->
ul_SpecificParameters
=
DRB_ul_SpecificParameters
;
DRB_ul_SpecificParameters
->
priority
=
4
;
DRB_ul_SpecificParameters
->
prioritisedBitRate
=
LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8
;
//LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
DRB_ul_SpecificParameters
->
bucketSizeDuration
=
LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50
;
logicalchannelgroup_drb
=
CALLOC
(
1
,
sizeof
(
long
));
*
logicalchannelgroup_drb
=
1
;
//(i+1) % 3;
DRB_ul_SpecificParameters
->
logicalChannelGroup
=
logicalchannelgroup_drb
;
ASN_SEQUENCE_ADD
(
&
DRB_configList
->
list
,
DRB_config
);
if
(
ENB_NAS_USE_TUN
){
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
ENB_FLAG_YES
,
0x1234
,
0
,
0
,
0
);
}
else
{
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
ENB_FLAG_NO
,
0x1234
,
0
,
0
,
0
);
}
rrc_pdcp_config_asn1_req
(
&
ctxt
,
(
LTE_SRB_ToAddModList_t
*
)
NULL
,
DRB_configList
,
(
LTE_DRB_ToReleaseList_t
*
)
NULL
,
0xff
,
NULL
,
NULL
,
NULL
,
(
LTE_PMCH_InfoList_r9_t
*
)
NULL
,
&
DRB_config
->
drb_Identity
);
rrc_rlc_config_asn1_req
(
&
ctxt
,
(
LTE_SRB_ToAddModList_t
*
)
NULL
,
DRB_configList
,
(
LTE_DRB_ToReleaseList_t
*
)
NULL
//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
,(
LTE_PMCH_InfoList_r9_t
*
)
NULL
,
0
,
0
//#endif
);
}
int
pdcp_fifo_flush_sdus
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
...
...
@@ -43,13 +153,35 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP)
void
pdcp_layer_init
(
void
)
{
TODO
;
/* be sure to initialize only once */
static
pthread_mutex_t
m
=
PTHREAD_MUTEX_INITIALIZER
;
static
int
initialized
=
0
;
if
(
pthread_mutex_lock
(
&
m
)
!=
0
)
abort
();
if
(
initialized
)
{
if
(
pthread_mutex_unlock
(
&
m
)
!=
0
)
abort
();
return
;
}
initialized
=
1
;
if
(
pthread_mutex_unlock
(
&
m
)
!=
0
)
abort
();
nr_pdcp_ue_manager
=
new_nr_pdcp_ue_manager
(
1
);
init_nr_rlc_data_req_queue
();
}
uint64_t
pdcp_module_init
(
uint64_t
_pdcp_optmask
)
{
TODO
;
return
_pdcp_optmask
;
pdcp_optmask
=
_pdcp_optmask
;
return
pdcp_optmask
;
}
static
void
deliver_sdu_drb
(
void
*
_ue
,
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
)
{
}
static
void
deliver_pdu_drb
(
void
*
_ue
,
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
)
{
}
boolean_t
pdcp_data_ind
(
...
...
@@ -65,10 +197,100 @@ boolean_t pdcp_data_ind(
}
void
pdcp_run
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
{
MessageDef
*
msg_p
;
int
result
;
protocol_ctxt_t
ctxt
;
while
(
1
)
{
itti_poll_msg
(
ctxt_pP
->
enb_flag
?
TASK_PDCP_ENB
:
TASK_PDCP_UE
,
&
msg_p
);
if
(
msg_p
==
NULL
)
break
;
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
RRC_DCCH_DATA_REQ
:
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
RRC_DCCH_DATA_REQ
(
msg_p
).
module_id
,
RRC_DCCH_DATA_REQ
(
msg_p
).
enb_flag
,
RRC_DCCH_DATA_REQ
(
msg_p
).
rnti
,
RRC_DCCH_DATA_REQ
(
msg_p
).
frame
,
0
,
RRC_DCCH_DATA_REQ
(
msg_p
).
eNB_index
);
result
=
pdcp_data_req
(
&
ctxt
,
SRB_FLAG_YES
,
RRC_DCCH_DATA_REQ
(
msg_p
).
rb_id
,
RRC_DCCH_DATA_REQ
(
msg_p
).
muip
,
RRC_DCCH_DATA_REQ
(
msg_p
).
confirmp
,
RRC_DCCH_DATA_REQ
(
msg_p
).
sdu_size
,
RRC_DCCH_DATA_REQ
(
msg_p
).
sdu_p
,
RRC_DCCH_DATA_REQ
(
msg_p
).
mode
,
NULL
,
NULL
);
if
(
result
!=
TRUE
)
LOG_E
(
PDCP
,
"PDCP data request failed!
\n
"
);
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
RRC_DCCH_DATA_REQ
(
msg_p
).
sdu_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
break
;
default:
LOG_E
(
PDCP
,
"Received unexpected message %s
\n
"
,
ITTI_MSG_NAME
(
msg_p
));
break
;
}
}
}
static
void
add_srb
(
int
rnti
,
struct
LTE_SRB_ToAddMod
*
s
)
{
TODO
;
}
static
void
add_drb_am
(
int
rnti
,
struct
LTE_DRB_ToAddMod
*
s
)
{
nr_pdcp_entity_t
*
pdcp_drb
;
nr_pdcp_ue_t
*
ue
;
int
drb_id
=
s
->
drb_Identity
;
printf
(
"
\n\n
################# add drb %d
\n\n\n
"
,
drb_id
);
if
(
drb_id
!=
1
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal, bad drb id %d
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
drb_id
);
exit
(
1
);
}
nr_pdcp_manager_lock
(
nr_pdcp_ue_manager
);
ue
=
nr_pdcp_manager_get_ue
(
nr_pdcp_ue_manager
,
rnti
);
if
(
ue
->
drb
[
drb_id
-
1
]
!=
NULL
)
{
LOG_D
(
PDCP
,
"%s:%d:%s: warning DRB %d already exist for ue %d, do nothing
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
drb_id
,
rnti
);
}
else
{
pdcp_drb
=
new_nr_pdcp_entity_drb_am
(
drb_id
,
deliver_sdu_drb
,
ue
,
deliver_pdu_drb
,
ue
);
nr_pdcp_ue_add_drb_pdcp_entity
(
ue
,
drb_id
,
pdcp_drb
);
LOG_D
(
PDCP
,
"%s:%d:%s: added drb %d to ue %d
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
drb_id
,
rnti
);
}
nr_pdcp_manager_unlock
(
nr_pdcp_ue_manager
);
}
static
void
add_drb
(
int
rnti
,
struct
LTE_DRB_ToAddMod
*
s
)
{
switch
(
s
->
rlc_Config
->
present
)
{
case
LTE_RLC_Config_PR_am
:
add_drb_am
(
rnti
,
s
);
break
;
case
LTE_RLC_Config_PR_um_Bi_Directional
:
//add_drb_um(rnti, s);
/* hack */
add_drb_am
(
rnti
,
s
);
break
;
default:
LOG_E
(
PDCP
,
"%s:%d:%s: fatal: unhandled DRB type
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
}
boolean_t
rrc_pdcp_config_asn1_req
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
LTE_SRB_ToAddModList_t
*
const
srb2add_list
,
...
...
@@ -83,13 +305,53 @@ boolean_t rrc_pdcp_config_asn1_req(
#endif
,
rb_id_t
*
const
defaultDRB
)
{
TODO
;
int
rnti
=
ctxt_pP
->
rnti
;
int
i
;
if
(
ctxt_pP
->
enb_flag
!=
1
||
ctxt_pP
->
module_id
!=
0
||
ctxt_pP
->
instance
!=
0
||
ctxt_pP
->
eNB_index
!=
0
||
//ctxt_pP->configured != 2 ||
//srb2add_list == NULL ||
//drb2add_list != NULL ||
drb2release_list
!=
NULL
||
security_modeP
!=
255
||
//kRRCenc != NULL ||
//kRRCint != NULL ||
//kUPenc != NULL ||
pmch_InfoList_r9
!=
NULL
/*||
defaultDRB != NULL */
)
{
TODO
;
}
if
(
srb2add_list
!=
NULL
)
{
for
(
i
=
0
;
i
<
srb2add_list
->
list
.
count
;
i
++
)
{
add_srb
(
rnti
,
srb2add_list
->
list
.
array
[
i
]);
}
}
if
(
drb2add_list
!=
NULL
)
{
for
(
i
=
0
;
i
<
drb2add_list
->
list
.
count
;
i
++
)
{
add_drb
(
rnti
,
drb2add_list
->
list
.
array
[
i
]);
}
}
/* update security */
if
(
kRRCint
!=
NULL
)
{
/* todo */
}
free
(
kRRCenc
);
free
(
kRRCint
);
free
(
kUPenc
);
return
0
;
}
uint64_t
get_pdcp_optmask
(
void
)
{
TODO
;
return
pdcp_optmask
;
}
boolean_t
pdcp_remove_UE
(
...
...
openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
0 → 100644
View file @
14dd67a8
/*
* 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.1 (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
*/
#include "nr_pdcp_ue_manager.h"
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include "LOG/log.h"
typedef
struct
{
pthread_mutex_t
lock
;
nr_pdcp_ue_t
**
ue_list
;
int
ue_count
;
int
enb_flag
;
}
nr_pdcp_ue_manager_internal_t
;
nr_pdcp_ue_manager_t
*
new_nr_pdcp_ue_manager
(
int
enb_flag
)
{
nr_pdcp_ue_manager_internal_t
*
ret
;
ret
=
calloc
(
1
,
sizeof
(
nr_pdcp_ue_manager_internal_t
));
if
(
ret
==
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: out of memory
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
if
(
pthread_mutex_init
(
&
ret
->
lock
,
NULL
))
abort
();
ret
->
enb_flag
=
enb_flag
;
return
ret
;
}
int
nr_pdcp_manager_get_enb_flag
(
nr_pdcp_ue_manager_t
*
_m
)
{
nr_pdcp_ue_manager_internal_t
*
m
=
_m
;
return
m
->
enb_flag
;
}
void
nr_pdcp_manager_lock
(
nr_pdcp_ue_manager_t
*
_m
)
{
nr_pdcp_ue_manager_internal_t
*
m
=
_m
;
if
(
pthread_mutex_lock
(
&
m
->
lock
))
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
}
void
nr_pdcp_manager_unlock
(
nr_pdcp_ue_manager_t
*
_m
)
{
nr_pdcp_ue_manager_internal_t
*
m
=
_m
;
if
(
pthread_mutex_unlock
(
&
m
->
lock
))
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
}
/* must be called with lock acquired */
nr_pdcp_ue_t
*
nr_pdcp_manager_get_ue
(
nr_pdcp_ue_manager_t
*
_m
,
int
rnti
)
{
/* TODO: optimze */
nr_pdcp_ue_manager_internal_t
*
m
=
_m
;
int
i
;
for
(
i
=
0
;
i
<
m
->
ue_count
;
i
++
)
if
(
m
->
ue_list
[
i
]
->
rnti
==
rnti
)
return
m
->
ue_list
[
i
];
LOG_D
(
PDCP
,
"%s:%d:%s: new UE %d
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
rnti
);
m
->
ue_count
++
;
m
->
ue_list
=
realloc
(
m
->
ue_list
,
sizeof
(
nr_pdcp_ue_t
*
)
*
m
->
ue_count
);
if
(
m
->
ue_list
==
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: out of memory
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
m
->
ue_list
[
m
->
ue_count
-
1
]
=
calloc
(
1
,
sizeof
(
nr_pdcp_ue_t
));
if
(
m
->
ue_list
[
m
->
ue_count
-
1
]
==
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: out of memory
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
m
->
ue_list
[
m
->
ue_count
-
1
]
->
rnti
=
rnti
;
return
m
->
ue_list
[
m
->
ue_count
-
1
];
}
/* must be called with lock acquired */
void
nr_pdcp_manager_remove_ue
(
nr_pdcp_ue_manager_t
*
_m
,
int
rnti
)
{
nr_pdcp_ue_manager_internal_t
*
m
=
_m
;
nr_pdcp_ue_t
*
ue
;
int
i
;
int
j
;
for
(
i
=
0
;
i
<
m
->
ue_count
;
i
++
)
if
(
m
->
ue_list
[
i
]
->
rnti
==
rnti
)
break
;
if
(
i
==
m
->
ue_count
)
{
LOG_D
(
PDCP
,
"%s:%d:%s: warning: ue %d not found
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
rnti
);
return
;
}
ue
=
m
->
ue_list
[
i
];
for
(
j
=
0
;
j
<
2
;
j
++
)
if
(
ue
->
srb
[
j
]
!=
NULL
)
ue
->
srb
[
j
]
->
delete
(
ue
->
srb
[
j
]);
for
(
j
=
0
;
j
<
5
;
j
++
)
if
(
ue
->
drb
[
j
]
!=
NULL
)
ue
->
drb
[
j
]
->
delete
(
ue
->
drb
[
j
]);
free
(
ue
);
m
->
ue_count
--
;
if
(
m
->
ue_count
==
0
)
{
free
(
m
->
ue_list
);
m
->
ue_list
=
NULL
;
return
;
}
memmove
(
&
m
->
ue_list
[
i
],
&
m
->
ue_list
[
i
+
1
],
(
m
->
ue_count
-
i
)
*
sizeof
(
nr_pdcp_ue_t
*
));
m
->
ue_list
=
realloc
(
m
->
ue_list
,
m
->
ue_count
*
sizeof
(
nr_pdcp_ue_t
*
));
if
(
m
->
ue_list
==
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
}
/* must be called with lock acquired */
void
nr_pdcp_ue_add_srb_pdcp_entity
(
nr_pdcp_ue_t
*
ue
,
int
srb_id
,
nr_pdcp_entity_t
*
entity
)
{
if
(
srb_id
<
1
||
srb_id
>
2
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal, bad srb id
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
srb_id
--
;
if
(
ue
->
srb
[
srb_id
]
!=
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal, srb already present
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
ue
->
srb
[
srb_id
]
=
entity
;
}
/* must be called with lock acquired */
void
nr_pdcp_ue_add_drb_pdcp_entity
(
nr_pdcp_ue_t
*
ue
,
int
drb_id
,
nr_pdcp_entity_t
*
entity
)
{
if
(
drb_id
<
1
||
drb_id
>
5
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal, bad drb id
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
drb_id
--
;
if
(
ue
->
drb
[
drb_id
]
!=
NULL
)
{
LOG_E
(
PDCP
,
"%s:%d:%s: fatal, drb already present
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
exit
(
1
);
}
ue
->
drb
[
drb_id
]
=
entity
;
}
openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h
0 → 100644
View file @
14dd67a8
/*
* 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.1 (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
*/
#ifndef _NR_PDCP_UE_MANAGER_H_
#define _NR_PDCP_UE_MANAGER_H_
#include "nr_pdcp_entity.h"
typedef
void
nr_pdcp_ue_manager_t
;
typedef
struct
nr_pdcp_ue_t
{
int
rnti
;
nr_pdcp_entity_t
*
srb
[
2
];
nr_pdcp_entity_t
*
drb
[
5
];
}
nr_pdcp_ue_t
;
/***********************************************************************/
/* manager functions */
/***********************************************************************/
nr_pdcp_ue_manager_t
*
new_nr_pdcp_ue_manager
(
int
enb_flag
);
int
nr_pdcp_manager_get_enb_flag
(
nr_pdcp_ue_manager_t
*
m
);
void
nr_pdcp_manager_lock
(
nr_pdcp_ue_manager_t
*
m
);
void
nr_pdcp_manager_unlock
(
nr_pdcp_ue_manager_t
*
m
);
nr_pdcp_ue_t
*
nr_pdcp_manager_get_ue
(
nr_pdcp_ue_manager_t
*
m
,
int
rnti
);
void
nr_pdcp_manager_remove_ue
(
nr_pdcp_ue_manager_t
*
m
,
int
rnti
);
/***********************************************************************/
/* ue functions */
/***********************************************************************/
void
nr_pdcp_ue_add_srb_pdcp_entity
(
nr_pdcp_ue_t
*
ue
,
int
srb_id
,
nr_pdcp_entity_t
*
entity
);
void
nr_pdcp_ue_add_drb_pdcp_entity
(
nr_pdcp_ue_t
*
ue
,
int
drb_id
,
nr_pdcp_entity_t
*
entity
);
#endif
/* _NR_PDCP_UE_MANAGER_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment