linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Becker <becker@scyld.com>
To: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: PATCH] via-rhine.c: don't reference skb after passing it to netif_rx
Date: Mon, 26 Feb 2001 20:52:39 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.10.10102262050220.1129-100000@vaio.greennet> (raw)
In-Reply-To: <20010226210441.K8692@conectiva.com.br>

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


  reply	other threads:[~2001-02-27  1:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.10.10102262050220.1129-100000@vaio.greennet \
    --to=becker@scyld.com \
    --cc=acme@conectiva.com.br \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).