linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH] via-rhine.c: don't reference skb after passing it to netif_rx
@ 2001-02-27  0:04 Arnaldo Carvalho de Melo
  2001-02-27  1:52 ` Donald Becker
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-27  0:04 UTC (permalink / raw)
  To: Alan Cox, becker, linux-kernel

humm, almost finishing... 8)

Em Mon, Feb 26, 2001 at 08:33:59PM -0300, Arnaldo Carvalho de Melo escreveu:
Hi,

	I've just read davem's post at netdev about the brokeness of
referencing skbs after passing it to netif_rx, so please consider applying
this patch. Ah, this was just added to the Janitor's TODO list at
http://bazar.conectiva.com.br/~acme/TODO and I'm doing a quick audit in the
net drivers searching for this, maybe some more patches will follow.

- Arnaldo

--- linux-2.4.2/drivers/net/via-rhine.c	Mon Dec 11 19:38:29 2000
+++ linux-2.4.2.acme/drivers/net/via-rhine.c	Mon Feb 26 22:36:18 2001
@@ -1147,9 +1147,9 @@
 								 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
 			}
 			skb->protocol = eth_type_trans(skb, dev);
+			np->stats.rx_bytes += skb->len;
 			netif_rx(skb);
 			dev->last_rx = jiffies;
-			np->stats.rx_bytes += skb->len;
 			np->stats.rx_packets++;
 		}
 		entry = (++np->cur_rx) % RX_RING_SIZE;

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

* Re: PATCH] via-rhine.c: don't reference skb after passing it to netif_rx
  2001-02-27  1:52 ` Donald Becker
@ 2001-02-27  0:15   ` Arnaldo Carvalho de Melo
  2001-02-27  9:07     ` Urban Widmark
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-27  0:15 UTC (permalink / raw)
  To: Donald Becker; +Cc: Alan Cox, linux-kernel

Em Mon, Feb 26, 2001 at 08:52:39PM -0500, Donald Becker escreveu:
> On Mon, 26 Feb 2001, Arnaldo Carvalho de Melo wrote:
> 
> > Em Mon, Feb 26, 2001 at 08:33:59PM -0300, Arnaldo Carvalho de Melo escreveu:
> > 	I've just read davem's post at netdev about the brokeness of
> > referencing skbs after passing it to netif_rx, so please consider applying
> > this patch. Ah, this was just added to the Janitor's TODO list at
> 
> > --- linux-2.4.2/drivers/net/via-rhine.c	Mon Dec 11 19:38:29 2000
> > +++ linux-2.4.2.acme/drivers/net/via-rhine.c	Mon Feb 26 22:36:18 2001
> > @@ -1147,9 +1147,9 @@
> >  								 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
> >  			}
> >  			skb->protocol = eth_type_trans(skb, dev);
> > +			np->stats.rx_bytes += skb->len;
> >  			netif_rx(skb);
> >  			dev->last_rx = jiffies;
> > -			np->stats.rx_bytes += skb->len;
> >  			np->stats.rx_packets++;
> >  		}
> 
> Easier fix: 
> -			np->stats.rx_bytes += skb->len;
> +			np->stats.rx_bytes += pkt_len;
> 
> Grouping the writes to np->stats results in better cache usage.

thanks, I'll take that into account for the remaining ones and this should
be checked by the driver authors for the ones I've already sent.

- Arnaldo

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

* Re: PATCH] via-rhine.c: don't reference skb after passing it to netif_rx
  2001-02-27  0:04 PATCH] via-rhine.c: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
@ 2001-02-27  1:52 ` Donald Becker
  2001-02-27  0:15   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Donald Becker @ 2001-02-27  1:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Alan Cox, linux-kernel

On Mon, 26 Feb 2001, Arnaldo Carvalho de Melo wrote:

> Em Mon, Feb 26, 2001 at 08:33:59PM -0300, Arnaldo Carvalho de Melo escreveu:
> 	I've just read davem's post at netdev about the brokeness of
> referencing skbs after passing it to netif_rx, so please consider applying
> this patch. Ah, this was just added to the Janitor's TODO list at

> --- linux-2.4.2/drivers/net/via-rhine.c	Mon Dec 11 19:38:29 2000
> +++ linux-2.4.2.acme/drivers/net/via-rhine.c	Mon Feb 26 22:36:18 2001
> @@ -1147,9 +1147,9 @@
>  								 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
>  			}
>  			skb->protocol = eth_type_trans(skb, dev);
> +			np->stats.rx_bytes += skb->len;
>  			netif_rx(skb);
>  			dev->last_rx = jiffies;
> -			np->stats.rx_bytes += skb->len;
>  			np->stats.rx_packets++;
>  		}

Easier fix: 
-			np->stats.rx_bytes += skb->len;
+			np->stats.rx_bytes += pkt_len;

Grouping the writes to np->stats results in better cache usage.


Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Second Generation Beowulf Clusters
Annapolis MD 21403			410-990-9993


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

* Re: PATCH] via-rhine.c: don't reference skb after passing it to netif_rx
  2001-02-27  0:15   ` Arnaldo Carvalho de Melo
@ 2001-02-27  9:07     ` Urban Widmark
  2001-02-27  9:43       ` PATCH] via-rhine.c: don't reference skb after passing it tonetif_rx Jeff Garzik
  2001-02-27 16:24       ` PATCH] via-rhine.c: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 6+ messages in thread
From: Urban Widmark @ 2001-02-27  9:07 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel

On Mon, 26 Feb 2001, Arnaldo Carvalho de Melo wrote:

> thanks, I'll take that into account for the remaining ones and this should
> be checked by the driver authors for the ones I've already sent.

The pkt_len variant is already in 2.4.1-ac15 and probably before that
(changed by Manfred Spraul back in ac4?).

Perhaps you should run through the drivers in -acX instead/also?
(too late now I guess :)

/Urban


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

* Re: PATCH] via-rhine.c: don't reference skb after passing it tonetif_rx
  2001-02-27  9:07     ` Urban Widmark
@ 2001-02-27  9:43       ` Jeff Garzik
  2001-02-27 16:24       ` PATCH] via-rhine.c: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2001-02-27  9:43 UTC (permalink / raw)
  To: Urban Widmark; +Cc: Arnaldo Carvalho de Melo, linux-kernel

Urban Widmark wrote:
> 
> On Mon, 26 Feb 2001, Arnaldo Carvalho de Melo wrote:
> 
> > thanks, I'll take that into account for the remaining ones and this should
> > be checked by the driver authors for the ones I've already sent.
> 
> The pkt_len variant is already in 2.4.1-ac15 and probably before that
> (changed by Manfred Spraul back in ac4?).
> 
> Perhaps you should run through the drivers in -acX instead/also?
> (too late now I guess :)

FWIW I sync up all my network driver patches (include most of the
last_rx/etc changes) with Alan first, and then ship them to Linus as
they are proven stable.

	Jeff


-- 
Jeff Garzik       | "You see, in this world there's two kinds of
Building 1024     |  people, my friend: Those with loaded guns
MandrakeSoft      |  and those who dig. You dig."  --Blondie

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

* Re: PATCH] via-rhine.c: don't reference skb after passing it to netif_rx
  2001-02-27  9:07     ` Urban Widmark
  2001-02-27  9:43       ` PATCH] via-rhine.c: don't reference skb after passing it tonetif_rx Jeff Garzik
@ 2001-02-27 16:24       ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-27 16:24 UTC (permalink / raw)
  To: Urban Widmark; +Cc: linux-kernel

Em Tue, Feb 27, 2001 at 10:07:07AM +0100, Urban Widmark escreveu:
> On Mon, 26 Feb 2001, Arnaldo Carvalho de Melo wrote:
> 
> > thanks, I'll take that into account for the remaining ones and this should
> > be checked by the driver authors for the ones I've already sent.
> 
> The pkt_len variant is already in 2.4.1-ac15 and probably before that
> (changed by Manfred Spraul back in ac4?).
> 
> Perhaps you should run through the drivers in -acX instead/also?
> (too late now I guess :)

well, I think that some of the patches will apply cleanly to both 2.4.2
stock and 2.4.2-acLATEST, or at least sound as a hint to driver
maintainers. I'll wait for the next ac patch and look again.

- Arnaldo

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

end of thread, other threads:[~2001-02-27 18:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-27  0:04 PATCH] via-rhine.c: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
2001-02-27  1:52 ` Donald Becker
2001-02-27  0:15   ` Arnaldo Carvalho de Melo
2001-02-27  9:07     ` Urban Widmark
2001-02-27  9:43       ` PATCH] via-rhine.c: don't reference skb after passing it tonetif_rx Jeff Garzik
2001-02-27 16:24       ` PATCH] via-rhine.c: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo

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).