Merge remote-tracking branch 'remotes/origin/develop_SA_CUDU_rfsim_with_5gc' into integration_w5GC
Conflicts: cmake_targets/CMakeLists.txt openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
This commit is contained in:
@@ -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
|
||||
##########################
|
||||
@@ -2532,7 +2532,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
|
||||
@@ -3142,9 +3142,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 MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
|
||||
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
|
||||
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
|
||||
NFAPI_USER_LIB MISC_NFAPI_NR_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
|
||||
|
||||
@@ -345,6 +345,7 @@ void *rrc_enb_process_msg(void *);
|
||||
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
|
||||
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
|
||||
|
||||
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
|
||||
|
||||
@@ -379,6 +379,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) {
|
||||
@@ -830,9 +854,6 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
#endif
|
||||
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
|
||||
|
||||
// if(IS_SOFTMODEM_NOS1)
|
||||
// init_pdcp();
|
||||
|
||||
if (RC.nb_nr_inst > 0) {
|
||||
nr_read_config_and_init();
|
||||
} else {
|
||||
@@ -841,9 +862,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
}
|
||||
|
||||
if (RC.nb_nr_inst > 0) {
|
||||
|
||||
if(IS_SOFTMODEM_NOS1)
|
||||
init_pdcp();
|
||||
init_pdcp();
|
||||
|
||||
// don't create if node doesn't connect to RRC/S1/GTP
|
||||
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,4 +33,5 @@ MESSAGE_DEF(GTPV1U_ENB_S1_REQ, MESSAGE_PRIORITY_MED, Gtpv1uS1Req, gtpv
|
||||
|
||||
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_req_t, NRGtpv1uDeleteTunnelReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_DELETE_TUNNEL_RESP, MESSAGE_PRIORITY_MED, gtpv1u_gnb_delete_tunnel_resp_t, NRGtpv1uDeleteTunnelResp)
|
||||
MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_NG_REQ, MESSAGE_PRIORITY_MED, Gtpv1uNGReq, gtpv1uNGReq)
|
||||
MESSAGE_DEF(GTPV1U_GNB_TUNNEL_DATA_REQ, MESSAGE_PRIORITY_MED, gtpv1u_gnb_tunnel_data_req_t, NRGtpv1uTunnelDataReq)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#define GTPV1U_GNB_DELETE_TUNNEL_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelReq
|
||||
#define GTPV1U_GNB_DELETE_TUNNEL_RESP(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uDeleteTunnelResp
|
||||
#define GTPV1U_GNB_NG_REQ(mSGpTR) (mSGpTR)->ittiMsg.gtpv1uNGReq
|
||||
#define GTPV1U_GNB_TUNNEL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.NRGtpv1uTunnelDataReq
|
||||
|
||||
#define GTPV1U_ALL_TUNNELS_TEID (teid_t)0xFFFFFFFF
|
||||
|
||||
@@ -210,4 +211,12 @@ typedef struct gtpv1u_gnb_delete_tunnel_resp_s {
|
||||
teid_t gnb_NGu_teid; ///< local NGU Tunnel Endpoint Identifier to be deleted
|
||||
} gtpv1u_gnb_delete_tunnel_resp_t;
|
||||
|
||||
typedef struct gtpv1u_gnb_tunnel_data_req_s {
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
uint32_t offset; ///< start of message offset in buffer
|
||||
rnti_t rnti;
|
||||
pdusessionid_t pdusession_id;
|
||||
} gtpv1u_gnb_tunnel_data_req_t;
|
||||
|
||||
#endif /* GTPV1_U_MESSAGES_TYPES_H_ */
|
||||
|
||||
@@ -114,7 +114,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;
|
||||
@@ -509,12 +509,12 @@ uint64_t pdcp_module_init(uint64_t _pdcp_optmask)
|
||||
netlink_init_tun("ue",num_if);
|
||||
//Add --nr-ip-over-lte option check for next line
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
nas_config(1, 1, 2, "ue");
|
||||
nas_config(1, 0, 1, "ue");
|
||||
LOG_I(PDCP, "UE pdcp will use tun interface\n");
|
||||
start_pdcp_tun_ue();
|
||||
} else if(ENB_NAS_USE_TUN) {
|
||||
netlink_init_tun("enb",1);
|
||||
nas_config(1, 1, 1, "enb");
|
||||
nas_config(1, 0, 2, "enb");// set the node IP to X.X.0.2 because UE's IP is X.X.0.1
|
||||
LOG_I(PDCP, "ENB pdcp will use tun interface\n");
|
||||
start_pdcp_tun_enb();
|
||||
} else {
|
||||
@@ -537,7 +537,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
int rb_id = 0;
|
||||
int i;
|
||||
|
||||
if (ENB_NAS_USE_TUN_BIT || UE_NAS_USE_TUN_BIT){
|
||||
if (IS_SOFTMODEM_NOS1) {
|
||||
len = write(nas_sock_fd[0], buf, size);
|
||||
if (len != size) {
|
||||
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
@@ -560,18 +560,28 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
|
||||
size + GTPU_HEADER_OVERHEAD_MAX);
|
||||
AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY");
|
||||
memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size);
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
|
||||
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
|
||||
//printf("\n");
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
|
||||
|
||||
if (NODE_IS_CU(RC.nrrrc[0]->node_type) || (RC.nrrrc[0]->node_type == ngran_gNB)) {
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ);
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = 10;
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d, rnti %d \n", __func__, rb_id, size, ue->rnti);
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
|
||||
} else {
|
||||
message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ);
|
||||
AssertFatal(message_p != NULL, "OUT OF MEMORY");
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti;
|
||||
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
|
||||
LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size);
|
||||
//for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]);
|
||||
//printf("\n");
|
||||
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ void nas_getparams(void) {
|
||||
/* configuration parameters for netlink, includes network parameters when running in noS1 mode */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
{"NetworkPrefix", NASHLP_NETPREFIX, 0, strptr:&baseNetAddress, defstrval:"10.0", TYPE_STRING, 0 },
|
||||
{"NetworkPrefix", NASHLP_NETPREFIX, 0, strptr:&baseNetAddress, defstrval:"60.60", TYPE_STRING, 0 },
|
||||
{"NetworkMask", NASHLP_NETMASK, 0, strptr:&netMask, defstrval:"255.255.255.0", TYPE_STRING, 0 },
|
||||
{"BroadcastAddr", NASHLP_BROADCASTADDR, 0, strptr:&broadcastAddr, defstrval:"10.0.255.255", TYPE_STRING, 0 },
|
||||
{"BroadcastAddr", NASHLP_BROADCASTADDR, 0, strptr:&broadcastAddr, defstrval:"60.60.255.255", TYPE_STRING, 0 },
|
||||
};
|
||||
config_get( nasoptions,sizeof(nasoptions)/sizeof(paramdef_t),"nas.noS1");
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+16
-115
@@ -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
|
||||
|
||||
@@ -127,7 +127,6 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
|
||||
);
|
||||
|
||||
mui_t nr_rrc_mui=0;
|
||||
uint8_t first_rrcreconfigurationcomplete = 0;
|
||||
|
||||
static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) {
|
||||
return NR_UE_rrc_inst[ue_mod_idP].nrRrcState;
|
||||
@@ -1364,7 +1363,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;
|
||||
@@ -1793,6 +1792,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
|
||||
@@ -2256,34 +2258,11 @@ rrc_ue_process_rrcReconfiguration(
|
||||
for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) {
|
||||
pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size;
|
||||
pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf;
|
||||
#ifdef ITTI_SIM
|
||||
uint8_t msg_type = 0;
|
||||
if((pdu_buffer + 1) != NULL){
|
||||
if (*(pdu_buffer + 1) > 0 ) {
|
||||
if((pdu_buffer + 9) != NULL){
|
||||
msg_type = *(pdu_buffer + 9);
|
||||
} else {
|
||||
LOG_W(NR_RRC, "[UE] Received invalid downlink message\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if((pdu_buffer + 2) != NULL){
|
||||
msg_type = *(pdu_buffer + 2);
|
||||
} else {
|
||||
LOG_W(NR_RRC, "[UE] Received invalid downlink message\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(msg_type == REGISTRATION_ACCEPT){
|
||||
LOG_I(NR_RRC, "[UE] Received REGISTRATION ACCEPT message\n");
|
||||
}
|
||||
#endif
|
||||
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_ESTABLI_CNF);
|
||||
NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS;
|
||||
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length;
|
||||
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
|
||||
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
|
||||
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
|
||||
}
|
||||
|
||||
free (ie->nonCriticalExtension->dedicatedNAS_MessageList);
|
||||
@@ -2380,46 +2359,14 @@ nr_rrc_ue_decode_dcch(
|
||||
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
|
||||
{
|
||||
rrc_ue_process_rrcReconfiguration(ctxt_pP,
|
||||
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration,
|
||||
gNB_indexP);
|
||||
nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP,
|
||||
gNB_indexP,
|
||||
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier);
|
||||
|
||||
if (first_rrcreconfigurationcomplete == 0) {
|
||||
first_rrcreconfigurationcomplete = 1;
|
||||
#ifdef ITTI_SIM
|
||||
if (AMF_MODE_ENABLED) {
|
||||
as_nas_info_t initialNasMsg;
|
||||
memset(&initialNasMsg, 0, sizeof(as_nas_info_t));
|
||||
generateRegistrationComplete(&initialNasMsg, NULL);
|
||||
if(initialNasMsg.length > 0){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_UPLINK_DATA_REQ);
|
||||
NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p);
|
||||
LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message(RegistrationComplete)\n");
|
||||
}
|
||||
as_nas_info_t pduEstablishMsg;
|
||||
memset(&pduEstablishMsg, 0, sizeof(as_nas_info_t));
|
||||
generatePduSessionEstablishRequest(&pduEstablishMsg);
|
||||
if(initialNasMsg.length > 0){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_UPLINK_DATA_REQ);
|
||||
NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)pduEstablishMsg.data;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = pduEstablishMsg.length;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p);
|
||||
LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
rrc_ue_process_rrcReconfiguration(ctxt_pP,
|
||||
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration,
|
||||
gNB_indexP);
|
||||
nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP,
|
||||
gNB_indexP,
|
||||
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
|
||||
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
|
||||
@@ -2465,59 +2412,13 @@ nr_rrc_ue_decode_dcch(
|
||||
/* This message hold a dedicated info NAS payload, forward it to NAS */
|
||||
NR_DedicatedNAS_Message_t *dedicatedNAS_Message =
|
||||
dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message;
|
||||
uint32_t pdu_length;
|
||||
uint8_t *pdu_buffer;
|
||||
pdu_length = dedicatedNAS_Message->size;
|
||||
pdu_buffer = dedicatedNAS_Message->buf;
|
||||
#ifdef ITTI_SIM
|
||||
LOG_I(NR_RRC, "[UE %d] Received %s: UEid %u, length %u , buffer %p\n", ctxt_pP->module_id, messages_info[NAS_DOWNLINK_DATA_IND].name,
|
||||
ctxt_pP->module_id, pdu_length, pdu_buffer);
|
||||
as_nas_info_t initialNasMsg;
|
||||
uint8_t msg_type = 0;
|
||||
memset(&initialNasMsg, 0, sizeof(as_nas_info_t));
|
||||
if((pdu_buffer + 1) != NULL){
|
||||
if (*(pdu_buffer + 1) > 0 ) {
|
||||
msg_type = *(pdu_buffer + 9);
|
||||
} else {
|
||||
msg_type = *(pdu_buffer + 2);
|
||||
}
|
||||
}
|
||||
if((pdu_buffer + 2) == NULL){
|
||||
LOG_W(NR_RRC, "[UE] Received invalid downlink message\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(msg_type){
|
||||
case FGS_IDENTITY_REQUEST:
|
||||
generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3));
|
||||
break;
|
||||
case FGS_AUTHENTICATION_REQUEST:
|
||||
generateAuthenticationResp(&initialNasMsg, pdu_buffer);
|
||||
break;
|
||||
case FGS_SECURITY_MODE_COMMAND:
|
||||
generateSecurityModeComplete(&initialNasMsg);
|
||||
break;
|
||||
default:
|
||||
LOG_W(NR_RRC,"unknow message type %d\n",msg_type);
|
||||
break;
|
||||
}
|
||||
if(initialNasMsg.length > 0){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_UPLINK_DATA_REQ);
|
||||
NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p);
|
||||
LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message\n");
|
||||
}
|
||||
#else
|
||||
MessageDef *msg_p;
|
||||
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND);
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ?
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length;
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer;
|
||||
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
|
||||
#endif
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = dedicatedNAS_Message->size;
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf;
|
||||
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
#include "RRC/NR_UE/rrc_vars.h"
|
||||
#include "openair3/NAS/UE/nas_ue_task.h"
|
||||
#if ITTI_SIM
|
||||
#include "nr_nas_msg_sim.h"
|
||||
#endif
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
@@ -404,6 +407,12 @@ int create_tasks_nrue(uint32_t ue_nb) {
|
||||
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("create TASK_NAS_NRUE\n");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -309,6 +309,106 @@ void *gtpv1u_gNB_task(void *args) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Callback called when a gtpv1u message arrived on UDP interface */
|
||||
NwGtpv1uRcT nr_gtpv1u_gNB_process_stack_req(
|
||||
NwGtpv1uUlpHandleT hUlp,
|
||||
NwGtpv1uUlpApiT *pUlpApi) {
|
||||
boolean_t result = FALSE;
|
||||
teid_t teid = 0;
|
||||
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
|
||||
nr_gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL;
|
||||
protocol_ctxt_t ctxt;
|
||||
NwGtpv1uRcT rc;
|
||||
|
||||
switch(pUlpApi->apiType) {
|
||||
/* Here there are two type of messages handled:
|
||||
* - T-PDU
|
||||
* - END-MARKER
|
||||
*/
|
||||
case NW_GTPV1U_ULP_API_RECV_TPDU: {
|
||||
uint8_t buffer[4096];
|
||||
uint32_t buffer_len;
|
||||
//uint16_t msgType = NW_GTP_GPDU;
|
||||
//NwGtpv1uMsgT *pMsg = NULL;
|
||||
/* Nw-gptv1u stack has processed a PDU. we can schedule it to PDCP
|
||||
* for transmission.
|
||||
*/
|
||||
teid = pUlpApi->apiInfo.recvMsgInfo.teid;
|
||||
//pMsg = (NwGtpv1uMsgT *) pUlpApi->apiInfo.recvMsgInfo.hMsg;
|
||||
//msgType = pMsg->msgType;
|
||||
|
||||
if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg,
|
||||
buffer, &buffer_len)) {
|
||||
LOG_E(GTPU, "Error while retrieving T-PDU");
|
||||
}
|
||||
|
||||
itti_free(TASK_UDP, ((NwGtpv1uMsgT *)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf);
|
||||
#if defined(GTP_DUMP_SOCKET) && GTP_DUMP_SOCKET > 0
|
||||
gtpv1u_eNB_write_dump_socket(buffer,buffer_len);
|
||||
#endif
|
||||
rc = nwGtpv1uMsgDelete(RC.nr_gtpv1u_data_g->gtpv1u_stack,
|
||||
pUlpApi->apiInfo.recvMsgInfo.hMsg);
|
||||
|
||||
if (rc != NW_GTPV1U_OK) {
|
||||
LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc);
|
||||
}
|
||||
|
||||
hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->teid_mapping, teid, (void **)>pv1u_teid_data_p);
|
||||
|
||||
if (hash_rc == HASH_TABLE_OK) {
|
||||
// #if defined(LOG_GTPU) && LOG_GTPU > 0
|
||||
LOG_D(GTPU, "Received T-PDU from gtpv1u stack teid %u size %d -> gnb module id %u ue module id %u pdu session id %u\n",
|
||||
teid,
|
||||
buffer_len,
|
||||
gtpv1u_teid_data_p->gnb_id,
|
||||
gtpv1u_teid_data_p->ue_id,
|
||||
gtpv1u_teid_data_p->pdu_session_id);
|
||||
// #endif
|
||||
//warning "LG eps bearer mapping to DRB id to do (offset -4)"
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gtpv1u_teid_data_p->gnb_id, GNB_FLAG_YES, gtpv1u_teid_data_p->ue_id, 0, 0,gtpv1u_teid_data_p->gnb_id);
|
||||
// MSC_LOG_TX_MESSAGE(
|
||||
// MSC_GTPU_ENB,
|
||||
// MSC_PDCP_ENB,
|
||||
// NULL,0,
|
||||
// MSC_AS_TIME_FMT" DATA-REQ rb %u size %u",
|
||||
// 0,0,
|
||||
// (gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
|
||||
// buffer_len);
|
||||
|
||||
result = pdcp_data_req(
|
||||
&ctxt,
|
||||
SRB_FLAG_NO,
|
||||
1,
|
||||
0, // mui
|
||||
SDU_CONFIRM_NO, // confirm
|
||||
buffer_len,
|
||||
buffer,
|
||||
PDCP_TRANSMISSION_MODE_DATA,NULL, NULL
|
||||
);
|
||||
|
||||
if ( result == FALSE ) {
|
||||
if (ctxt.configured == FALSE )
|
||||
LOG_W(GTPU, "gNB node PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ;
|
||||
else
|
||||
LOG_W(GTPU, "PDCP data request failed\n");
|
||||
|
||||
return NW_GTPV1U_FAILURE;
|
||||
}
|
||||
} else {
|
||||
LOG_W(GTPU, "Received T-PDU from gtpv1u stack teid %u unknown size %u", teid, buffer_len);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: {
|
||||
LOG_E(GTPU, "Received undefined UlpApi (%02x) from gtpv1u stack!\n",
|
||||
pUlpApi->apiType);
|
||||
}
|
||||
} // end of switch
|
||||
|
||||
return NW_GTPV1U_OK;
|
||||
}
|
||||
|
||||
int nr_gtpv1u_gNB_init(void) {
|
||||
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
|
||||
NwGtpv1uUlpEntityT ulp;
|
||||
@@ -344,7 +444,7 @@ int nr_gtpv1u_gNB_init(void) {
|
||||
/* Set the ULP API callback. Called once message have been processed by the
|
||||
* nw-gtpv1u stack.
|
||||
*/
|
||||
ulp.ulpReqCallback = gtpv1u_gNB_process_stack_req;
|
||||
ulp.ulpReqCallback = nr_gtpv1u_gNB_process_stack_req;
|
||||
memset((void *)&(ulp.hUlp), 0, sizeof(NwGtpv1uUlpHandleT));
|
||||
|
||||
if ((rc = nwGtpv1uSetUlpEntity(RC.nr_gtpv1u_data_g->gtpv1u_stack, &ulp)) != NW_GTPV1U_OK) {
|
||||
@@ -751,6 +851,79 @@ static int gtpv1u_ng_req(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_data_req) {
|
||||
gtpv1u_gnb_tunnel_data_req_t *data_req_p = NULL;
|
||||
NwGtpv1uUlpApiT stack_req;
|
||||
NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
|
||||
hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS;
|
||||
nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL;
|
||||
teid_t gnb_ngu_teid = 0;
|
||||
teid_t upf_ngu_teid = 0;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN);
|
||||
data_req_p = gnb_tunnel_data_req;
|
||||
|
||||
memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT));
|
||||
hash_rc = hashtable_get(RC.nr_gtpv1u_data_g->ue_mapping, (uint64_t)data_req_p->rnti, (void **)>pv1u_ue_data_p);
|
||||
|
||||
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
|
||||
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: while getting ue rnti %x in hashtable ue_mapping\n", data_req_p->rnti);
|
||||
} else {
|
||||
if ((data_req_p->pdusession_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->pdusession_id < max_val_NR_DRB_Identity)) {
|
||||
gnb_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB;
|
||||
upf_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf;
|
||||
stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU;
|
||||
stack_req.apiInfo.sendtoInfo.teid = upf_ngu_teid;
|
||||
stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip_addr;
|
||||
rc = nwGtpv1uGpduMsgNew(
|
||||
RC.nr_gtpv1u_data_g->gtpv1u_stack,
|
||||
upf_ngu_teid,
|
||||
NW_FALSE,
|
||||
RC.nr_gtpv1u_data_g->seq_num++,
|
||||
data_req_p->buffer,
|
||||
data_req_p->length,
|
||||
data_req_p->offset,
|
||||
&(stack_req.apiInfo.sendtoInfo.hMsg));
|
||||
|
||||
if (rc != NW_GTPV1U_OK) {
|
||||
LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc);
|
||||
MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u",
|
||||
gnb_ngu_teid,upf_ngu_teid,data_req_p->length);
|
||||
(void)gnb_ngu_teid; /* avoid gcc warning "set but not used" */
|
||||
} else {
|
||||
rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req);
|
||||
|
||||
if (rc != NW_GTPV1U_OK) {
|
||||
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc);
|
||||
MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u",
|
||||
gnb_ngu_teid,upf_ngu_teid,data_req_p->length);
|
||||
} else {
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
MSC_GTPU_GNB,
|
||||
MSC_GTPU_SGW,
|
||||
NULL,
|
||||
0,
|
||||
MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u",
|
||||
0,0,
|
||||
gnb_ngu_teid,
|
||||
upf_ngu_teid,
|
||||
data_req_p->length);
|
||||
}
|
||||
|
||||
rc = nwGtpv1uMsgDelete(RC.nr_gtpv1u_data_g->gtpv1u_stack,
|
||||
stack_req.apiInfo.sendtoInfo.hMsg);
|
||||
|
||||
if (rc != NW_GTPV1U_OK) {
|
||||
LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT);
|
||||
/* Buffer still needed, do not free it */
|
||||
//itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), data_req_p->buffer);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void *gtpv1u_gNB_process_itti_msg(void *notUsed) {
|
||||
/* Trying to fetch a message from the message queue.
|
||||
@@ -774,6 +947,24 @@ void *gtpv1u_gNB_process_itti_msg(void *notUsed) {
|
||||
gtpv1u_delete_ngu_tunnel(instance, &received_message_p->ittiMsg.NRGtpv1uDeleteTunnelReq);
|
||||
break;
|
||||
|
||||
// DATA COMING FROM UDP
|
||||
case UDP_DATA_IND: {
|
||||
udp_data_ind_t *udp_data_ind_p;
|
||||
udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind;
|
||||
nwGtpv1uProcessUdpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack,
|
||||
udp_data_ind_p->buffer,
|
||||
udp_data_ind_p->buffer_length,
|
||||
udp_data_ind_p->peer_port,
|
||||
udp_data_ind_p->peer_address);
|
||||
}
|
||||
break;
|
||||
|
||||
// DATA TO BE SENT TO UDP
|
||||
case GTPV1U_GNB_TUNNEL_DATA_REQ:
|
||||
LOG_I(GTPU, "Received message %s\n", ITTI_MSG_NAME(received_message_p));
|
||||
gtpv1u_gnb_tunnel_data_req(>PV1U_GNB_TUNNEL_DATA_REQ(received_message_p));
|
||||
break;
|
||||
|
||||
case TERMINATE_MESSAGE: {
|
||||
if (RC.nr_gtpv1u_data_g->ue_mapping != NULL) {
|
||||
hashtable_destroy (&(RC.nr_gtpv1u_data_g->ue_mapping));
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "aka_functions.h"
|
||||
#include "secu_defs.h"
|
||||
#include "PduSessionEstablishRequest.h"
|
||||
# include "intertask_interface.h"
|
||||
|
||||
char netName[] = "5G:mnc093.mcc208.3gppnetwork.org";
|
||||
char imsi[] = "2089300007487";
|
||||
// USIM_API_K: 5122250214c33e723a5dd523fc145fc0
|
||||
@@ -690,3 +692,199 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){
|
||||
initialNasMsg->data[2+i] = mac[i];
|
||||
}
|
||||
}
|
||||
|
||||
void *nas_nrue_task(void *args_p)
|
||||
{
|
||||
MessageDef *msg_p;
|
||||
instance_t instance;
|
||||
unsigned int Mod_id;
|
||||
int result;
|
||||
uint8_t msg_type = 0;
|
||||
uint8_t *pdu_buffer = NULL;
|
||||
|
||||
itti_mark_task_ready (TASK_NAS_NRUE);
|
||||
MSC_START_USE();
|
||||
|
||||
while(1) {
|
||||
// Wait for a message or an event
|
||||
itti_receive_msg (TASK_NAS_NRUE, &msg_p);
|
||||
|
||||
if (msg_p != NULL) {
|
||||
instance = msg_p->ittiMsgHeader.originInstance;
|
||||
Mod_id = instance ;
|
||||
if (instance == INSTANCE_DEFAULT) {
|
||||
printf("%s:%d: FATAL: instance is INSTANCE_DEFAULT, should not happen.\n",
|
||||
__FILE__, __LINE__);
|
||||
exit_fun("exit... \n");
|
||||
}
|
||||
|
||||
switch (ITTI_MSG_ID(msg_p)) {
|
||||
case INITIALIZE_MESSAGE:
|
||||
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
|
||||
|
||||
break;
|
||||
|
||||
case TERMINATE_MESSAGE:
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
case MESSAGE_TEST:
|
||||
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
|
||||
break;
|
||||
|
||||
case NAS_CELL_SELECTION_CNF:
|
||||
LOG_I(NAS, "[UE %d] Received %s: errCode %u, cellID %u, tac %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NAS_CELL_SELECTION_CNF (msg_p).errCode, NAS_CELL_SELECTION_CNF (msg_p).cellID, NAS_CELL_SELECTION_CNF (msg_p).tac);
|
||||
// as_stmsi_t s_tmsi={0, 0};
|
||||
// as_nas_info_t nas_info;
|
||||
// plmn_t plmnID={0, 0, 0, 0};
|
||||
// generateRegistrationRequest(&nas_info);
|
||||
// nr_nas_itti_nas_establish_req(0, AS_TYPE_ORIGINATING_SIGNAL, s_tmsi, plmnID, nas_info.data, nas_info.length, 0);
|
||||
break;
|
||||
|
||||
case NAS_CELL_SELECTION_IND:
|
||||
LOG_I(NAS, "[UE %d] Received %s: cellID %u, tac %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NAS_CELL_SELECTION_IND (msg_p).cellID, NAS_CELL_SELECTION_IND (msg_p).tac);
|
||||
|
||||
/* TODO not processed by NAS currently */
|
||||
break;
|
||||
|
||||
case NAS_PAGING_IND:
|
||||
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NAS_PAGING_IND (msg_p).cause);
|
||||
|
||||
/* TODO not processed by NAS currently */
|
||||
break;
|
||||
|
||||
case NAS_CONN_ESTABLI_CNF:
|
||||
{
|
||||
LOG_I(NAS, "[UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length);
|
||||
|
||||
pdu_buffer = NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data;
|
||||
if((pdu_buffer + 1) != NULL){
|
||||
if (*(pdu_buffer + 1) > 0 ) {
|
||||
if((pdu_buffer + 9) != NULL){
|
||||
msg_type = *(pdu_buffer + 9);
|
||||
} else {
|
||||
LOG_W(NAS, "[UE] Received invalid downlink message\n");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if((pdu_buffer + 2) != NULL){
|
||||
msg_type = *(pdu_buffer + 2);
|
||||
} else {
|
||||
LOG_W(NAS, "[UE] Received invalid downlink message\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(msg_type == REGISTRATION_ACCEPT){
|
||||
LOG_I(NAS, "[UE] Received REGISTRATION ACCEPT message\n");
|
||||
|
||||
as_nas_info_t initialNasMsg;
|
||||
memset(&initialNasMsg, 0, sizeof(as_nas_info_t));
|
||||
generateRegistrationComplete(&initialNasMsg, NULL);
|
||||
if(initialNasMsg.length > 0){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ);
|
||||
NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p);
|
||||
LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(RegistrationComplete)\n");
|
||||
}
|
||||
|
||||
as_nas_info_t pduEstablishMsg;
|
||||
memset(&pduEstablishMsg, 0, sizeof(as_nas_info_t));
|
||||
generatePduSessionEstablishRequest(&pduEstablishMsg);
|
||||
if(pduEstablishMsg.length > 0){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ);
|
||||
NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)pduEstablishMsg.data;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = pduEstablishMsg.length;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p);
|
||||
LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NAS_CONN_RELEASE_IND:
|
||||
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NAS_CONN_RELEASE_IND (msg_p).cause);
|
||||
|
||||
break;
|
||||
|
||||
case NAS_UPLINK_DATA_CNF:
|
||||
LOG_I(NAS, "[UE %d] Received %s: UEid %u, errCode %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
|
||||
NAS_UPLINK_DATA_CNF (msg_p).UEid, NAS_UPLINK_DATA_CNF (msg_p).errCode);
|
||||
|
||||
break;
|
||||
|
||||
case NAS_DOWNLINK_DATA_IND:
|
||||
{
|
||||
LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u , buffer %p\n", Mod_id,
|
||||
ITTI_MSG_NAME (msg_p),
|
||||
Mod_id,
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length,
|
||||
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data);
|
||||
as_nas_info_t initialNasMsg;
|
||||
memset(&initialNasMsg, 0, sizeof(as_nas_info_t));
|
||||
|
||||
pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data;
|
||||
if((pdu_buffer + 1) != NULL){
|
||||
if (*(pdu_buffer + 1) > 0 ) {
|
||||
msg_type = *(pdu_buffer + 9);
|
||||
} else {
|
||||
msg_type = *(pdu_buffer + 2);
|
||||
}
|
||||
}
|
||||
if((pdu_buffer + 2) == NULL){
|
||||
LOG_W(NAS, "[UE] Received invalid downlink message\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(msg_type){
|
||||
case FGS_IDENTITY_REQUEST:
|
||||
generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3));
|
||||
break;
|
||||
case FGS_AUTHENTICATION_REQUEST:
|
||||
generateAuthenticationResp(&initialNasMsg, pdu_buffer);
|
||||
break;
|
||||
case FGS_SECURITY_MODE_COMMAND:
|
||||
generateSecurityModeComplete(&initialNasMsg);
|
||||
break;
|
||||
default:
|
||||
LOG_W(NR_RRC,"unknow message type %d\n",msg_type);
|
||||
break;
|
||||
}
|
||||
|
||||
if(initialNasMsg.length > 0){
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ);
|
||||
NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data;
|
||||
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length;
|
||||
itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p);
|
||||
LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message\n");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
LOG_E(NAS, "[UE %d] Received unexpected message %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
|
||||
break;
|
||||
}
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
msg_p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf);
|
||||
void generateSecurityModeComplete(as_nas_info_t *initialNasMsg);
|
||||
void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer);
|
||||
void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg);
|
||||
void *nas_nrue_task(void *args_p);
|
||||
|
||||
#endif /* __NR_NAS_MSG_SIM_H__*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user