summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-07-13 22:44:18 +0200
committerDamjan Marion <damarion@cisco.com>2016-07-22 09:10:58 +0200
commit1f0da170e818a6991d841df47de0885da720b0c3 (patch)
tree900f90de63cd398cd80ff65182c6d815dd69d07d /vnet
parent11bfc2f7f3896b7a539f662f1385516e653b3926 (diff)
Add DPDK 16.07 support (rc3 based)
DPDK vhost-user support is disabled due to significan changes in the DPDK vhost-user code which are not compatible with current VPP code. Change-Id: I3f0d28cb75f6370282ec7e33d57cbfb77e1a3ce1 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/cli.c5
-rw-r--r--vnet/vnet/devices/dpdk/device.c8
-rw-r--r--vnet/vnet/devices/dpdk/dpdk.h19
-rw-r--r--vnet/vnet/devices/dpdk/dpdk_priv.h11
-rw-r--r--vnet/vnet/devices/dpdk/format.c34
-rw-r--r--vnet/vnet/devices/dpdk/init.c8
-rw-r--r--vnet/vnet/devices/dpdk/vhost_user.c3
7 files changed, 78 insertions, 10 deletions
diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c
index bcc3d2f9..3b0befd5 100644
--- a/vnet/vnet/devices/dpdk/cli.c
+++ b/vnet/vnet/devices/dpdk/cli.c
@@ -167,8 +167,13 @@ show_dpdk_buffer (vlib_main_t * vm, unformat_input_t * input,
rmp = vm->buffer_main->pktmbuf_pools[i];
if (rmp)
{
+#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
+ unsigned count = rte_mempool_avail_count(rmp);
+ unsigned free_count = rte_mempool_in_use_count(rmp);
+#else
unsigned count = rte_mempool_count(rmp);
unsigned free_count = rte_mempool_free_count(rmp);
+#endif
vlib_cli_output(vm, "name=\"%s\" available = %7d allocated = %7d total = %7d\n",
rmp->name, (u32)count, (u32)free_count,
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index 27e35229..66d4b6d4 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -355,6 +355,7 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
n_retry = (rv == DPDK_TX_RING_SIZE - tx_tail) ? 1 : 0;
}
}
+#if DPDK_VHOST_USER
else if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
{
u32 offset = 0;
@@ -450,6 +451,7 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
if (xd->need_txlock)
*xd->lockp[queue_id] = 0;
}
+#endif
#if RTE_LIBRTE_KNI
else if (xd->dev_type == VNET_DPDK_DEV_KNI)
{
@@ -878,6 +880,7 @@ dpdk_interface_tx (vlib_main_t * vm,
static int dpdk_device_renumber (vnet_hw_interface_t * hi,
u32 new_dev_instance)
{
+#if DPDK_VHOST_USER
dpdk_main_t * dm = &dpdk_main;
dpdk_device_t * xd = vec_elt_at_index (dm->devices, hi->dev_instance);
@@ -888,6 +891,7 @@ static int dpdk_device_renumber (vnet_hw_interface_t * hi,
}
xd->vu_if_id = new_dev_instance;
+#endif
return 0;
}
@@ -926,6 +930,7 @@ static void dpdk_clear_hw_interface_counters (u32 instance)
memset (&xd->last_stats, 0, sizeof (xd->last_stats));
}
+#if DPDK_VHOST_USER
if (PREDICT_FALSE(xd->dev_type == VNET_DPDK_DEV_VHOST_USER)) {
int i;
for (i = 0; i < xd->rx_q_used * VIRTIO_QNUM; i++) {
@@ -933,6 +938,7 @@ static void dpdk_clear_hw_interface_counters (u32 instance)
xd->vu_intf->vrings[i].bytes = 0;
}
}
+#endif
}
#ifdef RTE_LIBRTE_KNI
@@ -1027,6 +1033,7 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
return 0;
}
#endif
+#if DPDK_VHOST_USER
if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
{
if (is_up)
@@ -1045,6 +1052,7 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
return 0;
}
+#endif
if (is_up)
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h
index 00caeafa..830bf102 100644
--- a/vnet/vnet/devices/dpdk/dpdk.h
+++ b/vnet/vnet/devices/dpdk/dpdk.h
@@ -61,6 +61,12 @@
#define always_inline static inline __attribute__ ((__always_inline__))
#endif
+#if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 0)
+#define DPDK_VHOST_USER 1
+#else
+#define DPDK_VHOST_USER 0
+#endif
+
#include <vlib/pci/pci.h>
#define NB_MBUF (16<<10)
@@ -131,6 +137,7 @@ typedef struct {
u32 total_packet_cnt;
} dpdk_efd_agent_t;
+#if DPDK_VHOST_USER
typedef struct {
int callfd;
int kickfd;
@@ -160,6 +167,7 @@ typedef struct {
u32 region_fd[VHOST_MEMORY_MAX_NREGIONS];
u64 region_offset[VHOST_MEMORY_MAX_NREGIONS];
} dpdk_vu_intf_t;
+#endif
typedef void (*dpdk_flowcontrol_callback_t) (vlib_main_t *vm,
u32 hw_if_index,
@@ -225,11 +233,13 @@ typedef struct {
struct rte_kni *kni;
u8 kni_port_id;
+#if DPDK_VHOST_USER
/* vhost-user related */
u32 vu_if_id;
struct virtio_net vu_vhost_dev;
u32 vu_is_running;
dpdk_vu_intf_t *vu_intf;
+#endif
/* af_packet */
u8 af_packet_port_id;
@@ -240,8 +250,13 @@ typedef struct {
struct rte_eth_stats stats;
struct rte_eth_stats last_stats;
struct rte_eth_stats last_cleared_stats;
+#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
+ struct rte_eth_xstat * xstats;
+ struct rte_eth_xstat * last_cleared_xstats;
+#else
struct rte_eth_xstats * xstats;
struct rte_eth_xstats * last_cleared_xstats;
+#endif
f64 time_last_stats_update;
dpdk_port_type_t port_type;
@@ -509,10 +524,12 @@ u32 is_efd_discardable(vlib_thread_main_t *tm,
vlib_buffer_t * b0,
struct rte_mbuf *mb);
+#if DPDK_VHOST_USER
/* dpdk vhost-user interrupt management */
u8 dpdk_vhost_user_want_interrupt (dpdk_device_t *xd, int idx);
void dpdk_vhost_user_send_interrupt (vlib_main_t * vm, dpdk_device_t * xd,
int idx);
+#endif
static inline u64 vnet_get_aggregate_rx_packets (void)
@@ -544,6 +561,7 @@ void efd_config(u32 enabled,
void post_sw_interface_set_flags (vlib_main_t *vm, u32 sw_if_index, u32 flags);
+#if DPDK_VHOST_USER
typedef struct vhost_user_memory vhost_user_memory_t;
void dpdk_vhost_user_process_init (void **ctx);
@@ -568,6 +586,7 @@ int dpdk_vhost_user_delete_if (vnet_main_t * vnm, vlib_main_t * vm,
u32 sw_if_index);
int dpdk_vhost_user_dump_ifs (vnet_main_t * vnm, vlib_main_t * vm,
vhost_user_intf_details_t **out_vuids);
+#endif
u32 dpdk_get_admin_up_down_in_progress (void);
diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h
index c6be7e7f..ac499432 100644
--- a/vnet/vnet/devices/dpdk/dpdk_priv.h
+++ b/vnet/vnet/devices/dpdk/dpdk_priv.h
@@ -23,6 +23,15 @@
#define DPDK_NB_TX_DESC_40GE 1024
#define DPDK_NB_RX_DESC_ENIC 1024
+#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
+#define I40E_DEV_ID_SFP_XL710 0x1572
+#define I40E_DEV_ID_QSFP_A 0x1583
+#define I40E_DEV_ID_QSFP_B 0x1584
+#define I40E_DEV_ID_QSFP_C 0x1585
+#define I40E_DEV_ID_10G_BASE_T 0x1586
+#define I40E_DEV_ID_VF 0x154C
+#endif
+
/* These args appear by themselves */
#define foreach_eal_double_hyphen_predicate_arg \
_(no-shconf) \
@@ -72,6 +81,7 @@ dpdk_rx_burst ( dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
break;
}
}
+#if DPDK_VHOST_USER
else if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
{
vlib_main_t * vm = vlib_get_main();
@@ -129,6 +139,7 @@ dpdk_rx_burst ( dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
}
}
+#endif
#ifdef RTE_LIBRTE_KNI
else if (xd->dev_type == VNET_DPDK_DEV_KNI)
{
diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c
index 25591c2e..4c553655 100644
--- a/vnet/vnet/devices/dpdk/format.c
+++ b/vnet/vnet/devices/dpdk/format.c
@@ -28,16 +28,11 @@
_ (tx_frames_ok, opackets) \
_ (tx_bytes_ok, obytes) \
_ (tx_errors, oerrors) \
- _ (tx_loopback_frames_ok, olbpackets) \
- _ (tx_loopback_bytes_ok, olbbytes) \
_ (rx_frames_ok, ipackets) \
_ (rx_bytes_ok, ibytes) \
_ (rx_errors, ierrors) \
_ (rx_missed, imissed) \
- _ (rx_multicast_frames_ok, imcasts) \
- _ (rx_no_bufs, rx_nombuf) \
- _ (rx_loopback_frames_ok, ilbpackets) \
- _ (rx_loopback_bytes_ok, ilbbytes)
+ _ (rx_no_bufs, rx_nombuf)
#define foreach_dpdk_q_counter \
_ (rx_frames_ok, q_ipackets) \
@@ -174,9 +169,11 @@ u8 * format_dpdk_device_name (u8 * s, va_list * args)
return format(s, "kni%d", dm->devices[i].kni_port_id);
} else
#endif
+#if DPDK_VHOST_USER
if (dm->devices[i].dev_type == VNET_DPDK_DEV_VHOST_USER) {
return format(s, "VirtualEthernet0/0/%d", dm->devices[i].vu_if_id);
}
+#endif
switch (dm->devices[i].port_type)
{
case VNET_DPDK_PORT_TYPE_ETH_1G:
@@ -463,7 +460,6 @@ u8 * format_dpdk_device (u8 * s, va_list * args)
format_white_space, indent + 2, xd->cpu_socket);
/* $$$ MIB counters */
-
{
#define _(N, V) \
if ((xd->stats.V - xd->last_cleared_stats.V) != 0) { \
@@ -479,21 +475,33 @@ u8 * format_dpdk_device (u8 * s, va_list * args)
u8 * xs = 0;
u32 i = 0;
+#if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 0)
+ struct rte_eth_xstats * xstat, * last_xstat;
+#else
+ struct rte_eth_xstat * xstat, * last_xstat;
+ struct rte_eth_xstat_name * xstat_names = 0;
+ int len = rte_eth_xstats_get_names (xd->device_index, NULL, 0);
+ vec_validate (xstat_names, len - 1);
+ rte_eth_xstats_get_names (xd->device_index, xstat_names, len);
+#endif
ASSERT(vec_len(xd->xstats) == vec_len(xd->last_cleared_xstats));
vec_foreach_index(i, xd->xstats)
{
u64 delta = 0;
- struct rte_eth_xstats* xstat = vec_elt_at_index(xd->xstats, i);
- struct rte_eth_xstats* last_xstat =
- vec_elt_at_index(xd->last_cleared_xstats, i);
+ xstat = vec_elt_at_index(xd->xstats, i);
+ last_xstat = vec_elt_at_index(xd->last_cleared_xstats, i);
delta = xstat->value - last_xstat->value;
if (verbose == 2 || (verbose && delta))
{
/* format_c_identifier doesn't like c strings inside vector */
+#if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 0)
u8 * name = format(0,"%s", xstat->name);
+#else
+ u8 * name = format(0,"%s", xstat_names[i].name);
+#endif
xs = format(xs, "\n%U%-38U%16Ld",
format_white_space, indent + 4,
format_c_identifier, name, delta);
@@ -501,6 +509,11 @@ u8 * format_dpdk_device (u8 * s, va_list * args)
}
}
+#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0)
+ vec_free (xstat_names);
+#endif
+
+#if DPDK_VHOST_USER
if (verbose && xd->dev_type == VNET_DPDK_DEV_VHOST_USER) {
int i;
for (i = 0; i < xd->rx_q_used * VIRTIO_QNUM; i++) {
@@ -528,6 +541,7 @@ u8 * format_dpdk_device (u8 * s, va_list * args)
}
}
}
+#endif
if (xs)
{
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 178ff31b..816b20b3 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -1539,7 +1539,9 @@ dpdk_process (vlib_main_t * vm,
ethernet_main_t * em = &ethernet_main;
dpdk_device_t * xd;
vlib_thread_main_t * tm = vlib_get_thread_main();
+#if DPDK_VHOST_USER
void *vu_state;
+#endif
int i;
error = dpdk_lib_init (dm);
@@ -1564,7 +1566,9 @@ dpdk_process (vlib_main_t * vm,
if (error)
clib_error_report (error);
+#if DPDK_VHOST_USER
dpdk_vhost_user_process_init(&vu_state);
+#endif
tm->worker_thread_release = 1;
@@ -1654,13 +1658,17 @@ dpdk_process (vlib_main_t * vm,
if ((now - xd->time_last_link_update) >= dm->link_state_poll_interval)
dpdk_update_link_state (xd, now);
+#if DPDK_VHOST_USER
if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
if (dpdk_vhost_user_process_if(vm, xd, vu_state) != 0)
continue;
+#endif
}
}
+#if DPDK_VHOST_USER
dpdk_vhost_user_process_cleanup(vu_state);
+#endif
return 0;
}
diff --git a/vnet/vnet/devices/dpdk/vhost_user.c b/vnet/vnet/devices/dpdk/vhost_user.c
index 2d9462f0..212313a7 100644
--- a/vnet/vnet/devices/dpdk/vhost_user.c
+++ b/vnet/vnet/devices/dpdk/vhost_user.c
@@ -39,6 +39,8 @@
#define DBG_SOCK(args...)
#endif
+#if DPDK_VHOST_USER
+
static const char *vhost_message_str[] __attribute__((unused)) = {
[VHOST_USER_NONE] = "VHOST_USER_NONE",
[VHOST_USER_GET_FEATURES] = "VHOST_USER_GET_FEATURES",
@@ -1917,3 +1919,4 @@ VLIB_CLI_COMMAND (show_vhost_user_command, static) = {
.short_help = "show vhost-user interface",
.function = show_dpdk_vhost_user_command_fn,
};
+#endif