Commit 9e6b8ac3 authored by Jeff Garzik's avatar Jeff Garzik

Merge redhat.com:/spare/repo/netdev-2.6/misc

into redhat.com:/spare/repo/net-drivers-2.5
parents e249c44b 8538bf48
________________
NETIF Msg Level
The design of the network interface message level setting.
History
The design of the debugging message interface was guided and
constrained by backwards compatibility previous practice. It is useful
to understand the history and evolution in order to understand current
practice and relate it to older driver source code.
From the beginning of Linux, each network device driver has had a local
integer variable that controls the debug message level. The message
level ranged from 0 to 7, and monotonically increased in verbosity.
The message level was not precisely defined past level 3, but were
always implemented within +-1 of the specified level. Drivers tended
to shed the more verbose level messages as they matured.
0 Minimal messages, only essential information on fatal errors.
1 Standard messages, initialization status. No run-time messages
2 Special media selection messages, generally timer-driver.
3 Interface starts and stops, including normal status messages
4 Tx and Rx frame error messages, and abnormal driver operation
5 Tx packet queue information, interrupt events.
6 Status on each completed Tx packet and received Rx packets
7 Initial contents of Tx and Rx packets
Initially this message level variable was uniquely named in each driver
e.g. "lance_debug", so that a kernel symbolic debugger could locate and
modify the setting. When kernel modules became common, the variables
were consistently renamed to "debug" and allowed to be set as a module
parameter.
This approach worked well. However there is always a demand for
additional features. Over the years the following emerged as
reasonable and easily implemented enhancements
Using an ioctl() call to modify the level.
Per-interface rather than per-driver message level setting.
More selective control over the type of messages emitted.
The netif_msg recommandation adds these features with only a minor
complexity and code size increase.
The recommendation is the following points
Retaining the per-driver integer variable "debug" as a module
parameter with a default level of '1'.
Adding a per-interface private variable named "msg_enable". The
variable is a bit map rather than a level, and is initialized as
1 << debug
Or more precisely
debug < 0 ? 0 : 1 << min(sizeof(int)-1, debug)
Messages should changes from
if (debug > 1)
printk(MSG_DEBUG "%s: ...
to
if (np->msg_enable & NETIF_MSG_LINK)
printk(MSG_DEBUG "%s: ...
The set of message levels is named
Old level Name Bit position
0 NETIF_MSG_DRV 0x0001
1 NETIF_MSG_PROBE 0x0002
2 NETIF_MSG_LINK 0x0004
2 NETIF_MSG_TIMER 0x0004
3 NETIF_MSG_IFDOWN 0x0008
3 NETIF_MSG_IFUP 0x0008
4 NETIF_MSG_RX_ERR 0x0010
4 NETIF_MSG_TX_ERR 0x0010
5 NETIF_MSG_TX_QUEUED 0x0020
5 NETIF_MSG_INTR 0x0020
6 NETIF_MSG_TX_DONE 0x0040
6 NETIF_MSG_RX_STATUS 0x0040
7 NETIF_MSG_PKTDATA 0x0080
......@@ -513,7 +513,7 @@ irqreturn_t ei_interrupt(int irq, void *dev_id, struct pt_regs * regs)
}
}
spin_unlock(&ei_local->page_lock);
return IRQ_HANDLED;
return IRQ_RETVAL(nr_serviced > 0);
}
/**
......
/*
* Amiga Linux/68k A2065 Ethernet Driver
*
* (C) Copyright 1995 by Geert Uytterhoeven <geert@linux-m68k.org>
* (C) Copyright 1995-2003 by Geert Uytterhoeven <geert@linux-m68k.org>
*
* Fixes and tips by:
* - Janos Farkas (CHEXUM@sparta.banki.hu)
......@@ -130,14 +130,8 @@ struct lance_private {
int burst_sizes; /* ledma SBus burst sizes */
#endif
struct timer_list multicast_timer;
struct net_device *dev; /* Backpointer */
struct lance_private *next_module;
};
#ifdef MODULE
static struct lance_private *root_a2065_dev;
#endif
#define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
lp->tx_old+lp->tx_ring_mod_mask-lp->tx_new:\
lp->tx_old - lp->tx_new-1)
......@@ -704,133 +698,141 @@ static void lance_set_multicast (struct net_device *dev)
netif_wake_queue(dev);
}
static int __init a2065_probe(void)
static int __devinit a2065_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent);
static void __devexit a2065_remove_one(struct zorro_dev *z);
static struct zorro_device_id a2065_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_CBM_A2065_1 },
{ ZORRO_PROD_CBM_A2065_2 },
{ ZORRO_PROD_AMERISTAR_A2065 },
{ 0 }
};
static struct zorro_driver a2065_driver = {
.name = "a2065",
.id_table = a2065_zorro_tbl,
.probe = a2065_init_one,
.remove = __devexit_p(a2065_remove_one),
};
static int __devinit a2065_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
struct zorro_dev *z = NULL;
struct net_device *dev;
struct lance_private *priv;
int res = -ENODEV;
while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
unsigned long board, base_addr, mem_start;
struct resource *r1, *r2;
int is_cbm;
if (z->id == ZORRO_PROD_CBM_A2065_1 ||
z->id == ZORRO_PROD_CBM_A2065_2)
is_cbm = 1;
else if (z->id == ZORRO_PROD_AMERISTAR_A2065)
is_cbm = 0;
else
continue;
unsigned long board, base_addr, mem_start;
struct resource *r1, *r2;
int err;
board = z->resource.start;
base_addr = board+A2065_LANCE;
mem_start = board+A2065_RAM;
r1 = request_mem_region(base_addr, sizeof(struct lance_regs),
"Am7990");
if (!r1)
return -EBUSY;
r2 = request_mem_region(mem_start, A2065_RAM_SIZE, "RAM");
if (!r2) {
release_resource(r1);
return -EBUSY;
}
board = z->resource.start;
base_addr = board+A2065_LANCE;
mem_start = board+A2065_RAM;
dev = alloc_etherdev(sizeof(struct lance_private));
if (dev == NULL) {
release_resource(r1);
release_resource(r2);
return -ENOMEM;
}
r1 = request_mem_region(base_addr, sizeof(struct lance_regs),
"Am7990");
if (!r1) continue;
r2 = request_mem_region(mem_start, A2065_RAM_SIZE, "RAM");
if (!r2) {
release_resource(r1);
continue;
}
SET_MODULE_OWNER(dev);
priv = dev->priv;
dev = alloc_etherdev(sizeof(struct lance_private));
r1->name = dev->name;
r2->name = dev->name;
if (dev == NULL) {
release_resource(r1);
release_resource(r2);
return -ENOMEM;
}
SET_MODULE_OWNER(dev);
priv = dev->priv;
r1->name = dev->name;
r2->name = dev->name;
priv->dev = dev;
dev->dev_addr[0] = 0x00;
if (is_cbm) { /* Commodore */
dev->dev_addr[1] = 0x80;
dev->dev_addr[2] = 0x10;
} else { /* Ameristar */
dev->dev_addr[1] = 0x00;
dev->dev_addr[2] = 0x9f;
}
dev->dev_addr[3] = (z->rom.er_SerialNumber>>16) & 0xff;
dev->dev_addr[4] = (z->rom.er_SerialNumber>>8) & 0xff;
dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
printk("%s: A2065 at 0x%08lx, Ethernet Address "
"%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, board,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
dev->base_addr = ZTWO_VADDR(base_addr);
dev->mem_start = ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start+A2065_RAM_SIZE;
priv->ll = (volatile struct lance_regs *)dev->base_addr;
priv->init_block = (struct lance_init_block *)dev->mem_start;
priv->lance_init_block = (struct lance_init_block *)A2065_RAM;
priv->auto_select = 0;
priv->busmaster_regval = LE_C3_BSWP;
priv->lance_log_rx_bufs = LANCE_LOG_RX_BUFFERS;
priv->lance_log_tx_bufs = LANCE_LOG_TX_BUFFERS;
priv->rx_ring_mod_mask = RX_RING_MOD_MASK;
priv->tx_ring_mod_mask = TX_RING_MOD_MASK;
dev->open = &lance_open;
dev->stop = &lance_close;
dev->hard_start_xmit = &lance_start_xmit;
dev->tx_timeout = &lance_tx_timeout;
dev->watchdog_timeo = 5*HZ;
dev->get_stats = &lance_get_stats;
dev->set_multicast_list = &lance_set_multicast;
dev->dma = 0;
init_timer(&priv->multicast_timer);
priv->multicast_timer.data = (unsigned long) dev;
priv->multicast_timer.function =
(void (*)(unsigned long)) &lance_set_multicast;
res = register_netdev(dev);
if (res) {
release_resource(r1);
release_resource(r2);
free_netdev(dev);
break;
}
#ifdef MODULE
priv->next_module = root_a2065_dev;
root_a2065_dev = priv;
#endif
dev->dev_addr[0] = 0x00;
if (z->id != ZORRO_PROD_AMERISTAR_A2065) { /* Commodore */
dev->dev_addr[1] = 0x80;
dev->dev_addr[2] = 0x10;
} else { /* Ameristar */
dev->dev_addr[1] = 0x00;
dev->dev_addr[2] = 0x9f;
}
return res;
dev->dev_addr[3] = (z->rom.er_SerialNumber>>16) & 0xff;
dev->dev_addr[4] = (z->rom.er_SerialNumber>>8) & 0xff;
dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
printk("%s: A2065 at 0x%08lx, Ethernet Address "
"%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, board,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
dev->base_addr = ZTWO_VADDR(base_addr);
dev->mem_start = ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start+A2065_RAM_SIZE;
priv->ll = (volatile struct lance_regs *)dev->base_addr;
priv->init_block = (struct lance_init_block *)dev->mem_start;
priv->lance_init_block = (struct lance_init_block *)A2065_RAM;
priv->auto_select = 0;
priv->busmaster_regval = LE_C3_BSWP;
priv->lance_log_rx_bufs = LANCE_LOG_RX_BUFFERS;
priv->lance_log_tx_bufs = LANCE_LOG_TX_BUFFERS;
priv->rx_ring_mod_mask = RX_RING_MOD_MASK;
priv->tx_ring_mod_mask = TX_RING_MOD_MASK;
dev->open = &lance_open;
dev->stop = &lance_close;
dev->hard_start_xmit = &lance_start_xmit;
dev->tx_timeout = &lance_tx_timeout;
dev->watchdog_timeo = 5*HZ;
dev->get_stats = &lance_get_stats;
dev->set_multicast_list = &lance_set_multicast;
dev->dma = 0;
init_timer(&priv->multicast_timer);
priv->multicast_timer.data = (unsigned long) dev;
priv->multicast_timer.function =
(void (*)(unsigned long)) &lance_set_multicast;
err = register_netdev(dev);
if (err) {
release_resource(r1);
release_resource(r2);
free_netdev(dev);
return err;
}
zorro_set_drvdata(z, dev);
return 0;
}
static void __exit a2065_cleanup(void)
static void __devexit a2065_remove_one(struct zorro_dev *z)
{
#ifdef MODULE
struct lance_private *next;
struct net_device *dev;
struct net_device *dev = zorro_get_drvdata(z);
while (root_a2065_dev) {
next = root_a2065_dev->next_module;
dev = root_a2065_dev->dev;
unregister_netdev(dev);
release_mem_region(ZTWO_PADDR(dev->base_addr),
sizeof(struct lance_regs));
release_mem_region(ZTWO_PADDR(dev->mem_start), A2065_RAM_SIZE);
free_netdev(dev);
root_a2065_dev = next;
}
#endif
unregister_netdev(dev);
release_mem_region(ZTWO_PADDR(dev->base_addr),
sizeof(struct lance_regs));
release_mem_region(ZTWO_PADDR(dev->mem_start), A2065_RAM_SIZE);
free_netdev(dev);
}
static int __init a2065_init_module(void)
{
return zorro_module_init(&a2065_driver);
}
module_init(a2065_probe);
module_exit(a2065_cleanup);
static void __exit a2065_cleanup_module(void)
{
zorro_unregister_driver(&a2065_driver);
}
module_init(a2065_init_module);
module_exit(a2065_cleanup_module);
MODULE_LICENSE("GPL");
/*
* Amiga Linux/m68k Ariadne Ethernet Driver
*
* Copyright 1995 by Geert Uytterhoeven (geert@linux-m68k.org)
* Peter De Schrijver
* (Peter.DeSchrijver@linux.cc.kuleuven.ac.be)
* Copyright 1995-2003 by Geert Uytterhoeven (geert@linux-m68k.org)
* Peter De Schrijver (p2@mind.be)
*
* ---------------------------------------------------------------------------
*
......@@ -101,8 +100,6 @@ struct ariadne_private {
int dirty_tx; /* The ring entries to be free()ed. */
struct net_device_stats stats;
char tx_full;
struct net_device *dev; /* Backpointer */
struct ariadne_private *next_module;
};
......@@ -117,10 +114,6 @@ struct lancedata {
u_short rx_buff[RX_RING_SIZE][PKT_BUF_SIZE/sizeof(u_short)];
};
#ifdef MODULE
static struct ariadne_private *root_ariadne_dev;
#endif
static int ariadne_open(struct net_device *dev);
static void ariadne_init_ring(struct net_device *dev);
static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev);
......@@ -146,78 +139,89 @@ static void memcpyw(volatile u_short *dest, u_short *src, int len)
}
static int __init ariadne_probe(void)
static int __devinit ariadne_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent);
static void __devexit ariadne_remove_one(struct zorro_dev *z);
static struct zorro_device_id ariadne_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_VILLAGE_TRONIC_ARIADNE },
{ 0 }
};
static struct zorro_driver ariadne_driver = {
.name = "ariadne",
.id_table = ariadne_zorro_tbl,
.probe = ariadne_init_one,
.remove = __devexit_p(ariadne_remove_one),
};
static int __devinit ariadne_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
struct zorro_dev *z = NULL;
unsigned long board = z->resource.start;
unsigned long base_addr = board+ARIADNE_LANCE;
unsigned long mem_start = board+ARIADNE_RAM;
struct resource *r1, *r2;
struct net_device *dev;
struct ariadne_private *priv;
int res = -ENODEV;
while ((z = zorro_find_device(ZORRO_PROD_VILLAGE_TRONIC_ARIADNE, z))) {
unsigned long board = z->resource.start;
unsigned long base_addr = board+ARIADNE_LANCE;
unsigned long mem_start = board+ARIADNE_RAM;
struct resource *r1, *r2;
r1 = request_mem_region(base_addr, sizeof(struct Am79C960),
"Am79C960");
if (!r1) continue;
r2 = request_mem_region(mem_start, ARIADNE_RAM_SIZE, "RAM");
if (!r2) {
release_resource(r1);
continue;
}
int err;
r1 = request_mem_region(base_addr, sizeof(struct Am79C960), "Am79C960");
if (!r1)
return -EBUSY;
r2 = request_mem_region(mem_start, ARIADNE_RAM_SIZE, "RAM");
if (!r2) {
release_resource(r1);
return -EBUSY;
}
dev = alloc_etherdev(sizeof(struct ariadne_private));
dev = alloc_etherdev(sizeof(struct ariadne_private));
if (dev == NULL) {
release_resource(r1);
release_resource(r2);
return -ENOMEM;
}
if (dev == NULL) {
release_resource(r1);
release_resource(r2);
return -ENOMEM;
}
SET_MODULE_OWNER(dev);
priv = dev->priv;
r1->name = dev->name;
r2->name = dev->name;
priv->dev = dev;
dev->dev_addr[0] = 0x00;
dev->dev_addr[1] = 0x60;
dev->dev_addr[2] = 0x30;
dev->dev_addr[3] = (z->rom.er_SerialNumber>>16) & 0xff;
dev->dev_addr[4] = (z->rom.er_SerialNumber>>8) & 0xff;
dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
printk("%s: Ariadne at 0x%08lx, Ethernet Address "
"%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, board,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
dev->base_addr = ZTWO_VADDR(base_addr);
dev->mem_start = ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start+ARIADNE_RAM_SIZE;
dev->open = &ariadne_open;
dev->stop = &ariadne_close;
dev->hard_start_xmit = &ariadne_start_xmit;
dev->tx_timeout = &ariadne_tx_timeout;
dev->watchdog_timeo = 5*HZ;
dev->get_stats = &ariadne_get_stats;
dev->set_multicast_list = &set_multicast_list;
res = register_netdev(dev);
if (res) {
release_resource(r1);
release_resource(r2);
free_netdev(dev);
break;
}
#ifdef MODULE
priv->next_module = root_ariadne_dev;
root_ariadne_dev = priv;
#endif
SET_MODULE_OWNER(dev);
priv = dev->priv;
r1->name = dev->name;
r2->name = dev->name;
dev->dev_addr[0] = 0x00;
dev->dev_addr[1] = 0x60;
dev->dev_addr[2] = 0x30;
dev->dev_addr[3] = (z->rom.er_SerialNumber>>16) & 0xff;
dev->dev_addr[4] = (z->rom.er_SerialNumber>>8) & 0xff;
dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
printk("%s: Ariadne at 0x%08lx, Ethernet Address "
"%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, board,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
dev->base_addr = ZTWO_VADDR(base_addr);
dev->mem_start = ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start+ARIADNE_RAM_SIZE;
dev->open = &ariadne_open;
dev->stop = &ariadne_close;
dev->hard_start_xmit = &ariadne_start_xmit;
dev->tx_timeout = &ariadne_tx_timeout;
dev->watchdog_timeo = 5*HZ;
dev->get_stats = &ariadne_get_stats;
dev->set_multicast_list = &set_multicast_list;
err = register_netdev(dev);
if (err) {
release_resource(r1);
release_resource(r2);
free_netdev(dev);
return err;
}
return res;
zorro_set_drvdata(z, dev);
return 0;
}
......@@ -846,25 +850,27 @@ static void set_multicast_list(struct net_device *dev)
}
static void __exit ariadne_cleanup(void)
static void __devexit ariadne_remove_one(struct zorro_dev *z)
{
#ifdef MODULE
struct ariadne_private *next;
struct net_device *dev;
struct net_device *dev = zorro_get_drvdata(z);
while (root_ariadne_dev) {
next = root_ariadne_dev->next_module;
dev = root_ariadne_dev->dev;
unregister_netdev(dev);
release_mem_region(ZTWO_PADDR(dev->base_addr), sizeof(struct Am79C960));
release_mem_region(ZTWO_PADDR(dev->mem_start), ARIADNE_RAM_SIZE);
free_netdev(dev);
root_ariadne_dev = next;
}
#endif
unregister_netdev(dev);
release_mem_region(ZTWO_PADDR(dev->base_addr), sizeof(struct Am79C960));
release_mem_region(ZTWO_PADDR(dev->mem_start), ARIADNE_RAM_SIZE);
free_netdev(dev);
}
static int __init ariadne_init_module(void)
{
return zorro_module_init(&ariadne_driver);
}
static void __exit ariadne_cleanup_module(void)
{
zorro_unregister_driver(&ariadne_driver);
}
module_init(ariadne_probe);
module_exit(ariadne_cleanup);
module_init(ariadne_init_module);
module_exit(ariadne_cleanup_module);
MODULE_LICENSE("GPL");
......@@ -484,7 +484,7 @@ static HADDR
!acsi_wait_for_IRQ(TIMEOUTDMA) ||
get_status())
goto bad;
ret = phys_to_virt(&(((DMAHWADDR *)buffer)->hwaddr));
ret = phys_to_virt((unsigned long)&(((DMAHWADDR *)buffer)->hwaddr));
dma_cache_maintenance((unsigned long)buffer, 512, 0);
bad:
return (ret);
......
......@@ -1468,8 +1468,7 @@ static int __init dgrs_eisa_probe (struct device *gendev)
int rc = -ENODEV; /* Not EISA configured */
if (!request_region(io, 256, "RightSwitch")) {
printk(KERN_ERR "%s: io 0x%3lX, which is busy.\n", dev->name,
dev->base_addr);
printk(KERN_ERR "dgrs: eisa io 0x%x, which is busy.\n", io);
return -EBUSY;
}
......
......@@ -132,6 +132,10 @@
*
* Thanks to JC (jchapman@katalix.com) for helping with
* testing/troubleshooting the development driver.
*
* TODO:
* o several entry points race with dev->close
* o check for tx-no-resources/stop Q races with tx clean/wake Q
*/
#include <linux/config.h>
......@@ -154,12 +158,12 @@
#define DRV_NAME "e100"
#define DRV_VERSION "3.0.13_dev"
#define DRV_VERSION "3.0.15"
#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"
#define DRV_COPYRIGHT "Copyright(c) 1999-2004 Intel Corporation"
#define PFX DRV_NAME ": "
#define E100_WATCHDOG_PERIOD 2 * HZ
#define E100_WATCHDOG_PERIOD (2 * HZ)
#define E100_NAPI_WEIGHT 16
MODULE_DESCRIPTION(DRV_DESCRIPTION);
......@@ -293,6 +297,11 @@ enum scb_cmd_lo {
cuc_dump_reset = 0x70,
};
enum cuc_dump {
cuc_dump_complete = 0x0000A005,
cuc_dump_reset_complete = 0x0000A007,
};
enum port {
software_reset = 0x0000,
selftest = 0x0001,
......@@ -645,6 +654,7 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data)
eecs | eedi : eecs;
writeb(ctrl, &nic->csr->eeprom_ctrl_lo);
e100_write_flush(nic); udelay(4);
writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo);
e100_write_flush(nic); udelay(4);
}
......@@ -678,8 +688,10 @@ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs;
writeb(ctrl, &nic->csr->eeprom_ctrl_lo);
e100_write_flush(nic); udelay(4);
writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo);
e100_write_flush(nic); udelay(4);
/* Eeprom drives a dummy zero to EEDO after receiving
* complete address. Use this to adjust addr_len. */
ctrl = readb(&nic->csr->eeprom_ctrl_lo);
......@@ -687,6 +699,7 @@ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
*addr_len -= (i - 16);
i = 17;
}
data = (data << 1) | (ctrl & eedo ? 1 : 0);
}
......@@ -807,6 +820,7 @@ static inline int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
/* Order is important otherwise we'll be in a race with h/w:
* set S-bit in current first, then clear S-bit in previous. */
cb->command |= cpu_to_le16(cb_s);
wmb();
cb->prev->command &= cpu_to_le16(~cb_s);
while(nic->cb_to_send != nic->cb_to_use) {
......@@ -1113,7 +1127,7 @@ static void e100_update_stats(struct nic *nic)
* complete, so where always waiting for results of the
* previous command. */
if(*complete == le32_to_cpu(0x0000A007)) {
if(*complete == le32_to_cpu(cuc_dump_reset_complete)) {
*complete = 0;
nic->tx_frames = le32_to_cpu(s->tx_good_frames);
nic->tx_collisions = le32_to_cpu(s->tx_total_collisions);
......@@ -1126,7 +1140,6 @@ static void e100_update_stats(struct nic *nic)
le32_to_cpu(s->tx_lost_crs);
ns->rx_dropped += le32_to_cpu(s->rx_resource_errors);
ns->rx_length_errors += le32_to_cpu(s->rx_short_frame_errors);
ns->rx_over_errors += le32_to_cpu(s->rx_resource_errors);
ns->rx_crc_errors += le32_to_cpu(s->rx_crc_errors);
ns->rx_frame_errors += le32_to_cpu(s->rx_alignment_errors);
ns->rx_fifo_errors += le32_to_cpu(s->rx_overrun_errors);
......@@ -1262,7 +1275,7 @@ static inline int e100_tx_clean(struct nic *nic)
for(cb = nic->cb_to_clean;
cb->status & cpu_to_le16(cb_complete);
cb = nic->cb_to_clean = cb->next) {
if(likely(cb->skb)) {
if(likely(cb->skb != NULL)) {
nic->net_stats.tx_packets++;
nic->net_stats.tx_bytes += cb->skb->len;
......@@ -1371,6 +1384,7 @@ static inline int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
put_unaligned(cpu_to_le32(rx->dma_addr),
(u32 *)&prev_rfd->link);
wmb();
prev_rfd->command &= ~cpu_to_le16(cb_el);
pci_dma_sync_single(nic->pdev, rx->prev->dma_addr,
sizeof(struct rfd), PCI_DMA_TODEVICE);
......@@ -1417,9 +1431,14 @@ static inline int e100_rx_indicate(struct nic *nic, struct rx *rx,
skb_put(skb, actual_size);
skb->protocol = eth_type_trans(skb, nic->netdev);
if(unlikely(!(rfd_status & cb_ok)) ||
actual_size > nic->netdev->mtu + VLAN_ETH_HLEN) {
/* Don't indicate if errors */
if(unlikely(!(rfd_status & cb_ok))) {
/* Don't indicate if hardware indicates errors */
nic->net_stats.rx_dropped++;
dev_kfree_skb_any(skb);
} else if(actual_size > nic->netdev->mtu + VLAN_ETH_HLEN) {
/* Don't indicate oversized frames */
nic->net_stats.rx_over_errors++;
nic->net_stats.rx_dropped++;
dev_kfree_skb_any(skb);
} else {
nic->net_stats.rx_packets++;
......
......@@ -113,7 +113,7 @@ struct e1000_adapter;
#define E1000_SMARTSPEED_MAX 15
/* Packet Buffer allocations */
#define E1000_TX_FIFO_SIZE_SHIFT 0xA
#define E1000_PBA_BYTES_SHIFT 0xA
#define E1000_TX_HEAD_ADDR_SHIFT 7
#define E1000_PBA_TX_MASK 0xFFFF0000
......
......@@ -1540,7 +1540,7 @@ struct e1000_hw {
#define PBA_SIZE 4
/* Collision related configuration parameters */
#define E1000_COLLISION_THRESHOLD 16
#define E1000_COLLISION_THRESHOLD 15
#define E1000_CT_SHIFT 4
#define E1000_COLLISION_DISTANCE 64
#define E1000_FDX_COLLISION_DISTANCE E1000_COLLISION_DISTANCE
......
......@@ -68,7 +68,7 @@
char e1000_driver_name[] = "e1000";
char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
char e1000_driver_version[] = "5.2.30.1-k1";
char e1000_driver_version[] = "5.2.30.1-k2";
char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table
......@@ -328,14 +328,16 @@ e1000_reset(struct e1000_adapter *adapter)
adapter->tx_fifo_head = 0;
adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
adapter->tx_fifo_size =
(E1000_PBA_40K - pba) << E1000_TX_FIFO_SIZE_SHIFT;
(E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
atomic_set(&adapter->tx_fifo_stall, 0);
}
E1000_WRITE_REG(&adapter->hw, PBA, pba);
/* flow control settings */
adapter->hw.fc_high_water = pba - E1000_FC_HIGH_DIFF;
adapter->hw.fc_low_water = pba - E1000_FC_LOW_DIFF;
adapter->hw.fc_high_water =
(pba << E1000_PBA_BYTES_SHIFT) - E1000_FC_HIGH_DIFF;
adapter->hw.fc_low_water =
(pba << E1000_PBA_BYTES_SHIFT) - E1000_FC_LOW_DIFF;
adapter->hw.fc_pause_time = E1000_FC_PAUSE_TIME;
adapter->hw.fc_send_xon = 1;
adapter->hw.fc = adapter->hw.original_fc;
......@@ -472,9 +474,14 @@ e1000_probe(struct pci_dev *pdev,
}
#ifdef NETIF_F_TSO
#ifdef BROKEN_ON_NON_IA_ARCHS
/* Disbaled for now until root-cause is found for
* hangs reported against non-IA archs. TSO can be
* enabled using ethtool -K eth<x> tso on */
if((adapter->hw.mac_type >= e1000_82544) &&
(adapter->hw.mac_type != e1000_82547))
netdev->features |= NETIF_F_TSO;
#endif
#endif
if(pci_using_dac)
......@@ -522,7 +529,8 @@ e1000_probe(struct pci_dev *pdev,
INIT_WORK(&adapter->tx_timeout_task,
(void (*)(void *))e1000_tx_timeout_task, netdev);
register_netdev(netdev);
if((err = register_netdev(netdev)))
goto err_register;
/* we're going to reset, so assume we have no link for now */
......@@ -567,6 +575,7 @@ e1000_probe(struct pci_dev *pdev,
cards_found++;
return 0;
err_register:
err_sw_init:
err_eeprom:
iounmap(adapter->hw.hw_addr);
......@@ -2124,26 +2133,10 @@ e1000_intr(int irq, void *data, struct pt_regs *regs)
__netif_rx_schedule(netdev);
}
#else
/* Writing IMC and IMS is needed for 82547.
Due to Hub Link bus being occupied, an interrupt
de-assertion message is not able to be sent.
When an interrupt assertion message is generated later,
two messages are re-ordered and sent out.
That causes APIC to think 82547 is in de-assertion
state, while 82547 is in assertion state, resulting
in dead lock. Writing IMC forces 82547 into
de-assertion state.
*/
if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)
e1000_irq_disable(adapter);
for(i = 0; i < E1000_MAX_INTR; i++)
if(!e1000_clean_rx_irq(adapter) &
!e1000_clean_tx_irq(adapter))
break;
if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)
e1000_irq_enable(adapter);
#endif
return IRQ_HANDLED;
......
......@@ -47,7 +47,7 @@
BUG(); \
} else { \
set_current_state(TASK_UNINTERRUPTIBLE); \
schedule_timeout((x * HZ)/1000); \
schedule_timeout((x * HZ)/1000 + 2); \
} } while(0)
#endif
......
......@@ -44,10 +44,10 @@
#define WORDSWAP(a) ((((a)>>8)&0xff) | ((a)<<8))
static struct net_device *root_hydra_dev;
static int __init hydra_probe(void);
static int __init hydra_init(unsigned long board);
static int __devinit hydra_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent);
static int __devinit hydra_init(struct zorro_dev *z);
static int hydra_open(struct net_device *dev);
static int hydra_close(struct net_device *dev);
static void hydra_reset_8390(struct net_device *dev);
......@@ -57,34 +57,38 @@ static void hydra_block_input(struct net_device *dev, int count,
struct sk_buff *skb, int ring_offset);
static void hydra_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page);
static void __exit hydra_cleanup(void);
static int __init hydra_probe(void)
static void __devexit hydra_remove_one(struct zorro_dev *z);
static struct zorro_device_id hydra_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET },
{ 0 }
};
static struct zorro_driver hydra_driver = {
.name = "hydra",
.id_table = hydra_zorro_tbl,
.probe = hydra_init_one,
.remove = __devexit_p(hydra_remove_one),
};
static int __devinit hydra_init_one(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
struct zorro_dev *z = NULL;
unsigned long board;
int err = -ENODEV;
while ((z = zorro_find_device(ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET, z))) {
board = z->resource.start;
if (!request_mem_region(board, 0x10000, "Hydra"))
continue;
if ((err = hydra_init(ZTWO_VADDR(board)))) {
release_mem_region(board, 0x10000);
return err;
}
err = 0;
}
if (err == -ENODEV)
printk("No Hydra ethernet card found.\n");
int err;
return err;
if (!request_mem_region(z->resource.start, 0x10000, "Hydra"))
return -EBUSY;
if ((err = hydra_init(z))) {
release_mem_region(z->resource.start, 0x10000);
return -EBUSY;
}
return 0;
}
static int __init hydra_init(unsigned long board)
static int __devinit hydra_init(struct zorro_dev *z)
{
struct net_device *dev;
unsigned long board = ZTWO_VADDR(z->resource.start);
unsigned long ioaddr = board+HYDRA_NIC_BASE;
const char name[] = "NE2000";
int start_page, stop_page;
......@@ -119,7 +123,7 @@ static int __init hydra_init(unsigned long board)
return -EAGAIN;
}
printk("%s: hydra at 0x%08lx, address %02x:%02x:%02x:%02x:%02x:%02x (hydra.c " HYDRA_VERSION ")\n", dev->name, ZTWO_PADDR(board),
printk("%s: hydra at 0x%08lx, address %02x:%02x:%02x:%02x:%02x:%02x (hydra.c " HYDRA_VERSION ")\n", dev->name, z->resource.start,
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
......@@ -143,13 +147,16 @@ static int __init hydra_init(unsigned long board)
root_hydra_dev = dev;
#endif
NS8390_init(dev, 0);
err = register_netdev(dev);
if (!err)
return 0;
if (err) {
free_irq(IRQ_AMIGA_PORTS, dev);
free_netdev(dev);
return err;
}
free_irq(IRQ_AMIGA_PORTS, dev);
free_netdev(dev);
return err;
zorro_set_drvdata(z, dev);
return 0;
}
static int hydra_open(struct net_device *dev)
......@@ -220,20 +227,27 @@ static void hydra_block_output(struct net_device *dev, int count,
z_memcpy_toio(mem_base+((start_page - NESM_START_PG)<<8), buf, count);
}
static void __exit hydra_cleanup(void)
static void __devexit hydra_remove_one(struct zorro_dev *z)
{
struct net_device *dev, *next;
struct net_device *dev = zorro_get_drvdata(z);
while ((dev = root_hydra_dev)) {
next = (struct net_device *)(ei_status.priv);
unregister_netdev(dev);
free_irq(IRQ_AMIGA_PORTS, dev);
release_mem_region(ZTWO_PADDR(dev->base_addr)-HYDRA_NIC_BASE, 0x10000);
free_netdev(dev);
root_hydra_dev = next;
}
unregister_netdev(dev);
free_irq(IRQ_AMIGA_PORTS, dev);
release_mem_region(ZTWO_PADDR(dev->base_addr)-HYDRA_NIC_BASE, 0x10000);
free_netdev(dev);
}
static int __init hydra_init_module(void)
{
return zorro_module_init(&hydra_driver);
}
static void __exit hydra_cleanup_module(void)
{
zorro_unregister_driver(&hydra_driver);
}
module_init(hydra_probe);
module_exit(hydra_cleanup);
module_init(hydra_init_module);
module_exit(hydra_cleanup_module);
MODULE_LICENSE("GPL");
......@@ -155,44 +155,39 @@ setup_hw_rings(struct au1k_private *aup, u32 rx_base, u32 tx_base)
}
}
/*
* Device has already been stopped at this point.
*/
static void au1k_irda_net_uninit(struct net_device *dev)
{
dev->hard_start_xmit = NULL;
dev->open = NULL;
dev->stop = NULL;
dev->do_ioctl = NULL;
dev->get_stats = NULL;
dev->priv = NULL;
}
static int au1k_irda_init(void)
{
static unsigned version_printed = 0;
struct au1k_private *aup;
struct net_device *dev;
int err;
if (version_printed++ == 0) printk(version);
rtnl_lock();
dev = dev_alloc("irda%d", &err);
if (dev) {
dev->irq = AU1000_IRDA_RX_INT; /* TX has its own interrupt */
dev->init = au1k_irda_net_init;
dev->uninit = au1k_irda_net_uninit;
err = register_netdevice(dev);
if (err)
kfree(dev);
else
ir_devs[0] = dev;
printk(KERN_INFO "IrDA: Registered device %s\n", dev->name);
}
rtnl_unlock();
dev = alloc_irdadev(sizeof(struct au1k_private));
if (!dev)
return -ENOMEM;
dev->irq = AU1000_IRDA_RX_INT; /* TX has its own interrupt */
err = au1k_irda_net_init(dev);
if (err)
goto out;
err = register_netdev(dev);
if (err)
goto out1;
ir_devs[0] = dev;
printk(KERN_INFO "IrDA: Registered device %s\n", dev->name);
return 0;
out1:
aup = dev->priv;
dma_free((void *)aup->db[0].vaddr,
MAX_BUF_SIZE * 2*NUM_IR_DESC);
dma_free((void *)aup->rx_ring[0],
2 * MAX_NUM_IR_DESC*(sizeof(ring_dest_t)));
kfree(aup->rx_buff.head);
out:
free_netdev(dev);
return err;
}
......@@ -210,22 +205,14 @@ static int au1k_irda_init_iobuf(iobuff_t *io, int size)
static int au1k_irda_net_init(struct net_device *dev)
{
struct au1k_private *aup = NULL;
struct au1k_private *aup = dev->priv;
int i, retval = 0, err;
db_dest_t *pDB, *pDBfree;
unsigned long temp;
dev->priv = kmalloc(sizeof(struct au1k_private), GFP_KERNEL);
if (dev->priv == NULL) {
retval = -ENOMEM;
goto out;
}
memset(dev->priv, 0, sizeof(struct au1k_private));
aup = dev->priv;
err = au1k_irda_init_iobuf(&aup->rx_buff, 14384);
if (err)
goto out;
goto out1;
dev->open = au1k_irda_start;
dev->hard_start_xmit = au1k_irda_hard_xmit;
......@@ -234,7 +221,6 @@ static int au1k_irda_net_init(struct net_device *dev)
dev->do_ioctl = au1k_irda_ioctl;
dev->tx_timeout = au1k_tx_timeout;
irda_device_setup(dev);
irda_init_max_qos_capabilies(&aup->qos);
/* The only value we must override it the baudrate */
......@@ -244,19 +230,20 @@ static int au1k_irda_net_init(struct net_device *dev)
aup->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&aup->qos);
retval = -ENOMEM;
/* Tx ring follows rx ring + 512 bytes */
/* we need a 1k aligned buffer */
aup->rx_ring[0] = (ring_dest_t *)
dma_alloc(2*MAX_NUM_IR_DESC*(sizeof(ring_dest_t)), &temp);
if (!aup->rx_ring[0])
goto out2;
/* allocate the data buffers */
aup->db[0].vaddr =
(void *)dma_alloc(MAX_BUF_SIZE * 2*NUM_IR_DESC, &temp);
if (!aup->db[0].vaddr || !aup->rx_ring[0]) {
retval = -ENOMEM;
goto out;
}
if (!aup->db[0].vaddr)
goto out3;
setup_hw_rings(aup, (u32)aup->rx_ring[0], (u32)aup->rx_ring[0] + 512);
......@@ -296,19 +283,13 @@ static int au1k_irda_net_init(struct net_device *dev)
}
return 0;
out:
if (aup->db[0].vaddr)
dma_free((void *)aup->db[0].vaddr,
MAX_BUF_SIZE * 2*NUM_IR_DESC);
if (aup->rx_ring[0])
kfree((void *)aup->rx_ring[0]);
if (aup->rx_buff.head)
kfree(aup->rx_buff.head);
if (dev->priv != NULL)
kfree(dev->priv);
unregister_netdevice(dev);
printk(KERN_ERR "%s: au1k_init_module failed. Returns %d\n",
dev->name, retval);
out3:
dma_free((void *)aup->rx_ring[0],
2 * MAX_NUM_IR_DESC*(sizeof(ring_dest_t)));
out2:
kfree(aup->rx_buff.head);
out1:
printk(KERN_ERR "au1k_init_module failed. Returns %d\n", retval);
return retval;
}
......@@ -427,24 +408,14 @@ static void __exit au1k_irda_exit(void)
struct net_device *dev = ir_devs[0];
struct au1k_private *aup = (struct au1k_private *) dev->priv;
if (!dev) {
printk(KERN_ERR "au1k_ircc no dev found\n");
return;
}
if (aup->db[0].vaddr) {
dma_free((void *)aup->db[0].vaddr,
MAX_BUF_SIZE * 2*NUM_IR_DESC);
aup->db[0].vaddr = 0;
}
if (aup->rx_ring[0]) {
dma_free((void *)aup->rx_ring[0],
2*MAX_NUM_IR_DESC*(sizeof(ring_dest_t)));
aup->rx_ring[0] = 0;
}
rtnl_lock();
unregister_netdevice(dev);
rtnl_unlock();
ir_devs[0] = 0;
unregister_netdev(dev);
dma_free((void *)aup->db[0].vaddr,
MAX_BUF_SIZE * 2*NUM_IR_DESC);
dma_free((void *)aup->rx_ring[0],
2 * MAX_NUM_IR_DESC*(sizeof(ring_dest_t)));
kfree(aup->rx_buff.head);
free_netdev(dev);
}
......
......@@ -1163,10 +1163,11 @@ static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = dev_id;
pcnet_dev_t *info = PRIV(dev);
info->stale = 0;
ei_interrupt(irq, dev_id, regs);
/* FIXME! Was it really ours? */
return IRQ_HANDLED;
irqreturn_t ret = ei_interrupt(irq, dev_id, regs);
if (ret == IRQ_HANDLED)
info->stale = 0;
return ret;
}
static void ei_watchdog(u_long arg)
......
......@@ -342,7 +342,7 @@ static int __init lance_probe( struct net_device *dev)
REGA(CSR0) = CSR0_STOP;
request_irq(LANCE_IRQ, lance_interrupt, 0, "SUN3 Lance", dev);
request_irq(LANCE_IRQ, lance_interrupt, SA_INTERRUPT, "SUN3 Lance", dev);
dev->irq = (unsigned short)LANCE_IRQ;
......@@ -505,6 +505,9 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
struct lance_tx_head *head;
unsigned long flags;
DPRINTK( 1, ( "%s: transmit start.\n",
dev->name));
/* Transmitter timeout, serious problems. */
if (netif_queue_stopped(dev)) {
int tickssofar = jiffies - dev->trans_start;
......
......@@ -20,9 +20,6 @@
* different length.
*/
#if defined(CONFIG_3C359) || defined(CONFIG_3C359_MODULE)
static int mc_size = 24880 ;
u8 microcode[] = {
......@@ -1582,4 +1579,3 @@ u8 microcode[] = {
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x90,0xea,0xc0,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x13,0x06
} ;
#endif
......@@ -329,6 +329,9 @@ struct xircom_private {
int saved_if_port;
struct pci_dev *pdev;
spinlock_t lock;
#ifdef CONFIG_PM
u32 pci_state[16];
#endif
};
static int mdio_read(struct net_device *dev, int phy_id, int location);
......@@ -340,6 +343,7 @@ static void xircom_tx_timeout(struct net_device *dev);
static void xircom_init_ring(struct net_device *dev);
static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev);
static int xircom_rx(struct net_device *dev);
static void xircom_media_change(struct net_device *dev);
static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
static int xircom_close(struct net_device *dev);
static struct net_device_stats *xircom_get_stats(struct net_device *dev);
......@@ -749,6 +753,7 @@ xircom_up(struct net_device *dev)
long ioaddr = dev->base_addr;
int i;
xircom_init_ring(dev);
/* Clear the tx ring */
for (i = 0; i < TX_RING_SIZE; i++) {
tp->tx_skbuff[i] = 0;
......@@ -785,6 +790,9 @@ xircom_up(struct net_device *dev)
/* Tell the net layer we're ready */
netif_start_queue (dev);
/* Check current media state */
xircom_media_change(dev);
if (xircom_debug > 2) {
printk(KERN_DEBUG "%s: Done xircom_up(), CSR0 %8.8x, CSR5 %8.8x CSR6 %8.8x.\n",
dev->name, inl(ioaddr + CSR0), inl(ioaddr + CSR5),
......@@ -801,8 +809,6 @@ xircom_open(struct net_device *dev)
if (request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev))
return -EAGAIN;
xircom_init_ring(dev);
xircom_up(dev);
tp->open = 1;
......@@ -1011,6 +1017,7 @@ static void xircom_media_change(struct net_device *dev)
dev->name,
tp->speed100 ? "100" : "10",
tp->full_duplex ? "full" : "half");
netif_carrier_on(dev);
newcsr6 = csr6 & ~FullDuplexBit;
if (tp->full_duplex)
newcsr6 |= FullDuplexBit;
......@@ -1018,6 +1025,7 @@ static void xircom_media_change(struct net_device *dev)
outl_CSR6(newcsr6, ioaddr + CSR6);
} else {
printk(KERN_DEBUG "%s: Link is down\n", dev->name);
netif_carrier_off(dev);
}
}
......@@ -1668,6 +1676,11 @@ static int xircom_suspend(struct pci_dev *pdev, u32 state)
printk(KERN_INFO "xircom_suspend(%s)\n", dev->name);
if (tp->open)
xircom_down(dev);
pci_save_state(pdev, tp->pci_state);
pci_disable_device(pdev);
pci_set_power_state(pdev, 3);
return 0;
}
......@@ -1678,6 +1691,10 @@ static int xircom_resume(struct pci_dev *pdev)
struct xircom_private *tp = dev->priv;
printk(KERN_INFO "xircom_resume(%s)\n", dev->name);
pci_set_power_state(pdev,0);
pci_enable_device(pdev);
pci_restore_state(pdev, tp->pci_state);
/* Bring the chip out of sleep mode.
Caution: Snooze mode does not work with some boards! */
if (xircom_tbl[tp->chip_id].flags & HAS_ACPI)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment