Merge branch 'episys/master-nsa' into origin-episys-merge-nsa
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include "utils.h"
|
||||
|
||||
void *calloc_or_fail(size_t size) {
|
||||
@@ -137,3 +140,32 @@ void *memcpy1(void *dst,const void *src,size_t n) {
|
||||
asm volatile("rep movsb" : "+D" (dst) : "c"(n), "S"(src) : "cc","memory");
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void set_priority(int priority)
|
||||
{
|
||||
/* When running with a realtime scheduler, a buggy run-away process can take
|
||||
down the host requiring a reboot to recover. To avoid this scenario, we
|
||||
use alarm(2) to set a maximum running time */
|
||||
unsigned max_runtime_seconds = 10 * 60; /* default */
|
||||
const char *env = getenv("MAX_RUNTIME_SECONDS");
|
||||
if (env != NULL)
|
||||
{
|
||||
max_runtime_seconds = atoi(env);
|
||||
}
|
||||
unsigned was_alarm = alarm(max_runtime_seconds);
|
||||
/* Normally, was_alarm should be 0 indicating there was no previous alarm set.
|
||||
A non-zero value could indicate a mistake */
|
||||
fprintf(stderr, "Set alarm for %u seconds, was %u (see $MAX_RUNTIME_SECONDS)\n",
|
||||
max_runtime_seconds, was_alarm);
|
||||
|
||||
struct sched_param param =
|
||||
{
|
||||
.sched_priority = priority,
|
||||
};
|
||||
fprintf(stderr, "Calling sched_setscheduler(%d)\n", priority);
|
||||
if (sched_setscheduler(0, SCHED_RR, ¶m) == -1)
|
||||
{
|
||||
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz
|
||||
|
||||
void *memcpy1(void *dst,const void *src,size_t n);
|
||||
|
||||
void set_priority(int priority);
|
||||
|
||||
char *itoa(int i);
|
||||
|
||||
|
||||
@@ -633,6 +633,9 @@ void init_pdcp(void) {
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||
}
|
||||
} else {
|
||||
LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
|
||||
}
|
||||
} else if (get_softmodem_params()->nsa) {
|
||||
pdcp_layer_init();
|
||||
@@ -712,9 +715,11 @@ int main( int argc, char **argv ) {
|
||||
|
||||
#ifdef PDCP_USE_NETLINK
|
||||
|
||||
if(!IS_SOFTMODEM_NOS1) {
|
||||
if (!IS_SOFTMODEM_NOS1) {
|
||||
netlink_init();
|
||||
init_pdcp();
|
||||
if (get_softmodem_params()->nsa) {
|
||||
init_pdcp();
|
||||
}
|
||||
}
|
||||
#if defined(PDCP_USE_NETLINK_QUEUES)
|
||||
pdcp_netlink_init();
|
||||
|
||||
@@ -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 -----------------------------*/
|
||||
@@ -398,13 +397,11 @@ void init_pdcp(int ue_id) {
|
||||
if (IS_SOFTMODEM_NOKRNMOD) {
|
||||
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
||||
}
|
||||
if (rlc_module_init(0) != 0) {
|
||||
if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) {
|
||||
LOG_I(RLC, "Problem at RLC initiation \n");
|
||||
}
|
||||
pdcp_layer_init();
|
||||
nr_pdcp_module_init(pdcp_initmask, ue_id);
|
||||
|
||||
|
||||
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
|
||||
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
|
||||
}
|
||||
@@ -416,6 +413,13 @@ void *rrc_enb_process_msg(void *notUsed) {
|
||||
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
set_priority(79);
|
||||
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
|
||||
{
|
||||
fprintf(stderr, "mlockall: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
//uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
|
||||
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
|
||||
start_background_system();
|
||||
@@ -463,14 +467,13 @@ int main( int argc, char **argv ) {
|
||||
uint16_t node_number = get_softmodem_params()->node_number;
|
||||
ue_id_g = (node_number == 0) ? 0 : node_number - 2;
|
||||
AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n");
|
||||
|
||||
if(node_number == 0)
|
||||
{
|
||||
init_pdcp(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
init_pdcp(mode_offset + ue_id_g);
|
||||
if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa || get_softmodem_params()->nsa) {
|
||||
if(node_number == 0) {
|
||||
init_pdcp(0);
|
||||
}
|
||||
else {
|
||||
init_pdcp(mode_offset + ue_id_g);
|
||||
}
|
||||
}
|
||||
|
||||
NB_UE_INST=1;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#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;
|
||||
@@ -0,0 +1,9 @@
|
||||
#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;
|
||||
@@ -40,15 +40,9 @@ typedef struct {
|
||||
static nfapi_params_t nfapi_params = {0};
|
||||
|
||||
void set_thread_priority(int priority) {
|
||||
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
|
||||
set_priority(priority);
|
||||
|
||||
pthread_attr_t ptAttr;
|
||||
struct sched_param schedParam;
|
||||
schedParam.__sched_priority = priority; //79;
|
||||
|
||||
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
|
||||
printf("Failed to set scheduler to SCHED_RR\n");
|
||||
}
|
||||
|
||||
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
|
||||
printf("Failed to set pthread sched policy SCHED_RR\n");
|
||||
}
|
||||
|
||||
@@ -218,14 +218,9 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...)
|
||||
}
|
||||
|
||||
void pnf_set_thread_priority(int priority) {
|
||||
set_priority(priority);
|
||||
|
||||
pthread_attr_t ptAttr;
|
||||
struct sched_param schedParam;
|
||||
schedParam.__sched_priority = priority;
|
||||
|
||||
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
|
||||
printf("failed to set SCHED_RR\n");
|
||||
}
|
||||
|
||||
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
|
||||
printf("failed to set pthread SCHED_RR %d\n", errno);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -2752,6 +2747,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;
|
||||
@@ -2771,77 +2767,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);
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#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
|
||||
|
||||
|
||||
@@ -61,9 +61,10 @@ int create_tasks(uint32_t enb_nb) {
|
||||
rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL);
|
||||
AssertFatal(rc >= 0, "Create task for RRC eNB failed\n");
|
||||
|
||||
rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
|
||||
AssertFatal(rc >= 0, "Create task for SCTP failed\n");
|
||||
|
||||
if (get_softmodem_params()->nsa || (EPC_MODE_ENABLED && split73 != SPLIT73_DU)) {
|
||||
rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
|
||||
AssertFatal(rc >= 0, "Create task for SCTP failed\n");
|
||||
}
|
||||
|
||||
if (EPC_MODE_ENABLED && !NODE_IS_DU(type) && ! ( split73==SPLIT73_DU ) ) {
|
||||
rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL);
|
||||
|
||||
@@ -524,15 +524,7 @@ static void wait_nfapi_init(char *thread_name) {
|
||||
|
||||
int main ( int argc, char **argv )
|
||||
{
|
||||
struct sched_param param =
|
||||
{
|
||||
.sched_priority = 79
|
||||
};
|
||||
if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 )
|
||||
{
|
||||
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
set_priority(79);
|
||||
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
|
||||
{
|
||||
fprintf(stderr, "mlockall: %s\n", strerror(errno));
|
||||
|
||||
@@ -547,15 +547,7 @@ AssertFatal(false,"");
|
||||
}
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
struct sched_param param =
|
||||
{
|
||||
.sched_priority = 79
|
||||
};
|
||||
if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 )
|
||||
{
|
||||
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
set_priority(79);
|
||||
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
|
||||
{
|
||||
fprintf(stderr, "mlockall: %s\n", strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user