Re: [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx

Jeff Garzik (jgarzik@mandrakesoft.com)
Mon, 26 Feb 2001 20:56:06 -0500


This is a multi-part message in MIME format.
--------------02D4E90087C9DB5CDB0296CB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Arnaldo Carvalho de Melo wrote:
> --- linux-2.4.2/drivers/net/pcmcia/3c589_cs.c Tue Feb 13 19:15:05 2001
> +++ linux-2.4.2.acme/drivers/net/pcmcia/3c589_cs.c Mon Feb 26 22:44:00 2001
> @@ -992,9 +992,9 @@
> (pkt_len+3)>>2);
> skb->protocol = eth_type_trans(skb, dev);
>
> + lp->stats.rx_bytes += skb->len;
> netif_rx(skb);
> lp->stats.rx_packets++;
> - lp->stats.rx_bytes += skb->len;

I prefer the attached patch instead. It makes use of the existing local
'pkt_len', and it checks off another item that should probably be on the
janitor's todo list: Set 'dev->last_rx=jiffies' immediately after
netif_rx.

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
--------------02D4E90087C9DB5CDB0296CB
Content-Type: text/plain; charset=us-ascii;
 name="3c589-cs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="3c589-cs.patch"

Index: drivers/net/pcmcia/3c589_cs.c =================================================================== RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/3c589_cs.c,v retrieving revision 1.1.1.10.18.1 diff -u -r1.1.1.10.18.1 3c589_cs.c --- drivers/net/pcmcia/3c589_cs.c 2001/02/25 15:20:31 1.1.1.10.18.1 +++ drivers/net/pcmcia/3c589_cs.c 2001/02/27 01:54:28 @@ -993,8 +993,9 @@ skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); + dev->last_rx = jiffies; lp->stats.rx_packets++; - lp->stats.rx_bytes += skb->len; + lp->stats.rx_bytes += pkt_len; } else { DEBUG(1, "%s: couldn't allocate a sk_buff of" " size %d.\n", dev->name, pkt_len);

--------------02D4E90087C9DB5CDB0296CB--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/