All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx
@ 2001-02-27  0:10 Arnaldo Carvalho de Melo
  2001-02-27  1:56 ` Jeff Garzik
  2001-02-27  2:07 ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-27  0:10 UTC (permalink / raw)
  To: Alan Cox, dahinds, linux-kernel

now to pcmcia ones

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/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;
 	    } else {
 		DEBUG(1, "%s: couldn't allocate a sk_buff of"
 		      " size %d.\n", dev->name, pkt_len);

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

* Re: [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx
  2001-02-27  1:56 ` Jeff Garzik
@ 2001-02-27  0:26   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-27  0:26 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Alan Cox, dahinds, linux-kernel

Em Mon, Feb 26, 2001 at 08:56:06PM -0500, Jeff Garzik escreveu:
> 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.

Thanks, I've added your comments and Donald one about grouping the stat
updates, as always the Janitor's TODO list is available at
http://bazar.conectiva.com.br/~acme/TODO, so get your broom and keep on
cleaning 8)

- Arnaldo

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

* Re: [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx
  2001-02-27  2:07 ` Jeff Garzik
@ 2001-02-27  0:32   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-02-27  0:32 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Alan Cox, dahinds, linux-kernel

Em Mon, Feb 26, 2001 at 09:07:49PM -0500, Jeff Garzik escreveu:
> And here are the rest of the ones in pcmcia.

Hey man, thats what I call cooperation 8) I was now on the netwave one, but
had to stop to get another beer, when I came back... Jeff, go get a beer
please, I'll pay you by March, 31, if I meet you in California 8)

- Arnaldo

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

* Re: [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx
  2001-02-27  0:10 [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
@ 2001-02-27  1:56 ` Jeff Garzik
  2001-02-27  0:26   ` Arnaldo Carvalho de Melo
  2001-02-27  2:07 ` Jeff Garzik
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2001-02-27  1:56 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Alan Cox, dahinds, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

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

[-- Attachment #2: 3c589-cs.patch --]
[-- Type: text/plain, Size: 684 bytes --]

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

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

* Re: [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx
  2001-02-27  0:10 [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
  2001-02-27  1:56 ` Jeff Garzik
@ 2001-02-27  2:07 ` Jeff Garzik
  2001-02-27  0:32   ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2001-02-27  2:07 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Alan Cox, dahinds, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

And here are the rest of the ones in pcmcia.
-- 
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

[-- Attachment #2: pcmcia-rx.patch --]
[-- Type: text/plain, Size: 4784 bytes --]

Index: drivers/net/pcmcia/3c574_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/3c574_cs.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 3c574_cs.c
--- drivers/net/pcmcia/3c574_cs.c	2001/02/11 21:28:07	1.1.1.11
+++ drivers/net/pcmcia/3c574_cs.c	2001/02/27 02:05:52
@@ -1166,7 +1166,9 @@
 
 				skb->protocol = eth_type_trans(skb, dev);
 				netif_rx(skb);
+				dev->last_rx = jiffies;
 				lp->stats.rx_packets++;
+				lp->stats.rx_bytes += pkt_len;
 			} else {
 				DEBUG(1, "%s: couldn't allocate a sk_buff of"
 					  " size %d.\n", dev->name, pkt_len);
Index: drivers/net/pcmcia/netwave_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/netwave_cs.c,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 netwave_cs.c
--- drivers/net/pcmcia/netwave_cs.c	2001/02/11 21:28:08	1.1.1.8
+++ drivers/net/pcmcia/netwave_cs.c	2001/02/27 02:05:53
@@ -1463,16 +1463,16 @@
 	skb->protocol = eth_type_trans(skb,dev);
 	/* Queue packet for network layer */
 	netif_rx(skb);
-		
+
+	dev->last_rx = jiffies;
+	priv->stats.rx_packets++;
+	priv->stats.rx_bytes += rcvLen;
+
 	/* Got the packet, tell the adapter to skip it */
 	wait_WOC(iobase);
 	writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0);
 	writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
 	DEBUG(3, "Packet reception ok\n");
-		
-	priv->stats.rx_packets++;
-
-	priv->stats.rx_bytes += skb->len;
     }
     return 0;
 }
Index: drivers/net/pcmcia/nmclan_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/nmclan_cs.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 nmclan_cs.c
--- drivers/net/pcmcia/nmclan_cs.c	2001/02/11 21:28:08	1.1.1.9
+++ drivers/net/pcmcia/nmclan_cs.c	2001/02/27 02:05:53
@@ -1288,9 +1288,9 @@
 	skb->protocol = eth_type_trans(skb, dev);
 	
 	netif_rx(skb); /* Send the packet to the upper (protocol) layers. */
-
+	dev->last_rx = jiffies;
 	lp->linux_stats.rx_packets++;
-	lp->linux_stats.rx_bytes += skb->len;
+	lp->linux_stats.rx_bytes += pkt_len;
 	outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */
 	continue;
       } else {
Index: drivers/net/pcmcia/ray_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/ray_cs.c,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 ray_cs.c
--- drivers/net/pcmcia/ray_cs.c	2001/02/11 21:28:06	1.1.1.8
+++ drivers/net/pcmcia/ray_cs.c	2001/02/27 02:05:54
@@ -2219,9 +2219,9 @@
 
     skb->protocol = eth_type_trans(skb,dev);
     netif_rx(skb);
-
+    dev->last_rx = jiffies;
     local->stats.rx_packets++;
-    local->stats.rx_bytes += skb->len;
+    local->stats.rx_bytes += total_len;
 
     /* Gather signal strength per address */
 #ifdef WIRELESS_SPY
Index: drivers/net/pcmcia/smc91c92_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/smc91c92_cs.c,v
retrieving revision 1.1.1.12.2.2
diff -u -r1.1.1.12.2.2 smc91c92_cs.c
--- drivers/net/pcmcia/smc91c92_cs.c	2001/02/25 15:20:31	1.1.1.12.2.2
+++ drivers/net/pcmcia/smc91c92_cs.c	2001/02/27 02:05:55
@@ -1617,8 +1617,9 @@
 	
 	skb->dev = dev;
 	netif_rx(skb);
+	dev->last_rx = jiffies;
 	smc->stats.rx_packets++;
-	smc->stats.rx_bytes += skb->len;
+	smc->stats.rx_bytes += packet_length;
 	if (rx_status & RS_MULTICAST)
 	    smc->stats.multicast++;
     } else {
Index: drivers/net/pcmcia/wavelan_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/wavelan_cs.c,v
retrieving revision 1.1.1.16.2.1
diff -u -r1.1.1.16.2.1 wavelan_cs.c
--- drivers/net/pcmcia/wavelan_cs.c	2001/02/23 00:15:34	1.1.1.16.2.1
+++ drivers/net/pcmcia/wavelan_cs.c	2001/02/27 02:05:56
@@ -2733,8 +2733,9 @@
   netif_rx(skb);
 
   /* Keep stats up to date */
+  dev->last_rx = jiffies;
   lp->stats.rx_packets++;
-  lp->stats.rx_bytes += skb->len;
+  lp->stats.rx_bytes += sksize;
 
 #ifdef DEBUG_RX_TRACE
   printk(KERN_DEBUG "%s: <-wv_packet_read()\n", dev->name);
Index: drivers/net/pcmcia/xirc2ps_cs.c
===================================================================
RCS file: /cvsroot/gkernel/linux_2_4/drivers/net/pcmcia/xirc2ps_cs.c,v
retrieving revision 1.1.1.14.2.2
diff -u -r1.1.1.14.2.2 xirc2ps_cs.c
--- drivers/net/pcmcia/xirc2ps_cs.c	2001/02/23 03:37:00	1.1.1.14.2.2
+++ drivers/net/pcmcia/xirc2ps_cs.c	2001/02/27 02:05:57
@@ -1420,6 +1420,7 @@
 		skb->protocol = eth_type_trans(skb, dev);
 		skb->dev = dev;
 		netif_rx(skb);
+		dev->last_rx = jiffies;
 		lp->stats.rx_packets++;
 		lp->stats.rx_bytes += pktlen;
 		if (!(rsr & PhyPkt))

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-27  0:10 [PATCH] 3c589_cs: don't reference skb after passing it to netif_rx Arnaldo Carvalho de Melo
2001-02-27  1:56 ` Jeff Garzik
2001-02-27  0:26   ` Arnaldo Carvalho de Melo
2001-02-27  2:07 ` Jeff Garzik
2001-02-27  0:32   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.