[dpdk-dev] [PATCH] librte_ether: use RTE_ETH_VALID_PORTID_OR_ERR_RET to check port_id

Thomas Monjalon thomas.monjalon at 6wind.com
Wed May 18 17:01:19 CEST 2016


2016-05-18 16:41, Mauricio Vásquez:
> On Wed, May 18, 2016 at 10:15 AM, Thomas Monjalon <thomas.monjalon at 6wind.com
> > wrote:
> 
> > 2016-05-17 22:02, Mauricio Vásquez:
> > > On Fri, May 13, 2016 at 6:20 PM, Thomas Monjalon <
> > thomas.monjalon at 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?
I feel ENODEV would be better but it is an API change, so we should discuss
it later for another patch.



More information about the dev mailing list