Commit 15902084 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents b9dd83f2 a242ed69
...@@ -248,6 +248,8 @@ static struct pci_device_id rtl8139_pci_tbl[] = { ...@@ -248,6 +248,8 @@ static struct pci_device_id rtl8139_pci_tbl[] = {
{0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, {0x14ea, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, {0x14ea, 0xab07, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, {0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1432, 0x9130, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x02ac, 0x1012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
#ifdef CONFIG_SH_SECUREEDGE5410 #ifdef CONFIG_SH_SECUREEDGE5410
/* Bogus 8139 silicon reports 8129 without external PROM :-( */ /* Bogus 8139 silicon reports 8129 without external PROM :-( */
......
...@@ -1616,7 +1616,7 @@ config SUNDANCE_MMIO ...@@ -1616,7 +1616,7 @@ config SUNDANCE_MMIO
config TLAN config TLAN
tristate "TI ThunderLAN support" tristate "TI ThunderLAN support"
depends on NET_PCI && (PCI || EISA) depends on NET_PCI && (PCI || EISA) && !64BIT
---help--- ---help---
If you have a PCI Ethernet network card based on the ThunderLAN chip If you have a PCI Ethernet network card based on the ThunderLAN chip
which is supported by this driver, say Y and read the which is supported by this driver, say Y and read the
...@@ -2412,7 +2412,7 @@ config IPHASE5526 ...@@ -2412,7 +2412,7 @@ config IPHASE5526
config RCPCI config RCPCI
tristate "Red Creek Hardware VPN (EXPERIMENTAL)" tristate "Red Creek Hardware VPN (EXPERIMENTAL)"
depends on NETDEVICES && EXPERIMENTAL && PCI depends on NETDEVICES && EXPERIMENTAL && PCI && !64BIT
help help
This is a driver for hardware which provides a Virtual Private This is a driver for hardware which provides a Virtual Private
Network (VPN). Say Y if you have it. Network (VPN). Say Y if you have it.
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#define DRV_MODULE_NAME "b44" #define DRV_MODULE_NAME "b44"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "0.9" #define DRV_MODULE_VERSION "0.91"
#define DRV_MODULE_RELDATE "Jul 14, 2003" #define DRV_MODULE_RELDATE "Oct 3, 2003"
#define B44_DEF_MSG_ENABLE \ #define B44_DEF_MSG_ENABLE \
(NETIF_MSG_DRV | \ (NETIF_MSG_DRV | \
...@@ -80,15 +80,6 @@ MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value"); ...@@ -80,15 +80,6 @@ MODULE_PARM_DESC(b44_debug, "B44 bitmapped debugging message enable value");
static int b44_debug = -1; /* -1 == use B44_DEF_MSG_ENABLE as value */ static int b44_debug = -1; /* -1 == use B44_DEF_MSG_ENABLE as value */
#ifndef PCI_DEVICE_ID_BCM4401
#define PCI_DEVICE_ID_BCM4401 0x4401
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define IRQ_RETVAL(x)
#define irqreturn_t void
#endif
static struct pci_device_id b44_pci_tbl[] = { static struct pci_device_id b44_pci_tbl[] = {
{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401, { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BCM4401,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
...@@ -870,6 +861,8 @@ static void b44_tx_timeout(struct net_device *dev) ...@@ -870,6 +861,8 @@ static void b44_tx_timeout(struct net_device *dev)
spin_unlock_irq(&bp->lock); spin_unlock_irq(&bp->lock);
b44_enable_ints(bp);
netif_wake_queue(dev); netif_wake_queue(dev);
} }
......
...@@ -2664,8 +2664,8 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type) ...@@ -2664,8 +2664,8 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type)
static void my_skb_align(struct sk_buff *skb, int n) static void my_skb_align(struct sk_buff *skb, int n)
{ {
u32 x=(u32)skb->data; /* We only want the low bits .. */ unsigned long x=(unsigned long)skb->data;
u32 v; unsigned long v;
v=(x+n-1)&~(n-1); /* Where we want to be */ v=(x+n-1)&~(n-1); /* Where we want to be */
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
/* Change Log /* Change Log
* *
* 5.2.18 9/13/03 * 5.2.20 9/30/03
* o Bug fix: SERDES devices might be connected to a back-plane * o Bug fix: SERDES devices might be connected to a back-plane
* switch that doesn't support auto-neg, so add the capability * switch that doesn't support auto-neg, so add the capability
* to force 1000/Full. * to force 1000/Full.
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
* Jumbo Frames or with the reduced FIFO in 82547. * Jumbo Frames or with the reduced FIFO in 82547.
* o Better propagation of error codes. [Janice Girouard * o Better propagation of error codes. [Janice Girouard
* (janiceg@us.ibm.com)]. * (janiceg@us.ibm.com)].
* o Bug fix: hang under heavy Tx stress when running out of Tx
* descriptors; wasn't clearing context descriptor when backing
* out of send because of no-resource condition.
* *
* 5.2.16 8/8/03 * 5.2.16 8/8/03
* o Added support for new controllers: 82545GM, 82546GB, 82541/7_B1 * o Added support for new controllers: 82545GM, 82546GB, 82541/7_B1
...@@ -61,7 +64,7 @@ ...@@ -61,7 +64,7 @@
char e1000_driver_name[] = "e1000"; char e1000_driver_name[] = "e1000";
char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
char e1000_driver_version[] = "5.2.19-k1"; char e1000_driver_version[] = "5.2.20-k1";
char e1000_copyright[] = "Copyright (c) 1999-2003 Intel Corporation."; char e1000_copyright[] = "Copyright (c) 1999-2003 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table /* e1000_pci_tbl - PCI Device ID Table
...@@ -1545,6 +1548,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, ...@@ -1545,6 +1548,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
unsigned int first) unsigned int first)
{ {
struct e1000_desc_ring *tx_ring = &adapter->tx_ring; struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
struct e1000_tx_desc *tx_desc;
struct e1000_buffer *buffer_info; struct e1000_buffer *buffer_info;
unsigned int len = skb->len, max_per_txd = E1000_MAX_DATA_PER_TXD; unsigned int len = skb->len, max_per_txd = E1000_MAX_DATA_PER_TXD;
unsigned int offset = 0, size, count = 0, i; unsigned int offset = 0, size, count = 0, i;
...@@ -1640,17 +1644,29 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, ...@@ -1640,17 +1644,29 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
} }
} }
if(E1000_DESC_UNUSED(&adapter->tx_ring) < count) { if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) {
/* There aren't enough descriptors available to queue up /* There aren't enough descriptors available to queue up
* this send, so undo the mapping and abort the send. * this send (need: count + 1 context desc + 1 desc gap
* We could have done the check before we mapped the skb, * to keep tail from touching head), so undo the mapping
* but because of all the workarounds (above), it's too * and abort the send. We could have done the check before
* difficult to predict how many we're going to need.*/ * we mapped the skb, but because of all the workarounds
i = first; * (above), it's too difficult to predict how many we're
* going to need.*/
i = adapter->tx_ring.next_to_use;
if(i == first) {
/* Cleanup after e1000_tx_[csum|tso] scribbling
* on descriptors. */
tx_desc = E1000_TX_DESC(*tx_ring, first);
tx_desc->buffer_addr = 0;
tx_desc->lower.data = 0;
tx_desc->upper.data = 0;
}
while(count--) { while(count--) {
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
if(buffer_info->dma) { if(buffer_info->dma) {
pci_unmap_page(adapter->pdev, pci_unmap_page(adapter->pdev,
buffer_info->dma, buffer_info->dma,
...@@ -1658,9 +1674,12 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, ...@@ -1658,9 +1674,12 @@ e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
buffer_info->dma = 0; buffer_info->dma = 0;
} }
if(++i == tx_ring->count) i = 0; if(++i == tx_ring->count) i = 0;
} }
adapter->tx_ring.next_to_use = first;
return 0; return 0;
} }
......
...@@ -196,12 +196,8 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty ...@@ -196,12 +196,8 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
eth = (struct ethhdr *)skb->mac.raw; eth = (struct ethhdr *)skb->mac.raw;
if (!(bpq->acpt_addr[0] & 0x01) && if (!(bpq->acpt_addr[0] & 0x01) &&
memcmp(eth->h_source, bpq->acpt_addr, ETH_ALEN)) { memcmp(eth->h_source, bpq->acpt_addr, ETH_ALEN))
if (net_ratelimit())
printk(KERN_DEBUG "bpqether: wrong dest %s\n",
bpq_print_ethaddr(eth->h_source));
goto drop_unlock; goto drop_unlock;
}
if (skb_cow(skb, sizeof(struct ethhdr))) if (skb_cow(skb, sizeof(struct ethhdr)))
goto drop_unlock; goto drop_unlock;
......
...@@ -1762,7 +1762,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1762,7 +1762,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
#ifndef SCC_DONT_CHECK #ifndef SCC_DONT_CHECK
if(request_region(scc->ctrl, 1, "scc-probe")) if(request_region(hwcfg.ctrl_a, 1, "scc-probe"))
{ {
disable_irq(hwcfg.irq); disable_irq(hwcfg.irq);
Outb(hwcfg.ctrl_a, 0); Outb(hwcfg.ctrl_a, 0);
...@@ -1774,7 +1774,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1774,7 +1774,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (InReg(hwcfg.ctrl_a,R13) != 0x55) if (InReg(hwcfg.ctrl_a,R13) != 0x55)
found = 0; found = 0;
enable_irq(hwcfg.irq); enable_irq(hwcfg.irq);
release_region(scc->ctrl, 1); release_region(hwcfg.ctrl_a, 1);
} }
else else
found = 0; found = 0;
......
...@@ -1265,9 +1265,9 @@ static int hp100_init_rxpdl(struct net_device *dev, ...@@ -1265,9 +1265,9 @@ static int hp100_init_rxpdl(struct net_device *dev,
{ {
/* pdlptr is starting address for this pdl */ /* pdlptr is starting address for this pdl */
if (0 != (((unsigned) pdlptr) & 0xf)) if (0 != (((unsigned long) pdlptr) & 0xf))
printk("hp100: %s: Init rxpdl: Unaligned pdlptr 0x%x.\n", printk("hp100: %s: Init rxpdl: Unaligned pdlptr 0x%lx.\n",
dev->name, (unsigned) pdlptr); dev->name, (unsigned long) pdlptr);
ringptr->pdl = pdlptr + 1; ringptr->pdl = pdlptr + 1;
ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1); ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr + 1);
...@@ -1292,8 +1292,8 @@ static int hp100_init_txpdl(struct net_device *dev, ...@@ -1292,8 +1292,8 @@ static int hp100_init_txpdl(struct net_device *dev,
register hp100_ring_t * ringptr, register hp100_ring_t * ringptr,
register u32 * pdlptr) register u32 * pdlptr)
{ {
if (0 != (((unsigned) pdlptr) & 0xf)) if (0 != (((unsigned long) pdlptr) & 0xf))
printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%x.\n", dev->name, (unsigned) pdlptr); printk("hp100: %s: Init txpdl: Unaligned pdlptr 0x%lx.\n", dev->name, (unsigned long) pdlptr);
ringptr->pdl = pdlptr; /* +1; */ ringptr->pdl = pdlptr; /* +1; */
ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */ ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */
......
...@@ -1530,7 +1530,7 @@ static void drain_tx(struct net_device *dev) ...@@ -1530,7 +1530,7 @@ static void drain_tx(struct net_device *dev)
for (i = 0; i < TX_RING_SIZE; i++) { for (i = 0; i < TX_RING_SIZE; i++) {
if (np->tx_skbuff[i]) { if (np->tx_skbuff[i]) {
pci_unmap_single(np->pci_dev, pci_unmap_single(np->pci_dev,
np->rx_dma[i], np->rx_skbuff[i]->len, np->tx_dma[i], np->tx_skbuff[i]->len,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
dev_kfree_skb(np->tx_skbuff[i]); dev_kfree_skb(np->tx_skbuff[i]);
np->stats.tx_dropped++; np->stats.tx_dropped++;
......
...@@ -681,10 +681,6 @@ static void pcnet_config(dev_link_t *link) ...@@ -681,10 +681,6 @@ static void pcnet_config(dev_link_t *link)
} else { } else {
dev->if_port = 0; dev->if_port = 0;
} }
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
goto failed;
}
hw_info = get_hwinfo(link); hw_info = get_hwinfo(link);
if (hw_info == NULL) if (hw_info == NULL)
...@@ -699,7 +695,6 @@ static void pcnet_config(dev_link_t *link) ...@@ -699,7 +695,6 @@ static void pcnet_config(dev_link_t *link)
if (hw_info == NULL) { if (hw_info == NULL) {
printk(KERN_NOTICE "pcnet_cs: unable to read hardware net" printk(KERN_NOTICE "pcnet_cs: unable to read hardware net"
" address for io base %#3lx\n", dev->base_addr); " address for io base %#3lx\n", dev->base_addr);
unregister_netdev(dev);
goto failed; goto failed;
} }
...@@ -733,8 +728,6 @@ static void pcnet_config(dev_link_t *link) ...@@ -733,8 +728,6 @@ static void pcnet_config(dev_link_t *link)
ei_status.word16 = 1; ei_status.word16 = 1;
ei_status.reset_8390 = &pcnet_reset_8390; ei_status.reset_8390 = &pcnet_reset_8390;
strcpy(info->node.dev_name, dev->name);
link->dev = &info->node;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
if (info->flags & (IS_DL10019|IS_DL10022)) { if (info->flags & (IS_DL10019|IS_DL10022)) {
...@@ -743,6 +736,21 @@ static void pcnet_config(dev_link_t *link) ...@@ -743,6 +736,21 @@ static void pcnet_config(dev_link_t *link)
mii_phy_probe(dev); mii_phy_probe(dev);
if ((id == 0x30) && !info->pna_phy && (info->eth_phy == 4)) if ((id == 0x30) && !info->pna_phy && (info->eth_phy == 4))
info->eth_phy = 0; info->eth_phy = 0;
}
link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
link->dev = NULL;
goto failed;
}
strcpy(info->node.dev_name, dev->name);
if (info->flags & (IS_DL10019|IS_DL10022)) {
u_char id = inb(dev->base_addr + 0x1a);
printk(KERN_INFO "%s: NE2000 (DL100%d rev %02x): ", printk(KERN_INFO "%s: NE2000 (DL100%d rev %02x): ",
dev->name, ((info->flags & IS_DL10022) ? 22 : 19), id); dev->name, ((info->flags & IS_DL10022) ? 22 : 19), id);
if (info->pna_phy) if (info->pna_phy)
...@@ -758,7 +766,6 @@ static void pcnet_config(dev_link_t *link) ...@@ -758,7 +766,6 @@ static void pcnet_config(dev_link_t *link)
printk(" hw_addr "); printk(" hw_addr ");
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n")); printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
link->state &= ~DEV_CONFIG_PENDING;
return; return;
cs_failed: cs_failed:
......
...@@ -224,6 +224,7 @@ static struct pci_device_id tulip_pci_tbl[] = { ...@@ -224,6 +224,7 @@ static struct pci_device_id tulip_pci_tbl[] = {
{ 0x1186, 0x1561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x1186, 0x1561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1626, 0x8410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x1626, 0x8410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1737, 0xAB09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x1737, 0xAB09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x1737, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x17B3, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
{ 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, /* ALi 1563 integrated ethernet */ { 0x10b9, 0x5261, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DM910X }, /* ALi 1563 integrated ethernet */
{ 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */ { 0x10b7, 0x9300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, /* 3Com 3CSOHO100B-TX */
......
...@@ -230,7 +230,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -230,7 +230,8 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
This way, we can fail gracefully if not enough memory This way, we can fail gracefully if not enough memory
is available. is available.
*/ */
if ((dev = init_etherdev(NULL, sizeof(struct xircom_private))) == NULL) { dev = alloc_etherdev(sizeof(struct xircom_private));
if (!dev) {
printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n"); printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n");
goto device_fail; goto device_fail;
} }
...@@ -250,7 +251,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -250,7 +251,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev); SET_NETDEV_DEV(dev, &pdev->dev);
printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq);
private->dev = dev; private->dev = dev;
private->pdev = pdev; private->pdev = pdev;
...@@ -259,7 +260,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -259,7 +260,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->base_addr = private->io_port; dev->base_addr = private->io_port;
initialize_card(private); initialize_card(private);
read_mac_address(private); read_mac_address(private);
setup_descriptors(private); setup_descriptors(private);
...@@ -272,7 +272,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -272,7 +272,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
if (register_netdev(dev)) {
printk(KERN_ERR "xircom_probe: netdevice registration failed.\n");
goto reg_fail;
}
printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq);
/* start the transmitter to get a heartbeat */ /* start the transmitter to get a heartbeat */
/* TODO: send 2 dummy packets here */ /* TODO: send 2 dummy packets here */
transceiver_voodoo(private); transceiver_voodoo(private);
...@@ -287,10 +292,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -287,10 +292,12 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
leave("xircom_probe"); leave("xircom_probe");
return 0; return 0;
reg_fail:
kfree(private->tx_buffer);
tx_buf_fail: tx_buf_fail:
kfree(private->rx_buffer); kfree(private->rx_buffer);
rx_buf_fail: rx_buf_fail:
kfree(dev); free_netdev(dev);
device_fail: device_fail:
return -ENODEV; return -ENODEV;
} }
...@@ -305,22 +312,16 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -305,22 +312,16 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
static void __devexit xircom_remove(struct pci_dev *pdev) static void __devexit xircom_remove(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct xircom_private *card; struct xircom_private *card = dev->priv;
enter("xircom_remove"); enter("xircom_remove");
if (dev!=NULL) { pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle);
card=dev->priv; pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle);
if (card!=NULL) {
if (card->rx_buffer!=NULL)
pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle);
card->rx_buffer = NULL;
if (card->tx_buffer!=NULL)
pci_free_consistent(pdev,8192,card->tx_buffer,card->tx_dma_handle);
card->tx_buffer = NULL;
}
}
release_region(dev->base_addr, 128); release_region(dev->base_addr, 128);
unregister_netdev(dev); unregister_netdev(dev);
free_netdev(dev); free_netdev(dev);
pci_set_drvdata(pdev, NULL);
leave("xircom_remove"); leave("xircom_remove");
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
******************************************************************************/ ******************************************************************************/
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -84,7 +84,7 @@ static u_int irq_mask = 0xdeb8; ...@@ -84,7 +84,7 @@ static u_int irq_mask = 0xdeb8;
static int irq_list[4] = { -1 }; static int irq_list[4] = { -1 };
MODULE_AUTHOR("Simon Kelley"); MODULE_AUTHOR("Simon Kelley");
MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethnet cards."); MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
MODULE_PARM(irq_mask, "i"); MODULE_PARM(irq_mask, "i");
...@@ -404,9 +404,12 @@ static void atmel_config(dev_link_t *link) ...@@ -404,9 +404,12 @@ static void atmel_config(dev_link_t *link)
goto mismatch; goto mismatch;
for (k = 0; k < j; k++) { for (k = 0; k < j; k++) {
while ((*p != '\0') && (*p != '/')) p++; while ((*p != '\0') && (*p != '/')) p++;
if (*p == '\0') if (*p == '\0') {
goto mismatch; if (*q != '\0')
p++; goto mismatch;
} else {
p++;
}
} }
while((*q != '\0') && (*p != '\0') && while((*q != '\0') && (*p != '\0') &&
(*p != '/') && (*p == *q)) p++, q++; (*p != '/') && (*p == *q)) p++, q++;
......
...@@ -307,14 +307,14 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data); ...@@ -307,14 +307,14 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);
* *
* get_eeprom: * get_eeprom:
* Should fill in the magic field. Don't need to check len for zero * Should fill in the magic field. Don't need to check len for zero
* or wraparound but must check offset + len < size. Fill in the data * or wraparound. Fill in the data argument with the eeprom values
* argument with the eeprom values from offset to offset + len. Update * from offset to offset + len. Update len to the amount read.
* len to the amount read. Returns an error or zero. * Returns an error or zero.
* *
* set_eeprom: * set_eeprom:
* Should validate the magic field. Don't need to check len for zero * Should validate the magic field. Don't need to check len for zero
* or wraparound but must check offset + len < size. Update len to * or wraparound. Update len to the amount written. Returns an error
* the amount written. Returns an error or zero. * or zero.
*/ */
struct ethtool_ops { struct ethtool_ops {
int (*get_settings)(struct net_device *, struct ethtool_cmd *); int (*get_settings)(struct net_device *, struct ethtool_cmd *);
...@@ -328,6 +328,7 @@ struct ethtool_ops { ...@@ -328,6 +328,7 @@ struct ethtool_ops {
void (*set_msglevel)(struct net_device *, u32); void (*set_msglevel)(struct net_device *, u32);
int (*nway_reset)(struct net_device *); int (*nway_reset)(struct net_device *);
u32 (*get_link)(struct net_device *); u32 (*get_link)(struct net_device *);
int (*get_eeprom_len)(struct net_device *);
int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
......
...@@ -122,7 +122,8 @@ static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr) ...@@ -122,7 +122,8 @@ static int ethtool_get_drvinfo(struct net_device *dev, void *useraddr)
info.n_stats = ops->get_stats_count(dev); info.n_stats = ops->get_stats_count(dev);
if (ops->get_regs_len) if (ops->get_regs_len)
info.regdump_len = ops->get_regs_len(dev); info.regdump_len = ops->get_regs_len(dev);
/* XXX: eeprom? */ if (ops->get_eeprom_len)
info.eedump_len = ops->get_eeprom_len(dev);
if (copy_to_user(useraddr, &info, sizeof(info))) if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT; return -EFAULT;
...@@ -245,29 +246,34 @@ static int ethtool_get_link(struct net_device *dev, void *useraddr) ...@@ -245,29 +246,34 @@ static int ethtool_get_link(struct net_device *dev, void *useraddr)
static int ethtool_get_eeprom(struct net_device *dev, void *useraddr) static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
{ {
struct ethtool_eeprom eeprom; struct ethtool_eeprom eeprom;
struct ethtool_ops *ops = dev->ethtool_ops;
u8 *data; u8 *data;
int len, ret; int ret;
if (!dev->ethtool_ops->get_eeprom) if (!ops->get_eeprom || !ops->get_eeprom_len)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
return -EFAULT; return -EFAULT;
len = eeprom.len;
/* Check for wrap and zero */ /* Check for wrap and zero */
if (eeprom.offset + len <= eeprom.offset) if (eeprom.offset + eeprom.len <= eeprom.offset)
return -EINVAL;
/* Check for exceeding total eeprom len */
if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
return -EINVAL; return -EINVAL;
data = kmalloc(len, GFP_USER); data = kmalloc(eeprom.len, GFP_USER);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(data, useraddr + sizeof(eeprom), len)) ret = -EFAULT;
return -EFAULT; if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
goto out;
ret = dev->ethtool_ops->get_eeprom(dev, &eeprom, data); ret = ops->get_eeprom(dev, &eeprom, data);
if (!ret) if (ret)
goto out; goto out;
ret = -EFAULT; ret = -EFAULT;
...@@ -285,32 +291,37 @@ static int ethtool_get_eeprom(struct net_device *dev, void *useraddr) ...@@ -285,32 +291,37 @@ static int ethtool_get_eeprom(struct net_device *dev, void *useraddr)
static int ethtool_set_eeprom(struct net_device *dev, void *useraddr) static int ethtool_set_eeprom(struct net_device *dev, void *useraddr)
{ {
struct ethtool_eeprom eeprom; struct ethtool_eeprom eeprom;
struct ethtool_ops *ops = dev->ethtool_ops;
u8 *data; u8 *data;
int len, ret; int ret;
if (!dev->ethtool_ops->set_eeprom) if (!ops->set_eeprom || !ops->get_eeprom_len)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
return -EFAULT; return -EFAULT;
len = eeprom.len;
/* Check for wrap and zero */ /* Check for wrap and zero */
if (eeprom.offset + len <= eeprom.offset) if (eeprom.offset + eeprom.len <= eeprom.offset)
return -EINVAL;
/* Check for exceeding total eeprom len */
if (eeprom.offset + eeprom.len > ops->get_eeprom_len(dev))
return -EINVAL; return -EINVAL;
data = kmalloc(len, GFP_USER); data = kmalloc(eeprom.len, GFP_USER);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(data, useraddr + sizeof(eeprom), len)) ret = -EFAULT;
return -EFAULT; if (copy_from_user(data, useraddr + sizeof(eeprom), eeprom.len))
goto out;
ret = dev->ethtool_ops->set_eeprom(dev, &eeprom, data); ret = ops->set_eeprom(dev, &eeprom, data);
if (ret) if (ret)
goto out; goto out;
if (copy_to_user(useraddr + sizeof(eeprom), data, len)) if (copy_to_user(useraddr + sizeof(eeprom), data, eeprom.len))
ret = -EFAULT; ret = -EFAULT;
out: out:
......
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