Commit bd765c75 authored by Xue Song's avatar Xue Song

C-plane for rfsim with Free5GC + CU/DU separation is OK

parent 5918c03c
......@@ -987,7 +987,7 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
add_boolean_option(ITTI_SIM False "enable itti simulator")
add_boolean_option(RFSIM_NAS False "enable rfsim nas")
########################
# Include order
##########################
......@@ -2515,7 +2515,7 @@ if(NAS_UE)
endif()
if(ITTI_SIM)
if(ITTI_SIM OR RFSIM_NAS)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
......@@ -3125,7 +3125,7 @@ target_link_libraries (nr-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
NFAPI_USER_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} ${NAS_SIM_LIB}
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB
-Wl,--end-group z dl)
......
......@@ -67,6 +67,7 @@ USRP_REC_PLAY="False"
BUILD_ECLIPSE=0
NR="False"
ITTI_SIM="False"
RFSIM_NAS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
trap handle_ctrl_c INT
......@@ -260,6 +261,8 @@ function main() {
--nrUE)
nrUE=1
NR="True"
rfsimNas=1
RFSIM_NAS="True"
echo_info "Will compile NR UE"
shift;;
--mu)
......@@ -579,7 +582,7 @@ function main() {
config_libconfig_shlib=params_libconfig
# first generate the CMakefile in the right directory
if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then
if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then
# softmodem compilation
......@@ -604,6 +607,7 @@ function main() {
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$build_dir/build
eval $CMAKE_CMD
......
......@@ -378,6 +378,30 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==1)){
if (gnb_nb > 0) {
if(NGAP_CONF_MODE){
if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) {
LOG_E(NGAP, "Create task for NGAP failed\n");
return -1;
}
} else {
LOG_E(NGAP, "Ngap task not created\n");
}
if(!emulate_rf){
if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) {
LOG_E(UDP_, "Create task for UDP failed\n");
return -1;
}
}
if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1;
}
}
}
if (gnb_nb > 0) {
if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
......
......@@ -87,6 +87,10 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h"
#endif
extern const char *duplex_mode[];
// Thread variables
......@@ -189,6 +193,11 @@ int create_tasks_nrue(uint32_t ue_nb) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NAS UE failed\n");
return -1;
}
}
itti_wait_ready(0);
......
......@@ -113,7 +113,7 @@ nr_rrc_data_ind(
//------------------------------------------------------------------------------
{
rb_id_t DCCH_index = Srb_id;
LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n",
LOG_I(NR_RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from gNB %d\n",
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
{
MessageDef *message_p;
......
......@@ -575,19 +575,6 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p);
}
if (RC.nrrrc[ctxt.module_id]->node_type == ngran_gNB_CU) {
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = (uint8_t *)ue_context_p->ue_context.Srb1.Srb_info.Tx_buffer.Payload;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_context_p->ue_context.Srb1.Srb_info.Tx_buffer.payload_size;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_p->ue_context.rnti;
itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p);
LOG_D(NR_RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
}
return 0;
}
}
......@@ -802,25 +789,10 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS(
*/
switch (RC.nrrrc[ctxt.module_id]->node_type) {
case ngran_gNB_CU:
// create an ITTI message
// F1AP_DL_RRC_MESSAGE
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer;
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = length;
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_context_p->ue_context.rnti;
F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p);
LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n");
/* Transfer data to PDCP */
nr_rrc_data_req (
&ctxt,
ue_context_p->ue_context.Srb2.Srb_info.Srb_id,
DCCH, // ue_context_p->ue_context.Srb2.Srb_info.Srb_id,
(*rrc_gNB_mui)++,
SDU_CONFIRM_NO,
length,
......
......@@ -68,7 +68,7 @@
#include "RRC/NAS/rb_config.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
#if ITTI_SIM
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h"
#endif
......@@ -1361,7 +1361,7 @@ static void rrc_ue_generate_RRCSetupComplete(
const char *nas_msg;
int nas_msg_length;
if (AMF_MODE_ENABLED) {
#if ITTI_SIM
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg);
nas_msg = (char*)initialNasMsg.data;
......@@ -1790,6 +1790,9 @@ nr_rrc_ue_process_securityModeCommand(
void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ) {
uint8_t i=0,rv[6];
if(IS_SOFTMODEM_NOS1) {
AMF_MODE_ENABLED = 1;
}
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment