Subject: Re: [PATCH v2] e1000e: convert to stats64

From: Flavio Leitner <[email-masked]>
Date: Thu, 16 Dec 2010 11:10:21 -0200

On Thu, Dec 16, 2010 at 01:50:30PM +0100, Eric Dumazet wrote:
> Le jeudi 16 décembre 2010 à 10:31 -0200, Flavio Leitner a écrit :
> 
> > -static struct net_device_stats *e1000_get_stats(struct net_device *netdev)
> > +struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
> > +						   struct rtnl_link_stats64 *stats)
> >  {
> > -	/* only return the current stats */
> > -	return &netdev->stats;
> > +	struct e1000_adapter *adapter = netdev_priv(netdev);
> > +
> > +	memset(stats, 0, sizeof(struct rtnl_link_stats64));
> 
> You dont need this memset(), stats is cleared by caller (dev_get_stats()
> in net/core/dev.c), as this was always done ;)

Yes, but e1000_get_ethtool_stats() also calls it and doesn't do that.
I could move the memset to the caller, but I thought it would be cleaner
to leave where it is now.

> > +	spin_lock(&adapter->stats64_lock);
> > +	e1000e_update_stats(adapter);
> > +	/* Fill out the OS statistics structure */
> > +	stats->rx_bytes = adapter->stats.gorc;
> > +	stats->rx_packets = adapter->stats.gprc;
> > +	stats->tx_bytes = adapter->stats.gotc;
> > +	stats->tx_packets = adapter->stats.gptc;
> > +	stats->multicast = adapter->stats.mprc;
> > +	stats->collisions = adapter->stats.colc;
> > +
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [email-masked]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Flavio

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
E1000-devel mailing list
[email-masked]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired