aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/format.c
diff options
context:
space:
mode:
authorRui Cai <rucai@microsoft.com>2018-05-11 22:55:33 +0000
committerDamjan Marion <dmarion@me.com>2018-05-31 22:01:15 +0000
commita059a000f81a7251ffed2821f69dd96cfd94c8c7 (patch)
treed3674736007fbd45b61dc79de030ce5c53cf49a1 /src/plugins/dpdk/device/format.c
parentcb91e603bc82083fc762206edfe4530f993a6c36 (diff)
dpdk: Decoupling the meaning of xd->device_index in dpdk_plugin
Prior to the change, dpdk plugin assumes xd->device_index is used both as index for internal dpdk_main->devices array and DPDK port index to call into DPDK APIs. However, when running on top of Failsafe PMDs, DPDK port index range may no longer be contiguous (as noted: http://dpdk.org/ml/archives/dev/2018-March/092375.html for related changes in DPDK). Because this, dpdk plugin can no longer iterate through all available DPDK ports with a for 0->rte_eth_dev_count() loop and the assumption of device_index no longer holds. This is part of initial effort to enable vpp running over dpdk on failsafe PMD in Microsoft Azure(3/4). Change-Id: I416fd80f2d40e12e139f8f3492814da98343eae7 Signed-off-by: Rui Cai <rucai@microsoft.com>
Diffstat (limited to 'src/plugins/dpdk/device/format.c')
-rw-r--r--src/plugins/dpdk/device/format.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 22f37c4c63e..f10b00e27a6 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -253,7 +253,7 @@ format_dpdk_device_name (u8 * s, va_list * args)
dev_info.pci_dev->addr.devid,
dev_info.pci_dev->addr.function);
else
- ret = format (s, "%s%d", device_name, dm->devices[i].device_index);
+ ret = format (s, "%s%d", device_name, dm->devices[i].port_id);
if (dm->devices[i].interface_name_suffix)
return format (ret, "/%s", dm->devices[i].interface_name_suffix);
@@ -396,7 +396,7 @@ format_dpdk_link_status (u8 * s, va_list * args)
s = format (s, "%s ", l->link_status ? "up" : "down");
if (l->link_status)
{
- u32 promisc = rte_eth_promiscuous_get (xd->device_index);
+ u32 promisc = rte_eth_promiscuous_get (xd->port_id);
s = format (s, "%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
"full" : "half");
@@ -489,12 +489,12 @@ format_dpdk_device (u8 * s, va_list * args)
dpdk_update_link_state (xd, now);
s = format (s, "%U\n%Ucarrier %U",
- format_dpdk_device_type, xd->device_index,
+ format_dpdk_device_type, xd->port_id,
format_white_space, indent + 2, format_dpdk_link_status, xd);
s = format (s, "%Uflags: %U\n",
format_white_space, indent + 2, format_dpdk_device_flags, xd);
- rte_eth_dev_info_get (xd->device_index, &di);
+ rte_eth_dev_info_get (xd->port_id, &di);
if (verbose > 1 && xd->flags & DPDK_DEVICE_FLAG_PMD)
{
@@ -504,7 +504,7 @@ format_dpdk_device (u8 * s, va_list * args)
int retval;
rss_conf.rss_key = 0;
- retval = rte_eth_dev_rss_hash_conf_get (xd->device_index, &rss_conf);
+ 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 = di.pci_dev;
@@ -528,9 +528,10 @@ format_dpdk_device (u8 * s, va_list * args)
s =
format (s, "%Upromiscuous: unicast %s all-multicast %s\n",
format_white_space, indent + 2,
- rte_eth_promiscuous_get (xd->device_index) ? "on" : "off",
- rte_eth_allmulticast_get (xd->device_index) ? "on" : "off");
- vlan_off = rte_eth_dev_get_vlan_offload (xd->device_index);
+ 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",
@@ -576,9 +577,9 @@ format_dpdk_device (u8 * s, va_list * args)
u32 i = 0;
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);
+ int len = rte_eth_xstats_get_names (xd->port_id, NULL, 0);
vec_validate (xstat_names, len - 1);
- rte_eth_xstats_get_names (xd->device_index, xstat_names, len);
+ rte_eth_xstats_get_names (xd->port_id, xstat_names, len);
ASSERT (vec_len (xd->xstats) == vec_len (xd->last_cleared_xstats));