Re: Wrong network usage reported by /proc

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Monday, May 4, 2009 - 10:22 pm

Willy Tarreau a écrit :

I looked at e1000e driver, and apparently tx_packets & tx_bytes are computed
by the TX completion routine, not by the chip.

static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
{
...

                        if (cleaned) {
                                struct sk_buff *skb = buffer_info->skb;
                                unsigned int segs, bytecount;
                                segs = skb_shinfo(skb)->gso_segs ?: 1;
                                /* multiply data chunks by size of headers */
                                bytecount = ((segs - 1) * skb_headlen(skb)) +
                                            skb->len;
// maybe bytecount is wrong on some skbs ?
                                total_tx_packets += segs;
                                total_tx_bytes += bytecount;
                        }

...
    adapter->net_stats.tx_bytes += total_tx_bytes;
    adapter->net_stats.tx_packets += total_tx_packets;
...
}

and driver get_stats() does return this adapter->net_stats structure to caller

static struct net_device_stats *e1000_get_stats(struct net_device *netdev) 
{
	struct e1000_adapter *adapter = netdev_priv(netdev);

	/* only return the current stats */
	return &adapter->net_stats;
}

Could be converted to use netdev->stats... Oh well...

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Wrong network usage reported by /proc, Eric Dumazet, (Mon May 4, 10:53 am)
Re: Wrong network usage reported by /proc, Matthias Saou, (Mon May 4, 12:11 pm)
Re: Wrong network usage reported by /proc, Willy Tarreau, (Mon May 4, 10:04 pm)
Re: Wrong network usage reported by /proc, Eric Dumazet, (Mon May 4, 10:22 pm)
Re: Wrong network usage reported by /proc, Willy Tarreau, (Mon May 4, 10:50 pm)
Re: Wrong network usage reported by /proc, Matthias Saou, (Tue May 5, 1:09 am)
Re: Wrong network usage reported by /proc, Eric Dumazet, (Tue May 5, 1:51 am)
Re: Wrong network usage reported by /proc, Matthias Saou, (Thu May 7, 10:58 am)