lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1314718004.2752.15.camel@bwh-desktop>
Date:	Tue, 30 Aug 2011 16:26:44 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Giuseppe CAVALLARO <peppe.cavallaro@...com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH 4/9] stmmac: add MMC support exported via ethtool (v2)

On Tue, 2011-08-30 at 16:20 +0200, Giuseppe CAVALLARO wrote:
> This patch adds the MMC management counters support.
> MMC module is an extension of the register address
> space and all the hardware counters can be accessed
> via ethtoo -S ethX.
> 
> Note that, the MMC interrupts remain masked and the logic
> to handle this kind of interrupt will be added later (if
> actually useful).
[...]
>  static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
>  				      struct ethtool_drvinfo *info)
>  {
>  	struct stmmac_priv *priv = netdev_priv(dev);
>  
> -	if (!priv->plat->has_gmac)
> -		strcpy(info->driver, MAC100_ETHTOOL_NAME);
> -	else
> +	info->n_stats = STMMAC_STATS_LEN;
> +
> +	if (likely(priv->plat->has_gmac)) {

Using likely() and unlikely() in ethtool operations seems like a
pointless optimisation.

>  		strcpy(info->driver, GMAC_ETHTOOL_NAME);
> +		info->n_stats += STMMAC_MMC_STATS_LEN;
> +	} else
> +		strcpy(info->driver, MAC100_ETHTOOL_NAME);
>  
>  	strcpy(info->version, DRV_MODULE_VERSION);
>  	info->fw_version[0] = '\0';
> -	info->n_stats = STMMAC_STATS_LEN;
>  }
[...]

Don't bother initialising ethtool_drvinfo::n_stats.  The ethtool core
will do it by calling your get_sset_count implementation.

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ