From: "Mauricio Vásquez" <mauricio.vasquezbernal@studenti.polito.it>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] librte_ether: use RTE_ETH_VALID_PORTID_OR_ERR_RET to check port_id
Date: Wed, 18 May 2016 21:14:54 +0200 [thread overview]
Message-ID: <CAPwdgqiZ9evonw0AHByViEn4ETQs64_060t1PPBxjCbxiJkhmQ@mail.gmail.com> (raw)
In-Reply-To: <1725170.kb92joC1Ql@xps13>
On Wed, May 18, 2016 at 5:43 PM, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:
> 2016-05-18 17:25, Mauricio Vásquez:
> > On Wed, May 18, 2016 at 5:01 PM, Thomas Monjalon <
> thomas.monjalon@6wind.com>
> > wrote:
> >
> > > 2016-05-18 16:41, Mauricio Vásquez:
> > > > On Wed, May 18, 2016 at 10:15 AM, Thomas Monjalon <
> > > thomas.monjalon@6wind.com
> > > > > wrote:
> > > >
> > > > > 2016-05-17 22:02, Mauricio Vásquez:
> > > > > > On Fri, May 13, 2016 at 6:20 PM, Thomas Monjalon <
> > > > > thomas.monjalon@6wind.com>
> > > > > > wrote:
> > > > > > > 2016-04-29 17:23, Mauricio Vasquez B:
> > > > > > > > The RTE_ETH_VALID_PORTID_OR_ERR_RET macro is used in some
> places
> > > > > > > > to check if a port id is valid or not. This commit makes use
> of
> > > it in
> > > > > > > > some new parts of the code.
> > > > > > >
> > > > > > > There are other occurences:
> > > > > > > rte_eth_dev_socket_id
> > > > > > >
> > > > > > I missed it.
> > > > > >
> > > > > > > rte_eth_add_rx_callback
> > > > > > > rte_eth_add_tx_callback
> > > > > > > rte_eth_remove_rx_callback
> > > > > > > rte_eth_remove_tx_callback
> > > > > > >
> > > > > > The macro can not be used on those ones because they set the
> > > rte_errno
> > > > > > variable before returning.
> > > > >
> > > > > It may be a good idea to set rte_errno to EINVAL in these macros.
> > > > >
> > > > > Generally speaking, rte_errno is not used a lot currently.
> > > >
> > > >
> > > > I noticed that both EINVAL and ENODEV are used. I think that
> returning
> > > > ENODEV and setting rte_errno to EINVAL would be strange, what do you
> > > think
> > > > about always using ENODEV?
> > >
> > > Why EINVAL is used?
> > >
> > Why not using retval to set errno?
> > >
> >
> > If we do it, the macro could no be used in
> > rte_eth_dev_socket_id
> > rte_eth_dev_get_device_type
> > rte_eth_add_rx_callback
> > rte_eth_add_tx_callback
> > rte_eth_remove_rx_callback
> > rte_eth_remove_tx_callback
> > as they do not return an error number.
>
> So you should not set errno in the existing macro.
> But you can create a new macro RTE_ETH_VALID_PORTID_OR_ERRNO_RET
> for these functions.
>
> I realized that RTE_ETH_VALID_PORTID_OR_ERR_RET can be used also in
rte_eth_remove_rx_callback and rte_eth_remove_tx_callback.
Personally I think it is not worthy to create a macro just for the two
missing functions.
> > I feel ENODEV would be better but it is an API change, so we should
> discuss
> > > it later for another patch.
>
> It looks to be really needed to have an unique kind of error interface to
> clean all this mess.
>
next prev parent reply other threads:[~2016-05-18 19:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 15:23 Mauricio Vasquez B
2016-05-13 16:20 ` Thomas Monjalon
2016-05-17 20:02 ` Mauricio Vásquez
2016-05-18 8:15 ` Thomas Monjalon
2016-05-18 14:41 ` Mauricio Vásquez
2016-05-18 15:01 ` Thomas Monjalon
2016-05-18 15:25 ` Mauricio Vásquez
2016-05-18 15:43 ` Thomas Monjalon
2016-05-18 19:14 ` Mauricio Vásquez [this message]
2016-05-17 20:01 ` [dpdk-dev] [PATCH v2] " Mauricio Vasquez B
2016-05-18 19:15 ` [dpdk-dev] [PATCH v3] " Mauricio Vasquez B
2016-05-24 13:31 ` 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=CAPwdgqiZ9evonw0AHByViEn4ETQs64_060t1PPBxjCbxiJkhmQ@mail.gmail.com \
--to=mauricio.vasquezbernal@studenti.polito.it \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.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).