patch-2.3.45 linux/drivers/net/ni65.c
Next file: linux/drivers/net/pcmcia/3c574_cs.c
Previous file: linux/drivers/net/ncr885e.c
Back to the patch index
Back to the overall index
- Lines: 189
- Date:
Sun Feb 13 18:20:21 2000
- Orig file:
v2.3.44/linux/drivers/net/ni65.c
- Orig date:
Thu Feb 10 17:11:10 2000
diff -u --recursive --new-file v2.3.44/linux/drivers/net/ni65.c linux/drivers/net/ni65.c
@@ -228,6 +228,7 @@
static int ni65_lance_reinit(struct net_device *dev);
static void ni65_init_lance(struct priv *p,unsigned char*,int,int);
static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev);
+static void ni65_timeout(struct net_device *dev);
static int ni65_close(struct net_device *dev);
static int ni65_alloc_buffer(struct net_device *dev);
static void ni65_free_buffer(struct priv *p);
@@ -278,16 +279,13 @@
if(ni65_lance_reinit(dev))
{
- dev->tbusy = 0;
- dev->interrupt = 0;
- dev->start = 1;
+ netif_start_queue(dev);
MOD_INC_USE_COUNT;
return 0;
}
else
{
free_irq(dev->irq,dev);
- dev->start = 0;
return -EAGAIN;
}
}
@@ -299,6 +297,8 @@
{
struct priv *p = (struct priv *) dev->priv;
+ netif_stop_queue(dev);
+
outw(inw(PORT+L_RESET),PORT+L_RESET); /* that's the hard way */
#ifdef XMT_VIA_SKB
@@ -314,8 +314,6 @@
}
#endif
free_irq(dev->irq,dev);
- dev->tbusy = 1;
- dev->start = 0;
MOD_DEC_USE_COUNT;
return 0;
}
@@ -482,15 +480,13 @@
dev->open = ni65_open;
dev->stop = ni65_close;
dev->hard_start_xmit = ni65_send_packet;
+ dev->tx_timeout = ni65_timeout;
+ dev->watchdog_timeo = HZ/2;
dev->get_stats = ni65_get_stats;
dev->set_multicast_list = set_multicast_list;
ether_setup(dev);
- dev->interrupt = 0;
- dev->tbusy = 0;
- dev->start = 0;
-
return 0; /* everything is OK */
}
@@ -714,7 +710,8 @@
}
p->rmdnum = p->tmdlast = 0;
if(!p->lock)
- dev->tbusy = (p->tmdnum || !p->xmit_queued) ? 0 : 1;
+ if (p->tmdnum || !p->xmit_queued)
+ netif_wake_queue(dev);
dev->trans_start = jiffies;
}
else
@@ -813,15 +810,6 @@
struct priv *p;
int bcnt = 32;
- if (dev == NULL) {
- printk (KERN_ERR "ni65_interrupt(): irq %d for unknown device.\n", irq);
- return;
- }
-
- if(test_and_set_bit(0,(int *) &dev->interrupt)) {
- printk("ni65: oops .. interrupt while proceeding interrupt\n");
- return;
- }
p = (struct priv *) dev->priv;
while(--bcnt) {
@@ -916,8 +904,6 @@
else
writedatareg(CSR0_INEA);
- dev->interrupt = 0;
-
return;
}
@@ -974,7 +960,7 @@
#ifdef XMT_VIA_SKB
if(p->tmd_skb[p->tmdlast]) {
- dev_kfree_skb(p->tmd_skb[p->tmdlast]);
+ dev_kfree_skb_irq(p->tmd_skb[p->tmdlast]);
p->tmd_skb[p->tmdlast] = NULL;
}
#endif
@@ -983,8 +969,7 @@
if(p->tmdlast == p->tmdnum)
p->xmit_queued = 0;
}
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue(dev);
}
/*
@@ -1082,32 +1067,31 @@
/*
* kick xmitter ..
*/
-static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev)
+
+static void ni65_timeout(struct net_device *dev)
{
+ int i;
struct priv *p = (struct priv *) dev->priv;
- if(dev->tbusy)
- {
- int tickssofar = jiffies - dev->trans_start;
- if (tickssofar < 50)
- return 1;
+ printk(KERN_ERR "%s: xmitter timed out, try to restart!\n",dev->name);
+ for(i=0;i<TMDNUM;i++)
+ printk("%02x ",p->tmdhead[i].u.s.status);
+ printk("\n");
+ ni65_lance_reinit(dev);
+ dev->trans_start = jiffies;
+ netif_wake_queue(dev);
+}
- printk(KERN_ERR "%s: xmitter timed out, try to restart!\n",dev->name);
- {
- int i;
- for(i=0;i<TMDNUM;i++)
- printk("%02x ",p->tmdhead[i].u.s.status);
- printk("\n");
- }
- ni65_lance_reinit(dev);
- dev->tbusy=0;
- dev->trans_start = jiffies;
- }
+/*
+ * Send a packet
+ */
- if (test_and_set_bit(0, (void*)&dev->tbusy) != 0) {
- printk(KERN_ERR "%s: Transmitter access conflict.\n", dev->name);
- return 1;
- }
+static int ni65_send_packet(struct sk_buff *skb, struct net_device *dev)
+{
+ struct priv *p = (struct priv *) dev->priv;
+
+ netif_stop_queue(dev);
+
if (test_and_set_bit(0, (void*)&p->lock)) {
printk(KERN_ERR "%s: Queue was locked.\n", dev->name);
return 1;
@@ -1152,7 +1136,9 @@
p->xmit_queued = 1;
p->tmdnum = (p->tmdnum + 1) & (TMDNUM-1);
- dev->tbusy = (p->tmdnum == p->tmdlast) ? 1 : 0;
+ if(p->tmdnum != p->tmdlast)
+ netif_wake_queue(dev);
+
p->lock = 0;
dev->trans_start = jiffies;
@@ -1183,7 +1169,7 @@
{
if(!ni65_lance_reinit(dev))
printk(KERN_ERR "%s: Can't switch card into MC mode!\n",dev->name);
- dev->tbusy = 0;
+ netif_wake_queue(dev);
}
#ifdef MODULE
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)