Commit 5c49b197 authored by Melissa Elkadi's avatar Melissa Elkadi

Merge remote-tracking branch...

Merge remote-tracking branch 'origin/episys/david/merge_develop_cfra_working_using_ue_config_for_IP_address' into episys/mel/merge_develop_cfra_working
parents 2cb934ac 6342e67c
......@@ -21,7 +21,7 @@ L1s = (
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "lo:";
remote_n_address = "127.0.0.2";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
......
......@@ -136,10 +136,9 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
void init_nrUE_standalone_thread(int ue_idx)
{
const char *standalone_addr = "127.0.0.1";
int standalone_tx_port = 3611 + 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_tx_port, standalone_rx_port);
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
pthread_mutex_init(&mac->mutex_dl_info, NULL);
......
......@@ -480,6 +480,7 @@ int main( int argc, char **argv ) {
NB_INST=1;
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **));
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs);
RCconfig_nr_ue_L1();
if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
......
......@@ -38,21 +38,23 @@
#include "SCHED_NR_UE/fapi_nr_ue_l1.h"
#include "executables/softmodem-common.h"
#include "openair2/RRC/NR_UE/rrc_proto.h"
#include "openair2/GNB_APP/L1_nr_paramdef.h"
#include "openair2/GNB_APP/gnb_paramdef.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include <stdio.h>
#define MAX_IF_MODULES 100
UL_IND_t *UL_INFO = NULL;
static eth_params_t stub_eth_params;
static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES];
static int ue_tx_sock_descriptor = -1;
static int ue_rx_sock_descriptor = -1;
int current_sfn_slot;
sem_t sfn_slot_semaphore;
void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
void nrue_init_standalone_socket(int tx_port, int rx_port)
{
{
struct sockaddr_in server_address;
......@@ -68,7 +70,7 @@ void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0)
if (inet_pton(server_address.sin_family, stub_eth_params.remote_addr, &server_address.sin_addr) <= 0)
{
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
......@@ -92,6 +94,7 @@ void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
int addr_len = sizeof(server_address);
memset(&server_address, 0, addr_len);
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = INADDR_ANY;
server_address.sin_port = htons(rx_port);
int sd = socket(server_address.sin_family, SOCK_DGRAM, 0);
......@@ -101,13 +104,6 @@ void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0)
{
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
return;
}
if (bind(sd, (struct sockaddr *)&server_address, addr_len) < 0)
{
LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
......@@ -119,7 +115,7 @@ void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
LOG_D(NR_RRC, "Sucessfully set up rx_socket in %s.\n", __FUNCTION__);
}
LOG_I(NR_RRC, "NRUE standalone socket info: tx_port %d rx_port %d on %s.\n",
tx_port, rx_port, addr);
tx_port, rx_port, stub_eth_params.remote_addr);
}
void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id)
......@@ -948,3 +944,32 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq) {
return 0;
}
void RCconfig_nr_ue_L1(void) {
int j;
paramdef_t L1_Params[] = L1PARAMS_DESC;
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0};
config_getlist(&L1_ParamList, L1_Params, sizeof(L1_Params) / sizeof(paramdef_t), NULL);
if (L1_ParamList.numelt > 0) {
for (j = 0; j < L1_ParamList.numelt; j++) {
if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
stub_eth_params.local_if_name = strdup(
*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
stub_eth_params.my_addr = strdup(
*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
stub_eth_params.remote_addr = strdup(
*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
stub_eth_params.my_portc =
*(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
stub_eth_params.remote_portc =
*(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
stub_eth_params.my_portd =
*(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
stub_eth_params.remote_portd =
*(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
stub_eth_params.transp_preference = ETH_UDP_MODE;
}
}
}
}
......@@ -220,7 +220,7 @@ typedef struct nr_ue_if_module_s {
\param module_id module id*/
nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id);
void nrue_init_standalone_socket(const char *addr, int tx_port, int rx_port);
void nrue_init_standalone_socket(int tx_port, int rx_port);
void *nrue_standalone_pnf_task(void *context);
extern int current_sfn_slot;
......
......@@ -75,6 +75,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][NUM_NFAPI_SUBFRAME][10]; //T
extern UE_RRC_INST *UE_rrc_inst;
extern uint16_t sf_ahead;
static eth_params_t stub_eth_params;
void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
......@@ -1147,7 +1148,6 @@ void UE_config_stub_pnf(void) {
int j;
paramdef_t L1_Params[] = L1PARAMS_DESC;
paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST, NULL, 0};
eth_params_t stub_eth_params;
config_getlist(&L1_ParamList, L1_Params, sizeof(L1_Params) / sizeof(paramdef_t), NULL);
if (L1_ParamList.numelt > 0) {
......@@ -1179,6 +1179,9 @@ void UE_config_stub_pnf(void) {
*(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
stub_eth_params.transp_preference = ETH_UDP_MODE;
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF)
continue;
sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
// configure_nfapi_pnf(UE_mac_inst[0].eth_params_n.remote_addr,
// UE_mac_inst[0].eth_params_n.remote_portc,
......@@ -1195,7 +1198,7 @@ void UE_config_stub_pnf(void) {
}
}
void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
void ue_init_standalone_socket(int tx_port, int rx_port)
{
{
struct sockaddr_in server_address;
......@@ -1211,7 +1214,7 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0)
if (inet_pton(server_address.sin_family, stub_eth_params.remote_addr, &server_address.sin_addr) <= 0)
{
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
......@@ -1234,6 +1237,7 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
int addr_len = sizeof(server_address);
memset(&server_address, 0, addr_len);
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = INADDR_ANY;
server_address.sin_port = htons(rx_port);
int sd = socket(server_address.sin_family, SOCK_DGRAM, 0);
......@@ -1243,13 +1247,6 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
return;
}
if (inet_pton(server_address.sin_family, addr, &server_address.sin_addr) <= 0)
{
LOG_E(MAC, "Invalid standalone PNF Address\n");
close(sd);
return;
}
if (bind(sd, (struct sockaddr *)&server_address, addr_len) < 0)
{
LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
......
......@@ -182,7 +182,7 @@ void *memcpy_tx_req_standalone(nfapi_tx_request_t *tx_req);
void *memcpy_dl_config_req_standalone(nfapi_dl_config_request_t *dl_config_req);
// open an SCTP socket with a standalone PNF module
void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port);
void ue_init_standalone_socket(int tx_port, int rx_port);
// read from standalone pnf socket call corresponding memcpy functions
void *ue_standalone_pnf_task(void *context);
......
......@@ -420,10 +420,9 @@ void init_UE_stub_single_thread(int nb_inst,
void init_UE_standalone_thread(int ue_idx)
{
const char *standalone_addr = "127.0.0.1"; // these two lines go into init
int standalone_tx_port = 3211 + 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_tx_port, standalone_rx_port);
pthread_t thread;
if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) {
......
......@@ -727,7 +727,7 @@ int main( int argc, char **argv ) {
exit(-1); // need a softer mode
}
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) { // UE-STUB-PNF
if (NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { // UE-STUB-PNF
UE_config_stub_pnf();
}
......
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