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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
a6f1fe5f
Commit
a6f1fe5f
authored
Aug 10, 2022
by
Sakthivel Velumani
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unified bearer context message transfer for E1 and non-E1 mode
compiles, to be tested
parent
f245ace2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
199 additions
and
212 deletions
+199
-212
openair2/RRC/NR/nr_rrc_defs.h
openair2/RRC/NR/nr_rrc_defs.h
+4
-0
openair2/RRC/NR/nr_rrc_proto.h
openair2/RRC/NR/nr_rrc_proto.h
+7
-0
openair2/RRC/NR/rrc_gNB.c
openair2/RRC/NR/rrc_gNB.c
+107
-26
openair2/RRC/NR/rrc_gNB_GTPV1U.c
openair2/RRC/NR/rrc_gNB_GTPV1U.c
+6
-8
openair2/RRC/NR/rrc_gNB_GTPV1U.h
openair2/RRC/NR/rrc_gNB_GTPV1U.h
+1
-2
openair2/RRC/NR/rrc_gNB_NGAP.c
openair2/RRC/NR/rrc_gNB_NGAP.c
+74
-176
No files found.
openair2/RRC/NR/nr_rrc_defs.h
View file @
a6f1fe5f
...
...
@@ -467,9 +467,12 @@ typedef struct {
int
do_drb_integrity
;
}
nr_security_configuration_t
;
typedef
void
(
*
nr_e1_bearer_cxt_msg_transfer_func_t
)(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
);
typedef
struct
nr_mac_rrc_dl_if_s
{
/* TODO add other message types as necessary */
dl_rrc_message_transfer_func_t
dl_rrc_message_transfer
;
nr_e1_bearer_cxt_msg_transfer_func_t
nr_e1_bearer_cxt_msg_transfer
;
}
nr_mac_rrc_dl_if_t
;
//---NR---(completely change)---------------------
...
...
@@ -523,6 +526,7 @@ typedef struct gNB_RRC_INST_s {
nr_security_configuration_t
security
;
nr_mac_rrc_dl_if_t
mac_rrc
;
}
gNB_RRC_INST
;
#include "nr_rrc_proto.h" //should be put here otherwise compilation error
...
...
openair2/RRC/NR/nr_rrc_proto.h
View file @
a6f1fe5f
...
...
@@ -218,3 +218,10 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, rnti_t rnti,
uint8_t
*
const
kUPenc
,
uint8_t
*
const
kUPint
,
struct
NR_CellGroupConfig__rlc_BearerToAddModList
*
rlc_bearer2add_list
);
void
bearer_context_setup_direct
(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
);
void
bearer_context_setup_e1ap
(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
);
openair2/RRC/NR/rrc_gNB.c
View file @
a6f1fe5f
...
...
@@ -84,7 +84,7 @@
#include "rrc_eNB_S1AP.h"
#include "rrc_gNB_NGAP.h"
#include "rrc_
e
NB_GTPV1U.h"
#include "rrc_
g
NB_GTPV1U.h"
#include "nr_pdcp/nr_pdcp_entity.h"
#include "pdcp.h"
...
...
@@ -200,8 +200,11 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration
static
void
rrc_gNB_mac_rrc_init
(
gNB_RRC_INST
*
rrc
)
{
switch
(
rrc
->
node_type
)
{
case
ngran_gNB_CUCP
:
rrc
->
cu_if
.
nr_e1_bearer_cxt_msg_transfer
=
bearer_context_setup_e1ap
;
case
ngran_gNB_CU
:
mac_rrc_dl_f1ap_init
(
&
rrc
->
mac_rrc
);
rrc
->
mac_rrc
.
nr_e1_bearer_cxt_msg_transfer
=
bearer_context_setup_direct
;
break
;
case
ngran_gNB_DU
:
/* silently drop this, as we currently still need the RRC at the DU. As
...
...
@@ -210,6 +213,7 @@ static void rrc_gNB_mac_rrc_init(gNB_RRC_INST *rrc)
break
;
case
ngran_gNB
:
mac_rrc_dl_direct_init
(
&
rrc
->
mac_rrc
);
rrc
->
mac_rrc
.
nr_e1_bearer_cxt_msg_transfer
=
bearer_context_setup_direct
;
break
;
default:
AssertFatal
(
0
==
1
,
"Unknown node type %d
\n
"
,
rrc
->
node_type
);
...
...
@@ -3936,33 +3940,33 @@ void fill_DRB_configList(NR_DRB_ToAddModList_t *DRB_configList, pdu_session_to_s
}
}
int
rrc_gNB_process_e1_bearer_context_setup_req
(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
)
{
gtpv1u_gnb_create_tunnel_req_t
create_tunnel_req
=
{
0
};
gtpv1u_gnb_create_tunnel_resp_t
create_tunnel_resp
=
{
0
};
int
drb_config_gtpu_create
(
e1ap_bearer_setup_req_t
*
req
,
gtpv1u_gnb_create_tunnel_req_t
*
create_tunnel_req
,
gtpv1u_gnb_create_tunnel_resp_t
*
create_tunnel_resp
,
instance_t
instance
)
{
NR_DRB_ToAddModList_t
DRB_configList
=
{
0
};
for
(
int
i
=
0
;
i
<
req
->
numPDUSessions
;
i
++
)
{
pdu_session_to_setup_t
*
pdu
=
&
req
->
pduSession
[
i
];
create_tunnel_req
.
pdusession_id
[
i
]
=
pdu
->
sessionId
;
create_tunnel_req
.
incoming_rb_id
[
i
]
=
pdu
->
DRBnGRanList
[
0
].
id
;
// taking only the first DRB. TODO:change this
memcpy
(
&
create_tunnel_req
.
dst_addr
[
i
].
buffer
,
create_tunnel_req
->
pdusession_id
[
i
]
=
pdu
->
sessionId
;
create_tunnel_req
->
incoming_rb_id
[
i
]
=
pdu
->
DRBnGRanList
[
0
].
id
;
// taking only the first DRB. TODO:change this
memcpy
(
&
create_tunnel_req
->
dst_addr
[
i
].
buffer
,
&
pdu
->
tlAddress
,
sizeof
(
uint8_t
)
*
4
);
create_tunnel_req
.
dst_addr
[
i
].
length
=
32
;
// 8bits * 4bytes
create_tunnel_req
.
outgoing_teid
[
i
]
=
pdu
->
teId
;
create_tunnel_req
->
dst_addr
[
i
].
length
=
32
;
// 8bits * 4bytes
create_tunnel_req
->
outgoing_teid
[
i
]
=
pdu
->
teId
;
fill_DRB_configList
(
&
DRB_configList
,
pdu
);
}
create_tunnel_req
.
num_tunnels
=
req
->
numPDUSessions
;
create_tunnel_req
.
ue_id
=
(
req
->
gNB_cu_cp_ue_id
&
0xFFFF
);
create_tunnel_req
->
num_tunnels
=
req
->
numPDUSessions
;
create_tunnel_req
->
ue_id
=
(
req
->
gNB_cu_cp_ue_id
&
0xFFFF
);
int
ret
=
gtpv1u_create_ngu_tunnel
(
instance
,
&
create_tunnel_req
,
&
create_tunnel_resp
);
create_tunnel_req
,
create_tunnel_resp
);
if
(
ret
!=
0
)
{
LOG_E
(
NR_RRC
,
"rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE id %ld
\n
"
,
create_tunnel_req
.
ue_id
);
create_tunnel_req
->
ue_id
);
return
ret
;
}
...
...
@@ -3979,11 +3983,20 @@ int rrc_gNB_process_e1_bearer_context_setup_req(e1ap_bearer_setup_req_t *req, in
&
kUPint
);
nr_pdcp_e1_add_drbs
(
false
,
create_tunnel_req
.
ue_id
,
create_tunnel_req
->
ue_id
,
&
DRB_configList
,
(
req
->
integrityProtectionAlgorithm
<<
4
)
|
req
->
cipheringAlgorithm
,
kUPenc
,
kUPint
);
return
ret
;
}
int
rrc_gNB_process_e1_bearer_context_setup_req
(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
)
{
gtpv1u_gnb_create_tunnel_req_t
create_tunnel_req
=
{
0
};
gtpv1u_gnb_create_tunnel_resp_t
create_tunnel_resp
=
{
0
};
int
ret
=
drb_config_gtpu_create
(
req
,
&
create_tunnel_req
,
&
create_tunnel_resp
,
instance
);
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
instance
,
E1AP_BEARER_CONTEXT_SETUP_RESP
);
...
...
@@ -3996,8 +4009,10 @@ int rrc_gNB_process_e1_bearer_context_setup_req(e1ap_bearer_setup_req_t *req, in
pdu_session_to_setup_t
*
pdu2Setup
=
req
->
pduSession
+
i
;
pduSetup
->
id
=
pdu2Setup
->
sessionId
;
memcpy
(
&
pduSetup
->
tlAddress
,
&
pdu2Setup
->
tlAddress
,
sizeof
(
in_addr_t
));
pduSetup
->
teId
=
pdu2Setup
->
teId
;
memcpy
(
&
pduSetup
->
tlAddress
,
&
create_tunnel_resp
.
gnb_addr
.
buffer
,
sizeof
(
in_addr_t
));
pduSetup
->
teId
=
create_tunnel_resp
.
gnb_NGu_teid
[
i
];
pduSetup
->
numDRBSetup
=
pdu2Setup
->
numDRB2Setup
;
for
(
int
j
=
0
;
j
<
pdu2Setup
->
numDRB2Setup
;
j
++
)
{
...
...
@@ -4030,18 +4045,14 @@ int rrc_gNB_process_e1_bearer_context_setup_req(e1ap_bearer_setup_req_t *req, in
return
ret
;
}
void
rrc_gNB_process_e1_bearer_context_setup_resp
(
e1ap_bearer_setup_resp_t
*
resp
,
instance_t
instance
)
{
// Find the UE context from UE ID and send ITTI message to F1AP to send UE context modification message to DU
uint16_t
ue_initial_id
=
0
;
// Making an invalid UE initial ID
rrc_gNB_ue_context_t
*
ue_context_p
=
rrc_gNB_get_ue_context_from_ngap_ids
(
instance
,
ue_initial_id
,
resp
->
gNB_cu_cp_ue_id
);
protocol_ctxt_t
ctxt
=
{
0
};
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
GNB_FLAG_YES
,
ue_context_p
->
ue_context
.
rnti
,
0
,
0
,
0
);
void
prepare_and_send_ue_context_modification_f1
(
rrc_gNB_ue_context_t
*
ue_context_p
)
{
/*Generate a UE context modification request message towards the DU to instruct the DU
*for SRB2 and DRB configuration and get the updates on master cell group config from the DU*/
// TODO: code repetition. very bad. And so many hard codings
protocol_ctxt_t
ctxt
=
{
0
};
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
GNB_FLAG_YES
,
ue_context_p
->
ue_context
.
rnti
,
0
,
0
,
0
);
// TODO: So many hard codings
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
0
,
F1AP_UE_CONTEXT_MODIFICATION_REQ
);
f1ap_ue_context_setup_t
*
req
=&
F1AP_UE_CONTEXT_MODIFICATION_REQ
(
message_p
);
...
...
@@ -4075,6 +4086,76 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp
itti_send_msg_to_task
(
TASK_CU_F1
,
ctxt
.
module_id
,
message_p
);
}
void
bearer_context_setup_direct
(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
)
{
gtpv1u_gnb_create_tunnel_req_t
create_tunnel_req
=
{
0
};
gtpv1u_gnb_create_tunnel_resp_t
create_tunnel_resp
=
{
0
};
uint16_t
ue_initial_id
=
0
;
// Making an invalid UE initial ID
rrc_gNB_ue_context_t
*
ue_context_p
=
rrc_gNB_get_ue_context_from_ngap_ids
(
instance
,
ue_initial_id
,
req
->
gNB_cu_cp_ue_id
);
protocol_ctxt_t
ctxt
=
{
0
};
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
GNB_FLAG_YES
,
ue_context_p
->
ue_context
.
rnti
,
0
,
0
,
0
);
int
ret
=
drb_config_gtpu_create
(
req
,
&
create_tunnel_req
,
&
create_tunnel_resp
,
instance
);
if
(
ret
<
0
)
AssertFatal
(
false
,
"Unable to configure DRB or to create GTP Tunnel
\n
"
);
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP
(
&
ctxt
,
&
create_tunnel_resp
);
ue_context_p
->
ue_context
.
setup_pdu_sessions
+=
create_tunnel_resp
.
num_tunnels
;
if
(
!
NODE_IS_CU
(
RC
.
nrrrc
[
ctxt
.
module_id
]
->
node_type
)){
rrc_gNB_generate_dedicatedRRCReconfiguration
(
&
ctxt
,
ue_context_p
,
NULL
);
}
else
{
prepare_and_send_ue_context_modification_f1
(
ue_context_p
);
}
// call the code that sends UE context modification message to DU
}
void
bearer_context_setup_e1ap
(
e1ap_bearer_setup_req_t
*
req
,
instance_t
instance
)
{
// create ITTI msg and send to CUCP E1 task to send via SCTP
// then in CUUP the function rrc_gNB_process_e1_bearer_context_setup_req
uint16_t
ue_initial_id
=
0
;
// Making an invalid UE initial ID
rrc_gNB_ue_context_t
*
ue_context_p
=
rrc_gNB_get_ue_context_from_ngap_ids
(
instance
,
ue_initial_id
,
req
->
gNB_cu_cp_ue_id
);
protocol_ctxt_t
ctxt
=
{
0
};
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
GNB_FLAG_YES
,
ue_context_p
->
ue_context
.
rnti
,
0
,
0
,
0
);
MessageDef
*
msg_p
=
itti_alloc_new_message
(
TASK_CUCP_E1
,
0
,
E1AP_BEARER_CONTEXT_SETUP_REQ
);
e1ap_bearer_setup_req_t
*
bearer_req
=
&
E1AP_BEARER_CONTEXT_SETUP_REQ
(
msg_p
);
memcpy
(
bearer_req
,
req
,
sizeof
(
e1ap_bearer_setup_req_t
));
free
(
req
);
itti_send_msg_to_task
(
TASK_CUCP_E1
,
ctxt
.
module_id
,
msg_p
);
}
void
rrc_gNB_process_e1_bearer_context_setup_resp
(
e1ap_bearer_setup_resp_t
*
resp
,
instance_t
instance
)
{
// Find the UE context from UE ID and send ITTI message to F1AP to send UE context modification message to DU
uint16_t
ue_initial_id
=
0
;
// Making an invalid UE initial ID
rrc_gNB_ue_context_t
*
ue_context_p
=
rrc_gNB_get_ue_context_from_ngap_ids
(
instance
,
ue_initial_id
,
resp
->
gNB_cu_cp_ue_id
);
protocol_ctxt_t
ctxt
=
{
0
};
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
0
,
GNB_FLAG_YES
,
ue_context_p
->
ue_context
.
rnti
,
0
,
0
,
0
);
gtpv1u_gnb_create_tunnel_resp_t
create_tunnel_resp
=
{
0
};
for
(
int
i
=
0
;
i
<
resp
->
numPDUSessions
;
i
++
)
{
create_tunnel_resp
.
pdusession_id
[
i
]
=
resp
->
pduSession
[
i
].
id
;
create_tunnel_resp
.
gnb_NGu_teid
[
i
]
=
resp
->
pduSession
[
i
].
teId
;
memcpy
(
create_tunnel_resp
.
gnb_addr
.
buffer
,
&
resp
->
pduSession
[
i
].
tlAddress
,
sizeof
(
in_addr_t
));
create_tunnel_resp
.
gnb_addr
.
length
=
sizeof
(
in_addr_t
)
*
8
;
// IPv4 bit length
}
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP
(
&
ctxt
,
&
create_tunnel_resp
);
ue_context_p
->
ue_context
.
setup_pdu_sessions
+=
resp
->
numPDUSessions
;
prepare_and_send_ue_context_modification_f1
(
ue_context_p
);
}
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
void
*
rrc_gnb_task
(
void
*
args_p
)
{
...
...
openair2/RRC/NR/rrc_gNB_GTPV1U.c
View file @
a6f1fe5f
...
...
@@ -86,8 +86,7 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
int
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
gtpv1u_gnb_create_tunnel_resp_t
*
const
create_tunnel_resp_pP
,
uint8_t
*
inde_list
const
gtpv1u_gnb_create_tunnel_resp_t
*
const
create_tunnel_resp_pP
)
{
rnti_t
rnti
;
int
i
;
...
...
@@ -103,14 +102,13 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
ctxt_pP
->
rnti
);
for
(
i
=
0
;
i
<
create_tunnel_resp_pP
->
num_tunnels
;
i
++
)
{
ue_context_p
->
ue_context
.
gnb_gtp_teid
[
i
nde_list
[
i
]
]
=
create_tunnel_resp_pP
->
gnb_NGu_teid
[
i
];
ue_context_p
->
ue_context
.
gnb_gtp_addrs
[
i
nde_list
[
i
]
]
=
create_tunnel_resp_pP
->
gnb_addr
;
ue_context_p
->
ue_context
.
gnb_gtp_psi
[
i
nde_list
[
i
]
]
=
create_tunnel_resp_pP
->
pdusession_id
[
i
];
LOG_I
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP tunnel (%u, %u) bearer UE context index %u,
msg index %u,
id %u, gtp addr len %d
\n
"
,
ue_context_p
->
ue_context
.
gnb_gtp_teid
[
i
]
=
create_tunnel_resp_pP
->
gnb_NGu_teid
[
i
];
ue_context_p
->
ue_context
.
gnb_gtp_addrs
[
i
]
=
create_tunnel_resp_pP
->
gnb_addr
;
ue_context_p
->
ue_context
.
gnb_gtp_psi
[
i
]
=
create_tunnel_resp_pP
->
pdusession_id
[
i
];
LOG_I
(
NR_RRC
,
PROTOCOL_NR_RRC_CTXT_UE_FMT
" nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP tunnel (%u, %u) bearer UE context index %u, id %u, gtp addr len %d
\n
"
,
PROTOCOL_NR_RRC_CTXT_UE_ARGS
(
ctxt_pP
),
create_tunnel_resp_pP
->
gnb_NGu_teid
[
i
],
ue_context_p
->
ue_context
.
gnb_gtp_teid
[
inde_list
[
i
]],
inde_list
[
i
],
ue_context_p
->
ue_context
.
gnb_gtp_teid
[
i
],
i
,
create_tunnel_resp_pP
->
pdusession_id
[
i
],
create_tunnel_resp_pP
->
gnb_addr
.
length
);
...
...
openair2/RRC/NR/rrc_gNB_GTPV1U.h
View file @
a6f1fe5f
...
...
@@ -41,8 +41,7 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
int
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP
(
const
protocol_ctxt_t
*
const
ctxt_pP
,
const
gtpv1u_gnb_create_tunnel_resp_t
*
const
create_tunnel_resp_pP
,
uint8_t
*
inde_list
const
gtpv1u_gnb_create_tunnel_resp_t
*
const
create_tunnel_resp_pP
);
#endif
openair2/RRC/NR/rrc_gNB_NGAP.c
View file @
a6f1fe5f
...
...
@@ -477,7 +477,6 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
protocol_ctxt_t
ctxt
=
{
0
};
uint8_t
pdu_sessions_done
=
0
;
gtpv1u_gnb_create_tunnel_resp_t
create_tunnel_resp
;
uint8_t
inde_list
[
NR_NB_RB_MAX
-
3
]
=
{
0
};
int
ret
=
0
;
ue_initial_id
=
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
ue_initial_id
;
...
...
@@ -523,7 +522,6 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
i
,
create_tunnel_req
.
outgoing_teid
[
pdu_sessions_done
],
create_tunnel_req
.
pdusession_id
[
pdu_sessions_done
]);
inde_list
[
pdu_sessions_done
]
=
i
;
pdu_sessions_done
++
;
if
(
pdu_sessions_done
>=
nb_pdusessions_tosetup
)
{
...
...
@@ -552,8 +550,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP
(
&
ctxt
,
&
create_tunnel_resp
,
&
inde_list
[
0
]);
&
create_tunnel_resp
);
ue_context_p
->
ue_context
.
setup_pdu_sessions
+=
NGAP_INITIAL_CONTEXT_SETUP_REQ
(
msg_p
).
nb_of_pdusessions
;
ue_context_p
->
ue_context
.
established_pdu_sessions_flag
=
1
;
}
...
...
@@ -962,9 +959,6 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
uint32_t
gNB_ue_ngap_id
;
rrc_gNB_ue_context_t
*
ue_context_p
=
NULL
;
protocol_ctxt_t
ctxt
=
{
0
};
uint8_t
pdu_sessions_done
;
uint8_t
inde_list
[
NR_NB_RB_MAX
-
3
]
=
{
0
};
int
ret
=
0
;
ngap_pdusession_setup_req_t
*
msg
=&
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
);
ue_initial_id
=
msg
->
ue_initial_id
;
...
...
@@ -985,181 +979,85 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
return
;
}
if
(
rrc
->
node_type
==
ngran_gNB_CUCP
)
{
// E1 split CU-CP node
/* Configurations are referred from rrc_gNB_generate_dedicatedRRCReconfiguration() and
rrc_gNB_process_RRCReconfigurationComplete()
At CU-CP we configure the E1 bearer context setup parameters (PDU sessions, DRBs and
QoS flows) same as in these functions. At CU-UP we create PDU Sessions and allocate DRBs.
*/
MessageDef
*
msg_p
=
itti_alloc_new_message
(
TASK_CUCP_E1
,
0
,
E1AP_BEARER_CONTEXT_SETUP_REQ
);
e1ap_bearer_setup_req_t
*
bearer_req
=
&
E1AP_BEARER_CONTEXT_SETUP_REQ
(
msg_p
);
bearer_req
->
gNB_cu_cp_ue_id
=
gNB_ue_ngap_id
;
bearer_req
->
cipheringAlgorithm
=
ue_context_p
->
ue_context
.
ciphering_algorithm
;
memcpy
(
bearer_req
->
encryptionKey
,
ue_context_p
->
ue_context
.
kgnb
,
sizeof
(
ue_context_p
->
ue_context
.
kgnb
));
bearer_req
->
integrityProtectionAlgorithm
=
ue_context_p
->
ue_context
.
integrity_algorithm
;
memcpy
(
bearer_req
->
integrityProtectionKey
,
ue_context_p
->
ue_context
.
kgnb
,
sizeof
(
ue_context_p
->
ue_context
.
kgnb
));
bearer_req
->
ueDlAggMaxBitRate
=
msg
->
ueAggMaxBitRateDownlink
;
bearer_req
->
numPDUSessions
=
msg
->
nb_pdusessions_tosetup
;
for
(
int
i
=
0
;
i
<
bearer_req
->
numPDUSessions
;
i
++
)
{
pdu_session_to_setup_t
*
pdu
=
bearer_req
->
pduSession
+
i
;
pdu
->
sessionId
=
msg
->
pdusession_setup_params
[
i
].
pdusession_id
;
pdu
->
sessionType
=
msg
->
pdusession_setup_params
[
i
].
upf_addr
.
pdu_session_type
;
pdu
->
sst
=
msg
->
allowed_nssai
[
i
].
sST
;
if
(
rrc
->
security
.
do_drb_integrity
)
{
pdu
->
integrityProtectionIndication
=
E1AP_IntegrityProtectionIndication_required
;
}
if
(
rrc
->
security
.
do_drb_ciphering
)
{
pdu
->
confidentialityProtectionIndication
=
E1AP_ConfidentialityProtectionIndication_required
;
}
pdu
->
teId
=
msg
->
pdusession_setup_params
[
i
].
gtp_teid
;
memcpy
(
&
pdu
->
tlAddress
,
msg
->
pdusession_setup_params
[
i
].
upf_addr
.
buffer
,
sizeof
(
uint8_t
)
*
4
);
pdu
->
numDRB2Setup
=
1
;
// One DRB per PDU Session. TODO: Remove hardcoding
for
(
int
j
=
0
;
j
<
pdu
->
numDRB2Setup
;
j
++
)
{
DRB_nGRAN_to_setup_t
*
drb
=
pdu
->
DRBnGRanList
+
j
;
drb
->
id
=
i
+
j
+
1
;
drb
->
defaultDRB
=
E1AP_DefaultDRB_true
;
drb
->
sDAP_Header_UL
=
!
(
rrc
->
configuration
.
enable_sdap
);
drb
->
sDAP_Header_DL
=
!
(
rrc
->
configuration
.
enable_sdap
);
drb
->
pDCP_SN_Size_UL
=
E1AP_PDCP_SN_Size_s_18
;
drb
->
pDCP_SN_Size_DL
=
E1AP_PDCP_SN_Size_s_18
;
ue_context_p
->
ue_context
.
nb_of_pdusessions
=
msg
->
nb_pdusessions_tosetup
;
ue_context_p
->
ue_context
.
gNB_ue_ngap_id
=
msg
->
gNB_ue_ngap_id
;
ue_context_p
->
ue_context
.
amf_ue_ngap_id
=
msg
->
amf_ue_ngap_id
;
drb
->
discardTimer
=
E1AP_DiscardTimer_infinity
;
drb
->
reorderingTimer
=
E1AP_T_Reordering_ms0
;
drb
->
rLC_Mode
=
E1AP_RLC_Mode_rlc_am
;
drb
->
numCellGroups
=
1
;
// assume one cell group associated with a DRB
for
(
int
k
=
0
;
k
<
drb
->
numCellGroups
;
k
++
)
{
cell_group_t
*
cellGroup
=
drb
->
cellGroupList
+
k
;
cellGroup
->
id
=
0
;
// MCG
}
drb
->
numQosFlow2Setup
=
msg
->
pdusession_setup_params
[
i
].
nb_qos
;
for
(
int
k
=
0
;
k
<
drb
->
numQosFlow2Setup
;
k
++
)
{
qos_flow_to_setup_t
*
qos
=
drb
->
qosFlows
+
k
;
qos
->
id
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
qfi
;
qos
->
fiveQI
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
fiveQI
;
qos
->
fiveQI_type
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
fiveQI_type
;
qos
->
qoSPriorityLevel
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
allocation_retention_priority
.
priority_level
;
qos
->
pre_emptionCapability
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
allocation_retention_priority
.
pre_emp_capability
;
qos
->
pre_emptionVulnerability
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
allocation_retention_priority
.
pre_emp_vulnerability
;
}
}
/* Configurations are referred from rrc_gNB_generate_dedicatedRRCReconfiguration() and
rrc_gNB_process_RRCReconfigurationComplete()
At CU-CP we configure the E1 bearer context setup parameters (PDU sessions, DRBs and
QoS flows) same as in these functions. At CU-UP we create PDU Sessions and allocate DRBs.
*/
e1ap_bearer_setup_req_t
*
bearer_req
=
calloc
(
1
,
sizeof
(
e1ap_bearer_setup_req_t
));
bearer_req
->
gNB_cu_cp_ue_id
=
gNB_ue_ngap_id
;
bearer_req
->
cipheringAlgorithm
=
ue_context_p
->
ue_context
.
ciphering_algorithm
;
memcpy
(
bearer_req
->
encryptionKey
,
ue_context_p
->
ue_context
.
kgnb
,
sizeof
(
ue_context_p
->
ue_context
.
kgnb
));
bearer_req
->
integrityProtectionAlgorithm
=
ue_context_p
->
ue_context
.
integrity_algorithm
;
memcpy
(
bearer_req
->
integrityProtectionKey
,
ue_context_p
->
ue_context
.
kgnb
,
sizeof
(
ue_context_p
->
ue_context
.
kgnb
));
bearer_req
->
ueDlAggMaxBitRate
=
msg
->
ueAggMaxBitRateDownlink
;
bearer_req
->
numPDUSessions
=
msg
->
nb_pdusessions_tosetup
;
for
(
int
i
=
0
;
i
<
bearer_req
->
numPDUSessions
;
i
++
)
{
ue_context_p
->
ue_context
.
pduSession
[
i
].
param
=
msg
->
pdusession_setup_params
[
i
];
pdu_session_to_setup_t
*
pdu
=
bearer_req
->
pduSession
+
i
;
pdu
->
sessionId
=
msg
->
pdusession_setup_params
[
i
].
pdusession_id
;
pdu
->
sessionType
=
msg
->
pdusession_setup_params
[
i
].
upf_addr
.
pdu_session_type
;
pdu
->
sst
=
msg
->
allowed_nssai
[
i
].
sST
;
if
(
rrc
->
security
.
do_drb_integrity
)
{
pdu
->
integrityProtectionIndication
=
E1AP_IntegrityProtectionIndication_required
;
}
itti_send_msg_to_task
(
TASK_CUCP_E1
,
ctxt
.
module_id
,
msg_p
);
return
;
}
if
(
rrc
->
security
.
do_drb_ciphering
)
{
pdu
->
confidentialityProtectionIndication
=
E1AP_ConfidentialityProtectionIndication_required
;
}
pdu
->
teId
=
msg
->
pdusession_setup_params
[
i
].
gtp_teid
;
memcpy
(
&
pdu
->
tlAddress
,
msg
->
pdusession_setup_params
[
i
].
upf_addr
.
buffer
,
sizeof
(
uint8_t
)
*
4
);
// No E1-AP
gtpv1u_gnb_create_tunnel_req_t
create_tunnel_req
=
{
0
};
gtpv1u_gnb_create_tunnel_resp_t
create_tunnel_resp
=
{
0
};
uint8_t
nb_pdusessions_tosetup
=
msg
->
nb_pdusessions_tosetup
;
pdu_sessions_done
=
0
;
for
(
int
i
=
0
;
i
<
NR_NB_RB_MAX
-
3
;
i
++
)
{
if
(
ue_context_p
->
ue_context
.
pduSession
[
i
].
status
>=
PDU_SESSION_STATUS_DONE
)
continue
;
ue_context_p
->
ue_context
.
pduSession
[
i
].
status
=
PDU_SESSION_STATUS_NEW
;
ue_context_p
->
ue_context
.
pduSession
[
i
].
param
=
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
).
pdusession_setup_params
[
pdu_sessions_done
];
create_tunnel_req
.
pdusession_id
[
pdu_sessions_done
]
=
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
).
pdusession_setup_params
[
pdu_sessions_done
].
pdusession_id
;
create_tunnel_req
.
incoming_rb_id
[
pdu_sessions_done
]
=
i
+
1
;
create_tunnel_req
.
outgoing_teid
[
pdu_sessions_done
]
=
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
).
pdusession_setup_params
[
pdu_sessions_done
].
gtp_teid
;
create_tunnel_req
.
outgoing_qfi
[
pdu_sessions_done
]
=
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
).
pdusession_setup_params
[
pdu_sessions_done
].
qos
[
0
].
qfi
;
memcpy
(
create_tunnel_req
.
dst_addr
[
pdu_sessions_done
].
buffer
,
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
).
pdusession_setup_params
[
pdu_sessions_done
].
upf_addr
.
buffer
,
sizeof
(
uint8_t
)
*
20
);
create_tunnel_req
.
dst_addr
[
pdu_sessions_done
].
length
=
NGAP_PDUSESSION_SETUP_REQ
(
msg_p
).
pdusession_setup_params
[
pdu_sessions_done
].
upf_addr
.
length
;
LOG_I
(
NR_RRC
,
"NGAP PDUSESSION SETUP REQ: local index %d teid %u, pdusession id %d
\n
"
,
i
,
create_tunnel_req
.
outgoing_teid
[
pdu_sessions_done
],
create_tunnel_req
.
pdusession_id
[
pdu_sessions_done
]);
inde_list
[
pdu_sessions_done
]
=
i
;
pdu_sessions_done
++
;
if
(
pdu_sessions_done
>=
nb_pdusessions_tosetup
)
{
break
;
pdu
->
numDRB2Setup
=
1
;
// One DRB per PDU Session. TODO: Remove hardcoding
for
(
int
j
=
0
;
j
<
pdu
->
numDRB2Setup
;
j
++
)
{
DRB_nGRAN_to_setup_t
*
drb
=
pdu
->
DRBnGRanList
+
j
;
drb
->
id
=
i
+
j
+
1
;
drb
->
defaultDRB
=
E1AP_DefaultDRB_true
;
drb
->
sDAP_Header_UL
=
!
(
rrc
->
configuration
.
enable_sdap
);
drb
->
sDAP_Header_DL
=
!
(
rrc
->
configuration
.
enable_sdap
);
drb
->
pDCP_SN_Size_UL
=
E1AP_PDCP_SN_Size_s_18
;
drb
->
pDCP_SN_Size_DL
=
E1AP_PDCP_SN_Size_s_18
;
drb
->
discardTimer
=
E1AP_DiscardTimer_infinity
;
drb
->
reorderingTimer
=
E1AP_T_Reordering_ms0
;
drb
->
rLC_Mode
=
E1AP_RLC_Mode_rlc_am
;
drb
->
numCellGroups
=
1
;
// assume one cell group associated with a DRB
for
(
int
k
=
0
;
k
<
drb
->
numCellGroups
;
k
++
)
{
cell_group_t
*
cellGroup
=
drb
->
cellGroupList
+
k
;
cellGroup
->
id
=
0
;
// MCG
}
drb
->
numQosFlow2Setup
=
msg
->
pdusession_setup_params
[
i
].
nb_qos
;
for
(
int
k
=
0
;
k
<
drb
->
numQosFlow2Setup
;
k
++
)
{
qos_flow_to_setup_t
*
qos
=
drb
->
qosFlows
+
k
;
qos
->
id
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
qfi
;
qos
->
fiveQI
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
fiveQI
;
qos
->
fiveQI_type
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
fiveQI_type
;
qos
->
qoSPriorityLevel
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
allocation_retention_priority
.
priority_level
;
qos
->
pre_emptionCapability
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
allocation_retention_priority
.
pre_emp_capability
;
qos
->
pre_emptionVulnerability
=
msg
->
pdusession_setup_params
[
i
].
qos
[
k
].
allocation_retention_priority
.
pre_emp_vulnerability
;
}
}
}
ue_context_p
->
ue_context
.
nb_of_pdusessions
=
msg
->
nb_pdusessions_tosetup
;
ue_context_p
->
ue_context
.
gNB_ue_ngap_id
=
msg
->
gNB_ue_ngap_id
;
ue_context_p
->
ue_context
.
amf_ue_ngap_id
=
msg
->
amf_ue_ngap_id
;
create_tunnel_req
.
ue_id
=
ue_context_p
->
ue_context
.
rnti
;
create_tunnel_req
.
num_tunnels
=
pdu_sessions_done
;
ret
=
gtpv1u_create_ngu_tunnel
(
instance
,
&
create_tunnel_req
,
&
create_tunnel_resp
);
if
(
ret
!=
0
)
{
LOG_E
(
NR_RRC
,
"rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE %x
\n
"
,
ue_context_p
->
ue_context
.
rnti
);
ue_context_p
->
ue_context
.
ue_release_timer_ng
=
1
;
ue_context_p
->
ue_context
.
ue_release_timer_thres_ng
=
100
;
ue_context_p
->
ue_context
.
ue_release_timer
=
0
;
ue_context_p
->
ue_context
.
ue_reestablishment_timer
=
0
;
// set ul_failure to 20000 for triggering rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ
ue_context_p
->
ue_context
.
ul_failure_timer
=
20000
;
// rrc_gNB_free_UE(ctxt.module_id,ue_context_p);
ue_context_p
->
ue_context
.
ul_failure_timer
=
0
;
//Fix me: should send error to 5GC
return
;
}
nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP
(
&
ctxt
,
&
create_tunnel_resp
,
&
inde_list
[
0
]);
ue_context_p
->
ue_context
.
setup_pdu_sessions
+=
nb_pdusessions_tosetup
;
if
(
!
NODE_IS_CU
(
RC
.
nrrrc
[
ctxt
.
module_id
]
->
node_type
)){
rrc_gNB_generate_dedicatedRRCReconfiguration
(
&
ctxt
,
ue_context_p
,
NULL
);
}
else
{
/*Generate a UE context modification request message towards the DU to instruct the DU
*for SRB2 and DRB configuration and get the updates on master cell group config from the DU*/
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_RRC_GNB
,
0
,
F1AP_UE_CONTEXT_MODIFICATION_REQ
);
f1ap_ue_context_setup_t
*
req
=&
F1AP_UE_CONTEXT_MODIFICATION_REQ
(
message_p
);
req
->
rnti
=
ue_context_p
->
ue_context
.
rnti
;
req
->
mcc
=
RC
.
nrrrc
[
ctxt
.
module_id
]
->
configuration
.
mcc
[
0
];
req
->
mnc
=
RC
.
nrrrc
[
ctxt
.
module_id
]
->
configuration
.
mnc
[
0
];
req
->
mnc_digit_length
=
RC
.
nrrrc
[
ctxt
.
module_id
]
->
configuration
.
mnc_digit_length
[
0
];
req
->
nr_cellid
=
RC
.
nrrrc
[
ctxt
.
module_id
]
->
nr_cellid
;
/*Instruction towards the DU for SRB2 configuration*/
req
->
srbs_to_be_setup
=
malloc
(
1
*
sizeof
(
f1ap_srb_to_be_setup_t
));
req
->
srbs_to_be_setup_length
=
1
;
f1ap_srb_to_be_setup_t
*
SRBs
=
req
->
srbs_to_be_setup
;
SRBs
[
0
].
srb_id
=
2
;
SRBs
[
0
].
lcid
=
2
;
/*Instruction towards the DU for DRB configuration and tunnel creation*/
gtpv1u_gnb_create_tunnel_req_t
create_tunnel_req
;
memset
(
&
create_tunnel_req
,
0
,
sizeof
(
gtpv1u_gnb_create_tunnel_req_t
));
req
->
drbs_to_be_setup
=
malloc
(
1
*
sizeof
(
f1ap_drb_to_be_setup_t
));
req
->
drbs_to_be_setup_length
=
1
;
f1ap_drb_to_be_setup_t
*
DRBs
=
req
->
drbs_to_be_setup
;
LOG_D
(
RRC
,
"Length of DRB list:%d
\n
"
,
req
->
drbs_to_be_setup_length
);
DRBs
[
0
].
drb_id
=
1
;
DRBs
[
0
].
rlc_mode
=
RLC_MODE_AM
;
DRBs
[
0
].
up_ul_tnl
[
0
].
tl_address
=
inet_addr
(
RC
.
nrrrc
[
ctxt
.
module_id
]
->
eth_params_s
.
my_addr
);
DRBs
[
0
].
up_ul_tnl
[
0
].
port
=
RC
.
nrrrc
[
ctxt
.
module_id
]
->
eth_params_s
.
my_portd
;
DRBs
[
0
].
up_ul_tnl_length
=
1
;
DRBs
[
0
].
up_dl_tnl
[
0
].
tl_address
=
inet_addr
(
RC
.
nrrrc
[
ctxt
.
module_id
]
->
eth_params_s
.
remote_addr
);
DRBs
[
0
].
up_dl_tnl
[
0
].
port
=
RC
.
nrrrc
[
ctxt
.
module_id
]
->
eth_params_s
.
remote_portd
;
DRBs
[
0
].
up_dl_tnl_length
=
1
;
itti_send_msg_to_task
(
TASK_CU_F1
,
ctxt
.
module_id
,
message_p
);
}
rrc
->
cu_if
.
nr_e1_bearer_cxt_msg_transfer
(
bearer_req
,
instance
);
return
;
}
...
...
FANG WANG
@wf
mentioned in commit
553f1d1a
·
Feb 11, 2023
mentioned in commit
553f1d1a
mentioned in commit 553f1d1a52845911be4ba61ec2bcc5c60ad42ae7
Toggle commit list
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