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
a81b655c
Commit
a81b655c
authored
Sep 15, 2020
by
Xue Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RRC Setup message
parent
b77ecaf2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
339 additions
and
84 deletions
+339
-84
openair2/COMMON/platform_types.h
openair2/COMMON/platform_types.h
+6
-0
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+150
-0
openair2/RRC/NR/MESSAGES/asn1_msg.h
openair2/RRC/NR/MESSAGES/asn1_msg.h
+7
-0
openair2/RRC/NR/nr_rrc_defs.h
openair2/RRC/NR/nr_rrc_defs.h
+2
-2
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+137
-72
openair2/RRC/NR/rrc_gNB_UE_context.c
openair2/RRC/NR/rrc_gNB_UE_context.c
+31
-10
openair2/RRC/NR/rrc_gNB_UE_context.h
openair2/RRC/NR/rrc_gNB_UE_context.h
+6
-0
No files found.
openair2/COMMON/platform_types.h
View file @
a81b655c
...
...
@@ -299,6 +299,12 @@ typedef struct protocol_ctxt_s {
(CTXT_Pp)->module_id, \
(CTXT_Pp)->rnti
#define PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) \
(CTXT_Pp)->frame, \
((CTXT_Pp)->enb_flag == GNB_FLAG_YES) ? "gNB":" UE", \
(CTXT_Pp)->module_id, \
(CTXT_Pp)->rnti
#define CHECK_CTXT_ARGS(CTXT_Pp)
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
a81b655c
...
...
@@ -45,6 +45,15 @@
#include "NR_DL-CCCH-Message.h"
#include "NR_RRCReject.h"
#include "NR_RejectWaitTime.h"
#include "NR_RRCSetup.h"
#include "NR_RRCSetup-IEs.h"
#include "NR_SRB-ToAddModList.h"
#include "NR_CellGroupConfig.h"
#include "NR_RLC-BearerConfig.h"
#include "NR_RLC-Config.h"
#include "NR_LogicalChannelConfig.h"
#include "NR_PDCP-Config.h"
#include "NR_MAC-CellGroupConfig.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
#include "NR_TDD-UL-DL-ConfigCommon.h"
...
...
@@ -619,3 +628,144 @@ uint8_t do_RRCReject(uint8_t Mod_id,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
//------------------------------------------------------------------------------
uint8_t
do_RRCSetup
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_eNB_ue_context_t
*
const
ue_context_pP
,
int
CC_id
,
uint8_t
*
const
buffer
,
const
uint8_t
transaction_id
,
NR_SRB_ToAddModList_t
*
SRB_configList
)
//------------------------------------------------------------------------------
{
asn_enc_rval_t
enc_rval
;;
NR_DL_CCCH_Message_t
dl_ccch_msg
;
NR_RRCSetup_t
*
rrcSetup
;
NR_RRCSetup_IEs_t
*
ie
;
NR_SRB_ToAddMod_t
*
SRB1_config
=
NULL
;
NR_PDCP_Config_t
*
pdcp_Config
=
NULL
;
NR_CellGroupConfig_t
*
cellGroupConfig
=
NULL
;
NR_RLC_BearerConfig_t
*
rlc_BearerConfig
=
NULL
;
NR_RLC_Config_t
*
rlc_Config
=
NULL
;
NR_LogicalChannelConfig_t
*
logicalChannelConfig
=
NULL
;
NR_MAC_CellGroupConfig_t
*
mac_CellGroupConfig
=
NULL
;
char
masterCellGroup_buf
[
1000
];
int
size
=
0
;
long
*
logicalChannelGroup
=
NULL
;
memset
((
void
*
)
&
dl_ccch_msg
,
0
,
sizeof
(
NR_DL_CCCH_Message_t
));
dl_ccch_msg
.
message
.
present
=
NR_DL_CCCH_MessageType_PR_c1
;
dl_ccch_msg
.
message
.
choice
.
c1
->
present
=
NR_DL_CCCH_MessageType__c1_PR_rrcSetup
;
rrcSetup
=
dl_ccch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetup
;
rrcSetup
->
criticalExtensions
.
present
=
NR_RRCSetup__criticalExtensions_PR_rrcSetup
;
rrcSetup
->
rrc_TransactionIdentifier
=
transaction_id
;
ie
=
rrcSetup
->
criticalExtensions
.
choice
.
rrcSetup
;
/****************************** radioBearerConfig ******************************/
/* Configure SRB1 */
if
(
SRB_configList
)
{
free
(
SRB_configList
);
}
SRB_configList
=
calloc
(
1
,
sizeof
(
NR_SRB_ToAddModList_t
));
// SRB1
/* TODO */
SRB1_config
=
calloc
(
1
,
sizeof
(
NR_SRB_ToAddMod_t
));
SRB1_config
->
srb_Identity
=
1
;
// pdcp_Config->t_Reordering
SRB1_config
->
pdcp_Config
=
pdcp_Config
;
ie
->
radioBearerConfig
.
srb_ToAddModList
=
SRB_configList
;
ASN_SEQUENCE_ADD
(
&
SRB_configList
->
list
,
SRB1_config
);
ie
->
radioBearerConfig
.
srb3_ToRelease
=
NULL
;
ie
->
radioBearerConfig
.
drb_ToAddModList
=
NULL
;
ie
->
radioBearerConfig
.
drb_ToReleaseList
=
NULL
;
ie
->
radioBearerConfig
.
securityConfig
=
NULL
;
/****************************** masterCellGroup ******************************/
/* TODO */
cellGroupConfig
=
calloc
(
1
,
sizeof
(
NR_CellGroupConfig_t
));
cellGroupConfig
->
cellGroupId
=
0
;
/* Rlc Bearer Config */
/* TS38.331 9.2.1 Default SRB configurations */
cellGroupConfig
->
rlc_BearerToAddModList
=
calloc
(
1
,
sizeof
(
*
cellGroupConfig
->
rlc_BearerToAddModList
));
rlc_BearerConfig
=
calloc
(
1
,
sizeof
(
NR_RLC_BearerConfig_t
));
rlc_BearerConfig
->
logicalChannelIdentity
=
1
;
rlc_BearerConfig
->
servedRadioBearer
->
present
=
NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity
;
rlc_BearerConfig
->
servedRadioBearer
->
choice
.
srb_Identity
=
1
;
rlc_BearerConfig
->
reestablishRLC
=
NULL
;
rlc_Config
->
present
=
NR_RLC_Config_PR_am
;
rlc_Config
->
choice
.
am
=
calloc
(
1
,
sizeof
(
*
rlc_Config
->
choice
.
am
));
*
(
rlc_Config
->
choice
.
am
->
dl_AM_RLC
.
sn_FieldLength
)
=
NR_SN_FieldLengthAM_size12
;
rlc_Config
->
choice
.
am
->
dl_AM_RLC
.
t_Reassembly
=
NR_T_Reassembly_ms35
;
rlc_Config
->
choice
.
am
->
dl_AM_RLC
.
t_StatusProhibit
=
NR_T_StatusProhibit_ms0
;
*
(
rlc_Config
->
choice
.
am
->
ul_AM_RLC
.
sn_FieldLength
)
=
NR_SN_FieldLengthAM_size12
;
rlc_Config
->
choice
.
am
->
ul_AM_RLC
.
t_PollRetransmit
=
NR_T_PollRetransmit_ms45
;
rlc_Config
->
choice
.
am
->
ul_AM_RLC
.
pollPDU
=
NR_PollPDU_infinity
;
rlc_Config
->
choice
.
am
->
ul_AM_RLC
.
pollByte
=
NR_PollByte_infinity
;
rlc_Config
->
choice
.
am
->
ul_AM_RLC
.
maxRetxThreshold
=
NR_UL_AM_RLC__maxRetxThreshold_t8
;
rlc_BearerConfig
->
rlc_Config
=
rlc_Config
;
logicalChannelConfig
=
calloc
(
1
,
sizeof
(
NR_LogicalChannelConfig_t
));
logicalChannelConfig
->
ul_SpecificParameters
->
priority
=
1
;
logicalChannelConfig
->
ul_SpecificParameters
->
prioritisedBitRate
=
NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity
;
logicalChannelGroup
=
CALLOC
(
1
,
sizeof
(
long
));
*
logicalChannelGroup
=
0
;
logicalChannelConfig
->
ul_SpecificParameters
->
logicalChannelGroup
=
logicalChannelGroup
;
rlc_BearerConfig
->
mac_LogicalChannelConfig
=
logicalChannelConfig
;
ASN_SEQUENCE_ADD
(
&
cellGroupConfig
->
rlc_BearerToAddModList
->
list
,
rlc_BearerConfig
);
/* mac CellGroup Config */
mac_CellGroupConfig
=
calloc
(
1
,
sizeof
(
NR_MAC_CellGroupConfig_t
));
mac_CellGroupConfig
->
bsr_Config
=
calloc
(
1
,
sizeof
(
*
mac_CellGroupConfig
->
bsr_Config
));
mac_CellGroupConfig
->
bsr_Config
->
periodicBSR_Timer
=
NR_BSR_Config__periodicBSR_Timer_sf10
;
mac_CellGroupConfig
->
bsr_Config
->
retxBSR_Timer
=
NR_BSR_Config__retxBSR_Timer_sf80
;
mac_CellGroupConfig
->
phr_Config
=
calloc
(
1
,
sizeof
(
*
mac_CellGroupConfig
->
phr_Config
));
mac_CellGroupConfig
->
phr_Config
->
present
=
NR_SetupRelease_PHR_Config_PR_setup
;
mac_CellGroupConfig
->
phr_Config
->
choice
.
setup
=
calloc
(
1
,
sizeof
(
*
mac_CellGroupConfig
->
phr_Config
->
choice
.
setup
));
mac_CellGroupConfig
->
phr_Config
->
choice
.
setup
->
phr_PeriodicTimer
=
NR_PHR_Config__phr_PeriodicTimer_sf10
;
mac_CellGroupConfig
->
phr_Config
->
choice
.
setup
->
phr_ProhibitTimer
=
NR_PHR_Config__phr_ProhibitTimer_sf10
;
mac_CellGroupConfig
->
phr_Config
->
choice
.
setup
->
phr_Tx_PowerFactorChange
=
NR_PHR_Config__phr_Tx_PowerFactorChange_dB1
;
cellGroupConfig
->
mac_CellGroupConfig
=
mac_CellGroupConfig
;
// cellGroupConfig.physicalCellGroupConfig;
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_CellGroupConfig
,
NULL
,
(
void
*
)
cellGroupConfig
,
masterCellGroup_buf
,
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_E
(
RRC
,
"ASN1 message CellGroupConfig encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
}
if
(
OCTET_STRING_fromBuf
(
&
ie
->
masterCellGroup
,
masterCellGroup_buf
,
(
enc_rval
.
encoded
+
7
)
/
8
)
==
-
1
)
{
LOG_E
(
RRC
,
"fatal: OCTET_STRING_fromBuf failed
\n
"
);
return
-
1
;
}
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
xer_fprint
(
stdout
,
&
asn_DEF_NR_DL_CCCH_Message
,
(
void
*
)
&
dl_ccch_msg
);
}
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_DL_CCCH_Message
,
NULL
,
(
void
*
)
&
dl_ccch_msg
,
buffer
,
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_E
(
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
}
LOG_D
(
RRC
,
"RRCSetup Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
openair2/RRC/NR/MESSAGES/asn1_msg.h
View file @
a81b655c
...
...
@@ -85,3 +85,10 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
uint8_t
do_RRCReject
(
uint8_t
Mod_id
,
uint8_t
*
const
buffer
);
uint8_t
do_RRCSetup
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_eNB_ue_context_t
*
const
ue_context_pP
,
int
CC_id
,
uint8_t
*
const
buffer
,
const
uint8_t
transaction_id
,
NR_SRB_ToAddModList_t
*
SRB_configList
);
openair2/RRC/NR/nr_rrc_defs.h
View file @
a81b655c
...
...
@@ -90,10 +90,10 @@ typedef struct nr_uid_linear_allocator_s {
#define PROTOCOL_NR_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT
#define PROTOCOL_NR_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
#define PROTOCOL_NR_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_
NR_
CTXT_ARGS(CTXT_Pp)
#define PROTOCOL_NR_RRC_CTXT_FMT PROTOCOL_CTXT_FMT
#define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
#define PROTOCOL_NR_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_
NR_
CTXT_ARGS(CTXT_Pp)
#define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
...
...
openair2/RRC/NR/rrc_gNB.c
View file @
a81b655c
...
...
@@ -56,6 +56,7 @@
#include "rlc.h"
#include "rrc_eNB_UE_context.h"
#include "rrc_gNB_UE_context.h"
#include "platform_types.h"
#include "msc.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
...
...
@@ -300,66 +301,119 @@ void rrc_gNB_process_AdditionRequestInformation(const module_id_t gnb_mod_idP, x
}
//-----------------------------------------------------------------------------
// return the ue context if there is already an UE with the same S-TMSI, NULL otherwise
static
struct
rrc_gNB_ue_context_s
*
rrc_gNB_ue_context_5g_stmsi_exist
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
NR_NG_5G_S_TMSI_t
*
s_TMSI
uint8_t
rrc_gNB_get_next_transaction_identifier
(
module_id_t
gnb_mod_idP
)
//-----------------------------------------------------------------------------
{
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
uint64_t
s_TMSI_value
=
0
;
// 48-bit
// uint16_t amf_set_id = 0; // 10-bit
// uint8_t amf_pointer = 0; // 6-bit
// uint32_t tmsi = 0; // 32-bit
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
s_TMSI_value
=
*
(
s_TMSI
->
buf
);
// amf_set_id = s_TMSI_value >> 38;
// amf_pointer = (s_TMSI_value >> 32) & 0x3F;
// tmsi = (uint32_t)s_TMSI_value;
RB_FOREACH
(
ue_context_p
,
rrc_nr_ue_tree_s
,
&
(
RC
.
nrrrc
[
ctxt_pP
->
module_id
]
->
rrc_ue_head
))
{
LOG_I
(
RRC
,
"checking for UE 5G S-TMSI %x: rnti %x
\n
"
,
s_TMSI_value
,
ue_context_p
->
ue_context
.
rnti
);
if
(
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
==
s_TMSI_value
)
{
return
ue_context_p
;
}
}
return
NULL
;
static
uint8_t
nr_rrc_transaction_identifier
[
NUMBER_OF_gNB_MAX
];
nr_rrc_transaction_identifier
[
gnb_mod_idP
]
=
(
nr_rrc_transaction_identifier
[
gnb_mod_idP
]
+
1
)
%
NR_RRC_TRANSACTION_IDENTIFIER_NUMBER
;
LOG_T
(
NR_RRC
,
"generated xid is %d
\n
"
,
nr_rrc_transaction_identifier
[
gnb_mod_idP
]);
return
nr_rrc_transaction_identifier
[
gnb_mod_idP
];
}
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_RRCSetup
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
const
int
CC_id
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
const
int
CC_id
)
//-----------------------------------------------------------------------------
{
LOG_I
(
RRC
,
"rrc_gNB_generate_RRCSetup
\n
"
);
NR_SRB_ToAddModList_t
*
SRB_configList
;
// T(T_GNB_RRC_SETUP,
// T_INT(ctxt_pP->module_id),
// T_INT(ctxt_pP->frame),
// T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti));
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
SRB_configList
=
&
ue_p
->
SRB_configList
;
do_RRCSetup
(
ctxt_pP
,
ue_context_pP
,
CC_id
,
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
,
rrc_gNB_get_next_transaction_identifier
(
ctxt_pP
->
module_id
),
SRB_configList
);
LOG_DUMPMSG
(
NR_RRC
,
DEBUG_RRC
,
(
char
*
)(
ue_p
->
Srb0
.
Tx_buffer
.
Payload
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
"[MSG] RRC Setup
\n
"
);
LOG_D
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" RRC_gNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_gNB
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
// rrc_mac_config_req_eNB( ctxt_pP->module_id,
// ue_context_pP->ue_context.primaryCC_id,
// 0,0,0,0,0, 0,
// ue_context_pP->ue_context.rnti,
// NULL,
// NULL,
// NULL,
// ue_context_pP->ue_context.physicalConfigDedicated,
// NULL,
// NULL,
// ue_context_pP->ue_context.mac_MainConfig,
// 1,
// SRB1_logicalChannelConfig,
// ue_context_pP->ue_context.measGapConfig,
// NULL,
// NULL,
// NULL,
// 0, NULL, NULL, NULL,
// 0, NULL, NULL,
// NULL,
// 0,
// NULL,
// NULL,
// NULL,
// NULL,
// NULL,
// NULL);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_GNB
,
MSC_RRC_UE
,
ue_p
->
Srb0
.
Tx_buffer
.
Header
,
// LG WARNING
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
MSC_AS_TIME_FMT
" RRCSetup UE %x size %u"
,
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
->
ue_context
.
rnti
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
LOG_I
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" [RAPROC] Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP
->
ue_context
.
ue_release_timer
=
1
;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP
->
ue_context
.
ue_release_timer_thres
=
1000
;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
}
void
rrc_gNB_generate_RRCReject
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
const
int
CC_id
const
protocol_ctxt_t
*
const
ctxt_pP
,
rrc_gNB_ue_context_t
*
const
ue_context_pP
,
const
int
CC_id
)
//-----------------------------------------------------------------------------
{
LOG_I
(
RRC
,
"rrc_gNB_generate_RRCReject
\n
"
);
LOG_I
(
NR_
RRC
,
"rrc_gNB_generate_RRCReject
\n
"
);
gNB_RRC_UE_t
*
ue_p
=
&
ue_context_pP
->
ue_context
;
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
=
do_RRCReject
(
ctxt_pP
->
module_id
,
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
);
LOG_DUMPMSG
(
RRC
,
DEBUG_RRC
,
LOG_DUMPMSG
(
NR_
RRC
,
DEBUG_RRC
,
(
char
*
)(
ue_p
->
Srb0
.
Tx_buffer
.
Payload
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
"[MSG] RRCReject
\n
"
);
MSC_LOG_TX_MESSAGE
(
MSC_RRC_
E
NB
,
MSC_LOG_TX_MESSAGE
(
MSC_RRC_
G
NB
,
MSC_RRC_UE
,
ue_p
->
Srb0
.
Tx_buffer
.
Header
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
,
...
...
@@ -367,19 +421,18 @@ rrc_gNB_generate_RRCReject(
MSC_AS_TIME_ARGS
(
ctxt_pP
),
ue_context_pP
==
NULL
?
-
1
:
ue_context_pP
->
ue_context
.
rnti
,
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
LOG_I
(
RRC
,
PROTOCOL_RRC_CTXT_UE_FMT
" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)
\n
"
,
PROTOCOL_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
LOG_I
(
NR_
RRC
,
PROTOCOL_
NR_
RRC_CTXT_UE_FMT
" [RAPROC] Logical Channel DL-CCCH, Generating NR_RRCReject (bytes %d)
\n
"
,
PROTOCOL_
NR_
RRC_CTXT_UE_ARGS
(
ctxt_pP
),
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
);
}
/*------------------------------------------------------------------------------*/
int
nr_rrc_
eNB_decode_ccch
(
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
*
buffer
,
int
buffer_length
,
const
int
CC_id
)
int
nr_rrc_
gNB_decode_ccch
(
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
*
buffer
,
int
buffer_length
,
const
int
CC_id
)
{
module_id_t
Idx
;
asn_dec_rval_t
dec_rval
;
NR_UL_CCCH_Message_t
*
ul_ccch_msg
=
NULL
;
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
...
...
@@ -397,8 +450,8 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
if
(
dec_rval
.
consumed
==
0
)
{
/* TODO */
// LOG_E(RRC, PROTOCOL
_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n",
// PROTOCOL
_RRC_CTXT_UE_ARGS(ctxt_pP));
LOG_E
(
NR_RRC
,
PROTOCOL_NR
_RRC_CTXT_UE_FMT
" FATAL Error in receiving CCCH
\n
"
,
PROTOCOL_NR
_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
return
-
1
;
}
...
...
@@ -406,9 +459,9 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
switch
(
ul_ccch_msg
->
message
.
choice
.
c1
->
present
)
{
case
NR_UL_CCCH_MessageType__c1_PR_NOTHING
:
/* TODO */
// LOG_I(
RRC,
// PROTOCOL
_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n",
// PROTOCOL
_RRC_CTXT_ARGS(ctxt_pP));
LOG_I
(
NR_
RRC
,
PROTOCOL_NR
_RRC_CTXT_FMT
" Received PR_NOTHING on UL-CCCH-Message
\n
"
,
PROTOCOL_NR
_RRC_CTXT_ARGS
(
ctxt_pP
));
break
;
case
NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest
:
...
...
@@ -416,7 +469,7 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
if
(
ue_context_p
!=
NULL
)
{
rrc_gNB_free_mem_UE_context
(
ctxt_pP
,
ue_context_p
);
MSC_LOG_RX_DISCARDED_MESSAGE
(
MSC_RRC_
E
NB
,
MSC_RRC_
G
NB
,
MSC_RRC_UE
,
buffer
,
dec_rval
.
consumed
,
...
...
@@ -427,8 +480,9 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
}
else
{
rrcSetupRequest
=
&
ul_ccch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
->
rrcSetupRequest
;
if
(
NR_InitialUE_Identity_PR_randomValue
==
rrcSetupRequest
->
ue_Identity
.
present
)
{
/* randomValue BIT STRING (SIZE (39)) */
if
(
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
!=
5
)
{
// 39-bit random value
LOG_E
(
RRC
,
"wrong InitialUE-Identity randomValue size, expected 5, provided %lu"
,
LOG_E
(
NR_
RRC
,
"wrong InitialUE-Identity randomValue size, expected 5, provided %lu"
,
(
long
unsigned
int
)
rrcSetupRequest
->
ue_Identity
.
choice
.
randomValue
.
size
);
return
-
1
;
}
...
...
@@ -441,7 +495,7 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
* the current one must be removed from MAC/PHY (zombie UE)
*/
if
((
ue_context_p
=
rrc_gNB_ue_context_random_exist
(
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
random_value
)))
{
LOG_W
(
RRC
,
"new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY
\n
"
,
LOG_W
(
NR_
RRC
,
"new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY
\n
"
,
ctxt_pP
->
rnti
,
ue_context_p
->
ue_context
.
rnti
,
ue_context_p
->
ue_context
.
rnti
);
ue_context_p
->
ue_context
.
ul_failure_timer
=
20000
;
}
...
...
@@ -456,15 +510,19 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
}
else
if
(
NR_InitialUE_Identity_PR_ng_5G_S_TMSI_Part1
==
rrcSetupRequest
->
ue_Identity
.
present
)
{
/* TODO */
/* <5G-S-TMSI> = <AMF Set ID><AMF Pointer><5G-TMSI> 48-bit */
NR_NG_5G_S_TMSI_t
s_TMSI
=
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
;
if
(
s_TMSI
.
size
!=
6
)
{
LOG_E
(
RRC
,
"Identity 5G_s_TMSI size, expected 6
, provided %lu
\n
"
,
(
long
unsigned
int
)
s_TMSI
.
size
);
/* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */
if
(
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
!=
5
)
{
LOG_E
(
NR_RRC
,
"wrong InitialUE-Identity 5G_s_TMSI size, expected 5
, provided %lu
\n
"
,
(
long
unsigned
int
)
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
);
return
-
1
;
}
if
((
ue_context_p
=
rrc_gNB_ue_context_5g_stmsi_exist
(
ctxt_pP
,
&
s_TMSI
)))
{
LOG_I
(
RRC
,
" 5G-S-TMSI exists, ue_context_p %p, old rnti %x => %x
\n
"
,
ue_context_p
,
ue_context_p
->
ue_context
.
rnti
,
ctxt_pP
->
rnti
);
memcpy
(((
uint8_t
*
)
&
random_value
)
+
3
,
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
buf
,
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
size
);
if
((
ue_context_p
=
rrc_gNB_ue_context_5g_s_tmsi_exist
(
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
random_value
)))
{
LOG_I
(
NR_RRC
,
" 5G-S-TMSI exists, ue_context_p %p, old rnti %x => %x
\n
"
,
ue_context_p
,
ue_context_p
->
ue_context
.
rnti
,
ctxt_pP
->
rnti
);
rrc_mac_remove_ue
(
ctxt_pP
->
module_id
,
ue_context_p
->
ue_context
.
rnti
);
...
...
@@ -482,23 +540,25 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
ue_context_p
->
ue_context
.
ue_release_timer_s1
=
0
;
ue_context_p
->
ue_context
.
ue_release_timer_rrc
=
0
;
}
else
{
LOG_I
(
RRC
,
" 5G-S-TMSI doesn't exist, setting Initialue_identity_5g_s_TMSI to %p => %x
\n
"
,
ue_context_p
,
*
(
s_TMSI
.
buf
));
LOG_I
(
NR_RRC
,
" 5G-S-TMSI doesn't exist, setting Initialue_identity_5g_s_TMSI to %p => %x
\n
"
,
ue_context_p
,
*
(
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
buf
));
ue_context_p
=
rrc_gNB_get_next_free_ue_context
(
ctxt_pP
,
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
*
(
s_TMSI
.
buf
)
);
ue_context_p
=
rrc_gNB_get_next_free_ue_context
(
ctxt_pP
,
RC
.
nrrrc
[
ctxt_pP
->
module_id
],
random_value
);
if
(
ue_context_p
==
NULL
)
{
LOG_E
(
RRC
,
"%s:%d:%s: rrc_gNB_get_next_free_ue_context returned NULL
\n
"
,
__FILE__
,
__LINE__
,
__FUNCTION__
);
}
if
(
ue_context_p
!=
NULL
)
{
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
=
*
(
s_TMSI
.
buf
);
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
=
*
(
rrcSetupRequest
->
ue_Identity
.
choice
.
ng_5G_S_TMSI_Part1
.
buf
);
}
}
}
else
{
/* TODO */
// LOG_E(
RRC,
// PROTOCOL
_RRC_CTXT_UE_FMT" RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE\n",
// PROTOCOL
_RRC_CTXT_UE_ARGS(ctxt_pP));
LOG_E
(
NR_
RRC
,
PROTOCOL_NR
_RRC_CTXT_UE_FMT
" RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE
\n
"
,
PROTOCOL_NR
_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
rrc_gNB_generate_RRCReject
(
ctxt_pP
,
rrc_gNB_get_ue_context
(
gnb_rrc_inst
,
ctxt_pP
->
rnti
),
CC_id
);
...
...
@@ -516,18 +576,23 @@ int nr_rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
break
;
case
NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest
:
LOG_I
(
NR_RRC
,
"receive rrcResumeRequest message
\n
"
);
/* TODO */
break
;
case
NR_UL_CCCH_MessageType__c1_PR_rrcReestablishmentRequest
:
LOG_I
(
NR_RRC
,
"receive rrcReestablishmentRequest message
\n
"
);
/* TODO */
break
;
case
NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest
:
LOG_I
(
NR_RRC
,
"receive rrcSystemInfoRequest message
\n
"
);
/* TODO */
break
;
default:
/* TODO */
// LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n",
// PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
LOG_E
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" Unknown message
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
break
;
}
}
...
...
@@ -556,35 +621,35 @@ void *rrc_gnb_task(void *args_p) {
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
TERMINATE_MESSAGE
:
LOG_W
(
RRC
,
" *** Exiting NR_RRC thread
\n
"
);
LOG_W
(
NR_
RRC
,
" *** Exiting NR_RRC thread
\n
"
);
itti_exit_task
();
break
;
case
MESSAGE_TEST
:
LOG_I
(
RRC
,
"[gNB %d] Received %s
\n
"
,
instance
,
msg_name_p
);
LOG_I
(
NR_
RRC
,
"[gNB %d] Received %s
\n
"
,
instance
,
msg_name_p
);
break
;
/* Messages from MAC */
case
NR_RRC_MAC_CCCH_DATA_IND
:
// PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt,
// NR_RRC_MAC_CCCH_DATA_IND(msg_p).gnb_index,
//
E
NB_FLAG_YES,
//
G
NB_FLAG_YES,
// NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti,
// msg_p->ittiMsgHeader.lte_time.frame,
// msg_p->ittiMsgHeader.lte_time.slot);
LOG_I
(
RRC
,
"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d
\n
"
,
LOG_I
(
NR_
RRC
,
"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d
\n
"
,
instance
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
CC_id
,
&
ctxt
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
);
if
(
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
>=
CCCH_SDU_SIZE
)
{
LOG_I
(
RRC
,
"CCCH message has size %d > %d
\n
"
,
LOG_I
(
NR_
RRC
,
"CCCH message has size %d > %d
\n
"
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
,
CCCH_SDU_SIZE
);
break
;
}
nr_rrc_
e
NB_decode_ccch
(
&
ctxt
,
nr_rrc_
g
NB_decode_ccch
(
&
ctxt
,
(
uint8_t
*
)
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
sdu_size
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
CC_id
);
...
...
openair2/RRC/NR/rrc_gNB_UE_context.c
View file @
a81b655c
...
...
@@ -189,7 +189,7 @@ void rrc_gNB_free_mem_UE_context(
//------------------------------------------------------------------------------
void
rrc_gNB_remove_ue_context
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
protocol_ctxt_t
*
const
ctxt_pP
,
gNB_RRC_INST
*
rrc_instance_pP
,
struct
rrc_gNB_ue_context_s
*
ue_context_pP
)
//------------------------------------------------------------------------------
...
...
@@ -237,6 +237,27 @@ rrc_gNB_ue_context_random_exist(
return
NULL
;
}
//-----------------------------------------------------------------------------
// return the ue context if there is already an UE with the same S-TMSI, NULL otherwise
struct
rrc_gNB_ue_context_s
*
rrc_gNB_ue_context_5g_s_tmsi_exist
(
gNB_RRC_INST
*
rrc_instance_pP
,
const
uint64_t
s_TMSI
)
//-----------------------------------------------------------------------------
{
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
RB_FOREACH
(
ue_context_p
,
rrc_nr_ue_tree_s
,
&
rrc_instance_pP
->
rrc_ue_head
)
{
LOG_I
(
NR_RRC
,
"checking for UE 5G S-TMSI %x: rnti %x
\n
"
,
s_TMSI
,
ue_context_p
->
ue_context
.
rnti
);
if
(
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
==
s_TMSI
)
{
return
ue_context_p
;
}
}
return
NULL
;
}
//-----------------------------------------------------------------------------
// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection
struct
rrc_gNB_ue_context_s
*
...
...
@@ -254,9 +275,9 @@ rrc_gNB_get_next_free_ue_context(
ue_context_p
=
rrc_gNB_allocate_new_UE_context
(
rrc_instance_pP
);
if
(
ue_context_p
==
NULL
)
{
LOG_E
(
RRC
,
PROTOCOL_RRC_CTXT_UE_FMT
" Cannot create new UE context, no memory
\n
"
,
PROTOCOL_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
LOG_E
(
NR_
RRC
,
PROTOCOL_
NR_
RRC_CTXT_UE_FMT
" Cannot create new UE context, no memory
\n
"
,
PROTOCOL_
NR_
RRC_CTXT_UE_ARGS
(
ctxt_pP
));
return
NULL
;
}
...
...
@@ -264,15 +285,15 @@ rrc_gNB_get_next_free_ue_context(
ue_context_p
->
ue_context
.
rnti
=
ctxt_pP
->
rnti
;
// yes duplicate, 1 may be removed
ue_context_p
->
ue_context
.
random_ue_identity
=
ue_identityP
;
RB_INSERT
(
rrc_nr_ue_tree_s
,
&
rrc_instance_pP
->
rrc_ue_head
,
ue_context_p
);
LOG_D
(
RRC
,
PROTOCOL_RRC_CTXT_UE_FMT
" Created new UE context uid %u
\n
"
,
PROTOCOL_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
LOG_D
(
NR_
RRC
,
PROTOCOL_
NR_
RRC_CTXT_UE_FMT
" Created new UE context uid %u
\n
"
,
PROTOCOL_
NR_
RRC_CTXT_UE_ARGS
(
ctxt_pP
),
ue_context_p
->
local_uid
);
return
ue_context_p
;
}
else
{
LOG_E
(
RRC
,
PROTOCOL_RRC_CTXT_UE_FMT
" Cannot create new UE context, already exist
\n
"
,
PROTOCOL_RRC_CTXT_UE_ARGS
(
ctxt_pP
));
LOG_E
(
NR_
RRC
,
PROTOCOL_
NR_
RRC_CTXT_UE_FMT
" Cannot create new UE context, already exist
\n
"
,
PROTOCOL_
NR_
RRC_CTXT_UE_ARGS
(
ctxt_pP
));
return
NULL
;
}
...
...
openair2/RRC/NR/rrc_gNB_UE_context.h
View file @
a81b655c
...
...
@@ -90,6 +90,12 @@ rrc_gNB_ue_context_random_exist(
const
uint64_t
ue_identityP
);
struct
rrc_gNB_ue_context_s
*
rrc_gNB_ue_context_5g_s_tmsi_exist
(
gNB_RRC_INST
*
rrc_instance_pP
,
const
uint64_t
s_TMSI
);
struct
rrc_gNB_ue_context_s
*
rrc_gNB_get_next_free_ue_context
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
...
...
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