summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/dpdk_priv.h
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/dpdk_priv.h
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/dpdk_priv.h')
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index cbc116e8dc2..c73f57edfe0 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -65,14 +65,13 @@ dpdk_get_xstats (dpdk_device_t * xd)
if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP))
return;
int len;
- if ((len = rte_eth_xstats_get (xd->device_index, NULL, 0)) > 0)
+ if ((len = rte_eth_xstats_get (xd->port_id, NULL, 0)) > 0)
{
vec_validate (xd->xstats, len - 1);
vec_validate (xd->last_cleared_xstats, len - 1);
len =
- rte_eth_xstats_get (xd->device_index, xd->xstats,
- vec_len (xd->xstats));
+ rte_eth_xstats_get (xd->port_id, xd->xstats, vec_len (xd->xstats));
ASSERT (vec_len (xd->xstats) == len);
ASSERT (vec_len (xd->last_cleared_xstats) == len);
@@ -98,7 +97,7 @@ dpdk_update_counters (dpdk_device_t * xd, f64 now)
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);
+ rte_eth_stats_get (xd->port_id, &xd->stats);
/* maybe bump interface rx no buffer counter */
if (PREDICT_FALSE (xd->stats.rx_nombuf != xd->last_stats.rx_nombuf))