summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c505.c4
-rw-r--r--drivers/net/3c515.c91
-rw-r--r--drivers/net/Config.in1
-rw-r--r--drivers/net/Makefile1
-rw-r--r--drivers/net/Space.c11
-rw-r--r--drivers/net/aironet4500.h134
-rw-r--r--drivers/net/aironet4500_card.c226
-rw-r--r--drivers/net/aironet4500_core.c247
-rw-r--r--drivers/net/aironet4500_proc.c2
-rw-r--r--drivers/net/aironet4500_rid.c2
-rw-r--r--drivers/net/am79c961a.c2
-rw-r--r--drivers/net/arlan.c153
-rw-r--r--drivers/net/fc/iph5526.c3
-rw-r--r--drivers/net/hamradio/mkiss.c33
-rw-r--r--drivers/net/ioc3-eth.c1
-rw-r--r--drivers/net/irda/nsc-ircc.c6
-rw-r--r--drivers/net/pcmcia/aironet4500_cs.c22
-rw-r--r--drivers/net/pcmcia/com20020_cs.c6
-rw-r--r--drivers/net/rrunner.c483
-rw-r--r--drivers/net/seeq8005.c2
-rw-r--r--drivers/net/setup.c33
-rw-r--r--drivers/net/sunlance.c4
-rw-r--r--drivers/net/tokenring/ibmtr.c280
-rw-r--r--drivers/net/tokenring/ibmtr.h11
-rw-r--r--drivers/net/tulip/eeprom.c6
-rw-r--r--drivers/net/tulip/tulip.h7
-rw-r--r--drivers/net/tulip/tulip_core.c33
-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
-rw-r--r--drivers/net/wavelan.c4
-rw-r--r--drivers/net/yellowfin.c143
33 files changed, 1226 insertions, 977 deletions
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 5a5d5fcf0..5e948c7e7 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -1242,12 +1242,12 @@ static void elp_set_mc_list(struct net_device *dev)
adapter->got[CMD_CONFIGURE_82586] = 0;
if (!send_pcb(dev, &adapter->tx_pcb))
{
- spin_unlock_irqrestore(&lp->lock, flags);
+ spin_unlock_irqrestore(&adapter->lock, flags);
printk("%s: couldn't send 82586 configure command\n", dev->name);
}
else {
int timeout = jiffies + TIMEOUT;
- spin_unlock_irqrestore(&lp->lock, flags);
+ spin_unlock_irqrestore(&adapter->lock, flags);
while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout));
if (time_after_eq(jiffies, timeout))
TIMEOUT_MSG(__LINE__);
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 36f15f0cb..80f56adf7 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -11,6 +11,8 @@
Center of Excellence in Space Data and Information Sciences
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
+ 2/2/00- Added support for kernel-level ISAPnP
+ by Stephen Frost <sfrost@snowman.net> and Alessandro Zummo
Cleaned up for 2.3.x/softnet by Jeff Garzik and Alan Cox.
*/
@@ -46,6 +48,7 @@ static int max_interrupt_work = 20;
#include <linux/module.h>
#include <linux/version.h>
+#include <linux/isapnp.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -349,6 +352,21 @@ static struct media_table {
{ "Default", 0, 0xFF, XCVR_10baseT, 10000},
};
+#ifdef CONFIG_ISAPNP
+struct corkscrew_isapnp_adapters_struct {
+ unsigned short vendor, function;
+ char *name;
+};
+struct corkscrew_isapnp_adapters_struct corkscrew_isapnp_adapters[] = {
+ {ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5051), "3Com Fast EtherLink ISA"},
+ {0, }
+};
+int corkscrew_isapnp_phys_addr[3] = {
+ 0, 0, 0
+};
+#endif
+static int nopnp = 0;
+
static int corkscrew_scan(struct net_device *dev);
static struct net_device *corkscrew_found_device(struct net_device *dev,
int ioaddr, int irq,
@@ -422,11 +440,79 @@ int tc515_probe(struct net_device *dev)
static int corkscrew_scan(struct net_device *dev)
{
int cards_found = 0;
- static int ioaddr = 0x100;
+ short i;
+ static int ioaddr;
+ static int pnp_cards = 0;
+
+#ifdef CONFIG_ISAPNP
+ if(nopnp == 1)
+ goto no_pnp;
+ for(i=0; corkscrew_isapnp_adapters[i].vendor != 0; i++) {
+ struct pci_dev *idev = NULL;
+ int irq, j;
+ while((idev = isapnp_find_dev(NULL,
+ corkscrew_isapnp_adapters[i].vendor,
+ corkscrew_isapnp_adapters[i].function,
+ idev))) {
+
+ if(idev->active) idev->deactivate(idev);
+
+ if(idev->prepare(idev)<0)
+ continue;
+ if (!(idev->resource[0].flags & IORESOURCE_IO))
+ continue;
+ if(idev->activate(idev)<0) {
+ printk("isapnp configure failed (out of resources?)\n");
+ return -ENOMEM;
+ }
+ if (!idev->resource[0].start || check_region(idev->resource[0].start,16))
+ continue;
+ ioaddr = idev->resource[0].start;
+ irq = idev->irq_resource[0].start;
+ if(corkscrew_debug)
+ printk ("ISAPNP reports %s at i/o 0x%x, irq %d\n",
+ corkscrew_isapnp_adapters[i].name,ioaddr, irq);
+
+ if ((inw(ioaddr + 0x2002) & 0x1f0) != (ioaddr & 0x1f0))
+ continue;
+ /* Verify by reading the device ID from the EEPROM. */
+ {
+ int timer;
+ outw(EEPROM_Read + 7, ioaddr + Wn0EepromCmd);
+ /* Pause for at least 162 us. for the read to take place. */
+ for (timer = 4; timer >= 0; timer--) {
+ udelay(162);
+ if ((inw(ioaddr + Wn0EepromCmd) & 0x0200)
+ == 0)
+ break;
+ }
+ if (inw(ioaddr + Wn0EepromData) != 0x6d50)
+ continue;
+ }
+ printk(KERN_INFO "3c515 Resource configuraiton register %#4.4x, DCR %4.4x.\n",
+ inl(ioaddr + 0x2002), inw(ioaddr + 0x2000));
+ /* irq = inw(ioaddr + 0x2002) & 15; */ /* Use the irq from isapnp */
+ corkscrew_isapnp_phys_addr[pnp_cards] = ioaddr;
+ corkscrew_found_device(dev, ioaddr, irq, CORKSCREW_ID, dev
+ && dev->mem_start ? dev->
+ mem_start : options[cards_found]);
+ dev = 0;
+ pnp_cards++;
+ cards_found++;
+ }
+ }
+no_pnp:
+#endif /* not CONFIG_ISAPNP */
/* Check all locations on the ISA bus -- evil! */
- for (; ioaddr < 0x400; ioaddr += 0x20) {
+ for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x20) {
int irq;
+#ifdef CONFIG_ISAPNP
+ /* Make sure this was not already picked up by isapnp */
+ if(ioaddr == corkscrew_isapnp_phys_addr[0]) continue;
+ if(ioaddr == corkscrew_isapnp_phys_addr[1]) continue;
+ if(ioaddr == corkscrew_isapnp_phys_addr[2]) continue;
+#endif
if (check_region(ioaddr, CORKSCREW_TOTAL_SIZE))
continue;
/* Check the resource configuration for a matching ioaddr. */
@@ -455,7 +541,6 @@ static int corkscrew_scan(struct net_device *dev)
dev = 0;
cards_found++;
}
-
if (corkscrew_debug)
printk(KERN_INFO "%d 3c515 cards found.\n", cards_found);
return cards_found;
diff --git a/drivers/net/Config.in b/drivers/net/Config.in
index abf7958ef..64edb30c1 100644
--- a/drivers/net/Config.in
+++ b/drivers/net/Config.in
@@ -5,6 +5,7 @@
source drivers/net/arcnet/Config.in
tristate 'Dummy net driver support' CONFIG_DUMMY
+tristate 'Bonding driver support' CONFIG_BONDING
tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
if [ "$CONFIG_NETLINK" = "y" ]; then
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 550a97ae2..6a7b1f06a 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -228,6 +228,7 @@ obj-$(CONFIG_STRIP) += strip.o
obj-$(CONFIG_DE650) += de650.o 8390.o
obj-$(CONFIG_3C589) += 3c589.o
obj-$(CONFIG_DUMMY) += dummy.o
+obj-$(CONFIG_BONDING) += bonding.o
obj-$(CONFIG_DE600) += de600.o
obj-$(CONFIG_DE620) += de620.o
obj-$(CONFIG_AT1500) += lance.o
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
index d497f72d5..bccd82b04 100644
--- a/drivers/net/Space.c
+++ b/drivers/net/Space.c
@@ -681,6 +681,15 @@ static struct net_device tr0_dev = {
-struct net_device *dev_base = NEXT_DEV;
+/*
+ * The loopback device is global so it can be directly referenced
+ * by the network code. Also, it must be first on device list.
+ */
+
+extern int loopback_init(struct net_device *dev);
+struct net_device loopback_dev =
+ {"lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, loopback_init};
+
+struct net_device *dev_base = &loopback_dev;
rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
diff --git a/drivers/net/aironet4500.h b/drivers/net/aironet4500.h
index 95f0d23af..914976a70 100644
--- a/drivers/net/aironet4500.h
+++ b/drivers/net/aironet4500.h
@@ -19,17 +19,7 @@
/*#include <linux/module.h>
#include <linux/kernel.h>
*/
-#if LINUX_VERSION_CODE < 0x2030E
-#define NET_DEVICE device
-#error bad kernel version code
-#else
-#define NET_DEVICE net_device
-#endif
-
-#if LINUX_VERSION_CODE < 0x20300
-#define init_MUTEX(a) *(a) = MUTEX;
-#endif
/*
#include <linux/types.h>
#include <linux/netdevice.h>
@@ -63,11 +53,6 @@ typedef spinlock_t my_spinlock_t ;
#define my_spin_unlock_irqrestore(a,b) spin_unlock_irqrestore(a,b)
-#if LINUX_VERSION_CODE <= 0x20100
-#define in_interrupt() intr_count
-#endif
-
-
#define AWC_ERROR -1
#define AWC_SUCCESS 0
@@ -81,6 +66,10 @@ struct awc_cis {
};
+/* timeout for transmit watchdog timer */
+#define TX_TIMEOUT (HZ * 3)
+
+
/*************************** REGISTER OFFSETS *********************/
#define awc_Command_register 0x00
@@ -137,7 +126,7 @@ struct awc_bap {
struct awc_command {
volatile int state;
volatile int lock_state;
- struct NET_DEVICE * dev;
+ struct net_device * dev;
struct awc_private * priv;
u16 port;
struct awc_bap * bap;
@@ -1293,7 +1282,7 @@ struct awc_strings {
/***************************** R I D ***************/
#define AWC_NOF_RIDS 18
-extern int awc_rid_setup(struct NET_DEVICE * dev);
+extern int awc_rid_setup(struct net_device * dev);
struct aironet4500_rid_selector{
const u16 selector;
@@ -1427,7 +1416,7 @@ struct awc_rid_dir{
const struct aironet4500_rid_selector * selector;
const int size;
const struct aironet4500_RID * rids;
- struct NET_DEVICE * dev ;
+ struct net_device * dev ;
void * buff;
int bufflen; // just checking
};
@@ -1490,8 +1479,6 @@ struct awc_private {
int large_buff_mem;
int small_buff_no;
- int tx_timeout;
-
volatile int mac_enabled;
u16 link_status;
u8 link_status_changed;
@@ -1533,60 +1520,59 @@ struct awc_private {
int card_type;
};
-extern int awc_init(struct NET_DEVICE * dev);
-extern void awc_reset(struct NET_DEVICE *dev);
-extern int awc_config(struct NET_DEVICE *dev);
-extern int awc_open(struct NET_DEVICE *dev);
-extern void awc_tx_timeout(struct NET_DEVICE *dev);
-extern int awc_tx_done(struct awc_fid * rx_fid);
-extern int awc_start_xmit(struct sk_buff *, struct NET_DEVICE *);
+extern int awc_init(struct net_device * dev);
+extern void awc_reset(struct net_device *dev);
+extern int awc_config(struct net_device *dev);
+extern int awc_open(struct net_device *dev);
+extern void awc_tx_timeout(struct net_device *dev);
+extern int awc_start_xmit(struct sk_buff *, struct net_device *);
extern void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-extern struct enet_statistics * awc_get_stats(struct NET_DEVICE *dev);
-extern int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid);
-extern void awc_set_multicast_list(struct NET_DEVICE *dev);
-extern int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu);
-extern int awc_close(struct NET_DEVICE *dev);
-extern int awc_private_init(struct NET_DEVICE * dev);
+extern struct enet_statistics * awc_get_stats(struct net_device *dev);
+extern int awc_rx(struct net_device *dev, struct awc_fid * rx_fid);
+extern void awc_set_multicast_list(struct net_device *dev);
+extern int awc_change_mtu(struct net_device *dev, int new_mtu);
+extern int awc_close(struct net_device *dev);
+extern int awc_private_init(struct net_device * dev);
extern int awc_register_proc(int (*awc_proc_set_device) (int),int (*awc_proc_unset_device)(int));
extern int awc_unregister_proc(void);
extern int (* awc_proc_set_fun) (int) ;
extern int (* awc_proc_unset_fun) (int) ;
-extern int awc_interrupt_process(struct NET_DEVICE * dev);
-extern int awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf );
-extern int awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf);
-extern int awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid );
-extern int awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid);
-extern int awc_tx_alloc(struct NET_DEVICE * dev) ;
-extern int awc_tx_dealloc(struct NET_DEVICE * dev);
-extern struct awc_fid *awc_tx_fid_lookup(struct NET_DEVICE * dev, u16 fid);
-extern int awc_issue_soft_reset(struct NET_DEVICE * dev);
-extern int awc_issue_noop(struct NET_DEVICE * dev);
-extern int awc_dump_registers(struct NET_DEVICE * dev);
+extern int awc_interrupt_process(struct net_device * dev);
+extern int awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf );
+extern int awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf);
+extern int awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid );
+extern int awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid);
+extern int awc_tx_alloc(struct net_device * dev) ;
+extern int awc_tx_dealloc(struct net_device * dev);
+extern struct awc_fid *awc_tx_fid_lookup(struct net_device * dev, u16 fid);
+extern int awc_issue_soft_reset(struct net_device * dev);
+extern int awc_issue_noop(struct net_device * dev);
+extern int awc_dump_registers(struct net_device * dev);
extern unsigned short awc_issue_command_and_block(struct awc_command * cmd);
-extern int awc_enable_MAC(struct NET_DEVICE * dev);
-extern int awc_disable_MAC(struct NET_DEVICE * dev);
-extern int awc_read_all_rids(struct NET_DEVICE * dev);
-extern int awc_write_all_rids(struct NET_DEVICE * dev);
-extern int awc_receive_packet(struct NET_DEVICE * dev);
-extern int awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) ;
-extern int awc_tx_complete_check(struct NET_DEVICE * dev);
-extern int awc_interrupt_process(struct NET_DEVICE * dev);
-extern void awc_bh(struct NET_DEVICE *dev);
-extern int awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff);
-extern void awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff);
-extern int awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev, struct sk_buff * skb);
-extern void awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev, struct awc_fid * tx_buff);
-extern void awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,struct awc_fid * tx_buff);
-extern void awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff);
-extern void awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff);
-extern int awc_tx_alloc(struct NET_DEVICE * dev) ;
-extern int awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid);
-extern int awc_tx_dealloc(struct NET_DEVICE * dev);
+extern int awc_enable_MAC(struct net_device * dev);
+extern int awc_disable_MAC(struct net_device * dev);
+extern int awc_read_all_rids(struct net_device * dev);
+extern int awc_write_all_rids(struct net_device * dev);
+extern int awc_receive_packet(struct net_device * dev);
+extern int awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) ;
+extern int awc_tx_complete_check(struct net_device * dev);
+extern int awc_interrupt_process(struct net_device * dev);
+extern void awc_bh(struct net_device *dev);
+extern int awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff);
+extern void awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff);
+extern int awc_802_11_tx_find_path_and_post(struct net_device * dev, struct sk_buff * skb);
+extern void awc_802_11_after_tx_packet_to_card_write(struct net_device * dev, struct awc_fid * tx_buff);
+extern void awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,struct awc_fid * tx_buff);
+extern void awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff);
+extern void awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff);
+extern int awc_tx_alloc(struct net_device * dev) ;
+extern int awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid);
+extern int awc_tx_dealloc(struct net_device * dev);
extern struct awc_fid *
- awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle);
-extern int awc_queues_init(struct NET_DEVICE * dev);
-extern int awc_queues_destroy(struct NET_DEVICE * dev);
-extern int awc_rids_setup(struct NET_DEVICE * dev);
+ awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle);
+extern int awc_queues_init(struct net_device * dev);
+extern int awc_queues_destroy(struct net_device * dev);
+extern int awc_rids_setup(struct net_device * dev);
@@ -1603,7 +1589,7 @@ extern int tx_rate;
extern int awc_full_stats;
#define MAX_AWCS 4
-extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS];
+extern struct net_device * aironet4500_devices[MAX_AWCS];
#define AWC_DEBUG 1
@@ -1615,16 +1601,4 @@ extern struct NET_DEVICE * aironet4500_devices[MAX_AWCS];
#define AWC_ENTRY_EXIT_DEBUG(a)
#endif
-#if LINUX_VERSION_CODE < 0x20100
-#ifndef test_and_set_bit
- #define test_and_set_bit(a,b) set_bit(a,b)
-#endif
-#endif
-
-#if LINUX_VERSION_CODE < 0x20100
- #define FREE_SKB(a) dev_kfree_skb(a, FREE_WRITE)
-#else
- #define FREE_SKB(a) dev_kfree_skb(a)
-#endif
-
#endif /* AIRONET4500_H */
diff --git a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
index b6a00e875..b271b18f4 100644
--- a/drivers/net/aironet4500_card.c
+++ b/drivers/net/aironet4500_card.c
@@ -7,11 +7,13 @@
*
* Revision 0.1 ,started 30.12.1998
*
+ * Revision 0.2, Feb 27, 2000
+ * Jeff Garzik - softnet, cleanups
*
*/
#ifdef MODULE
static const char *awc_version =
-"aironet4500_cards.c v0.1 28/03/99 Elmer Joandi, elmer@ylenurme.ee.\n";
+"aironet4500_cards.c v0.2 Feb 27, 2000 Elmer Joandi, elmer@ylenurme.ee.\n";
#endif
#include <linux/version.h>
@@ -36,9 +38,6 @@ static const char *awc_version =
#include <linux/if_arp.h>
#include <linux/ioport.h>
#include <linux/delay.h>
-#if LINUX_VERSION_CODE < 0x20100
-#include <linux/bios32.h>
-#endif
#include "aironet4500.h"
@@ -64,11 +63,11 @@ static const char *awc_version =
static int reverse_probe =0 ;
-static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
+static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
int ioaddr, int cis_addr, int mem_addr,u8 pci_irq_line) ;
-int awc4500_pci_probe(struct NET_DEVICE *dev)
+int awc4500_pci_probe(struct net_device *dev)
{
int cards_found = 0;
static int pci_index = 0; /* Static, for multiple probe calls. */
@@ -77,7 +76,7 @@ int awc4500_pci_probe(struct NET_DEVICE *dev)
unsigned char awc_pci_dev, awc_pci_bus;
- if (!pcibios_present())
+ if (!pci_present())
return -1;
for (;pci_index < 0xff; pci_index++) {
@@ -85,10 +84,8 @@ int awc4500_pci_probe(struct NET_DEVICE *dev)
u32 pci_memaddr;
u32 pci_ioaddr;
u32 pci_cisaddr;
-#if LINUX_VERSION_CODE < 0x20100
- u16 pci_caps =0;
- u8 pci_caps_ptr =0;
-#endif
+ struct pci_dev *pdev;
+
if (pcibios_find_class (PCI_CLASS_NETWORK_OTHER << 8,
reverse_probe ? 0xfe - pci_index : pci_index,
&awc_pci_bus, &awc_pci_dev) != PCIBIOS_SUCCESSFUL){
@@ -98,31 +95,16 @@ int awc4500_pci_probe(struct NET_DEVICE *dev)
break;
}
}
- pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
- PCI_VENDOR_ID, &vendor);
- pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
- PCI_DEVICE_ID, &device);
-#if LINUX_VERSION_CODE >= 0x20300
- pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq;
- pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[0].start;
- pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[1].start;
- pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->resource[2].start;
-#else
-#if LINUX_VERSION_CODE >= 0x20155
- pci_irq_line = pci_find_slot(awc_pci_bus, awc_pci_dev)->irq;
- pci_memaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[0];
- pci_cisaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[1];
- pci_ioaddr = pci_find_slot(awc_pci_bus, awc_pci_dev)->base_address[2];
-#else
- pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_0, &pci_memaddr);
- pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_1, &pci_cisaddr);
- pcibios_read_config_dword(awc_pci_bus, awc_pci_dev,PCI_BASE_ADDRESS_2, &pci_ioaddr);
- pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, PCI_INTERRUPT_LINE, &pci_irq_line);
- pcibios_read_config_word(awc_pci_bus, awc_pci_dev,PCI_STATUS, &pci_caps);
- pcibios_read_config_byte(awc_pci_bus, awc_pci_dev, 0x34, &pci_caps_ptr);
-
-#endif // 2.2
-#endif // 2.3
+ pdev = pci_find_slot(awc_pci_bus, awc_pci_dev);
+ if (!pdev)
+ continue;
+ vendor = pdev->vendor;
+ device = pdev->device;
+ pci_irq_line = pdev->irq;
+ pci_memaddr = pci_resource_start (pdev, 0);
+ pci_cisaddr = pci_resource_start (pdev, 1);
+ pci_ioaddr = pci_resource_start (pdev, 2);
+
// printk("\n pci capabilities %x and ptr %x \n",pci_caps,pci_caps_ptr);
/* Remove I/O space marker in bit 0. */
@@ -132,17 +114,7 @@ int awc4500_pci_probe(struct NET_DEVICE *dev)
device != PCI_DEVICE_AIRONET_4800 &&
device != PCI_DEVICE_AIRONET_4500 )
continue;
-#if LINUX_VERSION_CODE < 0x20300
-
- if (!(pci_ioaddr & 1)){
- printk("awc4X00 ioaddr location mismatch \n");
- return -1;
- };
- pci_ioaddr &= ~3;
- pci_cisaddr &= ~0xf;
- pci_memaddr &= ~0xf;
-#endif
// if (check_region(pci_ioaddr, AIRONET4X00_IO_SIZE) ||
// check_region(pci_cisaddr, AIRONET4X00_CIS_SIZE) ||
// check_region(pci_memaddr, AIRONET4X00_MEM_SIZE)) {
@@ -153,33 +125,28 @@ int awc4500_pci_probe(struct NET_DEVICE *dev)
// request_region(pci_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
// request_region(pci_memaddr, AIRONET4X00_MEM_SIZE, "aironet4x00 mem");
-// pcibios_write_config_word(awc_pci_bus, awc_pci_dev,
-// PCI_COMMAND, 0);
+// pci_write_config_word(pdev, PCI_COMMAND, 0);
udelay(10000);
- pcibios_read_config_word(awc_pci_bus, awc_pci_dev,
- PCI_COMMAND, &pci_command);
+ pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
new_command = pci_command |0x100 | PCI_COMMAND_MEMORY|PCI_COMMAND_IO;
if (pci_command != new_command) {
printk(KERN_INFO " The PCI BIOS has not enabled this"
" device! Updating PCI command %4.4x->%4.4x.\n",
pci_command, new_command);
- pcibios_write_config_word(awc_pci_bus, awc_pci_dev,
- PCI_COMMAND, new_command);
+ pci_write_config_word(pdev, PCI_COMMAND, new_command);
}
/* if (device == PCI_DEVICE_AIRONET_4800)
- pcibios_write_config_dword(awc_pci_bus, awc_pci_dev,
- 0x40, 0x00000000);
+ pci_write_config_dword(pdev, 0x40, 0x00000000);
udelay(1000);
*/
if (device == PCI_DEVICE_AIRONET_4800)
- pcibios_write_config_dword(awc_pci_bus, awc_pci_dev,
- 0x40, 0x40000000);
+ pci_write_config_dword(pdev, 0x40, 0x40000000);
- if (awc_pci_init(dev, awc_pci_bus, awc_pci_dev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
+ if (awc_pci_init(dev, pdev, pci_ioaddr,pci_cisaddr,pci_memaddr,pci_irq_line)){
printk(KERN_ERR "awc4800 pci init failed \n");
break;
}
@@ -191,7 +158,7 @@ int awc4500_pci_probe(struct NET_DEVICE *dev)
}
-static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
+static int awc_pci_init(struct net_device * dev, struct pci_dev *pdev,
int ioaddr, int cis_addr, int mem_addr, u8 pci_irq_line) {
int i;
@@ -218,18 +185,15 @@ static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
dev->init = &awc_init;
dev->open = &awc_open;
dev->stop = &awc_close;
- dev->tbusy = 1;
- dev->start = 0;
-
dev->base_addr = ioaddr;
-
-
dev->irq = pci_irq_line;
-#if LINUX_VERSION_CODE > 0x20100
- request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-#else
+ dev->tx_timeout = &awc_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
+
+ netif_start_queue (dev);
+
request_irq(dev->irq,awc_interrupt, SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-#endif
+
awc_private_init( dev);
awc_init(dev);
@@ -244,17 +208,11 @@ static int awc_pci_init(struct NET_DEVICE * dev, int pci_bus, int device_nr,
awc_proc_set_fun(i);
}
- dev->tbusy = 1;
- dev->start = 0;
-
-
// if (register_netdev(dev) != 0) {
// printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
// goto failed;
// }
-
-
return 0;
// failed:
// return -1;
@@ -285,7 +243,7 @@ static void awc_pci_release(void) {
unregister_netdev(aironet4500_devices[i]);
free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+ kfree_s(aironet4500_devices[i], sizeof(struct net_device));
aironet4500_devices[i]=0;
@@ -304,14 +262,9 @@ static void awc_pci_release(void) {
#ifdef CONFIG_AIRONET4500_PNP
-#if LINUX_VERSION_CODE > 0x20300
#include <linux/isapnp.h>
-#else
-#include "isapnp.h"
-#endif
#define AIRONET4X00_IO_SIZE 0x40
-#if LINUX_VERSION_CODE > 0x20300
#define isapnp_logdev pci_dev
#define isapnp_dev pci_bus
#define isapnp_find_device isapnp_find_card
@@ -319,17 +272,11 @@ static void awc_pci_release(void) {
#define PNP_BUS bus
#define PNP_BUS_NUMBER number
#define PNP_DEV_NUMBER devfn
-#else
-#define PNP_BUS dev
-#define PNP_BUS_NUMBER csn
-#define PNP_DEV_NUMBER number
-#endif
-int awc4500_pnp_hw_reset(struct NET_DEVICE *dev){
+
+int awc4500_pnp_hw_reset(struct net_device *dev){
struct isapnp_logdev *logdev;
-#if LINUX_VERSION_CODE < 0x20300
- struct isapnp_config cfg;
-#endif
+
DEBUG(0, "awc_pnp_reset \n");
if (!dev->priv ) {
@@ -357,30 +304,14 @@ int awc4500_pnp_hw_reset(struct NET_DEVICE *dev){
dev->name, logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
return -EAGAIN;
}
-#if LINUX_VERSION_CODE < 0x20300
- if (isapnp_config_init(&cfg, logdev)<0) {
- printk("cfg init failed \n");
- isapnp_cfg_end();
- return -EAGAIN;
- }
- cfg.port[0] = dev->base_addr;
- cfg.irq[0] = dev->irq;
- if (isapnp_configure(&cfg)<0) {
- printk("%s hw_reset, isapnp configure failed (out of resources?)\n",dev->name);
- isapnp_cfg_end();
- return -ENOMEM;
- }
-#else
-
-#endif
isapnp_activate(logdev->PNP_DEV_NUMBER); /* activate device */
isapnp_cfg_end();
return 0;
}
-int awc4500_pnp_probe(struct NET_DEVICE *dev)
+int awc4500_pnp_probe(struct net_device *dev)
{
int isa_index = 0;
int isa_irq_line = 0;
@@ -389,21 +320,13 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev)
int i=0;
struct isapnp_dev * pnp_dev ;
struct isapnp_logdev *logdev;
-#if LINUX_VERSION_CODE < 0x20300
- struct isapnp_config cfg;
-#endif
while (1) {
pnp_dev = isapnp_find_device(
ISAPNP_VENDOR('A','W','L'),
ISAPNP_DEVICE(1),
-#if LINUX_VERSION_CODE < 0x20300
- isa_index
-#else
- 0
-#endif
- );
+ 0);
if (!pnp_dev) break;
@@ -421,28 +344,11 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev)
logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
return -EAGAIN;
}
-#if LINUX_VERSION_CODE < 0x20300
- if (isapnp_config_init(&cfg, logdev)<0) {
- printk("cfg init failed \n");
- isapnp_cfg_end();
- return -EAGAIN;
- }
- if (isapnp_configure(&cfg)<0) {
- printk("isapnp configure failed (out of resources?)\n");
- isapnp_cfg_end();
- return -ENOMEM;
- }
-#endif
isapnp_activate(logdev->PNP_DEV_NUMBER); /* activate device */
isapnp_cfg_end();
-#if LINUX_VERSION_CODE < 0x20300
- isa_ioaddr = cfg.port[0];
- isa_irq_line = cfg.irq[0];
-#else
isa_irq_line = logdev->irq;
isa_ioaddr = logdev->resource[0].start;
-#endif
request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
if (!dev) {
@@ -468,18 +374,14 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev)
dev->init = &awc_init;
dev->open = &awc_open;
dev->stop = &awc_close;
- dev->tbusy = 1;
- dev->start = 0;
-
dev->base_addr = isa_ioaddr;
-
-
dev->irq = isa_irq_line;
-#if LINUX_VERSION_CODE > 0x20100
+ dev->tx_timeout = &awc_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
+
+ netif_start_queue (dev);
+
request_irq(dev->irq,awc_interrupt , SA_SHIRQ | SA_INTERRUPT ,"Aironet 4X00",dev);
-#else
- request_irq(dev->irq,awc_interrupt, SA_SHIRQ ,"Aironet 4X00",dev);
-#endif
awc_private_init( dev);
@@ -512,9 +414,6 @@ int awc4500_pnp_probe(struct NET_DEVICE *dev)
return -1;
}
- dev->tbusy = 1;
- dev->start = 0;
-
card++;
}
@@ -557,7 +456,7 @@ static void awc_pnp_release(void) {
unregister_netdev(aironet4500_devices[i]);
free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+ kfree_s(aironet4500_devices[i], sizeof(struct net_device));
aironet4500_devices[i]=0;
@@ -580,16 +479,14 @@ static int io[] = {0,0,0,0,0};
EXPORT_SYMBOL(irq);
EXPORT_SYMBOL(io);
*/
-#if LINUX_VERSION_CODE >= 0x20100
MODULE_PARM(irq,"i");
MODULE_PARM_DESC(irq,"Aironet 4x00 ISA non-PNP irqs,required");
MODULE_PARM(io,"i");
MODULE_PARM_DESC(io,"Aironet 4x00 ISA non-PNP ioports,required");
-#endif
-int awc4500_isa_probe(struct NET_DEVICE *dev)
+int awc4500_isa_probe(struct net_device *dev)
{
// int cards_found = 0;
// static int isa_index = 0; /* Static, for multiple probe calls. */
@@ -638,19 +535,14 @@ int awc4500_isa_probe(struct NET_DEVICE *dev)
dev->init = &awc_init;
dev->open = &awc_open;
dev->stop = &awc_close;
- dev->tbusy = 1;
- dev->start = 0;
-
dev->base_addr = isa_ioaddr;
-
-
dev->irq = isa_irq_line;
+ dev->tx_timeout = &awc_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
+
+ netif_start_queue (dev);
-#if LINUX_VERSION_CODE > 0x20100
request_irq(dev->irq,awc_interrupt ,SA_INTERRUPT ,"Aironet 4X00",dev);
-#else
- request_irq(dev->irq,awc_interrupt ,0 ,"Aironet 4X00",dev);
-#endif
awc_private_init( dev);
if ( awc_init(dev) ){
@@ -671,9 +563,6 @@ int awc4500_isa_probe(struct NET_DEVICE *dev)
awc_proc_set_fun(i);
}
- dev->tbusy = 1;
- dev->start = 0;
-
card++;
}
if (card == 0 ) {
@@ -707,7 +596,7 @@ static void awc_isa_release(void) {
unregister_netdev(aironet4500_devices[i]);
free_irq(aironet4500_devices[i]->irq,aironet4500_devices[i]);
kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+ kfree_s(aironet4500_devices[i], sizeof(struct net_device));
aironet4500_devices[i]=0;
@@ -906,7 +795,7 @@ int awc_i365_probe_once(struct i365_socket * s ){
static int awc_i365_init(struct i365_socket * s) {
- struct NET_DEVICE * dev;
+ struct net_device * dev;
int i;
@@ -923,11 +812,12 @@ static int awc_i365_init(struct i365_socket * s) {
dev->init = &awc_init;
dev->open = &awc_open;
dev->stop = &awc_close;
- dev->tbusy = 1;
- dev->start = 0;
dev->irq = s->irq;
dev->base_addr = s->io;
+ dev->tx_timeout = &awc_tx_timeout;
+ dev->watchdog_timeo = TX_TIMEOUT;
+ netif_start_queue (dev);
awc_private_init( dev);
@@ -943,24 +833,18 @@ static int awc_i365_init(struct i365_socket * s) {
awc_proc_set_fun(i);
}
- dev->tbusy = 1;
- dev->start = 0;
-
-
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "awc_cs: register_netdev() failed\n");
goto failed;
}
-
-
return 0;
failed:
return -1;
-
}
+
static void awc_i365_release(void) {
// long flags;
@@ -983,7 +867,7 @@ static void awc_i365_release(void) {
unregister_netdev(aironet4500_devices[i]);
//kfree_s(aironet4500_devices[i]->priv, sizeof(struct awc_private));
- kfree_s(aironet4500_devices[i], sizeof(struct NET_DEVICE));
+ kfree_s(aironet4500_devices[i], sizeof(struct net_device));
aironet4500_devices[i]=0;
diff --git a/drivers/net/aironet4500_core.c b/drivers/net/aironet4500_core.c
index 1b82d4715..205a43d97 100644
--- a/drivers/net/aironet4500_core.c
+++ b/drivers/net/aironet4500_core.c
@@ -72,7 +72,7 @@ const char * awc_print_string( struct awc_strings* strings, int code){
return "UNKNOWN";
};
-int awc_dump_registers(struct NET_DEVICE * dev){
+int awc_dump_registers(struct net_device * dev){
#ifdef AWC_DEBUG
int i;
@@ -108,7 +108,7 @@ int awc_dump_registers(struct NET_DEVICE * dev){
inline
-int awc_command_busy_clear_wait(struct NET_DEVICE * dev){
+int awc_command_busy_clear_wait(struct net_device * dev){
// long long jiff = jiffies;
u16 active_interrupts;
int cnt= 0;
@@ -319,7 +319,7 @@ awc_issue_command(struct awc_command * cmd){
inline
unsigned short
-awc_issue_command_no_ack(struct NET_DEVICE * dev,
+awc_issue_command_no_ack(struct net_device * dev,
u16 com, u16 par1, u16 par2, u16 par3){
struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -695,7 +695,7 @@ struct awc_rid_dir awc_rids_temp[]={
int
-awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){
+awc_readrid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf ){
struct awc_command cmd;
int sleep_state ;
@@ -728,7 +728,7 @@ awc_readrid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf ){
}
int
-awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){
+awc_writerid(struct net_device * dev, struct aironet4500_RID * rid, void *pBuf){
struct awc_command cmd;
int sleep_state ;
@@ -765,7 +765,7 @@ awc_writerid(struct NET_DEVICE * dev, struct aironet4500_RID * rid, void *pBuf){
}
int
-awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){
+awc_readrid_dir(struct net_device * dev, struct awc_rid_dir * rid ){
struct awc_command cmd;
int sleep_state;
@@ -798,7 +798,7 @@ awc_readrid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid ){
}
int
-awc_writerid_dir(struct NET_DEVICE * dev, struct awc_rid_dir * rid){
+awc_writerid_dir(struct net_device * dev, struct awc_rid_dir * rid){
struct awc_command cmd;
int sleep_state ;
@@ -847,7 +847,7 @@ EXPORT_SYMBOL(awc_writerid_dir);
inline
int
-awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){
+awc_issue_blocking_command(struct net_device * dev,u16 comm){
struct awc_command cmd;
// struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -872,7 +872,7 @@ awc_issue_blocking_command(struct NET_DEVICE * dev,u16 comm){
};
int
-awc_issue_soft_reset(struct NET_DEVICE * dev){
+awc_issue_soft_reset(struct net_device * dev){
u16 status ;
// int i= 0;
@@ -912,7 +912,7 @@ awc_issue_soft_reset(struct NET_DEVICE * dev){
};
int
-awc_issue_noop(struct NET_DEVICE * dev){
+awc_issue_noop(struct net_device * dev){
int retval;
AWC_OUT(dev->base_addr + 0x28, 0);
AWC_OUT(dev->base_addr + 0x2A, 0);
@@ -925,7 +925,7 @@ awc_issue_noop(struct NET_DEVICE * dev){
EXPORT_SYMBOL(awc_enable_MAC);
int
-awc_enable_MAC(struct NET_DEVICE * dev){
+awc_enable_MAC(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
AWC_ENTRY_EXIT_DEBUG(" entry awc_enable_MAC ");
@@ -950,7 +950,7 @@ awc_enable_MAC(struct NET_DEVICE * dev){
EXPORT_SYMBOL(awc_disable_MAC);
int
-awc_disable_MAC(struct NET_DEVICE * dev){
+awc_disable_MAC(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
AWC_ENTRY_EXIT_DEBUG(" entry awc_disable_MAC ");
@@ -973,7 +973,7 @@ awc_disable_MAC(struct NET_DEVICE * dev){
int
-awc_read_all_rids(struct NET_DEVICE * dev){
+awc_read_all_rids(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
int status,i;
@@ -992,7 +992,7 @@ awc_read_all_rids(struct NET_DEVICE * dev){
}
int
-awc_write_all_rids(struct NET_DEVICE * dev){
+awc_write_all_rids(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
int i,status ;
@@ -1012,7 +1012,7 @@ awc_write_all_rids(struct NET_DEVICE * dev){
-int awc_tx_alloc(struct NET_DEVICE * dev) {
+int awc_tx_alloc(struct net_device * dev) {
struct awc_command cmd;
int k=0;
@@ -1116,7 +1116,7 @@ int awc_tx_alloc(struct NET_DEVICE * dev) {
};
int
-awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){
+awc_tx_dealloc_fid(struct net_device * dev,struct awc_fid * fid){
struct awc_command cmd;
int fid_handle = 0;
@@ -1150,7 +1150,7 @@ awc_tx_dealloc_fid(struct NET_DEVICE * dev,struct awc_fid * fid){
};
int
-awc_tx_dealloc(struct NET_DEVICE * dev){
+awc_tx_dealloc(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -1177,7 +1177,7 @@ awc_tx_dealloc(struct NET_DEVICE * dev){
inline struct awc_fid *
-awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle){
+awc_tx_fid_lookup_and_remove(struct net_device * dev, u16 fid_handle){
struct awc_private * priv = (struct awc_private *)dev->priv;
// int k = 0;
@@ -1272,7 +1272,7 @@ awc_tx_fid_lookup_and_remove(struct NET_DEVICE * dev, u16 fid_handle){
int
-awc_queues_init(struct NET_DEVICE * dev){
+awc_queues_init(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
struct awc_fid * fid = NULL;
int retv =0;
@@ -1302,7 +1302,7 @@ awc_queues_init(struct NET_DEVICE * dev){
int
-awc_queues_destroy(struct NET_DEVICE * dev){
+awc_queues_destroy(struct net_device * dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
struct awc_fid * fid = NULL;
int retv =0;
@@ -1325,7 +1325,7 @@ awc_queues_destroy(struct NET_DEVICE * dev){
/****************************** 802.11router ******************/
inline int
-awc_802_11_copy_path_skb(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
+awc_802_11_copy_path_skb(struct net_device * dev, struct awc_fid * rx_buff){
struct awc_private * priv = (struct awc_private * )dev->priv;
@@ -1360,7 +1360,7 @@ awc_802_11_copy_path_skb(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
int
-awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
+awc_802_11_find_copy_path(struct net_device * dev, struct awc_fid * rx_buff){
// struct awc_private * priv = (struct awc_private * )dev->priv;
// u8 is_802_3 = 0;
@@ -1386,7 +1386,7 @@ awc_802_11_find_copy_path(struct NET_DEVICE * dev, struct awc_fid * rx_buff){
int parse_not_8023= 0;
void
-awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
+awc_802_11_router_rx(struct net_device * dev,struct awc_fid * rx_buff){
struct awc_private * priv = (struct awc_private * )dev->priv;
struct sk_buff * skb = rx_buff->skb;
@@ -1531,7 +1531,7 @@ awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
DEBUG(0x200,"%s packet dropped in packet hdr parse \n ",dev->name);
if (rx_buff->skb && (rx_buff->type & p80211copy_path_skb)){
- FREE_SKB(rx_buff->skb);
+ dev_kfree_skb_irq(rx_buff->skb);
rx_buff->skb = NULL;
rx_buff->u.rx.payload = NULL;
};
@@ -1541,13 +1541,13 @@ awc_802_11_router_rx(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
};
void
-awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
+awc_802_11_failed_rx_copy(struct net_device * dev,struct awc_fid * rx_buff){
struct awc_private * priv = (struct awc_private * )dev->priv;
AWC_ENTRY_EXIT_DEBUG("awc_802_11_failed_rx_copy");
if (rx_buff->skb)
- FREE_SKB(rx_buff->skb);
+ dev_kfree_skb_irq(rx_buff->skb);
rx_buff->skb = NULL;
rx_buff->u.rx.payload = NULL;
priv->stats.rx_errors++;
@@ -1566,7 +1566,7 @@ awc_802_11_failed_rx_copy(struct NET_DEVICE * dev,struct awc_fid * rx_buff){
int
-awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
+awc_802_11_tx_find_path_and_post(struct net_device * dev,
struct sk_buff * skb){
@@ -1750,10 +1750,6 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
udelay(1);
awc_transmit_packet(dev,fid);
UP(&priv->tx_buff_semaphore);
- if (priv->tx_large_ready.size > 0 ){
- dev->tbusy = 0;
- mark_bh(NET_BH);
- }
AWC_ENTRY_EXIT_DEBUG("exit\n");
return 0;
@@ -1763,7 +1759,7 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
#ifdef AWC_DEBUG
// printk("s");
#endif
- dev->tbusy = 1; //weell, here it must be set anyway and before
+ netif_stop_queue (dev); //weell, here it must be set anyway and before
//priv->stats.tx_fifo_errors++;
UP(&priv->tx_buff_semaphore);
AWC_ENTRY_EXIT_DEBUG("NoSpaceExit\n");
@@ -1771,9 +1767,7 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
final:
priv->stats.tx_errors++;
UP(&priv->tx_buff_semaphore);
- dev->tbusy = 0;
- FREE_SKB(skb);
- mark_bh(NET_BH);
+ dev_kfree_skb(skb);
AWC_ENTRY_EXIT_DEBUG("BADExit\n");
return -1;
@@ -1788,7 +1782,7 @@ awc_802_11_tx_find_path_and_post(struct NET_DEVICE * dev,
void
-awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev,
+awc_802_11_after_tx_packet_to_card_write(struct net_device * dev,
struct awc_fid * tx_buff){
@@ -1799,10 +1793,10 @@ awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev,
};
if(tx_buff->skb){
- FREE_SKB(tx_buff->skb);
+ dev_kfree_skb(tx_buff->skb);
tx_buff->skb = NULL;
}
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
AWC_ENTRY_EXIT_DEBUG("exit\n");
};
@@ -1815,7 +1809,7 @@ awc_802_11_after_tx_packet_to_card_write(struct NET_DEVICE * dev,
*/
void
-awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,
+awc_802_11_after_failed_tx_packet_to_card_write(struct net_device * dev,
struct awc_fid * tx_buff){
struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -1827,7 +1821,7 @@ awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,
};
if(tx_buff->skb){
- FREE_SKB(tx_buff->skb);
+ dev_kfree_skb(tx_buff->skb);
tx_buff->skb = NULL;
tx_buff->busy =0;
printk(KERN_ERR "%s packet to card write failed \n",dev->name);
@@ -1845,7 +1839,7 @@ awc_802_11_after_failed_tx_packet_to_card_write(struct NET_DEVICE * dev,
};
void
-awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){
+awc_802_11_after_tx_complete(struct net_device * dev, struct awc_fid * tx_buff){
struct awc_private * priv = (struct awc_private *)dev->priv;
@@ -1866,8 +1860,7 @@ awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){
}
tx_buff->busy = 0;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
AWC_ENTRY_EXIT_DEBUG("exit\n");
};
@@ -1880,7 +1873,7 @@ awc_802_11_after_tx_complete(struct NET_DEVICE * dev, struct awc_fid * tx_buff){
inline int
-awc_receive_packet(struct NET_DEVICE * dev){
+awc_receive_packet(struct net_device * dev){
struct awc_command cmd;
u16 Fid;
@@ -2010,7 +2003,7 @@ awc_receive_packet(struct NET_DEVICE * dev){
int
-awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) {
+awc_transmit_packet(struct net_device * dev, struct awc_fid * tx_buff) {
struct awc_command cmd;
u16 size ;
@@ -2143,7 +2136,7 @@ awc_transmit_packet(struct NET_DEVICE * dev, struct awc_fid * tx_buff) {
inline int
-awc_tx_complete_check(struct NET_DEVICE * dev){
+awc_tx_complete_check(struct net_device * dev){
struct awc_fid * fid;
struct awc_command cmd;
@@ -2197,7 +2190,7 @@ awc_tx_complete_check(struct NET_DEVICE * dev){
void
-awc_bh(struct NET_DEVICE *dev){
+awc_bh(struct net_device *dev){
struct awc_private * priv = (struct awc_private *)dev->priv;
int active_interrupts;
@@ -2226,8 +2219,7 @@ start:
if (active_interrupts == 0xffff){
printk(KERN_CRIT "%s device ejected in interrupt, disabling\n",dev->name);
- dev->tbusy = 1;
- dev->start = 0;
+ netif_device_detach (dev);
if (priv->command_semaphore_on){
priv->command_semaphore_on--;
AWC_UNLOCK_COMMAND_ISSUING(priv);
@@ -2286,7 +2278,7 @@ start:
inline int
-awc_interrupt_process(struct NET_DEVICE * dev){
+awc_interrupt_process(struct net_device * dev){
struct awc_private * priv ;
int active_interrupts;
@@ -2327,10 +2319,6 @@ awc_interrupt_process(struct NET_DEVICE * dev){
// printk("ikka interruptis\n");
- if (test_and_set_bit( 0, (void *) &dev->interrupt) ) {
- printk("RI\n");
- goto reenter_end_here;
- }
priv->interrupt_count++;
if (priv->interrupt_count > 1 )
printk(" interrupt count on\n ");
@@ -2354,12 +2342,10 @@ start:
printk(KERN_CRIT "%s device ejected, got interrupt, disabling\n",dev->name);
//priv->
- dev->tbusy = 1;
- dev->start = 0;
+ netif_device_detach (dev);
priv->ejected = 1;
if (priv->bh_active || priv->bh_running){
priv->interrupt_count--;
- dev->interrupt = 0;
goto bad_end;
} else if (priv->command_semaphore_on){
@@ -2368,7 +2354,6 @@ start:
AWC_QUEUE_BH;
}
priv->interrupt_count--;
- dev->interrupt = 0;
goto bad_end;
}
@@ -2458,8 +2443,7 @@ start:
awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
else
awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
}
} else
printk(KERN_ERR "awc fid %x not found\n",tx_fid);
@@ -2502,7 +2486,6 @@ start:
priv->interrupt_count--;
- dev->interrupt = 0;
awc_ints_enable(dev->base_addr, 0x0000);
@@ -2523,15 +2506,8 @@ start:
// restore_flags(flags);
return 0;
-reenter_end_here:
-
- AWC_ENTRY_EXIT_DEBUG(" reenter-bad end exit \n");
-// enable_irq(dev->irq);
-// restore_flags(flags);
- return 0;
bad_end:
- dev->interrupt = 0;
AWC_ENTRY_EXIT_DEBUG(" bad_end exit \n");
// enable_irq(dev->irq);
// restore_flags(flags);
@@ -2543,7 +2519,7 @@ bad_end:
static const char *aironet4500_core_version =
"aironet4500.c v0.1 1/1/99 Elmer Joandi, elmer@ylenurme.ee.\n";
-struct NET_DEVICE * aironet4500_devices[MAX_AWCS] = {NULL,NULL,NULL,NULL};
+struct net_device * aironet4500_devices[MAX_AWCS] = {NULL,NULL,NULL,NULL};
static int awc_debug = 0; // 0xffffff;
static int p802_11_send = 0; // 1
@@ -2595,7 +2571,6 @@ EXPORT_SYMBOL(awc_debug);
EXPORT_SYMBOL(awc_private_init);
EXPORT_SYMBOL(awc_tx_timeout);
EXPORT_SYMBOL(awc_start_xmit);
-EXPORT_SYMBOL(awc_tx_done);
EXPORT_SYMBOL(awc_rx);
EXPORT_SYMBOL(awc_interrupt);
EXPORT_SYMBOL(awc_get_stats);
@@ -2611,7 +2586,7 @@ EXPORT_SYMBOL(awc_unregister_proc);
/*************************** RESET INIT CONFIG ***********************/
- void awc_reset(struct NET_DEVICE *dev)
+ void awc_reset(struct net_device *dev)
{
long long jiff;
@@ -2633,7 +2608,7 @@ EXPORT_SYMBOL(awc_unregister_proc);
}
- int awc_config(struct NET_DEVICE *dev)
+ int awc_config(struct net_device *dev)
{
// struct awc_private *priv = (struct awc_private *)dev->priv;
@@ -2654,7 +2629,7 @@ EXPORT_SYMBOL(awc_unregister_proc);
char name[] = "ElmerLinux";
- int awc_init(struct NET_DEVICE *dev){
+ int awc_init(struct net_device *dev){
struct awc_private *priv = (struct awc_private *)dev->priv;
int i;
const char * radioType;
@@ -2785,8 +2760,6 @@ char name[] = "ElmerLinux";
// here we go, bad aironet
memset(&priv->SSIDs,0,sizeof(priv->SSIDs));
- my_spin_lock_init(&priv->queues_lock);
-
priv->SSIDs.ridLen =0;
if (!SSID) {
priv->SSIDs.SSID[0].SSID[0] ='a';
@@ -2834,7 +2807,7 @@ char name[] = "ElmerLinux";
};
-int awc_private_init(struct NET_DEVICE * dev){
+int awc_private_init(struct net_device * dev){
struct awc_private * priv = (struct awc_private *) dev->priv;
int i = 0;
@@ -2906,7 +2879,6 @@ int awc_private_init(struct NET_DEVICE * dev){
priv->ejected =0;
- dev->interrupt =0;
priv->interrupt_count =0;
return 0;
@@ -2916,7 +2888,7 @@ int awc_private_init(struct NET_DEVICE * dev){
/**************************** OPEN CLOSE **********************/
- int awc_open(struct NET_DEVICE *dev)
+ int awc_open(struct net_device *dev)
{
struct awc_private *priv = (struct awc_private *)dev->priv;
@@ -2924,9 +2896,6 @@ int awc_private_init(struct NET_DEVICE * dev){
DEBUG(2, "%s: awc_open \n", dev->name);
- dev->interrupt = 0; dev->tbusy = 1; dev->start = 0;
-
-
if( awc_queues_init(dev) ) goto final;
if( awc_config(dev) ) goto final;
@@ -2945,24 +2914,23 @@ int awc_private_init(struct NET_DEVICE * dev){
MOD_INC_USE_COUNT;
// kernel_thread(awc_thread,dev,0);
- dev->tbusy = 0; dev->start = 1;
+ netif_start_queue (dev);
return 0; /* Always succeed */
final:
- dev->tbusy = 0; dev->start = 0;
+ netif_device_detach (dev);
printk(KERN_ERR "aironet open failed \n");
return -1;
}
- int awc_close(struct NET_DEVICE *dev)
+ int awc_close(struct net_device *dev)
{
struct awc_private * priv = (struct awc_private *) dev->priv;
DEBUG(2, "%s: closing device.\n", dev->name);
- dev->start = 0;
- dev->tbusy=1;
+ netif_stop_queue (dev);
awc_disable_MAC(dev);
awc_queues_destroy(dev);
@@ -2986,32 +2954,58 @@ int awc_private_init(struct NET_DEVICE * dev){
- void awc_tx_timeout(struct NET_DEVICE *dev)
+void awc_tx_timeout (struct net_device *dev)
{
- struct awc_private *priv = (struct awc_private *)dev->priv;
+ struct awc_private *priv = (struct awc_private *) dev->priv;
+ struct awc_fid * fid;
+ int cnt;
- DEBUG(2, "%s: awc_tx_timeout \n", dev->name);
+ DEBUG (2, "%s: awc_tx_timeout \n", dev->name);
- printk(KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d \n ",
- dev->name,priv->tx_small_buffs_total ,priv->tx_buffs_total,
- priv->tx_in_transmit.size,priv->tx_post_process.size,
- priv->tx_large_ready.size,priv->tx_small_ready.size);
+ printk (KERN_NOTICE "%s: Transmit timed out , buffs %d %d, queues tx %d pp %d lrg %d sm %d \n ",
+ dev->name, priv->tx_small_buffs_total, priv->tx_buffs_total,
+ priv->tx_in_transmit.size, priv->tx_post_process.size,
+ priv->tx_large_ready.size, priv->tx_small_ready.size);
priv->stats.tx_errors++;
+ // save_flags(flags);
+ // cli();
+ fid = priv->tx_in_transmit.head;
+ cnt = 0;
+ while (fid) {
+ if (jiffies - fid->transmit_start_time > (HZ)) {
+ // printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name,
+ // jiffies - fid->transmit_start_time );
+ awc_fid_queue_remove (&priv->tx_in_transmit, fid);
+ if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
+ awc_fid_queue_push_tail (&priv->tx_small_ready, fid);
+ else
+ awc_fid_queue_push_tail (&priv->tx_large_ready, fid);
+ }
+ fid = fid->next;
+ if (cnt++ > 200) {
+ printk ("bbb in awc_fid_queue\n");
+ // restore_flags(flags);
+ return;
+ };
+
+ }
+ //restore_flags(flags);
+ //debug =0x8;
+
dev->trans_start = jiffies;
- dev->tbusy = 0;
+ netif_start_queue (dev);
}
+
long long last_tx_q_hack = 0;
int direction = 1;
- int awc_start_xmit(struct sk_buff *skb, struct NET_DEVICE *dev) {
+ int awc_start_xmit(struct sk_buff *skb, struct net_device *dev) {
struct awc_private *priv = (struct awc_private *)dev->priv;
int retval = 0;
// unsigned long flags;
- struct awc_fid * fid = NULL;
- int cnt=0;
DEBUG(2, "%s: awc_start_xmit \n", dev->name);
@@ -3021,48 +3015,13 @@ int direction = 1;
return -1;
};
- /* Transmitter timeout, serious problems. */
- if (test_and_set_bit( 0, (void *) &dev->tbusy) ) {
- if (jiffies - dev->trans_start > 3* HZ ){
- // save_flags(flags);
- // cli();
- fid = priv->tx_in_transmit.head;
- cnt = 0;
- while (fid){
- if (jiffies - fid->transmit_start_time > (HZ)){
- // printk(KERN_ERR "%s staled tx_buff found, age %uld jiffies\n",dev->name,
- // jiffies - fid->transmit_start_time );
- awc_fid_queue_remove(&priv->tx_in_transmit, fid);
- if (fid->u.tx.fid_size <= AWC_TX_ALLOC_SMALL_SIZE)
- awc_fid_queue_push_tail(&priv->tx_small_ready,fid);
- else
- awc_fid_queue_push_tail(&priv->tx_large_ready,fid);
- dev->tbusy = 0;
- }
- fid = fid->next;
- if (cnt++ > 200) {
- printk("bbb in awc_fid_queue\n");
- // restore_flags(flags);
- return -1;
- };
-
- }
- //restore_flags(flags);
- //debug =0x8;
- };
- if (jiffies - dev->trans_start >= (5* HZ) ) {
- awc_tx_timeout(dev);
- }
- return 1;
- }
-
if (!skb) {
DEBUG(1, " xmit skb=NULL, jiffie %ld \n",jiffies);
return -1;
};
if (test_and_set_bit( 0, (void *) &priv->tx_chain_active) ) {
- dev->tbusy=0;
+ netif_start_queue (dev);
return 1;
}
@@ -3075,15 +3034,7 @@ int direction = 1;
return retval;
}
-int awc_tx_done(struct awc_fid * rx_fid){
-
-// dev->tbusy = 0;
- mark_bh(NET_BH);
-
- return 0;
-};
-
-int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
+int awc_rx(struct net_device *dev, struct awc_fid * rx_fid) {
// struct awc_private *lp = (struct awc_private *)dev->priv;
@@ -3109,7 +3060,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
void awc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- struct NET_DEVICE *dev = (struct NET_DEVICE *)dev_id;
+ struct net_device *dev = (struct net_device *)dev_id;
// struct awc_private *lp;
// unsigned long flags;
@@ -3133,7 +3084,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
- struct enet_statistics *awc_get_stats(struct NET_DEVICE *dev)
+ struct enet_statistics *awc_get_stats(struct net_device *dev)
{
struct awc_private *priv = (struct awc_private *)dev->priv;
// unsigned long flags;
@@ -3142,7 +3093,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
DEBUG(2, "%s: awc_get_stats \n", dev->name);
- if (!dev->start) {
+ if (!netif_running(dev)) {
return 0;
}
// save_flags(flags);
@@ -3175,7 +3126,7 @@ int awc_rx(struct NET_DEVICE *dev, struct awc_fid * rx_fid) {
}
-int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){
+int awc_change_mtu(struct net_device *dev, int new_mtu){
// struct awc_private *priv = (struct awc_private *)dev->priv;
// unsigned long flags;
@@ -3183,7 +3134,7 @@ int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){
if ((new_mtu < 256 ) || (new_mtu > 2312) || (max_mtu && new_mtu > max_mtu) )
return -EINVAL;
- if (dev->start) {
+ if (netif_running(dev)) {
printk("PLEASE, ifconfig %s down for mtu change\n",dev->name);
};
@@ -3207,7 +3158,7 @@ int awc_change_mtu(struct NET_DEVICE *dev, int new_mtu){
void
-awc_set_multicast_list(struct NET_DEVICE *dev) {
+awc_set_multicast_list(struct net_device *dev) {
// int ioaddr = dev->base_addr;
/* if (dev->flags & IFF_PROMISC)
diff --git a/drivers/net/aironet4500_proc.c b/drivers/net/aironet4500_proc.c
index 2b28f1a63..b9da62ab7 100644
--- a/drivers/net/aironet4500_proc.c
+++ b/drivers/net/aironet4500_proc.c
@@ -264,7 +264,7 @@ int awc_proc_fun(ctl_table *ctl, int write, struct file * filp,
struct awc_rid_dir * rid_dir;
- struct NET_DEVICE * dev= NULL;
+ struct net_device * dev= NULL;
struct aironet4500_RID * rid = (struct aironet4500_RID * ) ctl->extra2;
diff --git a/drivers/net/aironet4500_rid.c b/drivers/net/aironet4500_rid.c
index f1fb95dd6..7d52269f9 100644
--- a/drivers/net/aironet4500_rid.c
+++ b/drivers/net/aironet4500_rid.c
@@ -2134,7 +2134,7 @@ struct awc_rid_dir awc_rids[]={
int awc_nof_rids = (sizeof(awc_rids) / sizeof(struct awc_rid_dir)) -1;
-int awc_rids_setup(struct NET_DEVICE * dev){
+int awc_rids_setup(struct net_device * dev){
struct awc_private * priv = (struct awc_private *) dev->priv;
int i=0;
diff --git a/drivers/net/am79c961a.c b/drivers/net/am79c961a.c
index cfb48ca03..9c00c4cbd 100644
--- a/drivers/net/am79c961a.c
+++ b/drivers/net/am79c961a.c
@@ -20,13 +20,13 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
+#include <linux/delay.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/ecard.h>
-#include <asm/delay.h>
#define TX_BUFFERS 15
#define RX_BUFFERS 25
diff --git a/drivers/net/arlan.c b/drivers/net/arlan.c
index d2a02efcb..0e3b982fe 100644
--- a/drivers/net/arlan.c
+++ b/drivers/net/arlan.c
@@ -102,6 +102,7 @@ static int arlan_hw_config (struct net_device * dev);
static void arlan_tx_done_interrupt (struct net_device * dev, int status);
static void arlan_rx_interrupt (struct net_device * dev, u_char rxStatus, u_short, u_short);
static void arlan_process_interrupt (struct net_device * dev);
+static void arlan_tx_timeout (struct net_device *dev);
int arlan_command(struct net_device * dev, int command);
EXPORT_SYMBOL(arlan_command);
@@ -182,10 +183,7 @@ extern inline int arlan_drop_tx(struct net_device *dev)
priv->txOffset = 0;
priv->bad = 0;
if (!priv->under_reset && !priv->under_config)
- {
- dev->tbusy = 0;
- mark_bh(NET_BH);
- }
+ netif_wake_queue (dev);
}
return 1;
};
@@ -288,15 +286,9 @@ int arlan_command(struct net_device *dev, int command_p)
}
}
if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
- {
priv->under_reset = 1;
- dev->start = 0;
- }
if (priv->waiting_command_mask & ARLAN_COMMAND_CONF)
- {
priv->under_config = 1;
- dev->start = 0;
- }
/* Issuing command */
arlan_lock_card_access(dev);
@@ -341,14 +333,14 @@ int arlan_command(struct net_device *dev, int command_p)
else if (priv->waiting_command_mask & ARLAN_COMMAND_RESET)
{
priv->under_reset=1;
- dev->tbusy = 1;
+ netif_stop_queue (dev);
arlan_drop_tx(dev);
if (priv->tx_command_given || priv->rx_command_given)
{
printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
};
- dev->tbusy = 1;
+ netif_stop_queue (dev);
if (arlan_debug & ARLAN_DEBUG_RESET)
printk(KERN_ERR "%s: Doing chip reset\n", dev->name);
priv->lastReset = jiffies;
@@ -388,7 +380,6 @@ int arlan_command(struct net_device *dev, int command_p)
{
printk(KERN_ERR "%s: Reset under tx or rx command \n", dev->name);
}
- dev->start = 0;
arlan_drop_tx(dev);
setInterruptEnable(dev);
arlan_hw_config(dev);
@@ -437,13 +428,11 @@ int arlan_command(struct net_device *dev, int command_p)
}
else if (priv->waiting_command_mask & ARLAN_COMMAND_TBUSY_CLEAR)
{
- if ( !registrationBad(dev) && (dev->tbusy || !dev->start) )
+ if ( !registrationBad(dev) &&
+ (netif_queue_stopped(dev) || !netif_running(dev)) )
{
priv->waiting_command_mask &= ~ARLAN_COMMAND_TBUSY_CLEAR;
-
- dev->tbusy = 0;
- dev->start = 1;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
};
}
else if (priv->waiting_command_mask & ARLAN_COMMAND_TX)
@@ -587,8 +576,7 @@ extern inline void arlan_retransmit_now(struct net_device *dev)
else
IFDEBUG(ARLAN_DEBUG_TX_CHAIN) printk(KERN_ERR "ReTransmit buff empty");
priv->txOffset = 0;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
return;
}
@@ -650,11 +638,8 @@ static void arlan_registration_timer(unsigned long data)
priv->registrationLastSeen = jiffies;
priv->registrationLostCount = 0;
priv->reRegisterExp = 1;
- if (dev->start == 0)
- {
- dev->start = 1;
- mark_bh(NET_BH);
- }
+ if (!netif_running(dev))
+ netif_wake_queue(dev);
}
@@ -682,8 +667,7 @@ static void arlan_registration_timer(unsigned long data)
if (!(TXHEAD(dev).offset && TXTAIL(dev).offset))
{
priv->txOffset = 0;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
}
priv->tx_done_delayed = 0;
bh_mark_needed = 1;
@@ -691,8 +675,7 @@ static void arlan_registration_timer(unsigned long data)
if (bh_mark_needed)
{
priv->txOffset = 0;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
}
arlan_process_interrupt(dev);
@@ -788,7 +771,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
}
else
{
- dev->tbusy = 1;
+ netif_stop_queue (dev);
return -1;
IFDEBUG(ARLAN_DEBUG_TX_CHAIN)
printk(KERN_ERR "TX TAIL & HEAD full, return, tailStart %d headEnd %d\n", tailStarts, headEnds);
@@ -811,11 +794,11 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
}
if (TXHEAD(dev).offset && TXTAIL(dev).offset)
{
- dev->tbusy = 1;
+ netif_stop_queue (dev);
return 0;
}
else
- dev->tbusy = 0;
+ netif_start_queue (dev);
IFDEBUG(ARLAN_DEBUG_HEADER_DUMP)
@@ -1161,7 +1144,7 @@ static int arlan_mac_addr(struct net_device *dev, void *p)
ARLAN_DEBUG_ENTRY("arlan_mac_addr");
return -EINVAL;
- if (dev->start)
+ if (!netif_running(dev))
return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
@@ -1223,8 +1206,8 @@ static int __init
dev->set_multicast_list = arlan_set_multicast;
dev->change_mtu = arlan_change_mtu;
dev->set_mac_address = arlan_mac_addr;
- dev->tbusy = 1;
- dev->start = 0;
+ dev->tx_timeout = arlan_tx_timeout;
+ dev->watchdog_timeo = 3*HZ;
((struct arlan_private *) dev->priv)->irq_test_done = 0;
arlan_device[num] = dev;
@@ -1302,14 +1285,13 @@ static int arlan_open(struct net_device *dev)
priv->open_time = jiffies;
memcpy_fromio(dev->dev_addr, arlan->lanCardNodeId, 6);
memset(dev->broadcast, 0xff, 6);
- dev->tbusy = 1;
priv->txOffset = 0;
- dev->interrupt = 0;
- dev->start = 0;
dev->tx_queue_len = tx_queue_len;
priv->interrupt_processing_active = 0;
priv->command_lock = 0;
+ netif_start_queue (dev);
+
init_MUTEX(&priv->card_lock);
myATOMIC_INIT(priv->card_users, 1); /* damn 2.0.33 */
priv->registrationLostCount = 0;
@@ -1327,7 +1309,6 @@ static int arlan_open(struct net_device *dev)
priv->Conf->writeEEPROM = 0;
priv->Conf->registrationInterrupts = 1;
- dev->tbusy = 0;
init_timer(&priv->timer);
priv->timer.expires = jiffies + HZ / 10;
priv->timer.data = (unsigned long) dev;
@@ -1335,8 +1316,6 @@ static int arlan_open(struct net_device *dev)
arlan_command(dev, ARLAN_COMMAND_POWERUP | ARLAN_COMMAND_LONG_WAIT_NOW);
udelay(200000);
- dev->tbusy = 0;
- dev->start = 1;
add_timer(&priv->timer);
MOD_INC_USE_COUNT;
@@ -1351,69 +1330,43 @@ static int arlan_open(struct net_device *dev)
}
+static void arlan_tx_timeout (struct net_device *dev)
+{
+ printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name);
+ /* Try to restart the adaptor. */
+ arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
+ dev->trans_start = jiffies;
+ netif_start_queue (dev);
+}
static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
{
struct arlan_private *priv = ((struct arlan_private *) dev->priv);
- struct arlan_conf_stru *conf = ((struct arlan_private *) dev->priv)->Conf;
+ short length;
+ unsigned char *buf;
ARLAN_DEBUG_ENTRY("arlan_tx");
-
- if (dev->tbusy)
- {
- /*
- * 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 * 1000) / HZ) * 2 > conf->txTimeoutMs)
- arlan_command(dev, ARLAN_COMMAND_TX_ABORT);
-
- if (((tickssofar * 1000) / HZ) < conf->txTimeoutMs)
- {
- // up(&priv->card_lock);
- goto bad_end;
- }
- printk(KERN_ERR "%s: arlan transmit timed out, kernel decided\n", dev->name);
- /* Try to restart the adaptor. */
- arlan_command(dev, ARLAN_COMMAND_CLEAN_AND_RESET);
- dev->trans_start = jiffies;
- goto bad_end;
-
- }
+
/*
- * Block a timer-based transmit from overlapping. This could better be
- * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
+ * If some higher layer thinks we've missed an tx-done interrupt
+ * we are passed NULL. Caution: dev_tint() handles the cli()/sti()
+ * itself.
*/
- if (test_and_set_bit(0, (void *) &dev->tbusy) != 0)
- {
- printk(KERN_ERR "%s: Transmitter access conflict.\n",
- dev->name);
- }
- else
- {
- short length;
- unsigned char *buf;
-
- /*
- * If some higher layer thinks we've missed an tx-done interrupt
- * we are passed NULL. Caution: dev_tint() handles the cli()/sti()
- * itself.
- */
- length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
- buf = skb->data;
+ length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
+ buf = skb->data;
+
+ if (priv->txOffset + length + 0x12 > 0x800) {
+ printk(KERN_ERR "TX RING overflow \n");
+ netif_stop_queue (dev);
+ }
- if (priv->txOffset + length + 0x12 > 0x800)
- printk(KERN_ERR "TX RING overflow \n");
+ if (arlan_hw_tx(dev, buf, length) == -1)
+ goto bad_end;
- if (arlan_hw_tx(dev, buf, length) == -1)
- goto bad_end;
+ dev->trans_start = jiffies;
- dev->trans_start = jiffies;
- }
dev_kfree_skb(skb);
arlan_process_interrupt(dev);
@@ -1424,6 +1377,7 @@ static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
bad_end:
arlan_process_interrupt(dev);
priv->tx_chain_active = 0;
+ netif_stop_queue (dev);
ARLAN_DEBUG_EXIT("arlan_tx");
return 1;
}
@@ -1522,8 +1476,7 @@ static void arlan_tx_done_interrupt(struct net_device *dev, int status)
if (!TXHEAD(dev).offset || !TXTAIL(dev).offset)
{
priv->txOffset = 0;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue (dev);
}
}
}
@@ -1852,15 +1805,12 @@ static void arlan_process_interrupt(struct net_device *dev)
WRITESHMB(arlan->rxStatus, 0x00);
arlan_command(dev, ARLAN_COMMAND_RX);
if (registrationBad(dev))
- dev->start = 0;
+ netif_device_detach(dev);
if (!registrationBad(dev))
{
priv->registrationLastSeen = jiffies;
- if (!dev->tbusy && !priv->under_reset && !priv->under_config)
- {
- mark_bh(NET_BH);
- dev->start = 1;
- }
+ if (!netif_queue_stopped(dev) && !priv->under_reset && !priv->under_config)
+ netif_wake_queue (dev);
}
goto ends;
}
@@ -1900,12 +1850,10 @@ static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (!rxStatus && !txStatus)
priv->interrupt_ack_requested++;
- dev->interrupt++;
arlan_process_interrupt(dev);
priv->irq_test_done = 1;
- dev->interrupt--;
ARLAN_DEBUG_EXIT("arlan_interrupt");
return;
@@ -1938,8 +1886,7 @@ static int arlan_close(struct net_device *dev)
printk(KERN_NOTICE "%s: Closing device\n", dev->name);
priv->open_time = 0;
- dev->tbusy = 1;
- dev->start = 0;
+ netif_stop_queue(dev);
free_irq(dev->irq, dev);
MOD_DEC_USE_COUNT;
diff --git a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c
index 785a3fafd..28d50eb8c 100644
--- a/drivers/net/fc/iph5526.c
+++ b/drivers/net/fc/iph5526.c
@@ -218,6 +218,7 @@ static void update_scsi_oxid(struct fc_info *fi);
Scsi_Host_Template driver_template = IPH5526_SCSI_FC;
+static void iph5526_timeout(struct net_device *dev);
#ifdef CONFIG_PCI
static int iph5526_probe_pci(struct net_device *dev);
@@ -286,6 +287,8 @@ static int __init fcdev_init(struct net_device *dev)
dev->get_stats = iph5526_get_stats;
dev->set_multicast_list = NULL;
dev->change_mtu = iph5526_change_mtu;
+ dev->tx_timeout = iph5526_timeout;
+ dev->watchdog_timeo = 5*HZ;
#ifndef MODULE
fc_setup(dev);
#endif
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 10b249b4e..c55556cc9 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -320,16 +320,14 @@ static void ax_changedmtu(struct ax_disp *ax)
/* Set the "sending" flag. This must be atomic, hence the ASM. */
static inline void ax_lock(struct ax_disp *ax)
{
- if (test_and_set_bit(0, (void *)&ax->dev->tbusy))
- printk(KERN_ERR "mkiss: %s: trying to lock already locked device!\n", ax->dev->name);
+ netif_stop_queue(ax->dev);
}
/* Clear the "sending" flag. This must be atomic, hence the ASM. */
static inline void ax_unlock(struct ax_disp *ax)
{
- if (!test_and_clear_bit(0, (void *)&ax->dev->tbusy))
- printk(KERN_ERR "mkiss: %s: trying to unlock already unlocked device!\n", ax->dev->name);
+ netif_start_queue(ax->dev);
}
/* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
@@ -435,7 +433,7 @@ static void ax25_write_wakeup(struct tty_struct *tty)
struct mkiss_channel *mkiss;
/* First make sure we're connected. */
- if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start)
+ if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev))
return;
if (ax->xleft <= 0) {
/* Now serial buffer is almost free & we can start
@@ -449,8 +447,7 @@ static void ax25_write_wakeup(struct tty_struct *tty)
ax_unlock(ax->mkiss);
}
- ax_unlock(ax);
- mark_bh(NET_BH);
+ netif_wake_queue(ax->dev);
return;
}
@@ -474,22 +471,22 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev)
tmp_ax = ax->mkiss;
}
- if (!dev->start) {
+ if (!netif_running(dev)) {
printk(KERN_ERR "mkiss: %s: xmit call when iface is down\n", dev->name);
return 1;
}
if (tmp_ax != NULL)
- if (tmp_ax->dev->tbusy)
+ if (netif_queue_stopped(tmp_ax->dev))
return 1;
if (tmp_ax != NULL)
- if (dev->tbusy) {
+ if (netif_queue_stopped(dev)) {
printk(KERN_ERR "mkiss: dev busy while serial dev is free\n");
ax_unlock(ax);
}
- if (dev->tbusy) {
+ if (netif_queue_stopped(dev)) {
/*
* May be we must check transmitter timeout here ?
* 14 Oct 1994 Dmitry Gorodchanin.
@@ -583,9 +580,8 @@ static int ax_open(struct net_device *dev)
ax->xleft = 0;
ax->flags &= (1 << AXF_INUSE); /* Clear ESCAPE & ERROR flags */
- dev->tbusy = 0;
- dev->start = 1;
+ netif_start_queue(dev);
return 0;
/* Cleanup */
@@ -609,8 +605,7 @@ static int ax_close(struct net_device *dev)
ax->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
- dev->tbusy = 1;
- dev->start = 0;
+ netif_stop_queue(dev);
return 0;
}
@@ -630,7 +625,7 @@ static void ax25_receive_buf(struct tty_struct *tty, const unsigned char *cp, ch
{
struct ax_disp *ax = (struct ax_disp *)tty->disc_data;
- if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start)
+ if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev))
return;
/*
@@ -691,7 +686,7 @@ static int ax25_open(struct tty_struct *tty)
if (mkiss->magic == MKISS_DRIVER_MAGIC) {
for (cnt = 1; cnt < ax25_maxdev; cnt++) {
if (ax25_ctrls[cnt]) {
- if (ax25_ctrls[cnt]->dev.start) {
+ if (netif_running(&ax25_ctrls[cnt]->dev)) {
if (ax == &ax25_ctrls[cnt]->ctrl) {
cnt--;
tmp_ax = &ax25_ctrls[cnt]->ctrl;
@@ -802,7 +797,7 @@ int kiss_esc(unsigned char *s, unsigned char *d, int len)
static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc, int len)
{
unsigned char *ptr = d;
- unsigned char c;
+ unsigned char c=0;
*ptr++ = END;
while (len > 0) {
@@ -1221,7 +1216,7 @@ void cleanup_module(void)
* VSV = if dev->start==0, then device
* unregistred while close proc.
*/
- if (ax25_ctrls[i]->dev.start)
+ if (netif_running(&ax25_ctrls[i]->dev))
unregister_netdev(&(ax25_ctrls[i]->dev));
kfree(ax25_ctrls[i]);
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 94645b12d..185af1262 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -48,7 +48,6 @@
* - Use hardware checksums.
* - Convert to using the PCI infrastructure / IOC3 meta driver.
*/
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 7a6cc5091..2dd149bf1 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -6,7 +6,7 @@
* Status: Stable.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Nov 7 21:43:15 1998
- * Modified at: Fri Feb 18 01:48:51 2000
+ * Modified at: Wed Mar 1 11:29:34 2000
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-2000 Dag Brattli <dagb@cs.uit.no>
@@ -715,9 +715,9 @@ static int nsc_ircc_setup(chipio_t *info)
switch_bank(iobase, BANK2);
outb(EXCR2_RFSIZ|EXCR2_TFSIZ, iobase+EXCR2);
- /* IRCR2: FEND_MD is set */
+ /* IRCR2: FEND_MD is not set */
switch_bank(iobase, BANK5);
- outb(0x2a, iobase+4);
+ outb(0x02, iobase+4);
/* Make sure that some defaults are OK */
switch_bank(iobase, BANK6);
diff --git a/drivers/net/pcmcia/aironet4500_cs.c b/drivers/net/pcmcia/aironet4500_cs.c
index 2acd2e46a..5d72f7778 100644
--- a/drivers/net/pcmcia/aironet4500_cs.c
+++ b/drivers/net/pcmcia/aironet4500_cs.c
@@ -112,13 +112,13 @@ static void flush_stale_links(void)
by the net software, because we only register already-found cards.
*/
-static int awc_pcmcia_init(struct NET_DEVICE *dev)
+static int awc_pcmcia_init(struct net_device *dev)
{
return awc_init(dev);
}
-static int awc_pcmcia_open(struct NET_DEVICE *dev)
+static int awc_pcmcia_open(struct net_device *dev)
{
dev_link_t *link;
int status;
@@ -136,7 +136,7 @@ static int awc_pcmcia_open(struct NET_DEVICE *dev)
return status;
}
-static int awc_pcmcia_close(struct NET_DEVICE *dev)
+static int awc_pcmcia_close(struct net_device *dev)
{
// int ioaddr = dev->base_addr;
dev_link_t *link;
@@ -170,7 +170,7 @@ static dev_link_t *awc_attach(void)
{
client_reg_t client_reg;
dev_link_t *link = NULL;
- struct NET_DEVICE *dev = NULL;
+ struct net_device *dev = NULL;
int ret;
PC_DEBUG(0, "awc_attach()\n");
@@ -199,8 +199,8 @@ static dev_link_t *awc_attach(void)
/* Create the network device object. */
- dev = kmalloc(sizeof(struct NET_DEVICE ), GFP_KERNEL);
- memset(dev,0,sizeof(struct NET_DEVICE));
+ dev = kmalloc(sizeof(struct net_device ), GFP_KERNEL);
+ memset(dev,0,sizeof(struct net_device));
// dev = init_etherdev(0, sizeof(struct awc_private) );
if (!dev ) {
printk(KERN_CRIT "out of mem on dev alloc \n");
@@ -321,10 +321,10 @@ static void awc_detach(dev_link_t *link)
}
if (link->priv) {
- //struct NET_DEVICE *dev = link->priv;
+ //struct net_device *dev = link->priv;
// dam dam damn mif (dev->priv)
// kfree_s(dev->priv, sizeof(struct awc_private));
- kfree_s(link->priv, sizeof(struct NET_DEVICE));
+ kfree_s(link->priv, sizeof(struct net_device));
}
kfree_s(link->dev, sizeof(struct dev_node_t));
kfree_s(link, sizeof(struct dev_link_t));
@@ -345,7 +345,7 @@ while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
static void awc_pcmcia_config(dev_link_t *link)
{
client_handle_t handle;
- struct NET_DEVICE *dev;
+ struct net_device *dev;
struct awc_private *lp;
tuple_t tuple;
int ii;
@@ -520,7 +520,7 @@ failed:
static void awc_release(u_long arg)
{
dev_link_t *link = (dev_link_t *)arg;
- struct NET_DEVICE *dev = link->priv;
+ struct net_device *dev = link->priv;
DEBUG(0, "awc_release(0x%p)\n", link);
@@ -558,7 +558,7 @@ static int awc_event(event_t event, int priority,
event_callback_args_t *args)
{
dev_link_t *link = args->client_data;
- struct NET_DEVICE *dev = link->priv;
+ struct net_device *dev = link->priv;
PC_DEBUG(1, "awc_event(0x%06x)\n", event);
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index baec21158..6853cc403 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -309,7 +309,7 @@ static void com20020_detach(dev_link_t *link)
{
DEBUG(1,"unregister...\n");
- if (dev->start)
+ if (netif_running(dev))
dev->stop(dev);
/*
@@ -501,7 +501,7 @@ static int com20020_event(event_t event, int priority,
case CS_EVENT_CARD_REMOVAL:
link->state &= ~DEV_PRESENT;
if (link->state & DEV_CONFIG) {
- dev->tbusy = 1; dev->start = 0;
+ netif_device_detach(dev);
link->release.expires = jiffies + HZ/20;
link->state |= DEV_RELEASE_PENDING;
add_timer(&link->release);
@@ -517,7 +517,7 @@ static int com20020_event(event_t event, int priority,
case CS_EVENT_RESET_PHYSICAL:
if (link->state & DEV_CONFIG) {
if (link->open) {
- dev->tbusy = 1; dev->start = 0;
+ netif_device_detach(dev);
}
CardServices(ReleaseConfiguration, link->handle);
}
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 8e2e4f72e..a3a0018cb 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -1,7 +1,7 @@
/*
* rrunner.c: Linux driver for the Essential RoadRunner HIPPI board.
*
- * Written 1998 by Jes Sorensen, <Jes.Sorensen@cern.ch>.
+ * Copyright (C) 1998-2000 by Jes Sorensen, <Jes.Sorensen@cern.ch>.
*
* Thanks to Essential Communication for providing us with hardware
* and very comprehensive documentation without which I would not have
@@ -13,6 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
+ *
+ * Thanks to Jayaram Bhat from ODS/Essential for fixing some of the
+ * stupid bugs in my code.
+ *
+ * Softnet support and various other patches from Val Henson of
+ * ODS/Essential.
*/
#define DEBUG 1
@@ -20,7 +26,7 @@
#define PKT_COPY_THRESHOLD 512
#include <linux/module.h>
-
+#include <linux/version.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/ioport.h>
@@ -32,17 +38,53 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/mm.h>
-#include <linux/cache.h>
#include <net/sock.h>
#include <asm/system.h>
+#include <asm/cache.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < 0x02030e)
+#define net_device device
+#endif
+
+#if (LINUX_VERSION_CODE >= 0x02031b)
+#define NEW_NETINIT
+#endif
+
+#if (LINUX_VERSION_CODE < 0x02032b)
+/*
+ * SoftNet changes
+ */
+#define dev_kfree_skb_irq(a) dev_kfree_skb(a)
+#define netif_wake_queue(dev) clear_bit(0, &dev->tbusy)
+#define netif_stop_queue(dev) set_bit(0, &dev->tbusy)
+
+static inline void netif_start_queue(struct net_device *dev)
+{
+ dev->tbusy = 0;
+ dev->start = 1;
+}
+
+#define rr_mark_net_bh(foo) mark_bh(foo)
+#define rr_if_busy(dev) dev->tbusy
+#define rr_if_running(dev) dev->start /* Currently unused. */
+#define rr_if_down(dev) {do{dev->start = 0;}while (0);}
+#else
+#define NET_BH 0
+#define rr_mark_net_bh(foo) {do{} while(0);}
+#define rr_if_busy(dev) test_bit(LINK_STATE_XOFF, &dev->state)
+#define rr_if_running(dev) test_bit(LINK_STATE_START, &dev->state)
+#define rr_if_down(dev) {do{} while(0);}
+#endif
+
#include "rrunner.h"
+#define RUN_AT(x) (jiffies + (x))
+
/*
* Implementation notes:
@@ -59,7 +101,9 @@
* stack will need to know about I/O vectors or something similar.
*/
-static const char __initdata *version = "rrunner.c: v0.17 03/09/99 Jes Sorensen (Jes.Sorensen@cern.ch)\n";
+static const char __initdata *version = "rrunner.c: v0.22 03/01/2000 Jes Sorensen (Jes.Sorensen@cern.ch)\n";
+
+static struct net_device *root_dev = NULL;
/*
@@ -72,11 +116,17 @@ extern __u32 sysctl_rmem_max;
static int probed __initdata = 0;
+#ifdef NEW_NETINIT
int __init rr_hippi_probe (void)
+#else
+int __init rr_hippi_probe (struct net_device *dev)
+#endif
{
+#ifdef NEW_NETINIT
+ struct net_device *dev;
+#endif
int boards_found = 0;
int version_disp; /* was version info already displayed? */
- struct net_device *dev;
struct pci_dev *pdev = NULL;
struct pci_dev *opdev = NULL;
u8 pci_latency;
@@ -128,10 +178,11 @@ int __init rr_hippi_probe (void)
dev->get_stats = &rr_get_stats;
dev->do_ioctl = &rr_ioctl;
- /*
- * Dummy value.
- */
- dev->base_addr = 42;
+#if (LINUX_VERSION_CODE < 0x02030d)
+ dev->base_addr = pdev->base_address[0];
+#else
+ dev->base_addr = pdev->resource[0].start;
+#endif
/* display version info if adapter is found */
if (!version_disp)
@@ -153,14 +204,14 @@ int __init rr_hippi_probe (void)
printk(KERN_INFO "%s: Essential RoadRunner serial HIPPI "
"at 0x%08lx, irq %i, PCI latency %i\n", dev->name,
- pdev->resource[0].start, dev->irq, pci_latency);
+ dev->base_addr, dev->irq, pci_latency);
/*
* Remap the regs into kernel space.
*/
rrpriv->regs = (struct rr_regs *)
- ioremap(pdev->resource[0].start, 0x1000);
+ ioremap(dev->base_addr, 0x1000);
if (!rrpriv->regs){
printk(KERN_ERR "%s: Unable to map I/O register, "
@@ -193,10 +244,16 @@ int __init rr_hippi_probe (void)
* 1 or more boards. Otherwise, return failure (-ENODEV).
*/
+#ifdef MODULE
return boards_found;
+#else
+ if (boards_found > 0)
+ return 0;
+ else
+ return -ENODEV;
+#endif
}
-static struct net_device *root_dev = NULL;
#ifdef MODULE
#if LINUX_VERSION_CODE > 0x20118
@@ -204,10 +261,18 @@ MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@cern.ch>");
MODULE_DESCRIPTION("Essential RoadRunner HIPPI driver");
#endif
-
int init_module(void)
{
- return rr_hippi_probe()? 0 : -ENODEV;
+ int cards;
+
+ root_dev = NULL;
+
+#ifdef NEW_NETINIT
+ cards = rr_hippi_probe();
+#else
+ cards = rr_hippi_probe(NULL);
+#endif
+ return cards ? 0 : -ENODEV;
}
void cleanup_module(void)
@@ -260,11 +325,11 @@ static void rr_issue_cmd(struct rr_private *rrpriv, struct cmd *cmd)
idx = rrpriv->info->cmd_ctrl.pi;
writel(*(u32*)(cmd), &regs->CmdRing[idx]);
- mb();
+ wmb();
idx = (idx - 1) % CMD_RING_ENTRIES;
rrpriv->info->cmd_ctrl.pi = idx;
- mb();
+ wmb();
if (readl(&regs->Mode) & FATAL_ERR)
printk("error code %02x\n", readl(&regs->Fail1));
@@ -363,8 +428,8 @@ static int rr_reset(struct net_device *dev)
/*
* Why 32 ? is this not cache line size dependant?
*/
- writel(WBURST_32, &regs->PciState);
- mb();
+ writel(RBURST_64|WBURST_64, &regs->PciState);
+ wmb();
start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart);
@@ -374,11 +439,11 @@ static int rr_reset(struct net_device *dev)
#endif
writel(start_pc + 0x800, &regs->Pc);
- mb();
+ wmb();
udelay(5);
writel(start_pc, &regs->Pc);
- mb();
+ wmb();
return 0;
}
@@ -495,7 +560,9 @@ static int __init rr_init(struct net_device *dev)
{
struct rr_private *rrpriv;
struct rr_regs *regs;
+ struct eeprom *hw = NULL;
u32 sram_size, rev;
+ int i;
rrpriv = (struct rr_private *)dev->priv;
regs = rrpriv->regs;
@@ -519,6 +586,26 @@ static int __init rr_init(struct net_device *dev)
printk(" Maximum receive rings %i\n", readl(&regs->MaxRxRng));
#endif
+ /*
+ * Read the hardware address from the eeprom. The HW address
+ * is not really necessary for HIPPI but awfully convenient.
+ * The pointer arithmetic to put it in dev_addr is ugly, but
+ * Donald Becker does it this way for the GigE version of this
+ * card and it's shorter and more portable than any
+ * other method I've seen. -VAL
+ */
+
+ *(u16 *)(dev->dev_addr) =
+ htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA));
+ *(u32 *)(dev->dev_addr+2) =
+ htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4]));
+
+ printk(" MAC: ");
+
+ for (i = 0; i < 5; i++)
+ printk("%2.2x:", dev->dev_addr[i]);
+ printk("%2.2x\n", dev->dev_addr[i]);
+
sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
printk(" SRAM size 0x%06x\n", sram_size);
@@ -545,9 +632,10 @@ static int rr_init1(struct net_device *dev)
{
struct rr_private *rrpriv;
struct rr_regs *regs;
- u32 hostctrl;
unsigned long myjif, flags;
struct cmd cmd;
+ u32 hostctrl;
+ int ecode = 0;
short i;
rrpriv = (struct rr_private *)dev->priv;
@@ -557,13 +645,14 @@ static int rr_init1(struct net_device *dev)
hostctrl = readl(&regs->HostCtrl);
writel(hostctrl | HALT_NIC | RR_CLEAR_INT, &regs->HostCtrl);
- mb();
+ wmb();
if (hostctrl & PARITY_ERR){
printk("%s: Parity error halting NIC - this is serious!\n",
dev->name);
spin_unlock_irqrestore(&rrpriv->lock, flags);
- return -EFAULT;
+ ecode = -EFAULT;
+ goto error;
}
set_rxaddr(regs, rrpriv->rx_ctrl);
@@ -607,45 +696,36 @@ static int rr_init1(struct net_device *dev)
rr_reset(dev);
- writel(0x60, &regs->IntrTmr);
- /*
- * These seem to have no real effect as the Firmware sets
- * it's own default values
- */
- writel(0x10, &regs->WriteDmaThresh);
- writel(0x20, &regs->ReadDmaThresh);
+ /* Tuning values */
+ writel(0x5000, &regs->ConRetry);
+ writel(0x100, &regs->ConRetryTmr);
+ writel(0x500000, &regs->ConTmout);
+ writel(0x60, &regs->IntrTmr);
+ writel(0x500000, &regs->TxDataMvTimeout);
+ writel(0x200000, &regs->RxDataMvTimeout);
+ writel(0x80, &regs->WriteDmaThresh);
+ writel(0x80, &regs->ReadDmaThresh);
rrpriv->fw_running = 0;
- mb();
+ wmb();
hostctrl &= ~(HALT_NIC | INVALID_INST_B | PARITY_ERR);
writel(hostctrl, &regs->HostCtrl);
- mb();
+ wmb();
spin_unlock_irqrestore(&rrpriv->lock, flags);
- udelay(1000);
-
- /*
- * Now start the FirmWare.
- */
- cmd.code = C_START_FW;
- cmd.ring = 0;
- cmd.index = 0;
-
- rr_issue_cmd(rrpriv, &cmd);
-
- /*
- * Give the FirmWare time to chew on the `get running' command.
- */
- myjif = jiffies + 5 * HZ;
- while ((jiffies < myjif) && !rrpriv->fw_running);
-
for (i = 0; i < RX_RING_ENTRIES; i++) {
struct sk_buff *skb;
rrpriv->rx_ring[i].mode = 0;
skb = alloc_skb(dev->mtu + HIPPI_HLEN, GFP_ATOMIC);
+ if (!skb) {
+ printk(KERN_WARNING "%s: Unable to allocate memory "
+ "for receive ring - halting NIC\n", dev->name);
+ ecode = -ENOMEM;
+ goto error;
+ }
rrpriv->rx_skbuff[i] = skb;
/*
* Sanity test to see if we conflict with the DMA
@@ -662,28 +742,43 @@ static int rr_init1(struct net_device *dev)
rrpriv->rx_ctrl[4].entries = RX_RING_ENTRIES;
rrpriv->rx_ctrl[4].mode = 8;
rrpriv->rx_ctrl[4].pi = 0;
- mb();
+ wmb();
set_rraddr(&rrpriv->rx_ctrl[4].rngptr, rrpriv->rx_ring);
- cmd.code = C_NEW_RNG;
- cmd.ring = 4;
+ udelay(1000);
+
+ /*
+ * Now start the FirmWare.
+ */
+ cmd.code = C_START_FW;
+ cmd.ring = 0;
cmd.index = 0;
+
rr_issue_cmd(rrpriv, &cmd);
-#if 0
-{
- u32 tmp;
- tmp = readl(&regs->ExtIo);
- writel(0x80, &regs->ExtIo);
-
- i = jiffies + 1 * HZ;
- while (jiffies < i);
- writel(tmp, &regs->ExtIo);
-}
-#endif
- dev->tbusy = 0;
- dev->start = 1;
- return 0;
+ /*
+ * Give the FirmWare time to chew on the `get running' command.
+ */
+ myjif = jiffies + 5 * HZ;
+ while ((jiffies < myjif) && !rrpriv->fw_running);
+
+ netif_start_queue(dev);
+
+ return ecode;
+
+ error:
+ /*
+ * We might have gotten here because we are out of memory,
+ * make sure we release everything we allocated before failing
+ */
+ for (i = 0; i < RX_RING_ENTRIES; i++) {
+ if (rrpriv->rx_skbuff[i]) {
+ rrpriv->rx_ring[i].size = 0;
+ set_rraddr(&rrpriv->rx_ring[i].addr, 0);
+ dev_kfree_skb(rrpriv->rx_skbuff[i]);
+ }
+ }
+ return ecode;
}
@@ -705,81 +800,147 @@ static u32 rr_handle_event(struct net_device *dev, u32 prodidx, u32 eidx)
switch (rrpriv->evt_ring[eidx].code){
case E_NIC_UP:
tmp = readl(&regs->FwRev);
- printk("%s: Firmware revision %i.%i.%i up and running\n",
- dev->name, (tmp >> 16), ((tmp >> 8) & 0xff),
- (tmp & 0xff));
+ printk(KERN_INFO "%s: Firmware revision %i.%i.%i "
+ "up and running\n", dev->name,
+ (tmp >> 16), ((tmp >> 8) & 0xff), (tmp & 0xff));
rrpriv->fw_running = 1;
- mb();
+ writel(RX_RING_ENTRIES - 1, &regs->IpRxPi);
+ wmb();
break;
case E_LINK_ON:
- printk("%s: Optical link ON\n", dev->name);
+ printk(KERN_INFO "%s: Optical link ON\n", dev->name);
break;
case E_LINK_OFF:
- printk("%s: Optical link OFF\n", dev->name);
+ printk(KERN_INFO "%s: Optical link OFF\n", dev->name);
break;
case E_RX_IDLE:
- printk("%s: RX data not moving\n", dev->name);
+ printk(KERN_WARNING "%s: RX data not moving\n",
+ dev->name);
break;
case E_WATCHDOG:
- printk("%s: The watchdog is here to see us\n",
+ printk(KERN_INFO "%s: The watchdog is here to see "
+ "us\n", dev->name);
+ break;
+ case E_INTERN_ERR:
+ printk(KERN_ERR "%s: HIPPI Internal NIC error\n",
dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
+ case E_HOST_ERR:
+ printk(KERN_ERR "%s: Host software error\n",
+ dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
break;
/*
* TX events.
*/
case E_CON_REJ:
- printk("%s: Connection rejected\n", dev->name);
+ printk(KERN_WARNING "%s: Connection rejected\n",
+ dev->name);
rrpriv->stats.tx_aborted_errors++;
break;
case E_CON_TMOUT:
- printk("%s: Connection timeout\n", dev->name);
+ printk(KERN_WARNING "%s: Connection timeout\n",
+ dev->name);
break;
case E_DISC_ERR:
- printk("%s: HIPPI disconnect error\n", dev->name);
+ printk(KERN_WARNING "%s: HIPPI disconnect error\n",
+ dev->name);
rrpriv->stats.tx_aborted_errors++;
break;
+ case E_INT_PRTY:
+ printk(KERN_ERR "%s: HIPPI Internal Parity error\n",
+ dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
case E_TX_IDLE:
- printk("%s: Transmitter idle\n", dev->name);
+ printk(KERN_WARNING "%s: Transmitter idle\n",
+ dev->name);
break;
case E_TX_LINK_DROP:
- printk("%s: Link lost during transmit\n", dev->name);
+ printk(KERN_WARNING "%s: Link lost during transmit\n",
+ dev->name);
rrpriv->stats.tx_aborted_errors++;
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
+ case E_TX_INV_RNG:
+ printk(KERN_ERR "%s: Invalid send ring block\n",
+ dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
+ case E_TX_INV_BUF:
+ printk(KERN_ERR "%s: Invalid send buffer address\n",
+ dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
+ case E_TX_INV_DSC:
+ printk(KERN_ERR "%s: Invalid descriptor address\n",
+ dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
break;
/*
* RX events.
*/
- case E_VAL_RNG: /* Should be ignored */
-#if (DEBUG > 2)
- printk("%s: RX ring valid event\n", dev->name);
-#endif
- writel(RX_RING_ENTRIES - 1, &regs->IpRxPi);
- break;
- case E_INV_RNG:
- printk("%s: RX ring invalid event\n", dev->name);
- break;
case E_RX_RNG_OUT:
- printk("%s: Receive ring full\n", dev->name);
+ printk(KERN_INFO "%s: Receive ring full\n", dev->name);
break;
case E_RX_PAR_ERR:
- printk("%s: Receive parity error.\n", dev->name);
+ printk(KERN_WARNING "%s: Receive parity error\n",
+ dev->name);
break;
case E_RX_LLRC_ERR:
- printk("%s: Receive LLRC error.\n", dev->name);
+ printk(KERN_WARNING "%s: Receive LLRC error\n",
+ dev->name);
break;
case E_PKT_LN_ERR:
- printk("%s: Receive packet length error.\n",
+ printk(KERN_WARNING "%s: Receive packet length "
+ "error\n", dev->name);
+ break;
+ case E_RX_INV_BUF:
+ printk(KERN_ERR "%s: Invalid receive buffer "
+ "address\n", dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
+ case E_RX_INV_DSC:
+ printk(KERN_ERR "%s: Invalid receive descriptor "
+ "address\n", dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
+ break;
+ case E_RNG_BLK:
+ printk(KERN_ERR "%s: Invalid ring block\n",
dev->name);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ wmb();
break;
default:
- printk("%s: Unhandled event 0x%02x\n",
+ printk(KERN_WARNING "%s: Unhandled event 0x%02x\n",
dev->name, rrpriv->evt_ring[eidx].code);
}
eidx = (eidx + 1) % EVT_RING_ENTRIES;
}
rrpriv->info->evt_ctrl.pi = eidx;
- mb();
+ wmb();
return eidx;
}
@@ -787,10 +948,10 @@ static u32 rr_handle_event(struct net_device *dev, u32 prodidx, u32 eidx)
static void rx_int(struct net_device *dev, u32 rxlimit, u32 index)
{
struct rr_private *rrpriv = (struct rr_private *)dev->priv;
- u32 pkt_len;
struct rr_regs *regs = rrpriv->regs;
do {
+ u32 pkt_len;
pkt_len = rrpriv->rx_ring[index].size;
#if (DEBUG > 2)
printk("index %i, rxlimit %i\n", index, rxlimit);
@@ -803,8 +964,7 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index)
if (pkt_len < PKT_COPY_THRESHOLD) {
skb = alloc_skb(pkt_len, GFP_ATOMIC);
if (skb == NULL){
- printk("%s: Out of memory deferring "
- "packet\n", dev->name);
+ printk(KERN_WARNING "%s: Unable to allocate skb (%i bytes), deferring packet\n", dev->name, pkt_len);
rrpriv->stats.rx_dropped++;
goto defer;
}else
@@ -847,7 +1007,7 @@ static void rx_int(struct net_device *dev, u32 rxlimit, u32 index)
} while(index != rxlimit);
rrpriv->cur_rx = index;
- mb();
+ wmb();
}
@@ -857,7 +1017,6 @@ static void rr_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
struct rr_regs *regs;
struct net_device *dev = (struct net_device *)dev_id;
u32 prodidx, rxindex, eidx, txcsmr, rxlimit, txcon;
- unsigned long flags;
rrpriv = (struct rr_private *)dev->priv;
regs = rrpriv->regs;
@@ -865,7 +1024,7 @@ static void rr_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
if (!(readl(&regs->HostCtrl) & RR_INT))
return;
- spin_lock_irqsave(&rrpriv->lock, flags);
+ spin_lock(&rrpriv->lock);
prodidx = readl(&regs->EvtPrd);
txcsmr = (prodidx >> 8) & 0xff;
@@ -886,7 +1045,7 @@ static void rr_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
do {
rrpriv->stats.tx_packets++;
rrpriv->stats.tx_bytes +=rrpriv->tx_skbuff[txcon]->len;
- dev_kfree_skb(rrpriv->tx_skbuff[txcon]);
+ dev_kfree_skb_irq(rrpriv->tx_skbuff[txcon]);
rrpriv->tx_skbuff[txcon] = NULL;
rrpriv->tx_ring[txcon].size = 0;
@@ -895,15 +1054,15 @@ static void rr_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
txcon = (txcon + 1) % TX_RING_ENTRIES;
} while (txcsmr != txcon);
- mb();
+ wmb();
rrpriv->dirty_tx = txcon;
- if (rrpriv->tx_full && dev->tbusy &&
+ if (rrpriv->tx_full && rr_if_busy(dev) &&
(((rrpriv->info->tx_ctrl.pi + 1) % TX_RING_ENTRIES)
!= rrpriv->dirty_tx)){
rrpriv->tx_full = 0;
- dev->tbusy = 0;
- mark_bh(NET_BH);
+ netif_wake_queue(dev);
+ rr_mark_net_bh(NET_BH);
}
}
@@ -913,9 +1072,51 @@ static void rr_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
eidx |= ((txcsmr << 8) | (rxlimit << 16));
writel(eidx, &regs->EvtCon);
- mb();
+ wmb();
- spin_unlock_irqrestore(&rrpriv->lock, flags);
+ spin_unlock(&rrpriv->lock);
+}
+
+
+static void rr_timer(unsigned long data)
+{
+ struct net_device *dev = (struct net_device *)data;
+ struct rr_private *rrpriv = (struct rr_private *)dev->priv;
+ struct rr_regs *regs = rrpriv->regs;
+ unsigned long flags;
+ int i;
+
+ if (readl(&regs->HostCtrl) & NIC_HALTED){
+ printk("%s: Restarting nic\n", dev->name);
+ memset(rrpriv->rx_ctrl, 0, 256 * sizeof(struct ring_ctrl));
+ memset(rrpriv->info, 0, sizeof(struct rr_info));
+ wmb();
+ for (i = 0; i < TX_RING_ENTRIES; i++) {
+ if (rrpriv->tx_skbuff[i]) {
+ rrpriv->tx_ring[i].size = 0;
+ set_rraddr(&rrpriv->tx_ring[i].addr, 0);
+ dev_kfree_skb(rrpriv->tx_skbuff[i]);
+ rrpriv->tx_skbuff[i] = NULL;
+ }
+ }
+
+ for (i = 0; i < RX_RING_ENTRIES; i++) {
+ if (rrpriv->rx_skbuff[i]) {
+ rrpriv->rx_ring[i].size = 0;
+ set_rraddr(&rrpriv->rx_ring[i].addr, 0);
+ dev_kfree_skb(rrpriv->rx_skbuff[i]);
+ rrpriv->rx_skbuff[i] = NULL;
+ }
+ }
+ if (rr_init1(dev)) {
+ spin_lock_irqsave(&rrpriv->lock, flags);
+ writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT,
+ &regs->HostCtrl);
+ spin_unlock_irqrestore(&rrpriv->lock, flags);
+ }
+ }
+ rrpriv->timer.expires = RUN_AT(5*HZ);
+ add_timer(&rrpriv->timer);
}
@@ -936,22 +1137,21 @@ static int rr_open(struct net_device *dev)
goto error;
}
- rrpriv->rx_ctrl = kmalloc(256*sizeof(struct ring_ctrl),
- GFP_KERNEL | GFP_DMA);
+ rrpriv->rx_ctrl = kmalloc(256*sizeof(struct ring_ctrl), GFP_KERNEL);
if (!rrpriv->rx_ctrl) {
ecode = -ENOMEM;
goto error;
}
- rrpriv->info = kmalloc(sizeof(struct rr_info), GFP_KERNEL | GFP_DMA);
+ rrpriv->info = kmalloc(sizeof(struct rr_info), GFP_KERNEL);
if (!rrpriv->info){
- kfree(rrpriv->rx_ctrl);
+ rrpriv->rx_ctrl = NULL;
ecode = -ENOMEM;
goto error;
}
memset(rrpriv->rx_ctrl, 0, 256 * sizeof(struct ring_ctrl));
memset(rrpriv->info, 0, sizeof(struct rr_info));
- mb();
+ wmb();
spin_lock_irqsave(&rrpriv->lock, flags);
writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, &regs->HostCtrl);
@@ -965,22 +1165,40 @@ static int rr_open(struct net_device *dev)
goto error;
}
- rr_init1(dev);
+ if ((ecode = rr_init1(dev)))
+ goto error;
- dev->tbusy = 0;
- dev->start = 1;
+ /* Set the timer to switch to check for link beat and perhaps switch
+ to an alternate media type. */
+ init_timer(&rrpriv->timer);
+ rrpriv->timer.expires = RUN_AT(5*HZ); /* 5 sec. watchdog */
+ rrpriv->timer.data = (unsigned long)dev;
+ rrpriv->timer.function = &rr_timer; /* timer handler */
+ add_timer(&rrpriv->timer);
+
+ netif_start_queue(dev);
MOD_INC_USE_COUNT;
- return 0;
+ return ecode;
error:
spin_lock_irqsave(&rrpriv->lock, flags);
writel(readl(&regs->HostCtrl)|HALT_NIC|RR_CLEAR_INT, &regs->HostCtrl);
spin_unlock_irqrestore(&rrpriv->lock, flags);
- dev->tbusy = 1;
- dev->start = 0;
- return -ENOMEM;
+ if (rrpriv->info) {
+ kfree(rrpriv->info);
+ rrpriv->info = NULL;
+ }
+ if (rrpriv->rx_ctrl) {
+ kfree(rrpriv->rx_ctrl);
+ rrpriv->rx_ctrl = NULL;
+ }
+
+ netif_stop_queue(dev);
+ rr_if_down(dev);
+
+ return ecode;
}
@@ -1055,9 +1273,9 @@ static int rr_close(struct net_device *dev)
u32 tmp;
short i;
- dev->start = 0;
- set_bit(0, (void*)&dev->tbusy);
-
+ netif_stop_queue(dev);
+ rr_if_down(dev);
+
rrpriv = (struct rr_private *)dev->priv;
regs = rrpriv->regs;
@@ -1074,11 +1292,13 @@ static int rr_close(struct net_device *dev)
}else{
tmp |= HALT_NIC | RR_CLEAR_INT;
writel(tmp, &regs->HostCtrl);
- mb();
+ wmb();
}
rrpriv->fw_running = 0;
+ del_timer(&rrpriv->timer);
+
writel(0, &regs->TxPi);
writel(0, &regs->IpRxPi);
@@ -1098,6 +1318,7 @@ static int rr_close(struct net_device *dev)
rrpriv->tx_ring[i].size = 0;
set_rraddr(&rrpriv->tx_ring[i].addr, 0);
dev_kfree_skb(rrpriv->tx_skbuff[i]);
+ rrpriv->tx_skbuff[i] = NULL;
}
}
@@ -1106,11 +1327,18 @@ static int rr_close(struct net_device *dev)
rrpriv->rx_ring[i].size = 0;
set_rraddr(&rrpriv->rx_ring[i].addr, 0);
dev_kfree_skb(rrpriv->rx_skbuff[i]);
+ rrpriv->rx_skbuff[i] = NULL;
}
}
- kfree(rrpriv->rx_ctrl);
- kfree(rrpriv->info);
+ if (rrpriv->rx_ctrl) {
+ kfree(rrpriv->rx_ctrl);
+ rrpriv->rx_ctrl = NULL;
+ }
+ if (rrpriv->info) {
+ kfree(rrpriv->info);
+ rrpriv->info = NULL;
+ }
free_irq(dev->irq, dev);
spin_unlock(&rrpriv->lock);
@@ -1142,7 +1370,7 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev)
printk("incoming skb too small - reallocating\n");
if (!(new_skb = dev_alloc_skb(len + 8))) {
dev_kfree_skb(skb);
- dev->tbusy = 0;
+ netif_wake_queue(dev);
return -EBUSY;
}
skb_reserve(new_skb, 8);
@@ -1172,11 +1400,12 @@ static int rr_start_xmit(struct sk_buff *skb, struct net_device *dev)
rrpriv->tx_ring[index].size = len + 8; /* include IFIELD */
rrpriv->tx_ring[index].mode = PACKET_START | PACKET_END;
txctrl->pi = (index + 1) % TX_RING_ENTRIES;
+ wmb();
writel(txctrl->pi, &regs->TxPi);
if (txctrl->pi == rrpriv->dirty_tx){
rrpriv->tx_full = 1;
- set_bit(0, (void*)&dev->tbusy);
+ netif_stop_queue(dev);
}
spin_unlock_irqrestore(&rrpriv->lock, flags);
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index f7d86c103..283602e44 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -42,9 +42,9 @@ static const char *version =
#include <linux/malloc.h>
#include <linux/string.h>
#include <linux/init.h>
+#include <linux/delay.h>
#include <asm/system.h>
#include <asm/bitops.h>
-#include <asm/delay.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <linux/errno.h>
diff --git a/drivers/net/setup.c b/drivers/net/setup.c
index 472b23a8c..d47b1062e 100644
--- a/drivers/net/setup.c
+++ b/drivers/net/setup.c
@@ -185,27 +185,6 @@ static void __init appletalk_device_init(void)
#endif /* CONFIG_IPDDP */
}
-
-/*
- * The loopback device is global so it can be directly referenced
- * by the network code.
- */
-
-extern int loopback_init(struct net_device *dev);
-struct net_device loopback_dev =
-{
- "lo" __PAD2, /* Software Loopback interface */
- 0x0, /* recv memory end */
- 0x0, /* recv memory start */
- 0x0, /* memory end */
- 0x0, /* memory start */
- 0, /* base I/O address */
- 0, /* IRQ */
- 0, 0, 0, /* flags */
- NULL, /* next device */
- loopback_init /* loopback_init should set up the rest */
-};
-
static void special_device_init(void)
{
#ifdef CONFIG_DUMMY
@@ -248,12 +227,20 @@ static void special_device_init(void)
extern int sb1000_probe(struct net_device *dev);
static struct net_device sb1000_dev =
{
- "cm0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe
+ "cm0 __PAD3", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe
};
register_netdev(&sb1000_dev);
}
#endif
- register_netdev(&loopback_dev);
+#ifdef CONFIG_BONDING
+ {
+ extern int bond_init(struct net_device *dev);
+ static struct net_device bond_dev = {
+ "bond" __PAD4, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, bond_init,
+ };
+ register_netdev(&bond_dev);
+ }
+#endif
}
/*
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index e17304fd0..3a210c024 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1,4 +1,4 @@
-/* $Id: sunlance.c,v 1.99 2000/02/16 10:36:14 davem Exp $
+/* $Id: sunlance.c,v 1.100 2000/02/27 09:38:12 anton Exp $
* lance.c: Linux/Sparc/Lance driver
*
* Written 1995, 1996 by Miguel de Icaza
@@ -1287,8 +1287,10 @@ static void lance_set_multicast(struct net_device *dev)
static void lance_set_multicast_retry(unsigned long _opaque)
{
struct net_device *dev = (struct net_device *) _opaque;
+ struct lance_private *lp = (struct lance_private *) dev->priv;
lance_set_multicast(dev);
+ timer_exit(&lp->multicast_timer);
}
static void lance_free_hwresources(struct lance_private *lp)
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index b81815e25..0dfffbc8e 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -83,6 +83,11 @@
* Changes by Jochen Friedrich to enable RFC1469 Option 2 multicasting
* i.e. using functional address C0 00 00 04 00 00 to transmit and
* receive multicast packets.
+ *
+ * Changes by Mike Sullivan (based on original sram patch by Dave Grothe
+ * to support windowing into on adapter shared ram.
+ * i.e. Use LANAID to setup a PnP configuration with 16K RAM. Paging
+ * will shift this 16K window over the entire available shared RAM.
*/
/* change the define of IBMTR_DEBUG_MESSAGES to a nonzero value
@@ -102,7 +107,8 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */
#define NO_AUTODETECT 1
#undef NO_AUTODETECT
-#undef ENABLE_PAGING
+/* #undef ENABLE_PAGING */
+#define ENABLE_PAGING 1
#define FALSE 0
@@ -119,7 +125,8 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */
static char *version =
"ibmtr.c: v1.3.57 8/ 7/94 Peter De Schrijver and Mark Swanson\n"
" v2.1.125 10/20/98 Paul Norton <pnorton@ieee.org>\n"
-" v2.2.0 12/30/98 Joel Sloan <jjs@c-me.com>\n";
+" v2.2.0 12/30/98 Joel Sloan <jjs@c-me.com>\n"
+" v2.2.1 02/08/00 Mike Sullivan <sullivam@us.ibm.com>\n";
static char pcchannelid[] = {
0x05, 0x00, 0x04, 0x09,
@@ -570,7 +577,7 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
ti->mapped_ram_size = ti->avail_shared_ram;
} else {
#ifdef ENABLE_PAGING
- unsigned char pg_size;
+ unsigned char pg_size=0;
#endif
#if !TR_NEWFORMAT
@@ -590,15 +597,16 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
pg_size=64; /* 32KB page size */
break;
case 0xc:
- ti->page_mask=(ti->mapped_ram_size==32) ? 0xc0 : 0;
- ti->page_mask=(ti->mapped_ram_size==64) ? 0x80 : 0;
- DPRINTK("Dual size shared RAM page (code=0xC), don't support it!\n");
- /* nb/dwm: I did this because RRR (3,2) bits are documented as
- R/O and I can't find how to select which page size
- Also, the above conditional statement sequence is invalid
- as page_mask will always be set by the second stmt */
- kfree_s(ti, sizeof(struct tok_info));
- return -ENODEV;
+ switch (ti->mapped_ram_size) {
+ case 32:
+ ti->page_mask=0xc0;
+ pg_size=32;
+ break;
+ case 64:
+ ti->page_mask=0x80;
+ pg_size=64;
+ break;
+ }
break;
default:
DPRINTK("Unknown shared ram paging info %01X\n",ti->shared_ram_paging);
@@ -606,16 +614,22 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
return -ENODEV;
break;
}
+
+ if (ibmtr_debug_trace & TRC_INIT)
+ DPRINTK("Shared RAM paging code: "
+ "%02X mapped RAM size: %dK shared RAM size: %dK page mask: %0xX\n:",
+ ti->shared_ram_paging, ti->mapped_ram_size/2, ti->avail_shared_ram/2, ti->page_mask);
+
if (ti->page_mask) {
if (pg_size > ti->mapped_ram_size) {
DPRINTK("Page size (%d) > mapped ram window (%d), can't page.\n",
- pg_size, ti->mapped_ram_size);
+ pg_size/2, ti->mapped_ram_size/2);
ti->page_mask = 0; /* reset paging */
- } else {
- ti->mapped_ram_size=ti->avail_shared_ram;
- DPRINTK("Shared RAM paging enabled. Page size : %uK\n",
- ((ti->page_mask^ 0xff)+1)>>2);
- }
+ }
+ } else if (pg_size > ti->mapped_ram_size) {
+ DPRINTK("Page size (%d) > mapped ram window (%d), can't page.\n",
+ pg_size/2, ti->mapped_ram_size/2);
+ }
#endif
}
/* finish figuring the shared RAM address */
@@ -673,9 +687,17 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
DPRINTK("Hardware address : %02X:%02X:%02X:%02X:%02X:%02X\n",
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
+ if (ti->page_mask)
+ DPRINTK("Shared RAM paging enabled. Page size: %uK Shared Ram size %dK\n",
+ ((ti->page_mask ^ 0xff)+1)>>2,ti->avail_shared_ram/2);
+ else
+ DPRINTK("Shared RAM paging disabled. ti->page_mask %x\n",ti->page_mask);
#endif
/* Calculate the maximum DHB we can use */
- switch (ti->mapped_ram_size) {
+ if (!ti->page_mask) {
+ ti->avail_shared_ram=ti->mapped_ram_size;
+ }
+ switch (ti->avail_shared_ram) {
case 16 : /* 8KB shared RAM */
ti->dhb_size4mb = MIN(ti->dhb_size4mb, 2048);
ti->rbuf_len4 = 1032;
@@ -685,34 +707,34 @@ static int __init ibmtr_probe1(struct net_device *dev, int PIOaddr)
ti->rbuf_cnt16 = 2;
break;
case 32 : /* 16KB shared RAM */
- ti->dhb_size4mb = MIN(ti->dhb_size4mb, 4464);
+ ti->dhb_size4mb = MIN(ti->dhb_size4mb, 2048);
ti->rbuf_len4 = 520;
ti->rbuf_cnt4 = 9;
- ti->dhb_size16mb = MIN(ti->dhb_size16mb, 4096);
+ ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
ti->rbuf_len16 = 1032; /* 1024 usable */
ti->rbuf_cnt16 = 4;
break;
case 64 : /* 32KB shared RAM */
- ti->dhb_size4mb = MIN(ti->dhb_size4mb, 4464);
+ ti->dhb_size4mb = MIN(ti->dhb_size4mb, 2048);
ti->rbuf_len4 = 1032;
ti->rbuf_cnt4 = 6;
- ti->dhb_size16mb = MIN(ti->dhb_size16mb, 10240);
+ ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
ti->rbuf_len16 = 1032;
ti->rbuf_cnt16 = 10;
break;
case 127 : /* 63KB shared RAM */
- ti->dhb_size4mb = MIN(ti->dhb_size4mb, 4464);
+ ti->dhb_size4mb = MIN(ti->dhb_size4mb, 2048);
ti->rbuf_len4 = 1032;
ti->rbuf_cnt4 = 6;
- ti->dhb_size16mb = MIN(ti->dhb_size16mb, 16384);
+ ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
ti->rbuf_len16 = 1032;
ti->rbuf_cnt16 = 16;
break;
case 128 : /* 64KB shared RAM */
- ti->dhb_size4mb = MIN(ti->dhb_size4mb, 4464);
+ ti->dhb_size4mb = MIN(ti->dhb_size4mb, 2048);
ti->rbuf_len4 = 1032;
ti->rbuf_cnt4 = 6;
- ti->dhb_size16mb = MIN(ti->dhb_size16mb, 17960);
+ ti->dhb_size16mb = MIN(ti->dhb_size16mb, 2048);
ti->rbuf_len16 = 1032;
ti->rbuf_cnt16 = 18;
break;
@@ -764,6 +786,7 @@ static int __init trdev_init(struct net_device *dev)
{
struct tok_info *ti=(struct tok_info *)dev->priv;
+ SET_PAGE(ti->srb_page);
ti->open_status = CLOSED;
dev->init = tok_init_card;
@@ -802,7 +825,7 @@ static void tok_set_multicast_list(struct net_device *dev)
address[3] |= mclist->dmi_addr[5];
mclist = mclist->next;
}
- SET_PAGE(ti->srb);
+ SET_PAGE(ti->srb_page);
for (i=0; i<sizeof(struct srb_set_funct_addr); i++)
isa_writeb(0, ti->srb+i);
@@ -848,7 +871,7 @@ static int tok_close(struct net_device *dev)
struct tok_info *ti=(struct tok_info *) dev->priv;
netif_stop_queue(dev);
-
+ SET_PAGE(ti->srb_page);
isa_writeb(DIR_CLOSE_ADAPTER,
ti->srb + offsetof(struct srb_close_adapter, command));
isa_writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -857,6 +880,7 @@ static int tok_close(struct net_device *dev)
sleep_on(&ti->wait_for_tok_int);
+ SET_PAGE(ti->srb_page);
if (isa_readb(ti->srb + offsetof(struct srb_close_adapter, ret_code)))
DPRINTK("close adapter failed: %02X\n",
(int)isa_readb(ti->srb + offsetof(struct srb_close_adapter, ret_code)));
@@ -875,6 +899,9 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
unsigned char status;
struct tok_info *ti;
struct net_device *dev;
+#ifdef ENABLE_PAGING
+ unsigned char save_srpr;
+#endif
dev = dev_id;
#if TR_VERBOSE
@@ -882,6 +909,9 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
#endif
ti = (struct tok_info *) dev->priv;
spin_lock(&(ti->lock));
+#ifdef ENABLE_PAGING
+ save_srpr=isa_readb(ti->mmio+ACA_OFFSET+ACA_RW+SRPR_EVEN);
+#endif
/* Disable interrupts till processing is finished */
isa_writeb((~INT_ENABLE), ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN);
@@ -907,17 +937,15 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
if (status == 0xFF)
{
DPRINTK("PCMCIA card removed.\n");
- spin_unlock(&(ti->lock));
- return;
+ goto return_point ;
}
/* Check ISRP EVEN too. */
if ( isa_readb (ti->mmio + ACA_OFFSET + ACA_RW + ISRP_EVEN) == 0xFF)
{
DPRINTK("PCMCIA card removed.\n");
- spin_unlock(&(ti->lock));
- return;
- }
+ goto return_point ;
+ }
#endif
@@ -925,8 +953,15 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
int i;
__u32 check_reason;
+ __u8 check_reason_page=0;
- check_reason=ti->mmio + ntohs(isa_readw(ti->sram + ACA_OFFSET + ACA_RW +WWCR_EVEN));
+ check_reason=ntohs(isa_readw(ti->sram + ACA_OFFSET + ACA_RW +WWCR_EVEN));
+ if (ti->page_mask) {
+ check_reason_page=(check_reason>>8) & ti->page_mask;
+ check_reason &= ~(ti->page_mask << 8);
+ }
+ check_reason += ti->sram;
+ SET_PAGE(check_reason_page);
DPRINTK("Adapter check interrupt\n");
DPRINTK("8 reason bytes follow: ");
@@ -951,6 +986,12 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
/* SRB, ASB, ARB or SSB response */
if (status & SRB_RESP_INT) { /* SRB response */
+ SET_PAGE(ti->srb_page);
+#if TR_VERBOSE
+ DPRINTK("SRB resp: cmd=%02X rsp=%02X\n",
+ isa_readb(ti->srb),
+ isa_readb(ti->srb + offsetof(struct srb_xmit, ret_code)));
+#endif
switch(isa_readb(ti->srb)) { /* SRB command check */
@@ -962,7 +1003,7 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
DPRINTK("error on xmit_dir_frame request: %02X\n",
xmit_ret_code);
if (ti->current_skb) {
- dev_kfree_skb(ti->current_skb);
+ dev_kfree_skb_irq(ti->current_skb);
ti->current_skb=NULL;
}
netif_wake_queue(dev);
@@ -979,7 +1020,7 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
DPRINTK("error on xmit_ui_frame request: %02X\n",
xmit_ret_code);
if (ti->current_skb) {
- dev_kfree_skb(ti->current_skb);
+ dev_kfree_skb_irq(ti->current_skb);
ti->current_skb=NULL;
}
netif_wake_queue(dev);
@@ -993,10 +1034,25 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
unsigned char open_ret_code;
__u16 open_error_code;
- ti->srb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, srb_addr)));
- ti->ssb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, ssb_addr)));
- ti->arb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, arb_addr)));
- ti->asb=ti->sram+ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, asb_addr)));
+ ti->srb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, srb_addr)));
+ ti->ssb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, ssb_addr)));
+ ti->arb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, arb_addr)));
+ ti->asb=ntohs(isa_readw(ti->init_srb +offsetof(struct srb_open_response, asb_addr)));
+ if (ti->page_mask) {
+ ti->srb_page=(ti->srb>>8) & ti->page_mask;
+ ti->srb &= ~(ti->page_mask<<8);
+ ti->ssb_page=(ti->ssb>>8) & ti->page_mask;
+ ti->ssb &= ~(ti->page_mask<<8);
+ ti->arb_page=(ti->arb>>8) & ti->page_mask;
+ ti->arb &= ~(ti->page_mask<<8);
+ ti->asb_page=(ti->asb>>8) & ti->page_mask;
+ ti->asb &= ~(ti->page_mask<<8);
+ }
+ ti->srb+=ti->sram;
+ ti->ssb+=ti->sram;
+ ti->arb+=ti->sram;
+ ti->asb+=ti->sram;
+
ti->current_skb=NULL;
open_ret_code = isa_readb(ti->init_srb +offsetof(struct srb_open_response, ret_code));
@@ -1125,6 +1181,10 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
} /* SRB response */
if (status & ASB_FREE_INT) { /* ASB response */
+ SET_PAGE(ti->asb_page);
+#if TR_VERBOSE
+ DPRINTK("ASB resp: cmd=%02X\n", isa_readb(ti->asb));
+ #endif
switch(isa_readb(ti->asb)) { /* ASB command check */
@@ -1147,6 +1207,12 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
} /* ASB response */
if (status & ARB_CMD_INT) { /* ARB response */
+ SET_PAGE(ti->arb_page);
+#if TR_VERBOSE
+ DPRINTK("ARB resp: cmd=%02X rsp=%02X\n",
+ isa_readb(ti->arb),
+ isa_readb(ti->arb + offsetof(struct arb_dlc_status, status)));
+#endif
switch (isa_readb(ti->arb)) { /* ARB command check */
@@ -1203,6 +1269,11 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
if (status & SSB_RESP_INT) { /* SSB response */
unsigned char retcode;
+ SET_PAGE(ti->ssb_page);
+#if TR_VERBOSE
+ DPRINTK("SSB resp: cmd=%02X rsp=%02X\n",
+ isa_readb(ti->ssb), isa_readb(ti->ssb+2));
+#endif
switch (isa_readb(ti->ssb)) { /* SSB command check */
case XMIT_DIR_FRAME:
@@ -1216,6 +1287,7 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
case XMIT_XID_CMD:
DPRINTK("xmit xid ret_code: %02X\n", (int)isa_readb(ti->ssb+2));
+ break;
default:
DPRINTK("Unknown command %02X in ssb\n", (int)isa_readb(ti->ssb));
@@ -1240,6 +1312,13 @@ void tok_interrupt (int irq, void *dev_id, struct pt_regs *regs)
DPRINTK("Unexpected interrupt from tr adapter\n");
}
+#ifdef PCMCIA
+ return_point:
+#endif
+#ifdef ENABLE_PAGING
+ isa_writeb(save_srpr, ti->mmio+ACA_OFFSET+ACA_RW+SRPR_EVEN);
+#endif
+
spin_unlock(&(ti->lock));
}
@@ -1262,9 +1341,26 @@ static void initial_tok_int(struct net_device *dev)
isa_writeb(ti->sram_base, ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN);
ti->sram=((__u32)ti->sram_base << 12);
}
- ti->init_srb=ti->sram
- +ntohs((unsigned short)isa_readw(ti->mmio+ ACA_OFFSET + WRBR_EVEN));
- SET_PAGE(ntohs((unsigned short)isa_readw(ti->mmio+ACA_OFFSET + WRBR_EVEN)));
+ ti->init_srb=ntohs((unsigned short)isa_readw(ti->mmio+ ACA_OFFSET + WRBR_EVEN));
+ if (ti->page_mask) {
+ ti->init_srb_page=(ti->init_srb>>8)&ti->page_mask;
+ ti->init_srb &= ~(ti->page_mask<<8);
+ }
+ ti->init_srb+=ti->sram;
+
+ if (ti->avail_shared_ram == 127) {
+ int i;
+ int last_512=0xfe00;
+ if (ti->page_mask) {
+ last_512 &= ~(ti->page_mask<<8);
+ }
+ /* initialize high section of ram (if necessary) */
+ SET_PAGE(0xc0);
+ for (i=0; i<512; i++) {
+ isa_writeb(0,ti->sram+last_512+i);
+ }
+ }
+ SET_PAGE(ti->init_srb_page);
dev->mem_start = ti->sram;
dev->mem_end = ti->sram + (ti->mapped_ram_size<<9) - 1;
@@ -1272,7 +1368,7 @@ static void initial_tok_int(struct net_device *dev)
#if TR_VERBOSE
{
int i;
- DPRINTK("init_srb(%p):", ti->init_srb);
+ DPRINTK("init_srb(%lx):", (long)ti->init_srb);
for (i=0;i<17;i++) printk("%02X ", (int)isa_readb(ti->init_srb+i));
printk("\n");
}
@@ -1325,11 +1421,6 @@ static int tok_init_card(struct net_device *dev)
/* Reset adapter */
netif_stop_queue(dev);
-#ifdef ENABLE_PAGING
- if(ti->page_mask)
- isa_writeb(SRPR_ENABLE_PAGING, ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN);
-#endif
-
isa_writeb(~INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_EVEN);
#if !TR_NEWFORMAT
@@ -1339,6 +1430,10 @@ static int tok_init_card(struct net_device *dev)
outb(0, PIOaddr+ADAPTRESET);
for (i=jiffies+TR_RESET_INTERVAL; time_before_eq(jiffies, i);); /* wait 50ms */
outb(0,PIOaddr+ADAPTRESETREL);
+#ifdef ENABLE_PAGING
+ if(ti->page_mask)
+ isa_writeb(SRPR_ENABLE_PAGING, ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN);
+#endif
#if !TR_NEWFORMAT
DPRINTK("card reset\n");
@@ -1354,7 +1449,7 @@ static void open_sap(unsigned char type,struct net_device *dev)
int i;
struct tok_info *ti=(struct tok_info *) dev->priv;
- SET_PAGE(ti->srb);
+ SET_PAGE(ti->srb_page);
for (i=0; i<sizeof(struct dlc_open_sap); i++)
isa_writeb(0, ti->srb+i);
@@ -1417,6 +1512,12 @@ void tok_open_adapter(unsigned long dev_addr)
ti->init_srb + offsetof(struct dir_open_adapter, dlc_max_sta));
ti->srb=ti->init_srb; /* We use this one in the interrupt handler */
+ ti->srb_page=ti->init_srb_page;
+ DPRINTK("Opend adapter: Xmit bfrs: %d X %d, Rcv bfrs: %d X %d\n",
+ isa_readb(ti->init_srb+offsetof(struct dir_open_adapter,num_dhb)),
+ ntohs(isa_readw(ti->init_srb+offsetof(struct dir_open_adapter,dhb_length))),
+ ntohs(isa_readw(ti->init_srb+offsetof(struct dir_open_adapter,num_rcv_buf))),
+ ntohs(isa_readw(ti->init_srb+offsetof(struct dir_open_adapter,rcv_buf_len))) );
isa_writeb(INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN);
isa_writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1432,7 +1533,11 @@ static void tr_tx(struct net_device *dev)
unsigned char xmit_command;
int i;
struct trllc *llc;
+ struct srb_xmit xsrb;
+ __u8 dhb_page=0;
+ __u8 llc_ssap;
+ SET_PAGE(ti->asb_page);
if (isa_readb(ti->asb + offsetof(struct asb_xmit_resp, ret_code))!=0xFF)
DPRINTK("ASB not free !!!\n");
@@ -1441,8 +1546,13 @@ static void tr_tx(struct net_device *dev)
providing a shared memory address for us
to stuff with data. Here we compute the
effective address where we will place data.*/
- dhb=ti->sram
- +ntohs(isa_readw(ti->arb + offsetof(struct arb_xmit_req, dhb_address)));
+ SET_PAGE(ti->arb_page);
+ dhb=ntohs(isa_readw(ti->arb + offsetof(struct arb_xmit_req, dhb_address)));
+ if (ti->page_mask) {
+ dhb_page=(dhb >> 8) & ti->page_mask;
+ dhb &= ~(ti->page_mask << 8);
+ }
+ dhb+=ti->sram;
/* Figure out the size of the 802.5 header */
if (!(trhdr->saddr[0] & 0x80)) /* RIF present? */
@@ -1453,13 +1563,17 @@ static void tr_tx(struct net_device *dev)
llc = (struct trllc *)(ti->current_skb->data + hdr_len);
- xmit_command = isa_readb(ti->srb + offsetof(struct srb_xmit, command));
-
+ llc_ssap=llc->ssap;
+ SET_PAGE(ti->srb_page);
+ isa_memcpy_fromio(&xsrb, ti->srb, sizeof(xsrb));
+ SET_PAGE(ti->asb_page);
+ xmit_command=xsrb.command;
+
isa_writeb(xmit_command, ti->asb + offsetof(struct asb_xmit_resp, command));
- isa_writew(isa_readb(ti->srb + offsetof(struct srb_xmit, station_id)),
+ isa_writew(xsrb.station_id,
ti->asb + offsetof(struct asb_xmit_resp, station_id));
- isa_writeb(llc->ssap, ti->asb + offsetof(struct asb_xmit_resp, rsap_value));
- isa_writeb(isa_readb(ti->srb + offsetof(struct srb_xmit, cmd_corr)),
+ isa_writeb(llc_ssap, ti->asb + offsetof(struct asb_xmit_resp, rsap_value));
+ isa_writeb(xsrb.cmd_corr,
ti->asb + offsetof(struct asb_xmit_resp, cmd_corr));
isa_writeb(0, ti->asb + offsetof(struct asb_xmit_resp, ret_code));
@@ -1468,6 +1582,7 @@ static void tr_tx(struct net_device *dev)
isa_writew(htons(0x11),
ti->asb + offsetof(struct asb_xmit_resp, frame_length));
isa_writeb(0x0e, ti->asb + offsetof(struct asb_xmit_resp, hdr_length));
+ SET_PAGE(dhb_page);
isa_writeb(AC, dhb);
isa_writeb(LLC_FRAME, dhb+1);
@@ -1487,11 +1602,12 @@ static void tr_tx(struct net_device *dev)
isa_writew(htons(ti->current_skb->len),
ti->asb + offsetof(struct asb_xmit_resp, frame_length));
+ SET_PAGE(dhb_page);
isa_memcpy_toio(dhb, ti->current_skb->data, ti->current_skb->len);
isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
ti->tr_stats.tx_bytes+=ti->current_skb->len;
- dev_kfree_skb(ti->current_skb);
+ dev_kfree_skb_irq(ti->current_skb);
ti->current_skb=NULL;
netif_wake_queue(dev);
if (ti->readlog_pending) ibmtr_readlog(dev);
@@ -1501,6 +1617,7 @@ static void tr_rx(struct net_device *dev)
{
struct tok_info *ti=(struct tok_info *) dev->priv;
__u32 rbuffer, rbufdata;
+ __u8 rbuffer_page=0;
__u32 llc;
unsigned char *data;
unsigned int rbuffer_len, lan_hdr_len, hdr_len, ip_len, length;
@@ -1509,31 +1626,40 @@ static void tr_rx(struct net_device *dev)
int IPv4_p = 0;
unsigned int chksum = 0;
struct iphdr *iph;
+ struct arb_rec_req rarb;
- rbuffer=(ti->sram
- +ntohs(isa_readw(ti->arb + offsetof(struct arb_rec_req, rec_buf_addr))))+2;
-
+ SET_PAGE(ti->arb_page);
+ isa_memcpy_fromio(&rarb, ti->arb, sizeof(rarb));
+ rbuffer=ntohs(rarb.rec_buf_addr)+2;
+ if (ti->page_mask) {
+ rbuffer_page=(rbuffer >> 8) & ti->page_mask;
+ rbuffer &= ~(ti->page_mask<<8);
+ }
+ rbuffer += ti->sram;
+
+ SET_PAGE(ti->asb_page);
if(isa_readb(ti->asb + offsetof(struct asb_rec, ret_code))!=0xFF)
DPRINTK("ASB not free !!!\n");
isa_writeb(REC_DATA,
ti->asb + offsetof(struct asb_rec, command));
- isa_writew(isa_readw(ti->arb + offsetof(struct arb_rec_req, station_id)),
+ isa_writew(rarb.station_id,
ti->asb + offsetof(struct asb_rec, station_id));
- isa_writew(isa_readw(ti->arb + offsetof(struct arb_rec_req, rec_buf_addr)),
+ isa_writew(rarb.rec_buf_addr,
ti->asb + offsetof(struct asb_rec, rec_buf_addr));
- lan_hdr_len=isa_readb(ti->arb + offsetof(struct arb_rec_req, lan_hdr_len));
+ lan_hdr_len=rarb.lan_hdr_len;
hdr_len = lan_hdr_len + sizeof(struct trllc) + sizeof(struct iphdr);
-
+
+ SET_PAGE(rbuffer_page);
llc=(rbuffer + offsetof(struct rec_buf, data) + lan_hdr_len);
#if TR_VERBOSE
DPRINTK("offsetof data: %02X lan_hdr_len: %02X\n",
(unsigned int)offsetof(struct rec_buf,data), (unsigned int)lan_hdr_len);
- DPRINTK("llc: %08X rec_buf_addr: %04X ti->sram: %p\n", llc,
- ntohs(isa_readw(ti->arb + offsetof(struct arb_rec_req, rec_buf_addr))),
- ti->sram);
+ DPRINTK("llc: %08X rec_buf_addr: %04X ti->sram: %lx\n", llc,
+ ntohs(rarb.rec_buf_addr),
+ (long)ti->sram);
DPRINTK("dsap: %02X, ssap: %02X, llc: %02X, protid: %02X%02X%02X, "
"ethertype: %04X\n",
(int)isa_readb(llc + offsetof(struct trllc, dsap)),
@@ -1545,14 +1671,15 @@ static void tr_rx(struct net_device *dev)
(int)isa_readw(llc + offsetof(struct trllc, ethertype)));
#endif
if (isa_readb(llc + offsetof(struct trllc, llc))!=UI_CMD) {
+ SET_PAGE(ti->asb_page);
isa_writeb(DATA_LOST, ti->asb + offsetof(struct asb_rec, ret_code));
ti->tr_stats.rx_dropped++;
isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
return;
}
- length = ntohs(isa_readw(ti->arb+offsetof(struct arb_rec_req, frame_len)));
- if ((isa_readb(llc + offsetof(struct trllc, dsap))==EXTENDED_SAP) &&
+ length = ntohs(rarb.frame_len);
+ if ((isa_readb(llc + offsetof(struct trllc, dsap))==EXTENDED_SAP) &&
(isa_readb(llc + offsetof(struct trllc, ssap))==EXTENDED_SAP) &&
(length>=hdr_len)) {
IPv4_p = 1;
@@ -1585,11 +1712,12 @@ static void tr_rx(struct net_device *dev)
}
#endif
- skb_size = length-lan_hdr_len+sizeof(struct trh_hdr)+sizeof(struct trllc);
+ skb_size = length;
if (!(skb=dev_alloc_skb(skb_size))) {
DPRINTK("out of memory. frame dropped.\n");
ti->tr_stats.rx_dropped++;
+ SET_PAGE(ti->asb_page);
isa_writeb(DATA_LOST, ti->asb + offsetof(struct asb_rec, ret_code));
isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
return;
@@ -1630,11 +1758,17 @@ static void tr_rx(struct net_device *dev)
break;
length -= rbuffer_len;
data += rbuffer_len;
+ if (ti->page_mask) {
+ rbuffer_page=(rbuffer>>8) & ti->page_mask;
+ rbuffer &= ~(ti->page_mask << 8);
+ }
rbuffer += ti->sram;
+ SET_PAGE(rbuffer_page);
rbuffer_len = ntohs(isa_readw(rbuffer + offsetof(struct rec_buf, buf_len)));
rbufdata = rbuffer + offsetof(struct rec_buf, data);
}
+ SET_PAGE(ti->asb_page);
isa_writeb(0, ti->asb + offsetof(struct asb_rec, ret_code));
isa_writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1663,6 +1797,7 @@ static int tok_send_packet(struct sk_buff *skb, struct net_device *dev)
/* Save skb; we'll need it when the adapter asks for the data */
ti->current_skb=skb;
+ SET_PAGE(ti->srb_page);
isa_writeb(XMIT_UI_FRAME, ti->srb + offsetof(struct srb_xmit, command));
isa_writew(ti->exsap_station_id, ti->srb
+offsetof(struct srb_xmit, station_id));
@@ -1685,6 +1820,7 @@ void ibmtr_readlog(struct net_device *dev) {
ti=(struct tok_info *) dev->priv;
ti->readlog_pending = 0;
+ SET_PAGE(ti->srb_page);
isa_writeb(DIR_READ_LOG, ti->srb);
isa_writeb(INT_ENABLE, ti->mmio + ACA_OFFSET + ACA_SET + ISRP_EVEN);
isa_writeb(CMD_IN_SRB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
diff --git a/drivers/net/tokenring/ibmtr.h b/drivers/net/tokenring/ibmtr.h
index 769af277a..3e341078b 100644
--- a/drivers/net/tokenring/ibmtr.h
+++ b/drivers/net/tokenring/ibmtr.h
@@ -133,9 +133,9 @@
#define TCR_ODD 0x0D
#define TVR_EVEN 0x0E /* Timer value registers - even and odd */
#define TVR_ODD 0x0F
-#define SRPR_EVEN 0x10 /* Shared RAM paging registers - even and odd */
+#define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */
#define SRPR_ENABLE_PAGING 0xc0
-#define SRPR_ODD 0x11 /* Not used. */
+#define SRPR_ODD 0x19 /* Not used. */
#define TOKREAD 0x60
#define TOKOR 0x40
#define TOKAND 0x20
@@ -162,7 +162,7 @@
#define ACA_RW 0x00
#ifdef ENABLE_PAGING
-#define SET_PAGE(x) (isa_writeb(((x>>8)&ti.page_mask), \
+#define SET_PAGE(x) (isa_writeb((x), \
ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN))
#else
#define SET_PAGE(x)
@@ -205,6 +205,11 @@ struct tok_info {
__u32 ssb; /* System Status Block address */
__u32 arb; /* Adapter Request Block address */
__u32 asb; /* Adapter Status Block address */
+ __u8 init_srb_page;
+ __u8 srb_page;
+ __u8 ssb_page;
+ __u8 arb_page;
+ __u8 asb_page;
unsigned short exsap_station_id;
unsigned short global_int_enable;
struct sk_buff *current_skb;
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index 7ac6aa08d..b009a8a4b 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -56,6 +56,12 @@ static struct eeprom_fixup eeprom_fixups[] __devinitdata = {
0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */
}},
+ {"NetWinder", 0x00, 0x10, 0x57,
+ /* Default media = MII
+ * MII block, reset sequence (3) = 0x0821 0x0000 0x0001, capabilities 0x01e1
+ */
+ { 0x1e00, 0x0000, 0x000b, 0x8f01, 0x0103, 0x0300, 0x0821, 0x000, 0x0001, 0x0000, 0x01e1 }
+ },
{0, 0, 0, 0, {}}};
diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
index 3642a13b4..a5cdc6b8d 100644
--- a/drivers/net/tulip/tulip.h
+++ b/drivers/net/tulip/tulip.h
@@ -50,7 +50,6 @@ enum chips {
DC21140 = 2,
DC21142 = 3, DC21143 = 3,
LC82C168,
- NGMC169,
MX98713,
MX98715,
MX98725,
@@ -242,8 +241,10 @@ struct mediainfo {
struct tulip_private {
const char *product_name;
struct net_device *next_module;
- struct tulip_rx_desc rx_ring[RX_RING_SIZE];
- struct tulip_tx_desc tx_ring[TX_RING_SIZE];
+ struct tulip_rx_desc *rx_ring;
+ struct tulip_tx_desc *tx_ring;
+ dma_addr_t rx_ring_dma;
+ dma_addr_t tx_ring_dma;
/* The saved address of a sent-in-place packet/buffer, for skfree(). */
struct sk_buff *tx_skbuff[TX_RING_SIZE];
/* The addresses of receive-in-place skbuffs. */
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 3be78468b..dbbaaa5d7 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -19,7 +19,7 @@
*/
-static const char version[] = "Linux Tulip driver version 0.9.3 (Feb 23, 2000)\n";
+static const char version[] = "Linux Tulip driver version 0.9.4 (Feb 28, 2000)\n";
#include <linux/module.h>
#include "tulip.h"
@@ -51,7 +51,7 @@ const char * const medianame[] = {
};
/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
-#ifdef __alpha__
+#if defined(__alpha__) || defined(__arm__)
static int rx_copybreak = 1518;
#else
static int rx_copybreak = 100;
@@ -74,6 +74,8 @@ static int rx_copybreak = 100;
static int csr0 = 0x01A00000 | 0xE000;
#elif defined(__i386__) || defined(__powerpc__) || defined(__sparc__)
static int csr0 = 0x01A00000 | 0x8000;
+#elif defined(__arm__)
+static int csr0 = 0x01A00000 | 0x4800;
#else
#warning Processor architecture undefined!
static int csr0 = 0x00A00000 | 0x4800;
@@ -123,8 +125,6 @@ struct tulip_chip_table tulip_tbl[] = {
t21142_timer },
{ "Lite-On 82c168 PNIC", 256, 0x0001ebef,
HAS_MII | HAS_PNICNWAY, pnic_timer },
- { "NETGEAR NGMC169 MAC", 256, 0x0001ebef,
- HAS_MII | HAS_PNICNWAY, pnic_timer },
{ "Macronix 98713 PMAC", 128, 0x0001ebef,
HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer },
{ "Macronix 98715 PMAC", 256, 0x0001ebef,
@@ -155,7 +155,6 @@ static struct pci_device_id tulip_pci_tbl[] __devinitdata = {
{ 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
{ 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 },
{ 0x11AD, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, LC82C168 },
- { 0x1385, 0xf004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NGMC169 },
{ 0x10d9, 0x0512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98713 },
{ 0x10d9, 0x0531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
{ 0x10d9, 0x0531, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98725 },
@@ -301,8 +300,8 @@ static void tulip_up(struct net_device *dev)
tp->cur_tx++;
}
- outl(virt_to_bus(tp->rx_ring), ioaddr + CSR3);
- outl(virt_to_bus(tp->tx_ring), ioaddr + CSR4);
+ outl(tp->rx_ring_dma, ioaddr + CSR3);
+ outl(tp->tx_ring_dma, ioaddr + CSR4);
tp->saved_if_port = dev->if_port;
if (dev->if_port == 0)
@@ -569,12 +568,12 @@ static void tulip_init_ring(struct net_device *dev)
for (i = 0; i < RX_RING_SIZE; i++) {
tp->rx_ring[i].status = 0x00000000;
tp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ);
- tp->rx_ring[i].buffer2 = virt_to_le32desc(&tp->rx_ring[i+1]);
+ tp->rx_ring[i].buffer2 = cpu_to_le32(tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * (i + 1));
tp->rx_skbuff[i] = NULL;
}
/* Mark the last entry as wrapping the ring. */
tp->rx_ring[i-1].length = cpu_to_le32(PKT_BUF_SZ | DESC_RING_WRAP);
- tp->rx_ring[i-1].buffer2 = virt_to_le32desc(&tp->rx_ring[0]);
+ tp->rx_ring[i-1].buffer2 = cpu_to_le32(tp->rx_ring_dma);
for (i = 0; i < RX_RING_SIZE; i++) {
/* Note the receive buffer must be longword aligned.
@@ -595,9 +594,9 @@ static void tulip_init_ring(struct net_device *dev)
for (i = 0; i < TX_RING_SIZE; i++) {
tp->tx_skbuff[i] = 0;
tp->tx_ring[i].status = 0x00000000;
- tp->tx_ring[i].buffer2 = virt_to_le32desc(&tp->tx_ring[i+1]);
+ tp->tx_ring[i].buffer2 = cpu_to_le32(tp->tx_ring_dma + sizeof(struct tulip_tx_desc) * (i + 1));
}
- tp->tx_ring[i-1].buffer2 = virt_to_le32desc(&tp->tx_ring[0]);
+ tp->tx_ring[i-1].buffer2 = cpu_to_le32(tp->tx_ring_dma);
}
static int
@@ -1033,6 +1032,13 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
*/
tp = dev->priv;
+ tp->rx_ring = pci_alloc_consistent(pdev,
+ sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
+ sizeof(struct tulip_tx_desc) * TX_RING_SIZE,
+ &tp->rx_ring_dma);
+ tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE);
+ tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE;
+
tp->chip_id = chip_idx;
tp->flags = tulip_tbl[chip_idx].flags;
tp->pdev = pdev;
@@ -1352,6 +1358,11 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev)
if (dev) {
struct tulip_private *tp = (struct tulip_private *)dev->priv;
+ pci_free_consistent(pdev,
+ sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
+ sizeof(struct tulip_tx_desc) * TX_RING_SIZE,
+ tp->rx_ring,
+ tp->rx_ring_dma);
unregister_netdev(dev);
release_region(dev->base_addr,
tulip_tbl[tp->chip_id].io_size);
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);
diff --git a/drivers/net/wavelan.c b/drivers/net/wavelan.c
index 17b285ba4..45592eacf 100644
--- a/drivers/net/wavelan.c
+++ b/drivers/net/wavelan.c
@@ -3726,7 +3726,7 @@ static void wavelan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
/* Release spinlock here so that wv_hw_reset() can grab it */
- spin_unlock (&lp->lock);
+ spin_unlock (&lp->spinlock);
/* Check the state of the command unit. */
if (((status & SCB_ST_CNA) == SCB_ST_CNA) ||
@@ -4006,7 +4006,7 @@ static int __init wavelan_config(device * dev)
lp->mc_count = 0;
/* Init spinlock */
- spin_lock_init(&lp->lock);
+ spin_lock_init(&lp->spinlock);
/*
* Fill in the fields of the device structure
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index a907847c0..7eb759b94 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -103,6 +103,22 @@ static int gx_fix = 0;
#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
+#ifdef USE_IO_OPS
+#define YF_INB inb
+#define YF_INW inw
+#define YF_INL inl
+#define YF_OUTB outb
+#define YF_OUTW outw
+#define YF_OUTL outl
+#else
+#define YF_INB readb
+#define YF_INW readw
+#define YF_INL readl
+#define YF_OUTB writeb
+#define YF_OUTW writew
+#define YF_OUTL writel
+#endif
+
/*
Theory of Operation
@@ -357,11 +373,11 @@ static int __devinit read_eeprom(long ioaddr, int location)
{
int bogus_cnt = 10000; /* Typical 33Mhz: 1050 ticks */
- outb(location, ioaddr + EEAddr);
- outb(0x30 | ((location >> 8) & 7), ioaddr + EECtrl);
- while ((inb(ioaddr + EEStatus) & 0x80) && --bogus_cnt > 0)
+ YF_OUTB(location, ioaddr + EEAddr);
+ YF_OUTB(0x30 | ((location >> 8) & 7), ioaddr + EECtrl);
+ while ((YF_INB(ioaddr + EEStatus) & 0x80) && --bogus_cnt > 0)
;
- return inb(ioaddr + EERead);
+ return YF_INB(ioaddr + EERead);
}
/* MII Managemen Data I/O accesses.
@@ -372,24 +388,24 @@ static int mdio_read(long ioaddr, int phy_id, int location)
{
int i;
- outw((phy_id<<8) + location, ioaddr + MII_Addr);
- outw(1, ioaddr + MII_Cmd);
+ YF_OUTW((phy_id<<8) + location, ioaddr + MII_Addr);
+ YF_OUTW(1, ioaddr + MII_Cmd);
for (i = 10000; i >= 0; i--)
- if ((inw(ioaddr + MII_Status) & 1) == 0)
+ if ((YF_INW(ioaddr + MII_Status) & 1) == 0)
break;
- return inw(ioaddr + MII_Rd_Data);
+ return YF_INW(ioaddr + MII_Rd_Data);
}
static void mdio_write(long ioaddr, int phy_id, int location, int value)
{
int i;
- outw((phy_id<<8) + location, ioaddr + MII_Addr);
- outw(value, ioaddr + MII_Wr_Data);
+ YF_OUTW((phy_id<<8) + location, ioaddr + MII_Addr);
+ YF_OUTW(value, ioaddr + MII_Wr_Data);
/* Wait for the command to finish. */
for (i = 10000; i >= 0; i--)
- if ((inw(ioaddr + MII_Status) & 1) == 0)
+ if ((YF_INW(ioaddr + MII_Status) & 1) == 0)
break;
return;
}
@@ -402,7 +418,7 @@ static int yellowfin_open(struct net_device *dev)
int i;
/* Reset the chip. */
- outl(0x80000000, ioaddr + DMACtrl);
+ YF_OUTL(0x80000000, ioaddr + DMACtrl);
if (request_irq(dev->irq, &yellowfin_interrupt, SA_SHIRQ, dev->name, dev))
return -EAGAIN;
@@ -415,30 +431,30 @@ static int yellowfin_open(struct net_device *dev)
yellowfin_init_ring(dev);
- outl(virt_to_bus(yp->rx_ring), ioaddr + RxPtr);
- outl(virt_to_bus(yp->tx_ring), ioaddr + TxPtr);
+ YF_OUTL(virt_to_bus(yp->rx_ring), ioaddr + RxPtr);
+ YF_OUTL(virt_to_bus(yp->tx_ring), ioaddr + TxPtr);
for (i = 0; i < 6; i++)
- outb(dev->dev_addr[i], ioaddr + StnAddr + i);
+ YF_OUTB(dev->dev_addr[i], ioaddr + StnAddr + i);
/* Set up various condition 'select' registers.
There are no options here. */
- outl(0x00800080, ioaddr + TxIntrSel); /* Interrupt on Tx abort */
- outl(0x00800080, ioaddr + TxBranchSel); /* Branch on Tx abort */
- outl(0x00400040, ioaddr + TxWaitSel); /* Wait on Tx status */
- outl(0x00400040, ioaddr + RxIntrSel); /* Interrupt on Rx done */
- outl(0x00400040, ioaddr + RxBranchSel); /* Branch on Rx error */
- outl(0x00400040, ioaddr + RxWaitSel); /* Wait on Rx done */
+ YF_OUTL(0x00800080, ioaddr + TxIntrSel); /* Interrupt on Tx abort */
+ YF_OUTL(0x00800080, ioaddr + TxBranchSel); /* Branch on Tx abort */
+ YF_OUTL(0x00400040, ioaddr + TxWaitSel); /* Wait on Tx status */
+ YF_OUTL(0x00400040, ioaddr + RxIntrSel); /* Interrupt on Rx done */
+ YF_OUTL(0x00400040, ioaddr + RxBranchSel); /* Branch on Rx error */
+ YF_OUTL(0x00400040, ioaddr + RxWaitSel); /* Wait on Rx done */
/* Initialize other registers: with so many this eventually this will
converted to an offset/value list. */
- outl(dma_ctrl, ioaddr + DMACtrl);
- outw(fifo_cfg, ioaddr + FIFOcfg);
+ YF_OUTL(dma_ctrl, ioaddr + DMACtrl);
+ YF_OUTW(fifo_cfg, ioaddr + FIFOcfg);
/* Enable automatic generation of flow control frames, period 0xffff. */
- outl(0x0030FFFF, ioaddr + FlowCtrl);
+ YF_OUTL(0x0030FFFF, ioaddr + FlowCtrl);
yp->tx_threshold = 32;
- outl(yp->tx_threshold, ioaddr + TxThreshold);
+ YF_OUTL(yp->tx_threshold, ioaddr + TxThreshold);
if (dev->if_port == 0)
dev->if_port = yp->default_port;
@@ -449,19 +465,19 @@ static int yellowfin_open(struct net_device *dev)
if (yp->flags & IsGigabit) {
/* We are always in full-duplex mode with gigabit! */
yp->full_duplex = 1;
- outw(0x01CF, ioaddr + Cnfg);
+ YF_OUTW(0x01CF, ioaddr + Cnfg);
} else {
- outw(0x0018, ioaddr + FrameGap0); /* 0060/4060 for non-MII 10baseT */
- outw(0x1018, ioaddr + FrameGap1);
- outw(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
+ YF_OUTW(0x0018, ioaddr + FrameGap0); /* 0060/4060 for non-MII 10baseT */
+ YF_OUTW(0x1018, ioaddr + FrameGap1);
+ YF_OUTW(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
}
set_rx_mode(dev);
/* Enable interrupts by setting the interrupt mask. */
- outw(0x81ff, ioaddr + IntrEnb); /* See enum intr_status_bits */
- outw(0x0000, ioaddr + EventStatus); /* Clear non-interrupting events */
- outl(0x80008000, ioaddr + RxCtrl); /* Start Rx and Tx channels. */
- outl(0x80008000, ioaddr + TxCtrl);
+ YF_OUTW(0x81ff, ioaddr + IntrEnb); /* See enum intr_status_bits */
+ YF_OUTW(0x0000, ioaddr + EventStatus); /* Clear non-interrupting events */
+ YF_OUTL(0x80008000, ioaddr + RxCtrl); /* Start Rx and Tx channels. */
+ YF_OUTL(0x80008000, ioaddr + TxCtrl);
if (yellowfin_debug > 2) {
printk(KERN_DEBUG "%s: Done yellowfin_open().\n",
@@ -486,7 +502,7 @@ static void yellowfin_timer(unsigned long data)
if (yellowfin_debug > 3) {
printk(KERN_DEBUG "%s: Yellowfin timer tick, status %8.8x.\n",
- dev->name, inw(ioaddr + IntrStatus));
+ dev->name, YF_INW(ioaddr + IntrStatus));
}
if (yp->mii_cnt) {
@@ -503,7 +519,7 @@ static void yellowfin_timer(unsigned long data)
|| (negotiated & 0x00C0) == 0x0040)) {
yp->full_duplex = 1;
}
- outw(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
+ YF_OUTW(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
if (mii_reg1 & 0x0004)
next_tick = 60*HZ;
@@ -523,7 +539,7 @@ static void yellowfin_tx_timeout(struct net_device *dev)
printk(KERN_WARNING "%s: Yellowfin transmit timed out at %d/%d Tx "
"status %4.4x, Rx status %4.4x, resetting...\n",
dev->name, yp->cur_tx, yp->dirty_tx,
- inl(ioaddr + TxStatus), inl(ioaddr + RxStatus));
+ YF_INL(ioaddr + TxStatus), YF_INL(ioaddr + RxStatus));
/* Note: these should be KERN_DEBUG. */
if (yellowfin_debug) {
@@ -543,7 +559,7 @@ static void yellowfin_tx_timeout(struct net_device *dev)
dev->if_port = 0;
/* Wake the potentially-idle transmit channel. */
- outl(0x10001000, dev->base_addr + TxCtrl);
+ YF_OUTL(0x10001000, dev->base_addr + TxCtrl);
if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE)
netif_wake_queue (dev); /* Typical path */
@@ -681,7 +697,7 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Non-x86 Todo: explicitly flush cache lines here. */
/* Wake the potentially-idle transmit channel. */
- outl(0x10001000, dev->base_addr + TxCtrl);
+ YF_OUTL(0x10001000, dev->base_addr + TxCtrl);
if (yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE)
netif_start_queue (dev); /* Typical path */
@@ -717,7 +733,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg
spin_lock (&yp->lock);
do {
- u16 intr_status = inw(ioaddr + IntrClear);
+ u16 intr_status = YF_INW(ioaddr + IntrClear);
if (yellowfin_debug > 4)
printk(KERN_DEBUG "%s: Yellowfin interrupt, status %4.4x.\n",
@@ -728,7 +744,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg
if (intr_status & (IntrRxDone | IntrEarlyRx)) {
yellowfin_rx(dev);
- outl(0x10001000, ioaddr + RxCtrl); /* Wake Rx engine. */
+ YF_OUTL(0x10001000, ioaddr + RxCtrl); /* Wake Rx engine. */
}
#ifdef NO_TXSTATS
@@ -845,7 +861,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg
if (yellowfin_debug > 3)
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
- dev->name, inw(ioaddr + IntrStatus));
+ dev->name, YF_INW(ioaddr + IntrStatus));
/* Code that should never be run! Perhaps remove after testing.. */
{
@@ -1023,18 +1039,19 @@ static int yellowfin_close(struct net_device *dev)
if (yellowfin_debug > 1) {
printk(KERN_DEBUG "%s: Shutting down ethercard, status was Tx %4.4x Rx %4.4x Int %2.2x.\n",
- dev->name, inw(ioaddr + TxStatus),
- inw(ioaddr + RxStatus), inw(ioaddr + IntrStatus));
+ dev->name, YF_INW(ioaddr + TxStatus),
+ YF_INW(ioaddr + RxStatus),
+ YF_INW(ioaddr + IntrStatus));
printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n",
dev->name, yp->cur_tx, yp->dirty_tx, yp->cur_rx, yp->dirty_rx);
}
/* Disable interrupts by clearing the interrupt mask. */
- outw(0x0000, ioaddr + IntrEnb);
+ YF_OUTW(0x0000, ioaddr + IntrEnb);
/* Stop the chip's Tx and Rx processes. */
- outl(0x80000000, ioaddr + RxCtrl);
- outl(0x80000000, ioaddr + TxCtrl);
+ YF_OUTL(0x80000000, ioaddr + RxCtrl);
+ YF_OUTL(0x80000000, ioaddr + TxCtrl);
del_timer(&yp->timer);
@@ -1043,7 +1060,7 @@ static int yellowfin_close(struct net_device *dev)
printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", (int)virt_to_bus(yp->tx_ring));
for (i = 0; i < TX_RING_SIZE*2; i++)
printk(" %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n",
- inl(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ',
+ YF_INL(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ',
i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr,
yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status);
printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status);
@@ -1055,7 +1072,7 @@ static int yellowfin_close(struct net_device *dev)
printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", (int)virt_to_bus(yp->rx_ring));
for (i = 0; i < RX_RING_SIZE; i++) {
printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n",
- inl(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ',
+ YF_INL(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ',
i, yp->rx_ring[i].dbdma_cmd, yp->rx_ring[i].addr,
yp->rx_ring[i].result_status);
if (yellowfin_debug > 6) {
@@ -1134,17 +1151,17 @@ static void set_rx_mode(struct net_device *dev)
{
struct yellowfin_private *yp = (struct yellowfin_private *)dev->priv;
long ioaddr = dev->base_addr;
- u16 cfg_value = inw(ioaddr + Cnfg);
+ u16 cfg_value = YF_INW(ioaddr + Cnfg);
/* Stop the Rx process to change any value. */
- outw(cfg_value & ~0x1000, ioaddr + Cnfg);
+ YF_OUTW(cfg_value & ~0x1000, ioaddr + Cnfg);
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
/* Unconditionally log net taps. */
printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
- outw(0x000F, ioaddr + AddrMode);
+ YF_OUTW(0x000F, ioaddr + AddrMode);
} else if ((dev->mc_count > 64) || (dev->flags & IFF_ALLMULTI)) {
/* Too many to filter well, or accept all multicasts. */
- outw(0x000B, ioaddr + AddrMode);
+ YF_OUTW(0x000B, ioaddr + AddrMode);
} else if (dev->mc_count > 0) { /* Must use the multicast hash table. */
struct dev_mc_list *mclist;
u16 hash_table[4];
@@ -1167,13 +1184,13 @@ static void set_rx_mode(struct net_device *dev)
}
/* Copy the hash table to the chip. */
for (i = 0; i < 4; i++)
- outw(hash_table[i], ioaddr + HashTbl + i*2);
- outw(0x0003, ioaddr + AddrMode);
+ YF_OUTW(hash_table[i], ioaddr + HashTbl + i*2);
+ YF_OUTW(0x0003, ioaddr + AddrMode);
} else { /* Normal, unicast/broadcast-only mode. */
- outw(0x0001, ioaddr + AddrMode);
+ YF_OUTW(0x0001, ioaddr + AddrMode);
}
/* Restart the Rx process. */
- outw(cfg_value | 0x1000, ioaddr + Cnfg);
+ YF_OUTW(cfg_value | 0x1000, ioaddr + Cnfg);
}
#ifdef HAVE_PRIVATE_IOCTL
@@ -1209,7 +1226,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
int option, i, irq;
int flags, chip_idx;
static int find_cnt = 0;
- long ioaddr;
+ long ioaddr, real_ioaddr;
chip_idx = ent->driver_data;
flags = chip_info[chip_idx].flags;
@@ -1243,18 +1260,20 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
pci_set_master (pdev);
#ifdef USE_IO_OPS
- ioaddr = pci_resource_start (pdev, 0);
+ real_ioaddr = ioaddr = pci_resource_start (pdev, 0);
#else
- ioaddr = pci_resource_start (pdev, 1);
+ real_ioaddr = ioaddr = pci_resource_start (pdev, 1);
+ ioaddr = ioremap(ioaddr, YELLOWFIN_SIZE);
#endif
irq = pdev->irq;
printk(KERN_INFO "%s: %s type %8x at 0x%lx, ",
- dev->name, chip_info[chip_idx].name, inl(ioaddr + ChipRev), ioaddr);
+ dev->name, chip_info[chip_idx].name,
+ YF_INL(ioaddr + ChipRev), real_ioaddr);
if (flags & IsGigabit)
for (i = 0; i < 6; i++)
- dev->dev_addr[i] = inb(ioaddr + StnAddr + i);
+ dev->dev_addr[i] = YF_INB(ioaddr + StnAddr + i);
else {
int ee_offset = (read_eeprom(ioaddr, 6) == 0xff ? 0x100 : 0);
for (i = 0; i < 6; i++)
@@ -1265,7 +1284,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq);
/* Reset the chip. */
- outl(0x80000000, ioaddr + DMACtrl);
+ YF_OUTL(0x80000000, ioaddr + DMACtrl);
dev->base_addr = ioaddr;
dev->irq = irq;