netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ifb double-counts packets
@ 2006-12-23 10:35 dean gaudet
  2006-12-23 13:29 ` jamal
  0 siblings, 1 reply; 5+ messages in thread
From: dean gaudet @ 2006-12-23 10:35 UTC (permalink / raw)
  To: Jamal Hadi Salim; +Cc: netdev

it seems that ifb counts packets twice... both at xmit time and also in 
the tasklet.  i'm not sure which one of the two to drop, but here's a 
patch for dropping the counting at xmit time.

patch against 2.6.20-rc1.

-dean

Signed-off-by: dean gaudet <dean@arctic.org>

Index: linux/drivers/net/ifb.c
===================================================================
--- linux.orig/drivers/net/ifb.c	2006-11-29 13:57:37.000000000 -0800
+++ linux/drivers/net/ifb.c	2006-12-23 02:14:31.000000000 -0800
@@ -154,9 +154,6 @@
 	int ret = 0;
 	u32 from = G_TC_FROM(skb->tc_verd);
 
-	stats->tx_packets++;
-	stats->tx_bytes+=skb->len;
-
 	if (!from || !skb->input_dev) {
 dropped:
 		dev_kfree_skb(skb);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] ifb double-counts packets
  2006-12-23 10:35 [patch] ifb double-counts packets dean gaudet
@ 2006-12-23 13:29 ` jamal
  2006-12-23 21:58   ` dean gaudet
  0 siblings, 1 reply; 5+ messages in thread
From: jamal @ 2006-12-23 13:29 UTC (permalink / raw)
  To: dean gaudet; +Cc: netdev

On Sat, 2006-23-12 at 02:35 -0800, dean gaudet wrote:
> it seems that ifb counts packets twice... both at xmit time and also in 
> the tasklet.  i'm not sure which one of the two to drop, but here's a 
> patch for dropping the counting at xmit time.

Good catch but not quite right. The correct way to do it is to increment
the rx_ counters instead of tx_ right at the top of  ifb_xmit().

Do you wanna resubmit your patch with these chmages and hopefully tested
for your situation?

cheers,
jamal



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] ifb double-counts packets
  2006-12-23 13:29 ` jamal
@ 2006-12-23 21:58   ` dean gaudet
  2006-12-26 18:38     ` jamal
  2007-01-02  3:39     ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: dean gaudet @ 2006-12-23 21:58 UTC (permalink / raw)
  To: jamal; +Cc: netdev

On Sat, 23 Dec 2006, jamal wrote:

> On Sat, 2006-23-12 at 02:35 -0800, dean gaudet wrote:
> > it seems that ifb counts packets twice... both at xmit time and also in 
> > the tasklet.  i'm not sure which one of the two to drop, but here's a 
> > patch for dropping the counting at xmit time.
> 
> Good catch but not quite right. The correct way to do it is to increment
> the rx_ counters instead of tx_ right at the top of  ifb_xmit().
> 
> Do you wanna resubmit your patch with these chmages and hopefully tested
> for your situation?

heh yeah that makes more sense :)

-dean

Signed-off-by: dean gaudet <dean@arctic.org>

Index: linux/drivers/net/ifb.c
===================================================================
--- linux.orig/drivers/net/ifb.c	2006-11-29 13:57:37.000000000 -0800
+++ linux/drivers/net/ifb.c	2006-12-23 13:52:39.000000000 -0800
@@ -154,8 +154,8 @@
 	int ret = 0;
 	u32 from = G_TC_FROM(skb->tc_verd);
 
-	stats->tx_packets++;
-	stats->tx_bytes+=skb->len;
+	stats->rx_packets++;
+	stats->rx_bytes+=skb->len;
 
 	if (!from || !skb->input_dev) {
 dropped:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] ifb double-counts packets
  2006-12-23 21:58   ` dean gaudet
@ 2006-12-26 18:38     ` jamal
  2007-01-02  3:39     ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: jamal @ 2006-12-26 18:38 UTC (permalink / raw)
  To: dean gaudet; +Cc: netdev

On Sat, 2006-23-12 at 13:58 -0800, dean gaudet wrote:

> Signed-off-by: dean gaudet <dean@arctic.org>

Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>

cheers,
jamal




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] ifb double-counts packets
  2006-12-23 21:58   ` dean gaudet
  2006-12-26 18:38     ` jamal
@ 2007-01-02  3:39     ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2007-01-02  3:39 UTC (permalink / raw)
  To: dean; +Cc: hadi, netdev

From: dean gaudet <dean@arctic.org>
Date: Sat, 23 Dec 2006 13:58:24 -0800 (PST)

> On Sat, 23 Dec 2006, jamal wrote:
> 
> > On Sat, 2006-23-12 at 02:35 -0800, dean gaudet wrote:
> > > it seems that ifb counts packets twice... both at xmit time and also in 
> > > the tasklet.  i'm not sure which one of the two to drop, but here's a 
> > > patch for dropping the counting at xmit time.
> > 
> > Good catch but not quite right. The correct way to do it is to increment
> > the rx_ counters instead of tx_ right at the top of  ifb_xmit().
> > 
> > Do you wanna resubmit your patch with these chmages and hopefully tested
> > for your situation?
> 
> heh yeah that makes more sense :)
> 
> -dean
> 
> Signed-off-by: dean gaudet <dean@arctic.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-02  3:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-23 10:35 [patch] ifb double-counts packets dean gaudet
2006-12-23 13:29 ` jamal
2006-12-23 21:58   ` dean gaudet
2006-12-26 18:38     ` jamal
2007-01-02  3:39     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).