Skip to contentSkip to conversation

e100 statistic value "rx_bytes" error

PATCH In review Wei Dong 2 participants 2 messages Jun 15, 2006

Subsystems (2)
lore
Share & tools
lore

Wei Dong

author
#0 lore raw

PATCH 1/1 e100 statistic value "rx_bytes" error

Hi All:
When I test linux kernel(2.6.9-16), I found that maybe there is a bug
in e100 driver. See function e100_rx_indicate() at line 1847:

	nic->net_stats.rx_bytes += actual_size;

Here, actual_size is the actual size of an ethernent frame sans FCS.And the e100 driver gets it from skb. Because "rx_bytes" is a statistc value for a NIC, I think rx_bytes should include the FCS(4 bytes). The following is the patch for the function in e100.c

drivers/net/e100.c +2 -1
diff -ruN old/drivers/net/e100.c new/drivers/net/e100.c
@@ -1844,7 +1844,8 @@
 		dev_kfree_skb_any(skb);
 	} else {
 		nic->net_stats.rx_packets++;
-		nic->net_stats.rx_bytes += actual_size;
+		/* Don't forget FCS */
+		nic->net_stats.rx_bytes += actual_size + 4;
 		nic->netdev->last_rx = jiffies;
 		netif_receive_skb(skb);
 		if(work_done)

BR.
Weidong

#1 lore raw
Quoted 8 lines · Wei Dong

Hi All:
When I test linux kernel(2.6.9-16), I found that maybe there is a bug
in e100 driver. See function e100_rx_indicate() at line 1847:

	nic->net_stats.rx_bytes += actual_size;

Here, actual_size is the actual size of an ethernent frame sans FCS.And the e100 driver gets it from skb. Because "rx_bytes" is a statistc value for a NIC, I think rx_bytes should include the FCS(4 bytes). The following is the patch for the function in e100.c

This is definately not an issue, and I'm not for changing this: It always was like this in the first place. It's done for many drivers like this anyway, mostly those without real hardware counters do it this way anyway (I count half a dozen or so on first glance).

On top of that we would be changing statistics numbers after x years of e100 driver. I'm sure everyone doing real performance work will frown upon this.

Next it's unlikely that every driver (or worse, every nic in hardware) accounts for FCS in the rx_bytes count. It really wouldn't surprise me if a driver (or chip) got this wrong here or there.

Bottom line is that for e100, it's well known and easily seeable that e100 is counting skb sizes. That's consistent and I think we should keep it that way.

Auke

PS please cc the driver maintainers when you post patches to a specific driver.

Quoted 23 lines

diff -ruN old/drivers/net/e100.c new/drivers/net/e100.c

drivers/net/e100.c +2 -1
@@ -1844,7 +1844,8 @@
 		dev_kfree_skb_any(skb);
 	} else {
 		nic->net_stats.rx_packets++;
-		nic->net_stats.rx_bytes += actual_size;
+		/* Don't forget FCS */
+		nic->net_stats.rx_bytes += actual_size + 4;
 		nic->netdev->last_rx = jiffies;
 		netif_receive_skb(skb);
 		if(work_done)

BR.
Weidong

-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html