From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] ethdev: rework value return by rte_eth_dev_is_detachable
Date: Thu, 29 Oct 2015 09:55:01 +0100 [thread overview]
Message-ID: <1446108903-14412-2-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1446108903-14412-1-git-send-email-david.marchand@6wind.com>
From: Maxime Leroy <maxime.leroy@6wind.com>
The rte_eth_dev_is_detachable return 0 when the device is detachable.
It not, it returns a negative value or 1.
This patch modifies this function to return 1 when the device is detachable
and 0 when is not.
Signed-off-by: Maxime Leroy <maxime.leroy@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_ether/rte_ethdev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index f593f6e..396667c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -507,7 +507,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)
if (!rte_eth_dev_is_valid_port(port_id)) {
PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
- return -EINVAL;
+ return 0;
}
if (rte_eth_devices[port_id].dev_type == RTE_ETH_DEV_PCI) {
@@ -518,12 +518,12 @@ rte_eth_dev_is_detachable(uint8_t port_id)
break;
case RTE_KDRV_VFIO:
default:
- return -ENOTSUP;
+ return 0;
}
}
drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
- return !(drv_flags & RTE_PCI_DRV_DETACHABLE);
+ return drv_flags & RTE_PCI_DRV_DETACHABLE;
}
/* attach the new physical device, then store port_id of the device */
@@ -571,7 +571,7 @@ rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr)
goto err;
/* check whether the driver supports detach feature, or not */
- if (rte_eth_dev_is_detachable(port_id))
+ if (!rte_eth_dev_is_detachable(port_id))
goto err;
/* get pci address by port id */
@@ -648,7 +648,7 @@ rte_eth_dev_detach_vdev(uint8_t port_id, char *vdevname)
goto err;
/* check whether the driver supports detach feature, or not */
- if (rte_eth_dev_is_detachable(port_id))
+ if (!rte_eth_dev_is_detachable(port_id))
goto err;
/* get device name by port id */
--
1.9.1
next prev parent reply other threads:[~2015-10-29 8:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 8:55 [dpdk-dev] [PATCH 0/3] export hotplug capability David Marchand
2015-10-29 8:55 ` David Marchand [this message]
2015-10-29 8:55 ` [dpdk-dev] [PATCH 2/3] ethdev: export rte_eth_dev_is_detachable function David Marchand
2015-10-29 8:55 ` [dpdk-dev] [PATCH 3/3] ethdev: prevent segfaults in rte_eth_dev_is_detachable David Marchand
2015-11-03 11:10 ` Thomas Monjalon
2015-11-03 11:19 ` David Marchand
2015-11-03 11:20 ` Thomas Monjalon
2015-11-03 11:34 ` [dpdk-dev] [PATCH v2 0/2] export hotplug capability David Marchand
2015-11-03 11:34 ` [dpdk-dev] [PATCH v2 1/2] ethdev: rework value return by rte_eth_dev_is_detachable David Marchand
2015-11-03 11:35 ` [dpdk-dev] [PATCH v2 2/2] ethdev: export rte_eth_dev_is_detachable function David Marchand
2015-11-03 13:50 ` Thomas Monjalon
2015-11-04 7:49 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446108903-14412-2-git-send-email-david.marchand@6wind.com \
--to=david.marchand@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).