patch-2.3.44 linux/drivers/net/3c507.c

Next file: linux/drivers/net/3c509.c
Previous file: linux/drivers/net/3c505.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.43/linux/drivers/net/3c507.c linux/drivers/net/3c507.c
@@ -199,6 +199,8 @@
 #define RX_BUF_SIZE 	(1518+14+18)	/* packet+header+RBD */
 #define RX_BUF_END		(dev->mem_end - dev->mem_start)
 
+#define TX_TIMEOUT 5
+
 /*
   That's it: only 86 bytes to set up the beast, including every extra
   command available.  The 170 byte buffer at DUMP_DATA is shared between the
@@ -287,6 +289,7 @@
 static void el16_rx(struct net_device *dev);
 static int	el16_close(struct net_device *dev);
 static struct net_device_stats *el16_get_stats(struct net_device *dev);
+static void el16_tx_timeout (struct net_device *dev);
 
 static void hardware_send_packet(struct net_device *dev, void *buf, short length);
 static void init_82586_mem(struct net_device *dev);
@@ -325,7 +328,7 @@
 	return ENODEV;
 }
 
-int __init el16_probe1(struct net_device *dev, int ioaddr)
+static int __init el16_probe1(struct net_device *dev, int ioaddr)
 {
 	static unsigned char init_ID_done = 0, version_printed = 0;
 	int i, irq, irqval;
@@ -423,6 +426,8 @@
 	dev->stop		= el16_close;
 	dev->hard_start_xmit = el16_send_packet;
 	dev->get_stats	= el16_get_stats;
+	dev->tx_timeout = el16_tx_timeout;
+	dev->watchdog_timeo = TX_TIMEOUT;
 
 	ether_setup(dev);	/* Generic ethernet behaviour */
 
@@ -443,62 +448,59 @@
 	return 0;
 }
 
-static int el16_send_packet(struct sk_buff *skb, struct net_device *dev)
+
+static void el16_tx_timeout (struct net_device *dev)
 {
-	struct net_local *lp = (struct net_local *)dev->priv;
+	struct net_local *lp = (struct net_local *) dev->priv;
 	int ioaddr = dev->base_addr;
 	unsigned long shmem = dev->mem_start;
-	unsigned long flags;
 
-#if 0 /* LINK_STATE_XOFF is never set when we reach here */
-	if (test_bit(LINK_STATE_XOFF, &dev->flags))
-	{
-		/* If we get here, some higher level has decided we are broken.
-		   There should really be a "kick me" function call instead. */
-		int tickssofar = jiffies - dev->trans_start;
-		if (tickssofar < 5)
-			return 1;
+	if (net_debug > 1)
+		printk ("%s: transmit timed out, %s?  ", dev->name,
+			isa_readw (shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
+			"network cable problem");
+	/* Try to restart the adaptor. */
+	if (lp->last_restart == lp->stats.tx_packets) {
 		if (net_debug > 1)
-			printk("%s: transmit timed out, %s?  ", dev->name,
-				   isa_readw(shmem+iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
-				   "network cable problem");
-		/* Try to restart the adaptor. */
-		if (lp->last_restart == lp->stats.tx_packets) {
-			if (net_debug > 1) printk("Resetting board.\n");
-			/* Completely reset the adaptor. */
-			init_82586_mem(dev);
-		} else {
-			/* Issue the channel attention signal and hope it "gets better". */
-			if (net_debug > 1) printk("Kicking board.\n");
-			isa_writew(0xf000|CUC_START|RX_START,shmem+iSCB_CMD);
-			outb(0, ioaddr + SIGNAL_CA);			/* Issue channel-attn. */
-			lp->last_restart = lp->stats.tx_packets;
-		}
-		netif_start_queue(dev);
-		dev->trans_start = jiffies;
+			printk ("Resetting board.\n");
+		/* Completely reset the adaptor. */
+		init_82586_mem (dev);
+	} else {
+		/* Issue the channel attention signal and hope it "gets better". */
+		if (net_debug > 1)
+			printk ("Kicking board.\n");
+		isa_writew (0xf000 | CUC_START | RX_START, shmem + iSCB_CMD);
+		outb (0, ioaddr + SIGNAL_CA);	/* Issue channel-attn. */
+		lp->last_restart = lp->stats.tx_packets;
 	}
-#endif
+	dev->trans_start = jiffies;
+	netif_wake_queue (dev);
+}
 
-	{
-		short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
-		unsigned char *buf = skb->data;
 
-		spin_lock_irqsave(&lp->lock, flags);
+static int el16_send_packet (struct sk_buff *skb, struct net_device *dev)
+{
+	struct net_local *lp = (struct net_local *) dev->priv;
+	int ioaddr = dev->base_addr;
+	unsigned long flags;
+	short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
+	unsigned char *buf = skb->data;
 
-		lp->stats.tx_bytes+=length;
-		/* Disable the 82586's input to the interrupt line. */
-		outb(0x80, ioaddr + MISC_CTRL);
+	netif_stop_queue (dev);
 
-		hardware_send_packet(dev, buf, length);
+	spin_lock_irqsave (&lp->lock, flags);
 
-		dev->trans_start = jiffies;
-		/* Enable the 82586 interrupt input. */
-		outb(0x84, ioaddr + MISC_CTRL);
+	lp->stats.tx_bytes += length;
+	/* Disable the 82586's input to the interrupt line. */
+	outb (0x80, ioaddr + MISC_CTRL);
 
-		spin_unlock_irqrestore(&lp->lock, flags);
+	hardware_send_packet (dev, buf, length);
 
-		netif_stop_queue(dev);
-	}
+	dev->trans_start = jiffies;
+	/* Enable the 82586 interrupt input. */
+	outb (0x84, ioaddr + MISC_CTRL);
+
+	spin_unlock_irqrestore (&lp->lock, flags);
 
 	dev_kfree_skb (skb);
 
@@ -788,7 +790,7 @@
 	}
 
 	if (lp->tx_head != lp->tx_reap)
-		netif_start_queue(dev);
+		netif_wake_queue(dev);
 }
 
 static void el16_rx(struct net_device *dev)

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