diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 51d5f3805f22121da975758fe9294afa833e9782..7f8cf95c2bfd3be896823e3e0fa8c8648379c8a0 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2242,6 +2242,10 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1; } else if (strcmp(tr_preference, "raw") == 0) { enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1; + } else if (strcmp(tr_preference, "udpif4") == 0) { + enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udpif4 = 1; + } else if (strcmp(tr_preference, "rawif4") == 0) { + enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rawif4 = 1; } else {//if (strcmp(preference, "no") == 0) enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1; enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1; diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 5f7f2636a38ab49c7cfcbcfa5f6dc88103704d4e..e53921b4d0e3b9e067be09779c1137b7bc4978cd 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -86,6 +86,8 @@ typedef struct rrh_gw_config_s { char *remote_address; uint16_t local_port; uint16_t remote_port; + uint8_t udpif4; + uint8_t rawif4; int tx_scheduling_advance; int tx_sample_advance; int iq_txshift; diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c index 14561a25e79d536af5c39a7f291d636f38006f45..be524b6d5f56ba6ae272642114fa70fe08b4de21 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c @@ -51,6 +51,7 @@ #include "common_lib.h" #include "ethernet_lib.h" +#include "if_defs.h" #define DEBUG 0 diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c index a9706c73bdd16dad3cce786ead09bca8700b65f2..55b5e0853522a5447313edc6585002483008defb 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c @@ -52,6 +52,7 @@ #include "common_lib.h" #include "ethernet_lib.h" +#include "if_defs.h" #define DEBUG 0 struct sockaddr_in dest_addr[MAX_INST]; diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c index 7537d77e2ea9331870a6807e2a4eeb3af6354eb5..ee9ba50f66b3786ccfa5739c5ae1f1e85c2216dc 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c @@ -51,7 +51,7 @@ #include "common_lib.h" #include "ethernet_lib.h" - +#include "if_defs.h" int num_devices_eth = 0; struct sockaddr_in dest_addr[MAX_INST]; @@ -336,7 +336,6 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth device->trx_set_freq_func = trx_eth_set_freq; device->trx_set_gains_func = trx_eth_set_gains; - /// handle if4 eth read and write functions if (eth->flags == ETH_RAW_MODE) { device->trx_write_func = trx_eth_write_raw; device->trx_read_func = trx_eth_read_raw; diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h index beb324cc5966875961df71eeb1751aa4078096af..72ddc0e87c5fdc92167471b1d6ce11b8729f59d3 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h @@ -52,25 +52,12 @@ #define MAX_INST 4 #define DEFAULT_IF "lo" -#define ETH_RAW_MODE 1 -#define ETH_UDP_MODE 0 -#define ETH_RAW_IF4_MODE 3 -#define ETH_UDP_IF4_MODE 2 - #define TX_FLAG 1 #define RX_FLAG 0 -#define MAX_PACKET_SEQ_NUM(spp,spf) (spf/spp) +#include "if_defs.h" #define MAC_HEADER_SIZE_BYTES (sizeof(struct ether_header)) #define APP_HEADER_SIZE_BYTES (sizeof(int32_t) + sizeof(openair0_timestamp)) -#define PAYLOAD_SIZE_BYTES(nsamps) (nsamps<<2) -#define UDP_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps)) -#define RAW_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps)) - -#define DATA_BLOCK_SIZE_BYTES(scaled_nblocks) (2*scaled_nblocks) -#define RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_dl_header_t + DATA_BLOCK_SIZE_BYTES(nblocks)) -#define RAW_IF4_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_ul_header_t + DATA_BLOCK_SIZE_BYTES(nblocks)) -#define RAW_IF4_PRACH_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_prach_header_t + DATA_BLOCK_SIZE_BYTES(nblocks)) /*!\brief opaque ethernet data structure */ typedef struct { diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h b/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h new file mode 100644 index 0000000000000000000000000000000000000000..f38421bed2c2bcf2d20e8e972314a3d3ba0ee3a6 --- /dev/null +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h @@ -0,0 +1,57 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see <http://www.gnu.org/licenses/>. + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h +* \brief +* \author S. Sandeep Kumar, Raymond Knopp +* \date 2016 +* \version 0.1 +* \company Eurecom +* \email: ee13b1025@iith.ac.in, knopp@eurecom.fr +* \note +* \warning +*/ + +// ETH transport preference modes +#define ETH_UDP_MODE 0 +#define ETH_RAW_MODE 1 +#define ETH_UDP_IF4_MODE 2 +#define ETH_RAW_IF4_MODE 3 + +// Time domain RRH packet sizes +#define MAX_PACKET_SEQ_NUM(spp,spf) (spf/spp) +#define PAYLOAD_SIZE_BYTES(nsamps) (nsamps<<2) +#define UDP_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps)) +#define RAW_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps)) + +// Packet sizes for IF4 interface format +#define DATA_BLOCK_SIZE_BYTES(scaled_nblocks) (2*scaled_nblocks) +#define RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_dl_header_t + DATA_BLOCK_SIZE_BYTES(nblocks)) +#define RAW_IF4_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_ul_header_t + DATA_BLOCK_SIZE_BYTES(nblocks)) +#define RAW_IF4_PRACH_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_prach_header_t + DATA_BLOCK_SIZE_BYTES(nblocks)) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 50ffc6e1ff348e416d9308000abab9938b6a0556..dd55dacb1f52651032d543bc39f9782686314fa5 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -65,6 +65,7 @@ //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all #include "../../ARCH/COMMON/common_lib.h" +#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all @@ -1016,7 +1017,17 @@ static void get_options (int argc, char **argv) (eth_params+j)->my_port = enb_properties->properties[i]->rrh_gw_config[j].local_port; (eth_params+j)->remote_addr = enb_properties->properties[i]->rrh_gw_config[j].remote_address; (eth_params+j)->remote_port = enb_properties->properties[i]->rrh_gw_config[j].remote_port; - (eth_params+j)->transp_preference = enb_properties->properties[i]->rrh_gw_config[j].raw; + + if (enb_properties->properties[i]->rrh_gw_config[j].raw == 1) { + (eth_params+j)->transp_preference = ETH_RAW_MODE; + } else if (enb_properties->properties[i]->rrh_gw_config[j].rawif4 == 1) { + (eth_params+j)->transp_preference = ETH_RAW_IF4_MODE; + } else if (enb_properties->properties[i]->rrh_gw_config[j].udpif4 == 1) { + (eth_params+j)->transp_preference = ETH_UDP_IF4_MODE; + } else { + (eth_params+j)->transp_preference = ETH_UDP_MODE; + } + (eth_params+j)->iq_txshift = enb_properties->properties[i]->rrh_gw_config[j].iq_txshift; (eth_params+j)->tx_sample_advance = enb_properties->properties[i]->rrh_gw_config[j].tx_sample_advance; (eth_params+j)->tx_scheduling_advance = enb_properties->properties[i]->rrh_gw_config[j].tx_scheduling_advance;