From: Ivan Boule <ivan.boule@6wind.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Stephen Hemminger <shemming@brocade.com>
Subject: Re: [dpdk-dev] [PATCH 2/6] Subjet: ethdev: add common code to atomicly access link
Date: Thu, 15 May 2014 10:43:42 +0200 [thread overview]
Message-ID: <CAOm6c7oufA9--nsMGgkF0PJ2UYNzbOpA6OiCgeF4_x34R=QYsQ@mail.gmail.com> (raw)
In-Reply-To: <20140514185743.414400480@networkplumber.org>
Hi Stephen,
The new function rte_eth_dev_set_link() below is declared as void.
Thus, the comments about its return value are wrong, and should be removed,
unless they still refer to a desired behaviour, in which case it is the
function itself that should be reworked to invoke rte_atomic64_cmpset and
to return its result.
Regards,
Ivan
2014-05-14 20:55 GMT+02:00 Stephen Hemminger <stephen@networkplumber.org>:
> Many drivers copy/paste same code to atomicly access link information.
> Add functions to do this instead.
>
> Signed-off-by: Stephen Hemminger <shemming@brocade.com>
>
> --- a/lib/librte_ether/rte_ethdev.h 2014-05-14 11:27:07.409461720 -0700
> +++ b/lib/librte_ether/rte_ethdev.h 2014-05-14 11:27:07.409461720 -0700
> @@ -1704,6 +1704,45 @@ extern void rte_eth_link_get_nowait(uint
> struct rte_eth_link *link);
>
> +
> +/**
> + * @internal
> + * Set the link status from device in atomic fashion.
> + * Returns non-zero on success; 0 on failure
> + * Callers should retry on failure
> + */
> +static inline void rte_eth_dev_set_link(struct rte_eth_dev *dev,
> + struct rte_eth_link *link)
> +{
> + rte_atomic64_t *dst = (rte_atomic64_t *)&dev->data->dev_link;
> +
> + rte_atomic64_set(dst, *(int64_t *)link);
> +}
> +
>
>
--
Ivan BOULE
6WIND
Software Engineer
next prev parent reply other threads:[~2014-05-15 8:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 18:55 [dpdk-dev] [PATCH 0/6] Ethernet driver enhancements Stephen Hemminger
2014-05-14 18:55 ` [dpdk-dev] [PATCH 1/6] Subjec: ethdev: add macro to cover all checksum flags Stephen Hemminger
2014-05-14 18:55 ` [dpdk-dev] [PATCH 2/6] Subjet: ethdev: add common code to atomicly access link Stephen Hemminger
2014-05-15 8:43 ` Ivan Boule [this message]
2014-05-14 18:55 ` [dpdk-dev] [PATCH 3/6] ixgbe: use eth_dev_{get,set}_link Stephen Hemminger
2014-05-14 18:55 ` [dpdk-dev] [PATCH 4/6] e1000: " Stephen Hemminger
2014-05-14 18:55 ` [dpdk-dev] [PATCH 5/6] ether: allow setting mac address Stephen Hemminger
2014-05-15 9:04 ` Ivan Boule
2014-05-21 15:24 ` Ivan Boule
2014-05-14 18:55 ` [dpdk-dev] [PATCH 6/6] vmxnet3: replace Intel driver Stephen Hemminger
2014-05-15 17:14 ` 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='CAOm6c7oufA9--nsMGgkF0PJ2UYNzbOpA6OiCgeF4_x34R=QYsQ@mail.gmail.com' \
--to=ivan.boule@6wind.com \
--cc=dev@dpdk.org \
--cc=shemming@brocade.com \
--cc=stephen@networkplumber.org \
/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).