patch-2.3.44 linux/drivers/net/irda/irport.c
Next file: linux/drivers/net/irda/irtty.c
Previous file: linux/drivers/net/hamradio/soundmodem/sm.c
Back to the patch index
Back to the overall index
- Lines: 159
- Date:
Thu Feb 10 17:07:18 2000
- Orig file:
v2.3.43/linux/drivers/net/irda/irport.c
- Orig date:
Tue Feb 1 01:35:44 2000
diff -u --recursive --new-file v2.3.43/linux/drivers/net/irda/irport.c linux/drivers/net/irda/irport.c
@@ -85,6 +85,7 @@
static int irport_raw_write(struct net_device *dev, __u8 *buf, int len);
static struct net_device_stats *irport_net_get_stats(struct net_device *dev);
static int irport_change_speed_complete(struct irda_task *task);
+static void irport_timeout(struct net_device *dev);
EXPORT_SYMBOL(irport_open);
EXPORT_SYMBOL(irport_close);
@@ -92,6 +93,7 @@
EXPORT_SYMBOL(irport_stop);
EXPORT_SYMBOL(irport_interrupt);
EXPORT_SYMBOL(irport_hard_xmit);
+EXPORT_SYMBOL(irport_timeout);
EXPORT_SYMBOL(irport_change_speed);
EXPORT_SYMBOL(irport_net_open);
EXPORT_SYMBOL(irport_net_close);
@@ -227,6 +229,8 @@
/* Override the network functions we need to use */
dev->init = irport_net_init;
dev->hard_start_xmit = irport_hard_xmit;
+ dev->tx_timeout = irport_timeout;
+ dev->watchdog_timeo = HZ/20;
dev->open = irport_net_open;
dev->stop = irport_net_close;
dev->get_stats = irport_net_get_stats;
@@ -505,16 +509,11 @@
NULL, (void *) self->new_speed);
self->new_speed = 0;
} else {
- self->netdev->tbusy = 0; /* Unlock */
-
/* Tell network layer that we want more frames */
- mark_bh(NET_BH);
+ netif_wake_queue(self->netdev);
}
self->stats.tx_packets++;
- /* Schedule network layer, so we can get some more frames */
- mark_bh(NET_BH);
-
/*
* Reset Rx FIFO to make sure that all reflected transmit data
* is discarded. This is needed for half duplex operation
@@ -577,16 +576,37 @@
ASSERT(self->netdev != NULL, return -1;);
/* Finished changing speed, so we are not busy any longer */
- self->netdev->tbusy = 0;
-
/* Signal network layer so it can try to send the frame */
- mark_bh(NET_BH);
+ netif_wake_queue(self->netdev);
+
return 0;
}
/*
- * Function irport_xmit (void)
+ * Function irport_timeout (struct net_device *dev)
+ *
+ * The networking layer thinks we timed out.
+ *
+ */
+
+static void irport_timeout(struct net_device *dev)
+{
+ struct irport_cb *self;
+ int iobase;
+
+ self = (struct irport_cb *) dev->priv;
+ iobase = self->io.sir_base;
+
+ WARNING("%s: transmit timed out\n", dev->name);
+ irport_start(self);
+ self->change_speed(self->priv, self->io.speed);
+ dev->trans_start = jiffies;
+ netif_wake_queue(dev);
+}
+
+/*
+ * Function irport_hard_start_xmit (struct sk_buff *skb, struct net_device *dev)
*
* Transmits the current frame until FIFO is full, then
* waits until the next transmitt interrupt, and continues until the
@@ -606,19 +626,8 @@
iobase = self->io.sir_base;
- /* Lock transmit buffer */
- if (irda_lock((void *) &dev->tbusy) == FALSE) {
- int tickssofar = jiffies - dev->trans_start;
- if ((tickssofar < 5) || !dev->start)
- return -EBUSY;
-
- WARNING("%s: transmit timed out\n", dev->name);
- irport_start(self);
- self->change_speed(self->priv, self->io.speed);
-
- dev->trans_start = jiffies;
- }
-
+ netif_stop_queue(dev);
+
/* Check if we need to change the speed */
if ((speed = irda_get_speed(skb)) != self->io.speed)
self->new_speed = speed;
@@ -696,8 +705,6 @@
spin_lock(&self->lock);
- dev->interrupt = 1;
-
iobase = self->io.sir_base;
iir = inb(iobase+UART_IIR) & UART_IIR_ID;
@@ -733,8 +740,6 @@
iir = inb(iobase + UART_IIR) & UART_IIR_ID;
}
- dev->interrupt = 0;
-
spin_unlock(&self->lock);
}
@@ -770,10 +775,6 @@
irport_start(self);
- /* Ready to play! */
- dev->tbusy = 0;
- dev->interrupt = 0;
- dev->start = 1;
/*
* Open new IrLAP layer instance, now that everything should be
@@ -782,7 +783,10 @@
self->irlap = irlap_open(dev, &self->qos);
/* FIXME: change speed of dongle */
+ /* Ready to play! */
+ netif_start_queue(dev);
+
MOD_INC_USE_COUNT;
return 0;
@@ -809,9 +813,8 @@
iobase = self->io.sir_base;
/* Stop device */
- dev->tbusy = 1;
- dev->start = 0;
-
+ netif_stop_queue(dev);
+
/* Stop and remove instance of IrLAP */
if (self->irlap)
irlap_close(self->irlap);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)