On 11/15/2018 6:35 PM, Kevin Traynor wrote:
Thanks for this Kevin, I've tested with multiple devices (i40e, ixgbe,
igb and all associated VFs). Didn't come across any issues with adding
removing or with hotplugging. LGTM unless there are objections?
Ian
rte_eth_dev_attach/detach have been removed from
DPDK 18.11. Replace them with rte_dev_probe/remove.
Signed-off-by: Kevin Traynor <[email protected]>
---
lib/netdev-dpdk.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c586144f5..af310b06b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1352,5 +1352,5 @@ netdev_dpdk_destruct(struct netdev *netdev)
{
struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
- char devname[RTE_ETH_NAME_MAX_LEN];
+ struct rte_eth_dev_info dev_info;
ovs_mutex_lock(&dpdk_mutex);
@@ -1361,8 +1361,9 @@ netdev_dpdk_destruct(struct netdev *netdev)
if (dev->attached) {
rte_eth_dev_close(dev->port_id);
- if (rte_eth_dev_detach(dev->port_id, devname) < 0) {
+ rte_eth_dev_info_get(dev->port_id, &dev_info);
+ if (dev_info.device && !rte_dev_remove(dev_info.device)) {
+ VLOG_INFO("Device '%s' has been detached", dev->devargs);
+ } else {
VLOG_ERR("Device '%s' can not be detached", dev->devargs);
- } else {
- VLOG_INFO("Device '%s' has been detached", devname);
}
}
@@ -1654,5 +1655,6 @@ netdev_dpdk_process_devargs(struct netdev_dpdk *dev,
|| !rte_eth_dev_is_valid_port(new_port_id)) {
/* Device not found in DPDK, attempt to attach it */
- if (!rte_eth_dev_attach(devargs, &new_port_id)) {
+ if (!rte_dev_probe(devargs)
+ && !rte_eth_dev_get_port_by_name(name, &new_port_id)) {
/* Attach successful */
dev->attached = true;
@@ -3210,9 +3212,8 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc
OVS_UNUSED,
const char *argv[], void *aux OVS_UNUSED)
{
- int ret;
char *response;
dpdk_port_t port_id;
- char devname[RTE_ETH_NAME_MAX_LEN];
struct netdev_dpdk *dev;
+ struct rte_eth_dev_info dev_info;
ovs_mutex_lock(&dpdk_mutex);
@@ -3233,6 +3234,6 @@ netdev_dpdk_detach(struct unixctl_conn *conn, int argc
OVS_UNUSED,
rte_eth_dev_close(port_id);
- ret = rte_eth_dev_detach(port_id, devname);
- if (ret < 0) {
+ rte_eth_dev_info_get(port_id, &dev_info);
+ if (!dev_info.device || rte_dev_remove(dev_info.device)) {
response = xasprintf("Device '%s' can not be detached", argv[1]);
goto error;
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev