@@ -1351,5 +1351,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);
@@ -1360,8 +1360,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);
}
}
@@ -1653,5 +1654,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;
@@ -3203,9 +3205,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);
@@ -3226,6 +3227,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;
rte_eth_dev_attach/detach have been removed from DPDK 18.11. Replace them with rte_dev_probe/remove. Signed-off-by: Kevin Traynor <ktraynor@redhat.com> --- v2: use rte_eth_dev_get_port_by_name() and fix indents lib/netdev-dpdk.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)