[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1388664091.22017.17.camel@deadeye.wl.decadent.org.uk>
Date: Thu, 2 Jan 2014 12:01:31 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Sabrina Dubroca <sd@...asysnail.net>
CC: <davem@...emloft.net>, <johannes@...solutions.net>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH 5/5] alx: add stats to ethtool
On Thu, 2014-01-02 at 00:40 +0100, Sabrina Dubroca wrote:
> Signed-off-by: Sabrina Dubroca <sd@...asysnail.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists