From: Ben Hutchings <bhutchings@solarflare.com>
To: Sabrina Dubroca <sd@queasysnail.net>
Cc: <davem@davemloft.net>, <johannes@sipsolutions.net>,
<netdev@vger.kernel.org>
Subject: Re: [PATCH 5/5] alx: add stats to ethtool
Date: Thu, 2 Jan 2014 12:01:31 +0000 [thread overview]
Message-ID: <1388664091.22017.17.camel@deadeye.wl.decadent.org.uk> (raw)
In-Reply-To: <1388619628-3373-6-git-send-email-sd@queasysnail.net>
On Thu, 2014-01-02 at 00:40 +0100, Sabrina Dubroca wrote:
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> drivers/net/ethernet/atheros/alx/ethtool.c | 95 ++++++++++++++++++++++++++++++
> 1 file changed, 95 insertions(+)
>
> diff --git a/drivers/net/ethernet/atheros/alx/ethtool.c b/drivers/net/ethernet/atheros/alx/ethtool.c
> index 45b3650..259056f 100644
> --- a/drivers/net/ethernet/atheros/alx/ethtool.c
> +++ b/drivers/net/ethernet/atheros/alx/ethtool.c
[...]
> +static void alx_get_ethtool_stats(struct net_device *netdev,
> + struct ethtool_stats *estats, u64 *data)
> +{
> + struct alx_priv *alx = netdev_priv(netdev);
> + struct alx_hw *hw = &alx->hw;
> +
> + spin_lock(&alx->stats_lock);
> +
> + __alx_update_hw_stats(hw);
> + memcpy(data, &hw->stats, sizeof(hw->stats));
This definitely doesn't work if the members of hw->stats are typed as
unsigned long...
> + spin_unlock(&alx->stats_lock);
> +}
> +
> +static void alx_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
> +{
> + switch (stringset) {
> + case ETH_SS_STATS:
> + memcpy(buf, &alx_gstrings_stats, sizeof(alx_gstrings_stats));
> + break;
> + default:
> + WARN_ON(1);
> + break;
> + }
> +}
> +
> +static int alx_get_sset_count(struct net_device *netdev, int sset)
> +{
> + switch (sset) {
> + case ETH_SS_STATS:
> + return ALX_NUM_STATS;
> + default:
> + return -ENOTSUPP;
[...]
Never return error code ENOTSUPP; it's *not* the same thing as ENOTSUP
in userland and is not part of the userland ABI. I would use EINVAL
here.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2014-01-02 12:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-01 23:40 [PATCH 0/5] alx: add statistics Sabrina Dubroca
2014-01-01 23:40 ` [PATCH 1/5] alx: add a hardware stats structure Sabrina Dubroca
2014-01-02 11:52 ` Ben Hutchings
2014-01-01 23:40 ` [PATCH 2/5] alx: add constants for the stats fields Sabrina Dubroca
2014-01-01 23:40 ` [PATCH 3/5] alx: add stats update function Sabrina Dubroca
2014-01-02 5:55 ` Stephen Hemminger
2014-01-02 11:52 ` Ben Hutchings
2014-01-01 23:40 ` [PATCH 4/5] alx: add alx_get_stats operation Sabrina Dubroca
2014-01-02 3:27 ` David Miller
2014-01-02 11:56 ` Ben Hutchings
2014-01-02 16:05 ` Sabrina Dubroca
2014-01-02 16:25 ` Ben Hutchings
2014-01-02 17:39 ` David Miller
2014-01-02 11:57 ` Ben Hutchings
2014-01-01 23:40 ` [PATCH 5/5] alx: add stats to ethtool Sabrina Dubroca
2014-01-02 12:01 ` Ben Hutchings [this message]
2014-01-02 18:23 ` Ben Hutchings
2014-01-02 13:09 ` Johannes Berg
2014-01-02 18:19 ` Sabrina Dubroca
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=1388664091.22017.17.camel@deadeye.wl.decadent.org.uk \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
/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).