patch-2.4.2 linux/drivers/net/tokenring/lanstreamer.c

Next file: linux/drivers/net/tokenring/madgemc.c
Previous file: linux/drivers/net/tokenring/ibmtr.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.1/linux/drivers/net/tokenring/lanstreamer.c linux/drivers/net/tokenring/lanstreamer.c
@@ -237,6 +237,7 @@
 				printk(KERN_ERR "lanstreamer: out of memory.\n");
 				break;
 			}
+			SET_MODULE_OWNER(dev);
 #endif
 			dev->priv = (void *) streamer_priv;
 #if STREAMER_DEBUG
@@ -736,7 +737,6 @@
 #endif
 
 	netif_start_queue(dev);
-	MOD_INC_USE_COUNT;
 	return 0;
 }
 
@@ -852,6 +852,7 @@
 					/* send up to the protocol */
 					netif_rx(skb);
 				}
+				dev->last_rx = jiffies;
 				streamer_priv->streamer_stats.rx_packets++;
 				streamer_priv->streamer_stats.rx_bytes += length;
 			}	/* if skb == null */
@@ -906,7 +907,7 @@
 				streamer_priv->streamer_stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
 				streamer_priv->streamer_stats.tx_packets++;
 				dev_kfree_skb_irq(streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]);
-				streamer_priv-> streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef;
+				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef;
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status = 0;
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].bufcnt_framelen = 0;
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buflen = 0;
@@ -1070,8 +1071,6 @@
 	printk("\n");
 #endif
 	free_irq(dev->irq, dev);
-
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -1383,8 +1382,11 @@
 			       status, len);
 		}
 #endif
-		mac_frame = dev_alloc_skb(frame_len);
-
+		if (!(mac_frame = dev_alloc_skb(frame_len))) {
+			printk(KERN_WARNING "%s: Memory squeeze, dropping frame.\n",
+			       dev->name);
+			goto drop_frame;
+		}
 		/* Walk the buffer chain, creating the frame */
 
 		do {
@@ -1431,7 +1433,7 @@
 		netif_rx(mac_frame);
 
 		/* Now tell the card we have dealt with the received frame */
-
+drop_frame:
 		/* Set LISR Bit 1 */
 		writel(LISR_ARB_FREE, streamer_priv->streamer_mmio + LISR_SUM);
 
@@ -1758,6 +1760,7 @@
 	{
 		dev_streamer[i] = NULL;
 		dev_streamer[i] = init_trdev(dev_streamer[i], 0);
+		SET_MODULE_OWNER(dev_streamer[i]);
 		if (dev_streamer[i] == NULL)
 			return -ENOMEM;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)