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
lizhongxiao
OpenXG-RAN
Commits
d8cb2491
Commit
d8cb2491
authored
1 year ago
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve handling of SRBs at RRC UE
parent
afc75c5d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
249 additions
and
298 deletions
+249
-298
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
+24
-6
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h
+12
-0
openair2/RRC/NR/nr_rrc_common.h
openair2/RRC/NR/nr_rrc_common.h
+14
-13
openair2/RRC/NR_UE/L2_interface_ue.c
openair2/RRC/NR_UE/L2_interface_ue.c
+6
-5
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+178
-266
openair2/RRC/NR_UE/rrc_defs.h
openair2/RRC/NR_UE/rrc_defs.h
+15
-8
No files found.
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
View file @
d8cb2491
...
...
@@ -757,21 +757,27 @@ void deliver_pdu_srb_rlc(void *deliver_pdu_data, ue_id_t ue_id, int srb_id,
enqueue_rlc_data_req
(
&
ctxt
,
1
,
MBMS_FLAG_NO
,
srb_id
,
sdu_id
,
0
,
size
,
memblock
);
}
static
void
add_srb
(
int
is_gnb
,
ue_id_t
rntiMaybeUEid
,
struct
NR_SRB_ToAddMod
*
s
,
int
ciphering_algorithm
,
int
integrity_algorithm
,
unsigned
char
*
ciphering_key
,
unsigned
char
*
integrity_key
)
void
add_srb
(
int
is_gnb
,
ue_id_t
rntiMaybeUEid
,
struct
NR_SRB_ToAddMod
*
s
,
int
ciphering_algorithm
,
int
integrity_algorithm
,
unsigned
char
*
ciphering_key
,
unsigned
char
*
integrity_key
)
{
nr_pdcp_entity_t
*
pdcp_srb
;
nr_pdcp_ue_t
*
ue
;
int
t_Reordering
=
3000
;
int
srb_id
=
s
->
srb_Identity
;
if
(
s
->
pdcp_Config
==
NULL
||
s
->
pdcp_Config
->
t_Reordering
==
NULL
)
t_Reordering
=
3000
;
else
t_Reordering
=
decode_t_reordering
(
*
s
->
pdcp_Config
->
t_Reordering
);
int
t_Reordering
=
-
1
;
// infinity as per default SRB configuration in 9.2.1 of 38.331
if
(
s
->
pdcp_Config
!=
NULL
&&
s
->
pdcp_Config
->
t_Reordering
!=
NULL
)
t_Reordering
=
decode_t_reordering
(
*
s
->
pdcp_Config
->
t_Reordering
);
nr_pdcp_manager_lock
(
nr_pdcp_ue_manager
);
ue
=
nr_pdcp_manager_get_ue
(
nr_pdcp_ue_manager
,
rntiMaybeUEid
);
if
(
ue
->
srb
[
srb_id
-
1
]
!=
NULL
)
{
LOG_
D
(
PDCP
,
"%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
srb_id
,
rntiMaybeUEid
);
LOG_
E
(
PDCP
,
"%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
,
srb_id
,
rntiMaybeUEid
);
}
else
{
pdcp_srb
=
new_nr_pdcp_entity
(
NR_PDCP_SRB
,
is_gnb
,
srb_id
,
0
,
false
,
false
,
// sdap parameters
...
...
@@ -1061,6 +1067,18 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id,
return
1
;
}
void
nr_pdcp_reconfigure_srb
(
ue_id_t
ue_id
,
int
srb_id
,
long
t_Reordering
)
{
nr_pdcp_manager_lock
(
nr_pdcp_ue_manager
);
nr_pdcp_ue_t
*
ue
=
nr_pdcp_manager_get_ue
(
nr_pdcp_ue_manager
,
ue_id
);
nr_pdcp_entity_t
*
srb
=
ue
->
srb
[
srb_id
-
1
];
int
decoded_t_reordering
=
decode_t_reordering
(
t_Reordering
);
srb
->
t_reordering
=
decoded_t_reordering
;
nr_pdcp_manager_unlock
(
nr_pdcp_ue_manager
);
}
void
nr_pdcp_reestablishment
(
ue_id_t
ue_id
)
{
// TODO implement this on a per RB basis following TS 38.323 Sec 5.1.2
...
...
This diff is collapsed.
Click to expand it.
openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h
View file @
d8cb2491
...
...
@@ -59,6 +59,18 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
bool
nr_pdcp_remove_UE
(
ue_id_t
ue_id
);
void
nr_pdcp_reestablishment
(
ue_id_t
ue_id
);
void
nr_pdcp_reconfigure_srb
(
ue_id_t
ue_id
,
int
srb_id
,
long
t_Reordering
);
void
add_srb
(
int
is_gnb
,
ue_id_t
rntiMaybeUEid
,
struct
NR_SRB_ToAddMod
*
s
,
int
ciphering_algorithm
,
int
integrity_algorithm
,
unsigned
char
*
ciphering_key
,
unsigned
char
*
integrity_key
);
void
nr_pdcp_config_set_security
(
ue_id_t
ue_id
,
const
rb_id_t
rb_id
,
const
uint8_t
security_modeP
,
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/NR/nr_rrc_common.h
View file @
d8cb2491
...
...
@@ -28,6 +28,7 @@
#define NR_RRC_HEADER_SIZE_MAX 64
#define NR_RRC_BUFFER_SIZE_MAX 1024
#define NR_NUM_SRB 4
typedef
struct
{
char
Payload
[
NR_RRC_BUFFER_SIZE_MAX
];
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/NR_UE/L2_interface_ue.c
View file @
d8cb2491
...
...
@@ -133,14 +133,15 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
switch
(
Srb_id
)
{
case
CCCH
:
LOG_D
(
NR_RRC
,
"nr_mac_rrc_data_req_ue: Payload size = %i
\n
"
,
NR_UE_rrc_inst
[
Mod_idP
].
Srb0
[
gNB_id
].
Tx_buffer
.
payload_size
);
memcpy
(
buffer_pP
,
(
uint8_t
*
)
NR_UE_rrc_inst
[
Mod_idP
].
Srb0
[
gNB_id
].
Tx_buffer
.
Payload
,
NR_UE_rrc_inst
[
Mod_idP
].
Srb0
[
gNB_id
].
Tx_buffer
.
payload_size
);
for
(
int
i
=
0
;
i
<
NR_UE_rrc_inst
[
Mod_idP
].
Srb0
[
gNB_id
].
Tx_buffer
.
payload_size
;
i
++
)
{
LOG_D
(
NR_RRC
,
"nr_mac_rrc_data_req_ue: Payload size = %i
\n
"
,
NR_UE_rrc_inst
[
Mod_idP
].
Srb
[
gNB_id
][
0
].
srb_buffers
.
Tx_buffer
.
payload_size
);
NR_UE_RRC_SRB_INFO_t
*
Srb0
=
&
NR_UE_rrc_inst
[
Mod_idP
].
Srb
[
gNB_id
][
0
];
memcpy
(
buffer_pP
,
(
uint8_t
*
)
Srb0
->
srb_buffers
.
Tx_buffer
.
Payload
,
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
);
for
(
int
i
=
0
;
i
<
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
;
i
++
)
{
LOG_D
(
NR_RRC
,
"(%i): %i
\n
"
,
i
,
buffer_pP
[
i
]);
}
return
NR_UE_rrc_inst
[
Mod_idP
].
Srb0
[
gNB_id
]
.
Tx_buffer
.
payload_size
;
return
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
;
case
DCCH
:
AssertFatal
(
1
==
0
,
"SRB1 not implemented yet!
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/NR_UE/rrc_UE.c
View file @
d8cb2491
...
...
@@ -120,26 +120,6 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
mui_t
nr_rrc_mui
=
0
;
static
void
nr_rrc_addmod_srbs
(
int
rnti
,
const
NR_SRB_ToAddModList_t
*
srb_list
,
const
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
bearer_list
)
{
if
(
srb_list
==
NULL
||
bearer_list
==
NULL
)
return
;
for
(
int
i
=
0
;
i
<
srb_list
->
list
.
count
;
i
++
)
{
const
NR_SRB_ToAddMod_t
*
srb
=
srb_list
->
list
.
array
[
i
];
for
(
int
j
=
0
;
j
<
bearer_list
->
list
.
count
;
j
++
)
{
const
NR_RLC_BearerConfig_t
*
bearer
=
bearer_list
->
list
.
array
[
j
];
if
(
bearer
->
servedRadioBearer
!=
NULL
&&
bearer
->
servedRadioBearer
->
present
==
NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity
&&
srb
->
srb_Identity
==
bearer
->
servedRadioBearer
->
choice
.
srb_Identity
)
{
nr_rlc_add_srb
(
rnti
,
srb
->
srb_Identity
,
bearer
);
}
}
}
}
static
void
nr_rrc_addmod_drbs
(
int
rnti
,
const
NR_DRB_ToAddModList_t
*
drb_list
,
const
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
bearer_list
)
...
...
@@ -163,8 +143,8 @@ static void nr_rrc_addmod_drbs(int rnti,
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
int8_t
nr_rrc_ue_decode_secondary_cellgroup_config
(
const
module_id_t
module_id
,
const
uint8_t
*
buffer
,
const
uint32_t
size
)
{
const
uint32_t
size
)
{
NR_CellGroupConfig_t
*
cell_group_config
=
NULL
;
uint32_t
i
;
...
...
@@ -322,7 +302,6 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
protocol_ctxt_t
ctxt
;
NR_UE_MAC_INST_t
*
mac
=
get_mac_inst
(
module_id
);
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
module_id
,
ENB_FLAG_YES
,
mac
->
crnti
,
0
,
0
,
0
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_RadioBearerConfig
,
(
const
void
*
)
RadioBearerConfig
);
LOG_D
(
NR_RRC
,
"Calling nr_rrc_ue_process_RadioBearerConfig() at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld
\n
"
,
__LINE__
,
RadioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
0
]
->
cnAssociation
->
choice
.
eps_BearerIdentity
,
RadioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
0
]
->
drb_Identity
,
...
...
@@ -357,15 +336,19 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* reconfig_fi
rrc
->
ubwpd
=
NULL
;
rrc
->
as_security_activated
=
false
;
for
(
int
i
=
0
;
i
<
NB_
SIG_CNX_UE
;
i
++
)
for
(
int
i
=
0
;
i
<
NB_
CNX_UE
;
i
++
)
{
memset
((
void
*
)
&
rrc
->
SInfo
[
i
],
0
,
sizeof
(
rrc
->
SInfo
[
i
]));
for
(
int
j
=
0
;
j
<
NR_NUM_SRB
;
j
++
)
memset
((
void
*
)
&
rrc
->
Srb
[
i
][
j
],
0
,
sizeof
(
rrc
->
Srb
[
i
][
j
]));
// SRB0 activated by default
rrc
->
Srb
[
i
][
0
].
status
=
RB_ESTABLISHED
;
}
rrc
->
ra_trigger
=
RA_NOT_RUNNING
;
}
NR_UE_rrc_inst
->
uecap_file
=
uecap_file
;
if
(
get_softmodem_params
()
->
phy_test
==
1
||
get_softmodem_params
()
->
do_ra
==
1
)
{
if
(
get_softmodem_params
()
->
phy_test
==
1
||
get_softmodem_params
()
->
do_ra
==
1
)
{
// read in files for RRCReconfiguration and RBconfig
LOG_I
(
NR_RRC
,
"using %s for rrc init[1/2]
\n
"
,
reconfig_file
);
...
...
@@ -407,11 +390,6 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* reconfig_fi
return
NR_UE_rrc_inst
;
}
int8_t
nr_ue_process_rlc_bearer_list
(
NR_CellGroupConfig_t
*
cell_group_config
){
return
0
;
}
int8_t
nr_ue_process_secondary_cell_list
(
NR_CellGroupConfig_t
*
cell_group_config
){
return
0
;
...
...
@@ -998,20 +976,22 @@ static void rrc_ue_generate_RRCSetupComplete(
nr_pdcp_data_req_srb
(
ctxt_pP
->
rntiMaybeUEid
,
DCCH
,
nr_rrc_mui
++
,
size
,
buffer
,
deliver_pdu_srb_rlc
,
NULL
);
}
int8_t
nr_rrc_ue_decode_ccch
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
NR_
SRB_INFO
*
const
Srb_info
,
const
uint8_t
gNB_index
)
int8_t
nr_rrc_ue_decode_ccch
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
NR_
UE_RRC_SRB_INFO_t
*
Srb_info
,
const
uint8_t
gNB_index
)
{
NR_UE_RRC_INST_t
*
rrc
=
&
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
];
NR_DL_CCCH_Message_t
*
dl_ccch_msg
=
NULL
;
asn_dec_rval_t
dec_rval
;
int
rval
=
0
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH
,
VCD_FUNCTION_IN
);
LOG_D
(
RRC
,
"[NR UE%d] Decoding DL-CCCH message (%d bytes), State %d
\n
"
,
ctxt_pP
->
module_id
,
Srb_info
->
Rx_buffer
.
payload_size
,
LOG_D
(
RRC
,
"[NR UE%d] Decoding DL-CCCH message (%d bytes), State %d
\n
"
,
ctxt_pP
->
module_id
,
Srb_info
->
srb_buffers
.
Rx_buffer
.
payload_size
,
rrc
->
nrRrcState
);
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_DL_CCCH_Message
,
(
void
**
)
&
dl_ccch_msg
,
(
uint8_t
*
)
Srb_info
->
Rx_buffer
.
Payload
,
Srb_info
->
Rx_buffer
.
payload_size
,
0
,
0
);
(
uint8_t
*
)
Srb_info
->
srb_buffers
.
Rx_buffer
.
Payload
,
Srb_info
->
srb_buffers
.
Rx_buffer
.
payload_size
,
0
,
0
);
// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint
(
stdout
,
&
asn_DEF_NR_DL_CCCH_Message
,(
void
*
)
dl_ccch_msg
);
...
...
@@ -1305,14 +1285,14 @@ void nr_rrc_ue_process_securityModeCommand(const protocol_ctxt_t *const ctxt_pP,
securityModeCommand
->
criticalExtensions
.
present
);
}
//-----------------------------------------------------------------------------
void
nr_rrc_ue_generate_RRCSetupRequest
(
module_id_t
module_id
,
const
uint8_t
gNB_index
)
{
uint8_t
i
=
0
,
rv
[
6
];
if
(
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
==
0
)
{
void
nr_rrc_ue_generate_RRCSetupRequest
(
module_id_t
module_id
,
const
uint8_t
gNB_index
)
{
uint8_t
rv
[
6
];
NR_UE_RRC_SRB_INFO_t
*
Srb0
=
&
NR_UE_rrc_inst
[
module_id
].
Srb
[
gNB_index
][
0
];
if
(
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
==
0
)
{
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
#ifdef SMBV
// if SMBV is configured the contention resolution needs to be fix for the connection procedure to succeed
rv
[
i
]
=
i
;
...
...
@@ -1323,57 +1303,20 @@ void nr_rrc_ue_process_securityModeCommand(const protocol_ctxt_t *const ctxt_pP,
}
LOG_T
(
NR_RRC
,
"
\n
"
);
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
=
do_RRCSetupRequest
(
module_id
,
(
uint8_t
*
)
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
,
sizeof
(
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
),
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
=
do_RRCSetupRequest
(
module_id
,
(
uint8_t
*
)
Srb0
->
srb_buffers
.
Tx_buffer
.
Payload
,
sizeof
(
Srb0
->
srb_buffers
.
Tx_buffer
.
Payload
),
rv
);
LOG_I
(
NR_RRC
,
"[UE %d] : Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)
\n
"
,
module_id
,
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
]
.
Tx_buffer
.
payload_size
,
gNB_index
);
module_id
,
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
,
gNB_index
);
for
(
i
=
0
;
i
<
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
;
i
++
)
{
LOG_T
(
NR_RRC
,
"%x."
,
NR_UE_rrc_inst
[
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
[
i
]);
//printf("%x.",NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload[i]);
}
for
(
int
i
=
0
;
i
<
Srb0
->
srb_buffers
.
Tx_buffer
.
payload_size
;
i
++
)
LOG_T
(
NR_RRC
,
"%x."
,
Srb0
->
srb_buffers
.
Tx_buffer
.
Payload
[
i
]);
LOG_T
(
NR_RRC
,
"
\n
"
);
//printf("\n");
/*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff;
UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
}
}
//-----------------------------------------------------------------------------
int32_t
nr_rrc_ue_establish_srb1
(
module_id_t
ue_mod_idP
,
frame_t
frameP
,
uint8_t
gNB_index
,
NR_SRB_ToAddMod_t
*
SRB_config
)
//-----------------------------------------------------------------------------
{
// add descriptor from RRC PDU
NR_UE_rrc_inst
[
ue_mod_idP
].
Srb1
[
gNB_index
].
Active
=
1
;
NR_UE_rrc_inst
[
ue_mod_idP
].
Srb1
[
gNB_index
].
status
=
RADIO_CONFIG_OK
;
// RADIO CFG
LOG_I
(
NR_RRC
,
"[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d
\n
"
,
ue_mod_idP
,
DCCH
,
gNB_index
);
return
(
0
);
}
int32_t
nr_rrc_ue_establish_srb2
(
module_id_t
ue_mod_idP
,
frame_t
frameP
,
uint8_t
gNB_index
,
NR_SRB_ToAddMod_t
*
SRB_config
)
{
// add descriptor from RRC PDU
NR_UE_rrc_inst
[
ue_mod_idP
].
Srb2
[
gNB_index
].
Active
=
1
;
NR_UE_rrc_inst
[
ue_mod_idP
].
Srb2
[
gNB_index
].
status
=
RADIO_CONFIG_OK
;
// RADIO CFG
LOG_I
(
NR_RRC
,
"[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d
\n
"
,
ue_mod_idP
,
DCCH1
,
gNB_index
);
return
(
0
);
}
int32_t
nr_rrc_ue_establish_drb
(
module_id_t
ue_mod_idP
,
frame_t
frameP
,
uint8_t
gNB_index
,
...
...
@@ -1540,35 +1483,33 @@ int32_t nr_rrc_ue_establish_drb(module_id_t ue_mod_idP,
}
}
//-----------------------------------------------------------------------------
void
nr_rrc_ue_process_RadioBearerConfig
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
,
NR_RadioBearerConfig_t
*
const
radioBearerConfig
)
//-----------------------------------------------------------------------------
{
long
SRB_id
,
DRB_id
;
int
i
,
cnt
;
if
(
radioBearerConfig
->
srb3_ToRelease
!=
NULL
){
if
(
*
radioBearerConfig
->
srb3_ToRelease
==
true
){
//TODO (release the PDCP entity and the srb-Identity of the SRB3.)
}
}
void
nr_rrc_ue_process_RadioBearerConfig
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
,
NR_RadioBearerConfig_t
*
const
radioBearerConfig
)
{
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
))
xer_fprint
(
stdout
,
&
asn_DEF_NR_RadioBearerConfig
,
(
const
void
*
)
radioBearerConfig
);
NR_UE_RRC_INST_t
*
ue_rrc
=
&
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
];
if
(
radioBearerConfig
->
srb_ToAddModList
!=
NULL
)
{
AssertFatal
(
radioBearerConfig
->
srb3_ToRelease
==
NULL
,
"Release of SRB3 not yet implemented
\n
"
);
uint8_t
kRRCenc
[
16
]
=
{
0
};
uint8_t
kRRCint
[
16
]
=
{
0
};
if
(
ue_rrc
->
as_security_activated
)
{
if
(
radioBearerConfig
->
securityConfig
!=
NULL
)
{
if
(
*
radioBearerConfig
->
securityConfig
->
keyToUse
==
NR_SecurityConfig__keyToUse_master
)
{
// When the field is not included, continue to use the currently configured keyToUse
if
(
radioBearerConfig
->
securityConfig
->
keyToUse
)
{
AssertFatal
(
*
radioBearerConfig
->
securityConfig
->
keyToUse
==
NR_SecurityConfig__keyToUse_master
,
"Secondary key usage seems not to be implemented
\n
"
);
ue_rrc
->
keyToUse
=
*
radioBearerConfig
->
securityConfig
->
keyToUse
;
}
// When the field is not included, continue to use the currently configured security algorithm
if
(
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
)
{
ue_rrc
->
cipheringAlgorithm
=
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
->
cipheringAlgorithm
;
ue_rrc
->
integrityProtAlgorithm
=
*
radioBearerConfig
->
securityConfig
->
securityAlgorithmConfig
->
integrityProtAlgorithm
;
}
}
uint8_t
kRRCenc
[
16
]
=
{
0
};
uint8_t
kRRCint
[
16
]
=
{
0
};
nr_derive_key
(
RRC_ENC_ALG
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
...
...
@@ -1577,58 +1518,31 @@ int32_t nr_rrc_ue_establish_drb(module_id_t ue_mod_idP,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
kRRCint
);
}
// Refresh SRBs
nr_pdcp_add_srbs
(
ctxt_pP
->
enb_flag
,
if
(
radioBearerConfig
->
srb_ToAddModList
!=
NULL
)
{
for
(
int
cnt
=
0
;
cnt
<
radioBearerConfig
->
srb_ToAddModList
->
list
.
count
;
cnt
++
)
{
struct
NR_SRB_ToAddMod
*
srb
=
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
];
NR_UE_RRC_SRB_INFO_t
*
Srb_info
=
&
ue_rrc
->
Srb
[
gNB_index
][
srb
->
srb_Identity
];
if
(
Srb_info
->
status
==
RB_NOT_PRESENT
)
add_srb
(
ctxt_pP
->
enb_flag
,
ctxt_pP
->
rntiMaybeUEid
,
radioBearerConfig
->
srb_ToAddModList
,
ue_rrc
->
cipheringAlgorithm
|
(
ue_rrc
->
integrityProtAlgorithm
<<
4
),
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
ue_rrc
->
cipheringAlgorithm
,
ue_rrc
->
integrityProtAlgorithm
,
kRRCenc
,
kRRCint
);
// Refresh SRBs
nr_rrc_addmod_srbs
(
ctxt_pP
->
rntiMaybeUEid
,
radioBearerConfig
->
srb_ToAddModList
,
ue_rrc
->
cell_group_config
->
rlc_BearerToAddModList
);
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
srb_ToAddModList
->
list
.
count
;
cnt
++
)
{
SRB_id
=
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
]
->
srb_Identity
;
LOG_D
(
NR_RRC
,
"[UE %d]: Frame %d SRB config cnt %d (SRB%ld)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
cnt
,
SRB_id
);
if
(
SRB_id
==
1
)
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
SRB1_config
[
gNB_index
])
{
memcpy
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
SRB1_config
[
gNB_index
],
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_SRB_ToAddMod_t
));
}
else
{
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
SRB1_config
[
gNB_index
]
=
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
];
nr_rrc_ue_establish_srb1
(
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
gNB_index
,
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
]);
LOG_I
(
NR_RRC
,
"[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 gNB %d) --->][MAC_UE][MOD %02d][]
\n
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
gNB_index
,
ctxt_pP
->
module_id
);
nr_rrc_mac_config_req_ue_logicalChannelBearer
(
ctxt_pP
->
module_id
,
0
,
gNB_index
,
1
,
true
);
//todo handle mac_LogicalChannelConfig
// rrc_mac_config_req_ue
else
{
AssertFatal
(
srb
->
discardOnPDCP
,
"discardOnPDCP not yet implemented
\n
"
);
AssertFatal
(
srb
->
reestablishPDCP
,
"reestablishPDCP not yet implemented
\n
"
);
if
(
srb
->
pdcp_Config
&&
srb
->
pdcp_Config
->
t_Reordering
)
nr_pdcp_reconfigure_srb
(
ctxt_pP
->
rntiMaybeUEid
,
srb
->
srb_Identity
,
*
srb
->
pdcp_Config
->
t_Reordering
);
}
}
else
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
SRB2_config
[
gNB_index
])
{
memcpy
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
SRB2_config
[
gNB_index
],
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_SRB_ToAddMod_t
));
}
else
{
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
SRB2_config
[
gNB_index
]
=
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
];
nr_rrc_ue_establish_srb2
(
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
gNB_index
,
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
]);
LOG_I
(
NR_RRC
,
"[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 gNB %d) --->][MAC_UE][MOD %02d][]
\n
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
gNB_index
,
ctxt_pP
->
module_id
);
nr_rrc_mac_config_req_ue_logicalChannelBearer
(
ctxt_pP
->
module_id
,
0
,
gNB_index
,
2
,
true
);
//todo handle mac_LogicalChannelConfig
// rrc_mac_config_req_ue
Srb_info
->
status
=
RB_ESTABLISHED
;
}
}
// srb2
}
}
// srb_ToAddModList
// Establish DRBs if present
if
(
radioBearerConfig
->
drb_ToAddModList
!=
NULL
)
{
...
...
@@ -1638,18 +1552,17 @@ int32_t nr_rrc_ue_establish_drb(module_id_t ue_mod_idP,
*
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
defaultDRB
=
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
0
]
->
drb_Identity
;
}
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
drb_ToAddModList
->
list
.
count
;
cnt
++
)
{
DRB_id
=
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
cnt
]
->
drb_Identity
;
for
(
int
cnt
=
0
;
cnt
<
radioBearerConfig
->
drb_ToAddModList
->
list
.
count
;
cnt
++
)
{
int
DRB_id
=
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
cnt
]
->
drb_Identity
;
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
DRB_config
[
gNB_index
][
DRB_id
-
1
])
{
memcpy
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
DRB_config
[
gNB_index
][
DRB_id
-
1
],
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
cnt
],
sizeof
(
NR_DRB_ToAddMod_t
));
}
else
{
//LOG_D(NR_RRC, "Adding DRB %ld %p\n", DRB_id-1, radioBearerConfig->drb_ToAddModList->list.array[cnt]);
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
DRB_config
[
gNB_index
][
DRB_id
-
1
]
=
radioBearerConfig
->
drb_ToAddModList
->
list
.
array
[
cnt
];
int
j
;
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
rlc_bearer2add_list
=
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cell_group_config
->
rlc_BearerToAddModList
;
if
(
rlc_bearer2add_list
!=
NULL
)
{
for
(
j
=
0
;
j
<
rlc_bearer2add_list
->
list
.
count
;
j
++
){
for
(
int
j
=
0
;
j
<
rlc_bearer2add_list
->
list
.
count
;
j
++
){
if
(
rlc_bearer2add_list
->
list
.
array
[
j
]
->
servedRadioBearer
!=
NULL
){
if
(
rlc_bearer2add_list
->
list
.
array
[
j
]
->
servedRadioBearer
->
present
==
NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity
){
if
(
DRB_id
==
rlc_bearer2add_list
->
list
.
array
[
j
]
->
servedRadioBearer
->
choice
.
drb_Identity
){
...
...
@@ -1691,14 +1604,14 @@ int32_t nr_rrc_ue_establish_drb(module_id_t ue_mod_idP,
}
// drb_ToAddModList //
if
(
radioBearerConfig
->
drb_ToReleaseList
!=
NULL
)
{
for
(
i
=
0
;
i
<
radioBearerConfig
->
drb_ToReleaseList
->
list
.
count
;
i
++
)
{
DRB_id
=
*
radioBearerConfig
->
drb_ToReleaseList
->
list
.
array
[
i
];
for
(
int
i
=
0
;
i
<
radioBearerConfig
->
drb_ToReleaseList
->
list
.
count
;
i
++
)
{
int
DRB_id
=
*
radioBearerConfig
->
drb_ToReleaseList
->
list
.
array
[
i
];
free
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
DRB_config
[
gNB_index
][
DRB_id
-
1
]);
}
}
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cell_group_config
->
rlc_BearerToReleaseList
!=
NULL
)
{
for
(
i
=
0
;
i
<
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cell_group_config
->
rlc_BearerToReleaseList
->
list
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cell_group_config
->
rlc_BearerToReleaseList
->
list
.
count
;
i
++
)
{
NR_LogicalChannelIdentity_t
lcid
=
*
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cell_group_config
->
rlc_BearerToReleaseList
->
list
.
array
[
i
];
LOG_I
(
NR_RRC
,
"[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (RB lcid %ld gNB %d release) --->][MAC_UE][MOD %02d][]
\n
"
,
ctxt_pP
->
frame
,
ctxt_pP
->
module_id
,
lcid
,
0
,
ctxt_pP
->
module_id
);
...
...
@@ -1708,7 +1621,7 @@ int32_t nr_rrc_ue_establish_drb(module_id_t ue_mod_idP,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
nrRrcState
=
RRC_STATE_CONNECTED_NR
;
LOG_I
(
NR_RRC
,
"[UE %d] State = NR_RRC_CONNECTED (gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
gNB_index
);
}
}
//-----------------------------------------------------------------------------
static
void
rrc_ue_process_rrcReconfiguration
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
...
...
@@ -1932,7 +1845,6 @@ void *rrc_nrue_task(void *args_p)
instance_t
instance
;
unsigned
int
ue_mod_id
;
int
result
;
NR_SRB_INFO
*
srb_info_p
;
protocol_ctxt_t
ctxt
;
itti_mark_task_ready
(
TASK_RRC_NRUE
);
...
...
@@ -2008,14 +1920,14 @@ void *rrc_nrue_task(void *args_p)
ITTI_MSG_NAME
(
msg_p
),
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
frame
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
gnb_index
);
srb_info_p
=
&
NR_UE_rrc_inst
[
ue_mod_id
].
Srb0
[
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
gnb_index
];
memcpy
(
srb
_info_p
->
Rx_buffer
.
Payload
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu
,
NR_UE_RRC_SRB_INFO_t
*
srb0
=
&
NR_UE_rrc_inst
[
ue_mod_id
].
Srb
[
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
gnb_index
][
0
];
memcpy
(
srb
0
->
srb_buffers
.
Rx_buffer
.
Payload
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
);
srb
_info_p
->
Rx_buffer
.
payload_size
=
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
;
srb
0
->
srb_buffers
.
Rx_buffer
.
payload_size
=
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
;
PROTOCOL_CTXT_SET_BY_INSTANCE
(
&
ctxt
,
instance
,
GNB_FLAG_NO
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
rnti
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
frame
,
0
);
// PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NR_RRC_MAC_CCCH_DATA_IND (msg_p).rnti, NR_RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, NR_RRC_MAC_CCCH_DATA_IND (msg_p).gnb_index);
nr_rrc_ue_decode_ccch
(
&
ctxt
,
srb_info_p
,
nr_rrc_ue_decode_ccch
(
&
ctxt
,
srb0
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
gnb_index
);
break
;
...
...
@@ -2077,8 +1989,8 @@ void *rrc_nrue_task(void *args_p)
length
=
do_NR_ULInformationTransfer
(
&
buffer
,
NAS_UPLINK_DATA_REQ
(
msg_p
).
nasMsg
.
length
,
NAS_UPLINK_DATA_REQ
(
msg_p
).
nasMsg
.
data
);
/* Transfer data to PDCP */
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
ue_mod_id
,
GNB_FLAG_NO
,
NR_UE_rrc_inst
[
ue_mod_id
].
rnti
,
0
,
0
,
0
);
// check if SRB2 is created, if yes request data_req on
DCCH1 (SRB2)
rb_id_t
srb_id
=
NR_UE_rrc_inst
[
ue_mod_id
].
S
RB2_config
[
0
]
==
NULL
?
DCCH
:
DCCH
1
;
// check if SRB2 is created, if yes request data_req on
SRB2
rb_id_t
srb_id
=
NR_UE_rrc_inst
[
ue_mod_id
].
S
rb
[
0
][
2
].
status
==
RB_ESTABLISHED
?
2
:
1
;
nr_pdcp_data_req_srb
(
ctxt
.
rntiMaybeUEid
,
srb_id
,
nr_rrc_mui
++
,
length
,
buffer
,
deliver_pdu_srb_rlc
,
NULL
);
break
;
}
...
...
This diff is collapsed.
Click to expand it.
openair2/RRC/NR_UE/rrc_defs.h
View file @
d8cb2491
...
...
@@ -59,8 +59,6 @@
#define NB_NR_UE_INST 1
#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE
#define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE
#define MAX_MEAS_OBJ 7
#define MAX_MEAS_CONFIG 7
#define MAX_MEAS_ID 7
...
...
@@ -178,6 +176,17 @@ typedef enum {
IN_SYNC
=
1
}
nr_sync_msg_t
;
typedef
enum
{
RB_NOT_PRESENT
=
0
,
RB_ESTABLISHED
,
RB_SUSPENDED
}
NR_RB_status_t
;
typedef
struct
NR_UE_RRC_SRB_INFO_s
{
NR_RB_status_t
status
;
NR_SRB_INFO
srb_buffers
;
}
NR_UE_RRC_SRB_INFO_t
;
typedef
struct
NR_UE_RRC_INST_s
{
NR_MeasConfig_t
*
meas_config
;
NR_CellGroupConfig_t
*
cell_group_config
;
...
...
@@ -191,17 +200,14 @@ typedef struct NR_UE_RRC_INST_s {
NR_MeasIdToAddMod_t
*
MeasId
[
NB_CNX_UE
][
MAX_MEAS_ID
];
NR_MeasGapConfig_t
*
measGapConfig
[
NB_CNX_UE
];
NR_RSRP_Range_t
s_measure
;
NR_SRB_ToAddMod_t
*
SRB1_config
[
NB_CNX_UE
];
NR_SRB_ToAddMod_t
*
SRB2_config
[
NB_CNX_UE
];
NR_DRB_ToAddMod_t
*
DRB_config
[
NB_CNX_UE
][
8
];
rb_id_t
*
defaultDRB
;
// remember the ID of the default DRB
char
*
uecap_file
;
rnti_t
rnti
;
NR_SRB_INFO
Srb0
[
NB_SIG_CNX_UE
];
NR_SRB_INFO_TABLE_ENTRY
Srb1
[
NB_CNX_UE
];
NR_SRB_INFO_TABLE_ENTRY
Srb2
[
NB_CNX_UE
];
NR_UE_RRC_SRB_INFO_t
Srb
[
NB_CNX_UE
][
NR_NUM_SRB
];
OAI_NR_UECapability_t
*
UECap
;
uint8_t
*
UECapability
;
...
...
@@ -213,7 +219,7 @@ typedef struct NR_UE_RRC_INST_s {
plmn_t
plmnID
;
NR_UE_RRC_SI_INFO
SInfo
[
NB_
SIG_
CNX_UE
];
NR_UE_RRC_SI_INFO
SInfo
[
NB_CNX_UE
];
NR_MIB_t
*
mib
;
...
...
@@ -227,6 +233,7 @@ typedef struct NR_UE_RRC_INST_s {
//RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list;
NR_CipheringAlgorithm_t
cipheringAlgorithm
;
e_NR_IntegrityProtAlgorithm
integrityProtAlgorithm
;
long
keyToUse
;
bool
as_security_activated
;
long
selected_plmn_identity
;
...
...
This diff is collapsed.
Click to expand it.
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