git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rtl8187: Change TX power settings
[safe/jmp/linux-2.6]
/
drivers
/
net
/
eexpress.c
diff --git
a/drivers/net/eexpress.c
b/drivers/net/eexpress.c
index
4a50fcb
..
a125e41
100644
(file)
--- a/
drivers/net/eexpress.c
+++ b/
drivers/net/eexpress.c
@@
-8,8
+8,8
@@
*
* Many modifications, and currently maintained, by
* Philip Blundell <philb@gnu.org>
*
* Many modifications, and currently maintained, by
* Philip Blundell <philb@gnu.org>
- * Added the Compaq LTE Alan Cox <alan@
redhat.com
>
- * Added MCA support Adam Fritzler
<mid@auk.cx>
+ * Added the Compaq LTE Alan Cox <alan@
lxorguk.ukuu.org.uk
>
+ * Added MCA support Adam Fritzler
*
* Note - this driver is experimental still - it has problems on faster
* machines. Someone needs to sit down and go through it line by line with
*
* Note - this driver is experimental still - it has problems on faster
* machines. Someone needs to sit down and go through it line by line with
@@
-115,6
+115,7
@@
#include <linux/mca-legacy.h>
#include <linux/spinlock.h>
#include <linux/bitops.h>
#include <linux/mca-legacy.h>
#include <linux/spinlock.h>
#include <linux/bitops.h>
+#include <linux/jiffies.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/io.h>
@@
-134,7
+135,6
@@
struct net_local
{
struct net_local
{
- struct net_device_stats stats;
unsigned long last_tx; /* jiffies when last transmit started */
unsigned long init_time; /* jiffies when eexp_hw_init586 called */
unsigned short rx_first; /* first rx buf, same as RX_BUF_START */
unsigned long last_tx; /* jiffies when last transmit started */
unsigned long init_time; /* jiffies when eexp_hw_init586 called */
unsigned short rx_first; /* first rx buf, same as RX_BUF_START */
@@
-202,7
+202,7
@@
static unsigned short start_code[] = {
0x0000,Cmd_MCast,
0x0076, /* link to next command */
#define CONF_NR_MULTICAST 0x44
0x0000,Cmd_MCast,
0x0076, /* link to next command */
#define CONF_NR_MULTICAST 0x44
- 0x0000, /* number of
multicast addresses
*/
+ 0x0000, /* number of
bytes in multicast address(es)
*/
#define CONF_MULTICAST 0x46
0x0000, 0x0000, 0x0000, /* some addresses */
0x0000, 0x0000, 0x0000,
#define CONF_MULTICAST 0x46
0x0000, 0x0000, 0x0000, /* some addresses */
0x0000, 0x0000, 0x0000,
@@
-246,7
+246,6
@@
static char mca_irqmap[] = { 12, 9, 3, 4, 5, 10, 11, 15 };
static int eexp_open(struct net_device *dev);
static int eexp_close(struct net_device *dev);
static void eexp_timeout(struct net_device *dev);
static int eexp_open(struct net_device *dev);
static int eexp_close(struct net_device *dev);
static void eexp_timeout(struct net_device *dev);
-static struct net_device_stats *eexp_stats(struct net_device *dev);
static int eexp_xmit(struct sk_buff *buf, struct net_device *dev);
static irqreturn_t eexp_irq(int irq, void *dev_addr);
static int eexp_xmit(struct sk_buff *buf, struct net_device *dev);
static irqreturn_t eexp_irq(int irq, void *dev_addr);
@@
-340,8
+339,6
@@
static int __init do_express_probe(struct net_device *dev)
int dev_irq = dev->irq;
int err;
int dev_irq = dev->irq;
int err;
- SET_MODULE_OWNER(dev);
-
dev->if_port = 0xff; /* not set */
#ifdef CONFIG_MCA_LEGACY
dev->if_port = 0xff; /* not set */
#ifdef CONFIG_MCA_LEGACY
@@
-459,8
+456,9
@@
static int eexp_open(struct net_device *dev)
if (!dev->irq || !irqrmap[dev->irq])
return -ENXIO;
if (!dev->irq || !irqrmap[dev->irq])
return -ENXIO;
- ret = request_irq(dev->irq,&eexp_irq,0,dev->name,dev);
- if (ret) return ret;
+ ret = request_irq(dev->irq, &eexp_irq, 0, dev->name, dev);
+ if (ret)
+ return ret;
if (!request_region(ioaddr, EEXP_IO_EXTENT, "EtherExpress")) {
printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
if (!request_region(ioaddr, EEXP_IO_EXTENT, "EtherExpress")) {
printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
@@
-534,17
+532,6
@@
static int eexp_close(struct net_device *dev)
}
/*
}
/*
- * Return interface stats
- */
-
-static struct net_device_stats *eexp_stats(struct net_device *dev)
-{
- struct net_local *lp = netdev_priv(dev);
-
- return &lp->stats;
-}
-
-/*
* This gets called when a higher level thinks we are broken. Check that
* nothing has become jammed in the CU.
*/
* This gets called when a higher level thinks we are broken. Check that
* nothing has become jammed in the CU.
*/
@@
-556,7
+543,7
@@
static void unstick_cu(struct net_device *dev)
if (lp->started)
{
if (lp->started)
{
- if (
(jiffies - dev->trans_start)>50
)
+ if (
time_after(jiffies, dev->trans_start + 50)
)
{
if (lp->tx_link==lp->last_tx_restart)
{
{
if (lp->tx_link==lp->last_tx_restart)
{
@@
-612,7
+599,7
@@
static void unstick_cu(struct net_device *dev)
}
else
{
}
else
{
- if (
(jiffies-lp->init_time)>10
)
+ if (
time_after(jiffies, lp->init_time + 10)
)
{
unsigned short status = scb_status(dev);
printk(KERN_WARNING "%s: i82586 startup timed out, status %04x, resetting...\n",
{
unsigned short status = scb_status(dev);
printk(KERN_WARNING "%s: i82586 startup timed out, status %04x, resetting...\n",
@@
-647,7
+634,7
@@
static void eexp_timeout(struct net_device *dev)
printk(KERN_INFO "%s: transmit timed out, %s?\n", dev->name,
(SCB_complete(status)?"lost interrupt":
"board on fire"));
printk(KERN_INFO "%s: transmit timed out, %s?\n", dev->name,
(SCB_complete(status)?"lost interrupt":
"board on fire"));
-
lp
->stats.tx_errors++;
+
dev
->stats.tx_errors++;
lp->last_tx = jiffies;
if (!SCB_complete(status)) {
scb_command(dev, SCB_CUabort);
lp->last_tx = jiffies;
if (!SCB_complete(status)) {
scb_command(dev, SCB_CUabort);
@@
-665,9
+652,9
@@
static void eexp_timeout(struct net_device *dev)
*/
static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
{
*/
static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
{
- struct net_local *lp = netdev_priv(dev);
short length = buf->len;
#ifdef CONFIG_SMP
short length = buf->len;
#ifdef CONFIG_SMP
+ struct net_local *lp = netdev_priv(dev);
unsigned long flags;
#endif
unsigned long flags;
#endif
@@
-695,7
+682,7
@@
static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
{
unsigned short *data = (unsigned short *)buf->data;
{
unsigned short *data = (unsigned short *)buf->data;
-
lp
->stats.tx_bytes += length;
+
dev
->stats.tx_bytes += length;
eexp_hw_tx_pio(dev,data,length);
}
eexp_hw_tx_pio(dev,data,length);
}
@@
-714,13
+701,6
@@
static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
* check to make sure we've not become wedged.
*/
* check to make sure we've not become wedged.
*/
-/*
- * Handle an EtherExpress interrupt
- * If we've finished initializing, start the RU and CU up.
- * If we've already started, reap tx buffers, handle any received packets,
- * check to make sure we've not become wedged.
- */
-
static unsigned short eexp_start_irq(struct net_device *dev,
unsigned short status)
{
static unsigned short eexp_start_irq(struct net_device *dev,
unsigned short status)
{
@@
-783,13
+763,13
@@
static unsigned short eexp_start_irq(struct net_device *dev,
static void eexp_cmd_clear(struct net_device *dev)
{
unsigned long int oldtime = jiffies;
static void eexp_cmd_clear(struct net_device *dev)
{
unsigned long int oldtime = jiffies;
- while (scb_rdcmd(dev) && (
(jiffies-oldtime)<10
));
+ while (scb_rdcmd(dev) && (
time_before(jiffies, oldtime + 10)
));
if (scb_rdcmd(dev)) {
printk("%s: command didn't clear\n", dev->name);
}
}
if (scb_rdcmd(dev)) {
printk("%s: command didn't clear\n", dev->name);
}
}
-static irqreturn_t eexp_irq(int
irq
, void *dev_info)
+static irqreturn_t eexp_irq(int
dummy
, void *dev_info)
{
struct net_device *dev = dev_info;
struct net_local *lp;
{
struct net_device *dev = dev_info;
struct net_local *lp;
@@
-804,8
+784,7
@@
static irqreturn_t eexp_irq(int irq, void *dev_info)
old_read_ptr = inw(ioaddr+READ_PTR);
old_write_ptr = inw(ioaddr+WRITE_PTR);
old_read_ptr = inw(ioaddr+READ_PTR);
old_write_ptr = inw(ioaddr+WRITE_PTR);
- outb(SIRQ_dis|irqrmap[irq],ioaddr+SET_IRQ);
-
+ outb(SIRQ_dis|irqrmap[dev->irq], ioaddr+SET_IRQ);
status = scb_status(dev);
status = scb_status(dev);
@@
-851,7
+830,7
@@
static irqreturn_t eexp_irq(int irq, void *dev_info)
outw(rbd+8, ioaddr+READ_PTR);
printk("[%04x]\n", inw(ioaddr+DATAPORT));
#endif
outw(rbd+8, ioaddr+READ_PTR);
printk("[%04x]\n", inw(ioaddr+DATAPORT));
#endif
-
lp
->stats.rx_errors++;
+
dev
->stats.rx_errors++;
#if 1
eexp_hw_rxinit(dev);
#else
#if 1
eexp_hw_rxinit(dev);
#else
@@
-872,7
+851,7
@@
static irqreturn_t eexp_irq(int irq, void *dev_info)
eexp_cmd_clear(dev);
eexp_cmd_clear(dev);
- outb(SIRQ_en|irqrmap[
irq],
ioaddr+SET_IRQ);
+ outb(SIRQ_en|irqrmap[
dev->irq],
ioaddr+SET_IRQ);
#if NET_DEBUG > 6
printk("%s: leaving eexp_irq()\n", dev->name);
#if NET_DEBUG > 6
printk("%s: leaving eexp_irq()\n", dev->name);
@@
-960,17
+939,17
@@
static void eexp_hw_rx_pio(struct net_device *dev)
}
else if (!FD_OK(status))
{
}
else if (!FD_OK(status))
{
-
lp
->stats.rx_errors++;
+
dev
->stats.rx_errors++;
if (FD_CRC(status))
if (FD_CRC(status))
-
lp
->stats.rx_crc_errors++;
+
dev
->stats.rx_crc_errors++;
if (FD_Align(status))
if (FD_Align(status))
-
lp
->stats.rx_frame_errors++;
+
dev
->stats.rx_frame_errors++;
if (FD_Resrc(status))
if (FD_Resrc(status))
-
lp
->stats.rx_fifo_errors++;
+
dev
->stats.rx_fifo_errors++;
if (FD_DMA(status))
if (FD_DMA(status))
-
lp
->stats.rx_over_errors++;
+
dev
->stats.rx_over_errors++;
if (FD_Short(status))
if (FD_Short(status))
-
lp
->stats.rx_length_errors++;
+
dev
->stats.rx_length_errors++;
}
else
{
}
else
{
@@
-980,18
+959,16
@@
static void eexp_hw_rx_pio(struct net_device *dev)
if (skb == NULL)
{
printk(KERN_WARNING "%s: Memory squeeze, dropping packet\n",dev->name);
if (skb == NULL)
{
printk(KERN_WARNING "%s: Memory squeeze, dropping packet\n",dev->name);
-
lp
->stats.rx_dropped++;
+
dev
->stats.rx_dropped++;
break;
}
break;
}
- skb->dev = dev;
skb_reserve(skb, 2);
outw(pbuf+10, ioaddr+READ_PTR);
insw(ioaddr+DATAPORT, skb_put(skb,pkt_len),(pkt_len+1)>>1);
skb->protocol = eth_type_trans(skb,dev);
netif_rx(skb);
skb_reserve(skb, 2);
outw(pbuf+10, ioaddr+READ_PTR);
insw(ioaddr+DATAPORT, skb_put(skb,pkt_len),(pkt_len+1)>>1);
skb->protocol = eth_type_trans(skb,dev);
netif_rx(skb);
- dev->last_rx = jiffies;
- lp->stats.rx_packets++;
- lp->stats.rx_bytes += pkt_len;
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += pkt_len;
}
outw(rx_block, ioaddr+WRITE_PTR);
outw(0, ioaddr+DATAPORT);
}
outw(rx_block, ioaddr+WRITE_PTR);
outw(0, ioaddr+DATAPORT);
@@
-1062,7
+1039,7
@@
static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
outw(0xFFFF, ioaddr+SIGNAL_CA);
}
outw(0xFFFF, ioaddr+SIGNAL_CA);
}
-
lp
->stats.tx_packets++;
+
dev
->stats.tx_packets++;
lp->last_tx = jiffies;
}
lp->last_tx = jiffies;
}
@@
-1189,7
+1166,6
@@
static int __init eexp_hw_probe(struct net_device *dev, unsigned short ioaddr)
dev->open = eexp_open;
dev->stop = eexp_close;
dev->hard_start_xmit = eexp_xmit;
dev->open = eexp_open;
dev->stop = eexp_close;
dev->hard_start_xmit = eexp_xmit;
- dev->get_stats = eexp_stats;
dev->set_multicast_list = &eexp_set_multicast;
dev->tx_timeout = eexp_timeout;
dev->watchdog_timeo = 2*HZ;
dev->set_multicast_list = &eexp_set_multicast;
dev->tx_timeout = eexp_timeout;
dev->watchdog_timeo = 2*HZ;
@@
-1272,35
+1248,35
@@
static unsigned short eexp_hw_lasttxstat(struct net_device *dev)
else
{
lp->last_tx_restart = 0;
else
{
lp->last_tx_restart = 0;
-
lp
->stats.collisions += Stat_NoColl(status);
+
dev
->stats.collisions += Stat_NoColl(status);
if (!Stat_OK(status))
{
char *whatsup = NULL;
if (!Stat_OK(status))
{
char *whatsup = NULL;
-
lp
->stats.tx_errors++;
+
dev
->stats.tx_errors++;
if (Stat_Abort(status))
if (Stat_Abort(status))
-
lp
->stats.tx_aborted_errors++;
+
dev
->stats.tx_aborted_errors++;
if (Stat_TNoCar(status)) {
whatsup = "aborted, no carrier";
if (Stat_TNoCar(status)) {
whatsup = "aborted, no carrier";
-
lp
->stats.tx_carrier_errors++;
+
dev
->stats.tx_carrier_errors++;
}
if (Stat_TNoCTS(status)) {
whatsup = "aborted, lost CTS";
}
if (Stat_TNoCTS(status)) {
whatsup = "aborted, lost CTS";
-
lp
->stats.tx_carrier_errors++;
+
dev
->stats.tx_carrier_errors++;
}
if (Stat_TNoDMA(status)) {
whatsup = "FIFO underran";
}
if (Stat_TNoDMA(status)) {
whatsup = "FIFO underran";
-
lp
->stats.tx_fifo_errors++;
+
dev
->stats.tx_fifo_errors++;
}
if (Stat_TXColl(status)) {
whatsup = "aborted, too many collisions";
}
if (Stat_TXColl(status)) {
whatsup = "aborted, too many collisions";
-
lp
->stats.tx_aborted_errors++;
+
dev
->stats.tx_aborted_errors++;
}
if (whatsup)
printk(KERN_INFO "%s: transmit %s\n",
dev->name, whatsup);
}
else
}
if (whatsup)
printk(KERN_INFO "%s: transmit %s\n",
dev->name, whatsup);
}
else
-
lp
->stats.tx_packets++;
+
dev
->stats.tx_packets++;
}
if (tx_block == TX_BUF_START+((lp->num_tx_bufs-1)*TX_BUF_SIZE))
lp->tx_reap = tx_block = TX_BUF_START;
}
if (tx_block == TX_BUF_START+((lp->num_tx_bufs-1)*TX_BUF_SIZE))
lp->tx_reap = tx_block = TX_BUF_START;
@@
-1592,7
+1568,7
@@
static void eexp_hw_init586(struct net_device *dev)
static void eexp_setup_filter(struct net_device *dev)
{
static void eexp_setup_filter(struct net_device *dev)
{
- struct dev_mc_list *dmi
= dev->mc_list
;
+ struct dev_mc_list *dmi;
unsigned short ioaddr = dev->base_addr;
int count = dev->mc_count;
int i;
unsigned short ioaddr = dev->base_addr;
int count = dev->mc_count;
int i;
@@
-1603,9
+1579,9
@@
static void eexp_setup_filter(struct net_device *dev)
}
outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR);
}
outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR);
- outw(count, ioaddr+SHADOW(CONF_NR_MULTICAST));
- for (i = 0
; i < count; i++
) {
- unsigned short *data
= (unsigned short *)dmi->dmi_addr
;
+ outw(
6*
count, ioaddr+SHADOW(CONF_NR_MULTICAST));
+ for (i = 0
, dmi = dev->mc_list; i < count; i++, dmi = dmi->next
) {
+ unsigned short *data;
if (!dmi) {
printk(KERN_INFO "%s: too few multicast addresses\n", dev->name);
break;
if (!dmi) {
printk(KERN_INFO "%s: too few multicast addresses\n", dev->name);
break;
@@
-1614,6
+1590,7
@@
static void eexp_setup_filter(struct net_device *dev)
printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name);
continue;
}
printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name);
continue;
}
+ data = (unsigned short *)dmi->dmi_addr;
outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR);
outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i)));
outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR);
outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR);
outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i)));
outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR);
@@
-1657,7
+1634,7
@@
eexp_set_multicast(struct net_device *dev)
#endif
oj = jiffies;
while ((SCB_CUstat(scb_status(dev)) == 2) &&
#endif
oj = jiffies;
while ((SCB_CUstat(scb_status(dev)) == 2) &&
- (
(jiffies-oj) < 2000
));
+ (
time_before(jiffies, oj + 2000)
));
if (SCB_CUstat(scb_status(dev)) == 2)
printk("%s: warning, CU didn't stop\n", dev->name);
lp->started &= ~(STARTED_CU);
if (SCB_CUstat(scb_status(dev)) == 2)
printk("%s: warning, CU didn't stop\n", dev->name);
lp->started &= ~(STARTED_CU);