aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device/device.c')
-rw-r--r--src/plugins/dpdk/device/device.c49
1 files changed, 6 insertions, 43 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 51d6eacbeb4..6a0b1acf6c1 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -612,38 +612,16 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
uword is_up = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) != 0;
dpdk_main_t *dm = &dpdk_main;
dpdk_device_t *xd = vec_elt_at_index (dm->devices, hif->dev_instance);
- int rv = 0;
+
+ if (xd->flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
+ return clib_error_return (0, "Interface not initialized");
if (is_up)
{
f64 now = vlib_time_now (dm->vlib_main);
if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
- {
- rv = rte_eth_dev_start (xd->device_index);
- if (!rv && xd->default_mac_address)
- rv = rte_eth_dev_default_mac_addr_set (xd->device_index,
- (struct ether_addr *)
- xd->default_mac_address);
- }
-
- 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);
-
- if (xd->pmd == VNET_DPDK_PMD_BOND)
- {
- u8 slink[16];
- int nlink = rte_eth_bond_slaves_get (xd->device_index, slink, 16);
- while (nlink >= 1)
- {
- u8 dpdk_port = slink[--nlink];
- rte_eth_allmulticast_enable (dpdk_port);
- }
- }
+ dpdk_device_start (xd);
xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
dpdk_update_counters (xd, now);
@@ -652,27 +630,12 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
else
{
xd->flags &= ~DPDK_DEVICE_FLAG_ADMIN_UP;
-
- rte_eth_allmulticast_disable (xd->device_index);
vnet_hw_interface_set_flags (vnm, xd->hw_if_index, 0);
- rte_eth_dev_stop (xd->device_index);
- /* For bonded interface, stop slave links */
- if (xd->pmd == VNET_DPDK_PMD_BOND)
- {
- u8 slink[16];
- int nlink = rte_eth_bond_slaves_get (xd->device_index, slink, 16);
- while (nlink >= 1)
- {
- u8 dpdk_port = slink[--nlink];
- rte_eth_dev_stop (dpdk_port);
- }
- }
+ if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) != 0)
+ dpdk_device_stop (xd);
}
- if (rv < 0)
- clib_warning ("rte_eth_dev_%s error: %d", is_up ? "start" : "stop", rv);
-
return /* no error */ 0;
}