summaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-03-07 15:45:24 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-03-07 15:45:24 +0000
commit9f9f3e6e8548a596697778337110a423c384b6f3 (patch)
tree5dd4b290ef532cf5ecb058e1a92cd3435afeac8c /drivers/net/wan
parentd5c9a365ee7d2fded249aa5abfc5e89587583029 (diff)
Merge with Linux 2.3.49.
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/sdla.c2
-rw-r--r--drivers/net/wan/sdla_chdlc.c79
-rw-r--r--drivers/net/wan/sdla_fr.c86
-rw-r--r--drivers/net/wan/sdla_ppp.c85
4 files changed, 128 insertions, 124 deletions
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index 64165cd0e..e7875649e 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -565,7 +565,7 @@ int sdla_assoc(struct net_device *slave, struct net_device *master)
flp->dlci[i] = -*(short *)(master->dev_addr);
master->mtu = slave->mtu;
- if (netif_running(dev)) {
+ if (netif_running(slave)) {
if (flp->config.station == FRAD_STATION_CPE)
sdla_reconfig(slave);
else
diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c
index c0b419afa..4bc7762cb 100644
--- a/drivers/net/wan/sdla_chdlc.c
+++ b/drivers/net/wan/sdla_chdlc.c
@@ -11,6 +11,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
+* Feb 28, 2000 Jeff Garzik softnet updates
* Nov 20, 1999 Nenad Corbic Fixed zero length API bug.
* Sep 30, 1999 Nenad Corbic Fixed dynamic IP and route setup.
* Sep 23, 1999 Nenad Corbic Added SMP support, fixed tracing
@@ -64,6 +65,7 @@
#define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" )
+#define TX_TIMEOUT (5*HZ)
/******Data Structures*****************************************************/
@@ -130,6 +132,7 @@ static int del_if (wan_device_t* wandev, struct net_device* dev);
static int if_init (struct net_device* dev);
static int if_open (struct net_device* dev);
static int if_close (struct net_device* dev);
+static void if_tx_timeout (struct net_device *dev);
static int if_header (struct sk_buff* skb, struct net_device* dev,
unsigned short type, void* daddr, void* saddr, unsigned len);
#ifdef LINUX_2_1
@@ -441,7 +444,7 @@ static int update (wan_device_t* wandev)
if(test_bit(1, (void*)&card->wandev.critical))
return -EAGAIN;
- if(!dev->start)
+ if(!netif_running(dev))
return -ENODEV;
flags = card->u.c.flags;
@@ -652,6 +655,8 @@ static int if_init (struct net_device* dev)
dev->rebuild_header = &if_rebuild_hdr;
dev->hard_start_xmit = &if_send;
dev->get_stats = &if_stats;
+ dev->tx_timeout = &if_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
/* Initialize media-specific parameters */
dev->flags |= IFF_POINTTOPOINT;
@@ -709,7 +714,7 @@ static int if_open (struct net_device* dev)
/* Only one open per interface is allowed */
- if(dev->start)
+ if(netif_running(dev))
return -EBUSY;
if(test_and_set_bit(1, (void*)&card->wandev.critical)) {
@@ -774,9 +779,7 @@ static int if_open (struct net_device* dev)
do_gettimeofday(&tv);
chdlc_priv_area->router_start_time = tv.tv_sec;
- dev->interrupt = 0;
- dev->tbusy = 0;
- dev->start = 1;
+ netif_start_queue(dev);
dev->flags |= IFF_POINTTOPOINT;
wanpipe_open(card);
@@ -796,7 +799,7 @@ static int if_close (struct net_device* dev)
if(test_and_set_bit(1, (void*)&card->wandev.critical))
return -EAGAIN;
- dev->start = 0;
+ netif_stop_queue(dev);
wanpipe_close(card);
port_set_state(card, WAN_DISCONNECTED);
chdlc_set_intr_mode(card, 0);
@@ -843,6 +846,30 @@ static int if_rebuild_hdr (void* hdr, struct net_device* dev, unsigned long radd
}
#endif
+
+/*============================================================================
+ * Handle transmit timeout event from netif watchdog
+ */
+static void if_tx_timeout (struct net_device *dev)
+{
+ chdlc_private_area_t *chdlc_priv_area = dev->priv;
+ sdla_t *card = chdlc_priv_area->card;
+
+ /* If our device stays busy for at least 5 seconds then we will
+ * kick start the device by making dev->tbusy = 0. We expect
+ * that our device never stays busy more than 5 seconds. So this
+ * is only used as a last resort.
+ */
+ ++card->wandev.stats.collisions;
+
+ printk (KERN_INFO "%s: Transmit timeout !\n",
+ card->devname);
+
+ /* unbusy the interface */
+ netif_start_queue (dev);
+}
+
+
/*============================================================================
* Send a packet on a network interface.
* o set tbusy flag (marks start of the transmission) to block a timer-based
@@ -875,30 +902,10 @@ static int if_send (struct sk_buff* skb, struct net_device* dev)
*/
printk(KERN_INFO "%s: interface %s got kicked!\n",
card->devname, dev->name);
- mark_bh(NET_BH);
+ netif_wake_queue(dev);
return 0;
}
- if(dev->tbusy) {
-
- /* If our device stays busy for at least 5 seconds then we will
- * kick start the device by making dev->tbusy = 0. We expect
- * that our device never stays busy more than 5 seconds. So this
- * is only used as a last resort.
- */
- ++card->wandev.stats.collisions;
-
- if((jiffies - chdlc_priv_area->tick_counter) < (5 * HZ)) {
- return 1;
- }
-
- printk (KERN_INFO "%s: Transmit timeout !\n",
- card->devname);
-
- /* unbusy the interface */
- dev->tbusy = 0;
- }
-
if(ntohs(skb->protocol) != 0x16) {
/* check the udp packet type */
@@ -977,31 +984,24 @@ static int if_send (struct sk_buff* skb, struct net_device* dev)
}
if(chdlc_send(card, data, len)) {
- dev->tbusy = 1;
+ netif_stop_queue(dev);
chdlc_priv_area->tick_counter = jiffies;
chdlc_int->interrupt_permission |= APP_INT_ON_TX_FRAME;
}
else {
++card->wandev.stats.tx_packets;
-#ifdef LINUX_2_1
card->wandev.stats.tx_bytes += len;
-#endif
}
}
- if (!dev->tbusy) {
-#ifdef LINUX_2_1
+ if (!netif_queue_stopped(dev))
dev_kfree_skb(skb);
-#else
- dev_kfree_skb(skb, FREE_WRITE);
-#endif
- }
clear_bit(0, (void*)&card->wandev.critical);
if(card->hw.type != SDLA_S514){
s508_unlock(card,&smp_flags);
}
- return dev->tbusy;
+ return netif_queue_stopped(dev);
}
@@ -1521,8 +1521,7 @@ STATIC void wpc_isr (sdla_t* card)
~APP_INT_ON_TX_FRAME;
chdlc_priv_area = dev->priv;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue(dev);
break;
case COMMAND_COMPLETE_APP_INT_PEND:/* 0x04: cmd cplt */
@@ -1606,7 +1605,7 @@ static void rx_intr (sdla_t* card)
dev = card->wandev.dev;
chdlc_priv_area = dev->priv;
- if(dev && dev->start) {
+ if(dev && netif_running(dev)) {
len = rxbuf->frame_length;
diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c
index f4431c9dc..14257cc85 100644
--- a/drivers/net/wan/sdla_fr.c
+++ b/drivers/net/wan/sdla_fr.c
@@ -11,6 +11,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
+* Feb 28, 2000 Jeff Garzik o softnet updates
* Nov 08, 1999 Nenad Corbic o Combined all debug UDP calls into one function
* o Removed the ARP support. This has to be done
* in the next version.
@@ -108,7 +109,6 @@
* Jan 02, 1997 Gene Kozin Initial version.
*****************************************************************************/
-#include <linux/version.h>
#include <linux/kernel.h> /* printk(), and other useful stuff */
#include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */
@@ -129,9 +129,6 @@
#include <linux/if.h>
#include <linux/sdla_fr.h> /* frame relay firmware API definitions */
-#if LINUX_VERSION_CODE < 0x020125
-#define test_and_set_bit set_bit
-#endif
/****** Defines & Macros ****************************************************/
@@ -157,6 +154,8 @@
#define API 0x01
#define FRAME_RELAY_API 1
+#define TX_TIMEOUT (5*HZ)
+
/* For handle_IPXWAN() */
#define CVHexToAscii(b) (((unsigned char)(b) > (unsigned char)9) ? ((unsigned char)'A' + ((unsigned char)(b) - (unsigned char)10)) : ((unsigned char)'0' + (unsigned char)(b)))
@@ -273,6 +272,7 @@ static int if_close(struct net_device *dev);
static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len);
static int if_rebuild_hdr(struct sk_buff *skb);
static int if_send(struct sk_buff *skb, struct net_device *dev);
+static void if_tx_timeout (struct net_device *dev);
static int chk_bcast_mcast_addr(sdla_t *card, struct net_device* dev,
struct sk_buff *skb);
static struct net_device_stats *if_stats(struct net_device *dev);
@@ -939,6 +939,8 @@ static int if_init (struct net_device* dev)
dev->rebuild_header = &if_rebuild_hdr;
dev->hard_start_xmit = &if_send;
dev->get_stats = &if_stats;
+ dev->tx_timeout = &if_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
/* Initialize media-specific parameters */
dev->type = ARPHRD_DLCI; /* ARP h/w type */
@@ -993,7 +995,7 @@ static int if_open (struct net_device* dev)
int err = 0;
struct timeval tv;
- if (dev->start)
+ if (netif_running(dev))
return -EBUSY; /* only one open is allowed */
if (test_and_set_bit(1, (void*)&card->wandev.critical))
@@ -1034,9 +1036,7 @@ static int if_open (struct net_device* dev)
fr_activate_dlci(card, chan->dlci);
}
- dev->interrupt = 0;
- dev->tbusy = 0;
- dev->start = 1;
+ netif_start_queue(dev);
wanpipe_open(card);
update_chan_state(dev);
do_gettimeofday( &tv );
@@ -1058,7 +1058,7 @@ static int if_close (struct net_device* dev)
if (test_and_set_bit(1, (void*)&card->wandev.critical))
return -EAGAIN;
- dev->start = 0;
+ netif_stop_queue(dev);
wanpipe_close(card);
if (card->wandev.station == WANOPT_NODE) {
fr_delete_dlci (card,chan->dlci);
@@ -1113,6 +1113,30 @@ static int if_rebuild_hdr (struct sk_buff* skb)
return 1;
}
+
+/*============================================================================
+ * Handle transmit timeout event from netif watchdog
+ */
+static void if_tx_timeout (struct net_device *dev)
+{
+ fr_channel_t* chan = dev->priv;
+
+ /* If our device stays busy for at least 5 seconds then we will
+ * kick start the device by making dev->tbusy = 0. We expect
+ * that our device never stays busy more than 5 seconds. So this
+ * is only used as a last resort.
+ */
+
+ chan->drvstats_if_send.if_send_tbusy++;
+ ++chan->ifstats.collisions;
+
+ printk (KERN_INFO "%s: Transmit timed out\n", chan->name);
+ chan->drvstats_if_send.if_send_tbusy_timeout++;
+ netif_start_queue (dev);
+
+}
+
+
/*============================================================================
* Send a packet on a network interface.
* o set tbusy flag (marks start of the transmission) to block a timer-based
@@ -1153,7 +1177,7 @@ static int if_send (struct sk_buff* skb, struct net_device* dev)
printk(KERN_INFO "%s: interface %s got kicked!\n",
card->devname, dev->name);
chan->drvstats_if_send.if_send_skb_null ++;
- mark_bh(NET_BH);
+ netif_wake_queue(dev);
return 0;
}
@@ -1164,33 +1188,13 @@ static int if_send (struct sk_buff* skb, struct net_device* dev)
*/
set_bit(2, (void*)&card->wandev.critical);
if(chan->transmit_length) {
- dev->tbusy = 1;
+ netif_stop_queue(dev);
chan->tick_counter = jiffies;
clear_bit(2, (void*)&card->wandev.critical);
return 1;
}
clear_bit(2, (void*)&card->wandev.critical);
- if (dev->tbusy) {
-
- /* If our device stays busy for at least 5 seconds then we will
- * kick start the device by making dev->tbusy = 0. We expect
- * that our device never stays busy more than 5 seconds. So this
- * is only used as a last resort.
- */
-
- chan->drvstats_if_send.if_send_tbusy++;
- ++chan->ifstats.collisions;
-
- if ((jiffies - chan->tick_counter) < (5 * HZ)) {
- return 1;
- }
-
- printk(KERN_INFO "%s: Transmit timed out\n", chan->name);
- chan->drvstats_if_send.if_send_tbusy_timeout ++;
- dev->tbusy = 0;
- }
-
data = skb->data;
sendpacket = skb->data;
len = skb->len;
@@ -1318,15 +1322,14 @@ static int if_send (struct sk_buff* skb, struct net_device* dev)
}
}
- if (!dev->tbusy) {
+ if (!netif_queue_stopped(dev))
dev_kfree_skb(skb);
- }
clear_bit(0, (void*)&card->wandev.critical);
s508_s514_unlock(card,&smp_flags);
- return (dev->tbusy);
+ return (netif_queue_stopped(dev));
}
@@ -1743,10 +1746,10 @@ static void rx_intr (sdla_t* card)
skb = dev_alloc_skb(len);
- if (!dev->start || (skb == NULL)) {
+ if (!netif_running(dev) || (skb == NULL)) {
++chan->ifstats.rx_dropped;
- if(dev->start) {
+ if(netif_running(dev)) {
printk(KERN_INFO
"%s: no socket buffers available!\n",
@@ -1920,8 +1923,7 @@ static void tx_intr(sdla_t *card)
if(!(-- card->u.f.tx_interrupts_pending))
flags->imask &= ~FR_INTR_TXRDY;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
}
}
@@ -2704,7 +2706,7 @@ static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox)
"%s: DLCI %u is inactive!\n",
card->devname, dlci);
- if (dev && dev->start)
+ if (dev && netif_running(dev))
set_chan_state(dev, WAN_DISCONNECTED);
}
@@ -2714,7 +2716,7 @@ static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox)
"%s: DLCI %u has been deleted!\n",
card->devname, dlci);
- if (dev && dev->start) {
+ if (dev && netif_running(dev)) {
fr_channel_t *chan = dev->priv;
if (chan->route_flag == ROUTE_ADDED) {
@@ -2738,7 +2740,7 @@ static int fr_dlci_change (sdla_t *card, fr_mbox_t* mbox)
*/
chan->dlci_configured = DLCI_CONFIG_PENDING;
- if (dev && dev->start)
+ if (dev && netif_running(dev))
set_chan_state(dev, WAN_CONNECTED);
}
@@ -3004,7 +3006,7 @@ static int process_udp_mgmt_pkt(sdla_t* card)
test_bit(2, (void*)&card->wandev.critical)) {
return 0;
}
- if((dev->tbusy) || (card->u.f.tx_interrupts_pending)) {
+ if((netif_queue_stopped(dev)) || (card->u.f.tx_interrupts_pending)) {
return 0;
}
}
diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c
index f3dcc129b..40134ff72 100644
--- a/drivers/net/wan/sdla_ppp.c
+++ b/drivers/net/wan/sdla_ppp.c
@@ -142,9 +142,8 @@
#define NUM_AUTH_REQ_WITHOUT_REPLY 10
#define END_OFFSET 0x1F0
-#if LINUX_VERSION_CODE < 0x020125
-#define test_and_set_bit set_bit
-#endif
+
+#define TX_TIMEOUT (5*HZ)
/******Data Structures*****************************************************/
@@ -213,6 +212,7 @@ static int wpp_exec (struct sdla *card, void *u_cmd, void *u_data);
static int if_init(struct net_device *dev);
static int if_open(struct net_device *dev);
static int if_close(struct net_device *dev);
+static void if_tx_timeout (struct net_device *dev);
static int if_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
void *daddr, void *saddr, unsigned len);
static int if_rebuild_hdr(struct sk_buff *skb);
@@ -585,7 +585,8 @@ static int if_init(struct net_device *dev)
dev->rebuild_header = &if_rebuild_hdr;
dev->hard_start_xmit = &if_send;
dev->get_stats = &if_stats;
-
+ dev->tx_timeout = &if_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
/* Initialize media-specific parameters */
dev->type = ARPHRD_PPP; /* ARP h/w type */
@@ -632,7 +633,7 @@ static int if_open(struct net_device *dev)
struct timeval tv;
int err = 0;
- if (dev->start)
+ if (netif_running(dev))
return -EBUSY; /* only one open is allowed */
if (test_and_set_bit(0, (void*)&card->wandev.critical))
@@ -714,13 +715,10 @@ static int if_open(struct net_device *dev)
return err;
}
-
wanpipe_set_state(card, WAN_CONNECTING);
wanpipe_open(card);
dev->mtu = min(dev->mtu, card->wandev.mtu);
- dev->interrupt = 0;
- dev->tbusy = 0;
- dev->start = 1;
+ netif_start_queue(dev);
do_gettimeofday( &tv );
ppp_priv_area->router_start_time = tv.tv_sec;
card->wandev.critical = 0;
@@ -741,7 +739,7 @@ static int if_close(struct net_device *dev)
if (test_and_set_bit(0, (void*)&card->wandev.critical))
return -EAGAIN;
- dev->start = 0;
+ netif_stop_queue(dev);
wanpipe_close(card);
wanpipe_set_state(card, WAN_DISCONNECTED);
ppp_set_intr_mode(card, 0);
@@ -795,6 +793,35 @@ static int if_rebuild_hdr (struct sk_buff *skb)
return 1;
}
+
+/*============================================================================
+ * Handle transmit timeout from netif watchdog
+ */
+static void if_tx_timeout (struct net_device *dev)
+{
+ ppp_private_area_t *ppp_priv_area = dev->priv;
+ sdla_t *card = ppp_priv_area->card;
+
+
+ /* If our device stays busy for at least 5 seconds then we will
+ * kick start the device by making dev->tbusy = 0. We expect
+ * that our device never stays busy more than 5 seconds. So this
+ * is only used as a last resort.
+ */
+
+ ++ppp_priv_area->if_send_stat.if_send_tbusy;
+ ++card->wandev.stats.collisions;
+
+ printk (KERN_INFO "%s: Transmit times out\n", card->devname);
+
+ ++ppp_priv_area->if_send_stat.if_send_tbusy_timeout;
+ ++card->wandev.stats.collisions;
+
+ /* unbusy the card (because only one interface per card) */
+ netif_start_queue(dev);
+}
+
+
/*============================================================================
* Send a packet on a network interface.
* o set tbusy flag (marks start of the transmission) to block a timer-based
@@ -835,34 +862,11 @@ static int if_send (struct sk_buff *skb, struct net_device *dev)
++ppp_priv_area->if_send_stat.if_send_skb_null;
- mark_bh(NET_BH);
+ netif_wake_queue(dev);
return 0;
}
- if (dev->tbusy) {
-
- /* If our device stays busy for at least 5 seconds then we will
- * kick start the device by making dev->tbusy = 0. We expect
- * that our device never stays busy more than 5 seconds. So this
- * is only used as a last resort.
- */
-
- ++ppp_priv_area->if_send_stat.if_send_tbusy;
- ++card->wandev.stats.collisions;
-
- if ((jiffies - ppp_priv_area->tick_counter) < (5*HZ)) {
- return 1;
- }
-
- printk (KERN_INFO "%s: Transmit times out\n",card->devname);
-
- ++ppp_priv_area->if_send_stat.if_send_tbusy_timeout;
- ++card->wandev.stats.collisions;
-
- /* unbusy the card (because only one interface per card)*/
- dev->tbusy = 0;
- }
sendpacket = skb->data;
udp_type = udp_pkt_type( skb, card );
@@ -930,7 +934,7 @@ static int if_send (struct sk_buff *skb, struct net_device *dev)
if (ppp_send(card, skb->data, skb->len, skb->protocol)) {
retry = 1;
- dev->tbusy = 1;
+ netif_stop_queue(dev);
++ppp_priv_area->if_send_stat.if_send_adptr_bfrs_full;
++ppp_priv_area->if_send_stat.if_send_tx_int_enabled;
ppp_priv_area->tick_counter = jiffies;
@@ -1530,7 +1534,7 @@ STATIC void wpp_isr(sdla_t *card)
case PPP_INTR_TXRDY: /* transmit interrupt 0x02 (bit 1)*/
++card->statistics.isr_tx;
flags->imask &= ~PPP_INTR_TXRDY;
- dev->tbusy = 0;
+ netif_wake_queue (dev);
card->buff_int_mode_unbusy = 1;
break;
@@ -1564,9 +1568,8 @@ STATIC void wpp_isr(sdla_t *card)
flags->iflag = 0;
card->wandev.critical = 0;
- if(card->buff_int_mode_unbusy) {
- mark_bh(NET_BH);
- }
+ if(card->buff_int_mode_unbusy)
+ netif_wake_queue(dev);
}
/*============================================================================
@@ -1603,7 +1606,7 @@ static void rx_intr(sdla_t *card)
}
- if (dev && dev->start) {
+ if (dev && netif_running(dev)) {
len = rxbuf->length;
ppp_priv_area = dev->priv;
@@ -2006,7 +2009,7 @@ static void poll_disconnected(sdla_t *card)
{
struct net_device *dev = card->wandev.dev;
- if (dev && dev->start &&
+ if (dev && netif_running(dev) &&
((jiffies - card->state_tick) > HOLD_DOWN_TIME)) {
wanpipe_set_state(card, WAN_CONNECTING);