aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/device.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/device.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/device.c')
-rw-r--r--src/plugins/dpdk/device/device.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index fe659fbeaf1..d5ab2585c93 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -51,7 +51,7 @@ dpdk_set_mac_address (vnet_hw_interface_t * hi, char *address)
dpdk_main_t *dm = &dpdk_main;
dpdk_device_t *xd = vec_elt_at_index (dm->devices, hi->dev_instance);
- error = rte_eth_dev_default_mac_addr_set (xd->device_index,
+ error = rte_eth_dev_default_mac_addr_set (xd->port_id,
(struct ether_addr *) address);
if (error)
@@ -226,7 +226,7 @@ static_always_inline
else if (PREDICT_TRUE (xd->flags & DPDK_DEVICE_FLAG_PMD))
{
/* no wrap, transmit in one burst */
- n_sent = rte_eth_tx_burst (xd->device_index, queue_id, mb, n_left);
+ n_sent = rte_eth_tx_burst (xd->port_id, queue_id, mb, n_left);
}
else
{
@@ -248,8 +248,8 @@ static_always_inline
xd->hw_if_index)->tx_node_index;
vlib_error_count (vm, node_index, DPDK_TX_FUNC_ERROR_BAD_RETVAL, 1);
- clib_warning ("rte_eth_tx_burst[%d]: error %d", xd->device_index,
- n_sent);
+ clib_warning ("rte_eth_tx_burst[%d]: error %d",
+ xd->port_id, n_sent);
return n_left; // untransmitted packets
}
n_left -= n_sent;
@@ -629,25 +629,25 @@ dpdk_subif_add_del_function (vnet_main_t * vnm,
goto done;
}
- vlan_offload = rte_eth_dev_get_vlan_offload (xd->device_index);
+ vlan_offload = rte_eth_dev_get_vlan_offload (xd->port_id);
vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
- if ((r = rte_eth_dev_set_vlan_offload (xd->device_index, vlan_offload)))
+ if ((r = rte_eth_dev_set_vlan_offload (xd->port_id, vlan_offload)))
{
xd->num_subifs = prev_subifs;
err = clib_error_return (0, "rte_eth_dev_set_vlan_offload[%d]: err %d",
- xd->device_index, r);
+ xd->port_id, r);
goto done;
}
if ((r =
- rte_eth_dev_vlan_filter (xd->device_index, t->sub.eth.outer_vlan_id,
- is_add)))
+ rte_eth_dev_vlan_filter (xd->port_id,
+ t->sub.eth.outer_vlan_id, is_add)))
{
xd->num_subifs = prev_subifs;
err = clib_error_return (0, "rte_eth_dev_vlan_filter[%d]: err %d",
- xd->device_index, r);
+ xd->port_id, r);
goto done;
}