From: Thomas Monjalon <thomas@monjalon.net>
To: Asaf Penso <asafp@mellanox.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
Andrew Rybchenko <arybchenko@solarflare.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: deduplicate functions to get link infos
Date: Wed, 08 Apr 2020 14:49:20 +0200 [thread overview]
Message-ID: <3105481.44csPzL39Z@thomas> (raw)
In-Reply-To: <VI1PR05MB569306CF645CD60B9C5DA05DC0C00@VI1PR05MB5693.eurprd05.prod.outlook.com>
08/04/2020 07:21, Asaf Penso:
> From: Thomas Monjalon
> > +static int
> > +get_link_infos(uint16_t port_id, struct rte_eth_link *eth_link, int wait)
>
> I would recommend renaming to link_get_infos, to have the same naming
> convention as rte_eth_*link_get* and rte_eth_*link_get*_nowait
No strong opinion.
get_link_infos looks more natural english.
If others prefer to have a sort of consistency, fine.
> > +{
> > + struct rte_eth_dev *dev;
> > +
> > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> > + dev = &rte_eth_devices[port_id];
> > +
> > + if (dev->data->dev_conf.intr_conf.lsc &&
> > + dev->data->dev_started)
> > + rte_eth_linkstatus_get(dev, eth_link);
> > + else {
> > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops-
> > >link_update, -ENOTSUP);
> > + (*dev->dev_ops->link_update)(dev, wait);
> > + *eth_link = dev->data->dev_link;
> > + }
> > +
> > + return 0;
>
> Since it's a static function, I think it can return void,
No, it cannot return void because some errors may be returned
with the macros RTE_ETH_VALID_PORTID_OR_ERR_RET and
RTE_FUNC_PTR_OR_ERR_RET.
> and the calling functions can decide what to return,
> but it's a matter of taste.
>
> Do we want to check that the return value for eth_link
> is not NULL and return -1 in case it is?
eth_link must not be NULL. It is allocated by the caller.
next prev parent reply other threads:[~2020-04-08 12:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 9:33 [dpdk-dev] [RFC] ethdev: use special speed for virtual Ethernet devices Morten Brørup
2020-04-01 9:53 ` Thomas Monjalon
2020-04-01 10:03 ` Benoit Ganne (bganne)
2020-04-01 10:06 ` [dpdk-dev] [RFC] ethdev: use special speed for virtual Ethernetdevices Morten Brørup
2020-04-02 12:54 ` Ivan Dyukov
2020-04-02 13:50 ` Morten Brørup
2020-04-02 15:29 ` Stephen Hemminger
2020-04-02 20:41 ` Ivan Dyukov
2020-04-02 20:58 ` Thomas Monjalon
2020-04-03 8:05 ` Ivan Dyukov
2020-04-03 9:45 ` Morten Brørup
2020-04-03 11:01 ` Thomas Monjalon
2020-04-07 22:26 ` [dpdk-dev] [PATCH 0/2] ethdev link speed Thomas Monjalon
2020-04-07 22:26 ` [dpdk-dev] [PATCH 1/2] ethdev: deduplicate functions to get link infos Thomas Monjalon
2020-04-08 5:21 ` Asaf Penso
2020-04-08 12:49 ` Thomas Monjalon [this message]
2020-04-13 14:14 ` Andrew Rybchenko
2020-04-07 22:26 ` [dpdk-dev] [PATCH 2/2] ethdev: allow unknown link speed Thomas Monjalon
2020-04-08 5:39 ` Jerin Jacob
2020-04-10 10:53 ` Morten Brørup
2020-04-13 14:26 ` Andrew Rybchenko
2020-04-16 13:42 ` Ferruh Yigit
2020-04-26 11:44 ` Matan Azrad
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=3105481.44csPzL39Z@thomas \
--to=thomas@monjalon.net \
--cc=arybchenko@solarflare.com \
--cc=asafp@mellanox.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@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).