Commit 591e0e1f authored by Deokseong "David" Kim's avatar Deokseong "David" Kim Committed by Melissa

Adjusted UDP port ids for multiple UE connection with proxy

parent 777bcc6c
...@@ -129,8 +129,8 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, ...@@ -129,8 +129,8 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
void init_nrUE_standalone_thread(int ue_idx) void init_nrUE_standalone_thread(int ue_idx)
{ {
const char *standalone_addr = "127.0.0.1"; const char *standalone_addr = "127.0.0.1";
int standalone_tx_port = 3611 + (ue_idx)*2; int standalone_tx_port = 3611 + ue_idx * 2;
int standalone_rx_port = 3612 + (ue_idx)*2; int standalone_rx_port = 3612 + ue_idx * 2;
nrue_init_standalone_socket(standalone_addr, standalone_tx_port, standalone_rx_port); nrue_init_standalone_socket(standalone_addr, standalone_tx_port, standalone_rx_port);
pthread_t thread; pthread_t thread;
...@@ -252,6 +252,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -252,6 +252,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
} }
} }
} }
return NULL;
} }
......
...@@ -456,7 +456,7 @@ void init_openair0(void) { ...@@ -456,7 +456,7 @@ void init_openair0(void) {
} }
} }
void init_pdcp(void) { void init_pdcp(int ue_id) {
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
/*if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { /*if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
...@@ -471,7 +471,7 @@ void init_pdcp(void) { ...@@ -471,7 +471,7 @@ void init_pdcp(void) {
} }
pdcp_layer_init(); pdcp_layer_init();
nr_DRB_preconfiguration();*/ nr_DRB_preconfiguration();*/
nr_pdcp_module_init(pdcp_initmask, 0); 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_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); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
LOG_I(PDCP, "Before getting out from init_pdcp() \n"); LOG_I(PDCP, "Before getting out from init_pdcp() \n");
...@@ -525,8 +525,23 @@ int main( int argc, char **argv ) { ...@@ -525,8 +525,23 @@ int main( int argc, char **argv ) {
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
init_NR_UE(1,rrc_config_path); init_NR_UE(1,rrc_config_path);
int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 0;
int 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(IS_SOFTMODEM_NOS1) if(IS_SOFTMODEM_NOS1)
init_pdcp(); {
if(node_number == 0)
{
init_pdcp(0);
}
else
{
init_pdcp(mode_offset + node_number - 1);
}
}
NB_UE_INST=1; NB_UE_INST=1;
NB_INST=1; NB_INST=1;
......
...@@ -148,7 +148,7 @@ extern "C" ...@@ -148,7 +148,7 @@ extern "C"
{"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \ {"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \
{"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:2, TYPE_UINT16, 0}, \ {"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \
} }
#define CONFIG_HLP_NSA "Enable NSA mode \n" #define CONFIG_HLP_NSA "Enable NSA mode \n"
......
...@@ -530,7 +530,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -530,7 +530,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
if(ra->cfra) { if(ra->cfra) {
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); LOG_A(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti);
//nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); //nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP);
UE_info->active[UE_id] = true; UE_info->active[UE_id] = true;
......
...@@ -98,6 +98,7 @@ static int from_nr_ue_fd = -1; ...@@ -98,6 +98,7 @@ static int from_nr_ue_fd = -1;
static int to_nr_ue_fd = -1; static int to_nr_ue_fd = -1;
int slrb_id; int slrb_id;
int send_ue_information = 0; int send_ue_information = 0;
extern int ue_id_g;
// for malloc_clear // for malloc_clear
#include "PHY/defs_UE.h" #include "PHY/defs_UE.h"
...@@ -6515,7 +6516,7 @@ void nsa_sendmsg_to_nrue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg ...@@ -6515,7 +6516,7 @@ void nsa_sendmsg_to_nrue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg
struct sockaddr_in sa = struct sockaddr_in sa =
{ {
.sin_family = AF_INET, .sin_family = AF_INET,
.sin_port = htons(6008), .sin_port = htons(6008 + ue_id_g * 2),
}; };
int sent = sendto(to_nr_ue_fd, &n_msg, to_send, 0, int sent = sendto(to_nr_ue_fd, &n_msg, to_send, 0,
(struct sockaddr *)&sa, sizeof(sa)); (struct sockaddr *)&sa, sizeof(sa));
...@@ -6532,12 +6533,12 @@ void nsa_sendmsg_to_nrue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg ...@@ -6532,12 +6533,12 @@ void nsa_sendmsg_to_nrue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg
LOG_I(RRC, "Sent a %d message to the nrUE (%d bytes) \n", msg_type, sent); LOG_I(RRC, "Sent a %d message to the nrUE (%d bytes) \n", msg_type, sent);
} }
void init_connections_with_nr_ue(void) void init_connections_with_nr_ue()
{ {
struct sockaddr_in sa = struct sockaddr_in sa =
{ {
.sin_family = AF_INET, .sin_family = AF_INET,
.sin_port = htons(6007), .sin_port = htons(6007 + ue_id_g * 2),
}; };
AssertFatal(from_nr_ue_fd == -1, "from_nr_ue_fd was assigned already"); AssertFatal(from_nr_ue_fd == -1, "from_nr_ue_fd was assigned already");
from_nr_ue_fd = socket(AF_INET, SOCK_DGRAM, 0); from_nr_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
......
...@@ -133,7 +133,7 @@ uint8_t first_rrcreconfigurationcomplete = 0; ...@@ -133,7 +133,7 @@ uint8_t first_rrcreconfigurationcomplete = 0;
static const char nsa_ipaddr[] = "127.0.0.1"; static const char nsa_ipaddr[] = "127.0.0.1";
static int from_lte_ue_fd = -1; static int from_lte_ue_fd = -1;
static int to_lte_ue_fd = -1; static int to_lte_ue_fd = -1;
uint16_t ue_id_g; extern uint16_t ue_id_g;
static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) { static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) {
return NR_UE_rrc_inst[ue_mod_idP].nrRrcState; return NR_UE_rrc_inst[ue_mod_idP].nrRrcState;
...@@ -2909,7 +2909,7 @@ void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_ ...@@ -2909,7 +2909,7 @@ void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_
struct sockaddr_in sa = struct sockaddr_in sa =
{ {
.sin_family = AF_INET, .sin_family = AF_INET,
.sin_port = htons(6007), .sin_port = htons(6007 + ue_id_g * 2),
}; };
int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0, int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0,
(struct sockaddr *)&sa, sizeof(sa)); (struct sockaddr *)&sa, sizeof(sa));
...@@ -2931,7 +2931,7 @@ void init_connections_with_lte_ue(void) ...@@ -2931,7 +2931,7 @@ void init_connections_with_lte_ue(void)
struct sockaddr_in sa = struct sockaddr_in sa =
{ {
.sin_family = AF_INET, .sin_family = AF_INET,
.sin_port = htons(6008), .sin_port = htons(6008 + ue_id_g * 2),
}; };
AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd was assigned already"); AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd was assigned already");
from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0); from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0);
...@@ -2973,9 +2973,9 @@ static void start_oai_nrue_threads() ...@@ -2973,9 +2973,9 @@ static void start_oai_nrue_threads()
LOG_E(MAC, "sem_init() error\n"); LOG_E(MAC, "sem_init() error\n");
abort(); abort();
} }
int node_num = get_softmodem_params()->node_number;
ue_id_g = (node_num == 0)? 0 : node_num-2;
init_nrUE_standalone_thread(ue_id_g); init_nrUE_standalone_thread(ue_id_g);
} }
static void nsa_rrc_ue_process_ueCapabilityEnquiry(void) static void nsa_rrc_ue_process_ueCapabilityEnquiry(void)
......
...@@ -421,8 +421,8 @@ void init_UE_stub_single_thread(int nb_inst, ...@@ -421,8 +421,8 @@ void init_UE_stub_single_thread(int nb_inst,
void init_UE_standalone_thread(int ue_idx) void init_UE_standalone_thread(int ue_idx)
{ {
const char *standalone_addr = "127.0.0.1"; // these two lines go into init const char *standalone_addr = "127.0.0.1"; // these two lines go into init
int standalone_tx_port = 3211 + ue_idx*2; int standalone_tx_port = 3211 + ue_idx * 2;
int standalone_rx_port = 3212 + ue_idx*2; int standalone_rx_port = 3212 + ue_idx * 2;
ue_init_standalone_socket(standalone_addr, standalone_tx_port, standalone_rx_port); ue_init_standalone_socket(standalone_addr, standalone_tx_port, standalone_rx_port);
pthread_t thread; pthread_t thread;
......
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