From: Stephen Hemminger <stephen@networkplumber.org>
To: "Július Milan" <jmilan.dev@gmail.com>
Cc: dev@dpdk.org, xiaolong.ye@intel.com, qi.z.zhang@intel.com,
david.marchand@redhat.com
Subject: Re: [dpdk-dev] [PATCH] net/af_xdp: fix xdp_get_channels_info return value
Date: Fri, 12 Jul 2019 08:09:16 -0700 [thread overview]
Message-ID: <20190712080916.23f835f4@hermes.lan> (raw)
In-Reply-To: <CAP=P++CjQQX3hWb0Nck8JaJuGcy_SHmsjN0g3+f1Ns9r9fDBjA@mail.gmail.com>
On Fri, 12 Jul 2019 09:40:37 +0200
Július Milan <jmilan.dev@gmail.com> wrote:
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index ff8e90589..33352e10a 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
> ifr.ifr_data = (void *)&channels;
> strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
> ret = ioctl(fd, SIOCETHTOOL, &ifr);
> - if (ret && errno != EOPNOTSUPP) {
> - ret = -errno;
> - goto out;
> + if (ret) {
> + if (errno == EOPNOTSUPP) {
> + ret = 0;
> + } else {
> + ret = -errno;
> + goto out;
> + }
> }
Why not do close first and avoid the goto?
With your code, max_queues and combined_queues would never get set.
ret = ioctl(fd, SIOCETHTOOL, &ifr);
close(fd);
if (ret < 0 && errno != EOPNOTSUPP)
return -errno;
if (errno == EOPNOTSUPP || channels.max_combined == 0) {
...
next prev parent reply other threads:[~2019-07-12 15:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 7:40 Július Milan
2019-07-12 15:09 ` Stephen Hemminger [this message]
2019-07-12 7:55 Július Milan
2019-07-12 15:10 ` Stephen Hemminger
2019-07-12 15:35 ` Ferruh Yigit
2019-07-12 15:48 ` Stephen Hemminger
2019-07-12 16:07 ` Ferruh Yigit
2019-07-12 15:43 ` Ye Xiaolong
2019-07-12 15:01 ` Ferruh Yigit
2019-07-12 15:21 ` Stephen Hemminger
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=20190712080916.23f835f4@hermes.lan \
--to=stephen@networkplumber.org \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jmilan.dev@gmail.com \
--cc=qi.z.zhang@intel.com \
--cc=xiaolong.ye@intel.com \
/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).