All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Krzysztof Kanas <kkanas@marvell.com>
Cc: "27ee549a-d01b-21a5-4a0b-a7e5594b38c0@intel.com"
	<27ee549a-d01b-21a5-4a0b-a7e5594b38c0@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2] net/af_packet: add string error for system errors
Date: Thu, 11 Jul 2019 09:10:38 -0700	[thread overview]
Message-ID: <20190711091038.2ddbd432@hermes.lan> (raw)
In-Reply-To: <20190711095629.GA11907@kk-box-0>

On Thu, 11 Jul 2019 09:56:32 +0000
Krzysztof Kanas <kkanas@marvell.com> wrote:

> On 19-07-10 09:04, Stephen Hemminger wrote:
> > External Email
> > 
> > ----------------------------------------------------------------------
> > On Wed, 10 Jul 2019 16:46:30 +0200
> > <kkanas@marvell.com> wrote:
> >   
> > >  
> > > +#define PMD_LOG_ERRNO(level, fmt, args...) \
> > > +	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
> > > +		"%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno))
> > > +
> > >  static uint16_t
> > >  eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
> > >  {
> > > @@ -603,9 +609,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
> > >  		return -1;
> > >  	}
> > >  	if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) {
> > > -		PMD_LOG(ERR,
> > > -			"%s: ioctl failed (SIOCGIFINDEX)",
> > > -		        name);
> > > +		PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name);
> > >  		return -1;  
> > 
> > This is wrong.
> > The ioctl sets errno not rte_errno.  
> I was following the documentation on rte_strerror, which states:
> 
> For non-RTE-specific error codes, this function returns the value from 
> the libc strerror function

That document is correct, but the intended usage is to do rte_strerror(rte_errno)
and since rte_errno values correspond to errno values for system errors it would work.

In conclusion, your code will work but is a little confusing.

  reply	other threads:[~2019-07-11 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 14:46 [dpdk-dev] [PATCH v2] net/af_packet: add string error for system errors kkanas
2019-07-10 16:04 ` Stephen Hemminger
2019-07-11  9:56   ` [dpdk-dev] [EXT] " Krzysztof Kanas
2019-07-11 16:10     ` Stephen Hemminger [this message]
2019-07-12 10:01       ` [dpdk-dev] [PATCH v3] " kkanas
2019-07-15 14:06         ` Ferruh Yigit

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=20190711091038.2ddbd432@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=27ee549a-d01b-21a5-4a0b-a7e5594b38c0@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=kkanas@marvell.com \
    --cc=linville@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.