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
Michael Black
OpenXG-RAN
Commits
5697057f
Commit
5697057f
authored
Oct 16, 2020
by
Xue Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unblock ITTI SIM process
parent
a76ef07a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
240 additions
and
179 deletions
+240
-179
openair2/COMMON/itti_sim_messages_types.h
openair2/COMMON/itti_sim_messages_types.h
+1
-1
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+28
-22
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+47
-35
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+125
-106
openair2/RRC/NR_UE/rrc_proto.h
openair2/RRC/NR_UE/rrc_proto.h
+6
-0
openair2/SIMULATION/NR_RRC/itti_sim.c
openair2/SIMULATION/NR_RRC/itti_sim.c
+33
-15
No files found.
openair2/COMMON/itti_sim_messages_types.h
View file @
5697057f
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
typedef
struct
itti_sim_rrc_ch_s
{
typedef
struct
itti_sim_rrc_ch_s
{
const
rb_id_t
rbid
;
rb_id_t
rbid
;
uint8_t
*
sdu
;
uint8_t
*
sdu
;
int
size
;
int
size
;
}
itti_sim_rrc_ch_t
;
}
itti_sim_rrc_ch_t
;
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
5697057f
...
@@ -631,12 +631,12 @@ uint8_t do_RRCReject(uint8_t Mod_id,
...
@@ -631,12 +631,12 @@ uint8_t do_RRCReject(uint8_t Mod_id,
100
);
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_E
(
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
LOG_E
(
NR_
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
return
-
1
;
}
}
LOG_D
(
RRC
,
"RRCReject Encoded %zd bits (%zd bytes)
\n
"
,
LOG_D
(
NR_
RRC
,
"RRCReject Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
}
...
@@ -762,13 +762,13 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
...
@@ -762,13 +762,13 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
100
);
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_E
(
RRC
,
"ASN1 message CellGroupConfig encoding failed (%s, %lu)!
\n
"
,
LOG_E
(
NR_
RRC
,
"ASN1 message CellGroupConfig encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
return
-
1
;
}
}
if
(
OCTET_STRING_fromBuf
(
&
ie
->
masterCellGroup
,
masterCellGroup_buf
,
(
enc_rval
.
encoded
+
7
)
/
8
)
==
-
1
)
{
if
(
OCTET_STRING_fromBuf
(
&
ie
->
masterCellGroup
,
masterCellGroup_buf
,
(
enc_rval
.
encoded
+
7
)
/
8
)
==
-
1
)
{
LOG_E
(
RRC
,
"fatal: OCTET_STRING_fromBuf failed
\n
"
);
LOG_E
(
NR_
RRC
,
"fatal: OCTET_STRING_fromBuf failed
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -783,12 +783,12 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
...
@@ -783,12 +783,12 @@ uint8_t do_RRCSetup(const protocol_ctxt_t *const ctxt_pP,
100
);
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_E
(
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
LOG_E
(
NR_
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
return
-
1
;
}
}
LOG_D
(
RRC
,
"RRCSetup Encoded %zd bits (%zd bytes)
\n
"
,
LOG_D
(
NR_
RRC
,
"RRCSetup Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
}
...
@@ -890,19 +890,19 @@ uint8_t do_NR_UECapabilityEnquiry_nr( const protocol_ctxt_t *const ctxt_pP,
...
@@ -890,19 +890,19 @@ uint8_t do_NR_UECapabilityEnquiry_nr( const protocol_ctxt_t *const ctxt_pP,
100
);
100
);
if
(
enc_rval
.
encoded
==
-
1
)
{
if
(
enc_rval
.
encoded
==
-
1
)
{
LOG_I
(
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
LOG_I
(
NR_
RRC
,
"[gNB AssertFatal]ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
return
-
1
;
return
-
1
;
}
}
LOG_D
(
RRC
,
"[gNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)
\n
"
,
LOG_D
(
NR_
RRC
,
"[gNB %d] NR UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
ctxt_pP
->
rnti
,
ctxt_pP
->
rnti
,
enc_rval
.
encoded
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
(
enc_rval
.
encoded
+
7
)
/
8
);
if
(
enc_rval
.
encoded
==-
1
)
{
if
(
enc_rval
.
encoded
==-
1
)
{
LOG_E
(
RRC
,
"[e
NB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x
\n
"
,
LOG_E
(
NR_RRC
,
"[g
NB %d] ASN1 : NR UECapabilityRequest encoding failed for UE %x
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
ctxt_pP
->
rnti
);
ctxt_pP
->
rnti
);
return
(
-
1
);
return
(
-
1
);
...
@@ -1106,14 +1106,16 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
...
@@ -1106,14 +1106,16 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
ul_ccch_msg
.
message
.
present
=
NR_UL_CCCH_MessageType_PR_c1
;
ul_ccch_msg
.
message
.
present
=
NR_UL_CCCH_MessageType_PR_c1
;
ul_ccch_msg
.
message
.
choice
.
c1
=
CALLOC
(
1
,
sizeof
(
struct
NR_UL_CCCH_MessageType__c1
));
ul_ccch_msg
.
message
.
choice
.
c1
=
CALLOC
(
1
,
sizeof
(
struct
NR_UL_CCCH_MessageType__c1
));
ul_ccch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest
;
ul_ccch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest
;
ul_ccch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
=
CALLOC
(
1
,
sizeof
(
NR_RRCSetupRequest_t
));
rrcSetupRequest
=
ul_ccch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
;
rrcSetupRequest
=
ul_ccch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupRequest
;
if
(
1
)
{
if
(
1
)
{
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
present
=
NR_InitialUE_Identity_PR_randomValue
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
present
=
NR_InitialUE_Identity_PR_randomValue
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
size
=
5
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
size
=
5
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
bits_unused
=
0
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
bits_unused
=
1
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
=
buf
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
=
buf
;
rv
[
0
]
=
rv
[
0
]
&
0x7F
;
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
0
]
=
rv
[
0
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
0
]
=
rv
[
0
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
1
]
=
rv
[
1
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
1
]
=
rv
[
1
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
2
]
=
rv
[
2
];
rrcSetupRequest
->
rrcSetupRequest
.
ue_Identity
.
choice
.
randomValue
.
buf
[
2
]
=
rv
[
2
];
...
@@ -1132,9 +1134,9 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
...
@@ -1132,9 +1134,9 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
size
=
1
;
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
size
=
1
;
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
bits_unused
=
7
;
rrcSetupRequest
->
rrcSetupRequest
.
spare
.
bits_unused
=
7
;
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
//
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_CCCH_Message
,
(
void
*
)
&
ul_ccch_msg
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_CCCH_Message
,
(
void
*
)
&
ul_ccch_msg
);
}
//
}
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_UL_CCCH_Message
,
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_UL_CCCH_Message
,
NULL
,
NULL
,
...
@@ -1142,7 +1144,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
...
@@ -1142,7 +1144,7 @@ uint8_t do_RRCSetupRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
buffer
,
buffer
,
100
);
100
);
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
LOG_D
(
RRC
,
"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
LOG_D
(
NR_
RRC
,
"[UE] RRCSetupRequest Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -1178,7 +1180,7 @@ do_NR_RRCReconfigurationComplete(
...
@@ -1178,7 +1180,7 @@ do_NR_RRCReconfigurationComplete(
100
);
100
);
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
LOG_D
(
RRC
,
"rrcReconfigurationComplete Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
LOG_D
(
NR_
RRC
,
"rrcReconfigurationComplete Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
}
...
@@ -1197,16 +1199,20 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
...
@@ -1197,16 +1199,20 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
}
}
ul_dcch_msg
.
message
.
present
=
NR_UL_DCCH_MessageType_PR_c1
;
ul_dcch_msg
.
message
.
present
=
NR_UL_DCCH_MessageType_PR_c1
;
ul_dcch_msg
.
message
.
choice
.
c1
=
CALLOC
(
1
,
sizeof
(
struct
NR_
D
L_DCCH_MessageType__c1
));
ul_dcch_msg
.
message
.
choice
.
c1
=
CALLOC
(
1
,
sizeof
(
struct
NR_
U
L_DCCH_MessageType__c1
));
ul_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete
;
ul_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete
;
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
=
CALLOC
(
1
,
sizeof
(
NR_RRCSetupComplete_t
));
RrcSetupComplete
=
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
;
RrcSetupComplete
=
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
;
RrcSetupComplete
->
rrc_TransactionIdentifier
=
Transaction_id
;
RrcSetupComplete
->
rrc_TransactionIdentifier
=
Transaction_id
;
RrcSetupComplete
->
criticalExtensions
.
present
=
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete
;
RrcSetupComplete
->
criticalExtensions
.
present
=
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
nonCriticalExtension
=
CALLOC
(
1
,
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
=
CALLOC
(
1
,
sizeof
(
NR_RRCSetupComplete_IEs_t
));
sizeof
(
*
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
nonCriticalExtension
));
// RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension = CALLOC(1,
// sizeof(*RrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->nonCriticalExtension));
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
selectedPLMN_Identity
=
sel_plmn_id
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
selectedPLMN_Identity
=
sel_plmn_id
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
registeredAMF
=
NULL
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
registeredAMF
=
NULL
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
=
CALLOC
(
1
,
sizeof
(
struct
NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value
));
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
present
=
NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
.
size
=
6
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
.
size
=
6
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
.
buf
=
buf
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
.
buf
=
buf
;
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
.
buf
[
0
]
=
rv
[
0
];
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
.
buf
[
0
]
=
rv
[
0
];
...
@@ -1218,11 +1224,11 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
...
@@ -1218,11 +1224,11 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
memset
(
&
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
dedicatedNAS_Message
,
0
,
sizeof
(
OCTET_STRING_t
));
memset
(
&
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
dedicatedNAS_Message
,
0
,
sizeof
(
OCTET_STRING_t
));
OCTET_STRING_fromBuf
(
&
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
dedicatedNAS_Message
,
dedicatedInfoNAS
,
dedicatedInfoNASLength
);
OCTET_STRING_fromBuf
(
&
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
dedicatedNAS_Message
,
dedicatedInfoNAS
,
dedicatedInfoNASLength
);
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
//
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint
(
stdout
,
&
asn_DEF_NR_
D
L_DCCH_Message
,
(
void
*
)
&
ul_dcch_msg
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_
U
L_DCCH_Message
,
(
void
*
)
&
ul_dcch_msg
);
}
//
}
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_
D
L_DCCH_Message
,
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_
U
L_DCCH_Message
,
NULL
,
NULL
,
(
void
*
)
&
ul_dcch_msg
,
(
void
*
)
&
ul_dcch_msg
,
buffer
,
buffer
,
...
@@ -1230,7 +1236,7 @@ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
...
@@ -1230,7 +1236,7 @@ enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message,
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
AssertFatal
(
enc_rval
.
encoded
>
0
,
"ASN1 message encoding failed (%s, %lu)!
\n
"
,
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
enc_rval
.
failed_type
->
name
,
enc_rval
.
encoded
);
LOG_D
(
RRC
,
"RRCConnection
SetupComplete Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
LOG_D
(
NR_RRC
,
"RRC
SetupComplete Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,(
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
return
((
enc_rval
.
encoded
+
7
)
/
8
);
}
}
...
...
openair2/RRC/NR/rrc_gNB.c
View file @
5697057f
...
@@ -422,7 +422,7 @@ rrc_gNB_generate_RRCSetup(
...
@@ -422,7 +422,7 @@ rrc_gNB_generate_RRCSetup(
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
#ifdef ITTI_SIM
#ifdef ITTI_SIM
MessageDef
*
message_p
;
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_RRC_
UE
_SIM
,
GNB_RRC_CCCH_DATA_IND
);
message_p
=
itti_alloc_new_message
(
TASK_RRC_
GNB
_SIM
,
GNB_RRC_CCCH_DATA_IND
);
GNB_RRC_CCCH_DATA_IND
(
message_p
).
sdu
=
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
;
GNB_RRC_CCCH_DATA_IND
(
message_p
).
sdu
=
(
uint8_t
*
)
ue_p
->
Srb0
.
Tx_buffer
.
Payload
;
GNB_RRC_CCCH_DATA_IND
(
message_p
).
size
=
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
;
GNB_RRC_CCCH_DATA_IND
(
message_p
).
size
=
ue_p
->
Srb0
.
Tx_buffer
.
payload_size
;
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
itti_send_msg_to_task
(
TASK_RRC_UE_SIM
,
ctxt_pP
->
instance
,
message_p
);
...
@@ -481,7 +481,11 @@ rrc_gNB_process_RRCSetupComplete(
...
@@ -481,7 +481,11 @@ rrc_gNB_process_RRCSetupComplete(
// T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->subframe),
// T_INT(ctxt_pP->rnti));
// T_INT(ctxt_pP->rnti));
rrc_gNB_send_NGAP_NAS_FIRST_REQ
(
ctxt_pP
,
ue_context_pP
,
rrcSetupComplete
);
// if (AMF_MODE_ENABLED) {
// rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete);
// } else {
rrc_gNB_generate_SecurityModeCommand
(
ctxt_pP
,
ue_context_pP
);
// }
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
@@ -890,6 +894,7 @@ rrc_gNB_decode_dcch(
...
@@ -890,6 +894,7 @@ rrc_gNB_decode_dcch(
sdu_sizeP
,
sdu_sizeP
,
0
,
0
,
0
);
0
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_DCCH_Message
,
(
void
*
)
&
ul_dcch_msg
);
{
{
for
(
i
=
0
;
i
<
sdu_sizeP
;
i
++
)
{
for
(
i
=
0
;
i
<
sdu_sizeP
;
i
++
)
{
...
@@ -980,6 +985,8 @@ rrc_gNB_decode_dcch(
...
@@ -980,6 +985,8 @@ rrc_gNB_decode_dcch(
if
(
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
criticalExtensions
.
present
==
if
(
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
criticalExtensions
.
present
==
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete
)
{
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete
)
{
if
(
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
!=
NULL
)
{
if
(
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
criticalExtensions
.
choice
.
if
(
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
present
==
NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2
)
{
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
present
==
NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2
)
{
// ng-5G-S-TMSI-Part2 BIT STRING (SIZE (9))
// ng-5G-S-TMSI-Part2 BIT STRING (SIZE (9))
...
@@ -1012,14 +1019,19 @@ rrc_gNB_decode_dcch(
...
@@ -1012,14 +1019,19 @@ rrc_gNB_decode_dcch(
return
-
1
;
return
-
1
;
}
}
uint64_t
fiveg_s_TMSI
=
BIT_STRING_to_uint16
(
&
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
uint64_t
fiveg_s_TMSI
=
BIT_STRING_to_uint64
(
&
ul_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
);
criticalExtensions
.
choice
.
rrcSetupComplete
->
ng_5G_S_TMSI_Value
->
choice
.
ng_5G_S_TMSI
);
LOG_I
(
NR_RRC
,
"Received rrcSetupComplete, 5g_s_TMSI: 0x%lX, amf_set_id: 0x%lX(%d), amf_pointer: 0x%lX(%d), 5g TMSI: 0x%lX
\n
"
,
fiveg_s_TMSI
,
fiveg_s_TMSI
>>
38
,
fiveg_s_TMSI
>>
38
,
(
fiveg_s_TMSI
>>
32
)
&
0x3F
,
(
fiveg_s_TMSI
>>
32
)
&
0x3F
,
(
uint32_t
)
fiveg_s_TMSI
);
if
(
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
presence
==
TRUE
)
{
if
(
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
presence
==
TRUE
)
{
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
amf_set_id
=
fiveg_s_TMSI
>>
38
;
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
amf_set_id
=
fiveg_s_TMSI
>>
38
;
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
amf_pointer
=
(
fiveg_s_TMSI
>>
32
)
&
0x3F
;
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
amf_pointer
=
(
fiveg_s_TMSI
>>
32
)
&
0x3F
;
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
fiveg_tmsi
=
(
uint32_t
)
fiveg_s_TMSI
;
ue_context_p
->
ue_context
.
Initialue_identity_5g_s_TMSI
.
fiveg_tmsi
=
(
uint32_t
)
fiveg_s_TMSI
;
}
}
}
}
}
rrc_gNB_process_RRCSetupComplete
(
rrc_gNB_process_RRCSetupComplete
(
ctxt_pP
,
ctxt_pP
,
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
5697057f
...
@@ -350,7 +350,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
...
@@ -350,7 +350,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
memset
(
NR_UE_rrc_inst
,
0
,
NB_NR_UE_INST
*
sizeof
(
NR_UE_RRC_INST_t
));
memset
(
NR_UE_rrc_inst
,
0
,
NB_NR_UE_INST
*
sizeof
(
NR_UE_RRC_INST_t
));
// fill UE-NR-Capability @ UE-CapabilityRAT-Container here.
// fill UE-NR-Capability @ UE-CapabilityRAT-Container here.
NR_UE_rrc_inst
[
0
].
selected_plmn_identity
=
1
;
// init RRC lists
// init RRC lists
RRC_LIST_INIT
(
NR_UE_rrc_inst
->
RLC_Bearer_Config_list
,
NR_maxLC_ID
);
RRC_LIST_INIT
(
NR_UE_rrc_inst
->
RLC_Bearer_Config_list
,
NR_maxLC_ID
);
RRC_LIST_INIT
(
NR_UE_rrc_inst
->
SchedulingRequest_list
,
NR_maxNrofSR_ConfigPerCellGroup
);
RRC_LIST_INIT
(
NR_UE_rrc_inst
->
SchedulingRequest_list
,
NR_maxNrofSR_ConfigPerCellGroup
);
...
@@ -470,42 +470,6 @@ int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
...
@@ -470,42 +470,6 @@ int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
return
0
;
return
0
;
}
}
//-----------------------------------------------------------------------------
void
rrc_ue_generate_RRCSetupRequest
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
)
{
uint8_t
i
=
0
,
rv
[
6
];
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
==
0
)
{
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
for
(
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
;
#else
rv
[
i
]
=
taus
()
&
0xff
;
#endif
LOG_T
(
RRC
,
"%x."
,
rv
[
i
]);
}
LOG_T
(
RRC
,
"
\n
"
);
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
=
do_RRCSetupRequest
(
ctxt_pP
->
module_id
,
(
uint8_t
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
,
rv
);
LOG_I
(
RRC
,
"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
,
gNB_index
);
for
(
i
=
0
;
i
<
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
;
i
++
)
{
LOG_T
(
RRC
,
"%x."
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
[
i
]);
}
LOG_T
(
RRC
,
"
\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; */
}
}
/*brief decode BCCH-BCH (MIB) message*/
/*brief decode BCCH-BCH (MIB) message*/
int8_t
nr_rrc_ue_decode_NR_BCCH_BCH_Message
(
int8_t
nr_rrc_ue_decode_NR_BCCH_BCH_Message
(
const
module_id_t
module_id
,
const
module_id_t
module_id
,
...
@@ -1343,7 +1307,7 @@ static void rrc_ue_generate_RRCSetupComplete(
...
@@ -1343,7 +1307,7 @@ static void rrc_ue_generate_RRCSetupComplete(
}
}
*/
*/
size
=
do_RRCSetupComplete
(
ctxt_pP
->
module_id
,
buffer
,
Transaction_id
,
sel_plmn_id
,
nas_msg_length
,
nas_msg
);
size
=
do_RRCSetupComplete
(
ctxt_pP
->
module_id
,
buffer
,
Transaction_id
,
sel_plmn_id
,
nas_msg_length
,
nas_msg
);
LOG_I
(
RRC
,
"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCConnection
SetupComplete (bytes%d, gNB %d)
\n
"
,
LOG_I
(
NR_RRC
,
"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRC
SetupComplete (bytes%d, gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
size
,
gNB_index
);
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
size
,
gNB_index
);
LOG_D
(
RLC
,
LOG_D
(
RLC
,
"[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]
\n
"
,
"[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to gNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]
\n
"
,
...
@@ -1357,6 +1321,17 @@ static void rrc_ue_generate_RRCSetupComplete(
...
@@ -1357,6 +1321,17 @@ static void rrc_ue_generate_RRCSetupComplete(
size
,
size
,
buffer
,
buffer
,
PDCP_TRANSMISSION_MODE_CONTROL
);
PDCP_TRANSMISSION_MODE_CONTROL
);
#ifdef ITTI_SIM
MessageDef
*
message_p
;
uint8_t
*
message_buffer
;
message_buffer
=
itti_malloc
(
TASK_RRC_UE_SIM
,
TASK_RRC_GNB_SIM
,
size
);
memcpy
(
message_buffer
,
buffer
,
size
);
message_p
=
itti_alloc_new_message
(
TASK_RRC_UE_SIM
,
UE_RRC_DCCH_DATA_IND
);
UE_RRC_DCCH_DATA_IND
(
message_p
).
rbid
=
1
;
UE_RRC_DCCH_DATA_IND
(
message_p
).
sdu
=
message_buffer
;
UE_RRC_DCCH_DATA_IND
(
message_p
).
size
=
size
;
itti_send_msg_to_task
(
TASK_RRC_GNB_SIM
,
ctxt_pP
->
instance
,
message_p
);
#endif
}
}
int8_t
nr_rrc_ue_decode_ccch
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
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
SRB_INFO
*
const
Srb_info
,
const
uint8_t
gNB_index
){
...
@@ -1386,14 +1361,14 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_IN
...
@@ -1386,14 +1361,14 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_IN
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
gNB_index
].
State
==
RRC_SI_RECEIVED
)
{
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Info
[
gNB_index
].
State
==
RRC_SI_RECEIVED
)
{
switch
(
dl_ccch_msg
->
message
.
choice
.
c1
->
present
)
{
switch
(
dl_ccch_msg
->
message
.
choice
.
c1
->
present
)
{
case
NR_DL_CCCH_MessageType__c1_PR_NOTHING
:
case
NR_DL_CCCH_MessageType__c1_PR_NOTHING
:
LOG_I
(
RRC
,
"[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message
\n
"
,
LOG_I
(
NR_
RRC
,
"[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
);
ctxt_pP
->
frame
);
rval
=
0
;
rval
=
0
;
break
;
break
;
case
NR_DL_CCCH_MessageType__c1_PR_rrcReject
:
case
NR_DL_CCCH_MessageType__c1_PR_rrcReject
:
LOG_I
(
RRC
,
LOG_I
(
NR_
RRC
,
"[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject
\n
"
,
"[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
);
ctxt_pP
->
frame
);
...
@@ -1401,7 +1376,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_IN
...
@@ -1401,7 +1376,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_IN
break
;
break
;
case
NR_DL_CCCH_MessageType__c1_PR_rrcSetup
:
case
NR_DL_CCCH_MessageType__c1_PR_rrcSetup
:
LOG_I
(
RRC
,
LOG_I
(
NR_
RRC
,
"[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x
\n
"
,
"[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ctxt_pP
->
frame
,
...
@@ -1430,7 +1405,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_IN
...
@@ -1430,7 +1405,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_IN
break
;
break
;
default:
default:
LOG_E
(
RRC
,
"[UE%d] Frame %d : Unknown message
\n
"
,
LOG_E
(
NR_
RRC
,
"[UE%d] Frame %d : Unknown message
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
);
ctxt_pP
->
frame
);
rval
=
-
1
;
rval
=
-
1
;
...
@@ -1534,51 +1509,51 @@ nr_rrc_ue_process_securityModeCommand(
...
@@ -1534,51 +1509,51 @@ nr_rrc_ue_process_securityModeCommand(
NR_UL_DCCH_Message_t
ul_dcch_msg
;
NR_UL_DCCH_Message_t
ul_dcch_msg
;
uint8_t
buffer
[
200
];
uint8_t
buffer
[
200
];
int
i
,
securityMode
;
int
i
,
securityMode
;
LOG_I
(
RRC
,
"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (g
NB %d)
\n
"
,
LOG_I
(
NR_RRC
,
"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (e
NB %d)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ctxt_pP
->
subframe
,
gNB_index
);
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ctxt_pP
->
subframe
,
gNB_index
);
switch
(
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
)
{
switch
(
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
)
{
case
NR_CipheringAlgorithm_nea0
:
case
NR_CipheringAlgorithm_nea0
:
LOG_I
(
RRC
,
"[UE %d] Security algorithm is set to nea0
\n
"
,
LOG_I
(
NR_
RRC
,
"[UE %d] Security algorithm is set to nea0
\n
"
,
ctxt_pP
->
module_id
);
ctxt_pP
->
module_id
);
securityMode
=
NR_CipheringAlgorithm_nea0
;
securityMode
=
NR_CipheringAlgorithm_nea0
;
break
;
break
;
case
NR_CipheringAlgorithm_nea1
:
case
NR_CipheringAlgorithm_nea1
:
LOG_I
(
RRC
,
"[UE %d] Security algorithm is set to nea1
\n
"
,
ctxt_pP
->
module_id
);
LOG_I
(
NR_
RRC
,
"[UE %d] Security algorithm is set to nea1
\n
"
,
ctxt_pP
->
module_id
);
securityMode
=
NR_CipheringAlgorithm_nea1
;
securityMode
=
NR_CipheringAlgorithm_nea1
;
break
;
break
;
case
NR_CipheringAlgorithm_nea2
:
case
NR_CipheringAlgorithm_nea2
:
LOG_I
(
RRC
,
"[UE %d] Security algorithm is set to nea2
\n
"
,
LOG_I
(
NR_
RRC
,
"[UE %d] Security algorithm is set to nea2
\n
"
,
ctxt_pP
->
module_id
);
ctxt_pP
->
module_id
);
securityMode
=
NR_CipheringAlgorithm_nea2
;
securityMode
=
NR_CipheringAlgorithm_nea2
;
break
;
break
;
default:
default:
LOG_I
(
RRC
,
"[UE %d] Security algorithm is set to none
\n
"
,
ctxt_pP
->
module_id
);
LOG_I
(
NR_
RRC
,
"[UE %d] Security algorithm is set to none
\n
"
,
ctxt_pP
->
module_id
);
securityMode
=
NR_CipheringAlgorithm_spare1
;
securityMode
=
NR_CipheringAlgorithm_spare1
;
break
;
break
;
}
}
switch
(
*
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
integrityProtAlgorithm
)
{
switch
(
*
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
integrityProtAlgorithm
)
{
case
NR_IntegrityProtAlgorithm_nia1
:
case
NR_IntegrityProtAlgorithm_nia1
:
LOG_I
(
RRC
,
"[UE %d] Integrity protection algorithm is set to nia1
\n
"
,
ctxt_pP
->
module_id
);
LOG_I
(
NR_
RRC
,
"[UE %d] Integrity protection algorithm is set to nia1
\n
"
,
ctxt_pP
->
module_id
);
securityMode
|=
1
<<
5
;
securityMode
|=
1
<<
5
;
break
;
break
;
case
NR_IntegrityProtAlgorithm_nia2
:
case
NR_IntegrityProtAlgorithm_nia2
:
LOG_I
(
RRC
,
"[UE %d] Integrity protection algorithm is set to nia2
\n
"
,
ctxt_pP
->
module_id
);
LOG_I
(
NR_
RRC
,
"[UE %d] Integrity protection algorithm is set to nia2
\n
"
,
ctxt_pP
->
module_id
);
securityMode
|=
1
<<
6
;
securityMode
|=
1
<<
6
;
break
;
break
;
default:
default:
LOG_I
(
RRC
,
"[UE %d] Integrity protection algorithm is set to none
\n
"
,
ctxt_pP
->
module_id
);
LOG_I
(
NR_
RRC
,
"[UE %d] Integrity protection algorithm is set to none
\n
"
,
ctxt_pP
->
module_id
);
securityMode
|=
0x70
;
securityMode
|=
0x70
;
break
;
break
;
}
}
LOG_D
(
RRC
,
"[UE %d] security mode is %x
\n
"
,
ctxt_pP
->
module_id
,
securityMode
);
LOG_D
(
NR_
RRC
,
"[UE %d] security mode is %x
\n
"
,
ctxt_pP
->
module_id
,
securityMode
);
NR_UE_rrc_inst
->
cipheringAlgorithm
=
NR_UE_rrc_inst
->
cipheringAlgorithm
=
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
;
securityModeCommand
->
criticalExtensions
.
choice
.
securityModeCommand
->
securityConfigSMC
.
securityAlgorithmConfig
.
cipheringAlgorithm
;
NR_UE_rrc_inst
->
integrityProtAlgorithm
=
NR_UE_rrc_inst
->
integrityProtAlgorithm
=
...
@@ -1589,10 +1564,10 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
...
@@ -1589,10 +1564,10 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
ul_dcch_msg
.
message
.
choice
.
c1
=
calloc
(
1
,
sizeof
(
*
ul_dcch_msg
.
message
.
choice
.
c1
));
ul_dcch_msg
.
message
.
choice
.
c1
=
calloc
(
1
,
sizeof
(
*
ul_dcch_msg
.
message
.
choice
.
c1
));
if
(
securityMode
>=
NO_SECURITY_MODE
)
{
if
(
securityMode
>=
NO_SECURITY_MODE
)
{
LOG_I
(
RRC
,
"rrc_ue_process_securityModeCommand, security mode complete case
\n
"
);
LOG_I
(
NR_
RRC
,
"rrc_ue_process_securityModeCommand, security mode complete case
\n
"
);
ul_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_DCCH_MessageType__c1_PR_securityModeComplete
;
ul_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_DCCH_MessageType__c1_PR_securityModeComplete
;
}
else
{
}
else
{
LOG_I
(
RRC
,
"rrc_ue_process_securityModeCommand, security mode failure case
\n
"
);
LOG_I
(
NR_
RRC
,
"rrc_ue_process_securityModeCommand, security mode failure case
\n
"
);
ul_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_DCCH_MessageType__c1_PR_securityModeFailure
;
ul_dcch_msg
.
message
.
choice
.
c1
->
present
=
NR_UL_DCCH_MessageType__c1_PR_securityModeFailure
;
}
}
...
@@ -1607,8 +1582,8 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
...
@@ -1607,8 +1582,8 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
if
(
h_rc
==
HASH_TABLE_OK
)
{
if
(
h_rc
==
HASH_TABLE_OK
)
{
LOG_D
(
RRC
,
"PDCP_COLL_KEY_VALUE() returns valid key = %ld
\n
"
,
key
);
LOG_D
(
NR_
RRC
,
"PDCP_COLL_KEY_VALUE() returns valid key = %ld
\n
"
,
key
);
LOG_D
(
RRC
,
"driving kRRCenc, kRRCint and kUPenc from KgNB="
LOG_D
(
NR_
RRC
,
"driving kRRCenc, kRRCint and kUPenc from KgNB="
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
"%02x%02x%02x%02x"
...
@@ -1635,11 +1610,11 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
...
@@ -1635,11 +1610,11 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
|
(
NR_UE_rrc_inst
->
integrityProtAlgorithm
<<
4
),
|
(
NR_UE_rrc_inst
->
integrityProtAlgorithm
<<
4
),
kRRCenc
,
kRRCint
,
kUPenc
);
kRRCenc
,
kRRCint
,
kUPenc
);
}
else
{
}
else
{
LOG_I
(
RRC
,
"skipped pdcp_config_set_security() as securityMode == 0x%02x"
,
LOG_I
(
NR_
RRC
,
"skipped pdcp_config_set_security() as securityMode == 0x%02x"
,
securityMode
);
securityMode
);
}
}
}
else
{
}
else
{
LOG_I
(
RRC
,
"Could not get PDCP instance where key=0x%ld
\n
"
,
key
);
LOG_I
(
NR_
RRC
,
"Could not get PDCP instance where key=0x%ld
\n
"
,
key
);
}
}
if
(
securityModeCommand
->
criticalExtensions
.
present
==
NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
)
{
if
(
securityModeCommand
->
criticalExtensions
.
present
==
NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
)
{
...
@@ -1647,7 +1622,7 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
...
@@ -1647,7 +1622,7 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeComplete
->
rrc_TransactionIdentifier
=
securityModeCommand
->
rrc_TransactionIdentifier
;
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeComplete
->
rrc_TransactionIdentifier
=
securityModeCommand
->
rrc_TransactionIdentifier
;
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeComplete
->
criticalExtensions
.
present
=
NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete
;
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeComplete
->
criticalExtensions
.
present
=
NR_SecurityModeComplete__criticalExtensions_PR_securityModeComplete
;
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeComplete
->
criticalExtensions
.
choice
.
securityModeComplete
->
nonCriticalExtension
=
NULL
;
ul_dcch_msg
.
message
.
choice
.
c1
->
choice
.
securityModeComplete
->
criticalExtensions
.
choice
.
securityModeComplete
->
nonCriticalExtension
=
NULL
;
LOG_I
(
RRC
,
"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (g
NB %d), rrc_TransactionIdentifier: %ld
\n
"
,
LOG_I
(
NR_RRC
,
"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (e
NB %d), rrc_TransactionIdentifier: %ld
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ctxt_pP
->
subframe
,
gNB_index
,
securityModeCommand
->
rrc_TransactionIdentifier
);
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
ctxt_pP
->
subframe
,
gNB_index
,
securityModeCommand
->
rrc_TransactionIdentifier
);
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_UL_DCCH_Message
,
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_UL_DCCH_Message
,
NULL
,
NULL
,
...
@@ -1661,13 +1636,13 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
...
@@ -1661,13 +1636,13 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_DCCH_Message
,
(
void
*
)
&
ul_dcch_msg
);
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_DCCH_Message
,
(
void
*
)
&
ul_dcch_msg
);
}
}
LOG_D
(
RRC
,
"securityModeComplete Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
LOG_D
(
NR_
RRC
,
"securityModeComplete Encoded %zd bits (%zd bytes)
\n
"
,
enc_rval
.
encoded
,
(
enc_rval
.
encoded
+
7
)
/
8
);
for
(
i
=
0
;
i
<
(
enc_rval
.
encoded
+
7
)
/
8
;
i
++
)
{
for
(
i
=
0
;
i
<
(
enc_rval
.
encoded
+
7
)
/
8
;
i
++
)
{
LOG_T
(
RRC
,
"%02x."
,
buffer
[
i
]);
LOG_T
(
NR_
RRC
,
"%02x."
,
buffer
[
i
]);
}
}
LOG_T
(
RRC
,
"
\n
"
);
LOG_T
(
NR_
RRC
,
"
\n
"
);
rrc_data_req
(
rrc_data_req
(
ctxt_pP
,
ctxt_pP
,
DCCH
,
DCCH
,
...
@@ -1676,10 +1651,54 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
...
@@ -1676,10 +1651,54 @@ memset((void *)&ul_dcch_msg,0,sizeof(NR_UL_DCCH_Message_t));
(
enc_rval
.
encoded
+
7
)
/
8
,
(
enc_rval
.
encoded
+
7
)
/
8
,
buffer
,
buffer
,
PDCP_TRANSMISSION_MODE_CONTROL
);
PDCP_TRANSMISSION_MODE_CONTROL
);
}
else
LOG_W
(
RRC
,
"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
\n
"
,
}
else
LOG_W
(
NR_
RRC
,
"securityModeCommand->criticalExtensions.present (%d) != NR_SecurityModeCommand__criticalExtensions_PR_securityModeCommand
\n
"
,
securityModeCommand
->
criticalExtensions
.
present
);
securityModeCommand
->
criticalExtensions
.
present
);
}
}
//-----------------------------------------------------------------------------
void
rrc_ue_generate_RRCSetupRequest
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
)
{
uint8_t
i
=
0
,
rv
[
6
];
if
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
==
0
)
{
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
for
(
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
;
#else
rv
[
i
]
=
taus
()
&
0xff
;
#endif
LOG_T
(
NR_RRC
,
"%x."
,
rv
[
i
]);
}
LOG_T
(
NR_RRC
,
"
\n
"
);
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
=
do_RRCSetupRequest
(
ctxt_pP
->
module_id
,
(
uint8_t
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
,
rv
);
LOG_I
(
NR_RRC
,
"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, eNB %d)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
,
gNB_index
);
for
(
i
=
0
;
i
<
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
;
i
++
)
{
LOG_T
(
NR_RRC
,
"%x."
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
[
i
]);
}
LOG_T
(
NR_RRC
,
"
\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; */
#ifdef ITTI_SIM
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_RRC_UE_SIM
,
UE_RRC_CCCH_DATA_IND
);
GNB_RRC_CCCH_DATA_IND
(
message_p
).
sdu
=
(
uint8_t
*
)
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
Payload
;
GNB_RRC_CCCH_DATA_IND
(
message_p
).
size
=
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
Srb0
[
gNB_index
].
Tx_buffer
.
payload_size
;
itti_send_msg_to_task
(
TASK_RRC_GNB_SIM
,
ctxt_pP
->
instance
,
message_p
);
#endif
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int32_t
int32_t
nr_rrc_ue_establish_srb1
(
nr_rrc_ue_establish_srb1
(
...
@@ -1924,26 +1943,26 @@ nr_sa_rrc_ue_process_radioBearerConfig(
...
@@ -1924,26 +1943,26 @@ nr_sa_rrc_ue_process_radioBearerConfig(
derive_key_rrc_int
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
,
derive_key_rrc_int
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kRRCint
);
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
kgnb
,
&
kRRCint
);
// Refresh SRBs
// Refresh SRBs
nr_rrc_pdcp_config_asn1_req
(
ctxt_pP
,
//
nr_rrc_pdcp_config_asn1_req(ctxt_pP,
radioBearerConfig
->
srb_ToAddModList
,
//
radioBearerConfig->srb_ToAddModList,
NULL
,
//
NULL,
NULL
,
//
NULL,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
|
//
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
<<
4
),
//
(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
kRRCenc
,
//
kRRCenc,
kRRCint
,
//
kRRCint,
NULL
,
//
NULL,
NULL
,
//
NULL,
NULL
,
//
NULL,
NULL
);
//
NULL);
// Refresh SRBs
// Refresh SRBs
nr_rrc_rlc_config_asn1_req
(
ctxt_pP
,
//
nr_rrc_rlc_config_asn1_req(ctxt_pP,
radioBearerConfig
->
srb_ToAddModList
,
//
radioBearerConfig->srb_ToAddModList,
NULL
,
//
NULL,
NULL
,
//
NULL,
NULL
,
//
NULL,
NULL
//
NULL
);
//
);
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
srb_ToAddModList
->
list
.
count
;
cnt
++
)
{
for
(
cnt
=
0
;
cnt
<
radioBearerConfig
->
srb_ToAddModList
->
list
.
count
;
cnt
++
)
{
SRB_id
=
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
]
->
srb_Identity
;
SRB_id
=
radioBearerConfig
->
srb_ToAddModList
->
list
.
array
[
cnt
]
->
srb_Identity
;
...
@@ -2016,26 +2035,26 @@ nr_sa_rrc_ue_process_radioBearerConfig(
...
@@ -2016,26 +2035,26 @@ nr_sa_rrc_ue_process_radioBearerConfig(
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
<<
4
));
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
<<
4
));
// Refresh DRBs
// Refresh DRBs
nr_rrc_pdcp_config_asn1_req
(
ctxt_pP
,
//
nr_rrc_pdcp_config_asn1_req(ctxt_pP,
NULL
,
//
NULL,
radioBearerConfig
->
drb_ToAddModList
,
//
radioBearerConfig->drb_ToAddModList,
NULL
,
//
NULL,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
cipheringAlgorithm
|
//
NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm |
(
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
integrityProtAlgorithm
<<
4
),
//
(NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4),
NULL
,
//
NULL,
NULL
,
//
NULL,
kUPenc
,
//
kUPenc,
NULL
,
//
NULL,
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
defaultDRB
,
//
NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB,
NULL
);
//
NULL);
// Refresh DRBs
// Refresh DRBs
nr_rrc_rlc_config_asn1_req
(
ctxt_pP
,
//
nr_rrc_rlc_config_asn1_req(ctxt_pP,
NULL
,
//
NULL,
radioBearerConfig
->
drb_ToAddModList
,
//
radioBearerConfig->drb_ToAddModList,
NULL
,
//
NULL,
NULL
,
//
NULL,
NULL
//
NULL
);
//
);
}
// drb_ToAddModList
}
// drb_ToAddModList
if
(
radioBearerConfig
->
drb_ToReleaseList
!=
NULL
)
{
if
(
radioBearerConfig
->
drb_ToReleaseList
!=
NULL
)
{
...
@@ -2102,7 +2121,7 @@ rrc_ue_process_rrcReconfiguration(
...
@@ -2102,7 +2121,7 @@ rrc_ue_process_rrcReconfiguration(
void
nr_rrc_ue_generate_RRCReconfigurationComplete
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
,
const
uint8_t
Transaction_id
)
{
void
nr_rrc_ue_generate_RRCReconfigurationComplete
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
,
const
uint8_t
Transaction_id
)
{
uint8_t
buffer
[
32
],
size
;
uint8_t
buffer
[
32
],
size
;
size
=
do_NR_RRCReconfigurationComplete
(
ctxt_pP
,
buffer
,
Transaction_id
);
size
=
do_NR_RRCReconfigurationComplete
(
ctxt_pP
,
buffer
,
Transaction_id
);
LOG_I
(
RRC
,
PROTOCOL_RRC_CTXT_UE_FMT
" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)
\n
"
,
LOG_I
(
NR_
RRC
,
PROTOCOL_RRC_CTXT_UE_FMT
" Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes %d, gNB_index %d)
\n
"
,
PROTOCOL_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
size
,
gNB_index
);
PROTOCOL_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
size
,
gNB_index
);
LOG_D
(
RLC
,
LOG_D
(
RLC
,
"[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]
\n
"
,
"[FRAME %05d][RRC_UE][INST %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCReconfigurationComplete to gNB %d MUI %d) --->][PDCP][INST %02d][RB %02d]
\n
"
,
...
@@ -2230,16 +2249,16 @@ void *rrc_nrue_task( void *args_p ) {
...
@@ -2230,16 +2249,16 @@ void *rrc_nrue_task( void *args_p ) {
switch
(
ITTI_MSG_ID
(
msg_p
))
{
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
TERMINATE_MESSAGE
:
case
TERMINATE_MESSAGE
:
LOG_W
(
RRC
,
" *** Exiting RRC thread
\n
"
);
LOG_W
(
NR_
RRC
,
" *** Exiting RRC thread
\n
"
);
itti_exit_task
();
itti_exit_task
();
break
;
break
;
case
MESSAGE_TEST
:
case
MESSAGE_TEST
:
LOG_D
(
RRC
,
"[UE %d] Received %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
LOG_D
(
NR_
RRC
,
"[UE %d] Received %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
break
;
case
NR_RRC_MAC_BCCH_DATA_IND
:
case
NR_RRC_MAC_BCCH_DATA_IND
:
LOG_D
(
RRC
,
"[UE %d] Received %s: frameP %d, gNB %d
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
),
LOG_D
(
NR_
RRC
,
"[UE %d] Received %s: frameP %d, gNB %d
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
frame
,
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
gnb_index
);
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
frame
,
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
gnb_index
);
// PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0);
// PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0);
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
ue_mod_id
,
GNB_FLAG_NO
,
NOT_A_RNTI
,
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
frame
,
0
,
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
gnb_index
);
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
ue_mod_id
,
GNB_FLAG_NO
,
NOT_A_RNTI
,
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
frame
,
0
,
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
gnb_index
);
...
@@ -2251,7 +2270,7 @@ void *rrc_nrue_task( void *args_p ) {
...
@@ -2251,7 +2270,7 @@ void *rrc_nrue_task( void *args_p ) {
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
rsrp
);
NR_RRC_MAC_BCCH_DATA_IND
(
msg_p
).
rsrp
);
case
NR_RRC_MAC_CCCH_DATA_IND
:
case
NR_RRC_MAC_CCCH_DATA_IND
:
LOG_D
(
RRC
,
"[UE %d] RNTI %x Received %s: frameP %d, gNB %d
\n
"
,
LOG_D
(
NR_
RRC
,
"[UE %d] RNTI %x Received %s: frameP %d, gNB %d
\n
"
,
ue_mod_id
,
ue_mod_id
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
rnti
,
NR_RRC_MAC_CCCH_DATA_IND
(
msg_p
).
rnti
,
ITTI_MSG_NAME
(
msg_p
),
ITTI_MSG_NAME
(
msg_p
),
...
@@ -2293,7 +2312,7 @@ void *rrc_nrue_task( void *args_p ) {
...
@@ -2293,7 +2312,7 @@ void *rrc_nrue_task( void *args_p ) {
break
;
break
;
default:
default:
LOG_E
(
RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
LOG_E
(
NR_
RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
break
;
}
}
...
...
openair2/RRC/NR_UE/rrc_proto.h
View file @
5697057f
...
@@ -118,6 +118,12 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
...
@@ -118,6 +118,12 @@ int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP,
/**\brief RRC UE task.
/**\brief RRC UE task.
\param void *args_p Pointer on arguments to start the task. */
\param void *args_p Pointer on arguments to start the task. */
void
*
rrc_nrue_task
(
void
*
args_p
);
void
*
rrc_nrue_task
(
void
*
args_p
);
/**\brief RRC UE generate RRCSetupRequest message.
\param ctxt_pP protocol context
\param gNB_index gNB index */
void
rrc_ue_generate_RRCSetupRequest
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
uint8_t
gNB_index
);
/** @}*/
/** @}*/
#endif
#endif
openair2/SIMULATION/NR_RRC/itti_sim.c
View file @
5697057f
...
@@ -59,6 +59,7 @@ unsigned short config_frames[4] = {2,9,11,13};
...
@@ -59,6 +59,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "x2ap_eNB.h"
#include "x2ap_eNB.h"
#include "ngap_gNB.h"
#include "ngap_gNB.h"
#include "RRC/NR_UE/rrc_proto.h"
#include "RRC/NR_UE/rrc_proto.h"
#include "RRC/NR_UE/rrc_vars.h"
#include "openair3/NAS/UE/nas_ue_task.h"
#include "openair3/NAS/UE/nas_ue_task.h"
pthread_cond_t
nfapi_sync_cond
;
pthread_cond_t
nfapi_sync_cond
;
...
@@ -380,7 +381,7 @@ int create_tasks_nrue(uint32_t ue_nb) {
...
@@ -380,7 +381,7 @@ int create_tasks_nrue(uint32_t ue_nb) {
if
(
ue_nb
>
0
)
{
if
(
ue_nb
>
0
)
{
printf
(
"create TASK_RRC_NRUE
\n
"
);
printf
(
"create TASK_RRC_NRUE
\n
"
);
if
(
itti_create_task
(
TASK_RRC_NRUE
,
rrc_nrue_task
,
NULL
)
<
0
)
{
if
(
itti_create_task
(
TASK_RRC_NRUE
,
rrc_nrue_task
,
NULL
)
<
0
)
{
LOG_E
(
RRC
,
"Create task for RRC UE failed
\n
"
);
LOG_E
(
NR_
RRC
,
"Create task for RRC UE failed
\n
"
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -406,12 +407,12 @@ void *itti_sim_ue_rrc_task( void *args_p) {
...
@@ -406,12 +407,12 @@ void *itti_sim_ue_rrc_task( void *args_p) {
switch
(
ITTI_MSG_ID
(
msg_p
))
{
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
TERMINATE_MESSAGE
:
case
TERMINATE_MESSAGE
:
LOG_W
(
RRC
,
" *** Exiting RRC thread
\n
"
);
LOG_W
(
NR_
RRC
,
" *** Exiting RRC thread
\n
"
);
itti_exit_task
();
itti_exit_task
();
break
;
break
;
case
MESSAGE_TEST
:
case
MESSAGE_TEST
:
LOG_D
(
RRC
,
"[UE %d] Received %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
LOG_D
(
NR_
RRC
,
"[UE %d] Received %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
break
;
case
GNB_RRC_BCCH_DATA_IND
:
case
GNB_RRC_BCCH_DATA_IND
:
message_p
=
itti_alloc_new_message
(
TASK_RRC_NRUE
,
NR_RRC_MAC_BCCH_DATA_IND
);
message_p
=
itti_alloc_new_message
(
TASK_RRC_NRUE
,
NR_RRC_MAC_BCCH_DATA_IND
);
...
@@ -433,12 +434,11 @@ void *itti_sim_ue_rrc_task( void *args_p) {
...
@@ -433,12 +434,11 @@ void *itti_sim_ue_rrc_task( void *args_p) {
message_p
=
itti_alloc_new_message
(
TASK_RRC_NRUE
,
NR_RRC_DCCH_DATA_IND
);
message_p
=
itti_alloc_new_message
(
TASK_RRC_NRUE
,
NR_RRC_DCCH_DATA_IND
);
NR_RRC_DCCH_DATA_IND
(
message_p
).
dcch_index
=
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
rbid
;
NR_RRC_DCCH_DATA_IND
(
message_p
).
dcch_index
=
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
rbid
;
NR_RRC_DCCH_DATA_IND
(
message_p
).
sdu_size
=
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
size
;
NR_RRC_DCCH_DATA_IND
(
message_p
).
sdu_size
=
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
size
;
memset
(
NR_RRC_DCCH_DATA_IND
(
message_p
).
sdu_p
,
0
,
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
size
);
NR_RRC_DCCH_DATA_IND
(
message_p
).
sdu_p
=
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
sdu
;
memcpy
(
NR_RRC_DCCH_DATA_IND
(
message_p
).
sdu_p
,
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
sdu
,
GNB_RRC_DCCH_DATA_IND
(
msg_p
).
size
);
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
instance
,
message_p
);
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
instance
,
message_p
);
break
;
break
;
default:
default:
LOG_E
(
RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
LOG_E
(
NR_
RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
break
;
}
}
...
@@ -464,30 +464,30 @@ void *itti_sim_gnb_rrc_task( void *args_p) {
...
@@ -464,30 +464,30 @@ void *itti_sim_gnb_rrc_task( void *args_p) {
switch
(
ITTI_MSG_ID
(
msg_p
))
{
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
TERMINATE_MESSAGE
:
case
TERMINATE_MESSAGE
:
LOG_W
(
RRC
,
" *** Exiting RRC thread
\n
"
);
LOG_W
(
NR_
RRC
,
" *** Exiting RRC thread
\n
"
);
itti_exit_task
();
itti_exit_task
();
break
;
break
;
case
MESSAGE_TEST
:
case
MESSAGE_TEST
:
LOG_D
(
RRC
,
"[UE %d] Received %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
LOG_D
(
NR_
RRC
,
"[UE %d] Received %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
break
;
case
UE_RRC_CCCH_DATA_IND
:
case
UE_RRC_CCCH_DATA_IND
:
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
NR_RRC_MAC_CCCH_DATA_IND
);
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
NR_RRC_MAC_CCCH_DATA_IND
);
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu_size
=
UE_RRC_CCCH_DATA_IND
(
msg_p
).
size
;
NR_
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu_size
=
UE_RRC_CCCH_DATA_IND
(
msg_p
).
size
;
memset
(
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu
,
0
,
CCCH_SDU_SIZE
);
memset
(
NR_
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu
,
0
,
CCCH_SDU_SIZE
);
memcpy
(
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu
,
UE_RRC_CCCH_DATA_IND
(
msg_p
).
sdu
,
UE_RRC_CCCH_DATA_IND
(
msg_p
).
size
);
memcpy
(
NR_
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu
,
UE_RRC_CCCH_DATA_IND
(
msg_p
).
sdu
,
UE_RRC_CCCH_DATA_IND
(
msg_p
).
size
);
itti_send_msg_to_task
(
TASK_RRC_GNB
,
instance
,
message_p
);
itti_send_msg_to_task
(
TASK_RRC_GNB
,
instance
,
message_p
);
break
;
break
;
case
UE_RRC_DCCH_DATA_IND
:
case
UE_RRC_DCCH_DATA_IND
:
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
NR_RRC_DCCH_DATA_IND
);
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
NR_RRC_DCCH_DATA_IND
);
RRC_DCCH_DATA_IND
(
message_p
).
sdu_size
=
UE_RRC_DCCH_DATA_IND
(
msg_p
).
size
;
NR_
RRC_DCCH_DATA_IND
(
message_p
).
sdu_size
=
UE_RRC_DCCH_DATA_IND
(
msg_p
).
size
;
memset
(
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu
,
0
,
UE_RRC_DCCH_DATA_IND
(
msg_p
).
size
)
;
NR_RRC_DCCH_DATA_IND
(
message_p
).
dcch_index
=
UE_RRC_DCCH_DATA_IND
(
msg_p
).
rbid
;
memcpy
(
RRC_MAC_CCCH_DATA_IND
(
message_p
).
sdu
,
UE_RRC_DCCH_DATA_IND
(
msg_p
).
sdu
,
UE_RRC_DCCH_DATA_IND
(
msg_p
).
size
)
;
NR_RRC_DCCH_DATA_IND
(
message_p
).
sdu_p
=
UE_RRC_DCCH_DATA_IND
(
msg_p
).
sdu
;
itti_send_msg_to_task
(
TASK_RRC_GNB
,
instance
,
message_p
);
itti_send_msg_to_task
(
TASK_RRC_GNB
,
instance
,
message_p
);
break
;
break
;
default:
default:
LOG_E
(
RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
LOG_E
(
NR_
RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
break
;
}
}
...
@@ -584,7 +584,25 @@ int main( int argc, char **argv )
...
@@ -584,7 +584,25 @@ int main( int argc, char **argv )
// wait for end of program
// wait for end of program
printf
(
"TYPE <CTRL-C> TO TERMINATE
\n
"
);
printf
(
"TYPE <CTRL-C> TO TERMINATE
\n
"
);
usleep
(
10000
);
protocol_ctxt_t
ctxt
;
struct
rrc_gNB_ue_context_s
*
ue_context_p
=
NULL
;
ue_context_p
=
rrc_gNB_allocate_new_UE_context
(
RC
.
nrrrc
[
0
]);
if
(
ue_context_p
==
NULL
){
printf
(
"ue_context_p == NULL"
);
}
PROTOCOL_CTXT_SET_BY_INSTANCE
(
&
ctxt
,
0
,
ENB_FLAG_YES
,
0
,
0
,
0
);
NR_UE_rrc_inst
[
ctxt
.
module_id
].
Info
[
0
].
State
=
RRC_SI_RECEIVED
;
rrc_ue_generate_RRCSetupRequest
(
&
ctxt
,
0
);
#if 0
#if 0
// test itti sim
// test itti sim
...
...
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