diff options
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r-- | src/plugins/dpdk/device/cli.c | 9 | ||||
-rw-r--r-- | src/plugins/dpdk/device/device.c | 17 | ||||
-rw-r--r-- | src/plugins/dpdk/device/dpdk.h | 1 | ||||
-rw-r--r-- | src/plugins/dpdk/device/dpdk_priv.h | 4 | ||||
-rw-r--r-- | src/plugins/dpdk/device/format.c | 186 | ||||
-rw-r--r-- | src/plugins/dpdk/device/init.c | 6 |
6 files changed, 91 insertions, 132 deletions
diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c index 2487fc12252..bb6c6a9e396 100644 --- a/src/plugins/dpdk/device/cli.c +++ b/src/plugins/dpdk/device/cli.c @@ -302,15 +302,6 @@ set_dpdk_if_desc (vlib_main_t * vm, unformat_input_t * input, hw = vnet_get_hw_interface (vnm, hw_if_index); xd = vec_elt_at_index (dm->devices, hw->dev_instance); - if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0) - { - error = - clib_error_return (0, - "number of descriptors can be set only for " - "physical devices"); - goto done; - } - if ((nb_rx_desc == (u32) ~ 0 || nb_rx_desc == xd->nb_rx_desc) && (nb_tx_desc == (u32) ~ 0 || nb_tx_desc == xd->nb_tx_desc)) { diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c index 336167b86f8..187f531dcaa 100644 --- a/src/plugins/dpdk/device/device.c +++ b/src/plugins/dpdk/device/device.c @@ -171,17 +171,9 @@ static_always_inline { clib_spinlock_lock_if_init (&txq->lock); - if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD)) - { - /* no wrap, transmit in one burst */ - n_sent = rte_eth_tx_burst (xd->port_id, queue_id, mb, n_left); - n_retry--; - } - else - { - ASSERT (0); - n_sent = 0; - } + /* no wrap, transmit in one burst */ + n_sent = rte_eth_tx_burst (xd->port_id, queue_id, mb, n_left); + n_retry--; clib_spinlock_unlock_if_init (&txq->lock); @@ -552,9 +544,6 @@ dpdk_subif_add_del_function (vnet_main_t * vnm, else if (xd->num_subifs) xd->num_subifs--; - if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0) - goto done; - /* currently we program VLANS only for IXGBE VF */ if (xd->pmd != VNET_DPDK_PMD_IXGBEVF) goto done; diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 362c74bd5d3..d920149b17d 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -117,7 +117,6 @@ typedef uint16_t dpdk_portid_t; #define foreach_dpdk_device_flags \ _ (0, ADMIN_UP, "admin-up") \ _ (1, PROMISC, "promisc") \ - _ (2, PMD, "pmd") \ _ (3, PMD_INIT_FAIL, "pmd-init-fail") \ _ (4, MAYBE_MULTISEG, "maybe-multiseg") \ _ (5, HAVE_SUBIF, "subif") \ diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h index 267c0b55aa3..d88a8459c9f 100644 --- a/src/plugins/dpdk/device/dpdk_priv.h +++ b/src/plugins/dpdk/device/dpdk_priv.h @@ -97,10 +97,6 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now) vnet_main_t *vnm = vnet_get_main (); u32 thread_index = vlib_get_thread_index (); - /* only update counters for PMD interfaces */ - if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0) - return; - xd->time_last_stats_update = now ? now : xd->time_last_stats_update; clib_memcpy_fast (&xd->last_stats, &xd->stats, sizeof (xd->last_stats)); rte_eth_stats_get (xd->port_id, &xd->stats); diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c index 430ab392594..57f4390f706 100644 --- a/src/plugins/dpdk/device/format.c +++ b/src/plugins/dpdk/device/format.c @@ -561,6 +561,10 @@ format_dpdk_device (u8 * s, va_list * args) f64 now = vlib_time_now (vm); struct rte_eth_dev_info di; struct rte_eth_burst_mode mode; + struct rte_pci_device *pci; + struct rte_eth_rss_conf rss_conf; + int vlan_off; + int retval; dpdk_update_counters (xd, now); dpdk_update_link_state (xd, now); @@ -585,110 +589,96 @@ format_dpdk_device (u8 * s, va_list * args) xd->nb_tx_desc, di.tx_desc_lim.nb_min, di.tx_desc_lim.nb_max, di.tx_desc_lim.nb_align); - if (xd->flags & DPDK_DEVICE_FLAG_PMD) - { - struct rte_pci_device *pci; - struct rte_eth_rss_conf rss_conf; - int vlan_off; - int retval; - - rss_conf.rss_key = 0; - rss_conf.rss_hf = 0; - retval = rte_eth_dev_rss_hash_conf_get (xd->port_id, &rss_conf); - if (retval < 0) - clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval); + rss_conf.rss_key = 0; + rss_conf.rss_hf = 0; + retval = rte_eth_dev_rss_hash_conf_get (xd->port_id, &rss_conf); + if (retval < 0) + clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval); - pci = dpdk_get_pci_device (&di); + pci = dpdk_get_pci_device (&di); - if (pci) - { - u8 *s2; - if (xd->cpu_socket > -1) - s2 = format (0, "%d", xd->cpu_socket); - else - s2 = format (0, "unknown"); - s = format (s, "%Upci: device %04x:%04x subsystem %04x:%04x " - "address %04x:%02x:%02x.%02x numa %v\n", - format_white_space, indent + 2, pci->id.vendor_id, - pci->id.device_id, pci->id.subsystem_vendor_id, - pci->id.subsystem_device_id, pci->addr.domain, - pci->addr.bus, pci->addr.devid, pci->addr.function, s2); - vec_free (s2); - } + if (pci) + { + u8 *s2; + if (xd->cpu_socket > -1) + s2 = format (0, "%d", xd->cpu_socket); + else + s2 = format (0, "unknown"); + s = format (s, + "%Upci: device %04x:%04x subsystem %04x:%04x " + "address %04x:%02x:%02x.%02x numa %v\n", + format_white_space, indent + 2, pci->id.vendor_id, + pci->id.device_id, pci->id.subsystem_vendor_id, + pci->id.subsystem_device_id, pci->addr.domain, pci->addr.bus, + pci->addr.devid, pci->addr.function, s2); + vec_free (s2); + } - if (di.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) - { - s = - format (s, "%Uswitch info: %U\n", format_white_space, indent + 2, - format_switch_info, &di.switch_info); - } + if (di.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) + { + s = format (s, "%Uswitch info: %U\n", format_white_space, indent + 2, + format_switch_info, &di.switch_info); + } - if (1 < verbose) - { - s = format (s, "%Umodule: %U\n", format_white_space, indent + 2, - format_dpdk_device_module_info, xd); - } + if (1 < verbose) + { + s = format (s, "%Umodule: %U\n", format_white_space, indent + 2, + format_dpdk_device_module_info, xd); + } - s = format (s, "%Umax rx packet len: %d\n", format_white_space, - indent + 2, di.max_rx_pktlen); - s = format (s, "%Upromiscuous: unicast %s all-multicast %s\n", - format_white_space, indent + 2, - rte_eth_promiscuous_get (xd->port_id) ? "on" : "off", - rte_eth_allmulticast_get (xd->port_id) ? "on" : "off"); - vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id); - s = format (s, "%Uvlan offload: strip %s filter %s qinq %s\n", - format_white_space, indent + 2, - vlan_off & ETH_VLAN_STRIP_OFFLOAD ? "on" : "off", - vlan_off & ETH_VLAN_FILTER_OFFLOAD ? "on" : "off", - vlan_off & ETH_VLAN_EXTEND_OFFLOAD ? "on" : "off"); - s = format (s, "%Urx offload avail: %U\n", - format_white_space, indent + 2, - format_dpdk_rx_offload_caps, di.rx_offload_capa); - s = format (s, "%Urx offload active: %U\n", - format_white_space, indent + 2, - format_dpdk_rx_offload_caps, xd->port_conf.rxmode.offloads); - s = format (s, "%Utx offload avail: %U\n", - format_white_space, indent + 2, - format_dpdk_tx_offload_caps, di.tx_offload_capa); - s = format (s, "%Utx offload active: %U\n", - format_white_space, indent + 2, - format_dpdk_tx_offload_caps, xd->port_conf.txmode.offloads); - s = format (s, "%Urss avail: %U\n" - "%Urss active: %U\n", - format_white_space, indent + 2, - format_dpdk_rss_hf_name, di.flow_type_rss_offloads, - format_white_space, indent + 2, - format_dpdk_rss_hf_name, rss_conf.rss_hf); - - if (rte_eth_tx_burst_mode_get (xd->port_id, 0, &mode) == 0) - { - s = format (s, "%Utx burst mode: %s%s\n", - format_white_space, indent + 2, - mode.info, - mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ? - " (per queue)" : ""); - } - else - { - s = format (s, "%Utx burst function: %s\n", - format_white_space, indent + 2, - ptr2sname (rte_eth_devices[xd->port_id].tx_pkt_burst)); - } + s = format (s, "%Umax rx packet len: %d\n", format_white_space, indent + 2, + di.max_rx_pktlen); + s = format (s, "%Upromiscuous: unicast %s all-multicast %s\n", + format_white_space, indent + 2, + rte_eth_promiscuous_get (xd->port_id) ? "on" : "off", + rte_eth_allmulticast_get (xd->port_id) ? "on" : "off"); + vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id); + s = format (s, "%Uvlan offload: strip %s filter %s qinq %s\n", + format_white_space, indent + 2, + vlan_off & ETH_VLAN_STRIP_OFFLOAD ? "on" : "off", + vlan_off & ETH_VLAN_FILTER_OFFLOAD ? "on" : "off", + vlan_off & ETH_VLAN_EXTEND_OFFLOAD ? "on" : "off"); + s = format (s, "%Urx offload avail: %U\n", format_white_space, indent + 2, + format_dpdk_rx_offload_caps, di.rx_offload_capa); + s = format (s, "%Urx offload active: %U\n", format_white_space, indent + 2, + format_dpdk_rx_offload_caps, xd->port_conf.rxmode.offloads); + s = format (s, "%Utx offload avail: %U\n", format_white_space, indent + 2, + format_dpdk_tx_offload_caps, di.tx_offload_capa); + s = format (s, "%Utx offload active: %U\n", format_white_space, indent + 2, + format_dpdk_tx_offload_caps, xd->port_conf.txmode.offloads); + s = format (s, + "%Urss avail: %U\n" + "%Urss active: %U\n", + format_white_space, indent + 2, format_dpdk_rss_hf_name, + di.flow_type_rss_offloads, format_white_space, indent + 2, + format_dpdk_rss_hf_name, rss_conf.rss_hf); + + if (rte_eth_tx_burst_mode_get (xd->port_id, 0, &mode) == 0) + { + s = format (s, "%Utx burst mode: %s%s\n", format_white_space, indent + 2, + mode.info, + mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ? " (per queue)" : + ""); + } + else + { + s = + format (s, "%Utx burst function: %s\n", format_white_space, indent + 2, + ptr2sname (rte_eth_devices[xd->port_id].tx_pkt_burst)); + } - if (rte_eth_rx_burst_mode_get (xd->port_id, 0, &mode) == 0) - { - s = format (s, "%Urx burst mode: %s%s\n", - format_white_space, indent + 2, - mode.info, - mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ? - " (per queue)" : ""); - } - else - { - s = format (s, "%Urx burst function: %s\n", - format_white_space, indent + 2, - ptr2sname (rte_eth_devices[xd->port_id].rx_pkt_burst)); - } + if (rte_eth_rx_burst_mode_get (xd->port_id, 0, &mode) == 0) + { + s = format (s, "%Urx burst mode: %s%s\n", format_white_space, indent + 2, + mode.info, + mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ? " (per queue)" : + ""); + } + else + { + s = + format (s, "%Urx burst function: %s\n", format_white_space, indent + 2, + ptr2sname (rte_eth_devices[xd->port_id].rx_pkt_burst)); } /* $$$ MIB counters */ diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 06fb55e1734..f5eb8623bd8 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -440,8 +440,6 @@ dpdk_lib_init (dpdk_main_t * dm) vec_validate_aligned (xd->rx_queues, xd->rx_q_used - 1, CLIB_CACHE_LINE_BYTES); - xd->flags |= DPDK_DEVICE_FLAG_PMD; - /* workaround for drivers not setting driver_name */ if ((!dev_info.driver_name) && (pci_dev)) dev_info.driver_name = pci_dev->driver->driver.name; @@ -1711,10 +1709,6 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) u32 hw_flags = 0; u8 hw_flags_chg = 0; - /* only update link state for PMD interfaces */ - if ((xd->flags & DPDK_DEVICE_FLAG_PMD) == 0) - return; - xd->time_last_link_update = now ? now : xd->time_last_link_update; clib_memset (&xd->link, 0, sizeof (xd->link)); rte_eth_link_get_nowait (xd->port_id, &xd->link); |