From: Jan Viktorin <viktorin@rehivetech.com>
To: David Marchand <david.marchand@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [dpdk-dev, 2/2] ethdev: move code to common place in hotplug
Date: Thu, 21 Jan 2016 16:38:36 +0100 [thread overview]
Message-ID: <20160121163836.0bcd405e@pcviktorin.fit.vutbr.cz> (raw)
In-Reply-To: <1453377431-25850-3-git-send-email-david.marchand@6wind.com>
On Thu, 21 Jan 2016 12:57:11 +0100
David Marchand <david.marchand@6wind.com> wrote:
> Move these error logs and checks on detach capabilities in a common place.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
>
> ---
> lib/librte_ether/rte_ethdev.c | 69 +++++++++++++++++++++++++------------------
> 1 file changed, 40 insertions(+), 29 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 951fb1c..9083783 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -514,7 +514,6 @@ rte_eth_dev_attach_pdev(struct rte_pci_addr *addr, uint8_t *port_id)
>
> return 0;
> [snip]
>
> @@ -612,14 +599,25 @@ int
> rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
> {
> struct rte_pci_addr addr;
> + int ret = -1;
>
> if ((devargs == NULL) || (port_id == NULL))
> - return -EINVAL;
> + goto err;
This change modifies the return value from -EINVAL to -1. I don't know
whether is this an issue but it looks suspicious.
>
> - if (eal_parse_pci_DomBDF(devargs, &addr) == 0)
> - return rte_eth_dev_attach_pdev(&addr, port_id);
> - else
> - return rte_eth_dev_attach_vdev(devargs, port_id);
> + if (eal_parse_pci_DomBDF(devargs, &addr) == 0) {
> + ret = rte_eth_dev_attach_pdev(&addr, port_id);
> + if (ret < 0)
> + goto err;
> + } else {
> + ret = rte_eth_dev_attach_vdev(devargs, port_id);
> + if (ret < 0)
> + goto err;
> + }
> +
> + return 0;
> +err:
> + RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
> + return ret;
> }
>
> /* detach the device, then store the name of the device */
> @@ -627,26 +625,39 @@ int
> rte_eth_dev_detach(uint8_t port_id, char *name)
> {
> struct rte_pci_addr addr;
> - int ret;
> + int ret = -1;
>
> if (name == NULL)
> - return -EINVAL;
> + goto err;
Same here...
> +
> + /* check whether the driver supports detach feature, or not */
> + if (rte_eth_dev_is_detachable(port_id))
> + goto err;
>
> [snip]
--
Jan Viktorin E-mail: Viktorin@RehiveTech.com
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
next prev parent reply other threads:[~2016-01-21 15:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-21 11:57 [dpdk-dev] [PATCH 0/2] minor cleanup in ethdev hotplug David Marchand
2016-01-21 11:57 ` [dpdk-dev] [PATCH 1/2] ethdev: remove useless null checks David Marchand
2016-01-21 19:02 ` [dpdk-dev] [dpdk-dev,1/2] " Jan Viktorin
2016-01-22 9:11 ` Thomas Monjalon
2016-01-21 11:57 ` [dpdk-dev] [PATCH 2/2] ethdev: move code to common place in hotplug David Marchand
2016-01-21 15:38 ` Jan Viktorin [this message]
2016-01-21 18:06 ` [dpdk-dev] [dpdk-dev, " David Marchand
2016-01-21 18:42 ` Thomas Monjalon
2016-01-22 7:15 ` David Marchand
2016-01-22 14:06 ` [dpdk-dev] [PATCH v2 0/2] minor cleanup in ethdev hotplug David Marchand
2016-01-22 14:06 ` [dpdk-dev] [PATCH v2 1/2] ethdev: remove useless null checks David Marchand
2016-01-26 15:50 ` Jan Viktorin
2016-01-27 9:40 ` David Marchand
2016-01-22 14:06 ` [dpdk-dev] [PATCH v2 2/2] ethdev: move code to common place in hotplug David Marchand
2016-01-26 15:48 ` Jan Viktorin
2016-01-27 15:10 ` [dpdk-dev] [PATCH v2 0/2] minor cleanup in ethdev hotplug Thomas Monjalon
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=20160121163836.0bcd405e@pcviktorin.fit.vutbr.cz \
--to=viktorin@rehivetech.com \
--cc=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).