summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-08-22 22:34:38 +0200
committerDave Barach <openvpp@barachs.net>2016-08-23 00:18:49 +0000
commitb28e498a49aeb5386bb10695146f859032bd90ae (patch)
tree1c503990c6344fbb2d249844ddcd13464393a708
parent71e97c631a52fc7fbb8b18b37cbdbfbebedee853 (diff)
dpdk: Remove obsolete VMXNET3 driver start/stop workaround
Change-Id: I4f46f2965891b0bd0d69a2c426068b0fb1ba881e Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vnet/vnet/devices/dpdk/device.c74
-rw-r--r--vnet/vnet/devices/dpdk/dpdk.h5
-rw-r--r--vnet/vnet/devices/dpdk/dpdk_priv.h77
-rw-r--r--vnet/vnet/devices/dpdk/init.c24
-rw-r--r--vnet/vnet/devices/dpdk/node.c16
5 files changed, 68 insertions, 128 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index f00b80b6def..2ccfcdaa148 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -939,34 +939,15 @@ dpdk_clear_hw_interface_counters (u32 instance)
dpdk_device_t *xd = vec_elt_at_index (dm->devices, instance);
/*
- * DAW-FIXME: VMXNET3 device stop/start doesn't work,
- * therefore fake the stop in the dpdk driver by
- * silently dropping all of the incoming pkts instead of
- * stopping the driver / hardware.
+ * Set the "last_cleared_stats" to the current stats, so that
+ * things appear to clear from a display perspective.
*/
- if (xd->admin_up != 0xff)
- {
- /*
- * Set the "last_cleared_stats" to the current stats, so that
- * things appear to clear from a display perspective.
- */
- dpdk_update_counters (xd, vlib_time_now (dm->vlib_main));
+ dpdk_update_counters (xd, vlib_time_now (dm->vlib_main));
- clib_memcpy (&xd->last_cleared_stats, &xd->stats, sizeof (xd->stats));
- clib_memcpy (xd->last_cleared_xstats, xd->xstats,
- vec_len (xd->last_cleared_xstats) *
- sizeof (xd->last_cleared_xstats[0]));
- }
- else
- {
- /*
- * Internally rte_eth_xstats_reset() is calling rte_eth_stats_reset(),
- * so we're only calling xstats_reset() here.
- */
- rte_eth_xstats_reset (xd->device_index);
- memset (&xd->stats, 0, sizeof (xd->stats));
- memset (&xd->last_stats, 0, sizeof (xd->last_stats));
- }
+ clib_memcpy (&xd->last_cleared_stats, &xd->stats, sizeof (xd->stats));
+ clib_memcpy (xd->last_cleared_xstats, xd->xstats,
+ vec_len (xd->last_cleared_xstats) *
+ sizeof (xd->last_cleared_xstats[0]));
#if DPDK_VHOST_USER
if (PREDICT_FALSE (xd->dev_type == VNET_DPDK_DEV_VHOST_USER))
@@ -1069,12 +1050,12 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
else
{
hif->max_packet_bytes = 1500; /* kni interface default value */
- xd->admin_up = 1;
+ xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
}
}
else
{
- xd->admin_up = 0;
+ xd->flags &= ~DPDK_DEVICE_FLAG_ADMIN_UP;
int kni_rv;
kni_rv = rte_kni_release (xd->kni);
@@ -1093,12 +1074,12 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
vnet_hw_interface_set_flags (vnm, xd->vlib_hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP |
ETH_LINK_FULL_DUPLEX);
- xd->admin_up = 1;
+ xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
}
else
{
vnet_hw_interface_set_flags (vnm, xd->vlib_hw_if_index, 0);
- xd->admin_up = 0;
+ xd->flags &= ~DPDK_DEVICE_FLAG_ADMIN_UP;
}
return 0;
@@ -1110,49 +1091,26 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
f64 now = vlib_time_now (dm->vlib_main);
- /*
- * DAW-FIXME: VMXNET3 device stop/start doesn't work,
- * therefore fake the stop in the dpdk driver by
- * silently dropping all of the incoming pkts instead of
- * stopping the driver / hardware.
- */
- if (xd->admin_up == 0)
+ if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
rv = rte_eth_dev_start (xd->device_index);
- if (xd->promisc)
+ if (xd->flags & DPDK_DEVICE_FLAG_PROMISC)
rte_eth_promiscuous_enable (xd->device_index);
else
rte_eth_promiscuous_disable (xd->device_index);
rte_eth_allmulticast_enable (xd->device_index);
- xd->admin_up = 1;
+ xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
dpdk_update_counters (xd, now);
dpdk_update_link_state (xd, now);
}
else
{
- /*
- * DAW-FIXME: VMXNET3 device stop/start doesn't work,
- * therefore fake the stop in the dpdk driver by
- * silently dropping all of the incoming pkts instead of
- * stopping the driver / hardware.
- */
- if (xd->pmd != VNET_DPDK_PMD_VMXNET3)
- xd->admin_up = 0;
- else
- xd->admin_up = ~0;
+ xd->flags &= ~DPDK_DEVICE_FLAG_ADMIN_UP;
rte_eth_allmulticast_disable (xd->device_index);
vnet_hw_interface_set_flags (vnm, xd->vlib_hw_if_index, 0);
-
- /*
- * DAW-FIXME: VMXNET3 device stop/start doesn't work,
- * therefore fake the stop in the dpdk driver by
- * silently dropping all of the incoming pkts instead of
- * stopping the driver / hardware.
- */
- if (xd->pmd != VNET_DPDK_PMD_VMXNET3)
- rte_eth_dev_stop (xd->device_index);
+ rte_eth_dev_stop (xd->device_index);
/* For bonded interface, stop slave links */
if (xd->pmd == VNET_DPDK_PMD_BOND)
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h
index 90a50dafa43..e7c177b9329 100644
--- a/vnet/vnet/devices/dpdk/dpdk.h
+++ b/vnet/vnet/devices/dpdk/dpdk.h
@@ -218,8 +218,9 @@ typedef struct
dpdk_pmd_t pmd:8;
i8 cpu_socket;
- u8 admin_up;
- u8 promisc;
+ u16 flags;
+#define DPDK_DEVICE_FLAG_ADMIN_UP (1 << 0)
+#define DPDK_DEVICE_FLAG_PROMISC (1 << 1)
CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h
index 4ecb1b82502..0abe6306c89 100644
--- a/vnet/vnet/devices/dpdk/dpdk_priv.h
+++ b/vnet/vnet/devices/dpdk/dpdk_priv.h
@@ -91,50 +91,41 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
if (xd->dev_type != VNET_DPDK_DEV_ETH)
return;
- /*
- * DAW-FIXME: VMXNET3 device stop/start doesn't work,
- * therefore fake the stop in the dpdk driver by
- * silently dropping all of the incoming pkts instead of
- * stopping the driver / hardware.
- */
- if (xd->admin_up != 0xff)
+ xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
+ clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
+ rte_eth_stats_get (xd->device_index, &xd->stats);
+
+ /* maybe bump interface rx no buffer counter */
+ if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))
+ {
+ cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
+ VNET_INTERFACE_COUNTER_RX_NO_BUF);
+
+ vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
+ xd->stats.rx_nombuf -
+ xd->last_stats.rx_nombuf);
+ }
+
+ /* missed pkt counter */
+ if (PREDICT_FALSE (xd->stats.imissed != xd->last_stats.imissed))
{
- xd->time_last_stats_update = now ? now : xd->time_last_stats_update;
- clib_memcpy (&xd->last_stats, &xd->stats, sizeof (xd->last_stats));
- rte_eth_stats_get (xd->device_index, &xd->stats);
-
- /* maybe bump interface rx no buffer counter */
- if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))
- {
- cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
- VNET_INTERFACE_COUNTER_RX_NO_BUF);
-
- vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
- xd->stats.rx_nombuf -
- xd->last_stats.rx_nombuf);
- }
-
- /* missed pkt counter */
- if (PREDICT_FALSE (xd->stats.imissed != xd->last_stats.imissed))
- {
- cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
- VNET_INTERFACE_COUNTER_RX_MISS);
-
- vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
- xd->stats.imissed -
- xd->last_stats.imissed);
- }
- rxerrors = xd->stats.ierrors;
- last_rxerrors = xd->last_stats.ierrors;
-
- if (PREDICT_FALSE (rxerrors != last_rxerrors))
- {
- cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
- VNET_INTERFACE_COUNTER_RX_ERROR);
-
- vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
- rxerrors - last_rxerrors);
- }
+ cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
+ VNET_INTERFACE_COUNTER_RX_MISS);
+
+ vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
+ xd->stats.imissed -
+ xd->last_stats.imissed);
+ }
+ rxerrors = xd->stats.ierrors;
+ last_rxerrors = xd->last_stats.ierrors;
+
+ if (PREDICT_FALSE (rxerrors != last_rxerrors))
+ {
+ cm = vec_elt_at_index (vnm->interface_main.sw_if_counters,
+ VNET_INTERFACE_COUNTER_RX_ERROR);
+
+ vlib_increment_simple_counter (cm, my_cpu, xd->vlib_sw_if_index,
+ rxerrors - last_rxerrors);
}
dpdk_get_xstats (xd);
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 705c0371b97..afaaa85a221 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -71,7 +71,7 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
ASSERT (os_get_cpu_number () == 0);
- if (xd->admin_up)
+ if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
vnet_hw_interface_set_flags (dm->vnet_main, xd->vlib_hw_if_index, 0);
rte_eth_dev_stop (xd->device_index);
@@ -123,7 +123,7 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
xd->device_index, rv);
}
- if (xd->admin_up)
+ if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
int rv;
rv = rte_eth_dev_start (xd->device_index);
@@ -143,12 +143,16 @@ dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
if (ETHERNET_INTERFACE_FLAG_CONFIG_PROMISC (flags))
{
- old = xd->promisc;
- xd->promisc = flags & ETHERNET_INTERFACE_FLAG_ACCEPT_ALL;
+ old = (xd->flags & DPDK_DEVICE_FLAG_PROMISC) != 0;
- if (xd->admin_up)
+ if (flags & ETHERNET_INTERFACE_FLAG_ACCEPT_ALL)
+ xd->flags |= DPDK_DEVICE_FLAG_PROMISC;
+ else
+ xd->flags &= ~DPDK_DEVICE_FLAG_PROMISC;
+
+ if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
- if (xd->promisc)
+ if (xd->flags & DPDK_DEVICE_FLAG_PROMISC)
rte_eth_promiscuous_enable (xd->device_index);
else
rte_eth_promiscuous_disable (xd->device_index);
@@ -181,7 +185,7 @@ dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
xd->port_conf.rxmode.max_rx_pkt_len = hi->max_packet_bytes;
- if (xd->admin_up)
+ if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
rte_eth_dev_stop (xd->device_index);
rv = rte_eth_dev_configure
@@ -194,7 +198,7 @@ dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
rte_eth_dev_set_mtu (xd->device_index, hi->max_packet_bytes);
- if (xd->admin_up)
+ if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
int rv = rte_eth_dev_start (xd->device_index);
if (rv < 0)
@@ -1479,13 +1483,13 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
} *ed;
ed = ELOG_DATA (&vm->elog_main, e);
ed->sw_if_index = xd->vlib_sw_if_index;
- ed->admin_up = xd->admin_up;
+ ed->admin_up = (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) != 0;
ed->old_link_state = (u8)
vnet_hw_interface_is_link_up (vnm, xd->vlib_hw_if_index);
ed->new_link_state = (u8) xd->link.link_status;
}
- if ((xd->admin_up == 1) &&
+ if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) &&
((xd->link.link_status != 0) ^
vnet_hw_interface_is_link_up (vnm, xd->vlib_hw_if_index)))
{
diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c
index 303b44e489a..7b2914a800a 100644
--- a/vnet/vnet/devices/dpdk/node.c
+++ b/vnet/vnet/devices/dpdk/node.c
@@ -403,7 +403,7 @@ dpdk_device_input (dpdk_main_t * dm,
u8 efd_discard_burst = 0;
u32 buffer_flags_template;
- if (xd->admin_up == 0)
+ if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
return 0;
n_buffers = dpdk_rx_burst (dm, xd, queue_id);
@@ -427,20 +427,6 @@ dpdk_device_input (dpdk_main_t * dm,
fl = vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
- /*
- * DAW-FIXME: VMXNET3 device stop/start doesn't work,
- * therefore fake the stop in the dpdk driver by
- * silently dropping all of the incoming pkts instead of
- * stopping the driver / hardware.
- */
- if (PREDICT_FALSE (xd->admin_up != 1))
- {
- for (mb_index = 0; mb_index < n_buffers; mb_index++)
- rte_pktmbuf_free (xd->rx_vectors[queue_id][mb_index]);
-
- return 0;
- }
-
/* Check for congestion if EFD (Early-Fast-Discard) is enabled
* in any mode (e.g. dpdk, monitor, or drop_all)
*/