summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:20:15 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 20:20:15 -0800
commit5bf3be033f504f5fd79690fbb13d720407314e40 (patch)
tree96b4fdb8c54f2477829c648e6078a0e54f5e7a6e /drivers/net
parent98b8803038fa999212c37952adad1e04144f0ab7 (diff)
v2.4.10.1 -> v2.4.10.2
- me/Al Viro: fix bdget() oops with block device modules that don't clean up after they exit - Alan Cox: continued merging (drivers, license tags) - David Miller: sparc update, network fixes - Christoph Hellwig: work around broken drivers that add a gendisk more than once - Jakub Jelinek: handle more ELF loading special cases - Trond Myklebust: NFS client and lockd reclaimer cleanups/fixes - Greg KH: USB updates - Mikael Pettersson: sparate out local APIC / IO-APIC config options
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c501.c2
-rw-r--r--drivers/net/3c503.c2
-rw-r--r--drivers/net/3c505.c1
-rw-r--r--drivers/net/3c507.c33
-rw-r--r--drivers/net/3c509.c2
-rw-r--r--drivers/net/3c515.c4
-rw-r--r--drivers/net/3c59x.c2
-rw-r--r--drivers/net/8139too.c3
-rw-r--r--drivers/net/82596.c2
-rw-r--r--drivers/net/8390.c2
-rw-r--r--drivers/net/ac3200.c2
-rw-r--r--drivers/net/acenic.c2
-rw-r--r--drivers/net/aironet4500_card.c3
-rw-r--r--drivers/net/aironet4500_core.c2
-rw-r--r--drivers/net/aironet4500_proc.c1
-rw-r--r--drivers/net/arlan-proc.c1
-rw-r--r--drivers/net/arlan.c1
-rw-r--r--drivers/net/at1700.c2
-rw-r--r--drivers/net/atp.c2
-rw-r--r--drivers/net/bonding.c1
-rw-r--r--drivers/net/bsd_comp.c1
-rw-r--r--drivers/net/cs89x0.c2
-rw-r--r--drivers/net/de4x5.c2
-rw-r--r--drivers/net/de600.c3
-rw-r--r--drivers/net/de620.c2
-rw-r--r--drivers/net/defxx.c1
-rw-r--r--drivers/net/depca.c1
-rw-r--r--drivers/net/dgrs.c2
-rw-r--r--drivers/net/dl2k.c2
-rw-r--r--drivers/net/dmfe.c3
-rw-r--r--drivers/net/dummy.c1
-rw-r--r--drivers/net/e2100.c2
-rw-r--r--drivers/net/eepro.c2
-rw-r--r--drivers/net/eepro100.c107
-rw-r--r--drivers/net/eexpress.c2
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/eql.c1
-rw-r--r--drivers/net/es3210.c2
-rw-r--r--drivers/net/eth16i.c2
-rw-r--r--drivers/net/ethertap.c2
-rw-r--r--drivers/net/ewrk3.c2
-rw-r--r--drivers/net/fc/iph5526.c6
-rw-r--r--drivers/net/fc/tach.h6
-rw-r--r--drivers/net/hamachi.c2
-rw-r--r--drivers/net/hamradio/yam.c13
-rw-r--r--drivers/net/hp-plus.c2
-rw-r--r--drivers/net/hp.c2
-rw-r--r--drivers/net/hp100.c4732
-rw-r--r--drivers/net/irda/actisys.c2
-rw-r--r--drivers/net/irda/ali-ircc.c2
-rw-r--r--drivers/net/irda/esi.c1
-rw-r--r--drivers/net/irda/girbil.c2
-rw-r--r--drivers/net/irda/irport.c2
-rw-r--r--drivers/net/irda/irtty.c2
-rw-r--r--drivers/net/irda/litelink.c2
-rw-r--r--drivers/net/irda/nsc-ircc.c2
-rw-r--r--drivers/net/irda/old_belkin.c2
-rw-r--r--drivers/net/irda/smc-ircc.c10
-rw-r--r--drivers/net/irda/tekram.c1
-rw-r--r--drivers/net/irda/toshoboe.c2
-rw-r--r--drivers/net/irda/vlsi_ir.c2
-rw-r--r--drivers/net/irda/w83977af_ir.c2
-rw-r--r--drivers/net/lance.c2
-rw-r--r--drivers/net/lne390.c1
-rw-r--r--drivers/net/lp486e.c2
-rw-r--r--drivers/net/mac89x0.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/ne.c2
-rw-r--r--drivers/net/ne2k-pci.c2
-rw-r--r--drivers/net/ne3210.c2
-rw-r--r--drivers/net/ni5010.c1
-rw-r--r--drivers/net/ni52.c1
-rw-r--r--drivers/net/ni65.c1
-rw-r--r--drivers/net/ns83820.c112
-rw-r--r--drivers/net/pcmcia/3c574_cs.c1
-rw-r--r--drivers/net/pcmcia/3c589_cs.c1
-rw-r--r--drivers/net/pcmcia/aironet4500_cs.c2
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c1
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c1
-rw-r--r--drivers/net/pcmcia/netwave_cs.c1
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/pcmcia/ray_cs.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c1
-rw-r--r--drivers/net/pcmcia/wavelan_cs.c1
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c1
-rw-r--r--drivers/net/pcmcia/xircom_cb.c1
-rw-r--r--drivers/net/pcmcia/xircom_tulip_cb.c2
-rw-r--r--drivers/net/pcnet32.c1
-rw-r--r--drivers/net/plip.c1
-rw-r--r--drivers/net/ppp_async.c2
-rw-r--r--drivers/net/ppp_deflate.c1
-rw-r--r--drivers/net/rcpci45.c1
-rw-r--r--drivers/net/sb1000.c2
-rw-r--r--drivers/net/shaper.c1
-rw-r--r--drivers/net/sis900.c2
-rw-r--r--drivers/net/sk98lin/skge.c1
-rw-r--r--drivers/net/skfp/skfddi.c1
-rw-r--r--drivers/net/slhc.c1
-rw-r--r--drivers/net/slip.c1
-rw-r--r--drivers/net/smc-ultra.c2
-rw-r--r--drivers/net/smc-ultra32.c2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/strip.c2
-rw-r--r--drivers/net/sundance.c2
-rw-r--r--drivers/net/sungem.c2
-rw-r--r--drivers/net/sunhme.c2
-rw-r--r--drivers/net/tlan.c8
-rw-r--r--drivers/net/tokenring/lanstreamer.c1
-rw-r--r--drivers/net/tulip/tulip_core.c5
-rw-r--r--drivers/net/tun.c1
-rw-r--r--drivers/net/via-rhine.c2
-rw-r--r--drivers/net/wan/cycx_drv.c2
-rw-r--r--drivers/net/wan/hostess_sv11.c18
-rw-r--r--drivers/net/wan/sealevel.c22
-rw-r--r--drivers/net/wavelan.c4
-rw-r--r--drivers/net/wd.c1
-rw-r--r--drivers/net/winbond-840.c2
-rw-r--r--drivers/net/yellowfin.c2
119 files changed, 2669 insertions, 2587 deletions
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c
index ea06d383a564..13a272d5f7e8 100644
--- a/drivers/net/3c501.c
+++ b/drivers/net/3c501.c
@@ -980,6 +980,8 @@ void cleanup_module(void)
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c
index bc2a162b7ab2..c1768a1d078a 100644
--- a/drivers/net/3c503.c
+++ b/drivers/net/3c503.c
@@ -667,6 +667,8 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 4ce3e811430e..7f91256e65ab 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -1673,3 +1673,4 @@ void cleanup_module(void)
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c
index f97ad039d42e..df46dbbebfd5 100644
--- a/drivers/net/3c507.c
+++ b/drivers/net/3c507.c
@@ -126,6 +126,7 @@ struct net_local {
ushort tx_head;
ushort tx_cmd_link;
ushort tx_reap;
+ ushort tx_pkts_in_ring;
spinlock_t lock;
};
@@ -194,7 +195,7 @@ struct net_local {
#define DUMP_DATA 0x56 /* A 170 byte buffer for dump and Set-MC into. */
#define TX_BUF_START 0x0100
-#define NUM_TX_BUFS 4
+#define NUM_TX_BUFS 5
#define TX_BUF_SIZE (1518+14+20+16) /* packet+header+TBD */
#define RX_BUF_START 0x2000
@@ -463,6 +464,7 @@ static void el16_tx_timeout (struct net_device *dev)
printk ("Resetting board.\n");
/* Completely reset the adaptor. */
init_82586_mem (dev);
+ lp->tx_pkts_in_ring = 0;
} else {
/* Issue the channel attention signal and hope it "gets better". */
if (net_debug > 1)
@@ -538,30 +540,34 @@ static void el16_interrupt(int irq, void *dev_id, struct pt_regs *regs)
outb(0x80, ioaddr + MISC_CTRL);
/* Reap the Tx packet buffers. */
- while (lp->tx_reap != lp->tx_head) {
+ while (lp->tx_pkts_in_ring) {
unsigned short tx_status = isa_readw(shmem+lp->tx_reap);
-
- if (tx_status == 0) {
- if (net_debug > 5) printk("Couldn't reap %#x.\n", lp->tx_reap);
+ if (!(tx_status & 0x8000)) {
+ if (net_debug > 5)
+ printk("Tx command incomplete (%#x).\n", lp->tx_reap);
break;
}
- if (tx_status & 0x2000) {
- lp->stats.tx_packets++;
- lp->stats.collisions += tx_status & 0xf;
- netif_wake_queue(dev);
- } else {
+ /* Tx unsuccessful or some interesting status bit set. */
+ if (!(tx_status & 0x2000) || (tx_status & 0x0f3f)) {
lp->stats.tx_errors++;
if (tx_status & 0x0600) lp->stats.tx_carrier_errors++;
if (tx_status & 0x0100) lp->stats.tx_fifo_errors++;
if (!(tx_status & 0x0040)) lp->stats.tx_heartbeat_errors++;
if (tx_status & 0x0020) lp->stats.tx_aborted_errors++;
+ lp->stats.collisions += tx_status & 0xf;
}
+ lp->stats.tx_packets++;
if (net_debug > 5)
printk("Reaped %x, Tx status %04x.\n" , lp->tx_reap, tx_status);
lp->tx_reap += TX_BUF_SIZE;
if (lp->tx_reap > RX_BUF_START - TX_BUF_SIZE)
lp->tx_reap = TX_BUF_START;
- if (++boguscount > 4)
+
+ lp->tx_pkts_in_ring--;
+ /* There is always more space in the Tx ring buffer now. */
+ netif_wake_queue(dev);
+
+ if (++boguscount > 10)
break;
}
@@ -782,7 +788,8 @@ static void hardware_send_packet(struct net_device *dev, void *buf, short length
dev->name, ioaddr, length, tx_block, lp->tx_head);
}
- if (lp->tx_head != lp->tx_reap)
+ /* Grimly block further packets if there has been insufficient reaping. */
+ if (++lp->tx_pkts_in_ring < NUM_TX_BUFS)
netif_wake_queue(dev);
}
@@ -892,6 +899,8 @@ cleanup_module(void)
release_region(dev_3c507.base_addr, EL16_IO_EXTENT);
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index c9d14503ffd5..8b392f29f55b 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -202,6 +202,8 @@ static struct isapnp_device_id el3_isapnp_adapters[] __initdata = {
};
MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters);
+MODULE_LICENSE("GPL");
+
static u16 el3_isapnp_phys_addr[8][3];
#endif /* CONFIG_ISAPNP || CONFIG_ISAPNP_MODULE */
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 4159fae8a8c4..be9a92d2fed6 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -82,14 +82,14 @@ static int max_interrupt_work = 20;
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("3Com 3c515 Corkscrew driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
MODULE_PARM(rx_copybreak, "i");
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM_DESC(debug, "3c515 debug level (0-6)");
MODULE_PARM_DESC(options, "3c515: Bits 0-2: media type, bit 3: full duplex, bit 4: bus mastering");
-MODULE_PARM_DESC(full_duplex, "(ignored)");
MODULE_PARM_DESC(rx_copybreak, "3c515 copy breakpoint for copy-only-tiny-frames");
MODULE_PARM_DESC(max_interrupt_work, "3c515 maximum events handled per interrupt");
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 578f530ee25b..32899ae207c4 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -267,6 +267,8 @@ DRV_NAME ": Donald Becker and others. www.scyld.com/network/vortex.html\n";
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver "
DRV_VERSION " " DRV_RELDATE);
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 815eed82e0da..68b3035ff289 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -592,6 +592,8 @@ struct rtl8139_private {
MODULE_AUTHOR ("Jeff Garzik <jgarzik@mandrakesoft.com>");
MODULE_DESCRIPTION ("RealTek RTL-8139 Fast Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM (multicast_filter_limit, "i");
MODULE_PARM (max_interrupt_work, "i");
MODULE_PARM (media, "1-" __MODULE_STRING(MAX_UNITS) "i");
@@ -825,6 +827,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
#ifdef USE_IO_OPS
ioaddr = (void *) pio_start;
dev->base_addr = pio_start;
+ tp->mmio_addr = ioaddr;
#else
/* ioremap MMIO region */
ioaddr = ioremap (mmio_start, mmio_len);
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index bd7d379ed1d5..99b8c2901348 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -150,6 +150,8 @@ static int i596_debug = (DEB_SERIOUS|DEB_PROBE);
MODULE_AUTHOR("Richard Hirst");
MODULE_DESCRIPTION("i82596 driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(i596_debug, "i");
MODULE_PARM_DESC(i596_debug, "i82596 debug mask");
diff --git a/drivers/net/8390.c b/drivers/net/8390.c
index 380e4e664094..67064058e218 100644
--- a/drivers/net/8390.c
+++ b/drivers/net/8390.c
@@ -1156,6 +1156,8 @@ void cleanup_module(void)
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index 46cb71b2455b..2daff418971b 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -395,6 +395,8 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 1fb3c1785c7a..ca08e724a535 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -747,6 +747,8 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
#ifdef MODULE
MODULE_AUTHOR("Jes Sorensen <jes@trained-monkey.org>");
MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(link, "1-" __MODULE_STRING(8) "i");
MODULE_PARM(trace, "1-" __MODULE_STRING(8) "i");
MODULE_PARM(tx_coal_tick, "1-" __MODULE_STRING(8) "i");
diff --git a/drivers/net/aironet4500_card.c b/drivers/net/aironet4500_card.c
index 596a946661d4..5f5a4f84137c 100644
--- a/drivers/net/aironet4500_card.c
+++ b/drivers/net/aironet4500_card.c
@@ -38,6 +38,7 @@ static const char *awc_version =
#include <linux/if_arp.h>
#include <linux/ioport.h>
#include <linux/delay.h>
+#include <linux/init.h>
#include "aironet4500.h"
@@ -66,6 +67,8 @@ static struct pci_device_id aironet4500_card_pci_tbl[] __devinitdata = {
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(pci, aironet4500_card_pci_tbl);
+MODULE_LICENSE("GPL");
+
static int reverse_probe;
diff --git a/drivers/net/aironet4500_core.c b/drivers/net/aironet4500_core.c
index 9a07d2f02665..a04c7e0f5957 100644
--- a/drivers/net/aironet4500_core.c
+++ b/drivers/net/aironet4500_core.c
@@ -2582,6 +2582,8 @@ MODULE_PARM_DESC(master,"Aironet is Adhoc master (creates network sync) (0-1)");
MODULE_PARM_DESC(slave,"Aironet is Adhoc slave (0-1)");
MODULE_PARM_DESC(max_mtu,"Aironet MTU limit (256-2312)");
#endif
+MODULE_LICENSE("GPL");
+
/*EXPORT_SYMBOL(tx_queue_len);
EXPORT_SYMBOL(awc_debug);
diff --git a/drivers/net/aironet4500_proc.c b/drivers/net/aironet4500_proc.c
index 56a951e1d72a..1946e9c7a849 100644
--- a/drivers/net/aironet4500_proc.c
+++ b/drivers/net/aironet4500_proc.c
@@ -604,3 +604,4 @@ module_init(aironet_proc_init);
module_exit(aironet_proc_exit);
#endif // whole proc system styff
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/arlan-proc.c b/drivers/net/arlan-proc.c
index 2583736ad9a5..5ae3c12f1dec 100644
--- a/drivers/net/arlan-proc.c
+++ b/drivers/net/arlan-proc.c
@@ -1068,3 +1068,4 @@ void cleanup_module(void)
};
#endif // MODULE
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/arlan.c b/drivers/net/arlan.c
index beef2128909c..2f8c50e4c38f 100644
--- a/drivers/net/arlan.c
+++ b/drivers/net/arlan.c
@@ -2079,3 +2079,4 @@ void cleanup_module(void)
#endif
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index d028df1e0dc7..b9171a449cee 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -918,6 +918,8 @@ cleanup_module(void)
release_region(dev_at1700.base_addr, AT1700_IO_EXTENT);
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/atp.c b/drivers/net/atp.c
index 31a337ee4d20..62d7ceaeaad0 100644
--- a/drivers/net/atp.c
+++ b/drivers/net/atp.c
@@ -151,6 +151,8 @@ static int xcvr[NUM_UNITS]; /* The data transfer mode. */
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("RealTek RTL8002/8012 parallel port Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(debug, "i");
MODULE_PARM(io, "1-" __MODULE_STRING(NUM_UNITS) "i");
diff --git a/drivers/net/bonding.c b/drivers/net/bonding.c
index 2442de9dcbae..f67756b700af 100644
--- a/drivers/net/bonding.c
+++ b/drivers/net/bonding.c
@@ -299,6 +299,7 @@ static void __exit bonding_exit(void)
module_init(bonding_init);
module_exit(bonding_exit);
+MODULE_LICENSE("GPL");
/*
* Local variables:
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c
index a35ead1ef5f1..401671513982 100644
--- a/drivers/net/bsd_comp.c
+++ b/drivers/net/bsd_comp.c
@@ -1173,3 +1173,4 @@ void __exit bsdcomp_cleanup(void)
module_init(bsdcomp_init);
module_exit(bsdcomp_cleanup);
+MODULE_LICENSE("BSD without advertising clause");
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index 42969a787451..b21549c65ca0 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1628,6 +1628,8 @@ MODULE_PARM_DESC(use_dma , "(ignored)");
#endif
MODULE_AUTHOR("Mike Cruse, Russwll Nelson <nelson@crynwr.com>, Andrew Morton <andrewm@uow.edu.au>");
+MODULE_LICENSE("GPL");
+
EXPORT_NO_SYMBOLS;
diff --git a/drivers/net/de4x5.c b/drivers/net/de4x5.c
index 7e30cde0db19..2b5cff2b930c 100644
--- a/drivers/net/de4x5.c
+++ b/drivers/net/de4x5.c
@@ -1047,6 +1047,8 @@ MODULE_PARM(args, "s");
MODULE_PARM_DESC(de4x5_debug, "de4x5 debug mask");
MODULE_PARM_DESC(dec_only, "de4x5 probe only for Digital boards (0-1)");
MODULE_PARM_DESC(args, "de4x5 full duplex and media type settings; see de4x5.c for details");
+MODULE_LICENSE("GPL");
+
# else
static int loading_module;
#endif /* MODULE */
diff --git a/drivers/net/de600.c b/drivers/net/de600.c
index 22314569e65c..b9e5282bfba1 100644
--- a/drivers/net/de600.c
+++ b/drivers/net/de600.c
@@ -841,6 +841,9 @@ cleanup_module(void)
release_region(DE600_IO, 3);
}
#endif /* MODULE */
+
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
* kernel-compile-command: "gcc -D__KERNEL__ -Ilinux/include -I../../net/inet -Wall -Wstrict-prototypes -O2 -m486 -c de600.c"
diff --git a/drivers/net/de620.c b/drivers/net/de620.c
index 080586930593..98d821621501 100644
--- a/drivers/net/de620.c
+++ b/drivers/net/de620.c
@@ -1008,6 +1008,8 @@ void cleanup_module(void)
release_region(de620_dev.base_addr, 3);
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* (add '-DMODULE' when compiling as loadable module)
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c
index ff3864a962e9..177dbed4ee1b 100644
--- a/drivers/net/defxx.c
+++ b/drivers/net/defxx.c
@@ -3413,6 +3413,7 @@ static void __exit dfx_cleanup(void)
module_init(dfx_init);
module_exit(dfx_cleanup);
+MODULE_LICENSE("GPL");
/*
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index ac218822da1d..e6f061bedbc6 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -2076,6 +2076,7 @@ cleanup_module(void)
release_region(thisDepca.base_addr, DEPCA_TOTAL_SIZE);
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
/*
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c
index a3422c810244..06e8f427c93e 100644
--- a/drivers/net/dgrs.c
+++ b/drivers/net/dgrs.c
@@ -126,6 +126,8 @@ static struct pci_device_id dgrs_pci_tbl[] __initdata = {
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(pci, dgrs_pci_tbl);
+MODULE_LICENSE("GPL");
+
/*
* Firmware. Compiled separately for local compilation,
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 66c12f38bb6d..4ca0cf5d8e06 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -34,6 +34,8 @@ static int int_timeout; /* Rx DMA wait time in 64ns increments */
MODULE_AUTHOR ("Edward Peng");
MODULE_DESCRIPTION ("D-Link DL2000-based Gigabit Ethernet Adapter");
+MODULE_LICENSE("GPL");
+
MODULE_PARM (mtu, "1-" __MODULE_STRING (MAX_UNITS) "i");
MODULE_PARM (media, "1-" __MODULE_STRING (MAX_UNITS) "s");
MODULE_PARM (vlan, "1-" __MODULE_STRING (MAX_UNITS) "i");
diff --git a/drivers/net/dmfe.c b/drivers/net/dmfe.c
index 16e1d97b403d..fba554e9ea22 100644
--- a/drivers/net/dmfe.c
+++ b/drivers/net/dmfe.c
@@ -2000,6 +2000,7 @@ static struct pci_device_id dmfe_pci_tbl[] __devinitdata = {
};
MODULE_DEVICE_TABLE(pci, dmfe_pci_tbl);
+
static struct pci_driver dmfe_driver = {
name: "dmfe",
id_table: dmfe_pci_tbl,
@@ -2009,6 +2010,8 @@ static struct pci_driver dmfe_driver = {
MODULE_AUTHOR("Sten Wang, sten_wang@davicom.com.tw");
MODULE_DESCRIPTION("Davicom DM910X fast ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
MODULE_PARM(mode, "i");
MODULE_PARM(cr6set, "i");
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index ac9aab20555c..bd9c573c7362 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -122,3 +122,4 @@ static void __exit dummy_cleanup_module(void)
module_init(dummy_init_module);
module_exit(dummy_cleanup_module);
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/e2100.c b/drivers/net/e2100.c
index 1224763df143..cdab71f225b6 100644
--- a/drivers/net/e2100.c
+++ b/drivers/net/e2100.c
@@ -440,6 +440,8 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c
index b35983103396..c12c00c59b0b 100644
--- a/drivers/net/eepro.c
+++ b/drivers/net/eepro.c
@@ -1767,6 +1767,8 @@ static int n_eepro;
MODULE_AUTHOR("Pascal Dupuis <dupuis@lei.ucl.ac.be> for the 2.1 stuff (locking,...)");
MODULE_DESCRIPTION("Intel i82595 ISA EtherExpressPro10/10+ driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_EEPRO) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_EEPRO) "i");
MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_EEPRO) "i");
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 18f60b762cd0..74a014ceef85 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -43,7 +43,8 @@ static int rxdmacount /* = 0 */;
/* Set the copy breakpoint for the copy-only-tiny-buffer Rx method.
Lower values use more memory, but are faster. */
-#if defined(__alpha__) || defined(__sparc__) || defined(__arm__)
+#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || \
+ defined(__arm__)
static int rx_copybreak = 1518;
#else
static int rx_copybreak = 200;
@@ -103,6 +104,7 @@ static int debug = -1; /* The debug level */
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/mii.h>
+#include <linux/delay.h>
#include <asm/bitops.h>
#include <asm/io.h>
@@ -114,6 +116,7 @@ static int debug = -1; /* The debug level */
MODULE_AUTHOR("Maintainer: Andrey V. Savochkin <saw@saw.sw.com.sg>");
MODULE_DESCRIPTION("Intel i82557/i82558/i82559 PCI EtherExpressPro driver");
+MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
MODULE_PARM(options, "1-" __MODULE_STRING(8) "i");
MODULE_PARM(full_duplex, "1-" __MODULE_STRING(8) "i");
@@ -165,7 +168,7 @@ static inline int null_set_power_state(struct pci_dev *dev, int state)
#endif
-int speedo_debug = 1;
+static int speedo_debug = 1;
/*
Theory of Operation
@@ -319,7 +322,7 @@ static inline void io_outw(unsigned int val, unsigned long port)
static inline void wait_for_cmd_done(long cmd_ioaddr)
{
int wait = 1000;
- do ;
+ do udelay(1) ;
while(inb(cmd_ioaddr) && --wait >= 0);
#ifndef final_version
if (wait < 0)
@@ -1332,57 +1335,64 @@ speedo_start_xmit(struct sk_buff *skb, struct net_device *dev)
long ioaddr = dev->base_addr;
int entry;
- { /* Prevent interrupts from changing the Tx ring from underneath us. */
- unsigned long flags;
-
- spin_lock_irqsave(&sp->lock, flags);
+ /* Prevent interrupts from changing the Tx ring from underneath us. */
+ unsigned long flags;
- /* Check if there are enough space. */
- if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
- printk(KERN_ERR "%s: incorrect tbusy state, fixed.\n", dev->name);
- netif_stop_queue(dev);
- sp->tx_full = 1;
- spin_unlock_irqrestore(&sp->lock, flags);
- return 1;
- }
+ spin_lock_irqsave(&sp->lock, flags);
- /* Calculate the Tx descriptor entry. */
- entry = sp->cur_tx++ % TX_RING_SIZE;
+ /* Check if there are enough space. */
+ if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
+ printk(KERN_ERR "%s: incorrect tbusy state, fixed.\n", dev->name);
+ netif_stop_queue(dev);
+ sp->tx_full = 1;
+ spin_unlock_irqrestore(&sp->lock, flags);
+ return 1;
+ }
- sp->tx_skbuff[entry] = skb;
- sp->tx_ring[entry].status =
- cpu_to_le32(CmdSuspend | CmdTx | CmdTxFlex);
- if (!(entry & ((TX_RING_SIZE>>2)-1)))
- sp->tx_ring[entry].status |= cpu_to_le32(CmdIntr);
- sp->tx_ring[entry].link =
- cpu_to_le32(TX_RING_ELEM_DMA(sp, sp->cur_tx % TX_RING_SIZE));
- sp->tx_ring[entry].tx_desc_addr =
- cpu_to_le32(TX_RING_ELEM_DMA(sp, entry) + TX_DESCR_BUF_OFFSET);
- /* The data region is always in one buffer descriptor. */
- sp->tx_ring[entry].count = cpu_to_le32(sp->tx_threshold);
- sp->tx_ring[entry].tx_buf_addr0 =
- cpu_to_le32(pci_map_single(sp->pdev, skb->data,
- skb->len, PCI_DMA_TODEVICE));
- sp->tx_ring[entry].tx_buf_size0 = cpu_to_le32(skb->len);
- /* Trigger the command unit resume. */
+ /* Calculate the Tx descriptor entry. */
+ entry = sp->cur_tx++ % TX_RING_SIZE;
+
+ sp->tx_skbuff[entry] = skb;
+ sp->tx_ring[entry].status =
+ cpu_to_le32(CmdSuspend | CmdTx | CmdTxFlex);
+ if (!(entry & ((TX_RING_SIZE>>2)-1)))
+ sp->tx_ring[entry].status |= cpu_to_le32(CmdIntr);
+ sp->tx_ring[entry].link =
+ cpu_to_le32(TX_RING_ELEM_DMA(sp, sp->cur_tx % TX_RING_SIZE));
+ sp->tx_ring[entry].tx_desc_addr =
+ cpu_to_le32(TX_RING_ELEM_DMA(sp, entry) + TX_DESCR_BUF_OFFSET);
+ /* The data region is always in one buffer descriptor. */
+ sp->tx_ring[entry].count = cpu_to_le32(sp->tx_threshold);
+ sp->tx_ring[entry].tx_buf_addr0 =
+ cpu_to_le32(pci_map_single(sp->pdev, skb->data,
+ skb->len, PCI_DMA_TODEVICE));
+ sp->tx_ring[entry].tx_buf_size0 = cpu_to_le32(skb->len);
+
+ /* workaround for hardware bug on 10 mbit half duplex */
+
+ if ((sp->partner==0) && (sp->chip_id==1)) {
wait_for_cmd_done(ioaddr + SCBCmd);
- clear_suspend(sp->last_cmd);
- /* We want the time window between clearing suspend flag on the previous
- command and resuming CU to be as small as possible.
- Interrupts in between are very undesired. --SAW */
- outb(CUResume, ioaddr + SCBCmd);
- sp->last_cmd = (struct descriptor *)&sp->tx_ring[entry];
-
- /* Leave room for set_rx_mode(). If there is no more space than reserved
- for multicast filter mark the ring as full. */
- if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
- netif_stop_queue(dev);
- sp->tx_full = 1;
- }
+ outb(0 , ioaddr + SCBCmd);
+ }
- spin_unlock_irqrestore(&sp->lock, flags);
+ /* Trigger the command unit resume. */
+ wait_for_cmd_done(ioaddr + SCBCmd);
+ clear_suspend(sp->last_cmd);
+ /* We want the time window between clearing suspend flag on the previous
+ command and resuming CU to be as small as possible.
+ Interrupts in between are very undesired. --SAW */
+ outb(CUResume, ioaddr + SCBCmd);
+ sp->last_cmd = (struct descriptor *)&sp->tx_ring[entry];
+
+ /* Leave room for set_rx_mode(). If there is no more space than reserved
+ for multicast filter mark the ring as full. */
+ if ((int)(sp->cur_tx - sp->dirty_tx) >= TX_QUEUE_LIMIT) {
+ netif_stop_queue(dev);
+ sp->tx_full = 1;
}
+ spin_unlock_irqrestore(&sp->lock, flags);
+
dev->trans_start = jiffies;
return 0;
@@ -2205,12 +2215,15 @@ static void __devexit eepro100_remove_one (struct pci_dev *pdev)
pci_free_consistent(pdev, TX_RING_SIZE * sizeof(struct TxFD)
+ sizeof(struct speedo_stats),
sp->tx_ring, sp->tx_ring_dma);
+ pci_disable_device(pdev);
kfree(dev);
}
static struct pci_device_id eepro100_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557,
PCI_ANY_ID, PCI_ANY_ID, },
+ { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82562ET,
+ PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER,
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ID1029,
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index 514dd7e4e2f7..a039bfc504d8 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -1634,6 +1634,8 @@ MODULE_PARM(io, "1-" __MODULE_STRING(EEXP_MAX_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(EEXP_MAX_CARDS) "i");
MODULE_PARM_DESC(io, "EtherExpress 16 I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherExpress 16 IRQ number(s)");
+MODULE_LICENSE("GPL");
+
/* Ideally the user would give us io=, irq= for every card. If any parameters
* are specified, we verify and then use them. If no parameters are given, we
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index f1c9d7e039a5..468c675b4ba0 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -138,6 +138,8 @@ static char version3[] __devinitdata =
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("SMC 83c170 EPIC series Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(rx_copybreak, "i");
diff --git a/drivers/net/eql.c b/drivers/net/eql.c
index aa3861ff3028..300f28d51b36 100644
--- a/drivers/net/eql.c
+++ b/drivers/net/eql.c
@@ -1016,6 +1016,7 @@ static void __exit eql_cleanup_module(void)
module_init(eql_init_module);
module_exit(eql_cleanup_module);
+MODULE_LICENSE("GPL");
/*
* Local Variables:
diff --git a/drivers/net/es3210.c b/drivers/net/es3210.c
index 7d89be9c5079..e9cd5bc553e9 100644
--- a/drivers/net/es3210.c
+++ b/drivers/net/es3210.c
@@ -429,3 +429,5 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index 469960cb1762..fc546e8b3e89 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -1405,6 +1405,8 @@ static int debug = -1;
#if (LINUX_VERSION_CODE >= 0x20115)
MODULE_AUTHOR("Mika Kuoppala <miku@iki.fi>");
MODULE_DESCRIPTION("ICL EtherTeam 16i/32 driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_ETH16I_CARDS) "i");
MODULE_PARM_DESC(io, "eth16i I/O base address(es)");
diff --git a/drivers/net/ethertap.c b/drivers/net/ethertap.c
index f02363ad6462..6bb635be09c9 100644
--- a/drivers/net/ethertap.c
+++ b/drivers/net/ethertap.c
@@ -374,3 +374,5 @@ void cleanup_module(void)
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index ce3911e7ed20..4b9319011880 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -1876,6 +1876,8 @@ void cleanup_module(void)
release_region(thisEthwrk.base_addr, EWRK3_TOTAL_SIZE);
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
diff --git a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c
index 8d91da5067ed..4b7f58f9afcb 100644
--- a/drivers/net/fc/iph5526.c
+++ b/drivers/net/fc/iph5526.c
@@ -1932,7 +1932,7 @@ u_int tachyon_status;
fi->g.name_server = FALSE;
fi->g.alpa_list_index = 0;
fi->g.ox_id = NOT_SCSI_XID;
- fi->g.my_mtu = FRAME_SIZE;
+ fi->g.my_mtu = TACH_FRAME_SIZE;
/* Implicitly LOGO with all logged-in nodes.
*/
@@ -2811,7 +2811,7 @@ int i;
else
if (logi == ELS_FLOGI)
fi->g.login.common_features = htons(FLOGI_C_F);
- fi->g.login.recv_data_field_size = htons(FRAME_SIZE);
+ fi->g.login.recv_data_field_size = htons(TACH_FRAME_SIZE);
fi->g.login.n_port_total_conc_seq = htons(CONCURRENT_SEQUENCES);
fi->g.login.rel_off_by_info_cat = htons(RO_INFO_CATEGORY);
fi->g.login.ED_TOV = htonl(E_D_TOV);
@@ -2847,7 +2847,7 @@ int i;
fi->g.login.c_of_s[2].service_options = htons(SERVICE_VALID);
fi->g.login.c_of_s[2].initiator_ctl = htons(0);
fi->g.login.c_of_s[2].recipient_ctl = htons(0);
- fi->g.login.c_of_s[2].recv_data_field_size = htons(FRAME_SIZE);
+ fi->g.login.c_of_s[2].recv_data_field_size = htons(TACH_FRAME_SIZE);
fi->g.login.c_of_s[2].concurrent_sequences = htons(CLASS3_CONCURRENT_SEQUENCE);
fi->g.login.c_of_s[2].n_port_end_to_end_credit = htons(0);
fi->g.login.c_of_s[2].open_seq_per_exchange = htons(CLASS3_OPEN_SEQUENCE);
diff --git a/drivers/net/fc/tach.h b/drivers/net/fc/tach.h
index 741812c5f554..3e90ec06786e 100644
--- a/drivers/net/fc/tach.h
+++ b/drivers/net/fc/tach.h
@@ -94,9 +94,9 @@
/* Size of the various buffers.
*/
-#define FRAME_SIZE 2048
-#define MFS_BUFFER_SIZE FRAME_SIZE
-#define SFS_BUFFER_SIZE (FRAME_SIZE + TACHYON_HEADER_LEN)
+#define TACH_FRAME_SIZE 2048
+#define MFS_BUFFER_SIZE TACH_FRAME_SIZE
+#define SFS_BUFFER_SIZE (TACH_FRAME_SIZE + TACHYON_HEADER_LEN)
#define SEST_BUFFER_SIZE 512
#define TACH_HEADER_SIZE 64
#define NO_OF_TACH_HEADERS ((MY_PAGE_SIZE)/TACH_HEADER_SIZE)
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 26cbf35279c3..c84b81dd1c50 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -521,6 +521,8 @@ struct hamachi_private {
MODULE_AUTHOR("Donald Becker <becker@scyld.com>, Eric Kasten <kasten@nscl.msu.edu>, Keith Underwood <keithu@parl.clemson.edu>");
MODULE_DESCRIPTION("Packet Engines 'Hamachi' GNIC-II Gigabit Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(mtu, "i");
MODULE_PARM(debug, "i");
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 3bf52f8465e4..5a871a8cbc84 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -35,6 +35,9 @@
* 0.6 F6FBB 25.08.98 Added 1200Bds format
* 0.7 F6FBB 12.09.98 Added to the kernel configuration
* 0.8 F6FBB 14.10.98 Fixed slottime/persistance timing bug
+ * OK1ZIA 2.09.01 Fixed "kfree_skb on hard IRQ"
+ * using dev_kfree_skb_any(). (important in 2.4 kernel)
+ *
*/
/*****************************************************************************/
@@ -649,16 +652,16 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp)
yp->tx_state = TX_DATA;
if (skb->data[0] != 0) {
/* do_kiss_params(s, skb->data, skb->len); */
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
break;
}
yp->tx_len = skb->len - 1; /* strip KISS byte */
if (yp->tx_len >= YAM_MAX_FRAME || yp->tx_len < 2) {
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
break;
}
memcpy(yp->tx_buf, skb->data + 1, yp->tx_len);
- dev_kfree_skb(skb);
+ dev_kfree_skb_any(skb);
yp->tx_count = 0;
yp->tx_crcl = 0x21;
yp->tx_crch = 0xf3;
@@ -858,7 +861,7 @@ static int yam_open(struct net_device *dev)
return -EIO;
}
outb(0, IER(dev->base_addr));
- if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, NULL)) {
+ if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, dev)) {
printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq);
return -EBUSY;
}
@@ -896,7 +899,7 @@ static int yam_close(struct net_device *dev)
outb(0, IER(dev->base_addr));
outb(1, MCR(dev->base_addr));
/* Remove IRQ handler if last */
- free_irq(dev->irq, NULL);
+ free_irq(dev->irq,dev);
release_region(dev->base_addr, YAM_EXTENT);
netif_stop_queue(dev);
while ((skb = skb_dequeue(&yp->send_queue)))
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index a5af15996251..f3d056d8a7f9 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -457,6 +457,8 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/hp.c b/drivers/net/hp.c
index 8c309f8643ec..1799981670b6 100644
--- a/drivers/net/hp.c
+++ b/drivers/net/hp.c
@@ -429,6 +429,8 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 36479e42df3e..0b25e65b9cca 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2,7 +2,7 @@
** hp100.c
** HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters
**
-** $Id: hp100.c,v 1.57 1998/04/10 16:27:23 perex Exp perex $
+** $Id: hp100.c,v 1.58 2001/09/24 18:03:01 perex Exp perex $
**
** Based on the HP100 driver written by Jaroslav Kysela <perex@jcu.cz>
** Extended for new busmaster capable chipsets by
@@ -45,6 +45,11 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
+** 1.57c -> 1.58
+** - used indent to change coding-style
+** - added KTI DP-200 EISA ID
+** - ioremap is also used for low (<1MB) memory (multi-architecture support)
+**
** 1.57b -> 1.57c - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
** - release resources on failure in init_module
**
@@ -78,18 +83,18 @@
**
*/
-#define HP100_DEFAULT_PRIORITY_TX 0
+#define HP100_DEFAULT_PRIORITY_TX 0
#undef HP100_DEBUG
-#undef HP100_DEBUG_B /* Trace */
-#undef HP100_DEBUG_BM /* Debug busmaster code (PDL stuff) */
+#undef HP100_DEBUG_B /* Trace */
+#undef HP100_DEBUG_BM /* Debug busmaster code (PDL stuff) */
-#undef HP100_DEBUG_TRAINING /* Debug login-to-hub procedure */
-#undef HP100_DEBUG_TX
-#undef HP100_DEBUG_IRQ
-#undef HP100_DEBUG_RX
+#undef HP100_DEBUG_TRAINING /* Debug login-to-hub procedure */
+#undef HP100_DEBUG_TX
+#undef HP100_DEBUG_IRQ
+#undef HP100_DEBUG_RX
-#undef HP100_MULTICAST_FILTER /* Need to be debugged... */
+#undef HP100_MULTICAST_FILTER /* Need to be debugged... */
#include <linux/version.h>
#include <linux/module.h>
@@ -110,7 +115,7 @@
#include <linux/skbuff.h>
#include <linux/types.h>
-#include <linux/config.h> /* for CONFIG_PCI */
+#include <linux/config.h> /* for CONFIG_PCI */
#include <linux/delay.h>
#include <linux/init.h>
@@ -144,7 +149,7 @@ EXPORT_NO_SYMBOLS;
#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005
#endif
-#define HP100_REGION_SIZE 0x20 /* for ioports */
+#define HP100_REGION_SIZE 0x20 /* for ioports */
#define HP100_MAX_PACKET_SIZE (1536+4)
#define HP100_MIN_PACKET_SIZE 60
@@ -164,51 +169,51 @@ EXPORT_NO_SYMBOLS;
*/
struct hp100_eisa_id {
- u_int id;
- const char *name;
- u_char bus;
+ u_int id;
+ const char *name;
+ u_char bus;
};
struct hp100_pci_id {
- u_short vendor;
- u_short device;
+ u_short vendor;
+ u_short device;
};
struct hp100_private {
- struct hp100_eisa_id *id;
- spinlock_t lock;
- u_short chip;
- u_short soft_model;
- u_int memory_size;
- u_int virt_memory_size;
- u_short rx_ratio; /* 1 - 99 */
- u_short priority_tx; /* != 0 - priority tx */
- u_short mode; /* PIO, Shared Mem or Busmaster */
- u_char bus;
- struct pci_dev *pci_dev;
- short mem_mapped; /* memory mapped access */
- void *mem_ptr_virt; /* virtual memory mapped area, maybe NULL */
- unsigned long mem_ptr_phys; /* physical memory mapped area */
- short lan_type; /* 10Mb/s, 100Mb/s or -1 (error) */
- int hub_status; /* was login to hub successful? */
- u_char mac1_mode;
- u_char mac2_mode;
- u_char hash_bytes[ 8 ];
- hp100_stats_t stats;
-
- /* Rings for busmaster mode: */
- hp100_ring_t *rxrhead; /* Head (oldest) index into rxring */
- hp100_ring_t *rxrtail; /* Tail (newest) index into rxring */
- hp100_ring_t *txrhead; /* Head (oldest) index into txring */
- hp100_ring_t *txrtail; /* Tail (newest) index into txring */
-
- hp100_ring_t rxring[ MAX_RX_PDL ];
- hp100_ring_t txring[ MAX_TX_PDL ];
-
- u_int *page_vaddr; /* Virtual address of allocated page */
- u_int *page_vaddr_algn; /* Aligned virtual address of allocated page */
- int rxrcommit; /* # Rx PDLs commited to adapter */
- int txrcommit; /* # Tx PDLs commited to adapter */
+ struct hp100_eisa_id *id;
+ spinlock_t lock;
+ u_short chip;
+ u_short soft_model;
+ u_int memory_size;
+ u_int virt_memory_size;
+ u_short rx_ratio; /* 1 - 99 */
+ u_short priority_tx; /* != 0 - priority tx */
+ u_short mode; /* PIO, Shared Mem or Busmaster */
+ u_char bus;
+ struct pci_dev *pci_dev;
+ short mem_mapped; /* memory mapped access */
+ void *mem_ptr_virt; /* virtual memory mapped area, maybe NULL */
+ unsigned long mem_ptr_phys; /* physical memory mapped area */
+ short lan_type; /* 10Mb/s, 100Mb/s or -1 (error) */
+ int hub_status; /* was login to hub successful? */
+ u_char mac1_mode;
+ u_char mac2_mode;
+ u_char hash_bytes[8];
+ hp100_stats_t stats;
+
+ /* Rings for busmaster mode: */
+ hp100_ring_t *rxrhead; /* Head (oldest) index into rxring */
+ hp100_ring_t *rxrtail; /* Tail (newest) index into rxring */
+ hp100_ring_t *txrhead; /* Head (oldest) index into txring */
+ hp100_ring_t *txrtail; /* Tail (newest) index into txring */
+
+ hp100_ring_t rxring[MAX_RX_PDL];
+ hp100_ring_t txring[MAX_TX_PDL];
+
+ u_int *page_vaddr; /* Virtual address of allocated page */
+ u_int *page_vaddr_algn; /* Aligned virtual address of allocated page */
+ int rxrcommit; /* # Rx PDLs commited to adapter */
+ int txrcommit; /* # Tx PDLs commited to adapter */
};
/*
@@ -217,62 +222,64 @@ struct hp100_private {
static struct hp100_eisa_id hp100_eisa_ids[] = {
- /* 10/100 EISA card with revision A Cascade chip */
- { 0x80F1F022, "HP J2577 rev A", HP100_BUS_EISA },
+ /* 10/100 EISA card with revision A Cascade chip */
+ {0x80F1F022, "HP J2577 rev A", HP100_BUS_EISA},
- /* 10/100 ISA card with revision A Cascade chip */
- { 0x50F1F022, "HP J2573 rev A", HP100_BUS_ISA },
+ /* 10/100 ISA card with revision A Cascade chip */
+ {0x50F1F022, "HP J2573 rev A", HP100_BUS_ISA},
- /* 10 only EISA card with Cascade chip */
- { 0x2019F022, "HP 27248B", HP100_BUS_EISA },
+ /* 10 only EISA card with Cascade chip */
+ {0x2019F022, "HP 27248B", HP100_BUS_EISA},
- /* 10/100 EISA card with Cascade chip */
- { 0x4019F022, "HP J2577", HP100_BUS_EISA },
+ /* 10/100 EISA card with Cascade chip */
+ {0x4019F022, "HP J2577", HP100_BUS_EISA},
- /* 10/100 ISA card with Cascade chip */
- { 0x5019F022, "HP J2573", HP100_BUS_ISA },
+ /* 10/100 ISA card with Cascade chip */
+ {0x5019F022, "HP J2573", HP100_BUS_ISA},
- /* 10/100 PCI card - old J2585A */
- { 0x1030103c, "HP J2585A", HP100_BUS_PCI },
+ /* 10/100 PCI card - old J2585A */
+ {0x1030103c, "HP J2585A", HP100_BUS_PCI},
- /* 10/100 PCI card - new J2585B - master capable */
- { 0x1041103c, "HP J2585B", HP100_BUS_PCI },
+ /* 10/100 PCI card - new J2585B - master capable */
+ {0x1041103c, "HP J2585B", HP100_BUS_PCI},
- /* 10 Mbit Combo Adapter */
- { 0x1042103c, "HP J2970", HP100_BUS_PCI },
+ /* 10 Mbit Combo Adapter */
+ {0x1042103c, "HP J2970", HP100_BUS_PCI},
- /* 10 Mbit 10baseT Adapter */
- { 0x1040103c, "HP J2973", HP100_BUS_PCI },
+ /* 10 Mbit 10baseT Adapter */
+ {0x1040103c, "HP J2973", HP100_BUS_PCI},
- /* 10/100 EISA card from Compex */
- { 0x0103180e, "ReadyLink ENET100-VG4", HP100_BUS_EISA },
+ /* 10/100 EISA card from Compex */
+ {0x0103180e, "ReadyLink ENET100-VG4", HP100_BUS_EISA},
- /* 10/100 EISA card from Compex - FreedomLine (sq5bpf) */
- /* Note: plhbrod@mbox.vol.cz reported that same ID have ISA */
- /* version of adapter, too... */
- { 0x0104180e, "FreedomLine 100/VG", HP100_BUS_EISA },
+ /* 10/100 EISA card from Compex - FreedomLine (sq5bpf) */
+ /* Note: plhbrod@mbox.vol.cz reported that same ID have ISA */
+ /* version of adapter, too... */
+ {0x0104180e, "FreedomLine 100/VG", HP100_BUS_EISA},
- /* 10/100 PCI card from Compex - FreedomLine
- *
- * I think this card doesn't like aic7178 scsi controller, but
- * I haven't tested this much. It works fine on diskless machines.
- * Jacek Lipkowski <sq5bpf@acid.ch.pw.edu.pl>
- */
- { 0x021211f6, "FreedomLine 100/VG", HP100_BUS_PCI },
-
- /* 10/100 PCI card from Compex (J2585A compatible) */
- { 0x011211f6, "ReadyLink ENET100-VG4", HP100_BUS_PCI }
+ /* 10/100 PCI card from Compex - FreedomLine
+ *
+ * I think this card doesn't like aic7178 scsi controller, but
+ * I haven't tested this much. It works fine on diskless machines.
+ * Jacek Lipkowski <sq5bpf@acid.ch.pw.edu.pl>
+ */
+ {0x021211f6, "FreedomLine 100/VG", HP100_BUS_PCI},
+ /* 10/100 PCI card from Compex (J2585A compatible) */
+ {0x011211f6, "ReadyLink ENET100-VG4", HP100_BUS_PCI},
+
+ /* 10/100 PCI card from KTI */
+ {0x40008e2e, "KTI DP-200", HP100_BUS_PCI }
};
#define HP100_EISA_IDS_SIZE (sizeof(hp100_eisa_ids)/sizeof(struct hp100_eisa_id))
#ifdef CONFIG_PCI
static struct hp100_pci_id hp100_pci_ids[] = {
- { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A },
- { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B },
- { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_ENET100VG4 },
- { PCI_VENDOR_ID_COMPEX2, PCI_DEVICE_ID_COMPEX2_100VG }
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B},
+ {PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_ENET100VG4},
+ {PCI_VENDOR_ID_COMPEX2, PCI_DEVICE_ID_COMPEX2_100VG}
};
#endif
@@ -280,62 +287,71 @@ static struct hp100_pci_id hp100_pci_ids[] = {
#if LINUX_VERSION_CODE >= 0x20400
static struct pci_device_id hp100_pci_tbl[] __initdata = {
- { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A, PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B, PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_ENET100VG4, PCI_ANY_ID, PCI_ANY_ID, },
- { PCI_VENDOR_ID_COMPEX2, PCI_DEVICE_ID_COMPEX2_100VG, PCI_ANY_ID, PCI_ANY_ID, },
- { } /* Terminating entry */
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A, PCI_ANY_ID, PCI_ANY_ID,},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B, PCI_ANY_ID, PCI_ANY_ID,},
+ {PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_ENET100VG4, PCI_ANY_ID, PCI_ANY_ID,},
+ {PCI_VENDOR_ID_COMPEX2, PCI_DEVICE_ID_COMPEX2_100VG, PCI_ANY_ID, PCI_ANY_ID,},
+ {} /* Terminating entry */
};
MODULE_DEVICE_TABLE(pci, hp100_pci_tbl);
-#endif /* LINUX_VERSION_CODE >= 0x20400 */
+#endif /* LINUX_VERSION_CODE >= 0x20400 */
static int hp100_rx_ratio = HP100_DEFAULT_RX_RATIO;
static int hp100_priority_tx = HP100_DEFAULT_PRIORITY_TX;
static int hp100_mode = 1;
-MODULE_PARM( hp100_rx_ratio, "1i" );
-MODULE_PARM( hp100_priority_tx, "1i" );
-MODULE_PARM( hp100_mode, "1i" );
+MODULE_PARM(hp100_rx_ratio, "1i");
+MODULE_PARM(hp100_priority_tx, "1i");
+MODULE_PARM(hp100_mode, "1i");
/*
* prototypes
*/
-static int hp100_probe1( struct net_device *dev, int ioaddr, u_char bus, struct pci_dev *pci_dev );
-static int hp100_open( struct net_device *dev );
-static int hp100_close( struct net_device *dev );
-static int hp100_start_xmit( struct sk_buff *skb, struct net_device *dev );
-static int hp100_start_xmit_bm (struct sk_buff *skb, struct net_device *dev );
-static void hp100_rx( struct net_device *dev );
-static hp100_stats_t *hp100_get_stats( struct net_device *dev );
-static void hp100_misc_interrupt( struct net_device *dev );
-static void hp100_update_stats( struct net_device *dev );
-static void hp100_clear_stats( struct hp100_private *lp, int ioaddr );
-static void hp100_set_multicast_list( struct net_device *dev);
-static void hp100_interrupt( int irq, void *dev_id, struct pt_regs *regs );
-static void hp100_start_interface( struct net_device *dev );
-static void hp100_stop_interface( struct net_device *dev );
-static void hp100_load_eeprom( struct net_device *dev, u_short ioaddr );
-static int hp100_sense_lan( struct net_device *dev );
-static int hp100_login_to_vg_hub( struct net_device *dev, u_short force_relogin );
-static int hp100_down_vg_link( struct net_device *dev );
-static void hp100_cascade_reset( struct net_device *dev, u_short enable );
-static void hp100_BM_shutdown( struct net_device *dev );
-static void hp100_mmuinit( struct net_device *dev );
-static void hp100_init_pdls( struct net_device *dev );
-static int hp100_init_rxpdl( struct net_device *dev, register hp100_ring_t *ringptr, register u_int *pdlptr);
-static int hp100_init_txpdl( struct net_device *dev, register hp100_ring_t *ringptr, register u_int *pdlptr);
-static void hp100_rxfill( struct net_device *dev );
-static void hp100_hwinit( struct net_device *dev );
-static void hp100_clean_txring( struct net_device *dev );
+static int hp100_probe1(struct net_device *dev, int ioaddr, u_char bus,
+ struct pci_dev *pci_dev);
+
+
+static int hp100_open(struct net_device *dev);
+static int hp100_close(struct net_device *dev);
+static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev);
+static int hp100_start_xmit_bm(struct sk_buff *skb,
+ struct net_device *dev);
+static void hp100_rx(struct net_device *dev);
+static hp100_stats_t *hp100_get_stats(struct net_device *dev);
+static void hp100_misc_interrupt(struct net_device *dev);
+static void hp100_update_stats(struct net_device *dev);
+static void hp100_clear_stats(struct hp100_private *lp, int ioaddr);
+static void hp100_set_multicast_list(struct net_device *dev);
+static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static void hp100_start_interface(struct net_device *dev);
+static void hp100_stop_interface(struct net_device *dev);
+static void hp100_load_eeprom(struct net_device *dev, u_short ioaddr);
+static int hp100_sense_lan(struct net_device *dev);
+static int hp100_login_to_vg_hub(struct net_device *dev,
+ u_short force_relogin);
+static int hp100_down_vg_link(struct net_device *dev);
+static void hp100_cascade_reset(struct net_device *dev, u_short enable);
+static void hp100_BM_shutdown(struct net_device *dev);
+static void hp100_mmuinit(struct net_device *dev);
+static void hp100_init_pdls(struct net_device *dev);
+static int hp100_init_rxpdl(struct net_device *dev,
+ register hp100_ring_t * ringptr,
+ register u_int * pdlptr);
+static int hp100_init_txpdl(struct net_device *dev,
+ register hp100_ring_t * ringptr,
+ register u_int * pdlptr);
+static void hp100_rxfill(struct net_device *dev);
+static void hp100_hwinit(struct net_device *dev);
+static void hp100_clean_txring(struct net_device *dev);
#ifdef HP100_DEBUG
-static void hp100_RegisterDump( struct net_device *dev );
+static void hp100_RegisterDump(struct net_device *dev);
#endif
/* TODO: This function should not really be needed in a good design... */
-static void wait( void )
+static void wait(void)
{
- mdelay(1);
+ mdelay(1);
}
/*
@@ -343,977 +359,923 @@ static void wait( void )
* These functions should - if possible - avoid doing write operations
* since this could cause problems when the card is not installed.
*/
-
-int __init hp100_probe( struct net_device *dev )
+
+int __init hp100_probe(struct net_device *dev)
{
- int base_addr = dev ? dev -> base_addr : 0;
- int ioaddr = 0;
+ int base_addr = dev ? dev->base_addr : 0;
+ int ioaddr = 0;
#ifdef CONFIG_PCI
- int pci_start_index = 0;
+ int pci_start_index = 0;
#endif
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4200, TRACE );
- printk( "hp100: %s: probe\n", dev->name );
-#endif
-
- if ( base_addr > 0xff ) /* Check a single specified location. */
- {
- if ( check_region( base_addr, HP100_REGION_SIZE ) ) return -EINVAL;
- if ( base_addr < 0x400 )
- return hp100_probe1( dev, base_addr, HP100_BUS_ISA, NULL );
- if ( EISA_bus && base_addr >= 0x1c38 && ( (base_addr - 0x1c38) & 0x3ff ) == 0 )
- return hp100_probe1( dev, base_addr, HP100_BUS_EISA, NULL );
+ hp100_outw(0x4200, TRACE);
+ printk("hp100: %s: probe\n", dev->name);
+#endif
+
+ if (base_addr > 0xff) { /* Check a single specified location. */
+ if (check_region(base_addr, HP100_REGION_SIZE))
+ return -EINVAL;
+ if (base_addr < 0x400)
+ return hp100_probe1(dev, base_addr, HP100_BUS_ISA,
+ NULL);
+ if (EISA_bus && base_addr >= 0x1c38 && ((base_addr - 0x1c38) & 0x3ff) == 0)
+ return hp100_probe1(dev, base_addr, HP100_BUS_EISA, NULL);
#ifdef CONFIG_PCI
- printk( "hp100: %s: You must specify card # in i/o address parameter for PCI bus...", dev->name );
+ printk("hp100: %s: You must specify card # in i/o address parameter for PCI bus...", dev->name);
#else
- return -ENODEV;
+ return -ENODEV;
#endif
- }
- else
+ } else
#ifdef CONFIG_PCI
- if ( base_addr > 0 && base_addr < 8 + 1 )
- pci_start_index = 0x100 | ( base_addr - 1 );
- else
+ if (base_addr > 0 && base_addr < 8 + 1)
+ pci_start_index = 0x100 | (base_addr - 1);
+ else
#endif
- if ( base_addr != 0 ) return -ENXIO;
+ if (base_addr != 0)
+ return -ENXIO;
- /* at first - scan PCI bus(es) */
+ /* First: scan PCI bus(es) */
#ifdef CONFIG_PCI
- if ( pcibios_present() )
- {
- int pci_index;
- struct pci_dev *pci_dev = NULL;
- int pci_id_index;
- u_short pci_command;
+ if (pcibios_present()) {
+ int pci_index;
+ struct pci_dev *pci_dev = NULL;
+ int pci_id_index;
+ u_short pci_command;
#ifdef HP100_DEBUG_PCI
- printk( "hp100: %s: PCI BIOS is present, checking for devices..\n", dev->name );
-#endif
- pci_index = 0;
- for ( pci_id_index = 0; pci_id_index < HP100_PCI_IDS_SIZE; pci_id_index++ ) {
- while ( (pci_dev = pci_find_device( hp100_pci_ids[ pci_id_index ].vendor,
- hp100_pci_ids[ pci_id_index ].device,
- pci_dev )) != NULL ) {
- if ( pci_index < (pci_start_index & 7) ) {
- pci_index++;
- continue;
- }
- if (pci_enable_device(pci_dev))
- continue;
- /* found... */
- ioaddr = pci_resource_start (pci_dev, 0);
- if ( check_region( ioaddr, HP100_REGION_SIZE ) ) continue;
- pci_read_config_word( pci_dev, PCI_COMMAND, &pci_command );
- if ( !( pci_command & PCI_COMMAND_IO ) ) {
+ printk("hp100: %s: PCI BIOS is present, checking for devices..\n", dev->name);
+#endif
+ pci_index = 0;
+ for (pci_id_index = 0; pci_id_index < HP100_PCI_IDS_SIZE;
+ pci_id_index++) {
+ while ((pci_dev = pci_find_device(hp100_pci_ids[pci_id_index].vendor,
+ hp100_pci_ids[pci_id_index].device,
+ pci_dev)) != NULL) {
+ if (pci_index < (pci_start_index & 7)) {
+ pci_index++;
+ continue;
+ }
+ if (pci_enable_device(pci_dev))
+ continue;
+ /* found... */
+ ioaddr = pci_resource_start(pci_dev, 0);
+ if (check_region(ioaddr, HP100_REGION_SIZE))
+ continue;
+ pci_read_config_word(pci_dev, PCI_COMMAND, &pci_command);
+ if (!(pci_command & PCI_COMMAND_IO)) {
#ifdef HP100_DEBUG
- printk( "hp100: %s: PCI I/O Bit has not been set. Setting...\n", dev->name );
+ printk("hp100: %s: PCI I/O Bit has not been set. Setting...\n", dev->name);
#endif
- pci_command |= PCI_COMMAND_IO;
- pci_write_config_word( pci_dev, PCI_COMMAND, pci_command );
- }
- if ( !( pci_command & PCI_COMMAND_MASTER ) ) {
+ pci_command |= PCI_COMMAND_IO;
+ pci_write_config_word(pci_dev, PCI_COMMAND, pci_command);
+ }
+ if (!(pci_command & PCI_COMMAND_MASTER)) {
#ifdef HP100_DEBUG
- printk( "hp100: %s: PCI Master Bit has not been set. Setting...\n", dev->name );
+ printk("hp100: %s: PCI Master Bit has not been set. Setting...\n", dev->name);
#endif
- pci_command |= PCI_COMMAND_MASTER;
- pci_write_config_word( pci_dev, PCI_COMMAND, pci_command );
- }
+ pci_command |= PCI_COMMAND_MASTER;
+ pci_write_config_word(pci_dev, PCI_COMMAND, pci_command);
+ }
#ifdef HP100_DEBUG
- printk( "hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr );
-#endif
- if ( hp100_probe1( dev, ioaddr, HP100_BUS_PCI, pci_dev ) == 0 )
- return 0;
- }
- }
- }
- if ( pci_start_index > 0 ) return -ENODEV;
+ printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr);
+#endif
+ if (hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pci_dev) == 0)
+ return 0;
+ }
+ }
+ }
+ if (pci_start_index > 0)
+ return -ENODEV;
#endif /* CONFIG_PCI */
- /* Second: Probe all EISA possible port regions (if EISA bus present) */
- for ( ioaddr = 0x1c38; EISA_bus && ioaddr < 0x10000; ioaddr += 0x400 )
- {
- if ( check_region( ioaddr, HP100_REGION_SIZE ) ) continue;
- if ( hp100_probe1( dev, ioaddr, HP100_BUS_EISA, NULL ) == 0 ) return 0;
- }
-
- /* Third Probe all ISA possible port regions */
- for ( ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x20 )
- {
- if ( check_region( ioaddr, HP100_REGION_SIZE ) ) continue;
- if ( hp100_probe1( dev, ioaddr, HP100_BUS_ISA, NULL ) == 0 ) return 0;
- }
-
- return -ENODEV;
+ /* Second: Probe all EISA possible port regions (if EISA bus present) */
+ for (ioaddr = 0x1c38; EISA_bus && ioaddr < 0x10000; ioaddr += 0x400) {
+ if (check_region(ioaddr, HP100_REGION_SIZE))
+ continue;
+ if (hp100_probe1(dev, ioaddr, HP100_BUS_EISA, NULL) == 0)
+ return 0;
+ }
+
+ /* Third: Probe all ISA possible port regions */
+ for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x20) {
+ if (check_region(ioaddr, HP100_REGION_SIZE))
+ continue;
+ if (hp100_probe1(dev, ioaddr, HP100_BUS_ISA, NULL) == 0)
+ return 0;
+ }
+
+ return -ENODEV;
}
-
-static int __init hp100_probe1( struct net_device *dev, int ioaddr, u_char bus, struct pci_dev *pci_dev )
+static int __init hp100_probe1(struct net_device *dev, int ioaddr,
+ u_char bus, struct pci_dev *pci_dev)
{
- int i;
-
- u_char uc, uc_1;
- u_int eisa_id;
- u_int chip;
- u_int memory_size = 0, virt_memory_size = 0;
- u_short local_mode, lsw;
- short mem_mapped;
- unsigned long mem_ptr_phys;
- void **mem_ptr_virt;
- struct hp100_private *lp;
- struct hp100_eisa_id *eid;
+ int i;
+
+ u_char uc, uc_1;
+ u_int eisa_id;
+ u_int chip;
+ u_int memory_size = 0, virt_memory_size = 0;
+ u_short local_mode, lsw;
+ short mem_mapped;
+ unsigned long mem_ptr_phys;
+ void **mem_ptr_virt;
+ struct hp100_private *lp;
+ struct hp100_eisa_id *eid;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4201, TRACE );
- printk("hp100: %s: probe1\n",dev->name);
+ hp100_outw(0x4201, TRACE);
+ printk("hp100: %s: probe1\n", dev->name);
#endif
- if ( dev == NULL )
- {
+ if (dev == NULL) {
#ifdef HP100_DEBUG
- printk( "hp100_probe1: %s: dev == NULL ?\n", dev->name );
-#endif
- return -EIO;
- }
-
- if ( hp100_inw( HW_ID ) != HP100_HW_ID_CASCADE )
- {
- return -ENODEV;
- }
- else
- {
- chip = hp100_inw( PAGING ) & HP100_CHIPID_MASK;
+ printk("hp100_probe1: %s: dev == NULL ?\n", dev->name);
+#endif
+ return -EIO;
+ }
+
+ if (hp100_inw(HW_ID) != HP100_HW_ID_CASCADE) {
+ return -ENODEV;
+ } else {
+ chip = hp100_inw(PAGING) & HP100_CHIPID_MASK;
#ifdef HP100_DEBUG
- if ( chip == HP100_CHIPID_SHASTA )
- printk("hp100: %s: Shasta Chip detected. (This is a pre 802.12 chip)\n", dev->name);
- else if ( chip == HP100_CHIPID_RAINIER )
- printk("hp100: %s: Rainier Chip detected. (This is a pre 802.12 chip)\n", dev->name);
- else if ( chip == HP100_CHIPID_LASSEN )
- printk("hp100: %s: Lassen Chip detected.\n", dev->name);
- else
- printk("hp100: %s: Warning: Unknown CASCADE chip (id=0x%.4x).\n",dev->name,chip);
-#endif
- }
-
- dev->base_addr = ioaddr;
-
- hp100_page( ID_MAC_ADDR );
- for ( i = uc = eisa_id = 0; i < 4; i++ )
- {
- eisa_id >>= 8;
- uc_1 = hp100_inb( BOARD_ID + i );
- eisa_id |= uc_1 << 24;
- uc += uc_1;
- }
- uc += hp100_inb( BOARD_ID + 4 );
-
- if ( uc != 0xff ) /* bad checksum? */
- {
- printk("hp100_probe: %s: bad EISA ID checksum at base port 0x%x\n", dev->name, ioaddr );
- return -ENODEV;
- }
-
- for ( i=0; i < HP100_EISA_IDS_SIZE; i++)
- if ( hp100_eisa_ids[ i ].id == eisa_id )
- break;
- if ( i >= HP100_EISA_IDS_SIZE ) {
- for ( i = 0; i < HP100_EISA_IDS_SIZE; i++)
- if ( ( hp100_eisa_ids[ i ].id & 0xf0ffffff ) == ( eisa_id & 0xf0ffffff ) )
- break;
- if ( i >= HP100_EISA_IDS_SIZE ) {
- printk( "hp100_probe: %s: card at port 0x%x isn't known (id = 0x%x)\n", dev -> name, ioaddr, eisa_id );
- return -ENODEV;
- }
- }
- eid = &hp100_eisa_ids[ i ];
- if ( ( eid->id & 0x0f000000 ) < ( eisa_id & 0x0f000000 ) )
- {
- printk( "hp100_probe: %s: newer version of card %s at port 0x%x - unsupported\n",
- dev->name, eid->name, ioaddr );
- return -ENODEV;
- }
-
- for ( i = uc = 0; i < 7; i++ )
- uc += hp100_inb( LAN_ADDR + i );
- if ( uc != 0xff )
- {
- printk("hp100_probe: %s: bad lan address checksum (card %s at port 0x%x)\n",
- dev->name, eid->name, ioaddr );
- return -EIO;
- }
-
- /* Make sure, that all registers are correctly updated... */
-
- hp100_load_eeprom( dev, ioaddr );
- wait();
-
- /*
- * Determine driver operation mode
- *
- * Use the variable "hp100_mode" upon insmod or as kernel parameter to
- * force driver modes:
- * hp100_mode=1 -> default, use busmaster mode if configured.
- * hp100_mode=2 -> enable shared memory mode
- * hp100_mode=3 -> force use of i/o mapped mode.
- * hp100_mode=4 -> same as 1, but re-set the enable bit on the card.
- */
-
- /*
- * LSW values:
- * 0x2278 -> J2585B, PnP shared memory mode
- * 0x2270 -> J2585B, shared memory mode, 0xdc000
- * 0xa23c -> J2585B, I/O mapped mode
- * 0x2240 -> EISA COMPEX, BusMaster (Shasta Chip)
- * 0x2220 -> EISA HP, I/O (Shasta Chip)
- * 0x2260 -> EISA HP, BusMaster (Shasta Chip)
- */
+ if (chip == HP100_CHIPID_SHASTA)
+ printk("hp100: %s: Shasta Chip detected. (This is a pre 802.12 chip)\n", dev->name);
+ else if (chip == HP100_CHIPID_RAINIER)
+ printk("hp100: %s: Rainier Chip detected. (This is a pre 802.12 chip)\n", dev->name);
+ else if (chip == HP100_CHIPID_LASSEN)
+ printk("hp100: %s: Lassen Chip detected.\n", dev->name);
+ else
+ printk("hp100: %s: Warning: Unknown CASCADE chip (id=0x%.4x).\n", dev->name, chip);
+#endif
+ }
+
+ dev->base_addr = ioaddr;
+
+ hp100_page(ID_MAC_ADDR);
+ for (i = uc = eisa_id = 0; i < 4; i++) {
+ eisa_id >>= 8;
+ uc_1 = hp100_inb(BOARD_ID + i);
+ eisa_id |= uc_1 << 24;
+ uc += uc_1;
+ }
+ uc += hp100_inb(BOARD_ID + 4);
+
+ if (uc != 0xff) { /* bad checksum? */
+ printk("hp100_probe: %s: bad EISA ID checksum at base port 0x%x\n", dev->name, ioaddr);
+ return -ENODEV;
+ }
+
+ for (i = 0; i < HP100_EISA_IDS_SIZE; i++)
+ if (hp100_eisa_ids[i].id == eisa_id)
+ break;
+ if (i >= HP100_EISA_IDS_SIZE) {
+ for (i = 0; i < HP100_EISA_IDS_SIZE; i++)
+ if ((hp100_eisa_ids[i].id & 0xf0ffffff) == (eisa_id & 0xf0ffffff))
+ break;
+ if (i >= HP100_EISA_IDS_SIZE) {
+ printk ("hp100_probe: %s: card at port 0x%x isn't known (id = 0x%x)\n", dev->name, ioaddr, eisa_id);
+ return -ENODEV;
+ }
+ }
+ eid = &hp100_eisa_ids[i];
+ if ((eid->id & 0x0f000000) < (eisa_id & 0x0f000000)) {
+ printk("hp100_probe: %s: newer version of card %s at port 0x%x - unsupported\n", dev->name, eid->name, ioaddr);
+ return -ENODEV;
+ }
+
+ for (i = uc = 0; i < 7; i++)
+ uc += hp100_inb(LAN_ADDR + i);
+ if (uc != 0xff) {
+ printk("hp100_probe: %s: bad lan address checksum (card %s at port 0x%x)\n", dev->name, eid->name, ioaddr);
+ return -EIO;
+ }
+
+ /* Make sure, that all registers are correctly updated... */
+
+ hp100_load_eeprom(dev, ioaddr);
+ wait();
+
+ /*
+ * Determine driver operation mode
+ *
+ * Use the variable "hp100_mode" upon insmod or as kernel parameter to
+ * force driver modes:
+ * hp100_mode=1 -> default, use busmaster mode if configured.
+ * hp100_mode=2 -> enable shared memory mode
+ * hp100_mode=3 -> force use of i/o mapped mode.
+ * hp100_mode=4 -> same as 1, but re-set the enable bit on the card.
+ */
+
+ /*
+ * LSW values:
+ * 0x2278 -> J2585B, PnP shared memory mode
+ * 0x2270 -> J2585B, shared memory mode, 0xdc000
+ * 0xa23c -> J2585B, I/O mapped mode
+ * 0x2240 -> EISA COMPEX, BusMaster (Shasta Chip)
+ * 0x2220 -> EISA HP, I/O (Shasta Chip)
+ * 0x2260 -> EISA HP, BusMaster (Shasta Chip)
+ */
#if 0
- local_mode = 0x2270;
- hp100_outw(0xfefe,OPTION_LSW);
- hp100_outw(local_mode|HP100_SET_LB|HP100_SET_HB,OPTION_LSW);
+ local_mode = 0x2270;
+ hp100_outw(0xfefe, OPTION_LSW);
+ hp100_outw(local_mode | HP100_SET_LB | HP100_SET_HB, OPTION_LSW);
#endif
- /* hp100_mode value maybe used in future by another card */
- local_mode=hp100_mode;
- if ( local_mode < 1 || local_mode > 4 )
- local_mode = 1; /* default */
+ /* hp100_mode value maybe used in future by another card */
+ local_mode = hp100_mode;
+ if (local_mode < 1 || local_mode > 4)
+ local_mode = 1; /* default */
#ifdef HP100_DEBUG
- printk( "hp100: %s: original LSW = 0x%x\n", dev->name, hp100_inw(OPTION_LSW) );
-#endif
-
- if(local_mode==3)
- {
- hp100_outw(HP100_MEM_EN|HP100_RESET_LB, OPTION_LSW);
- hp100_outw(HP100_IO_EN|HP100_SET_LB, OPTION_LSW);
- hp100_outw(HP100_BM_WRITE|HP100_BM_READ|HP100_RESET_HB, OPTION_LSW);
- printk("hp100: %s: IO mapped mode forced.\n", dev->name);
- }
- else if(local_mode==2)
- {
- hp100_outw(HP100_MEM_EN|HP100_SET_LB, OPTION_LSW);
- hp100_outw(HP100_IO_EN |HP100_SET_LB, OPTION_LSW);
- hp100_outw(HP100_BM_WRITE|HP100_BM_READ|HP100_RESET_HB, OPTION_LSW);
- printk("hp100: %s: Shared memory mode requested.\n", dev->name);
- }
- else if(local_mode==4)
- {
- if(chip==HP100_CHIPID_LASSEN)
- {
- hp100_outw(HP100_BM_WRITE|
- HP100_BM_READ | HP100_SET_HB, OPTION_LSW);
- hp100_outw(HP100_IO_EN |
- HP100_MEM_EN | HP100_RESET_LB, OPTION_LSW);
- printk("hp100: %s: Busmaster mode requested.\n",dev->name);
+ printk("hp100: %s: original LSW = 0x%x\n", dev->name,
+ hp100_inw(OPTION_LSW));
+#endif
+
+ if (local_mode == 3) {
+ hp100_outw(HP100_MEM_EN | HP100_RESET_LB, OPTION_LSW);
+ hp100_outw(HP100_IO_EN | HP100_SET_LB, OPTION_LSW);
+ hp100_outw(HP100_BM_WRITE | HP100_BM_READ | HP100_RESET_HB, OPTION_LSW);
+ printk("hp100: %s: IO mapped mode forced.\n", dev->name);
+ } else if (local_mode == 2) {
+ hp100_outw(HP100_MEM_EN | HP100_SET_LB, OPTION_LSW);
+ hp100_outw(HP100_IO_EN | HP100_SET_LB, OPTION_LSW);
+ hp100_outw(HP100_BM_WRITE | HP100_BM_READ | HP100_RESET_HB, OPTION_LSW);
+ printk("hp100: %s: Shared memory mode requested.\n", dev->name);
+ } else if (local_mode == 4) {
+ if (chip == HP100_CHIPID_LASSEN) {
+ hp100_outw(HP100_BM_WRITE | HP100_BM_READ | HP100_SET_HB, OPTION_LSW);
+ hp100_outw(HP100_IO_EN | HP100_MEM_EN | HP100_RESET_LB, OPTION_LSW);
+ printk("hp100: %s: Busmaster mode requested.\n", dev->name);
+ }
+ local_mode = 1;
}
- local_mode=1;
- }
-
- if(local_mode==1) /* default behaviour */
- {
- lsw = hp100_inw(OPTION_LSW);
-
- if ( (lsw & HP100_IO_EN) &&
- (~lsw & HP100_MEM_EN) &&
- (~lsw & (HP100_BM_WRITE|HP100_BM_READ)) )
- {
+
+ if (local_mode == 1) { /* default behaviour */
+ lsw = hp100_inw(OPTION_LSW);
+
+ if ((lsw & HP100_IO_EN) && (~lsw & HP100_MEM_EN) &&
+ (~lsw & (HP100_BM_WRITE | HP100_BM_READ))) {
#ifdef HP100_DEBUG
- printk("hp100: %s: IO_EN bit is set on card.\n",dev->name);
-#endif
- local_mode=3;
- }
- else if ( chip == HP100_CHIPID_LASSEN &&
- ( lsw & (HP100_BM_WRITE|HP100_BM_READ) ) ==
- (HP100_BM_WRITE|HP100_BM_READ) )
- {
- printk("hp100: %s: Busmaster mode enabled.\n",dev->name);
- hp100_outw(HP100_MEM_EN|HP100_IO_EN|HP100_RESET_LB, OPTION_LSW);
- }
- else
- {
+ printk("hp100: %s: IO_EN bit is set on card.\n", dev->name);
+#endif
+ local_mode = 3;
+ } else if (chip == HP100_CHIPID_LASSEN &&
+ (lsw & (HP100_BM_WRITE | HP100_BM_READ)) == (HP100_BM_WRITE | HP100_BM_READ)) {
+ printk("hp100: %s: Busmaster mode enabled.\n", dev->name);
+ hp100_outw(HP100_MEM_EN | HP100_IO_EN | HP100_RESET_LB, OPTION_LSW);
+ } else {
#ifdef HP100_DEBUG
- printk("hp100: %s: Card not configured for BM or BM not supported with this card.\n", dev->name );
- printk("hp100: %s: Trying shared memory mode.\n", dev->name);
+ printk("hp100: %s: Card not configured for BM or BM not supported with this card.\n", dev->name);
+ printk("hp100: %s: Trying shared memory mode.\n", dev->name);
#endif
- /* In this case, try shared memory mode */
- local_mode=2;
- hp100_outw(HP100_MEM_EN|HP100_SET_LB, OPTION_LSW);
- /* hp100_outw(HP100_IO_EN|HP100_RESET_LB, OPTION_LSW); */
+ /* In this case, try shared memory mode */
+ local_mode = 2;
+ hp100_outw(HP100_MEM_EN | HP100_SET_LB, OPTION_LSW);
+ /* hp100_outw(HP100_IO_EN|HP100_RESET_LB, OPTION_LSW); */
+ }
}
- }
-
#ifdef HP100_DEBUG
- printk( "hp100: %s: new LSW = 0x%x\n", dev->name, hp100_inw(OPTION_LSW) );
-#endif
-
- /* Check for shared memory on the card, eventually remap it */
- hp100_page( HW_MAP );
- mem_mapped = (( hp100_inw( OPTION_LSW ) & ( HP100_MEM_EN ) ) != 0);
- mem_ptr_phys = 0UL;
- mem_ptr_virt = NULL;
- memory_size = (8192<<( (hp100_inb(SRAM)>>5)&0x07));
- virt_memory_size = 0;
-
- /* For memory mapped or busmaster mode, we want the memory address */
- if ( mem_mapped || (local_mode==1))
- {
- mem_ptr_phys = ( hp100_inw( MEM_MAP_LSW ) |
- ( hp100_inw( MEM_MAP_MSW ) << 16 ) );
- mem_ptr_phys &= ~0x1fff; /* 8k alignment */
-
- if ( bus == HP100_BUS_ISA && (mem_ptr_phys & ~0xfffff ) != 0 )
- {
- printk("hp100: %s: Can only use programmed i/o mode.\n", dev->name);
- mem_ptr_phys = 0;
- mem_mapped = 0;
- local_mode=3; /* Use programmed i/o */
- }
-
- /* We do not need access to shared memory in busmaster mode */
- /* However in slave mode we need to remap high (>1GB) card memory */
- if(local_mode!=1) /* = not busmaster */
- {
- if ( bus == HP100_BUS_PCI && mem_ptr_phys >= 0x100000 )
- {
- /* We try with smaller memory sizes, if ioremap fails */
- for(virt_memory_size = memory_size; virt_memory_size>16383; virt_memory_size>>=1)
- {
- if((mem_ptr_virt=ioremap((u_long)mem_ptr_phys,virt_memory_size))==NULL)
- {
+ printk("hp100: %s: new LSW = 0x%x\n", dev->name, hp100_inw(OPTION_LSW));
+#endif
+
+ /* Check for shared memory on the card, eventually remap it */
+ hp100_page(HW_MAP);
+ mem_mapped = ((hp100_inw(OPTION_LSW) & (HP100_MEM_EN)) != 0);
+ mem_ptr_phys = 0UL;
+ mem_ptr_virt = NULL;
+ memory_size = (8192 << ((hp100_inb(SRAM) >> 5) & 0x07));
+ virt_memory_size = 0;
+
+ /* For memory mapped or busmaster mode, we want the memory address */
+ if (mem_mapped || (local_mode == 1)) {
+ mem_ptr_phys = (hp100_inw(MEM_MAP_LSW) | (hp100_inw(MEM_MAP_MSW) << 16));
+ mem_ptr_phys &= ~0x1fff; /* 8k alignment */
+
+ if (bus == HP100_BUS_ISA && (mem_ptr_phys & ~0xfffff) != 0) {
+ printk("hp100: %s: Can only use programmed i/o mode.\n", dev->name);
+ mem_ptr_phys = 0;
+ mem_mapped = 0;
+ local_mode = 3; /* Use programmed i/o */
+ }
+
+ /* We do not need access to shared memory in busmaster mode */
+ /* However in slave mode we need to remap high (>1GB) card memory */
+ if (local_mode != 1) { /* = not busmaster */
+ /* We try with smaller memory sizes, if ioremap fails */
+ for (virt_memory_size = memory_size; virt_memory_size > 16383; virt_memory_size >>= 1) {
+ if ((mem_ptr_virt = ioremap((u_long) mem_ptr_phys, virt_memory_size)) == NULL) {
#ifdef HP100_DEBUG
- printk( "hp100: %s: ioremap for 0x%x bytes high PCI memory at 0x%lx failed\n", dev->name, virt_memory_size, mem_ptr_phys );
+ printk("hp100: %s: ioremap for 0x%x bytes high PCI memory at 0x%lx failed\n", dev->name, virt_memory_size, mem_ptr_phys);
#endif
- }
- else
- {
+ } else {
#ifdef HP100_DEBUG
- printk( "hp100: %s: remapped 0x%x bytes high PCI memory at 0x%lx to %p.\n", dev->name, virt_memory_size, mem_ptr_phys, mem_ptr_virt);
+ printk("hp100: %s: remapped 0x%x bytes high PCI memory at 0x%lx to %p.\n", dev->name, virt_memory_size, mem_ptr_phys, mem_ptr_virt);
#endif
- break;
- }
- }
-
- if(mem_ptr_virt==NULL) /* all ioremap tries failed */
- {
- printk("hp100: %s: Failed to ioremap the PCI card memory. Will have to use i/o mapped mode.\n", dev->name);
- local_mode=3;
- virt_memory_size = 0;
+ break;
+ }
+ }
+
+ if (mem_ptr_virt == NULL) { /* all ioremap tries failed */
+ printk("hp100: %s: Failed to ioremap the PCI card memory. Will have to use i/o mapped mode.\n", dev->name);
+ local_mode = 3;
+ virt_memory_size = 0;
+ }
}
- }
}
-
- }
-
- if(local_mode==3) /* io mapped forced */
- {
- mem_mapped = 0;
- mem_ptr_phys = 0;
- mem_ptr_virt = NULL;
- printk("hp100: %s: Using (slow) programmed i/o mode.\n", dev->name);
- }
-
- /* Initialise the "private" data structure for this card. */
- if ( (dev->priv=kmalloc(sizeof(struct hp100_private), GFP_KERNEL)) == NULL)
- return -ENOMEM;
-
- lp = (struct hp100_private *)dev->priv;
- memset( lp, 0, sizeof( struct hp100_private ) );
- spin_lock_init(&lp->lock);
- lp->id = eid;
- lp->chip = chip;
- lp->mode = local_mode;
- lp->bus = bus;
- lp->pci_dev = pci_dev;
- lp->priority_tx = hp100_priority_tx;
- lp->rx_ratio = hp100_rx_ratio;
- lp->mem_ptr_phys = mem_ptr_phys;
- lp->mem_ptr_virt = mem_ptr_virt;
- hp100_page( ID_MAC_ADDR );
- lp->soft_model = hp100_inb( SOFT_MODEL );
- lp->mac1_mode = HP100_MAC1MODE3;
- lp->mac2_mode = HP100_MAC2MODE3;
- memset( &lp->hash_bytes, 0x00, 8 );
-
- dev->base_addr = ioaddr;
-
- lp->memory_size = memory_size;
- lp->virt_memory_size = virt_memory_size;
- lp->rx_ratio = hp100_rx_ratio; /* can be conf'd with insmod */
-
- /* memory region for programmed i/o */
- request_region( dev->base_addr, HP100_REGION_SIZE, eid->name );
-
- dev->open = hp100_open;
- dev->stop = hp100_close;
-
- if (lp->mode==1) /* busmaster */
- dev->hard_start_xmit = hp100_start_xmit_bm;
- else
- dev->hard_start_xmit = hp100_start_xmit;
-
- dev->get_stats = hp100_get_stats;
- dev->set_multicast_list = &hp100_set_multicast_list;
-
- /* Ask the card for which IRQ line it is configured */
- if ( bus == HP100_BUS_PCI ) {
- dev->irq = pci_dev->irq;
- } else {
- hp100_page( HW_MAP );
- dev->irq = hp100_inb( IRQ_CHANNEL ) & HP100_IRQMASK;
- if ( dev->irq == 2 )
- dev->irq = 9;
- }
-
- if(lp->mode==1) /* busmaster */
- dev->dma=4;
-
- /* Ask the card for its MAC address and store it for later use. */
- hp100_page( ID_MAC_ADDR );
- for ( i = uc = 0; i < 6; i++ )
- dev->dev_addr[ i ] = hp100_inb( LAN_ADDR + i );
-
- /* Reset statistics (counters) */
- hp100_clear_stats( lp, ioaddr );
-
- SET_MODULE_OWNER(dev);
- ether_setup( dev );
-
- /* If busmaster mode is wanted, a dma-capable memory area is needed for
- * the rx and tx PDLs
- * PCI cards can access the whole PC memory. Therefore GFP_DMA is not
- * needed for the allocation of the memory area.
- */
-
- /* TODO: We do not need this with old cards, where PDLs are stored
- * in the cards shared memory area. But currently, busmaster has been
- * implemented/tested only with the lassen chip anyway... */
- if(lp->mode==1) /* busmaster */
- {
- /* Get physically continous memory for TX & RX PDLs */
- if ( (lp->page_vaddr=kmalloc(MAX_RINGSIZE+0x0f,GFP_KERNEL) ) == NULL)
- return -ENOMEM;
- lp->page_vaddr_algn=((u_int *) ( ((u_int)(lp->page_vaddr)+0x0f) &~0x0f));
- memset(lp->page_vaddr, 0, MAX_RINGSIZE+0x0f);
+
+ if (local_mode == 3) { /* io mapped forced */
+ mem_mapped = 0;
+ mem_ptr_phys = 0;
+ mem_ptr_virt = NULL;
+ printk("hp100: %s: Using (slow) programmed i/o mode.\n", dev->name);
+ }
+
+ /* Initialise the "private" data structure for this card. */
+ if ((dev->priv = kmalloc(sizeof(struct hp100_private), GFP_KERNEL)) == NULL)
+ return -ENOMEM;
+
+ lp = (struct hp100_private *) dev->priv;
+ memset(lp, 0, sizeof(struct hp100_private));
+ spin_lock_init(&lp->lock);
+ lp->id = eid;
+ lp->chip = chip;
+ lp->mode = local_mode;
+ lp->bus = bus;
+ lp->pci_dev = pci_dev;
+ lp->priority_tx = hp100_priority_tx;
+ lp->rx_ratio = hp100_rx_ratio;
+ lp->mem_ptr_phys = mem_ptr_phys;
+ lp->mem_ptr_virt = mem_ptr_virt;
+ hp100_page(ID_MAC_ADDR);
+ lp->soft_model = hp100_inb(SOFT_MODEL);
+ lp->mac1_mode = HP100_MAC1MODE3;
+ lp->mac2_mode = HP100_MAC2MODE3;
+ memset(&lp->hash_bytes, 0x00, 8);
+
+ dev->base_addr = ioaddr;
+
+ lp->memory_size = memory_size;
+ lp->virt_memory_size = virt_memory_size;
+ lp->rx_ratio = hp100_rx_ratio; /* can be conf'd with insmod */
+
+ /* memory region for programmed i/o */
+ request_region(dev->base_addr, HP100_REGION_SIZE, eid->name);
+
+ dev->open = hp100_open;
+ dev->stop = hp100_close;
+
+ if (lp->mode == 1) /* busmaster */
+ dev->hard_start_xmit = hp100_start_xmit_bm;
+ else
+ dev->hard_start_xmit = hp100_start_xmit;
+
+ dev->get_stats = hp100_get_stats;
+ dev->set_multicast_list = &hp100_set_multicast_list;
+
+ /* Ask the card for which IRQ line it is configured */
+ if (bus == HP100_BUS_PCI) {
+ dev->irq = pci_dev->irq;
+ } else {
+ hp100_page(HW_MAP);
+ dev->irq = hp100_inb(IRQ_CHANNEL) & HP100_IRQMASK;
+ if (dev->irq == 2)
+ dev->irq = 9;
+ }
+
+ if (lp->mode == 1) /* busmaster */
+ dev->dma = 4;
+
+ /* Ask the card for its MAC address and store it for later use. */
+ hp100_page(ID_MAC_ADDR);
+ for (i = uc = 0; i < 6; i++)
+ dev->dev_addr[i] = hp100_inb(LAN_ADDR + i);
+
+ /* Reset statistics (counters) */
+ hp100_clear_stats(lp, ioaddr);
+
+ SET_MODULE_OWNER(dev);
+ ether_setup(dev);
+
+ /* If busmaster mode is wanted, a dma-capable memory area is needed for
+ * the rx and tx PDLs
+ * PCI cards can access the whole PC memory. Therefore GFP_DMA is not
+ * needed for the allocation of the memory area.
+ */
+
+ /* TODO: We do not need this with old cards, where PDLs are stored
+ * in the cards shared memory area. But currently, busmaster has been
+ * implemented/tested only with the lassen chip anyway... */
+ if (lp->mode == 1) { /* busmaster */
+ /* Get physically continous memory for TX & RX PDLs */
+ if ((lp->page_vaddr = kmalloc(MAX_RINGSIZE + 0x0f, GFP_KERNEL)) == NULL)
+ return -ENOMEM;
+ lp->page_vaddr_algn = ((u_int *) (((u_int) (lp->page_vaddr) + 0x0f) & ~0x0f));
+ memset(lp->page_vaddr, 0, MAX_RINGSIZE + 0x0f);
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: Reserved DMA memory from 0x%x to 0x%x\n",
- dev->name,
- (u_int)lp->page_vaddr_algn,
- (u_int)lp->page_vaddr_algn+MAX_RINGSIZE);
-#endif
- lp->rxrcommit = lp->txrcommit = 0;
- lp->rxrhead = lp->rxrtail = &(lp->rxring[0]);
- lp->txrhead = lp->txrtail = &(lp->txring[0]);
- }
-
- /* Initialise the card. */
- /* (I'm not really sure if it's a good idea to do this during probing, but
- * like this it's assured that the lan connection type can be sensed
- * correctly)
- */
- hp100_hwinit( dev );
-
- /* Try to find out which kind of LAN the card is connected to. */
- lp->lan_type = hp100_sense_lan( dev );
-
- /* Print out a message what about what we think we have probed. */
- printk( "hp100: %s: %s at 0x%x, IRQ %d, ",
- dev->name, lp->id->name, ioaddr, dev->irq );
- switch ( bus ) {
- case HP100_BUS_EISA: printk( "EISA" ); break;
- case HP100_BUS_PCI: printk( "PCI" ); break;
- default: printk( "ISA" ); break;
- }
- printk( " bus, %dk SRAM (rx/tx %d%%).\n",
- lp->memory_size >> 10, lp->rx_ratio );
-
- if ( lp->mode==2 ) /* memory mapped */
- {
- printk( "hp100: %s: Memory area at 0x%lx-0x%lx",
- dev->name,mem_ptr_phys,
- (mem_ptr_phys+(mem_ptr_phys>0x100000?(u_long)lp->memory_size:16*1024))-1 );
- if ( mem_ptr_virt )
- printk( " (virtual base %p)", mem_ptr_virt );
- printk( ".\n" );
-
- /* Set for info when doing ifconfig */
- dev->mem_start = mem_ptr_phys;
- dev->mem_end = mem_ptr_phys+lp->memory_size;
- }
- printk( "hp100: %s: ", dev->name );
- if ( lp->lan_type != HP100_LAN_ERR )
- printk( "Adapter is attached to " );
- switch ( lp->lan_type ) {
- case HP100_LAN_100:
- printk( "100Mb/s Voice Grade AnyLAN network.\n" );
- break;
- case HP100_LAN_10:
- printk( "10Mb/s network.\n" );
- break;
- default:
- printk( "Warning! Link down.\n" );
- }
-
- return 0;
+ printk("hp100: %s: Reserved DMA memory from 0x%x to 0x%x\n", dev->name, (u_int) lp->page_vaddr_algn, (u_int) lp->page_vaddr_algn + MAX_RINGSIZE);
+#endif
+ lp->rxrcommit = lp->txrcommit = 0;
+ lp->rxrhead = lp->rxrtail = &(lp->rxring[0]);
+ lp->txrhead = lp->txrtail = &(lp->txring[0]);
+ }
+
+ /* Initialise the card. */
+ /* (I'm not really sure if it's a good idea to do this during probing, but
+ * like this it's assured that the lan connection type can be sensed
+ * correctly)
+ */
+ hp100_hwinit(dev);
+
+ /* Try to find out which kind of LAN the card is connected to. */
+ lp->lan_type = hp100_sense_lan(dev);
+
+ /* Print out a message what about what we think we have probed. */
+ printk("hp100: %s: %s at 0x%x, IRQ %d, ", dev->name, lp->id->name, ioaddr, dev->irq);
+ switch (bus) {
+ case HP100_BUS_EISA:
+ printk("EISA");
+ break;
+ case HP100_BUS_PCI:
+ printk("PCI");
+ break;
+ default:
+ printk("ISA");
+ break;
+ }
+ printk(" bus, %dk SRAM (rx/tx %d%%).\n", lp->memory_size >> 10, lp->rx_ratio);
+
+ if (lp->mode == 2) { /* memory mapped */
+ printk("hp100: %s: Memory area at 0x%lx-0x%lx", dev->name, mem_ptr_phys,
+ (mem_ptr_phys + (mem_ptr_phys > 0x100000 ? (u_long) lp->memory_size : 16 * 1024)) - 1);
+ if (mem_ptr_virt)
+ printk(" (virtual base %p)", mem_ptr_virt);
+ printk(".\n");
+
+ /* Set for info when doing ifconfig */
+ dev->mem_start = mem_ptr_phys;
+ dev->mem_end = mem_ptr_phys + lp->memory_size;
+ }
+ printk("hp100: %s: ", dev->name);
+ if (lp->lan_type != HP100_LAN_ERR)
+ printk("Adapter is attached to ");
+ switch (lp->lan_type) {
+ case HP100_LAN_100:
+ printk("100Mb/s Voice Grade AnyLAN network.\n");
+ break;
+ case HP100_LAN_10:
+ printk("10Mb/s network.\n");
+ break;
+ default:
+ printk("Warning! Link down.\n");
+ }
+
+ return 0;
}
-
/* This procedure puts the card into a stable init state */
-static void hp100_hwinit( struct net_device *dev )
+static void hp100_hwinit(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4202, TRACE );
- printk("hp100: %s: hwinit\n", dev->name);
-#endif
-
- /* Initialise the card. -------------------------------------------- */
-
- /* Clear all pending Ints and disable Ints */
- hp100_page( PERFORMANCE );
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* clear all pending ints */
-
- hp100_outw( HP100_INT_EN | HP100_RESET_LB, OPTION_LSW );
- hp100_outw( HP100_TRI_INT | HP100_SET_HB, OPTION_LSW );
-
- if(lp->mode==1)
- {
- hp100_BM_shutdown( dev ); /* disables BM, puts cascade in reset */
- wait();
- }
- else
- {
- hp100_outw( HP100_INT_EN | HP100_RESET_LB, OPTION_LSW );
- hp100_cascade_reset( dev, TRUE );
- hp100_page( MAC_CTRL );
- hp100_andb( ~(HP100_RX_EN|HP100_TX_EN), MAC_CFG_1);
- }
-
- /* Initiate EEPROM reload */
- hp100_load_eeprom( dev, 0 );
-
- wait();
-
- /* Go into reset again. */
- hp100_cascade_reset( dev, TRUE );
-
- /* Set Option Registers to a safe state */
- hp100_outw( HP100_DEBUG_EN |
- HP100_RX_HDR |
- HP100_EE_EN |
- HP100_BM_WRITE |
- HP100_BM_READ | HP100_RESET_HB |
- HP100_FAKE_INT |
- HP100_INT_EN |
- HP100_MEM_EN |
- HP100_IO_EN | HP100_RESET_LB, OPTION_LSW);
-
- hp100_outw( HP100_TRI_INT |
- HP100_MMAP_DIS | HP100_SET_HB, OPTION_LSW );
-
- hp100_outb( HP100_PRIORITY_TX |
- HP100_ADV_NXT_PKT |
- HP100_TX_CMD | HP100_RESET_LB, OPTION_MSW );
-
- /* TODO: Configure MMU for Ram Test. */
- /* TODO: Ram Test. */
-
- /* Re-check if adapter is still at same i/o location */
- /* (If the base i/o in eeprom has been changed but the */
- /* registers had not been changed, a reload of the eeprom */
- /* would move the adapter to the address stored in eeprom */
-
- /* TODO: Code to implement. */
-
- /* Until here it was code from HWdiscover procedure. */
- /* Next comes code from mmuinit procedure of SCO BM driver which is
- * called from HWconfigure in the SCO driver. */
-
- /* Initialise MMU, eventually switch on Busmaster Mode, initialise
- * multicast filter...
- */
- hp100_mmuinit( dev );
-
- /* We don't turn the interrupts on here - this is done by start_interface. */
- wait(); /* TODO: Do we really need this? */
-
- /* Enable Hardware (e.g. unreset) */
- hp100_cascade_reset( dev, FALSE );
-
- /* ------- initialisation complete ----------- */
-
- /* Finally try to log in the Hub if there may be a VG connection. */
- if( lp->lan_type != HP100_LAN_10 )
- hp100_login_to_vg_hub( dev, FALSE ); /* relogin */
-}
+ hp100_outw(0x4202, TRACE);
+ printk("hp100: %s: hwinit\n", dev->name);
+#endif
+
+ /* Initialise the card. -------------------------------------------- */
+
+ /* Clear all pending Ints and disable Ints */
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all ints */
+ hp100_outw(0xffff, IRQ_STATUS); /* clear all pending ints */
+
+ hp100_outw(HP100_INT_EN | HP100_RESET_LB, OPTION_LSW);
+ hp100_outw(HP100_TRI_INT | HP100_SET_HB, OPTION_LSW);
+
+ if (lp->mode == 1) {
+ hp100_BM_shutdown(dev); /* disables BM, puts cascade in reset */
+ wait();
+ } else {
+ hp100_outw(HP100_INT_EN | HP100_RESET_LB, OPTION_LSW);
+ hp100_cascade_reset(dev, TRUE);
+ hp100_page(MAC_CTRL);
+ hp100_andb(~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1);
+ }
+
+ /* Initiate EEPROM reload */
+ hp100_load_eeprom(dev, 0);
+
+ wait();
+
+ /* Go into reset again. */
+ hp100_cascade_reset(dev, TRUE);
+
+ /* Set Option Registers to a safe state */
+ hp100_outw(HP100_DEBUG_EN |
+ HP100_RX_HDR |
+ HP100_EE_EN |
+ HP100_BM_WRITE |
+ HP100_BM_READ | HP100_RESET_HB |
+ HP100_FAKE_INT |
+ HP100_INT_EN |
+ HP100_MEM_EN |
+ HP100_IO_EN | HP100_RESET_LB, OPTION_LSW);
+
+ hp100_outw(HP100_TRI_INT |
+ HP100_MMAP_DIS | HP100_SET_HB, OPTION_LSW);
+ hp100_outb(HP100_PRIORITY_TX |
+ HP100_ADV_NXT_PKT |
+ HP100_TX_CMD | HP100_RESET_LB, OPTION_MSW);
+
+ /* TODO: Configure MMU for Ram Test. */
+ /* TODO: Ram Test. */
+
+ /* Re-check if adapter is still at same i/o location */
+ /* (If the base i/o in eeprom has been changed but the */
+ /* registers had not been changed, a reload of the eeprom */
+ /* would move the adapter to the address stored in eeprom */
+
+ /* TODO: Code to implement. */
+
+ /* Until here it was code from HWdiscover procedure. */
+ /* Next comes code from mmuinit procedure of SCO BM driver which is
+ * called from HWconfigure in the SCO driver. */
+
+ /* Initialise MMU, eventually switch on Busmaster Mode, initialise
+ * multicast filter...
+ */
+ hp100_mmuinit(dev);
+
+ /* We don't turn the interrupts on here - this is done by start_interface. */
+ wait(); /* TODO: Do we really need this? */
+
+ /* Enable Hardware (e.g. unreset) */
+ hp100_cascade_reset(dev, FALSE);
+
+ /* ------- initialisation complete ----------- */
+
+ /* Finally try to log in the Hub if there may be a VG connection. */
+ if (lp->lan_type != HP100_LAN_10)
+ hp100_login_to_vg_hub(dev, FALSE); /* relogin */
+}
+
/*
* mmuinit - Reinitialise Cascade MMU and MAC settings.
* Note: Must already be in reset and leaves card in reset.
*/
-static void hp100_mmuinit( struct net_device *dev )
+static void hp100_mmuinit(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- int i;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ int i;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4203, TRACE );
- printk("hp100: %s: mmuinit\n",dev->name);
+ hp100_outw(0x4203, TRACE);
+ printk("hp100: %s: mmuinit\n", dev->name);
#endif
#ifdef HP100_DEBUG
- if( 0!=(hp100_inw(OPTION_LSW)&HP100_HW_RST) )
- {
- printk("hp100: %s: Not in reset when entering mmuinit. Fix me.\n",dev->name);
- return;
- }
-#endif
-
- /* Make sure IRQs are masked off and ack'ed. */
- hp100_page( PERFORMANCE );
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* ack IRQ */
-
- /*
- * Enable Hardware
- * - Clear Debug En, Rx Hdr Pipe, EE En, I/O En, Fake Int and Intr En
- * - Set Tri-State Int, Bus Master Rd/Wr, and Mem Map Disable
- * - Clear Priority, Advance Pkt and Xmit Cmd
- */
-
- hp100_outw( HP100_DEBUG_EN |
- HP100_RX_HDR |
- HP100_EE_EN | HP100_RESET_HB |
- HP100_IO_EN |
- HP100_FAKE_INT |
- HP100_INT_EN | HP100_RESET_LB, OPTION_LSW );
-
- hp100_outw( HP100_TRI_INT | HP100_SET_HB, OPTION_LSW);
-
- if(lp->mode==1) /* busmaster */
- {
- hp100_outw( HP100_BM_WRITE |
- HP100_BM_READ |
- HP100_MMAP_DIS | HP100_SET_HB, OPTION_LSW );
- }
- else if(lp->mode==2) /* memory mapped */
- {
- hp100_outw( HP100_BM_WRITE |
- HP100_BM_READ | HP100_RESET_HB, OPTION_LSW );
- hp100_outw( HP100_MMAP_DIS | HP100_RESET_HB, OPTION_LSW );
- hp100_outw( HP100_MEM_EN | HP100_SET_LB, OPTION_LSW );
- hp100_outw( HP100_IO_EN | HP100_SET_LB, OPTION_LSW );
- }
- else if( lp->mode==3 ) /* i/o mapped mode */
- {
- hp100_outw( HP100_MMAP_DIS | HP100_SET_HB |
- HP100_IO_EN | HP100_SET_LB, OPTION_LSW );
- }
-
- hp100_page( HW_MAP );
- hp100_outb( 0, EARLYRXCFG );
- hp100_outw( 0, EARLYTXCFG );
-
- /*
- * Enable Bus Master mode
- */
- if(lp->mode==1) /* busmaster */
- {
- /* Experimental: Set some PCI configuration bits */
- hp100_page( HW_MAP );
- hp100_andb( ~HP100_PDL_USE3, MODECTRL1 ); /* BM engine read maximum */
- hp100_andb( ~HP100_TX_DUALQ, MODECTRL1 ); /* No Queue for Priority TX */
-
- /* PCI Bus failures should result in a Misc. Interrupt */
- hp100_orb( HP100_EN_BUS_FAIL, MODECTRL2);
-
- hp100_outw( HP100_BM_READ | HP100_BM_WRITE | HP100_SET_HB, OPTION_LSW );
- hp100_page( HW_MAP );
- /* Use Burst Mode and switch on PAGE_CK */
- hp100_orb( HP100_BM_BURST_RD |
- HP100_BM_BURST_WR, BM);
- if((lp->chip==HP100_CHIPID_RAINIER)||(lp->chip==HP100_CHIPID_SHASTA))
- hp100_orb( HP100_BM_PAGE_CK, BM );
- hp100_orb( HP100_BM_MASTER, BM );
- }
- else /* not busmaster */
- {
- hp100_page(HW_MAP);
- hp100_andb(~HP100_BM_MASTER, BM );
- }
-
- /*
- * Divide card memory into regions for Rx, Tx and, if non-ETR chip, PDLs
- */
- hp100_page( MMU_CFG );
- if(lp->mode==1) /* only needed for Busmaster */
- {
- int xmit_stop, recv_stop;
-
- if((lp->chip==HP100_CHIPID_RAINIER)||(lp->chip==HP100_CHIPID_SHASTA))
- {
- int pdl_stop;
-
- /*
- * Each pdl is 508 bytes long. (63 frags * 4 bytes for address and
- * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded
- * to the next higher 1k boundary) bytes for the rx-pdl's
- * Note: For non-etr chips the transmit stop register must be
- * programmed on a 1k boundary, i.e. bits 9:0 must be zero.
- */
- pdl_stop = lp->memory_size;
- xmit_stop = ( pdl_stop-508*(MAX_RX_PDL)-16 )& ~(0x03ff);
- recv_stop = ( xmit_stop * (lp->rx_ratio)/100 ) &~(0x03ff);
- hp100_outw( (pdl_stop>>4)-1, PDL_MEM_STOP );
+ if (0 != (hp100_inw(OPTION_LSW) & HP100_HW_RST)) {
+ printk("hp100: %s: Not in reset when entering mmuinit. Fix me.\n", dev->name);
+ return;
+ }
+#endif
+
+ /* Make sure IRQs are masked off and ack'ed. */
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all ints */
+ hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */
+
+ /*
+ * Enable Hardware
+ * - Clear Debug En, Rx Hdr Pipe, EE En, I/O En, Fake Int and Intr En
+ * - Set Tri-State Int, Bus Master Rd/Wr, and Mem Map Disable
+ * - Clear Priority, Advance Pkt and Xmit Cmd
+ */
+
+ hp100_outw(HP100_DEBUG_EN |
+ HP100_RX_HDR |
+ HP100_EE_EN | HP100_RESET_HB |
+ HP100_IO_EN |
+ HP100_FAKE_INT |
+ HP100_INT_EN | HP100_RESET_LB, OPTION_LSW);
+
+ hp100_outw(HP100_TRI_INT | HP100_SET_HB, OPTION_LSW);
+
+ if (lp->mode == 1) { /* busmaster */
+ hp100_outw(HP100_BM_WRITE |
+ HP100_BM_READ |
+ HP100_MMAP_DIS | HP100_SET_HB, OPTION_LSW);
+ } else if (lp->mode == 2) { /* memory mapped */
+ hp100_outw(HP100_BM_WRITE |
+ HP100_BM_READ | HP100_RESET_HB, OPTION_LSW);
+ hp100_outw(HP100_MMAP_DIS | HP100_RESET_HB, OPTION_LSW);
+ hp100_outw(HP100_MEM_EN | HP100_SET_LB, OPTION_LSW);
+ hp100_outw(HP100_IO_EN | HP100_SET_LB, OPTION_LSW);
+ } else if (lp->mode == 3) { /* i/o mapped mode */
+ hp100_outw(HP100_MMAP_DIS | HP100_SET_HB |
+ HP100_IO_EN | HP100_SET_LB, OPTION_LSW);
+ }
+
+ hp100_page(HW_MAP);
+ hp100_outb(0, EARLYRXCFG);
+ hp100_outw(0, EARLYTXCFG);
+
+ /*
+ * Enable Bus Master mode
+ */
+ if (lp->mode == 1) { /* busmaster */
+ /* Experimental: Set some PCI configuration bits */
+ hp100_page(HW_MAP);
+ hp100_andb(~HP100_PDL_USE3, MODECTRL1); /* BM engine read maximum */
+ hp100_andb(~HP100_TX_DUALQ, MODECTRL1); /* No Queue for Priority TX */
+
+ /* PCI Bus failures should result in a Misc. Interrupt */
+ hp100_orb(HP100_EN_BUS_FAIL, MODECTRL2);
+
+ hp100_outw(HP100_BM_READ | HP100_BM_WRITE | HP100_SET_HB, OPTION_LSW);
+ hp100_page(HW_MAP);
+ /* Use Burst Mode and switch on PAGE_CK */
+ hp100_orb(HP100_BM_BURST_RD | HP100_BM_BURST_WR, BM);
+ if ((lp->chip == HP100_CHIPID_RAINIER) || (lp->chip == HP100_CHIPID_SHASTA))
+ hp100_orb(HP100_BM_PAGE_CK, BM);
+ hp100_orb(HP100_BM_MASTER, BM);
+ } else { /* not busmaster */
+
+ hp100_page(HW_MAP);
+ hp100_andb(~HP100_BM_MASTER, BM);
+ }
+
+ /*
+ * Divide card memory into regions for Rx, Tx and, if non-ETR chip, PDLs
+ */
+ hp100_page(MMU_CFG);
+ if (lp->mode == 1) { /* only needed for Busmaster */
+ int xmit_stop, recv_stop;
+
+ if ((lp->chip == HP100_CHIPID_RAINIER)
+ || (lp->chip == HP100_CHIPID_SHASTA)) {
+ int pdl_stop;
+
+ /*
+ * Each pdl is 508 bytes long. (63 frags * 4 bytes for address and
+ * 4 bytes for header). We will leave NUM_RXPDLS * 508 (rounded
+ * to the next higher 1k boundary) bytes for the rx-pdl's
+ * Note: For non-etr chips the transmit stop register must be
+ * programmed on a 1k boundary, i.e. bits 9:0 must be zero.
+ */
+ pdl_stop = lp->memory_size;
+ xmit_stop = (pdl_stop - 508 * (MAX_RX_PDL) - 16) & ~(0x03ff);
+ recv_stop = (xmit_stop * (lp->rx_ratio) / 100) & ~(0x03ff);
+ hp100_outw((pdl_stop >> 4) - 1, PDL_MEM_STOP);
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: PDL_STOP = 0x%x\n", dev->name, pdl_stop);
+ printk("hp100: %s: PDL_STOP = 0x%x\n", dev->name, pdl_stop);
#endif
- }
- else /* ETR chip (Lassen) in busmaster mode */
- {
- xmit_stop = ( lp->memory_size ) - 1;
- recv_stop = ( ( lp->memory_size * lp->rx_ratio ) / 100 ) & ~(0x03ff);
- }
+ } else {
+ /* ETR chip (Lassen) in busmaster mode */
+ xmit_stop = (lp->memory_size) - 1;
+ recv_stop = ((lp->memory_size * lp->rx_ratio) / 100) & ~(0x03ff);
+ }
- hp100_outw( xmit_stop>>4 , TX_MEM_STOP );
- hp100_outw( recv_stop>>4 , RX_MEM_STOP );
+ hp100_outw(xmit_stop >> 4, TX_MEM_STOP);
+ hp100_outw(recv_stop >> 4, RX_MEM_STOP);
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: TX_STOP = 0x%x\n",dev->name,xmit_stop>>4);
- printk("hp100: %s: RX_STOP = 0x%x\n",dev->name,recv_stop>>4);
-#endif
- }
- else /* Slave modes (memory mapped and programmed io) */
- {
- hp100_outw( (((lp->memory_size*lp->rx_ratio)/100)>>4), RX_MEM_STOP );
- hp100_outw( ((lp->memory_size - 1 )>>4), TX_MEM_STOP );
+ printk("hp100: %s: TX_STOP = 0x%x\n", dev->name, xmit_stop >> 4);
+ printk("hp100: %s: RX_STOP = 0x%x\n", dev->name, recv_stop >> 4);
+#endif
+ } else {
+ /* Slave modes (memory mapped and programmed io) */
+ hp100_outw((((lp->memory_size * lp->rx_ratio) / 100) >> 4), RX_MEM_STOP);
+ hp100_outw(((lp->memory_size - 1) >> 4), TX_MEM_STOP);
#ifdef HP100_DEBUG
- printk("hp100: %s: TX_MEM_STOP: 0x%x\n", dev->name,hp100_inw(TX_MEM_STOP));
- printk("hp100: %s: RX_MEM_STOP: 0x%x\n", dev->name,hp100_inw(RX_MEM_STOP));
-#endif
- }
-
- /* Write MAC address into page 1 */
- hp100_page( MAC_ADDRESS );
- for ( i = 0; i < 6; i++ )
- hp100_outb( dev->dev_addr[ i ], MAC_ADDR + i );
-
- /* Zero the multicast hash registers */
- for ( i = 0; i < 8; i++ )
- hp100_outb( 0x0, HASH_BYTE0 + i );
-
- /* Set up MAC defaults */
- hp100_page( MAC_CTRL );
-
- /* Go to LAN Page and zero all filter bits */
- /* Zero accept error, accept multicast, accept broadcast and accept */
- /* all directed packet bits */
- hp100_andb( ~(HP100_RX_EN|
- HP100_TX_EN|
- HP100_ACC_ERRORED|
- HP100_ACC_MC|
- HP100_ACC_BC|
- HP100_ACC_PHY), MAC_CFG_1 );
-
- hp100_outb( 0x00, MAC_CFG_2 );
-
- /* Zero the frame format bit. This works around a training bug in the */
- /* new hubs. */
- hp100_outb( 0x00, VG_LAN_CFG_2); /* (use 802.3) */
-
- if(lp->priority_tx)
- hp100_outb( HP100_PRIORITY_TX | HP100_SET_LB, OPTION_MSW );
- else
- hp100_outb( HP100_PRIORITY_TX | HP100_RESET_LB, OPTION_MSW );
-
- hp100_outb( HP100_ADV_NXT_PKT |
- HP100_TX_CMD | HP100_RESET_LB, OPTION_MSW );
-
- /* If busmaster, initialize the PDLs */
- if(lp->mode==1)
- hp100_init_pdls( dev );
-
- /* Go to performance page and initalize isr and imr registers */
- hp100_page( PERFORMANCE );
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* ack IRQ */
+ printk("hp100: %s: TX_MEM_STOP: 0x%x\n", dev->name, hp100_inw(TX_MEM_STOP));
+ printk("hp100: %s: RX_MEM_STOP: 0x%x\n", dev->name, hp100_inw(RX_MEM_STOP));
+#endif
+ }
+
+ /* Write MAC address into page 1 */
+ hp100_page(MAC_ADDRESS);
+ for (i = 0; i < 6; i++)
+ hp100_outb(dev->dev_addr[i], MAC_ADDR + i);
+
+ /* Zero the multicast hash registers */
+ for (i = 0; i < 8; i++)
+ hp100_outb(0x0, HASH_BYTE0 + i);
+
+ /* Set up MAC defaults */
+ hp100_page(MAC_CTRL);
+
+ /* Go to LAN Page and zero all filter bits */
+ /* Zero accept error, accept multicast, accept broadcast and accept */
+ /* all directed packet bits */
+ hp100_andb(~(HP100_RX_EN |
+ HP100_TX_EN |
+ HP100_ACC_ERRORED |
+ HP100_ACC_MC |
+ HP100_ACC_BC | HP100_ACC_PHY), MAC_CFG_1);
+
+ hp100_outb(0x00, MAC_CFG_2);
+
+ /* Zero the frame format bit. This works around a training bug in the */
+ /* new hubs. */
+ hp100_outb(0x00, VG_LAN_CFG_2); /* (use 802.3) */
+
+ if (lp->priority_tx)
+ hp100_outb(HP100_PRIORITY_TX | HP100_SET_LB, OPTION_MSW);
+ else
+ hp100_outb(HP100_PRIORITY_TX | HP100_RESET_LB, OPTION_MSW);
+
+ hp100_outb(HP100_ADV_NXT_PKT |
+ HP100_TX_CMD | HP100_RESET_LB, OPTION_MSW);
+
+ /* If busmaster, initialize the PDLs */
+ if (lp->mode == 1)
+ hp100_init_pdls(dev);
+
+ /* Go to performance page and initalize isr and imr registers */
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all ints */
+ hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */
}
-
/*
* open/close functions
*/
-static int hp100_open( struct net_device *dev )
+static int hp100_open(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- int ioaddr=dev->base_addr;
+ int ioaddr = dev->base_addr;
#endif
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4204, TRACE );
- printk("hp100: %s: open\n",dev->name);
-#endif
-
- /* New: if bus is PCI or EISA, interrupts might be shared interrupts */
- if ( request_irq(dev->irq, hp100_interrupt,
- lp->bus==HP100_BUS_PCI||lp->bus==HP100_BUS_EISA?SA_SHIRQ:SA_INTERRUPT,
- lp->id->name, dev))
- {
- printk( "hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq );
- return -EAGAIN;
- }
-
- dev->trans_start = jiffies;
- netif_start_queue(dev);
-
- lp->lan_type = hp100_sense_lan( dev );
- lp->mac1_mode = HP100_MAC1MODE3;
- lp->mac2_mode = HP100_MAC2MODE3;
- memset( &lp->hash_bytes, 0x00, 8 );
-
- hp100_stop_interface( dev );
-
- hp100_hwinit( dev );
-
- hp100_start_interface( dev ); /* sets mac modes, enables interrupts */
-
- return 0;
+ hp100_outw(0x4204, TRACE);
+ printk("hp100: %s: open\n", dev->name);
+#endif
+
+ /* New: if bus is PCI or EISA, interrupts might be shared interrupts */
+ if (request_irq(dev->irq, hp100_interrupt,
+ lp->bus == HP100_BUS_PCI || lp->bus ==
+ HP100_BUS_EISA ? SA_SHIRQ : SA_INTERRUPT,
+ lp->id->name, dev)) {
+ printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq);
+ return -EAGAIN;
+ }
+
+ dev->trans_start = jiffies;
+ netif_start_queue(dev);
+
+ lp->lan_type = hp100_sense_lan(dev);
+ lp->mac1_mode = HP100_MAC1MODE3;
+ lp->mac2_mode = HP100_MAC2MODE3;
+ memset(&lp->hash_bytes, 0x00, 8);
+
+ hp100_stop_interface(dev);
+
+ hp100_hwinit(dev);
+
+ hp100_start_interface(dev); /* sets mac modes, enables interrupts */
+
+ return 0;
}
-
/* The close function is called when the interface is to be brought down */
-static int hp100_close( struct net_device *dev )
+static int hp100_close(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4205, TRACE );
- printk("hp100: %s: close\n", dev->name);
+ hp100_outw(0x4205, TRACE);
+ printk("hp100: %s: close\n", dev->name);
#endif
- hp100_page( PERFORMANCE );
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all IRQs */
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all IRQs */
- hp100_stop_interface( dev );
+ hp100_stop_interface(dev);
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status=hp100_login_to_vg_hub( dev, FALSE );
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
- netif_stop_queue(dev);
+ netif_stop_queue(dev);
- free_irq( dev->irq, dev );
+ free_irq(dev->irq, dev);
#ifdef HP100_DEBUG
- printk( "hp100: %s: close LSW = 0x%x\n", dev->name, hp100_inw(OPTION_LSW) );
+ printk("hp100: %s: close LSW = 0x%x\n", dev->name,
+ hp100_inw(OPTION_LSW));
#endif
- return 0;
+ return 0;
}
-
+
/*
* Configure the PDL Rx rings and LAN
*/
-static void hp100_init_pdls( struct net_device *dev )
+static void hp100_init_pdls(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- hp100_ring_t *ringptr;
- u_int *pageptr;
- int i;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ hp100_ring_t *ringptr;
+ u_int *pageptr;
+ int i;
#ifdef HP100_DEBUG_B
- int ioaddr = dev->base_addr;
+ int ioaddr = dev->base_addr;
#endif
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4206, TRACE );
- printk("hp100: %s: init pdls\n", dev->name);
-#endif
-
- if(0==lp->page_vaddr_algn)
- printk("hp100: %s: Warning: lp->page_vaddr_algn not initialised!\n",dev->name);
- else
- {
- /* pageptr shall point into the DMA accessible memory region */
- /* we use this pointer to status the upper limit of allocated */
- /* memory in the allocated page. */
- /* note: align the pointers to the pci cache line size */
- memset(lp->page_vaddr_algn, 0, MAX_RINGSIZE); /* Zero Rx/Tx ring page */
- pageptr=lp->page_vaddr_algn;
-
- lp->rxrcommit =0;
- ringptr = lp->rxrhead = lp-> rxrtail = &(lp->rxring[0]);
-
- /* Initialise Rx Ring */
- for (i=MAX_RX_PDL-1; i>=0; i--)
- {
- lp->rxring[i].next = ringptr;
- ringptr=&(lp->rxring[i]);
- pageptr+=hp100_init_rxpdl(dev, ringptr, pageptr);
- }
-
- /* Initialise Tx Ring */
- lp->txrcommit = 0;
- ringptr = lp->txrhead = lp->txrtail = &(lp->txring[0]);
- for (i=MAX_TX_PDL-1; i>=0; i--)
- {
- lp->txring[i].next = ringptr;
- ringptr=&(lp->txring[i]);
- pageptr+=hp100_init_txpdl(dev, ringptr, pageptr);
- }
- }
-}
+ hp100_outw(0x4206, TRACE);
+ printk("hp100: %s: init pdls\n", dev->name);
+#endif
+
+ if (0 == lp->page_vaddr_algn)
+ printk("hp100: %s: Warning: lp->page_vaddr_algn not initialised!\n", dev->name);
+ else {
+ /* pageptr shall point into the DMA accessible memory region */
+ /* we use this pointer to status the upper limit of allocated */
+ /* memory in the allocated page. */
+ /* note: align the pointers to the pci cache line size */
+ memset(lp->page_vaddr_algn, 0, MAX_RINGSIZE); /* Zero Rx/Tx ring page */
+ pageptr = lp->page_vaddr_algn;
+
+ lp->rxrcommit = 0;
+ ringptr = lp->rxrhead = lp->rxrtail = &(lp->rxring[0]);
+
+ /* Initialise Rx Ring */
+ for (i = MAX_RX_PDL - 1; i >= 0; i--) {
+ lp->rxring[i].next = ringptr;
+ ringptr = &(lp->rxring[i]);
+ pageptr += hp100_init_rxpdl(dev, ringptr, pageptr);
+ }
+ /* Initialise Tx Ring */
+ lp->txrcommit = 0;
+ ringptr = lp->txrhead = lp->txrtail = &(lp->txring[0]);
+ for (i = MAX_TX_PDL - 1; i >= 0; i--) {
+ lp->txring[i].next = ringptr;
+ ringptr = &(lp->txring[i]);
+ pageptr += hp100_init_txpdl(dev, ringptr, pageptr);
+ }
+ }
+}
+
/* These functions "format" the entries in the pdl structure */
/* They return how much memory the fragments need. */
-static int hp100_init_rxpdl( struct net_device *dev, register hp100_ring_t *ringptr, register u32 *pdlptr )
+static int hp100_init_rxpdl(struct net_device *dev,
+ register hp100_ring_t * ringptr,
+ register u32 * pdlptr)
{
- /* pdlptr is starting address for this pdl */
+ /* pdlptr is starting address for this pdl */
- if( 0!=( ((unsigned)pdlptr) & 0xf) )
- printk("hp100: %s: Init rxpdl: Unaligned pdlptr 0x%x.\n",dev->name,(unsigned)pdlptr);
+ if (0 != (((unsigned) pdlptr) & 0xf))
+ printk("hp100: %s: Init rxpdl: Unaligned pdlptr 0x%x.\n",
+ dev->name, (unsigned) pdlptr);
- ringptr->pdl = pdlptr+1;
- ringptr->pdl_paddr = virt_to_bus(pdlptr+1);
- ringptr->skb = (void *) NULL;
+ ringptr->pdl = pdlptr + 1;
+ ringptr->pdl_paddr = virt_to_bus(pdlptr + 1);
+ ringptr->skb = (void *) NULL;
- /*
- * Write address and length of first PDL Fragment (which is used for
- * storing the RX-Header
- * We use the 4 bytes _before_ the PDH in the pdl memory area to
- * store this information. (PDH is at offset 0x04)
- */
- /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */
+ /*
+ * Write address and length of first PDL Fragment (which is used for
+ * storing the RX-Header
+ * We use the 4 bytes _before_ the PDH in the pdl memory area to
+ * store this information. (PDH is at offset 0x04)
+ */
+ /* Note that pdlptr+1 and not pdlptr is the pointer to the PDH */
- *(pdlptr+2) =(u_int) virt_to_bus(pdlptr); /* Address Frag 1 */
- *(pdlptr+3) = 4; /* Length Frag 1 */
+ *(pdlptr + 2) = (u_int) virt_to_bus(pdlptr); /* Address Frag 1 */
+ *(pdlptr + 3) = 4; /* Length Frag 1 */
- return( ( ((MAX_RX_FRAG*2+2)+3) /4)*4 );
+ return ((((MAX_RX_FRAG * 2 + 2) + 3) / 4) * 4);
}
-static int hp100_init_txpdl( struct net_device *dev, register hp100_ring_t *ringptr, register u32 *pdlptr )
+static int hp100_init_txpdl(struct net_device *dev,
+ register hp100_ring_t * ringptr,
+ register u32 * pdlptr)
{
- if( 0!=( ((unsigned)pdlptr) & 0xf) )
- printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%x.\n",dev->name,(unsigned) pdlptr);
-
- ringptr->pdl = pdlptr; /* +1; */
- ringptr->pdl_paddr = virt_to_bus(pdlptr); /* +1 */
- ringptr->skb = (void *) NULL;
-
- return((((MAX_TX_FRAG*2+2)+3)/4)*4);
+ if (0 != (((unsigned) pdlptr) & 0xf))
+ printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%x.\n", dev->name, (unsigned) pdlptr);
+
+ ringptr->pdl = pdlptr; /* +1; */
+ ringptr->pdl_paddr = virt_to_bus(pdlptr); /* +1 */
+ ringptr->skb = (void *) NULL;
+
+ return ((((MAX_TX_FRAG * 2 + 2) + 3) / 4) * 4);
}
-
/*
* hp100_build_rx_pdl allocates an skb_buff of maximum size plus two bytes
* for possible odd word alignment rounding up to next dword and set PDL
@@ -1321,80 +1283,76 @@ static int hp100_init_txpdl( struct net_device *dev, register hp100_ring_t *ring
* Returns: 0 if unable to allocate skb_buff
* 1 if successful
*/
-static int hp100_build_rx_pdl( hp100_ring_t *ringptr, struct net_device *dev )
+static int hp100_build_rx_pdl(hp100_ring_t * ringptr,
+ struct net_device *dev)
{
#ifdef HP100_DEBUG_B
- int ioaddr = dev->base_addr;
+ int ioaddr = dev->base_addr;
#endif
#ifdef HP100_DEBUG_BM
- u_int *p;
+ u_int *p;
#endif
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4207, TRACE );
- printk("hp100: %s: build rx pdl\n", dev->name);
-#endif
-
- /* Allocate skb buffer of maximum size */
- /* Note: This depends on the alloc_skb functions allocating more
- * space than requested, i.e. aligning to 16bytes */
-
- ringptr->skb = dev_alloc_skb( ((MAX_ETHER_SIZE+2+3)/4)*4 );
-
- if(NULL!=ringptr->skb)
- {
- /*
- * Reserve 2 bytes at the head of the buffer to land the IP header
- * on a long word boundary (According to the Network Driver section
- * in the Linux KHG, this should help to increase performance.)
- */
- skb_reserve(ringptr->skb, 2);
-
- ringptr->skb->dev=dev;
- ringptr->skb->data=(u_char *)skb_put(ringptr->skb, MAX_ETHER_SIZE );
-
- /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */
- /* Note: 1st Fragment is used for the 4 byte packet status
- * (receive header). Its PDL entries are set up by init_rxpdl. So
- * here we only have to set up the PDL fragment entries for the data
- * part. Those 4 bytes will be stored in the DMA memory region
- * directly before the PDL.
- */
+ hp100_outw(0x4207, TRACE);
+ printk("hp100: %s: build rx pdl\n", dev->name);
+#endif
+
+ /* Allocate skb buffer of maximum size */
+ /* Note: This depends on the alloc_skb functions allocating more
+ * space than requested, i.e. aligning to 16bytes */
+
+ ringptr->skb = dev_alloc_skb(((MAX_ETHER_SIZE + 2 + 3) / 4) * 4);
+
+ if (NULL != ringptr->skb) {
+ /*
+ * Reserve 2 bytes at the head of the buffer to land the IP header
+ * on a long word boundary (According to the Network Driver section
+ * in the Linux KHG, this should help to increase performance.)
+ */
+ skb_reserve(ringptr->skb, 2);
+
+ ringptr->skb->dev = dev;
+ ringptr->skb->data = (u_char *) skb_put(ringptr->skb, MAX_ETHER_SIZE);
+
+ /* ringptr->pdl points to the beginning of the PDL, i.e. the PDH */
+ /* Note: 1st Fragment is used for the 4 byte packet status
+ * (receive header). Its PDL entries are set up by init_rxpdl. So
+ * here we only have to set up the PDL fragment entries for the data
+ * part. Those 4 bytes will be stored in the DMA memory region
+ * directly before the PDL.
+ */
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n",
- dev->name,
- (u_int) ringptr->pdl,
- ((MAX_ETHER_SIZE+2+3)/4)*4,
- (unsigned int) ringptr->skb->data);
+ printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n",
+ dev->name, (u_int) ringptr->pdl,
+ ((MAX_ETHER_SIZE + 2 + 3) / 4) * 4,
+ (unsigned int) ringptr->skb->data);
#endif
- ringptr->pdl[0] = 0x00020000; /* Write PDH */
- ringptr->pdl[3] = ((u_int)virt_to_bus(ringptr->skb->data));
- ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */
-
+ ringptr->pdl[0] = 0x00020000; /* Write PDH */
+ ringptr->pdl[3] = ((u_int) virt_to_bus(ringptr->skb->data));
+ ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */
+
#ifdef HP100_DEBUG_BM
- for(p=(ringptr->pdl); p<(ringptr->pdl+5); p++)
- printk("hp100: %s: Adr 0x%.8x = 0x%.8x\n",dev->name,(u_int) p,(u_int) *p );
-#endif
- return(1);
- }
- /* else: */
- /* alloc_skb failed (no memory) -> still can receive the header
- * fragment into PDL memory. make PDL safe by clearing msgptr and
- * making the PDL only 1 fragment (i.e. the 4 byte packet status)
- */
+ for (p = (ringptr->pdl); p < (ringptr->pdl + 5); p++)
+ printk("hp100: %s: Adr 0x%.8x = 0x%.8x\n", dev->name, (u_int) p, (u_int) * p);
+#endif
+ return (1);
+ }
+ /* else: */
+ /* alloc_skb failed (no memory) -> still can receive the header
+ * fragment into PDL memory. make PDL safe by clearing msgptr and
+ * making the PDL only 1 fragment (i.e. the 4 byte packet status)
+ */
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: build_rx_pdl: PDH@0x%x, No space for skb.\n",
- dev->name,
- (u_int) ringptr->pdl);
+ printk("hp100: %s: build_rx_pdl: PDH@0x%x, No space for skb.\n", dev->name, (u_int) ringptr->pdl);
#endif
- ringptr->pdl[0]=0x00010000; /* PDH: Count=1 Fragment */
+ ringptr->pdl[0] = 0x00010000; /* PDH: Count=1 Fragment */
- return(0);
+ return (0);
}
-
/*
* hp100_rxfill - attempt to fill the Rx Ring will empty skb's
*
@@ -1405,275 +1363,250 @@ static int hp100_build_rx_pdl( hp100_ring_t *ringptr, struct net_device *dev )
* b. Put the physical address of the buffer into the PDL.
* c. Output physical address of PDL to adapter.
*/
-static void hp100_rxfill( struct net_device *dev )
+static void hp100_rxfill(struct net_device *dev)
{
- int ioaddr=dev->base_addr;
+ int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- hp100_ring_t *ringptr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ hp100_ring_t *ringptr;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4208, TRACE );
- printk("hp100: %s: rxfill\n",dev->name);
-#endif
-
- hp100_page( PERFORMANCE );
-
- while (lp->rxrcommit < MAX_RX_PDL)
- {
- /*
- ** Attempt to get a buffer and build a Rx PDL.
- */
- ringptr = lp->rxrtail;
- if (0 == hp100_build_rx_pdl( ringptr, dev ))
- {
- return; /* None available, return */
- }
-
- /* Hand this PDL over to the card */
- /* Note: This needs performance page selected! */
+ hp100_outw(0x4208, TRACE);
+ printk("hp100: %s: rxfill\n", dev->name);
+#endif
+
+ hp100_page(PERFORMANCE);
+
+ while (lp->rxrcommit < MAX_RX_PDL) {
+ /*
+ ** Attempt to get a buffer and build a Rx PDL.
+ */
+ ringptr = lp->rxrtail;
+ if (0 == hp100_build_rx_pdl(ringptr, dev)) {
+ return; /* None available, return */
+ }
+
+ /* Hand this PDL over to the card */
+ /* Note: This needs performance page selected! */
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: rxfill: Hand to card: pdl #%d @0x%x phys:0x%x, buffer: 0x%x\n",
- dev->name,
- lp->rxrcommit,
- (u_int)ringptr->pdl,
- (u_int)ringptr->pdl_paddr,
- (u_int)ringptr->pdl[3]);
-#endif
-
- hp100_outl( (u32)ringptr->pdl_paddr, RX_PDA);
-
- lp->rxrcommit += 1;
- lp->rxrtail = ringptr->next;
- }
+ printk("hp100: %s: rxfill: Hand to card: pdl #%d @0x%x phys:0x%x, buffer: 0x%x\n",
+ dev->name, lp->rxrcommit, (u_int) ringptr->pdl,
+ (u_int) ringptr->pdl_paddr, (u_int) ringptr->pdl[3]);
+#endif
+
+ hp100_outl((u32) ringptr->pdl_paddr, RX_PDA);
+
+ lp->rxrcommit += 1;
+ lp->rxrtail = ringptr->next;
+ }
}
-
/*
* BM_shutdown - shutdown bus mastering and leave chip in reset state
*/
-static void hp100_BM_shutdown( struct net_device *dev )
+static void hp100_BM_shutdown(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- unsigned long time;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ unsigned long time;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4209, TRACE );
- printk("hp100: %s: bm shutdown\n",dev->name);
-#endif
-
- hp100_page( PERFORMANCE );
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* Ack all ints */
-
- /* Ensure Interrupts are off */
- hp100_outw( HP100_INT_EN | HP100_RESET_LB , OPTION_LSW );
-
- /* Disable all MAC activity */
- hp100_page( MAC_CTRL );
- hp100_andb( ~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1 ); /* stop rx/tx */
-
- /* If cascade MMU is not already in reset */
- if (0 != (hp100_inw(OPTION_LSW)&HP100_HW_RST) )
- {
- /* Wait 1.3ms (10Mb max packet time) to ensure MAC is idle so
- * MMU pointers will not be reset out from underneath
- */
- hp100_page( MAC_CTRL );
- for(time=0; time<5000; time++)
- {
- if( (hp100_inb(MAC_CFG_1)&(HP100_TX_IDLE|HP100_RX_IDLE))==
- (HP100_TX_IDLE|HP100_RX_IDLE) ) break;
- }
-
- /* Shutdown algorithm depends on the generation of Cascade */
- if( lp->chip==HP100_CHIPID_LASSEN )
- { /* ETR shutdown/reset */
- /* Disable Busmaster mode and wait for bit to go to zero. */
- hp100_page(HW_MAP);
- hp100_andb( ~HP100_BM_MASTER, BM );
- /* 100 ms timeout */
- for(time=0; time<32000; time++)
- {
- if ( 0 == (hp100_inb( BM ) & HP100_BM_MASTER) ) break;
- }
- }
- else
- { /* Shasta or Rainier Shutdown/Reset */
- /* To ensure all bus master inloading activity has ceased,
- * wait for no Rx PDAs or no Rx packets on card.
- */
- hp100_page( PERFORMANCE );
- /* 100 ms timeout */
- for(time=0; time<10000; time++)
- {
- /* RX_PDL: PDLs not executed. */
- /* RX_PKT_CNT: RX'd packets on card. */
- if ( (hp100_inb( RX_PDL ) == 0) &&
- (hp100_inb( RX_PKT_CNT ) == 0) ) break;
- }
-
- if(time>=10000)
- printk("hp100: %s: BM shutdown error.\n", dev->name);
-
- /* To ensure all bus master outloading activity has ceased,
- * wait until the Tx PDA count goes to zero or no more Tx space
- * available in the Tx region of the card.
- */
- /* 100 ms timeout */
- for(time=0; time<10000; time++) {
- if ( (0 == hp100_inb( TX_PKT_CNT )) &&
- (0 != (hp100_inb( TX_MEM_FREE )&HP100_AUTO_COMPARE))) break;
- }
-
- /* Disable Busmaster mode */
- hp100_page(HW_MAP);
- hp100_andb( ~HP100_BM_MASTER, BM );
- } /* end of shutdown procedure for non-etr parts */
-
- hp100_cascade_reset( dev, TRUE );
- }
- hp100_page( PERFORMANCE );
- /* hp100_outw( HP100_BM_READ | HP100_BM_WRITE | HP100_RESET_HB, OPTION_LSW ); */
- /* Busmaster mode should be shut down now. */
-}
+ hp100_outw(0x4209, TRACE);
+ printk("hp100: %s: bm shutdown\n", dev->name);
+#endif
+
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all ints */
+ hp100_outw(0xffff, IRQ_STATUS); /* Ack all ints */
+
+ /* Ensure Interrupts are off */
+ hp100_outw(HP100_INT_EN | HP100_RESET_LB, OPTION_LSW);
+
+ /* Disable all MAC activity */
+ hp100_page(MAC_CTRL);
+ hp100_andb(~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1); /* stop rx/tx */
+
+ /* If cascade MMU is not already in reset */
+ if (0 != (hp100_inw(OPTION_LSW) & HP100_HW_RST)) {
+ /* Wait 1.3ms (10Mb max packet time) to ensure MAC is idle so
+ * MMU pointers will not be reset out from underneath
+ */
+ hp100_page(MAC_CTRL);
+ for (time = 0; time < 5000; time++) {
+ if ((hp100_inb(MAC_CFG_1) & (HP100_TX_IDLE | HP100_RX_IDLE)) == (HP100_TX_IDLE | HP100_RX_IDLE))
+ break;
+ }
+ /* Shutdown algorithm depends on the generation of Cascade */
+ if (lp->chip == HP100_CHIPID_LASSEN) { /* ETR shutdown/reset */
+ /* Disable Busmaster mode and wait for bit to go to zero. */
+ hp100_page(HW_MAP);
+ hp100_andb(~HP100_BM_MASTER, BM);
+ /* 100 ms timeout */
+ for (time = 0; time < 32000; time++) {
+ if (0 == (hp100_inb(BM) & HP100_BM_MASTER))
+ break;
+ }
+ } else { /* Shasta or Rainier Shutdown/Reset */
+ /* To ensure all bus master inloading activity has ceased,
+ * wait for no Rx PDAs or no Rx packets on card.
+ */
+ hp100_page(PERFORMANCE);
+ /* 100 ms timeout */
+ for (time = 0; time < 10000; time++) {
+ /* RX_PDL: PDLs not executed. */
+ /* RX_PKT_CNT: RX'd packets on card. */
+ if ((hp100_inb(RX_PDL) == 0) && (hp100_inb(RX_PKT_CNT) == 0))
+ break;
+ }
+
+ if (time >= 10000)
+ printk("hp100: %s: BM shutdown error.\n", dev->name);
+
+ /* To ensure all bus master outloading activity has ceased,
+ * wait until the Tx PDA count goes to zero or no more Tx space
+ * available in the Tx region of the card.
+ */
+ /* 100 ms timeout */
+ for (time = 0; time < 10000; time++) {
+ if ((0 == hp100_inb(TX_PKT_CNT)) &&
+ (0 != (hp100_inb(TX_MEM_FREE) & HP100_AUTO_COMPARE)))
+ break;
+ }
+
+ /* Disable Busmaster mode */
+ hp100_page(HW_MAP);
+ hp100_andb(~HP100_BM_MASTER, BM);
+ } /* end of shutdown procedure for non-etr parts */
+
+ hp100_cascade_reset(dev, TRUE);
+ }
+ hp100_page(PERFORMANCE);
+ /* hp100_outw( HP100_BM_READ | HP100_BM_WRITE | HP100_RESET_HB, OPTION_LSW ); */
+ /* Busmaster mode should be shut down now. */
+}
-
/*
* transmit functions
*/
/* tx function for busmaster mode */
-static int hp100_start_xmit_bm( struct sk_buff *skb, struct net_device *dev )
+static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
{
- unsigned long flags;
- int i, ok_flag;
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- hp100_ring_t *ringptr;
+ unsigned long flags;
+ int i, ok_flag;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ hp100_ring_t *ringptr;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4210, TRACE );
- printk("hp100: %s: start_xmit_bm\n",dev->name);
+ hp100_outw(0x4210, TRACE);
+ printk("hp100: %s: start_xmit_bm\n", dev->name);
#endif
- if ( skb==NULL )
- {
- return 0;
- }
-
- if ( skb->len <= 0 ) return 0;
-
- /* Get Tx ring tail pointer */
- if( lp->txrtail->next==lp->txrhead )
- {
- /* No memory. */
-#ifdef HP100_DEBUG
- printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
-#endif
- /* not waited long enough since last tx? */
- if ( jiffies - dev->trans_start < HZ ) return -EAGAIN;
-
- if ( lp->lan_type < 0 ) /* no LAN type detected yet? */
- {
- hp100_stop_interface( dev );
- if ( ( lp->lan_type = hp100_sense_lan( dev ) ) < 0 )
- {
- printk( "hp100: %s: no connection found - check wire\n", dev->name );
- hp100_start_interface( dev ); /* 10Mb/s RX pkts maybe handled */
- return -EIO;
- }
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE ); /* relogin */
- hp100_start_interface( dev );
+ if (skb == NULL) {
+ return 0;
}
-
- if ( lp->lan_type == HP100_LAN_100 && lp->hub_status < 0 )
- /* we have a 100Mb/s adapter but it isn't connected to hub */
- {
- printk( "hp100: %s: login to 100Mb/s hub retry\n", dev->name );
- hp100_stop_interface( dev );
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE );
- hp100_start_interface( dev );
+
+ if (skb->len <= 0)
+ return 0;
+
+ /* Get Tx ring tail pointer */
+ if (lp->txrtail->next == lp->txrhead) {
+ /* No memory. */
+#ifdef HP100_DEBUG
+ printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
+#endif
+ /* not waited long enough since last tx? */
+ if (jiffies - dev->trans_start < HZ)
+ return -EAGAIN;
+
+ if (lp->lan_type < 0) { /* no LAN type detected yet? */
+ hp100_stop_interface(dev);
+ if ((lp->lan_type = hp100_sense_lan(dev)) < 0) {
+ printk("hp100: %s: no connection found - check wire\n", dev->name);
+ hp100_start_interface(dev); /* 10Mb/s RX pkts maybe handled */
+ return -EIO;
+ }
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE); /* relogin */
+ hp100_start_interface(dev);
+ }
+
+ if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
+ /* we have a 100Mb/s adapter but it isn't connected to hub */
+ printk("hp100: %s: login to 100Mb/s hub retry\n", dev->name);
+ hp100_stop_interface(dev);
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
+ hp100_start_interface(dev);
+ } else {
+ spin_lock_irqsave(&lp->lock, flags);
+ hp100_ints_off(); /* Useful ? Jean II */
+ i = hp100_sense_lan(dev);
+ hp100_ints_on();
+ spin_unlock_irqrestore(&lp->lock, flags);
+ if (i == HP100_LAN_ERR)
+ printk("hp100: %s: link down detected\n", dev->name);
+ else if (lp->lan_type != i) { /* cable change! */
+ /* it's very hard - all network setting must be changed!!! */
+ printk("hp100: %s: cable change 10Mb/s <-> 100Mb/s detected\n", dev->name);
+ lp->lan_type = i;
+ hp100_stop_interface(dev);
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
+ hp100_start_interface(dev);
+ } else {
+ printk("hp100: %s: interface reset\n", dev->name);
+ hp100_stop_interface(dev);
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
+ hp100_start_interface(dev);
+ }
+ }
+
+ dev->trans_start = jiffies;
+ return -EAGAIN;
}
- else
- {
- spin_lock_irqsave (&lp->lock, flags);
- hp100_ints_off(); /* Useful ? Jean II */
- i = hp100_sense_lan( dev );
- hp100_ints_on();
- spin_unlock_irqrestore (&lp->lock, flags);
- if ( i == HP100_LAN_ERR )
- printk( "hp100: %s: link down detected\n", dev->name );
- else
- if ( lp->lan_type != i ) /* cable change! */
- {
- /* it's very hard - all network setting must be changed!!! */
- printk( "hp100: %s: cable change 10Mb/s <-> 100Mb/s detected\n", dev->name );
- lp->lan_type = i;
- hp100_stop_interface( dev );
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE );
- hp100_start_interface( dev );
- }
- else
- {
- printk( "hp100: %s: interface reset\n", dev->name );
- hp100_stop_interface( dev );
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE );
- hp100_start_interface( dev );
- }
+
+ /*
+ * we have to turn int's off before modifying this, otherwise
+ * a tx_pdl_cleanup could occur at the same time
+ */
+ spin_lock_irqsave(&lp->lock, flags);
+ ringptr = lp->txrtail;
+ lp->txrtail = ringptr->next;
+
+ /* Check whether packet has minimal packet size */
+ ok_flag = skb->len >= HP100_MIN_PACKET_SIZE;
+ i = ok_flag ? skb->len : HP100_MIN_PACKET_SIZE;
+
+ ringptr->skb = skb;
+ ringptr->pdl[0] = ((1 << 16) | i); /* PDH: 1 Fragment & length */
+ ringptr->pdl[1] = (u32) virt_to_bus(skb->data); /* 1st Frag: Adr. of data */
+ if (lp->chip == HP100_CHIPID_SHASTA) {
+ /* TODO:Could someone who has the EISA card please check if this works? */
+ ringptr->pdl[2] = i;
+ } else { /* Lassen */
+ /* In the PDL, don't use the padded size but the real packet size: */
+ ringptr->pdl[2] = skb->len; /* 1st Frag: Length of frag */
}
- dev->trans_start = jiffies;
- return -EAGAIN;
- }
-
- /*
- * we have to turn int's off before modifying this, otherwise
- * a tx_pdl_cleanup could occur at the same time
- */
- spin_lock_irqsave (&lp->lock, flags);
- ringptr=lp->txrtail;
- lp->txrtail=ringptr->next;
-
- /* Check whether packet has minimal packet size */
- ok_flag = skb->len >= HP100_MIN_PACKET_SIZE;
- i = ok_flag ? skb->len : HP100_MIN_PACKET_SIZE;
-
- ringptr->skb=skb;
- ringptr->pdl[0]=((1<<16) | i); /* PDH: 1 Fragment & length */
- ringptr->pdl[1]=(u32)virt_to_bus(skb->data); /* 1st Frag: Adr. of data */
- if(lp->chip==HP100_CHIPID_SHASTA)
- {
- /* TODO:Could someone who has the EISA card please check if this works? */
- ringptr->pdl[2]=i;
- }
- else /* Lassen */
- {
- /* In the PDL, don't use the padded size but the real packet size: */
- ringptr->pdl[2]=skb->len; /* 1st Frag: Length of frag */
- }
-
- /* Hand this PDL to the card. */
- hp100_outl( ringptr->pdl_paddr, TX_PDA_L ); /* Low Prio. Queue */
-
- lp->txrcommit++;
- spin_unlock_irqrestore (&lp->lock, flags);
-
- /* Update statistics */
- lp->stats.tx_packets++;
- lp->stats.tx_bytes += skb->len;
- dev->trans_start = jiffies;
-
- return 0;
-}
+ /* Hand this PDL to the card. */
+ hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */
+
+ lp->txrcommit++;
+ spin_unlock_irqrestore(&lp->lock, flags);
+ /* Update statistics */
+ lp->stats.tx_packets++;
+ lp->stats.tx_bytes += skb->len;
+ dev->trans_start = jiffies;
+
+ return 0;
+}
+
/* clean_txring checks if packets have been sent by the card by reading
* the TX_PDL register from the performance page and comparing it to the
* number of commited packets. It then frees the skb's of the packets that
@@ -1681,201 +1614,181 @@ static int hp100_start_xmit_bm( struct sk_buff *skb, struct net_device *dev )
*
* Needs the PERFORMANCE page selected.
*/
-static void hp100_clean_txring( struct net_device *dev )
+static void hp100_clean_txring(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- int ioaddr = dev->base_addr;
- int donecount;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ int ioaddr = dev->base_addr;
+ int donecount;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4211, TRACE );
- printk("hp100: %s: clean txring\n", dev->name);
+ hp100_outw(0x4211, TRACE);
+ printk("hp100: %s: clean txring\n", dev->name);
#endif
- /* How many PDLs have been transmitted? */
- donecount=(lp->txrcommit)-hp100_inb(TX_PDL);
+ /* How many PDLs have been transmitted? */
+ donecount = (lp->txrcommit) - hp100_inb(TX_PDL);
#ifdef HP100_DEBUG
- if(donecount>MAX_TX_PDL)
- printk("hp100: %s: Warning: More PDLs transmitted than commited to card???\n",dev->name);
+ if (donecount > MAX_TX_PDL)
+ printk("hp100: %s: Warning: More PDLs transmitted than commited to card???\n", dev->name);
#endif
- for( ; 0!=donecount; donecount-- )
- {
+ for (; 0 != donecount; donecount--) {
#ifdef HP100_DEBUG_BM
- printk("hp100: %s: Free skb: data @0x%.8x txrcommit=0x%x TXPDL=0x%x, done=0x%x\n",
- dev->name,
- (u_int) lp->txrhead->skb->data,
- lp->txrcommit,
- hp100_inb(TX_PDL),
- donecount);
-#endif
- dev_kfree_skb_any( lp->txrhead->skb );
- lp->txrhead->skb=(void *)NULL;
- lp->txrhead=lp->txrhead->next;
- lp->txrcommit--;
- }
+ printk("hp100: %s: Free skb: data @0x%.8x txrcommit=0x%x TXPDL=0x%x, done=0x%x\n",
+ dev->name, (u_int) lp->txrhead->skb->data,
+ lp->txrcommit, hp100_inb(TX_PDL), donecount);
+#endif
+ dev_kfree_skb_any(lp->txrhead->skb);
+ lp->txrhead->skb = (void *) NULL;
+ lp->txrhead = lp->txrhead->next;
+ lp->txrcommit--;
+ }
}
-
/* tx function for slave modes */
-static int hp100_start_xmit( struct sk_buff *skb, struct net_device *dev )
+static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
- unsigned long flags;
- int i, ok_flag;
- int ioaddr = dev->base_addr;
- u_short val;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ unsigned long flags;
+ int i, ok_flag;
+ int ioaddr = dev->base_addr;
+ u_short val;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4212, TRACE );
- printk("hp100: %s: start_xmit\n", dev->name);
+ hp100_outw(0x4212, TRACE);
+ printk("hp100: %s: start_xmit\n", dev->name);
#endif
- if ( skb==NULL )
- {
- return 0;
- }
-
- if ( skb->len <= 0 ) return 0;
-
- if ( lp->lan_type < 0 ) /* no LAN type detected yet? */
- {
- hp100_stop_interface( dev );
- if ( ( lp->lan_type = hp100_sense_lan( dev ) ) < 0 )
- {
- printk( "hp100: %s: no connection found - check wire\n", dev->name );
- hp100_start_interface( dev ); /* 10Mb/s RX packets maybe handled */
- return -EIO;
- }
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE ); /* relogin */
- hp100_start_interface( dev );
- }
-
- /* If there is not enough free memory on the card... */
- i=hp100_inl(TX_MEM_FREE)&0x7fffffff;
- if ( !(((i/2)-539)>(skb->len+16) && (hp100_inb(TX_PKT_CNT)<255)) )
- {
+ if (skb == NULL) {
+ return 0;
+ }
+
+ if (skb->len <= 0)
+ return 0;
+
+ if (lp->lan_type < 0) { /* no LAN type detected yet? */
+ hp100_stop_interface(dev);
+ if ((lp->lan_type = hp100_sense_lan(dev)) < 0) {
+ printk("hp100: %s: no connection found - check wire\n", dev->name);
+ hp100_start_interface(dev); /* 10Mb/s RX packets maybe handled */
+ return -EIO;
+ }
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE); /* relogin */
+ hp100_start_interface(dev);
+ }
+
+ /* If there is not enough free memory on the card... */
+ i = hp100_inl(TX_MEM_FREE) & 0x7fffffff;
+ if (!(((i / 2) - 539) > (skb->len + 16) && (hp100_inb(TX_PKT_CNT) < 255))) {
#ifdef HP100_DEBUG
- printk( "hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i );
+ printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i);
#endif
- /* not waited long enough since last failed tx try? */
- if ( jiffies - dev->trans_start < HZ )
- {
+ /* not waited long enough since last failed tx try? */
+ if (jiffies - dev->trans_start < HZ) {
#ifdef HP100_DEBUG
- printk("hp100: %s: trans_start timing problem\n", dev->name);
+ printk("hp100: %s: trans_start timing problem\n",
+ dev->name);
#endif
- return -EAGAIN;
+ return -EAGAIN;
+ }
+ if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
+ /* we have a 100Mb/s adapter but it isn't connected to hub */
+ printk("hp100: %s: login to 100Mb/s hub retry\n", dev->name);
+ hp100_stop_interface(dev);
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
+ hp100_start_interface(dev);
+ } else {
+ spin_lock_irqsave(&lp->lock, flags);
+ hp100_ints_off(); /* Useful ? Jean II */
+ i = hp100_sense_lan(dev);
+ hp100_ints_on();
+ spin_unlock_irqrestore(&lp->lock, flags);
+ if (i == HP100_LAN_ERR)
+ printk("hp100: %s: link down detected\n", dev->name);
+ else if (lp->lan_type != i) { /* cable change! */
+ /* it's very hard - all network setting must be changed!!! */
+ printk("hp100: %s: cable change 10Mb/s <-> 100Mb/s detected\n", dev->name);
+ lp->lan_type = i;
+ hp100_stop_interface(dev);
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
+ hp100_start_interface(dev);
+ } else {
+ printk("hp100: %s: interface reset\n", dev->name);
+ hp100_stop_interface(dev);
+ if (lp->lan_type == HP100_LAN_100)
+ lp->hub_status = hp100_login_to_vg_hub(dev, FALSE);
+ hp100_start_interface(dev);
+ mdelay(1);
+ }
+ }
+ dev->trans_start = jiffies;
+ return -EAGAIN;
}
- if ( lp->lan_type == HP100_LAN_100 && lp->hub_status < 0 )
- /* we have a 100Mb/s adapter but it isn't connected to hub */
- {
- printk( "hp100: %s: login to 100Mb/s hub retry\n", dev->name );
- hp100_stop_interface( dev );
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE );
- hp100_start_interface( dev );
- }
- else
- {
- spin_lock_irqsave (&lp->lock, flags);
- hp100_ints_off(); /* Useful ? Jean II */
- i = hp100_sense_lan( dev );
- hp100_ints_on();
- spin_unlock_irqrestore (&lp->lock, flags);
- if ( i == HP100_LAN_ERR )
- printk( "hp100: %s: link down detected\n", dev->name );
- else
- if ( lp->lan_type != i ) /* cable change! */
- {
- /* it's very hard - all network setting must be changed!!! */
- printk( "hp100: %s: cable change 10Mb/s <-> 100Mb/s detected\n", dev->name );
- lp->lan_type = i;
- hp100_stop_interface( dev );
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE );
- hp100_start_interface( dev );
- }
- else
- {
- printk( "hp100: %s: interface reset\n", dev->name );
- hp100_stop_interface( dev );
- if ( lp->lan_type == HP100_LAN_100 )
- lp->hub_status = hp100_login_to_vg_hub( dev, FALSE );
- hp100_start_interface( dev );
- mdelay(1);
- }
- }
- dev->trans_start = jiffies;
- return -EAGAIN;
- }
-
- for ( i=0; i<6000 && ( hp100_inb( OPTION_MSW ) & HP100_TX_CMD ); i++ )
- {
+
+ for (i = 0; i < 6000 && (hp100_inb(OPTION_MSW) & HP100_TX_CMD); i++) {
#ifdef HP100_DEBUG_TX
- printk( "hp100: %s: start_xmit: busy\n", dev->name );
+ printk("hp100: %s: start_xmit: busy\n", dev->name);
#endif
- }
-
- spin_lock_irqsave (&lp->lock, flags);
- hp100_ints_off();
- val = hp100_inw( IRQ_STATUS );
- /* Ack / clear the interrupt TX_COMPLETE interrupt - this interrupt is set
- * when the current packet being transmitted on the wire is completed. */
- hp100_outw( HP100_TX_COMPLETE, IRQ_STATUS );
+ }
+
+ spin_lock_irqsave(&lp->lock, flags);
+ hp100_ints_off();
+ val = hp100_inw(IRQ_STATUS);
+ /* Ack / clear the interrupt TX_COMPLETE interrupt - this interrupt is set
+ * when the current packet being transmitted on the wire is completed. */
+ hp100_outw(HP100_TX_COMPLETE, IRQ_STATUS);
#ifdef HP100_DEBUG_TX
- printk("hp100: %s: start_xmit: irq_status=0x%.4x, irqmask=0x%.4x, len=%d\n",dev->name,val,hp100_inw(IRQ_MASK),(int)skb->len );
-#endif
+ printk("hp100: %s: start_xmit: irq_status=0x%.4x, irqmask=0x%.4x, len=%d\n",
+ dev->name, val, hp100_inw(IRQ_MASK), (int) skb->len);
+#endif
+
+ ok_flag = skb->len >= HP100_MIN_PACKET_SIZE;
+ i = ok_flag ? skb->len : HP100_MIN_PACKET_SIZE;
+
+ hp100_outw(i, DATA32); /* tell card the total packet length */
+ hp100_outw(i, FRAGMENT_LEN); /* and first/only fragment length */
+
+ if (lp->mode == 2) { /* memory mapped */
+ if (lp->mem_ptr_virt) { /* high pci memory was remapped */
+ /* Note: The J2585B needs alignment to 32bits here! */
+ memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3);
+ if (!ok_flag)
+ memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len);
+ } else {
+ /* Note: The J2585B needs alignment to 32bits here! */
+ isa_memcpy_toio(lp->mem_ptr_phys, skb->data, (skb->len + 3) & ~3);
+ if (!ok_flag)
+ isa_memset_io(lp->mem_ptr_phys, 0, HP100_MIN_PACKET_SIZE - skb->len);
+ }
+ } else { /* programmed i/o */
+ outsl(ioaddr + HP100_REG_DATA32, skb->data,
+ (skb->len + 3) >> 2);
+ if (!ok_flag)
+ for (i = (skb->len + 3) & ~3; i < HP100_MIN_PACKET_SIZE; i += 4)
+ hp100_outl(0, DATA32);
+ }
- ok_flag = skb->len >= HP100_MIN_PACKET_SIZE;
- i = ok_flag ? skb->len : HP100_MIN_PACKET_SIZE;
+ hp100_outb(HP100_TX_CMD | HP100_SET_LB, OPTION_MSW); /* send packet */
+
+ lp->stats.tx_packets++;
+ lp->stats.tx_bytes += skb->len;
+ dev->trans_start = jiffies;
+ hp100_ints_on();
+ spin_unlock_irqrestore(&lp->lock, flags);
+
+ dev_kfree_skb_any(skb);
- hp100_outw( i, DATA32 ); /* tell card the total packet length */
- hp100_outw( i, FRAGMENT_LEN ); /* and first/only fragment length */
-
- if ( lp->mode==2 ) /* memory mapped */
- {
- if ( lp->mem_ptr_virt ) /* high pci memory was remapped */
- {
- /* Note: The J2585B needs alignment to 32bits here! */
- memcpy_toio( lp->mem_ptr_virt, skb->data, ( skb->len + 3 ) & ~3 );
- if ( !ok_flag )
- memset_io( lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len );
- }
- else
- {
- /* Note: The J2585B needs alignment to 32bits here! */
- isa_memcpy_toio( lp->mem_ptr_phys, skb->data, (skb->len + 3) & ~3 );
- if ( !ok_flag )
- isa_memset_io( lp->mem_ptr_phys, 0, HP100_MIN_PACKET_SIZE - skb->len );
- }
- }
- else /* programmed i/o */
- {
- outsl( ioaddr + HP100_REG_DATA32, skb->data, ( skb->len + 3 ) >> 2 );
- if ( !ok_flag )
- for ( i = ( skb->len + 3 ) & ~3; i < HP100_MIN_PACKET_SIZE; i += 4 )
- hp100_outl( 0, DATA32 );
- }
-
- hp100_outb( HP100_TX_CMD | HP100_SET_LB, OPTION_MSW ); /* send packet */
-
- lp->stats.tx_packets++;
- lp->stats.tx_bytes += skb->len;
- dev->trans_start=jiffies;
- hp100_ints_on();
- spin_unlock_irqrestore (&lp->lock, flags);
-
- dev_kfree_skb_any( skb );
-
#ifdef HP100_DEBUG_TX
- printk( "hp100: %s: start_xmit: end\n", dev->name );
+ printk("hp100: %s: start_xmit: end\n", dev->name);
#endif
-
- return 0;
-}
+ return 0;
+}
+
/*
* Receive Function (Non-Busmaster mode)
* Called when an "Receive Packet" interrupt occurs, i.e. the receive
@@ -1885,323 +1798,295 @@ static int hp100_start_xmit( struct sk_buff *skb, struct net_device *dev )
* and netif_rx.
*/
-static void hp100_rx( struct net_device *dev )
+static void hp100_rx(struct net_device *dev)
{
- int packets, pkt_len;
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- u_int header;
- struct sk_buff *skb;
+ int packets, pkt_len;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ u_int header;
+ struct sk_buff *skb;
#ifdef DEBUG_B
- hp100_outw( 0x4213, TRACE );
- printk("hp100: %s: rx\n", dev->name);
+ hp100_outw(0x4213, TRACE);
+ printk("hp100: %s: rx\n", dev->name);
#endif
- /* First get indication of received lan packet */
- /* RX_PKT_CND indicates the number of packets which have been fully */
- /* received onto the card but have not been fully transferred of the card */
- packets = hp100_inb( RX_PKT_CNT );
+ /* First get indication of received lan packet */
+ /* RX_PKT_CND indicates the number of packets which have been fully */
+ /* received onto the card but have not been fully transferred of the card */
+ packets = hp100_inb(RX_PKT_CNT);
#ifdef HP100_DEBUG_RX
- if ( packets > 1 )
- printk( "hp100: %s: rx: waiting packets = %d\n", dev->name,packets );
+ if (packets > 1)
+ printk("hp100: %s: rx: waiting packets = %d\n", dev->name, packets);
#endif
- while ( packets-- > 0 )
- {
- /* If ADV_NXT_PKT is still set, we have to wait until the card has */
- /* really advanced to the next packet. */
- for (pkt_len=0; pkt_len<6000 &&(hp100_inb(OPTION_MSW)&HP100_ADV_NXT_PKT);
- pkt_len++ )
- {
+ while (packets-- > 0) {
+ /* If ADV_NXT_PKT is still set, we have to wait until the card has */
+ /* really advanced to the next packet. */
+ for (pkt_len = 0; pkt_len < 6000 && (hp100_inb(OPTION_MSW) & HP100_ADV_NXT_PKT); pkt_len++) {
#ifdef HP100_DEBUG_RX
- printk( "hp100: %s: rx: busy, remaining packets = %d\n", dev->name, packets );
-#endif
- }
-
- /* First we get the header, which contains information about the */
- /* actual length of the received packet. */
- if( lp->mode==2 ) /* memory mapped mode */
- {
- if ( lp->mem_ptr_virt ) /* if memory was remapped */
- header = readl(lp->mem_ptr_virt);
- else
- header = isa_readl( lp->mem_ptr_phys );
- }
- else /* programmed i/o */
- header = hp100_inl( DATA32 );
-
- pkt_len = ((header & HP100_PKT_LEN_MASK) + 3) & ~3;
+ printk ("hp100: %s: rx: busy, remaining packets = %d\n", dev->name, packets);
+#endif
+ }
+
+ /* First we get the header, which contains information about the */
+ /* actual length of the received packet. */
+ if (lp->mode == 2) { /* memory mapped mode */
+ if (lp->mem_ptr_virt) /* if memory was remapped */
+ header = readl(lp->mem_ptr_virt);
+ else
+ header = isa_readl(lp->mem_ptr_phys);
+ } else /* programmed i/o */
+ header = hp100_inl(DATA32);
+
+ pkt_len = ((header & HP100_PKT_LEN_MASK) + 3) & ~3;
#ifdef HP100_DEBUG_RX
- printk( "hp100: %s: rx: new packet - length=%d, errors=0x%x, dest=0x%x\n",
- dev->name,
- header & HP100_PKT_LEN_MASK, (header>>16)&0xfff8,
- (header>>16)&7);
-#endif
-
- /* Now we allocate the skb and transfer the data into it. */
- skb = dev_alloc_skb( pkt_len );
- if ( skb == NULL ) /* Not enough memory->drop packet */
- {
+ printk("hp100: %s: rx: new packet - length=%d, errors=0x%x, dest=0x%x\n",
+ dev->name, header & HP100_PKT_LEN_MASK,
+ (header >> 16) & 0xfff8, (header >> 16) & 7);
+#endif
+
+ /* Now we allocate the skb and transfer the data into it. */
+ skb = dev_alloc_skb(pkt_len);
+ if (skb == NULL) { /* Not enough memory->drop packet */
#ifdef HP100_DEBUG
- printk( "hp100: %s: rx: couldn't allocate a sk_buff of size %d\n", dev->name, pkt_len );
+ printk("hp100: %s: rx: couldn't allocate a sk_buff of size %d\n",
+ dev->name, pkt_len);
#endif
- lp->stats.rx_dropped++;
- }
- else /* skb successfully allocated */
- {
- u_char *ptr;
-
- skb->dev = dev;
-
- /* ptr to start of the sk_buff data area */
- ptr = (u_char *)skb_put( skb, pkt_len );
-
- /* Now transfer the data from the card into that area */
- if ( lp->mode==2 )
- {
- if ( lp->mem_ptr_virt )
- memcpy_fromio( ptr, lp->mem_ptr_virt, pkt_len );
- /* Note alignment to 32bit transfers */
- else
- isa_memcpy_fromio( ptr, lp->mem_ptr_phys, pkt_len );
- }
- else /* io mapped */
- insl( ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2 );
-
- skb->protocol = eth_type_trans( skb, dev );
-
+ lp->stats.rx_dropped++;
+ } else { /* skb successfully allocated */
+
+ u_char *ptr;
+
+ skb->dev = dev;
+
+ /* ptr to start of the sk_buff data area */
+ ptr = (u_char *) skb_put(skb, pkt_len);
+
+ /* Now transfer the data from the card into that area */
+ if (lp->mode == 2) {
+ if (lp->mem_ptr_virt)
+ memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len);
+ /* Note alignment to 32bit transfers */
+ else
+ isa_memcpy_fromio(ptr, lp->mem_ptr_phys, pkt_len);
+ } else /* io mapped */
+ insl(ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2);
+
+ skb->protocol = eth_type_trans(skb, dev);
+
#ifdef HP100_DEBUG_RX
- printk( "hp100: %s: rx: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
- dev->name,
- ptr[ 0 ], ptr[ 1 ], ptr[ 2 ], ptr[ 3 ], ptr[ 4 ], ptr[ 5 ],
- ptr[ 6 ], ptr[ 7 ], ptr[ 8 ], ptr[ 9 ], ptr[ 10 ], ptr[ 11 ] );
-#endif
- netif_rx( skb );
- dev->last_rx = jiffies;
- lp->stats.rx_packets++;
- lp->stats.rx_bytes += pkt_len;
- }
-
- /* Indicate the card that we have got the packet */
- hp100_outb( HP100_ADV_NXT_PKT | HP100_SET_LB, OPTION_MSW );
-
- switch ( header & 0x00070000 ) {
- case (HP100_MULTI_ADDR_HASH<<16):
- case (HP100_MULTI_ADDR_NO_HASH<<16):
- lp->stats.multicast++; break;
- }
- } /* end of while(there are packets) loop */
+ printk("hp100: %s: rx: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
+ dev->name, ptr[0], ptr[1], ptr[2], ptr[3],
+ ptr[4], ptr[5], ptr[6], ptr[7], ptr[8],
+ ptr[9], ptr[10], ptr[11]);
+#endif
+ netif_rx(skb);
+ dev->last_rx = jiffies;
+ lp->stats.rx_packets++;
+ lp->stats.rx_bytes += pkt_len;
+ }
+
+ /* Indicate the card that we have got the packet */
+ hp100_outb(HP100_ADV_NXT_PKT | HP100_SET_LB, OPTION_MSW);
+
+ switch (header & 0x00070000) {
+ case (HP100_MULTI_ADDR_HASH << 16):
+ case (HP100_MULTI_ADDR_NO_HASH << 16):
+ lp->stats.multicast++;
+ break;
+ }
+ } /* end of while(there are packets) loop */
#ifdef HP100_DEBUG_RX
- printk( "hp100_rx: %s: end\n", dev->name );
+ printk("hp100_rx: %s: end\n", dev->name);
#endif
}
-
/*
* Receive Function for Busmaster Mode
*/
-static void hp100_rx_bm( struct net_device *dev )
+static void hp100_rx_bm(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- hp100_ring_t *ptr;
- u_int header;
- int pkt_len;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ hp100_ring_t *ptr;
+ u_int header;
+ int pkt_len;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4214, TRACE );
- printk("hp100: %s: rx_bm\n", dev->name);
+ hp100_outw(0x4214, TRACE);
+ printk("hp100: %s: rx_bm\n", dev->name);
#endif
#ifdef HP100_DEBUG
- if(0==lp->rxrcommit)
- {
- printk("hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->name);
- return;
- }
- else
-
- /* RX_PKT_CNT states how many PDLs are currently formatted and available to
- * the cards BM engine */
- if( (hp100_inw(RX_PKT_CNT)&0x00ff) >= lp->rxrcommit)
- {
- printk("hp100: %s: More packets received than commited? RX_PKT_CNT=0x%x, commit=0x%x\n", dev->name, hp100_inw(RX_PKT_CNT)&0x00ff, lp->rxrcommit);
- return;
- }
-#endif
-
- while( (lp->rxrcommit > hp100_inb(RX_PDL)) )
- {
- /*
- * The packet was received into the pdl pointed to by lp->rxrhead (
- * the oldest pdl in the ring
- */
-
- /* First we get the header, which contains information about the */
- /* actual length of the received packet. */
-
- ptr=lp->rxrhead;
-
- header = *(ptr->pdl-1);
- pkt_len = (header & HP100_PKT_LEN_MASK);
+ if (0 == lp->rxrcommit) {
+ printk("hp100: %s: rx_bm called although no PDLs were committed to adapter?\n", dev->name);
+ return;
+ } else
+ /* RX_PKT_CNT states how many PDLs are currently formatted and available to
+ * the cards BM engine */
+ if ((hp100_inw(RX_PKT_CNT) & 0x00ff) >= lp->rxrcommit) {
+ printk("hp100: %s: More packets received than commited? RX_PKT_CNT=0x%x, commit=0x%x\n",
+ dev->name, hp100_inw(RX_PKT_CNT) & 0x00ff,
+ lp->rxrcommit);
+ return;
+ }
+#endif
+
+ while ((lp->rxrcommit > hp100_inb(RX_PDL))) {
+ /*
+ * The packet was received into the pdl pointed to by lp->rxrhead (
+ * the oldest pdl in the ring
+ */
+
+ /* First we get the header, which contains information about the */
+ /* actual length of the received packet. */
+
+ ptr = lp->rxrhead;
+
+ header = *(ptr->pdl - 1);
+ pkt_len = (header & HP100_PKT_LEN_MASK);
#ifdef HP100_DEBUG_BM
- printk( "hp100: %s: rx_bm: header@0x%x=0x%x length=%d, errors=0x%x, dest=0x%x\n",
- dev->name,
- (u_int) (ptr->pdl-1),(u_int) header,
- pkt_len,
- (header>>16)&0xfff8,
- (header>>16)&7);
- printk( "hp100: %s: RX_PDL_COUNT:0x%x TX_PDL_COUNT:0x%x, RX_PKT_CNT=0x%x PDH=0x%x, Data@0x%x len=0x%x\n",
- dev->name,
- hp100_inb( RX_PDL ),
- hp100_inb( TX_PDL ),
- hp100_inb( RX_PKT_CNT ),
- (u_int) *(ptr->pdl),
- (u_int) *(ptr->pdl+3),
- (u_int) *(ptr->pdl+4));
-#endif
-
- if( (pkt_len>=MIN_ETHER_SIZE) &&
- (pkt_len<=MAX_ETHER_SIZE) )
- {
- if(ptr->skb==NULL)
- {
- printk("hp100: %s: rx_bm: skb null\n", dev->name);
- /* can happen if we only allocated room for the pdh due to memory shortage. */
- lp->stats.rx_dropped++;
- }
- else
- {
- skb_trim( ptr->skb, pkt_len ); /* Shorten it */
- ptr->skb->protocol = eth_type_trans( ptr->skb, dev );
-
- netif_rx( ptr->skb ); /* Up and away... */
-
- dev->last_rx = jiffies;
- lp->stats.rx_packets++;
- lp->stats.rx_bytes += pkt_len;
- }
-
- switch ( header & 0x00070000 ) {
- case (HP100_MULTI_ADDR_HASH<<16):
- case (HP100_MULTI_ADDR_NO_HASH<<16):
- lp->stats.multicast++; break;
- }
- }
- else
- {
+ printk("hp100: %s: rx_bm: header@0x%x=0x%x length=%d, errors=0x%x, dest=0x%x\n",
+ dev->name, (u_int) (ptr->pdl - 1), (u_int) header,
+ pkt_len, (header >> 16) & 0xfff8, (header >> 16) & 7);
+ printk("hp100: %s: RX_PDL_COUNT:0x%x TX_PDL_COUNT:0x%x, RX_PKT_CNT=0x%x PDH=0x%x, Data@0x%x len=0x%x\n",
+ dev->name, hp100_inb(RX_PDL), hp100_inb(TX_PDL),
+ hp100_inb(RX_PKT_CNT), (u_int) * (ptr->pdl),
+ (u_int) * (ptr->pdl + 3), (u_int) * (ptr->pdl + 4));
+#endif
+
+ if ((pkt_len >= MIN_ETHER_SIZE) &&
+ (pkt_len <= MAX_ETHER_SIZE)) {
+ if (ptr->skb == NULL) {
+ printk("hp100: %s: rx_bm: skb null\n", dev->name);
+ /* can happen if we only allocated room for the pdh due to memory shortage. */
+ lp->stats.rx_dropped++;
+ } else {
+ skb_trim(ptr->skb, pkt_len); /* Shorten it */
+ ptr->skb->protocol =
+ eth_type_trans(ptr->skb, dev);
+
+ netif_rx(ptr->skb); /* Up and away... */
+
+ dev->last_rx = jiffies;
+ lp->stats.rx_packets++;
+ lp->stats.rx_bytes += pkt_len;
+ }
+
+ switch (header & 0x00070000) {
+ case (HP100_MULTI_ADDR_HASH << 16):
+ case (HP100_MULTI_ADDR_NO_HASH << 16):
+ lp->stats.multicast++;
+ break;
+ }
+ } else {
#ifdef HP100_DEBUG
- printk("hp100: %s: rx_bm: Received bad packet (length=%d)\n",dev->name,pkt_len);
-#endif
- if(ptr->skb!=NULL)
- dev_kfree_skb_any( ptr->skb );
- lp->stats.rx_errors++;
- }
-
- lp->rxrhead=lp->rxrhead->next;
-
- /* Allocate a new rx PDL (so lp->rxrcommit stays the same) */
- if (0 == hp100_build_rx_pdl( lp->rxrtail, dev ))
- {
- /* No space for skb, header can still be received. */
+ printk("hp100: %s: rx_bm: Received bad packet (length=%d)\n", dev->name, pkt_len);
+#endif
+ if (ptr->skb != NULL)
+ dev_kfree_skb_any(ptr->skb);
+ lp->stats.rx_errors++;
+ }
+
+ lp->rxrhead = lp->rxrhead->next;
+
+ /* Allocate a new rx PDL (so lp->rxrcommit stays the same) */
+ if (0 == hp100_build_rx_pdl(lp->rxrtail, dev)) {
+ /* No space for skb, header can still be received. */
#ifdef HP100_DEBUG
- printk("hp100: %s: rx_bm: No space for new PDL.\n", dev->name);
-#endif
- return;
- }
- else
- { /* successfully allocated new PDL - put it in ringlist at tail. */
- hp100_outl((u32)lp->rxrtail->pdl_paddr, RX_PDA);
- lp->rxrtail=lp->rxrtail->next;
+ printk("hp100: %s: rx_bm: No space for new PDL.\n", dev->name);
+#endif
+ return;
+ } else { /* successfully allocated new PDL - put it in ringlist at tail. */
+ hp100_outl((u32) lp->rxrtail->pdl_paddr, RX_PDA);
+ lp->rxrtail = lp->rxrtail->next;
+ }
+
}
-
- }
}
-
-
/*
* statistics
*/
-static hp100_stats_t *hp100_get_stats( struct net_device *dev )
+static hp100_stats_t *hp100_get_stats(struct net_device *dev)
{
- unsigned long flags;
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ unsigned long flags;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4215, TRACE );
+ hp100_outw(0x4215, TRACE);
#endif
- spin_lock_irqsave (&lp->lock, flags);
- hp100_ints_off(); /* Useful ? Jean II */
- hp100_update_stats( dev );
- hp100_ints_on();
- spin_unlock_irqrestore (&lp->lock, flags);
- return &(lp->stats);
+ spin_lock_irqsave(&lp->lock, flags);
+ hp100_ints_off(); /* Useful ? Jean II */
+ hp100_update_stats(dev);
+ hp100_ints_on();
+ spin_unlock_irqrestore(&lp->lock, flags);
+ return &(lp->stats);
}
-static void hp100_update_stats( struct net_device *dev )
+static void hp100_update_stats(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- u_short val;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ int ioaddr = dev->base_addr;
+ u_short val;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4216, TRACE );
- printk("hp100: %s: update-stats\n", dev->name);
-#endif
-
- /* Note: Statistics counters clear when read. */
- hp100_page( MAC_CTRL );
- val = hp100_inw( DROPPED ) & 0x0fff;
- lp->stats.rx_errors += val;
- lp->stats.rx_over_errors += val;
- val = hp100_inb( CRC );
- lp->stats.rx_errors += val;
- lp->stats.rx_crc_errors += val;
- val = hp100_inb( ABORT );
- lp->stats.tx_errors += val;
- lp->stats.tx_aborted_errors += val;
- hp100_page( PERFORMANCE );
+ hp100_outw(0x4216, TRACE);
+ printk("hp100: %s: update-stats\n", dev->name);
+#endif
+
+ /* Note: Statistics counters clear when read. */
+ hp100_page(MAC_CTRL);
+ val = hp100_inw(DROPPED) & 0x0fff;
+ lp->stats.rx_errors += val;
+ lp->stats.rx_over_errors += val;
+ val = hp100_inb(CRC);
+ lp->stats.rx_errors += val;
+ lp->stats.rx_crc_errors += val;
+ val = hp100_inb(ABORT);
+ lp->stats.tx_errors += val;
+ lp->stats.tx_aborted_errors += val;
+ hp100_page(PERFORMANCE);
}
-static void hp100_misc_interrupt( struct net_device *dev )
+static void hp100_misc_interrupt(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4216, TRACE );
- printk("hp100: %s: misc_interrupt\n", dev->name);
+ hp100_outw(0x4216, TRACE);
+ printk("hp100: %s: misc_interrupt\n", dev->name);
#endif
- /* Note: Statistics counters clear when read. */
- lp->stats.rx_errors++;
- lp->stats.tx_errors++;
+ /* Note: Statistics counters clear when read. */
+ lp->stats.rx_errors++;
+ lp->stats.tx_errors++;
}
-static void hp100_clear_stats( struct hp100_private *lp, int ioaddr )
+static void hp100_clear_stats(struct hp100_private *lp, int ioaddr)
{
- unsigned long flags;
+ unsigned long flags;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4217, TRACE );
- printk("hp100: %s: clear_stats\n", dev->name);
+ hp100_outw(0x4217, TRACE);
+ printk("hp100: %s: clear_stats\n", dev->name);
#endif
- spin_lock_irqsave (&lp->lock, flags);
- hp100_page( MAC_CTRL ); /* get all statistics bytes */
- hp100_inw( DROPPED );
- hp100_inb( CRC );
- hp100_inb( ABORT );
- hp100_page( PERFORMANCE );
- spin_unlock_irqrestore (&lp->lock, flags);
+ spin_lock_irqsave(&lp->lock, flags);
+ hp100_page(MAC_CTRL); /* get all statistics bytes */
+ hp100_inw(DROPPED);
+ hp100_inb(CRC);
+ hp100_inb(ABORT);
+ hp100_page(PERFORMANCE);
+ spin_unlock_irqrestore(&lp->lock, flags);
}
-
+
/*
* multicast setup
*/
@@ -2209,838 +2094,821 @@ static void hp100_clear_stats( struct hp100_private *lp, int ioaddr )
/*
* Set or clear the multicast filter for this adapter.
*/
-
-static void hp100_set_multicast_list( struct net_device *dev )
+
+static void hp100_set_multicast_list(struct net_device *dev)
{
- unsigned long flags;
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ unsigned long flags;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4218, TRACE );
- printk("hp100: %s: set_mc_list\n", dev->name);
-#endif
-
- spin_lock_irqsave (&lp->lock, flags);
- hp100_ints_off();
- hp100_page( MAC_CTRL );
- hp100_andb( ~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1 ); /* stop rx/tx */
-
- if ( dev->flags & IFF_PROMISC )
- {
- lp->mac2_mode = HP100_MAC2MODE6; /* promiscuous mode = get all good */
- lp->mac1_mode = HP100_MAC1MODE6; /* packets on the net */
- memset( &lp->hash_bytes, 0xff, 8 );
- }
- else if ( dev->mc_count || (dev->flags&IFF_ALLMULTI) )
- {
- lp->mac2_mode = HP100_MAC2MODE5; /* multicast mode = get packets for */
- lp->mac1_mode = HP100_MAC1MODE5; /* me, broadcasts and all multicasts */
-#ifdef HP100_MULTICAST_FILTER /* doesn't work!!! */
- if ( dev -> flags & IFF_ALLMULTI )
- {
- /* set hash filter to receive all multicast packets */
- memset( &lp->hash_bytes, 0xff, 8 );
- }
- else
- {
- int i, j, idx;
- u_char *addrs;
- struct dev_mc_list *dmi;
-
- memset( &lp->hash_bytes, 0x00, 8 );
+ hp100_outw(0x4218, TRACE);
+ printk("hp100: %s: set_mc_list\n", dev->name);
+#endif
+
+ spin_lock_irqsave(&lp->lock, flags);
+ hp100_ints_off();
+ hp100_page(MAC_CTRL);
+ hp100_andb(~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1); /* stop rx/tx */
+
+ if (dev->flags & IFF_PROMISC) {
+ lp->mac2_mode = HP100_MAC2MODE6; /* promiscuous mode = get all good */
+ lp->mac1_mode = HP100_MAC1MODE6; /* packets on the net */
+ memset(&lp->hash_bytes, 0xff, 8);
+ } else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) {
+ lp->mac2_mode = HP100_MAC2MODE5; /* multicast mode = get packets for */
+ lp->mac1_mode = HP100_MAC1MODE5; /* me, broadcasts and all multicasts */
+#ifdef HP100_MULTICAST_FILTER /* doesn't work!!! */
+ if (dev->flags & IFF_ALLMULTI) {
+ /* set hash filter to receive all multicast packets */
+ memset(&lp->hash_bytes, 0xff, 8);
+ } else {
+ int i, j, idx;
+ u_char *addrs;
+ struct dev_mc_list *dmi;
+
+ memset(&lp->hash_bytes, 0x00, 8);
#ifdef HP100_DEBUG
- printk("hp100: %s: computing hash filter - mc_count = %i\n", dev -> name, dev -> mc_count );
-#endif
- for ( i = 0, dmi = dev -> mc_list; i < dev -> mc_count; i++, dmi = dmi -> next )
- {
- addrs = dmi -> dmi_addr;
- if ( ( *addrs & 0x01 ) == 0x01 ) /* multicast address? */
- {
+ printk("hp100: %s: computing hash filter - mc_count = %i\n", dev->name, dev->mc_count);
+#endif
+ for (i = 0, dmi = dev->mc_list; i < dev->mc_count; i++, dmi = dmi->next) {
+ addrs = dmi->dmi_addr;
+ if ((*addrs & 0x01) == 0x01) { /* multicast address? */
#ifdef HP100_DEBUG
- printk("hp100: %s: multicast = %02x:%02x:%02x:%02x:%02x:%02x, ",
- dev -> name,
- addrs[ 0 ], addrs[ 1 ], addrs[ 2 ],
- addrs[ 3 ], addrs[ 4 ], addrs[ 5 ] );
-#endif
- for ( j = idx = 0; j < 6; j++ )
- {
- idx ^= *addrs++ & 0x3f;
- printk( ":%02x:", idx );
- }
+ printk("hp100: %s: multicast = %02x:%02x:%02x:%02x:%02x:%02x, ",
+ dev->name, addrs[0], addrs[1], addrs[2],
+ addrs[3], addrs[4], addrs[5]);
+#endif
+ for (j = idx = 0; j < 6; j++) {
+ idx ^= *addrs++ & 0x3f;
+ printk(":%02x:", idx);
+ }
#ifdef HP100_DEBUG
- printk("idx = %i\n", idx );
+ printk("idx = %i\n", idx);
#endif
- lp->hash_bytes[ idx >> 3 ] |= ( 1 << ( idx & 7 ) );
- }
- }
- }
+ lp->hash_bytes[idx >> 3] |= (1 << (idx & 7));
+ }
+ }
+ }
#else
- memset( &lp->hash_bytes, 0xff, 8 );
-#endif
- }
- else
- {
- lp->mac2_mode = HP100_MAC2MODE3; /* normal mode = get packets for me */
- lp->mac1_mode = HP100_MAC1MODE3; /* and broadcasts */
- memset( &lp->hash_bytes, 0x00, 8 );
- }
-
- if ( ( (hp100_inb(MAC_CFG_1) & 0x0f)!=lp->mac1_mode ) ||
- ( hp100_inb(MAC_CFG_2)!=lp->mac2_mode ) )
- {
- int i;
-
- hp100_outb( lp->mac2_mode, MAC_CFG_2 );
- hp100_andb( HP100_MAC1MODEMASK, MAC_CFG_1 ); /* clear mac1 mode bits */
- hp100_orb( lp->mac1_mode, MAC_CFG_1 ); /* and set the new mode */
-
- hp100_page( MAC_ADDRESS );
- for ( i = 0; i < 8; i++ )
- hp100_outb( lp->hash_bytes[ i ], HASH_BYTE0 + i );
+ memset(&lp->hash_bytes, 0xff, 8);
+#endif
+ } else {
+ lp->mac2_mode = HP100_MAC2MODE3; /* normal mode = get packets for me */
+ lp->mac1_mode = HP100_MAC1MODE3; /* and broadcasts */
+ memset(&lp->hash_bytes, 0x00, 8);
+ }
+
+ if (((hp100_inb(MAC_CFG_1) & 0x0f) != lp->mac1_mode) ||
+ (hp100_inb(MAC_CFG_2) != lp->mac2_mode)) {
+ int i;
+
+ hp100_outb(lp->mac2_mode, MAC_CFG_2);
+ hp100_andb(HP100_MAC1MODEMASK, MAC_CFG_1); /* clear mac1 mode bits */
+ hp100_orb(lp->mac1_mode, MAC_CFG_1); /* and set the new mode */
+
+ hp100_page(MAC_ADDRESS);
+ for (i = 0; i < 8; i++)
+ hp100_outb(lp->hash_bytes[i], HASH_BYTE0 + i);
#ifdef HP100_DEBUG
- printk("hp100: %s: mac1 = 0x%x, mac2 = 0x%x, multicast hash = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
- dev->name, lp->mac1_mode, lp->mac2_mode,
- lp->hash_bytes[ 0 ], lp->hash_bytes[ 1 ],
- lp->hash_bytes[ 2 ], lp->hash_bytes[ 3 ],
- lp->hash_bytes[ 4 ], lp->hash_bytes[ 5 ],
- lp->hash_bytes[ 6 ], lp->hash_bytes[ 7 ]
- );
-#endif
-
- if(lp->lan_type==HP100_LAN_100)
- {
+ printk("hp100: %s: mac1 = 0x%x, mac2 = 0x%x, multicast hash = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
+ dev->name, lp->mac1_mode, lp->mac2_mode,
+ lp->hash_bytes[0], lp->hash_bytes[1],
+ lp->hash_bytes[2], lp->hash_bytes[3],
+ lp->hash_bytes[4], lp->hash_bytes[5],
+ lp->hash_bytes[6], lp->hash_bytes[7]);
+#endif
+
+ if (lp->lan_type == HP100_LAN_100) {
#ifdef HP100_DEBUG
- printk("hp100: %s: 100VG MAC settings have changed - relogin.\n", dev->name);
-#endif
- lp->hub_status=hp100_login_to_vg_hub( dev, TRUE ); /* force a relogin to the hub */
- }
- }
- else
- {
- int i;
- u_char old_hash_bytes[ 8 ];
-
- hp100_page( MAC_ADDRESS );
- for ( i = 0; i < 8; i++ )
- old_hash_bytes[ i ] = hp100_inb( HASH_BYTE0 + i );
- if ( memcmp( old_hash_bytes, &lp->hash_bytes, 8 ) )
- {
- for ( i = 0; i < 8; i++ )
- hp100_outb( lp->hash_bytes[ i ], HASH_BYTE0 + i );
+ printk("hp100: %s: 100VG MAC settings have changed - relogin.\n", dev->name);
+#endif
+ lp->hub_status = hp100_login_to_vg_hub(dev, TRUE); /* force a relogin to the hub */
+ }
+ } else {
+ int i;
+ u_char old_hash_bytes[8];
+
+ hp100_page(MAC_ADDRESS);
+ for (i = 0; i < 8; i++)
+ old_hash_bytes[i] = hp100_inb(HASH_BYTE0 + i);
+ if (memcmp(old_hash_bytes, &lp->hash_bytes, 8)) {
+ for (i = 0; i < 8; i++)
+ hp100_outb(lp->hash_bytes[i], HASH_BYTE0 + i);
#ifdef HP100_DEBUG
- printk("hp100: %s: multicast hash = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
- dev->name,
- lp->hash_bytes[ 0 ], lp->hash_bytes[ 1 ],
- lp->hash_bytes[ 2 ], lp->hash_bytes[ 3 ],
- lp->hash_bytes[ 4 ], lp->hash_bytes[ 5 ],
- lp->hash_bytes[ 6 ], lp->hash_bytes[ 7 ]
- );
-#endif
-
- if(lp->lan_type==HP100_LAN_100)
- {
+ printk("hp100: %s: multicast hash = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
+ dev->name, lp->hash_bytes[0],
+ lp->hash_bytes[1], lp->hash_bytes[2],
+ lp->hash_bytes[3], lp->hash_bytes[4],
+ lp->hash_bytes[5], lp->hash_bytes[6],
+ lp->hash_bytes[7]);
+#endif
+
+ if (lp->lan_type == HP100_LAN_100) {
#ifdef HP100_DEBUG
- printk("hp100: %s: 100VG MAC settings have changed - relogin.\n", dev->name);
-#endif
- lp->hub_status=hp100_login_to_vg_hub( dev, TRUE ); /* force a relogin to the hub */
- }
- }
- }
-
- hp100_page( MAC_CTRL );
- hp100_orb( HP100_RX_EN | HP100_RX_IDLE | /* enable rx */
- HP100_TX_EN | HP100_TX_IDLE, MAC_CFG_1 ); /* enable tx */
-
- hp100_page( PERFORMANCE );
- hp100_ints_on();
- spin_unlock_irqrestore (&lp->lock, flags);
+ printk("hp100: %s: 100VG MAC settings have changed - relogin.\n", dev->name);
+#endif
+ lp->hub_status = hp100_login_to_vg_hub(dev, TRUE); /* force a relogin to the hub */
+ }
+ }
+ }
+
+ hp100_page(MAC_CTRL);
+ hp100_orb(HP100_RX_EN | HP100_RX_IDLE | /* enable rx */
+ HP100_TX_EN | HP100_TX_IDLE, MAC_CFG_1); /* enable tx */
+
+ hp100_page(PERFORMANCE);
+ hp100_ints_on();
+ spin_unlock_irqrestore(&lp->lock, flags);
}
-
/*
* hardware interrupt handling
*/
-static void hp100_interrupt( int irq, void *dev_id, struct pt_regs *regs )
+static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- struct net_device *dev = (struct net_device *)dev_id;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ struct net_device *dev = (struct net_device *) dev_id;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
- int ioaddr;
- u_int val;
+ int ioaddr;
+ u_int val;
- if ( dev == NULL ) return;
- ioaddr = dev->base_addr;
-
- spin_lock (&lp->lock);
+ if (dev == NULL)
+ return;
+ ioaddr = dev->base_addr;
- hp100_ints_off();
+ spin_lock(&lp->lock);
+
+ hp100_ints_off();
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4219, TRACE );
+ hp100_outw(0x4219, TRACE);
#endif
- /* hp100_page( PERFORMANCE ); */
- val = hp100_inw( IRQ_STATUS );
+ /* hp100_page( PERFORMANCE ); */
+ val = hp100_inw(IRQ_STATUS);
#ifdef HP100_DEBUG_IRQ
- printk( "hp100: %s: mode=%x,IRQ_STAT=0x%.4x,RXPKTCNT=0x%.2x RXPDL=0x%.2x TXPKTCNT=0x%.2x TXPDL=0x%.2x\n",
- dev->name,
- lp->mode,
- (u_int)val,
- hp100_inb( RX_PKT_CNT ),
- hp100_inb( RX_PDL ),
- hp100_inb( TX_PKT_CNT ),
- hp100_inb( TX_PDL )
- );
-#endif
-
- if(val==0) /* might be a shared interrupt */
- {
- spin_unlock (&lp->lock);
- hp100_ints_on();
- return;
- }
- /* We're only interested in those interrupts we really enabled. */
- /* val &= hp100_inw( IRQ_MASK ); */
-
- /*
- * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL
- * is considered executed whenever the RX_PDL data structure is no longer
- * needed.
- */
- if ( val & HP100_RX_PDL_FILL_COMPL )
- {
- if(lp->mode==1)
- hp100_rx_bm( dev );
- else
- {
- printk("hp100: %s: rx_pdl_fill_compl interrupt although not busmaster?\n", dev->name);
+ printk("hp100: %s: mode=%x,IRQ_STAT=0x%.4x,RXPKTCNT=0x%.2x RXPDL=0x%.2x TXPKTCNT=0x%.2x TXPDL=0x%.2x\n",
+ dev->name, lp->mode, (u_int) val, hp100_inb(RX_PKT_CNT),
+ hp100_inb(RX_PDL), hp100_inb(TX_PKT_CNT), hp100_inb(TX_PDL));
+#endif
+
+ if (val == 0) { /* might be a shared interrupt */
+ spin_unlock(&lp->lock);
+ hp100_ints_on();
+ return;
+ }
+ /* We're only interested in those interrupts we really enabled. */
+ /* val &= hp100_inw( IRQ_MASK ); */
+
+ /*
+ * RX_PDL_FILL_COMPL is set whenever a RX_PDL has been executed. A RX_PDL
+ * is considered executed whenever the RX_PDL data structure is no longer
+ * needed.
+ */
+ if (val & HP100_RX_PDL_FILL_COMPL) {
+ if (lp->mode == 1)
+ hp100_rx_bm(dev);
+ else {
+ printk("hp100: %s: rx_pdl_fill_compl interrupt although not busmaster?\n", dev->name);
+ }
}
- }
-
- /*
- * The RX_PACKET interrupt is set, when the receive packet counter is
- * non zero. We use this interrupt for receiving in slave mode. In
- * busmaster mode, we use it to make sure we did not miss any rx_pdl_fill
- * interrupts. If rx_pdl_fill_compl is not set and rx_packet is set, then
- * we somehow have missed a rx_pdl_fill_compl interrupt.
- */
-
- if ( val & HP100_RX_PACKET ) /* Receive Packet Counter is non zero */
- {
- if(lp->mode!=1) /* non busmaster */
- hp100_rx( dev );
- else if ( !(val & HP100_RX_PDL_FILL_COMPL ))
- {
- /* Shouldnt happen - maybe we missed a RX_PDL_FILL Interrupt? */
- hp100_rx_bm( dev );
+
+ /*
+ * The RX_PACKET interrupt is set, when the receive packet counter is
+ * non zero. We use this interrupt for receiving in slave mode. In
+ * busmaster mode, we use it to make sure we did not miss any rx_pdl_fill
+ * interrupts. If rx_pdl_fill_compl is not set and rx_packet is set, then
+ * we somehow have missed a rx_pdl_fill_compl interrupt.
+ */
+
+ if (val & HP100_RX_PACKET) { /* Receive Packet Counter is non zero */
+ if (lp->mode != 1) /* non busmaster */
+ hp100_rx(dev);
+ else if (!(val & HP100_RX_PDL_FILL_COMPL)) {
+ /* Shouldnt happen - maybe we missed a RX_PDL_FILL Interrupt? */
+ hp100_rx_bm(dev);
+ }
}
- }
-
- /*
- * Ack. that we have noticed the interrupt and thereby allow next one.
- * Note that this is now done after the slave rx function, since first
- * acknowledging and then setting ADV_NXT_PKT caused an extra interrupt
- * on the J2573.
- */
- hp100_outw( val, IRQ_STATUS );
-
- /*
- * RX_ERROR is set when a packet is dropped due to no memory resources on
- * the card or when a RCV_ERR occurs.
- * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists
- * only in the 802.3 MAC and happens when 16 collisions occur during a TX
- */
- if ( val & ( HP100_TX_ERROR | HP100_RX_ERROR ) )
- {
+
+ /*
+ * Ack. that we have noticed the interrupt and thereby allow next one.
+ * Note that this is now done after the slave rx function, since first
+ * acknowledging and then setting ADV_NXT_PKT caused an extra interrupt
+ * on the J2573.
+ */
+ hp100_outw(val, IRQ_STATUS);
+
+ /*
+ * RX_ERROR is set when a packet is dropped due to no memory resources on
+ * the card or when a RCV_ERR occurs.
+ * TX_ERROR is set when a TX_ABORT condition occurs in the MAC->exists
+ * only in the 802.3 MAC and happens when 16 collisions occur during a TX
+ */
+ if (val & (HP100_TX_ERROR | HP100_RX_ERROR)) {
#ifdef HP100_DEBUG_IRQ
- printk("hp100: %s: TX/RX Error IRQ\n", dev->name);
+ printk("hp100: %s: TX/RX Error IRQ\n", dev->name);
#endif
- hp100_update_stats( dev );
- if(lp->mode==1)
- {
- hp100_rxfill( dev );
- hp100_clean_txring( dev );
+ hp100_update_stats(dev);
+ if (lp->mode == 1) {
+ hp100_rxfill(dev);
+ hp100_clean_txring(dev);
+ }
}
- }
-
- /*
- * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero.
- */
- if ( (lp->mode==1)&&(val &(HP100_RX_PDA_ZERO)) )
- hp100_rxfill( dev );
-
- /*
- * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire
- * is completed
- */
- if ( (lp->mode==1) && ( val & ( HP100_TX_COMPLETE )) )
- hp100_clean_txring( dev );
-
- /*
- * MISC_ERROR is set when either the LAN link goes down or a detected
- * bus error occurs.
- */
- if ( val & HP100_MISC_ERROR ) /* New for J2585B */
- {
+
+ /*
+ * RX_PDA_ZERO is set when the PDA count goes from non-zero to zero.
+ */
+ if ((lp->mode == 1) && (val & (HP100_RX_PDA_ZERO)))
+ hp100_rxfill(dev);
+
+ /*
+ * HP100_TX_COMPLETE interrupt occurs when packet transmitted on wire
+ * is completed
+ */
+ if ((lp->mode == 1) && (val & (HP100_TX_COMPLETE)))
+ hp100_clean_txring(dev);
+
+ /*
+ * MISC_ERROR is set when either the LAN link goes down or a detected
+ * bus error occurs.
+ */
+ if (val & HP100_MISC_ERROR) { /* New for J2585B */
#ifdef HP100_DEBUG_IRQ
- printk("hp100: %s: Misc. Error Interrupt - Check cabling.\n", dev->name);
+ printk
+ ("hp100: %s: Misc. Error Interrupt - Check cabling.\n",
+ dev->name);
#endif
- if(lp->mode==1)
- {
- hp100_clean_txring( dev );
- hp100_rxfill( dev );
+ if (lp->mode == 1) {
+ hp100_clean_txring(dev);
+ hp100_rxfill(dev);
+ }
+ hp100_misc_interrupt(dev);
}
- hp100_misc_interrupt( dev );
- }
- spin_unlock (&lp->lock);
- hp100_ints_on();
+ spin_unlock(&lp->lock);
+ hp100_ints_on();
}
-
/*
* some misc functions
*/
-static void hp100_start_interface( struct net_device *dev )
+static void hp100_start_interface(struct net_device *dev)
{
- unsigned long flags;
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ unsigned long flags;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4220, TRACE );
- printk("hp100: %s: hp100_start_interface\n",dev->name);
-#endif
-
- spin_lock_irqsave (&lp->lock, flags);
-
- /* Ensure the adapter does not want to request an interrupt when */
- /* enabling the IRQ line to be active on the bus (i.e. not tri-stated) */
- hp100_page( PERFORMANCE );
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* ack all IRQs */
- hp100_outw( HP100_FAKE_INT|HP100_INT_EN|HP100_RESET_LB, OPTION_LSW);
- /* Un Tri-state int. TODO: Check if shared interrupts can be realised? */
- hp100_outw( HP100_TRI_INT | HP100_RESET_HB, OPTION_LSW );
-
- if(lp->mode==1)
- {
- /* Make sure BM bit is set... */
- hp100_page(HW_MAP);
- hp100_orb( HP100_BM_MASTER, BM );
- hp100_rxfill( dev );
- }
- else if(lp->mode==2)
- {
- /* Enable memory mapping. Note: Don't do this when busmaster. */
- hp100_outw( HP100_MMAP_DIS | HP100_RESET_HB, OPTION_LSW );
- }
-
- hp100_page(PERFORMANCE);
- hp100_outw( 0xfefe, IRQ_MASK ); /* mask off all ints */
- hp100_outw( 0xffff, IRQ_STATUS ); /* ack IRQ */
-
- /* enable a few interrupts: */
- if(lp->mode==1) /* busmaster mode */
- {
- hp100_outw( HP100_RX_PDL_FILL_COMPL |
- HP100_RX_PDA_ZERO |
- HP100_RX_ERROR |
- /* HP100_RX_PACKET | */
- /* HP100_RX_EARLY_INT | */ HP100_SET_HB |
- /* HP100_TX_PDA_ZERO | */
- HP100_TX_COMPLETE |
- /* HP100_MISC_ERROR | */
- HP100_TX_ERROR | HP100_SET_LB, IRQ_MASK );
- }
- else
- {
- hp100_outw( HP100_RX_PACKET |
- HP100_RX_ERROR | HP100_SET_HB |
- HP100_TX_ERROR | HP100_SET_LB , IRQ_MASK );
- }
-
- /* Note : before hp100_set_multicast_list(), because it will play with
- * spinlock itself... Jean II */
- spin_unlock_irqrestore (&lp->lock, flags);
+ hp100_outw(0x4220, TRACE);
+ printk("hp100: %s: hp100_start_interface\n", dev->name);
+#endif
+
+ spin_lock_irqsave(&lp->lock, flags);
+
+ /* Ensure the adapter does not want to request an interrupt when */
+ /* enabling the IRQ line to be active on the bus (i.e. not tri-stated) */
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all ints */
+ hp100_outw(0xffff, IRQ_STATUS); /* ack all IRQs */
+ hp100_outw(HP100_FAKE_INT | HP100_INT_EN | HP100_RESET_LB,
+ OPTION_LSW);
+ /* Un Tri-state int. TODO: Check if shared interrupts can be realised? */
+ hp100_outw(HP100_TRI_INT | HP100_RESET_HB, OPTION_LSW);
+
+ if (lp->mode == 1) {
+ /* Make sure BM bit is set... */
+ hp100_page(HW_MAP);
+ hp100_orb(HP100_BM_MASTER, BM);
+ hp100_rxfill(dev);
+ } else if (lp->mode == 2) {
+ /* Enable memory mapping. Note: Don't do this when busmaster. */
+ hp100_outw(HP100_MMAP_DIS | HP100_RESET_HB, OPTION_LSW);
+ }
+
+ hp100_page(PERFORMANCE);
+ hp100_outw(0xfefe, IRQ_MASK); /* mask off all ints */
+ hp100_outw(0xffff, IRQ_STATUS); /* ack IRQ */
+
+ /* enable a few interrupts: */
+ if (lp->mode == 1) { /* busmaster mode */
+ hp100_outw(HP100_RX_PDL_FILL_COMPL |
+ HP100_RX_PDA_ZERO | HP100_RX_ERROR |
+ /* HP100_RX_PACKET | */
+ /* HP100_RX_EARLY_INT | */ HP100_SET_HB |
+ /* HP100_TX_PDA_ZERO | */
+ HP100_TX_COMPLETE |
+ /* HP100_MISC_ERROR | */
+ HP100_TX_ERROR | HP100_SET_LB, IRQ_MASK);
+ } else {
+ hp100_outw(HP100_RX_PACKET |
+ HP100_RX_ERROR | HP100_SET_HB |
+ HP100_TX_ERROR | HP100_SET_LB, IRQ_MASK);
+ }
- /* Enable MAC Tx and RX, set MAC modes, ... */
- hp100_set_multicast_list( dev );
+ /* Note : before hp100_set_multicast_list(), because it will play with
+ * spinlock itself... Jean II */
+ spin_unlock_irqrestore(&lp->lock, flags);
+
+ /* Enable MAC Tx and RX, set MAC modes, ... */
+ hp100_set_multicast_list(dev);
}
-
-static void hp100_stop_interface( struct net_device *dev )
+static void hp100_stop_interface(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- int ioaddr = dev->base_addr;
- u_int val;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ int ioaddr = dev->base_addr;
+ u_int val;
#ifdef HP100_DEBUG_B
- printk("hp100: %s: hp100_stop_interface\n",dev->name);
- hp100_outw( 0x4221, TRACE );
-#endif
-
- if (lp->mode==1)
- hp100_BM_shutdown( dev );
- else
- {
- /* Note: MMAP_DIS will be reenabled by start_interface */
- hp100_outw( HP100_INT_EN | HP100_RESET_LB |
- HP100_TRI_INT | HP100_MMAP_DIS | HP100_SET_HB, OPTION_LSW );
- val = hp100_inw( OPTION_LSW );
-
- hp100_page( MAC_CTRL );
- hp100_andb( ~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1 );
-
- if ( !(val & HP100_HW_RST) ) return; /* If reset, imm. return ... */
- /* ... else: busy wait until idle */
- for ( val = 0; val < 6000; val++ )
- if ( ( hp100_inb( MAC_CFG_1 ) & (HP100_TX_IDLE | HP100_RX_IDLE) ) ==
- (HP100_TX_IDLE | HP100_RX_IDLE) )
- {
- hp100_page(PERFORMANCE);
- return;
- }
- printk( "hp100: %s: hp100_stop_interface - timeout\n", dev->name );
- hp100_page(PERFORMANCE);
- }
+ printk("hp100: %s: hp100_stop_interface\n", dev->name);
+ hp100_outw(0x4221, TRACE);
+#endif
+
+ if (lp->mode == 1)
+ hp100_BM_shutdown(dev);
+ else {
+ /* Note: MMAP_DIS will be reenabled by start_interface */
+ hp100_outw(HP100_INT_EN | HP100_RESET_LB |
+ HP100_TRI_INT | HP100_MMAP_DIS | HP100_SET_HB,
+ OPTION_LSW);
+ val = hp100_inw(OPTION_LSW);
+
+ hp100_page(MAC_CTRL);
+ hp100_andb(~(HP100_RX_EN | HP100_TX_EN), MAC_CFG_1);
+
+ if (!(val & HP100_HW_RST))
+ return; /* If reset, imm. return ... */
+ /* ... else: busy wait until idle */
+ for (val = 0; val < 6000; val++)
+ if ((hp100_inb(MAC_CFG_1) & (HP100_TX_IDLE | HP100_RX_IDLE)) == (HP100_TX_IDLE | HP100_RX_IDLE)) {
+ hp100_page(PERFORMANCE);
+ return;
+ }
+ printk("hp100: %s: hp100_stop_interface - timeout\n", dev->name);
+ hp100_page(PERFORMANCE);
+ }
}
-
-static void hp100_load_eeprom( struct net_device *dev, u_short probe_ioaddr )
+static void hp100_load_eeprom(struct net_device *dev, u_short probe_ioaddr)
{
- int i;
- int ioaddr = probe_ioaddr > 0 ? probe_ioaddr : dev->base_addr;
+ int i;
+ int ioaddr = probe_ioaddr > 0 ? probe_ioaddr : dev->base_addr;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4222, TRACE );
+ hp100_outw(0x4222, TRACE);
#endif
- hp100_page( EEPROM_CTRL );
- hp100_andw( ~HP100_EEPROM_LOAD, EEPROM_CTRL );
- hp100_orw( HP100_EEPROM_LOAD, EEPROM_CTRL );
- for ( i = 0; i < 10000; i++ )
- if ( !( hp100_inb( OPTION_MSW ) & HP100_EE_LOAD ) ) return;
- printk( "hp100: %s: hp100_load_eeprom - timeout\n", dev->name );
+ hp100_page(EEPROM_CTRL);
+ hp100_andw(~HP100_EEPROM_LOAD, EEPROM_CTRL);
+ hp100_orw(HP100_EEPROM_LOAD, EEPROM_CTRL);
+ for (i = 0; i < 10000; i++)
+ if (!(hp100_inb(OPTION_MSW) & HP100_EE_LOAD))
+ return;
+ printk("hp100: %s: hp100_load_eeprom - timeout\n", dev->name);
}
-
/* Sense connection status.
* return values: LAN_10 - Connected to 10Mbit/s network
* LAN_100 - Connected to 100Mbit/s network
* LAN_ERR - not connected or 100Mbit/s Hub down
*/
-static int hp100_sense_lan( struct net_device *dev )
+static int hp100_sense_lan(struct net_device *dev)
{
- int ioaddr = dev->base_addr;
- u_short val_VG, val_10;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
+ int ioaddr = dev->base_addr;
+ u_short val_VG, val_10;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4223, TRACE );
+ hp100_outw(0x4223, TRACE);
#endif
- hp100_page( MAC_CTRL );
- val_10 = hp100_inb( 10_LAN_CFG_1 );
- val_VG = hp100_inb( VG_LAN_CFG_1 );
- hp100_page( PERFORMANCE );
+ hp100_page(MAC_CTRL);
+ val_10 = hp100_inb(10_LAN_CFG_1);
+ val_VG = hp100_inb(VG_LAN_CFG_1);
+ hp100_page(PERFORMANCE);
#ifdef HP100_DEBUG
- printk( "hp100: %s: sense_lan: val_VG = 0x%04x, val_10 = 0x%04x\n", dev->name, val_VG, val_10 );
+ printk("hp100: %s: sense_lan: val_VG = 0x%04x, val_10 = 0x%04x\n",
+ dev->name, val_VG, val_10);
#endif
- if ( val_10 & HP100_LINK_BEAT_ST ) /* 10Mb connection is active */
- return HP100_LAN_10;
+ if (val_10 & HP100_LINK_BEAT_ST) /* 10Mb connection is active */
+ return HP100_LAN_10;
- if ( val_10 & HP100_AUI_ST ) /* have we BNC or AUI onboard? */
- {
- val_10 |= HP100_AUI_SEL | HP100_LOW_TH;
- hp100_page( MAC_CTRL );
- hp100_outb( val_10, 10_LAN_CFG_1 );
- hp100_page( PERFORMANCE );
- return HP100_LAN_10;
- }
+ if (val_10 & HP100_AUI_ST) { /* have we BNC or AUI onboard? */
+ val_10 |= HP100_AUI_SEL | HP100_LOW_TH;
+ hp100_page(MAC_CTRL);
+ hp100_outb(val_10, 10_LAN_CFG_1);
+ hp100_page(PERFORMANCE);
+ return HP100_LAN_10;
+ }
- if ( (lp->id->id == 0x02019F022) ||
- (lp->id->id == 0x01042103c) ||
- (lp->id->id == 0x01040103c) )
- return HP100_LAN_ERR; /* Those cards don't have a 100 Mbit connector */
+ if ((lp->id->id == 0x02019F022) ||
+ (lp->id->id == 0x01042103c) || (lp->id->id == 0x01040103c))
+ return HP100_LAN_ERR; /* Those cards don't have a 100 Mbit connector */
- if ( val_VG & HP100_LINK_CABLE_ST ) /* Can hear the HUBs tone. */
- return HP100_LAN_100;
- return HP100_LAN_ERR;
+ if (val_VG & HP100_LINK_CABLE_ST) /* Can hear the HUBs tone. */
+ return HP100_LAN_100;
+ return HP100_LAN_ERR;
}
-
-
-static int hp100_down_vg_link( struct net_device *dev )
+static int hp100_down_vg_link(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- int ioaddr = dev->base_addr;
- unsigned long time;
- long savelan, newlan;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ int ioaddr = dev->base_addr;
+ unsigned long time;
+ long savelan, newlan;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4224, TRACE );
- printk("hp100: %s: down_vg_link\n", dev->name);
-#endif
-
- hp100_page( MAC_CTRL );
- time=jiffies+(HZ/4);
- do{
- if ( hp100_inb( VG_LAN_CFG_1 ) & HP100_LINK_CABLE_ST ) break;
- } while (time_after(time, jiffies));
+ hp100_outw(0x4224, TRACE);
+ printk("hp100: %s: down_vg_link\n", dev->name);
+#endif
+
+ hp100_page(MAC_CTRL);
+ time = jiffies + (HZ / 4);
+ do {
+ if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST)
+ break;
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
- if ( time_after_eq(jiffies, time) ) /* no signal->no logout */
- return 0;
+ if (time_after_eq(jiffies, time)) /* no signal->no logout */
+ return 0;
- /* Drop the VG Link by clearing the link up cmd and load addr.*/
+ /* Drop the VG Link by clearing the link up cmd and load addr. */
- hp100_andb( ~( HP100_LOAD_ADDR| HP100_LINK_CMD), VG_LAN_CFG_1);
- hp100_orb( HP100_VG_SEL, VG_LAN_CFG_1);
+ hp100_andb(~(HP100_LOAD_ADDR | HP100_LINK_CMD), VG_LAN_CFG_1);
+ hp100_orb(HP100_VG_SEL, VG_LAN_CFG_1);
- /* Conditionally stall for >250ms on Link-Up Status (to go down) */
- time=jiffies+(HZ/2);
- do{
- if ( !(hp100_inb( VG_LAN_CFG_1) & HP100_LINK_UP_ST) ) break;
- } while(time_after(time, jiffies));
+ /* Conditionally stall for >250ms on Link-Up Status (to go down) */
+ time = jiffies + (HZ / 2);
+ do {
+ if (!(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
+ break;
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
#ifdef HP100_DEBUG
- if (time_after_eq(jiffies, time))
- printk("hp100: %s: down_vg_link: Link does not go down?\n", dev->name);
-#endif
-
- /* To prevent condition where Rev 1 VG MAC and old hubs do not complete */
- /* logout under traffic (even though all the status bits are cleared), */
- /* do this workaround to get the Rev 1 MAC in its idle state */
- if ( lp->chip==HP100_CHIPID_LASSEN )
- {
- /* Reset VG MAC to insure it leaves the logoff state even if */
- /* the Hub is still emitting tones */
- hp100_andb(~HP100_VG_RESET, VG_LAN_CFG_1);
- udelay(1500); /* wait for >1ms */
- hp100_orb(HP100_VG_RESET, VG_LAN_CFG_1); /* Release Reset */
- udelay(1500);
- }
-
- /* New: For lassen, switch to 10 Mbps mac briefly to clear training ACK */
- /* to get the VG mac to full reset. This is not req.d with later chips */
- /* Note: It will take the between 1 and 2 seconds for the VG mac to be */
- /* selected again! This will be left to the connect hub function to */
- /* perform if desired. */
- if (lp->chip==HP100_CHIPID_LASSEN)
- {
- /* Have to write to 10 and 100VG control registers simultaneously */
- savelan=newlan=hp100_inl(10_LAN_CFG_1); /* read 10+100 LAN_CFG regs */
- newlan &= ~(HP100_VG_SEL<<16);
- newlan |= (HP100_DOT3_MAC)<<8;
- hp100_andb( ~HP100_AUTO_MODE, MAC_CFG_3); /* Autosel off */
- hp100_outl(newlan, 10_LAN_CFG_1);
-
- /* Conditionally stall for 5sec on VG selected. */
- time=jiffies+(HZ*5);
- do{
- if( !(hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST) ) break;
- } while(time_after(time, jiffies));
-
- hp100_orb( HP100_AUTO_MODE, MAC_CFG_3); /* Autosel back on */
- hp100_outl(savelan, 10_LAN_CFG_1);
- }
-
- time=jiffies+(3*HZ); /* Timeout 3s */
- do {
- if ( (hp100_inb( VG_LAN_CFG_1 )&HP100_LINK_CABLE_ST) == 0) break;
- } while (time_after(time, jiffies));
-
- if(time_before_eq(time, jiffies))
- {
+ if (time_after_eq(jiffies, time))
+ printk("hp100: %s: down_vg_link: Link does not go down?\n", dev->name);
+#endif
+
+ /* To prevent condition where Rev 1 VG MAC and old hubs do not complete */
+ /* logout under traffic (even though all the status bits are cleared), */
+ /* do this workaround to get the Rev 1 MAC in its idle state */
+ if (lp->chip == HP100_CHIPID_LASSEN) {
+ /* Reset VG MAC to insure it leaves the logoff state even if */
+ /* the Hub is still emitting tones */
+ hp100_andb(~HP100_VG_RESET, VG_LAN_CFG_1);
+ udelay(1500); /* wait for >1ms */
+ hp100_orb(HP100_VG_RESET, VG_LAN_CFG_1); /* Release Reset */
+ udelay(1500);
+ }
+
+ /* New: For lassen, switch to 10 Mbps mac briefly to clear training ACK */
+ /* to get the VG mac to full reset. This is not req.d with later chips */
+ /* Note: It will take the between 1 and 2 seconds for the VG mac to be */
+ /* selected again! This will be left to the connect hub function to */
+ /* perform if desired. */
+ if (lp->chip == HP100_CHIPID_LASSEN) {
+ /* Have to write to 10 and 100VG control registers simultaneously */
+ savelan = newlan = hp100_inl(10_LAN_CFG_1); /* read 10+100 LAN_CFG regs */
+ newlan &= ~(HP100_VG_SEL << 16);
+ newlan |= (HP100_DOT3_MAC) << 8;
+ hp100_andb(~HP100_AUTO_MODE, MAC_CFG_3); /* Autosel off */
+ hp100_outl(newlan, 10_LAN_CFG_1);
+
+ /* Conditionally stall for 5sec on VG selected. */
+ time = jiffies + (HZ * 5);
+ do {
+ if (!(hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST))
+ break;
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
+
+ hp100_orb(HP100_AUTO_MODE, MAC_CFG_3); /* Autosel back on */
+ hp100_outl(savelan, 10_LAN_CFG_1);
+ }
+
+ time = jiffies + (3 * HZ); /* Timeout 3s */
+ do {
+ if ((hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST) == 0)
+ break;
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
+
+ if (time_before_eq(time, jiffies)) {
#ifdef HP100_DEBUG
- printk( "hp100: %s: down_vg_link: timeout\n", dev->name );
-#endif
- return -EIO;
- }
-
- time=jiffies+(2*HZ); /* This seems to take a while.... */
- do {} while (time_after(time, jiffies));
-
- return 0;
+ printk("hp100: %s: down_vg_link: timeout\n", dev->name);
+#endif
+ return -EIO;
+ }
+
+ time = jiffies + (2 * HZ); /* This seems to take a while.... */
+ do {
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
+
+ return 0;
}
-
-static int hp100_login_to_vg_hub( struct net_device *dev, u_short force_relogin )
+static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- u_short val=0;
- unsigned long time;
- int startst;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ u_short val = 0;
+ unsigned long time;
+ int startst;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4225, TRACE );
- printk("hp100: %s: login_to_vg_hub\n", dev->name);
-#endif
-
- /* Initiate a login sequence iff VG MAC is enabled and either Load Address
- * bit is zero or the force relogin flag is set (e.g. due to MAC address or
- * promiscuous mode change)
- */
- hp100_page( MAC_CTRL );
- startst=hp100_inb( VG_LAN_CFG_1 );
- if((force_relogin==TRUE)||(hp100_inb( MAC_CFG_4 )&HP100_MAC_SEL_ST))
- {
-#ifdef HP100_DEBUG_TRAINING
- printk("hp100: %s: Start training\n", dev->name);
+ hp100_outw(0x4225, TRACE);
+ printk("hp100: %s: login_to_vg_hub\n", dev->name);
#endif
- /* Ensure VG Reset bit is 1 (i.e., do not reset)*/
- hp100_orb( HP100_VG_RESET , VG_LAN_CFG_1 );
-
- /* If Lassen AND auto-select-mode AND VG tones were sensed on */
- /* entry then temporarily put them into force 100Mbit mode */
- if((lp->chip==HP100_CHIPID_LASSEN)&&( startst & HP100_LINK_CABLE_ST ) )
- hp100_andb( ~HP100_DOT3_MAC, 10_LAN_CFG_2 );
-
- /* Drop the VG link by zeroing Link Up Command and Load Address */
- hp100_andb( ~(HP100_LINK_CMD/* |HP100_LOAD_ADDR */), VG_LAN_CFG_1);
-
+ /* Initiate a login sequence iff VG MAC is enabled and either Load Address
+ * bit is zero or the force relogin flag is set (e.g. due to MAC address or
+ * promiscuous mode change)
+ */
+ hp100_page(MAC_CTRL);
+ startst = hp100_inb(VG_LAN_CFG_1);
+ if ((force_relogin == TRUE) || (hp100_inb(MAC_CFG_4) & HP100_MAC_SEL_ST)) {
#ifdef HP100_DEBUG_TRAINING
- printk("hp100: %s: Bring down the link\n", dev->name);
+ printk("hp100: %s: Start training\n", dev->name);
#endif
- /* Wait for link to drop */
- time = jiffies + (HZ/10);
- do {
- if (~(hp100_inb( VG_LAN_CFG_1 )& HP100_LINK_UP_ST) ) break;
- } while (time_after(time, jiffies));
+ /* Ensure VG Reset bit is 1 (i.e., do not reset) */
+ hp100_orb(HP100_VG_RESET, VG_LAN_CFG_1);
- /* Start an addressed training and optionally request promiscuous port */
- if ( (dev->flags) & IFF_PROMISC )
- {
- hp100_orb( HP100_PROM_MODE, VG_LAN_CFG_2);
- if(lp->chip==HP100_CHIPID_LASSEN)
- hp100_orw( HP100_MACRQ_PROMSC, TRAIN_REQUEST );
- }
- else
- {
- hp100_andb( ~HP100_PROM_MODE, VG_LAN_CFG_2);
- /* For ETR parts we need to reset the prom. bit in the training
- * register, otherwise promiscious mode won't be disabled.
- */
- if(lp->chip==HP100_CHIPID_LASSEN)
- {
- hp100_andw( ~HP100_MACRQ_PROMSC, TRAIN_REQUEST );
- }
- }
+ /* If Lassen AND auto-select-mode AND VG tones were sensed on */
+ /* entry then temporarily put them into force 100Mbit mode */
+ if ((lp->chip == HP100_CHIPID_LASSEN) && (startst & HP100_LINK_CABLE_ST))
+ hp100_andb(~HP100_DOT3_MAC, 10_LAN_CFG_2);
+
+ /* Drop the VG link by zeroing Link Up Command and Load Address */
+ hp100_andb(~(HP100_LINK_CMD /* |HP100_LOAD_ADDR */ ), VG_LAN_CFG_1);
- /* With ETR parts, frame format request bits can be set. */
- if(lp->chip==HP100_CHIPID_LASSEN)
- hp100_orb( HP100_MACRQ_FRAMEFMT_EITHER, TRAIN_REQUEST);
-
- hp100_orb( HP100_LINK_CMD|HP100_LOAD_ADDR|HP100_VG_RESET, VG_LAN_CFG_1);
-
- /* Note: Next wait could be omitted for Hood and earlier chips under */
- /* certain circumstances */
- /* TODO: check if hood/earlier and skip wait. */
-
- /* Wait for either short timeout for VG tones or long for login */
- /* Wait for the card hardware to signalise link cable status ok... */
- hp100_page( MAC_CTRL );
- time = jiffies + ( 1*HZ ); /* 1 sec timeout for cable st */
- do {
- if ( hp100_inb( VG_LAN_CFG_1 ) & HP100_LINK_CABLE_ST ) break;
- } while ( time_before(jiffies, time) );
-
- if ( time_after_eq(jiffies, time) )
- {
#ifdef HP100_DEBUG_TRAINING
- printk( "hp100: %s: Link cable status not ok? Training aborted.\n", dev->name );
-#endif
- }
- else
- {
+ printk("hp100: %s: Bring down the link\n", dev->name);
+#endif
+
+ /* Wait for link to drop */
+ time = jiffies + (HZ / 10);
+ do {
+ if (~(hp100_inb(VG_LAN_CFG_1) & HP100_LINK_UP_ST))
+ break;
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
+
+ /* Start an addressed training and optionally request promiscuous port */
+ if ((dev->flags) & IFF_PROMISC) {
+ hp100_orb(HP100_PROM_MODE, VG_LAN_CFG_2);
+ if (lp->chip == HP100_CHIPID_LASSEN)
+ hp100_orw(HP100_MACRQ_PROMSC, TRAIN_REQUEST);
+ } else {
+ hp100_andb(~HP100_PROM_MODE, VG_LAN_CFG_2);
+ /* For ETR parts we need to reset the prom. bit in the training
+ * register, otherwise promiscious mode won't be disabled.
+ */
+ if (lp->chip == HP100_CHIPID_LASSEN) {
+ hp100_andw(~HP100_MACRQ_PROMSC, TRAIN_REQUEST);
+ }
+ }
+
+ /* With ETR parts, frame format request bits can be set. */
+ if (lp->chip == HP100_CHIPID_LASSEN)
+ hp100_orb(HP100_MACRQ_FRAMEFMT_EITHER, TRAIN_REQUEST);
+
+ hp100_orb(HP100_LINK_CMD | HP100_LOAD_ADDR | HP100_VG_RESET, VG_LAN_CFG_1);
+
+ /* Note: Next wait could be omitted for Hood and earlier chips under */
+ /* certain circumstances */
+ /* TODO: check if hood/earlier and skip wait. */
+
+ /* Wait for either short timeout for VG tones or long for login */
+ /* Wait for the card hardware to signalise link cable status ok... */
+ hp100_page(MAC_CTRL);
+ time = jiffies + (1 * HZ); /* 1 sec timeout for cable st */
+ do {
+ if (hp100_inb(VG_LAN_CFG_1) & HP100_LINK_CABLE_ST)
+ break;
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_before(jiffies, time));
+
+ if (time_after_eq(jiffies, time)) {
#ifdef HP100_DEBUG_TRAINING
- printk( "hp100: %s: HUB tones detected. Trying to train.\n", dev->name);
+ printk("hp100: %s: Link cable status not ok? Training aborted.\n", dev->name);
#endif
-
- time = jiffies + ( 2*HZ ); /* again a timeout */
- do {
- val = hp100_inb( VG_LAN_CFG_1 );
- if ( (val & ( HP100_LINK_UP_ST )) )
- {
+ } else {
#ifdef HP100_DEBUG_TRAINING
- printk( "hp100: %s: Passed training.\n", dev->name);
+ printk
+ ("hp100: %s: HUB tones detected. Trying to train.\n",
+ dev->name);
#endif
- break;
- }
- } while ( time_after(time, jiffies) );
- }
-
- /* If LINK_UP_ST is set, then we are logged into the hub. */
- if ( time_before_eq(jiffies, time) && (val & HP100_LINK_UP_ST) )
- {
+
+ time = jiffies + (2 * HZ); /* again a timeout */
+ do {
+ val = hp100_inb(VG_LAN_CFG_1);
+ if ((val & (HP100_LINK_UP_ST))) {
#ifdef HP100_DEBUG_TRAINING
- printk( "hp100: %s: Successfully logged into the HUB.\n", dev->name);
- if(lp->chip==HP100_CHIPID_LASSEN)
- {
- val = hp100_inw(TRAIN_ALLOW);
- printk( "hp100: %s: Card supports 100VG MAC Version \"%s\" ",
- dev->name,(hp100_inw(TRAIN_REQUEST)&HP100_CARD_MACVER) ? "802.12" : "Pre");
- printk( "Driver will use MAC Version \"%s\"\n",
- ( val & HP100_HUB_MACVER) ? "802.12" : "Pre" );
- printk( "hp100: %s: Frame format is %s.\n",dev->name,(val&HP100_MALLOW_FRAMEFMT)?"802.5":"802.3");
- }
-#endif
- }
- else
- {
- /* If LINK_UP_ST is not set, login was not successful */
- printk("hp100: %s: Problem logging into the HUB.\n",dev->name);
- if(lp->chip==HP100_CHIPID_LASSEN)
- {
- /* Check allowed Register to find out why there is a problem. */
- val = hp100_inw( TRAIN_ALLOW ); /* wont work on non-ETR card */
+ printk("hp100: %s: Passed training.\n", dev->name);
+#endif
+ break;
+ }
+ if (!in_interrupt()) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(1);
+ }
+ } while (time_after(time, jiffies));
+ }
+
+ /* If LINK_UP_ST is set, then we are logged into the hub. */
+ if (time_before_eq(jiffies, time) && (val & HP100_LINK_UP_ST)) {
+#ifdef HP100_DEBUG_TRAINING
+ printk("hp100: %s: Successfully logged into the HUB.\n", dev->name);
+ if (lp->chip == HP100_CHIPID_LASSEN) {
+ val = hp100_inw(TRAIN_ALLOW);
+ printk("hp100: %s: Card supports 100VG MAC Version \"%s\" ",
+ dev->name, (hp100_inw(TRAIN_REQUEST) & HP100_CARD_MACVER) ? "802.12" : "Pre");
+ printk("Driver will use MAC Version \"%s\"\n", (val & HP100_HUB_MACVER) ? "802.12" : "Pre");
+ printk("hp100: %s: Frame format is %s.\n", dev->name, (val & HP100_MALLOW_FRAMEFMT) ? "802.5" : "802.3");
+ }
+#endif
+ } else {
+ /* If LINK_UP_ST is not set, login was not successful */
+ printk("hp100: %s: Problem logging into the HUB.\n", dev->name);
+ if (lp->chip == HP100_CHIPID_LASSEN) {
+ /* Check allowed Register to find out why there is a problem. */
+ val = hp100_inw(TRAIN_ALLOW); /* wont work on non-ETR card */
#ifdef HP100_DEBUG_TRAINING
- printk("hp100: %s: MAC Configuration requested: 0x%04x, HUB allowed: 0x%04x\n", dev->name, hp100_inw(TRAIN_REQUEST), val);
-#endif
- if ( val & HP100_MALLOW_ACCDENIED )
- printk("hp100: %s: HUB access denied.\n", dev->name);
- if ( val & HP100_MALLOW_CONFIGURE )
- printk("hp100: %s: MAC Configuration is incompatible with the Network.\n", dev->name);
- if ( val & HP100_MALLOW_DUPADDR )
- printk("hp100: %s: Duplicate MAC Address on the Network.\n", dev->name);
- }
- }
-
- /* If we have put the chip into forced 100 Mbit mode earlier, go back */
- /* to auto-select mode */
-
- if( (lp->chip==HP100_CHIPID_LASSEN)&&(startst & HP100_LINK_CABLE_ST) )
- {
- hp100_page( MAC_CTRL );
- hp100_orb( HP100_DOT3_MAC, 10_LAN_CFG_2 );
- }
-
- val=hp100_inb(VG_LAN_CFG_1);
-
- /* Clear the MISC_ERROR Interrupt, which might be generated when doing the relogin */
- hp100_page(PERFORMANCE);
- hp100_outw( HP100_MISC_ERROR, IRQ_STATUS);
-
- if (val&HP100_LINK_UP_ST)
- return(0); /* login was ok */
- else
- {
- printk("hp100: %s: Training failed.\n", dev->name);
- hp100_down_vg_link( dev );
- return -EIO;
- }
- }
- /* no forced relogin & already link there->no training. */
- return -EIO;
+ printk("hp100: %s: MAC Configuration requested: 0x%04x, HUB allowed: 0x%04x\n", dev->name, hp100_inw(TRAIN_REQUEST), val);
+#endif
+ if (val & HP100_MALLOW_ACCDENIED)
+ printk("hp100: %s: HUB access denied.\n", dev->name);
+ if (val & HP100_MALLOW_CONFIGURE)
+ printk("hp100: %s: MAC Configuration is incompatible with the Network.\n", dev->name);
+ if (val & HP100_MALLOW_DUPADDR)
+ printk("hp100: %s: Duplicate MAC Address on the Network.\n", dev->name);
+ }
+ }
+
+ /* If we have put the chip into forced 100 Mbit mode earlier, go back */
+ /* to auto-select mode */
+
+ if ((lp->chip == HP100_CHIPID_LASSEN) && (startst & HP100_LINK_CABLE_ST)) {
+ hp100_page(MAC_CTRL);
+ hp100_orb(HP100_DOT3_MAC, 10_LAN_CFG_2);
+ }
+
+ val = hp100_inb(VG_LAN_CFG_1);
+
+ /* Clear the MISC_ERROR Interrupt, which might be generated when doing the relogin */
+ hp100_page(PERFORMANCE);
+ hp100_outw(HP100_MISC_ERROR, IRQ_STATUS);
+
+ if (val & HP100_LINK_UP_ST)
+ return (0); /* login was ok */
+ else {
+ printk("hp100: %s: Training failed.\n", dev->name);
+ hp100_down_vg_link(dev);
+ return -EIO;
+ }
+ }
+ /* no forced relogin & already link there->no training. */
+ return -EIO;
}
-
-static void hp100_cascade_reset( struct net_device *dev, u_short enable )
+static void hp100_cascade_reset(struct net_device *dev, u_short enable)
{
- int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *)dev->priv;
- int i;
+ int ioaddr = dev->base_addr;
+ struct hp100_private *lp = (struct hp100_private *) dev->priv;
#ifdef HP100_DEBUG_B
- hp100_outw( 0x4226, TRACE );
- printk("hp100: %s: cascade_reset\n", dev->name);
-#endif
-
- if (enable==TRUE)
- {
- hp100_outw( HP100_HW_RST | HP100_RESET_LB, OPTION_LSW );
- if(lp->chip==HP100_CHIPID_LASSEN)
- {
- /* Lassen requires a PCI transmit fifo reset */
- hp100_page( HW_MAP );
- hp100_andb( ~HP100_PCI_RESET, PCICTRL2 );
- hp100_orb( HP100_PCI_RESET, PCICTRL2 );
- /* Wait for min. 300 ns */
- /* we cant use jiffies here, because it may be */
- /* that we have disabled the timer... */
- for (i=0; i<0xffff; i++);
- hp100_andb( ~HP100_PCI_RESET, PCICTRL2 );
- hp100_page( PERFORMANCE );
- }
- }
- else
- { /* bring out of reset */
- hp100_outw(HP100_HW_RST|HP100_SET_LB, OPTION_LSW);
- for (i=0; i<0xffff; i++ );
- hp100_page(PERFORMANCE);
- }
+ hp100_outw(0x4226, TRACE);
+ printk("hp100: %s: cascade_reset\n", dev->name);
+#endif
+
+ if (enable == TRUE) {
+ hp100_outw(HP100_HW_RST | HP100_RESET_LB, OPTION_LSW);
+ if (lp->chip == HP100_CHIPID_LASSEN) {
+ /* Lassen requires a PCI transmit fifo reset */
+ hp100_page(HW_MAP);
+ hp100_andb(~HP100_PCI_RESET, PCICTRL2);
+ hp100_orb(HP100_PCI_RESET, PCICTRL2);
+ /* Wait for min. 300 ns */
+ /* we cant use jiffies here, because it may be */
+ /* that we have disabled the timer... */
+ udelay(400);
+ hp100_andb(~HP100_PCI_RESET, PCICTRL2);
+ hp100_page(PERFORMANCE);
+ }
+ } else { /* bring out of reset */
+ hp100_outw(HP100_HW_RST | HP100_SET_LB, OPTION_LSW);
+ udelay(400);
+ hp100_page(PERFORMANCE);
+ }
}
-#ifdef HP100_DEBUG
-void hp100_RegisterDump( struct net_device *dev )
+#ifdef HP100_DEBUG
+void hp100_RegisterDump(struct net_device *dev)
{
- int ioaddr=dev->base_addr;
- int Page;
- int Register;
-
- /* Dump common registers */
- printk("hp100: %s: Cascade Register Dump\n", dev->name);
- printk("hardware id #1: 0x%.2x\n",hp100_inb(HW_ID));
- printk("hardware id #2/paging: 0x%.2x\n",hp100_inb(PAGING));
- printk("option #1: 0x%.4x\n",hp100_inw(OPTION_LSW));
- printk("option #2: 0x%.4x\n",hp100_inw(OPTION_MSW));
-
- /* Dump paged registers */
- for (Page = 0; Page < 8; Page++)
- {
- /* Dump registers */
- printk("page: 0x%.2x\n",Page);
- outw( Page, ioaddr+0x02);
- for (Register = 0x8; Register < 0x22; Register += 2)
- {
- /* Display Register contents except data port */
- if (((Register != 0x10) && (Register != 0x12)) || (Page > 0))
- {
- printk("0x%.2x = 0x%.4x\n",Register,inw(ioaddr+Register));
- }
+ int ioaddr = dev->base_addr;
+ int Page;
+ int Register;
+
+ /* Dump common registers */
+ printk("hp100: %s: Cascade Register Dump\n", dev->name);
+ printk("hardware id #1: 0x%.2x\n", hp100_inb(HW_ID));
+ printk("hardware id #2/paging: 0x%.2x\n", hp100_inb(PAGING));
+ printk("option #1: 0x%.4x\n", hp100_inw(OPTION_LSW));
+ printk("option #2: 0x%.4x\n", hp100_inw(OPTION_MSW));
+
+ /* Dump paged registers */
+ for (Page = 0; Page < 8; Page++) {
+ /* Dump registers */
+ printk("page: 0x%.2x\n", Page);
+ outw(Page, ioaddr + 0x02);
+ for (Register = 0x8; Register < 0x22; Register += 2) {
+ /* Display Register contents except data port */
+ if (((Register != 0x10) && (Register != 0x12)) || (Page > 0)) {
+ printk("0x%.2x = 0x%.4x\n", Register, inw(ioaddr + Register));
+ }
+ }
}
- }
- hp100_page(PERFORMANCE);
+ hp100_page(PERFORMANCE);
}
#endif
-
/*
* module section
*/
-
+
#ifdef MODULE
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, "
+ "Siegfried \"Frieder\" Loeffler (dg1sek) <floeff@mathematik.uni-stuttgart.de>");
+MODULE_DESCRIPTION("HP CASCADE Architecture Driver for 100VG-AnyLan Network Adapters");
+
+/*
+ * Note: if you have more than five 100vg cards in your pc, feel free to
+ * increase this value
+ */
+
+#define HP100_DEVICES 5
+
+/*
+ * Note: to register three eisa or pci devices, use:
+ * option hp100 hp100_port=0,0,0
+ * to register one card at io 0x280 as eth239, use:
+ * option hp100 hp100_port=0x280 hp100_name=eth239
+ */
+
/* Parameters set by insmod */
-static int hp100_port[5] = { 0, -1, -1, -1, -1 };
-MODULE_PARM(hp100_port, "1-5i");
+static int hp100_port[HP100_DEVICES] = { 0, [1 ... (HP100_DEVICES-1)] = -1 };
+MODULE_PARM(hp100_port, "1-" __MODULE_STRING(HP100_DEVICES) "i");
-/* Allocate 5 string of length IFNAMSIZ, one string for each device */
-static char hp100_name[5][IFNAMSIZ] = { "", "", "", "", "" };
-/* Allow insmod to write those 5 strings individually */
-MODULE_PARM(hp100_name, "1-5c" __MODULE_STRING(IFNAMSIZ));
+/* Allocate HP100_DEVICES strings of length IFNAMSIZ, one string for each device */
+static char hp100_name[HP100_DEVICES][IFNAMSIZ] = { "", "", "", "", "" };
+/* Allow insmod to write those HP100_DEVICES strings individually */
+MODULE_PARM(hp100_name, "1-" __MODULE_STRING(HP100_DEVICES) "c" __MODULE_STRING(IFNAMSIZ));
/* List of devices */
-static struct net_device *hp100_devlist[5];
+static struct net_device *hp100_devlist[HP100_DEVICES];
static void release_dev(int i)
{
struct net_device *d = hp100_devlist[i];
- struct hp100_private *p = (struct hp100_private *)d->priv;
+ struct hp100_private *p = (struct hp100_private *) d->priv;
unregister_netdev(d);
release_region(d->base_addr, HP100_REGION_SIZE);
- if (p->mode == 1) /* busmaster */
- kfree(p->page_vaddr);
+ if (p->mode == 1) /* busmaster */
+ kfree(p->page_vaddr);
if (p->mem_ptr_virt)
iounmap(p->mem_ptr_virt);
kfree(d->priv);
@@ -3049,78 +2917,66 @@ static void release_dev(int i)
hp100_devlist[i] = NULL;
}
-/*
- * Note: if you have more than five 100vg cards in your pc, feel free to
- * increase this value
- */
-
-/*
- * Note: to register three eisa or pci devices, use:
- * option hp100 hp100_port=0,0,0
- * to register one card at io 0x280 as eth239, use:
- * option hp100 hp100_port=0x280 hp100_name=eth239
- */
-
-int init_module( void )
+static int __init hp100_module_init(void)
{
- int i, cards;
-
- if (hp100_port == 0 && !EISA_bus && !pcibios_present())
- printk("hp100: You should not use auto-probing with insmod!\n");
-
- /* Loop on all possible base addresses */
- i = -1; cards = 0;
- while((hp100_port[++i] != -1) && (i < 5))
- {
- /* Create device and set basics args */
- hp100_devlist[i] = kmalloc(sizeof(struct net_device), GFP_KERNEL);
- if (!hp100_devlist[i])
- goto fail;
- memset(hp100_devlist[i], 0x00, sizeof(struct net_device));
+ int i, cards;
+
+ if (hp100_port == 0 && !EISA_bus && !pcibios_present())
+ printk("hp100: You should not use auto-probing with insmod!\n");
+
+ /* Loop on all possible base addresses */
+ i = -1;
+ cards = 0;
+ while ((hp100_port[++i] != -1) && (i < HP100_DEVICES)) {
+ /* Create device and set basics args */
+ hp100_devlist[i] = kmalloc(sizeof(struct net_device), GFP_KERNEL);
+ if (!hp100_devlist[i])
+ goto fail;
+ memset(hp100_devlist[i], 0x00, sizeof(struct net_device));
#if LINUX_VERSION_CODE >= 0x020362 /* 2.3.99-pre7 */
- memcpy(hp100_devlist[i]->name, hp100_name[i], IFNAMSIZ); /* Copy name */
+ memcpy(hp100_devlist[i]->name, hp100_name[i], IFNAMSIZ); /* Copy name */
#else
- hp100_devlist[i]->name = hp100_name[i];
-#endif /* LINUX_VERSION_CODE >= 0x020362 */
- hp100_devlist[i]->base_addr = hp100_port[i];
- hp100_devlist[i]->init = &hp100_probe;
-
- /* Try to create the device */
- if(register_netdev(hp100_devlist[i]) != 0)
- {
- /* DeAllocate everything */
- /* Note: if dev->priv is mallocated, there is no way to fail */
- kfree(hp100_devlist[i]);
- hp100_devlist[i] = (struct net_device *) NULL;
- }
- else
- cards++;
- } /* Loop over all devices */
-
- return cards > 0 ? 0 : -ENODEV;
- fail:
- while (cards && --i)
- if (hp100_devlist[i]) {
- release_dev(i);
- --cards;
- }
- return -ENOMEM;
+ hp100_devlist[i]->name = hp100_name[i];
+#endif /* LINUX_VERSION_CODE >= 0x020362 */
+ hp100_devlist[i]->base_addr = hp100_port[i];
+ hp100_devlist[i]->init = &hp100_probe;
+
+ /* Try to create the device */
+ if (register_netdev(hp100_devlist[i]) != 0) {
+ /* DeAllocate everything */
+ /* Note: if dev->priv is mallocated, there is no way to fail */
+ kfree(hp100_devlist[i]);
+ hp100_devlist[i] = (struct net_device *) NULL;
+ } else
+ cards++;
+ } /* Loop over all devices */
+
+ return cards > 0 ? 0 : -ENODEV;
+ fail:
+ while (cards && --i)
+ if (hp100_devlist[i]) {
+ release_dev(i);
+ --cards;
+ }
+ return -ENOMEM;
}
-void cleanup_module( void )
+static void __exit hp100_module_exit(void)
{
- int i;
+ int i;
- /* TODO: Check if all skb's are released/freed. */
- for(i = 0; i < 5; i++)
- if(hp100_devlist[i] != (struct net_device *) NULL)
- release_dev(i);
+ /* TODO: Check if all skb's are released/freed. */
+ for (i = 0; i < HP100_DEVICES; i++)
+ if (hp100_devlist[i] != (struct net_device *) NULL)
+ release_dev(i);
}
-#endif /* MODULE */
+module_init(hp100_module_init)
+module_exit(hp100_module_exit)
+
+#endif /* MODULE */
-
/*
* Local variables:
* compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c hp100.c"
diff --git a/drivers/net/irda/actisys.c b/drivers/net/irda/actisys.c
index e7cf517f48d9..cde9f41b2a2a 100644
--- a/drivers/net/irda/actisys.c
+++ b/drivers/net/irda/actisys.c
@@ -272,6 +272,8 @@ static int actisys_reset(struct irda_task *task)
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no> - Jean Tourrilhes <jt@hpl.hp.com>");
MODULE_DESCRIPTION("ACTiSYS IR-220L and IR-220L+ dongle driver");
+MODULE_LICENSE("GPL");
+
/*
* Function init_module (void)
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 3db8ecf8575d..4aaef91ab021 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -2290,6 +2290,8 @@ static void FIR2SIR(int iobase)
#ifdef MODULE
MODULE_AUTHOR("Benjamin Kong <benjamin_kong@ali.com.tw>");
MODULE_DESCRIPTION("ALi FIR Controller Driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(io, "1-4i");
MODULE_PARM_DESC(io, "Base I/O addresses");
diff --git a/drivers/net/irda/esi.c b/drivers/net/irda/esi.c
index 100b0772db13..d39642a8e267 100644
--- a/drivers/net/irda/esi.c
+++ b/drivers/net/irda/esi.c
@@ -136,6 +136,7 @@ static int esi_reset(struct irda_task *task)
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
+MODULE_LICENSE("GPL");
/*
* Function init_module (void)
diff --git a/drivers/net/irda/girbil.c b/drivers/net/irda/girbil.c
index 37d0291c8f43..23e1e4f23c47 100644
--- a/drivers/net/irda/girbil.c
+++ b/drivers/net/irda/girbil.c
@@ -234,6 +234,8 @@ static int girbil_reset(struct irda_task *task)
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
+MODULE_LICENSE("GPL");
+
/*
* Function init_module (void)
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index 3effbc2067ab..53c1c27c4fca 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -1035,6 +1035,8 @@ MODULE_PARM_DESC(irq, "IRQ lines");
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Half duplex serial driver for IrDA SIR mode");
+MODULE_LICENSE("GPL");
+
void cleanup_module(void)
{
diff --git a/drivers/net/irda/irtty.c b/drivers/net/irda/irtty.c
index dce8561435bc..7452310e8119 100644
--- a/drivers/net/irda/irtty.c
+++ b/drivers/net/irda/irtty.c
@@ -1049,6 +1049,8 @@ static struct net_device_stats *irtty_net_get_stats(struct net_device *dev)
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("IrDA TTY device driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(qos_mtt_bits, "i");
MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
diff --git a/drivers/net/irda/litelink.c b/drivers/net/irda/litelink.c
index 7120b5647063..f2c6d85d8361 100644
--- a/drivers/net/irda/litelink.c
+++ b/drivers/net/irda/litelink.c
@@ -166,6 +166,8 @@ static int litelink_reset(struct irda_task *task)
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Parallax Litelink dongle driver");
+MODULE_LICENSE("GPL");
+
/*
* Function init_module (void)
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index a51489955334..308b64bccf02 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -2042,6 +2042,8 @@ static int nsc_ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data)
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("NSC IrDA Device Driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(qos_mtt_bits, "i");
MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time");
diff --git a/drivers/net/irda/old_belkin.c b/drivers/net/irda/old_belkin.c
index dbbaa50a1d69..96a3c781aba0 100644
--- a/drivers/net/irda/old_belkin.c
+++ b/drivers/net/irda/old_belkin.c
@@ -152,6 +152,8 @@ static int old_belkin_reset(struct irda_task *task)
#ifdef MODULE
MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>");
MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver");
+MODULE_LICENSE("GPL");
+
/*
* Function init_module (void)
diff --git a/drivers/net/irda/smc-ircc.c b/drivers/net/irda/smc-ircc.c
index 14b2af4325fa..33c86a4172a8 100644
--- a/drivers/net/irda/smc-ircc.c
+++ b/drivers/net/irda/smc-ircc.c
@@ -99,7 +99,7 @@ static int ircc_pmproc(struct pm_dev *dev, pm_request_t rqst, void *data);
#define SERx4 8 /* SuperIO Chip supports 115,2 KBaud * 4=460,8 KBaud */
/* These are the currently known SMC SuperIO chipsets */
-static const smc_chip_t __init fdc_chips_flat[]=
+static smc_chip_t __initdata fdc_chips_flat[]=
{
/* Base address 0x3f0 or 0x370 */
{ "37C44", KEY55_1|NoIRDA, 0x00, 0x00 }, /* This chip can not detected */
@@ -113,7 +113,7 @@ static const smc_chip_t __init fdc_chips_flat[]=
{ NULL }
};
-static const smc_chip_t __init fdc_chips_paged[]=
+static smc_chip_t __initdata fdc_chips_paged[]=
{
/* Base address 0x3f0 or 0x370 */
{ "37B72X", KEY55_1|SIR|SERx4, 0x4c, 0x00 },
@@ -132,7 +132,7 @@ static const smc_chip_t __init fdc_chips_paged[]=
{ NULL }
};
-static const smc_chip_t __init lpc_chips_flat[]=
+static smc_chip_t __initdata lpc_chips_flat[]=
{
/* Base address 0x2E or 0x4E */
{ "47N227", KEY55_1|FIR|SERx4, 0x5a, 0x00 },
@@ -140,7 +140,7 @@ static const smc_chip_t __init lpc_chips_flat[]=
{ NULL }
};
-static const smc_chip_t __init lpc_chips_paged[]=
+static smc_chip_t __initdata lpc_chips_paged[]=
{
/* Base address 0x2E or 0x4E */
{ "47B27X", KEY55_1|SIR|SERx4, 0x51, 0x00 },
@@ -1219,6 +1219,8 @@ module_exit(smc_cleanup);
MODULE_AUTHOR("Thomas Davis <tadavis@jps.net>");
MODULE_DESCRIPTION("SMC IrCC controller driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(ircc_dma, "1i");
MODULE_PARM_DESC(ircc_dma, "DMA channel");
MODULE_PARM(ircc_irq, "1i");
diff --git a/drivers/net/irda/tekram.c b/drivers/net/irda/tekram.c
index c6aa648c0195..10f53f887350 100644
--- a/drivers/net/irda/tekram.c
+++ b/drivers/net/irda/tekram.c
@@ -267,6 +267,7 @@ int tekram_reset(struct irda_task *task)
#ifdef MODULE
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Tekram IrMate IR-210B dongle driver");
+MODULE_LICENSE("GPL");
/*
* Function init_module (void)
diff --git a/drivers/net/irda/toshoboe.c b/drivers/net/irda/toshoboe.c
index c01376a24905..8e0a750aeca5 100644
--- a/drivers/net/irda/toshoboe.c
+++ b/drivers/net/irda/toshoboe.c
@@ -643,6 +643,8 @@ out:
MODULE_DESCRIPTION("Toshiba OBOE IrDA Device Driver");
MODULE_AUTHOR("James McKenzie <james@fishsoup.dhs.org>");
+MODULE_LICENSE("GPL");
+
MODULE_PARM (max_baud, "i");
MODULE_PARM_DESC(max_baus, "Maximum baud rate");
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 06dcec26009c..3ee231377b4d 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -46,6 +46,8 @@
MODULE_DESCRIPTION("IrDA SIR/MIR/FIR driver for VLSI 82C147");
MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");
+MODULE_LICENSE("GPL");
+
static /* const */ char drivername[] = "vlsi_ir";
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 1c980075f283..52f19ed6b094 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -1378,6 +1378,8 @@ static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev)
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(qos_mtt_bits, "i");
MODULE_PARM_DESC(qos_mtt_bits, "Mimimum Turn Time");
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index 81995bbfadb3..ac7a07cb5ebb 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -347,6 +347,8 @@ void cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/* Starting in v2.1.*, the LANCE/PCnet probe is now similar to the other
board probes now that kmalloc() can allocate ISA DMA-able regions.
diff --git a/drivers/net/lne390.c b/drivers/net/lne390.c
index dbdb691ff37d..b80f239169ac 100644
--- a/drivers/net/lne390.c
+++ b/drivers/net/lne390.c
@@ -384,6 +384,7 @@ MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_LNE_CARDS) "i");
MODULE_PARM_DESC(io, "LNE390 I/O base address(es)");
MODULE_PARM_DESC(irq, "LNE390 IRQ number(s)");
MODULE_PARM_DESC(mem, "LNE390 memory base address(es)");
+MODULE_LICENSE("GPL");
int init_module(void)
{
diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c
index 0255fbeaf4ac..85c5c63d781e 100644
--- a/drivers/net/lp486e.c
+++ b/drivers/net/lp486e.c
@@ -1324,6 +1324,8 @@ static void set_multicast_list(struct net_device *dev) {
MODULE_AUTHOR("Ard van Breemen <ard@cstmel.nl.eu.org>");
MODULE_DESCRIPTION("Intel Panther onboard i82596 driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
//MODULE_PARM(max_interrupt_work, "i");
//MODULE_PARM(reverse_probe, "i");
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index ccd882e9bb04..ec0912034773 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -524,7 +524,7 @@ net_rx(struct net_device *dev)
lp->stats.rx_dropped++;
return;
}
- skb->len = length;
+ skb_put(skb, length);
skb->dev = dev;
memcpy_fromio(skb->data, dev->mem_start + PP_RxFrame, length);
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 71e9f8c956b5..422894612d64 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -171,6 +171,8 @@ KERN_INFO " (unofficial 2.4.x kernel port, version " DRV_VERSION ", " DRV_RELDA
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(mtu, "i");
MODULE_PARM(debug, "i");
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 2d98d16aab74..43b12a6f33aa 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -788,6 +788,8 @@ void cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
* Local variables:
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index dfc29027ce97..0189756a64bb 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -77,6 +77,8 @@ KERN_INFO " http://www.scyld.com/network/ne2k-pci.html\n";
MODULE_AUTHOR("Donald Becker / Paul Gortmaker");
MODULE_DESCRIPTION("PCI NE2000 clone driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c
index bc1e08a1921b..6b408b118cd1 100644
--- a/drivers/net/ne3210.c
+++ b/drivers/net/ne3210.c
@@ -415,5 +415,7 @@ void cleanup_module(void)
}
}
}
+MODULE_LICENSE("GPL");
+
#endif /* MODULE */
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index ed6cd16d2cc8..0974671fcfd3 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -783,6 +783,7 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
/*
* Local variables:
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index f4ad2222b0f9..d222d5480bf8 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -1362,6 +1362,7 @@ void ni52_dump(struct net_device *dev,void *ptr)
printk("\n");
}
#endif
+MODULE_LICENSE("GPL");
/*
* END: linux/drivers/net/ni52.c
diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c
index d568458e5b38..84f5a31ae71d 100644
--- a/drivers/net/ni65.c
+++ b/drivers/net/ni65.c
@@ -1214,6 +1214,7 @@ void cleanup_module(void)
dev_ni65.priv = NULL;
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
/*
* END of ni65.c
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 8f0ebf5a38cc..f0639d32c53a 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1,7 +1,7 @@
-#define VERSION "0.11"
+#define VERSION "0.12"
/* ns83820.c by Benjamin LaHaise <bcrl@redhat.com>
*
- * $Revision: 1.34.2.2 $
+ * $Revision: 1.34.2.8 $
*
* Copyright 2001 Benjamin LaHaise.
* Copyright 2001 Red Hat.
@@ -41,7 +41,9 @@
* 20010827 0.10 - fix ia64 unaligned access.
* 20010906 0.11 - accept all packets with checksum errors as
* otherwise fragments get lost
- - fix >> 32 bugs
+ * - fix >> 32 bugs
+ * 0.12 - add statistics counters
+ * - add allmulti/promisc support
*
* Driver Overview
* ===============
@@ -61,7 +63,9 @@
* Cameo SOHO-GA2000T SOHO-GA2500T
* D-Link DGE-500T
* PureData PDP8023Z-TG
- * SMC SMC9462TX
+ * SMC SMC9452TX SMC9462TX
+ *
+ * Special thanks to SMC for providing hardware to test this driver on.
*
* Reports of success or failure would be greatly appreciated.
*/
@@ -366,6 +370,7 @@ struct rx_info {
struct ns83820 {
struct net_device net_dev;
+ struct net_device_stats stats;
u8 *base;
struct pci_dev *pci_dev;
@@ -732,39 +737,22 @@ static void rx_irq(struct ns83820 *dev)
kfree_skb(skb);
skb = tmp;
#endif
+ if (cmdsts & CMDSTS_DEST_MULTI)
+ dev->stats.multicast ++;
+ dev->stats.rx_packets ++;
+ dev->stats.rx_bytes += len;
if ((extsts & 0x002a0000) && !(extsts & 0x00540000)) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
} else {
skb->ip_summed = CHECKSUM_NONE;
}
skb->protocol = eth_type_trans(skb, &dev->net_dev);
- switch (netif_rx(skb)) {
- case NET_RX_SUCCESS:
- dev->ihr = 3;
- break;
- case NET_RX_CN_LOW:
- dev->ihr = 3;
- break;
- case NET_RX_CN_MOD:
- dev->ihr = dev->ihr + 1;
- break;
- case NET_RX_CN_HIGH:
- dev->ihr += dev->ihr/2 + 1;
- break;
- case NET_RX_DROP:
- dev->ihr = 255;
- break;
- }
- if (dev->ihr > 255)
- dev->ihr = 255;
+ if (NET_RX_DROP == netif_rx(skb))
+ dev->stats.rx_dropped ++;
#ifndef __i386__
done:;
#endif
} else {
- static int err;
- if (err++ < 20) {
- Dprintk("error packet: cmdsts: %08x extsts: %08x\n", cmdsts, extsts);
- }
kfree_skb(skb);
}
@@ -807,6 +795,13 @@ static void do_tx_done(struct ns83820 *dev)
!(CMDSTS_OWN & (cmdsts = desc[CMDSTS])) ) {
struct sk_buff *skb;
+ if (cmdsts & CMDSTS_ERR)
+ dev->stats.tx_errors ++;
+ if (cmdsts & CMDSTS_OK)
+ dev->stats.tx_packets ++;
+ if (cmdsts & CMDSTS_OK)
+ dev->stats.tx_bytes += cmdsts & 0xffff;
+
dprintk("tx_done_idx=%d free_idx=%d cmdsts=%08x\n",
tx_done_idx, dev->tx_free_idx, desc[CMDSTS]);
skb = dev->tx_skbs[tx_done_idx];
@@ -985,6 +980,35 @@ again:
return 0;
}
+static void ns83820_update_stats(struct ns83820 *dev)
+{
+ u8 *base = dev->base;
+
+ dev->stats.rx_errors += readl(base + 0x60) & 0xffff;
+ dev->stats.rx_crc_errors += readl(base + 0x64) & 0xffff;
+ dev->stats.rx_missed_errors += readl(base + 0x68) & 0xffff;
+ dev->stats.rx_frame_errors += readl(base + 0x6c) & 0xffff;
+ /*dev->stats.rx_symbol_errors +=*/ readl(base + 0x70);
+ dev->stats.rx_length_errors += readl(base + 0x74) & 0xffff;
+ dev->stats.rx_length_errors += readl(base + 0x78) & 0xffff;
+ /*dev->stats.rx_badopcode_errors += */ readl(base + 0x7c);
+ /*dev->stats.rx_pause_count += */ readl(base + 0x80);
+ /*dev->stats.tx_pause_count += */ readl(base + 0x84);
+ dev->stats.tx_carrier_errors += readl(base + 0x88) & 0xff;
+}
+
+static struct net_device_stats *ns83820_get_stats(struct net_device *_dev)
+{
+ struct ns83820 *dev = (void *)_dev;
+
+ /* somewhat overkill */
+ spin_lock_irq(&dev->misc_lock);
+ ns83820_update_stats(dev);
+ spin_unlock_irq(&dev->misc_lock);
+
+ return &dev->stats;
+}
+
static void ns83820_irq(int foo, void *data, struct pt_regs *regs)
{
struct ns83820 *dev = data;
@@ -1060,6 +1084,12 @@ static void ns83820_irq(int foo, void *data, struct pt_regs *regs)
if ((ISR_TXDESC | ISR_TXIDLE) & isr)
do_tx_done(dev);
+ if (ISR_MIB & isr) {
+ spin_lock(&dev->misc_lock);
+ ns83820_update_stats(dev);
+ spin_unlock(&dev->misc_lock);
+ }
+
if (ISR_PHY & isr)
phy_intr(dev);
}
@@ -1178,6 +1208,28 @@ static int ns83820_change_mtu(struct net_device *_dev, int new_mtu)
return 0;
}
+static void ns83820_set_multicast(struct net_device *_dev)
+{
+ struct ns83820 *dev = (void *)_dev;
+ u8 *rfcr = dev->base + RFCR;
+ u32 and_mask = 0xffffffff;
+ u32 or_mask = 0;
+
+ if (dev->net_dev.flags & IFF_PROMISC)
+ or_mask |= RFCR_AAU | RFCR_AAM;
+ else
+ and_mask &= ~(RFCR_AAU | RFCR_AAM);
+
+ if (dev->net_dev.flags & IFF_ALLMULTI)
+ or_mask |= RFCR_AAM;
+ else
+ and_mask &= ~RFCR_AAM;
+
+ spin_lock_irq(&dev->misc_lock);
+ writel((readl(rfcr) & and_mask) | or_mask, rfcr);
+ spin_unlock_irq(&dev->misc_lock);
+}
+
static int ns83820_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
{
struct ns83820 *dev;
@@ -1241,6 +1293,9 @@ static int ns83820_probe(struct pci_dev *pci_dev, const struct pci_device_id *id
dev->net_dev.stop = ns83820_stop;
dev->net_dev.hard_start_xmit = ns83820_hard_start_xmit;
dev->net_dev.change_mtu = ns83820_change_mtu;
+ dev->net_dev.get_stats = ns83820_get_stats;
+ dev->net_dev.change_mtu = ns83820_change_mtu;
+ dev->net_dev.set_multicast_list = ns83820_set_multicast;
//FIXME: dev->net_dev.tx_timeout = ns83820_tx_timeout;
lock_kernel();
@@ -1423,6 +1478,9 @@ static void ns83820_exit(void)
MODULE_AUTHOR("Benjamin LaHaise <bcrl@redhat.com>");
MODULE_DESCRIPTION("National Semiconductor DP83820 10/100/1000 driver");
+MODULE_LICENSE("GPL");
+
MODULE_DEVICE_TABLE(pci, pci_device_id);
+
module_init(ns83820_init);
module_exit(ns83820_exit);
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index da91816e379f..d1986a2ccafb 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -1312,6 +1312,7 @@ static void __exit exit_3c574_cs(void)
module_init(init_3c574_cs);
module_exit(exit_3c574_cs);
+MODULE_LICENSE("GPL");
/*
* Local variables:
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index a35f51d2dc0b..1deb93034180 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -1097,3 +1097,4 @@ static void __exit exit_3c589_cs(void)
module_init(init_3c589_cs);
module_exit(exit_3c589_cs);
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/aironet4500_cs.c b/drivers/net/pcmcia/aironet4500_cs.c
index 1dfe16146396..4c26b7f48f37 100644
--- a/drivers/net/pcmcia/aironet4500_cs.c
+++ b/drivers/net/pcmcia/aironet4500_cs.c
@@ -644,4 +644,4 @@ static void __exit aironet_cs_exit(void)
module_init(aironet_cs_init);
module_exit(aironet_cs_exit);
-
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 4c43040868c8..73908f868a7e 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -1257,3 +1257,4 @@ static void set_rx_mode(struct net_device *dev)
}
restore_flags(flags);
}
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index fb4bf2e13aa9..24d20fb7824e 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -107,6 +107,7 @@ MODULE_PARM(mmiobase, "i");
MODULE_PARM(srambase, "i");
MODULE_PARM(sramsize, "i");
MODULE_PARM(ringspeed, "i");
+MODULE_LICENSE("GPL");
/*====================================================================*/
diff --git a/drivers/net/pcmcia/netwave_cs.c b/drivers/net/pcmcia/netwave_cs.c
index 3bf0c6aaf6cf..2c6a50af1d74 100644
--- a/drivers/net/pcmcia/netwave_cs.c
+++ b/drivers/net/pcmcia/netwave_cs.c
@@ -1590,3 +1590,4 @@ static void set_multicast_list(struct net_device *dev)
writeb(rcvMode, ramBase + NETWAVE_EREG_CB + 1);
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
}
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 239dc0239608..62a62bc50036 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -409,6 +409,8 @@ static int irq_list[4] = { -1 };
MODULE_PARM(if_port, "i");
MODULE_PARM(irq_mask, "i");
MODULE_PARM(irq_list, "1-4i");
+MODULE_LICENSE("GPL");
+
/* ----------------------------------------------------------------------------
Function Prototypes
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 484e08384a43..e22fa262d5ed 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1522,3 +1522,4 @@ static void __exit exit_pcnet_cs(void)
module_init(init_pcnet_cs);
module_exit(exit_pcnet_cs);
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/ray_cs.c b/drivers/net/pcmcia/ray_cs.c
index 3655a3fc2356..f39af0ea8b52 100644
--- a/drivers/net/pcmcia/ray_cs.c
+++ b/drivers/net/pcmcia/ray_cs.c
@@ -221,6 +221,8 @@ static unsigned int ray_mem_speed = 500;
MODULE_AUTHOR("Corey Thomas <corey@world.std.com>");
MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(irq_mask,"i");
MODULE_PARM(net_type,"i");
MODULE_PARM(hop_dwell,"i");
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 8c3ef835999f..90eaf258b31e 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -85,6 +85,7 @@ static int irq_list[4] = { -1 };
MODULE_PARM(if_port, "i");
MODULE_PARM(irq_mask, "i");
MODULE_PARM(irq_list, "1-4i");
+MODULE_LICENSE("GPL");
/* Operational parameter that usually are not changed. */
diff --git a/drivers/net/pcmcia/wavelan_cs.c b/drivers/net/pcmcia/wavelan_cs.c
index aa0ac3fb9c21..b41536ce3f26 100644
--- a/drivers/net/pcmcia/wavelan_cs.c
+++ b/drivers/net/pcmcia/wavelan_cs.c
@@ -4832,3 +4832,4 @@ exit_wavelan_cs(void)
module_init(init_wavelan_cs);
module_exit(exit_wavelan_cs);
+MODULE_LICENSE("BSD without advertisement clause");
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index ac3355aa097c..757ff555d235 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -2090,3 +2090,4 @@ static int __init setup_xirc2ps_cs(char *str)
__setup("xirc2ps_cs=", setup_xirc2ps_cs);
#endif
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/xircom_cb.c b/drivers/net/pcmcia/xircom_cb.c
index a256a5b68484..47ed54e36a55 100644
--- a/drivers/net/pcmcia/xircom_cb.c
+++ b/drivers/net/pcmcia/xircom_cb.c
@@ -37,6 +37,7 @@
MODULE_DESCRIPTION("Xircom Cardbus ethernet driver");
MODULE_AUTHOR("Arjan van de Ven <arjanv@redhat.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/pcmcia/xircom_tulip_cb.c b/drivers/net/pcmcia/xircom_tulip_cb.c
index b229607541c8..4b95b3d7b126 100644
--- a/drivers/net/pcmcia/xircom_tulip_cb.c
+++ b/drivers/net/pcmcia/xircom_tulip_cb.c
@@ -106,6 +106,8 @@ static int csr0 = 0x00A00000 | 0x4800;
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Digital 21*4* Tulip ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(debug, "i");
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(rx_copybreak, "i");
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 37d965573a5f..2356639d600b 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1538,6 +1538,7 @@ MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i");
MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");
MODULE_AUTHOR("Thomas Bogendoerfer");
MODULE_DESCRIPTION("Driver for PCnet32 and PCnetPCI based ethercards");
+MODULE_LICENSE("GPL");
/* An additional parameter that may be passed in... */
static int debug = -1;
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index a2de0f408469..864d9b833043 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -1432,6 +1432,7 @@ static int __init plip_init (void)
module_init(plip_init);
module_exit(plip_cleanup_module);
+MODULE_LICENSE("GPL");
/*
* Local variables:
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 16d9ab300549..5177c8bee290 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -81,6 +81,8 @@ struct asyncppp {
static int flag_time = HZ;
MODULE_PARM(flag_time, "i");
MODULE_PARM_DESC(flag_time, "ppp_async: interval between flagged packets (in clock ticks)");
+MODULE_LICENSE("GPL");
+
/*
* Prototypes.
diff --git a/drivers/net/ppp_deflate.c b/drivers/net/ppp_deflate.c
index e1d4768972bf..0092f7b6c830 100644
--- a/drivers/net/ppp_deflate.c
+++ b/drivers/net/ppp_deflate.c
@@ -657,3 +657,4 @@ void __exit deflate_cleanup(void)
module_init(deflate_init);
module_exit(deflate_cleanup);
+MODULE_LICENSE("BSD without advertisement clause");
diff --git a/drivers/net/rcpci45.c b/drivers/net/rcpci45.c
index 3768ed0548d5..0b5bcdcc1eaa 100644
--- a/drivers/net/rcpci45.c
+++ b/drivers/net/rcpci45.c
@@ -111,6 +111,7 @@ static struct pci_device_id rcpci45_pci_table[] __devinitdata = {
{}
};
MODULE_DEVICE_TABLE (pci, rcpci45_pci_table);
+MODULE_LICENSE("GPL");
static void __exit
rcpci45_remove_one (struct pci_dev *pdev)
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c
index e469f46cfe56..ac5ca33b2980 100644
--- a/drivers/net/sb1000.c
+++ b/drivers/net/sb1000.c
@@ -1209,6 +1209,8 @@ static int sb1000_close(struct net_device *dev)
#ifdef MODULE
MODULE_AUTHOR("Franco Venturi <fventuri@mediaone.net>");
MODULE_DESCRIPTION("General Instruments SB1000 driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(io, "1-2i");
MODULE_PARM(irq, "i");
MODULE_PARM_DESC(io, "SB1000 I/O base addresses");
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index ad2c001a3b97..9e1e2e30a26c 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -743,4 +743,5 @@ static void __exit shaper_exit (void)
module_init(shaper_init);
module_exit(shaper_exit);
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index a65b3b097c2b..694d44e2f5b4 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -161,6 +161,8 @@ struct sis900_private {
MODULE_AUTHOR("Jim Huang <cmhuang@sis.com.tw>, Ollie Lho <ollie@sis.com.tw>");
MODULE_DESCRIPTION("SiS 900 PCI Fast Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(multicast_filter_limit, "i");
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(debug, "i");
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 463d815529ec..a2708e7e8a6d 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -591,6 +591,7 @@ SK_AC *pAC;
MODULE_AUTHOR("Christoph Goos <cgoos@syskonnect.de>");
MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver");
+MODULE_LICENSE("GPL");
MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s");
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index cb81e98cf00d..e748b5c9aa4c 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -187,6 +187,7 @@ static struct pci_device_id skfddi_pci_tbl[] __initdata = {
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(pci, skfddi_pci_tbl);
+MODULE_LICENSE("GPL");
// Define module-wide (static) variables
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c
index 3112a4d661b7..d83aeffb391c 100644
--- a/drivers/net/slhc.c
+++ b/drivers/net/slhc.c
@@ -797,3 +797,4 @@ EXPORT_SYMBOL(slhc_uncompress);
EXPORT_SYMBOL(slhc_toss);
#endif /* CONFIG_INET */
+MODULE_LICENSE("BSD without advertising clause");
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index e8201924d01f..ebac2929faaa 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -1516,3 +1516,4 @@ out:
}
#endif
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c
index 269be5c5a8e4..f2807a6447d9 100644
--- a/drivers/net/smc-ultra.c
+++ b/drivers/net/smc-ultra.c
@@ -557,6 +557,8 @@ cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
/*
diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c
index 1a2b9b8c8f6a..1b27198e434b 100644
--- a/drivers/net/smc-ultra32.c
+++ b/drivers/net/smc-ultra32.c
@@ -415,3 +415,5 @@ void cleanup_module(void)
}
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
+
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 09b396cf3298..0fec2bcce2c3 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -250,6 +250,8 @@ KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELD
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(mtu, "i");
MODULE_PARM(debug, "i");
diff --git a/drivers/net/strip.c b/drivers/net/strip.c
index 2d1164fb3da7..e78d5b991df0 100644
--- a/drivers/net/strip.c
+++ b/drivers/net/strip.c
@@ -2871,5 +2871,7 @@ module_exit(strip_exit_driver);
MODULE_AUTHOR("Stuart Cheshire <cheshire@cs.stanford.edu>");
MODULE_DESCRIPTION("Starmode Radio IP (STRIP) Device Driver");
+MODULE_LICENSE("BSD without advertisement clause");
+
MODULE_SUPPORTED_DEVICE("Starmode Radio IP (STRIP) modem");
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 0266076e179b..cf21b0181630 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -108,6 +108,8 @@ KERN_INFO " http://www.scyld.com/network/sundance.html\n";
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Sundance Alta Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(mtu, "i");
MODULE_PARM(debug, "i");
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 1f4c1a2a560a..08653abefba8 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -48,6 +48,8 @@ static char version[] __devinitdata =
MODULE_AUTHOR("David S. Miller (davem@redhat.com)");
MODULE_DESCRIPTION("Sun GEM Gbit ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(gem_debug, "i");
MODULE_PARM_DESC(gem_debug, "(ignored)");
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 654e2db9256c..a029bc9a88f0 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -190,6 +190,8 @@ struct pci_device_id happymeal_pci_ids[] __initdata = {
};
MODULE_DEVICE_TABLE(pci, happymeal_pci_ids);
+MODULE_LICENSE("GPL");
+
#endif
/* NOTE: In the descriptor writes one _must_ write the address
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index dbba4a020fb9..57632c10efb2 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -190,6 +190,8 @@ static int boards_found;
MODULE_AUTHOR("Maintainer: Torben Mathiasen <torben.mathiasen@compaq.com>");
MODULE_DESCRIPTION("Driver for TI ThunderLAN based ethernet PCI adapters");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(aui, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
MODULE_PARM(duplex, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
MODULE_PARM(speed, "1-" __MODULE_STRING(MAX_TLAN_BOARDS) "i");
@@ -452,7 +454,7 @@ static int __init tlan_probe(void)
/* Use new style PCI probing. Now the kernel will
do most of this for us */
- pci_module_init(&tlan_driver);
+ pci_register_driver(&tlan_driver);
TLAN_DBG(TLAN_DEBUG_PROBE, "Starting EISA Probe....\n");
TLan_EisaProbe();
@@ -462,6 +464,7 @@ static int __init tlan_probe(void)
tlan_have_pci, tlan_have_eisa);
if (TLanDevicesInstalled == 0) {
+ pci_unregister_driver(&tlan_driver);
kfree(TLanPadBuffer);
return -ENODEV;
}
@@ -643,8 +646,7 @@ static void TLan_Eisa_Cleanup(void)
static void __exit tlan_exit(void)
{
- if (tlan_have_pci)
- pci_unregister_driver(&tlan_driver);
+ pci_unregister_driver(&tlan_driver);
if (tlan_have_eisa)
TLan_Eisa_Cleanup();
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index cae4ad98e0e8..8dc7c621f67f 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -1825,3 +1825,4 @@ static void __exit streamer_cleanup_module(void) {
module_init(streamer_init_module);
module_exit(streamer_cleanup_module);
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 1a39a109aaf3..f130784958ff 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -101,6 +101,7 @@ static int csr0 = 0x00A00000 | 0x4800;
MODULE_AUTHOR("The Linux Kernel Team");
MODULE_DESCRIPTION("Digital 21*4* Tulip ethernet driver");
+MODULE_LICENSE("GPL");
MODULE_PARM(tulip_debug, "i");
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(rx_copybreak, "i");
@@ -1466,8 +1467,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
goto err_out_free_res;
#endif
- pci_set_master(pdev);
-
pci_read_config_byte (pdev, PCI_REVISION_ID, &chip_rev);
/*
@@ -1512,6 +1511,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
/* Stop the chip's Tx and Rx processes. */
tulip_stop_rxtx(tp);
+ pci_set_master(pdev);
+
/* Clear the missed-packet counter. */
inl(ioaddr + CSR8);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a7f262577394..fc552d28d810 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -581,3 +581,4 @@ void tun_cleanup(void)
module_init(tun_init);
module_exit(tun_cleanup);
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index dc7a5c13d1e0..fba2430f5ba6 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -184,6 +184,8 @@ static char shortname[] __devinitdata = "via-rhine";
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("VIA Rhine PCI Fast Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(debug, "i");
MODULE_PARM(rx_copybreak, "i");
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index a588bb6ec1da..9034148c3a38 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -64,6 +64,8 @@
MODULE_AUTHOR("Arnaldo Carvalho de Melo");
MODULE_DESCRIPTION("Cyclom 2x Sync Card Driver");
+MODULE_LICENSE("GPL");
+
/* Function Prototypes */
/* Module entry points. These are called by the OS and must be public. */
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c
index f43e33a9ab0d..f46c7e9c82ad 100644
--- a/drivers/net/wan/hostess_sv11.c
+++ b/drivers/net/wan/hostess_sv11.c
@@ -1,5 +1,3 @@
-#define LINUX_21
-
/*
* Comtrol SV11 card driver
*
@@ -186,7 +184,6 @@ static int hostess_queue_xmit(struct sk_buff *skb, struct net_device *d)
return z8530_queue_xmit(&sv11->sync.chanA, skb);
}
-#ifdef LINUX_21
static int hostess_neigh_setup(struct neighbour *n)
{
if (n->nud_state == NUD_NONE) {
@@ -206,15 +203,6 @@ static int hostess_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p
return 0;
}
-#else
-
-static int return_0(struct net_device *d)
-{
- return 0;
-}
-
-#endif
-
/*
* Description block for a Comtrol Hostess SV11 card
*/
@@ -345,11 +333,7 @@ static struct sv11_device *sv11_init(int iobase, int irq)
d->get_stats = hostess_get_stats;
d->set_multicast_list = NULL;
d->do_ioctl = hostess_ioctl;
-#ifdef LINUX_21
d->neigh_setup = hostess_neigh_setup_dev;
-#else
- d->init = return_0;
-#endif
d->set_mac_address = NULL;
if(register_netdev(d)==-1)
@@ -416,7 +400,7 @@ static struct sv11_device *sv11_unit;
int init_module(void)
{
printk(KERN_INFO "SV-11 Z85230 Synchronous Driver v 0.02.\n");
- printk(KERN_INFO "(c) Copyright 1998, Building Number Three Ltd.\n");
+ printk(KERN_INFO "(c) Copyright 2001, Red Hat Inc.\n");
if((sv11_unit=sv11_init(io,irq))==NULL)
return -ENODEV;
return 0;
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 8bc2e120a1fd..6e3fd01c259b 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -1,5 +1,3 @@
-#define LINUX_21
-
/*
* Sealevel Systems 4021 driver.
*
@@ -8,8 +6,8 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * (c) Copyright 1999 Building Number Three Ltd
- * (c) Copyright 2001 Alan Cox.
+ * (c) Copyright 1999, 2001 Alan Cox
+ * (c) Copyright 2001 Red Hat Inc.
*
*/
@@ -185,7 +183,6 @@ static int sealevel_queue_xmit(struct sk_buff *skb, struct net_device *d)
return z8530_queue_xmit(slvl->chan, skb);
}
-#ifdef LINUX_21
static int sealevel_neigh_setup(struct neighbour *n)
{
if (n->nud_state == NUD_NONE) {
@@ -205,15 +202,6 @@ static int sealevel_neigh_setup_dev(struct net_device *dev, struct neigh_parms *
return 0;
}
-#else
-
-static int return_0(struct net_device *d)
-{
- return 0;
-}
-
-#endif
-
/*
* Description block for a Comtrol Hostess SV11 card
*/
@@ -374,11 +362,7 @@ static struct slvl_board *slvl_init(int iobase, int irq, int txdma, int rxdma, i
d->get_stats = sealevel_get_stats;
d->set_multicast_list = NULL;
d->do_ioctl = sealevel_ioctl;
-#ifdef LINUX_21
d->neigh_setup = sealevel_neigh_setup_dev;
-#else
- d->init = return_0;
-#endif
d->set_mac_address = NULL;
if(register_netdev(d)==-1)
@@ -444,7 +428,6 @@ static int rxdma=3;
static int irq=5;
static int slow=0;
-#ifdef LINUX_21
MODULE_PARM(io,"i");
MODULE_PARM_DESC(io, "The I/O base of the Sealevel card");
MODULE_PARM(txdma,"i");
@@ -459,7 +442,6 @@ MODULE_PARM_DESC(slow, "Set this for an older Sealevel card such as the 4012");
MODULE_AUTHOR("Alan Cox");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Modular driver for the SeaLevel 4021");
-#endif
static struct slvl_board *slvl_unit;
diff --git a/drivers/net/wavelan.c b/drivers/net/wavelan.c
index 409c1d5eb4aa..7868bee37067 100644
--- a/drivers/net/wavelan.c
+++ b/drivers/net/wavelan.c
@@ -1545,8 +1545,7 @@ static inline int wv_set_frequency(unsigned long ioaddr, /* I/O port of the card
/* Setting by channel (same as wfreqsel) */
/* Warning: each channel is 22 MHz wide, so some of the channels
* will interfere. */
- if ((frequency->e == 0) &&
- (frequency->m >= 0) && (frequency->m < BAND_NUM)) {
+ if ((frequency->e == 0) && (frequency->m < BAND_NUM)) {
/* Get frequency offset. */
freq = channel_bands[frequency->m] >> 1;
}
@@ -4292,6 +4291,7 @@ void cleanup_module(void)
#endif
}
#endif /* MODULE */
+MODULE_LICENSE("GPL");
/*
* This software may only be used and distributed
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index efd3c350ae53..c053c1c53320 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -454,6 +454,7 @@ MODULE_PARM_DESC(io, "WD80x3 I/O base address(es)");
MODULE_PARM_DESC(irq, "WD80x3 IRQ number(s) (ignored for PureData boards)");
MODULE_PARM_DESC(mem, "WD80x3 memory base address(es)(ignored for PureData boards)");
MODULE_PARM_DESC(mem_end, "WD80x3 memory end address(es)");
+MODULE_LICENSE("GPL");
/* This is set up so that only a single autoprobe takes place per call.
ISA device autoprobes on a running machine are not recommended. */
diff --git a/drivers/net/winbond-840.c b/drivers/net/winbond-840.c
index 25ec43b93afe..c1aa90d3d8f9 100644
--- a/drivers/net/winbond-840.c
+++ b/drivers/net/winbond-840.c
@@ -149,6 +149,8 @@ KERN_INFO " http://www.scyld.com/network/drivers.html\n";
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(debug, "i");
MODULE_PARM(rx_copybreak, "i");
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 5338a70a2179..0f955e76db72 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -150,6 +150,8 @@ KERN_INFO " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n";
#endif /* !USE_IO_OPS */
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver");
+MODULE_LICENSE("GPL");
+
MODULE_PARM(max_interrupt_work, "i");
MODULE_PARM(mtu, "i");
MODULE_PARM(debug, "i");