Commit 2800fbe0 authored by Melissa's avatar Melissa

Merge branch 'episys/david/fixing_nr_xlsim_build' into 'episys/master-nsa'

Fixed nr_dlsim and nr_ulsim build errors.

See merge request aburger/openairinterface5g!69
parents cb134427 a5d23a0e
......@@ -1539,6 +1539,7 @@ set(NFAPI_USER_SRC
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/nfapi_pnf.c
${NFAPI_USER_DIR}/nfapi_vnf.c
${NFAPI_USER_DIR}/gnb_ind_vars.c
)
add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
add_dependencies(NFAPI_USER_LIB rrc_flag)
......@@ -2068,6 +2069,7 @@ set(NR_L2_SRC_UE
${NR_UE_RRC_DIR}/L2_interface_ue.c
${NR_UE_RRC_DIR}/main_ue.c
${NR_UE_RRC_DIR}/rrc_UE.c
${NR_UE_RRC_DIR}/rrc_nsa.c
)
set (MAC_SRC
......@@ -3282,14 +3284,16 @@ add_executable(nr_dlsim
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${PHY_INTERFACE_DIR}/queue.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_dlsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
......@@ -3302,13 +3306,15 @@ add_executable(nr_prachsim
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${PHY_INTERFACE_DIR}/queue.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES})
target_link_libraries(nr_prachsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl)
add_executable(nr_ulschsim
......@@ -3317,6 +3323,7 @@ add_executable(nr_ulschsim
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
......@@ -3335,13 +3342,15 @@ add_executable(nr_ulsim
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${PHY_INTERFACE_DIR}/queue.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_ulsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
......
......@@ -159,7 +159,6 @@ char uecap_xer[1024];
*/
uint8_t abstraction_flag=0;
uint16_t ue_id_g;
uint16_t ue_idx_standalone = 0xFFFF;
/*---------------------BMC: timespec helpers -----------------------------*/
......
#include "gnb_ind_vars.h"
queue_t gnb_rach_ind_queue;
queue_t gnb_rx_ind_queue;
queue_t gnb_crc_ind_queue;
queue_t gnb_uci_ind_queue;
queue_t gnb_slot_ind_queue;
#pragma once
#include "openair2/PHY_INTERFACE/queue.h"
extern queue_t gnb_rach_ind_queue;
extern queue_t gnb_rx_ind_queue;
extern queue_t gnb_crc_ind_queue;
extern queue_t gnb_uci_ind_queue;
extern queue_t gnb_slot_ind_queue;
......@@ -44,6 +44,7 @@
#include "common/ran_context.h"
#include "openair2/PHY_INTERFACE/queue.h"
#include "gnb_ind_vars.h"
#define TEST
......@@ -172,12 +173,6 @@ typedef struct {
} vnf_info;
queue_t gnb_rach_ind_queue;
queue_t gnb_rx_ind_queue;
queue_t gnb_crc_ind_queue;
queue_t gnb_uci_ind_queue;
queue_t gnb_slot_ind_queue;
int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
......
......@@ -37,6 +37,7 @@
#include "common/ran_context.h"
#include "executables/softmodem-common.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "nfapi/oai_integration/gnb_ind_vars.h"
#include "openair2/PHY_INTERFACE/queue.h"
#define MAX_IF_MODULES 100
......@@ -59,11 +60,6 @@ extern uint8_t nfapi_mode;
extern uint16_t sf_ahead;
extern uint16_t sl_ahead;
extern queue_t gnb_rach_ind_queue;
extern queue_t gnb_rx_ind_queue;
extern queue_t gnb_crc_ind_queue;
extern queue_t gnb_uci_ind_queue;
void handle_nr_rach(NR_UL_IND_t *UL_info)
{
......
......@@ -165,4 +165,4 @@ void *unqueue_matching(queue_t *q, size_t max_depth, queue_matcher_t *matcher, v
pthread_mutex_unlock(&q->mutex);
return item;
}
\ No newline at end of file
}
......@@ -129,10 +129,6 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
mui_t nr_rrc_mui=0;
static const char nsa_ipaddr[] = "127.0.0.1";
static int from_lte_ue_fd = -1;
static int to_lte_ue_fd = -1;
static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) {
return NR_UE_rrc_inst[ue_mod_idP].nrRrcState;
}
......@@ -205,7 +201,6 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
static void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len);
static void start_oai_nrue_threads(void);
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
......@@ -2722,6 +2717,7 @@ nr_rrc_ue_generate_rrcReestablishmentComplete(
void *recv_msgs_from_lte_ue(void *args_p)
{
itti_mark_task_ready (TASK_RRC_NSA_NRUE);
int from_lte_ue_fd = get_from_lte_ue_fd();
for (;;)
{
nsa_msg_t msg;
......@@ -2741,77 +2737,6 @@ void *recv_msgs_from_lte_ue(void *args_p)
}
return NULL;
}
void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type)
{
LOG_I(NR_RRC, "Entered %s \n", __FUNCTION__);
nsa_msg_t n_msg;
if (msg_len > sizeof(n_msg.msg_buffer))
{
LOG_E(NR_RRC, "%s: message too big: %zu\n", __func__, msg_len);
abort();
}
n_msg.msg_type = msg_type;
memcpy(n_msg.msg_buffer, message, msg_len);
size_t to_send = sizeof(n_msg.msg_type) + msg_len;
struct sockaddr_in sa =
{
.sin_family = AF_INET,
.sin_port = htons(6007 + ue_id_g * 2),
};
int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0,
(struct sockaddr *)&sa, sizeof(sa));
if (sent == -1)
{
LOG_E(NR_RRC, "%s: sendto: %s\n", __func__, strerror(errno));
return;
}
if (sent != to_send)
{
LOG_E(RRC, "%s: Short send %d != %zu\n", __func__, sent, to_send);
return;
}
LOG_D(NR_RRC, "Sent a %d message to the LTE UE (%d bytes) \n", msg_type, sent);
}
void init_connections_with_lte_ue(void)
{
struct sockaddr_in sa =
{
.sin_family = AF_INET,
.sin_port = htons(6008 + ue_id_g * 2),
};
AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd %d was assigned already", from_lte_ue_fd);
from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (from_lte_ue_fd == -1)
{
LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, from_lte_ue_fd, errno, strerror(errno));
abort();
}
if (inet_aton(nsa_ipaddr, &sa.sin_addr) == 0)
{
LOG_E(NR_RRC, "Bad nsa_ipaddr '%s'\n", nsa_ipaddr);
abort();
}
if (bind(from_lte_ue_fd, (struct sockaddr *) &sa, sizeof(sa)) == -1)
{
LOG_E(NR_RRC,"%s: Failed to bind the socket\n", __FUNCTION__);
abort();
}
AssertFatal(to_lte_ue_fd == -1, "to_lte_ue_fd was assigned already");
to_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (to_lte_ue_fd == -1)
{
LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, to_lte_ue_fd, errno, strerror(errno));
abort();
}
LOG_I(NR_RRC, "Started LTE-NR link in the nr-UE\n");
}
static void start_oai_nrue_threads()
{
init_queue(&nr_rach_ind_queue);
......
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "common/utils/LOG/log.h"
#include "openair2/RRC/NR_UE/rrc_proto.h"
static const char nsa_ipaddr[] = "127.0.0.1";
static int from_lte_ue_fd = -1;
static int to_lte_ue_fd = -1;
uint16_t ue_id_g;
int get_from_lte_ue_fd()
{
return from_lte_ue_fd;
}
void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type)
{
LOG_I(NR_RRC, "Entered %s \n", __FUNCTION__);
nsa_msg_t n_msg;
if (msg_len > sizeof(n_msg.msg_buffer))
{
LOG_E(NR_RRC, "%s: message too big: %zu\n", __func__, msg_len);
abort();
}
n_msg.msg_type = msg_type;
memcpy(n_msg.msg_buffer, message, msg_len);
size_t to_send = sizeof(n_msg.msg_type) + msg_len;
struct sockaddr_in sa =
{
.sin_family = AF_INET,
.sin_port = htons(6007 + ue_id_g * 2),
};
int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0,
(struct sockaddr *)&sa, sizeof(sa));
if (sent == -1)
{
LOG_E(NR_RRC, "%s: sendto: %s\n", __func__, strerror(errno));
return;
}
if (sent != to_send)
{
LOG_E(NR_RRC, "%s: Short send %d != %zu\n", __func__, sent, to_send);
return;
}
LOG_D(NR_RRC, "Sent a %d message to the LTE UE (%d bytes) \n", msg_type, sent);
}
void init_connections_with_lte_ue(void)
{
struct sockaddr_in sa =
{
.sin_family = AF_INET,
.sin_port = htons(6008 + ue_id_g * 2),
};
AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd %d was assigned already", from_lte_ue_fd);
from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (from_lte_ue_fd == -1)
{
LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, from_lte_ue_fd, errno, strerror(errno));
abort();
}
if (inet_aton(nsa_ipaddr, &sa.sin_addr) == 0)
{
LOG_E(NR_RRC, "Bad nsa_ipaddr '%s'\n", nsa_ipaddr);
abort();
}
if (bind(from_lte_ue_fd, (struct sockaddr *) &sa, sizeof(sa)) == -1)
{
LOG_E(NR_RRC,"%s: Failed to bind the socket\n", __FUNCTION__);
abort();
}
AssertFatal(to_lte_ue_fd == -1, "to_lte_ue_fd was assigned already");
to_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (to_lte_ue_fd == -1)
{
LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, to_lte_ue_fd, errno, strerror(errno));
abort();
}
LOG_I(NR_RRC, "Started LTE-NR link in the nr-UE\n");
}
......@@ -168,6 +168,10 @@ void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_
\param gNB_index gNB index */
void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index);
void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len);
int get_from_lte_ue_fd();
/** @}*/
#endif
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