Commit 0b40edef authored by Michael Cook's avatar Michael Cook

Merge branch 'episys/david/proxy_oai' into 'episys/master'

Updating for operation with Proxy

See merge request aburger/openairinterface5g!18
parents 355e5919 b220ed29
......@@ -351,6 +351,7 @@ typedef enum {
} task_id_t;
extern uint16_t ue_idx_standalone;
extern uint16_t node_number;
typedef task_id_t thread_id_t;
......
......@@ -95,11 +95,16 @@ static int tun_alloc(char *dev) {
}
int netlink_init_mbms_tun(char *ifprefix) {
int netlink_init_mbms_tun(char *ifprefix, int id) {//for UE, id = 1, 2, ...,
int ret;
char ifname[64];
sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons
if ( id > 0 ){
sprintf(ifname, "oaitun_%.3s%d",ifprefix, id-1);
}
else{
sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons
}
nas_sock_mbms_fd = tun_alloc(ifname);
if (nas_sock_mbms_fd == -1) {
......@@ -151,11 +156,13 @@ int netlink_init_mbms_tun(char *ifprefix) {
return 1;
}
int netlink_init_tun(char *ifprefix, int num_if) {
int netlink_init_tun(char *ifprefix, int num_if, int id) {//for UE, id = 1, 2, ...,
int ret;
char ifname[64];
for (int i = 0; i < num_if; i++) {
int begx = (id == 0) ? 0 : id - 1;
int endx = (id == 0) ? num_if : id;
for (int i = begx; i < endx; i++) {
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
nas_sock_fd[i] = tun_alloc(ifname);
......
......@@ -62,7 +62,7 @@ int multicast_link_read_data_from_sock(uint8_t eNB_flag);
void clear_eNB_transport_info(uint8_t);
void clear_UE_transport_info(uint8_t);
int netlink_init(void);
int netlink_init_tun(char *ifsuffix, int num_if);
int netlink_init_mbms_tun(char *ifsuffix);
int netlink_init_tun(char *ifsuffix, int num_if, int id);
int netlink_init_mbms_tun(char *ifsuffix, int id);
#endif /* EMU_PROTO_H_ */
......@@ -2278,7 +2278,7 @@ void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind) {
pdcp_params.pdcp_data_ind_func = pdcp_data_ind;
}
uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) {
/* temporary enforce netlink when UE_NAS_USE_TUN is set,
this is while switching from noS1 as build option
to noS1 as config option */
......@@ -2296,17 +2296,17 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
if(UE_NAS_USE_TUN) {
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?MAX_NUMBER_NETIF:1;
netlink_init_tun("ue",num_if);
netlink_init_tun("ue",num_if, id);
if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem");
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem", id);
nas_config_mbms(1, 2, 2, "uem");
LOG_I(PDCP, "UE pdcp will use tun interface\n");
} else if(ENB_NAS_USE_TUN) {
netlink_init_tun("enb",1);
netlink_init_tun("enb", 1, 0);
nas_config(1, 1, 1, "enb");
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
netlink_init_mbms_tun("enm");
netlink_init_mbms_tun("enm", 0);
nas_config_mbms(1, 2, 1, "enm");
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
}
......@@ -2318,8 +2318,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
}else{
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n");
netlink_init_mbms_tun("enm");
nas_config_mbms_s1(1, 2, 1, "enm");
netlink_init_mbms_tun("enm", 1);
nas_config_mbms_s1(1, 2, 1, "enm");
}else
LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
}
......
......@@ -409,7 +409,7 @@ void pdcp_mbms_run (
*/
void pdcp_run (
const protocol_ctxt_t *const ctxt_pP);
uint64_t pdcp_module_init (uint64_t pdcp_optmask);
uint64_t pdcp_module_init (uint64_t pdcp_optmask, int ue_id);
void pdcp_module_cleanup (void);
void nr_ip_over_LTE_DRB_preconfiguration (void);
void pdcp_layer_init (void);
......
......@@ -99,7 +99,7 @@ extern Packet_OTG_List_t *otg_pdcp_buffer;
extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP);
uint16_t ue_id_g;// global variable to identify ue id for each ue. Change happens only in main function of lte-uesoftmodem.c
void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) {
LOG_I(PDCP,"%s: \nPC5S message, header traffic_type: %d)\n", title, sl_pc5s_msg->pc5s_header.traffic_type);
......@@ -145,7 +145,14 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
}
printf("\n");
#endif
ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
if (ue_id_g == 0)
{
ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
}
else
{
ret = write(nas_sock_fd[ue_id_g], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
}
//LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite);
}
} else if (ENB_NAS_USE_TUN) {
......@@ -232,8 +239,15 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
do {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
len = read(UE_NAS_USE_TUN?nas_sock_fd[ctxt_pP->module_id]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (ue_id_g == 0)
{
len = read(UE_NAS_USE_TUN?nas_sock_fd[ctxt_pP->module_id]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
}
else
{
len = read(UE_NAS_USE_TUN?nas_sock_fd[ue_id_g]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len<=0) continue;
......
......@@ -488,7 +488,7 @@ void init_pdcp(void) {
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_W_MBMS_BIT;
pdcp_module_init(pdcp_initmask);
pdcp_module_init(pdcp_initmask, 0);
if (NODE_IS_CU(RC.rrc[0]->node_type)) {
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
......
......@@ -117,6 +117,7 @@
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0}, \
{"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0}, \
{"node-number", NULL, 0, u16ptr:&node_number, defuintval:2, TYPE_UINT16, 0}, \
}
/*-----------------------------------------------------------------------------------------------------------------------------*/
......@@ -207,7 +208,7 @@ extern int stop_L1L2(module_id_t enb_id);
extern int restart_L1L2(module_id_t enb_id);
extern void init_UE_stub_single_thread(int nb_inst, int eMBMS_active, int uecap_xer_in, char *emul_iface);
extern void init_UE_standalone_thread(void);
extern void init_UE_standalone_thread(int ue_idx);
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
......
......@@ -426,11 +426,11 @@ void init_UE_stub_single_thread(int nb_inst,
}
}
void init_UE_standalone_thread()
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;
int standalone_rx_port = 3212;
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);
pthread_t thread;
......
......@@ -86,7 +86,7 @@
#include "lte-softmodem.h"
extern int ue_id_g ;
/* temporary compilation wokaround (UE/eNB split */
uint16_t sf_ahead;
......@@ -280,6 +280,7 @@ void exit_function(const char *file, const char *function, const int line, const
extern int16_t dlsch_demod_shift;
uint16_t ue_idx_standalone = 0xFFFF;
uint16_t node_number;
static void get_options(void) {
int CC_id=0;
int tddflag=0;
......@@ -526,7 +527,7 @@ int restart_L1L2(module_id_t enb_id) {
return 0;
}
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);
// Do we need to include standalone mode here? - Andrew
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
......@@ -536,7 +537,7 @@ void init_pdcp(void) {
if (IS_SOFTMODEM_NOKRNMOD)
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
pdcp_module_init(pdcp_initmask);
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);
}
......@@ -623,7 +624,16 @@ int main( int argc, char **argv ) {
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
init_opt();
init_pdcp();
ue_id_g = (node_number == 0)? 0 : node_number-2 ;//ue_id_g = 0, 1, ...,
if( node_number == 0 )
{
init_pdcp(0);
}
else
{
init_pdcp(node_number-1);
}
//TTN for D2D
printf ("RRC control socket\n");
rrc_control_socket_init();
......@@ -746,7 +756,7 @@ int main( int argc, char **argv ) {
abort();
}
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_standalone_thread();
init_UE_standalone_thread(ue_id_g);
} else {
init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
frame_parms[0]);
......
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