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
Merge branch 'for-2.6.25' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerp...
[safe/jmp/linux-2.6]
/
drivers
/
net
/
via-rhine.c
diff --git
a/drivers/net/via-rhine.c
b/drivers/net/via-rhine.c
index
73e9c3d
..
7c851b1
100644
(file)
--- a/
drivers/net/via-rhine.c
+++ b/
drivers/net/via-rhine.c
@@
-42,7
+42,13
@@
static int max_interrupt_work = 20;
/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to > 1518 effectively disables this feature. */
/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to > 1518 effectively disables this feature. */
+#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \
+ || defined(CONFIG_SPARC) || defined(__ia64__) \
+ || defined(__sh__) || defined(__mips__)
+static int rx_copybreak = 1518;
+#else
static int rx_copybreak;
static int rx_copybreak;
+#endif
/* Work-around for broken BIOSes: they are unable to get the chip back out of
power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
/* Work-around for broken BIOSes: they are unable to get the chip back out of
power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
@@
-329,16
+335,16
@@
enum wol_bits {
/* The Rx and Tx buffer descriptors. */
struct rx_desc {
/* The Rx and Tx buffer descriptors. */
struct rx_desc {
-
s
32 rx_status;
-
u
32 desc_length; /* Chain flag, Buffer/frame length */
-
u
32 addr;
-
u
32 next_desc;
+
__le
32 rx_status;
+
__le
32 desc_length; /* Chain flag, Buffer/frame length */
+
__le
32 addr;
+
__le
32 next_desc;
};
struct tx_desc {
};
struct tx_desc {
-
s
32 tx_status;
-
u
32 desc_length; /* Chain flag, Tx Config, Frame length */
-
u
32 addr;
-
u
32 next_desc;
+
__le
32 tx_status;
+
__le
32 desc_length; /* Chain flag, Tx Config, Frame length */
+
__le
32 addr;
+
__le
32 next_desc;
};
/* Initial value for tx_desc.desc_length, Buffer size goes to bits 0-10 */
};
/* Initial value for tx_desc.desc_length, Buffer size goes to bits 0-10 */
@@
-383,6
+389,8
@@
struct rhine_private {
struct pci_dev *pdev;
long pioaddr;
struct pci_dev *pdev;
long pioaddr;
+ struct net_device *dev;
+ struct napi_struct napi;
struct net_device_stats stats;
spinlock_t lock;
struct net_device_stats stats;
spinlock_t lock;
@@
-576,32
+584,29
@@
static void rhine_poll(struct net_device *dev)
#endif
#ifdef CONFIG_VIA_RHINE_NAPI
#endif
#ifdef CONFIG_VIA_RHINE_NAPI
-static int rhine_napipoll(struct n
et_device *dev, int *
budget)
+static int rhine_napipoll(struct n
api_struct *napi, int
budget)
{
{
- struct rhine_private *rp = netdev_priv(dev);
+ struct rhine_private *rp = container_of(napi, struct rhine_private, napi);
+ struct net_device *dev = rp->dev;
void __iomem *ioaddr = rp->base;
void __iomem *ioaddr = rp->base;
- int
done, limit = min(dev->quota, *budget)
;
+ int
work_done
;
- done = rhine_rx(dev, limit);
- *budget -= done;
- dev->quota -= done;
+ work_done = rhine_rx(dev, budget);
- if (
done < limi
t) {
- netif_rx_complete(dev);
+ if (
work_done < budge
t) {
+ netif_rx_complete(dev
, napi
);
iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
IntrRxDropped | IntrRxNoBuf | IntrTxAborted |
IntrTxDone | IntrTxError | IntrTxUnderrun |
IntrPCIErr | IntrStatsMax | IntrLinkChange,
ioaddr + IntrEnable);
iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
IntrRxDropped | IntrRxNoBuf | IntrTxAborted |
IntrTxDone | IntrTxError | IntrTxUnderrun |
IntrPCIErr | IntrStatsMax | IntrLinkChange,
ioaddr + IntrEnable);
- return 0;
}
}
- else
- return 1;
+ return work_done;
}
#endif
}
#endif
-static void rhine_hw_init(struct net_device *dev, long pioaddr)
+static void
__devinit
rhine_hw_init(struct net_device *dev, long pioaddr)
{
struct rhine_private *rp = netdev_priv(dev);
{
struct rhine_private *rp = netdev_priv(dev);
@@
-633,6
+638,7
@@
static int __devinit rhine_init_one(struct pci_dev *pdev,
#else
int bar = 0;
#endif
#else
int bar = 0;
#endif
+ DECLARE_MAC_BUF(mac);
/* when built into the kernel, we only print version if device is found */
#ifndef MODULE
/* when built into the kernel, we only print version if device is found */
#ifndef MODULE
@@
-697,10
+703,10
@@
static int __devinit rhine_init_one(struct pci_dev *pdev,
printk(KERN_ERR "alloc_etherdev failed\n");
goto err_out;
}
printk(KERN_ERR "alloc_etherdev failed\n");
goto err_out;
}
- SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
rp = netdev_priv(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
rp = netdev_priv(dev);
+ rp->dev = dev;
rp->quirks = quirks;
rp->pioaddr = pioaddr;
rp->pdev = pdev;
rp->quirks = quirks;
rp->pioaddr = pioaddr;
rp->pdev = pdev;
@@
-779,8
+785,7
@@
static int __devinit rhine_init_one(struct pci_dev *pdev,
dev->poll_controller = rhine_poll;
#endif
#ifdef CONFIG_VIA_RHINE_NAPI
dev->poll_controller = rhine_poll;
#endif
#ifdef CONFIG_VIA_RHINE_NAPI
- dev->poll = rhine_napipoll;
- dev->weight = 64;
+ netif_napi_add(dev, &rp->napi, rhine_napipoll, 64);
#endif
if (rp->quirks & rqRhineI)
dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
#endif
if (rp->quirks & rqRhineI)
dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
@@
-790,18
+795,14
@@
static int __devinit rhine_init_one(struct pci_dev *pdev,
if (rc)
goto err_out_unmap;
if (rc)
goto err_out_unmap;
- printk(KERN_INFO "%s: VIA %s at 0x%lx, ",
+ printk(KERN_INFO "%s: VIA %s at 0x%lx,
%s, IRQ %d.\n
",
dev->name, name,
#ifdef USE_MMIO
dev->name, name,
#ifdef USE_MMIO
- memaddr
+ memaddr,
#else
#else
- (long)ioaddr
+ (long)ioaddr,
#endif
#endif
- );
-
- for (i = 0; i < 5; i++)
- printk("%2.2x:", dev->dev_addr[i]);
- printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], pdev->irq);
+ print_mac(mac, dev->dev_addr), pdev->irq);
pci_set_drvdata(pdev, dev);
pci_set_drvdata(pdev, dev);
@@
-1055,7
+1056,9
@@
static void init_registers(struct net_device *dev)
rhine_set_rx_mode(dev);
rhine_set_rx_mode(dev);
- netif_poll_enable(dev);
+#ifdef CONFIG_VIA_RHINE_NAPI
+ napi_enable(&rp->napi);
+#endif
/* Enable interrupts by setting the interrupt mask. */
iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
/* Enable interrupts by setting the interrupt mask. */
iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
@@
-1190,6
+1193,10
@@
static void rhine_tx_timeout(struct net_device *dev)
/* protect against concurrent rx interrupts */
disable_irq(rp->pdev->irq);
/* protect against concurrent rx interrupts */
disable_irq(rp->pdev->irq);
+#ifdef CONFIG_VIA_RHINE_NAPI
+ napi_disable(&rp->napi);
+#endif
+
spin_lock(&rp->lock);
/* clear all descriptors */
spin_lock(&rp->lock);
/* clear all descriptors */
@@
-1318,7
+1325,7
@@
static irqreturn_t rhine_interrupt(int irq, void *dev_instance)
IntrPCIErr | IntrStatsMax | IntrLinkChange,
ioaddr + IntrEnable);
IntrPCIErr | IntrStatsMax | IntrLinkChange,
ioaddr + IntrEnable);
- netif_rx_schedule(dev);
+ netif_rx_schedule(dev
, &rp->napi
);
#else
rhine_rx(dev, RX_RING_SIZE);
#endif
#else
rhine_rx(dev, RX_RING_SIZE);
#endif
@@
-1331,7
+1338,7
@@
static irqreturn_t rhine_interrupt(int irq, void *dev_instance)
if (debug > 2 &&
ioread8(ioaddr+ChipCmd) & CmdTxOn)
printk(KERN_WARNING "%s: "
if (debug > 2 &&
ioread8(ioaddr+ChipCmd) & CmdTxOn)
printk(KERN_WARNING "%s: "
- "rhine_interrupt() Tx engine"
+ "rhine_interrupt() Tx engine
"
"still on.\n", dev->name);
}
rhine_tx(dev);
"still on.\n", dev->name);
}
rhine_tx(dev);
@@
-1489,9
+1496,9
@@
static int rhine_rx(struct net_device *dev, int limit)
rp->rx_buf_sz,
PCI_DMA_FROMDEVICE);
rp->rx_buf_sz,
PCI_DMA_FROMDEVICE);
-
eth_copy_and_sum
(skb,
+
skb_copy_to_linear_data
(skb,
rp->rx_skbuff[entry]->data,
rp->rx_skbuff[entry]->data,
- pkt_len
, 0
);
+ pkt_len);
skb_put(skb, pkt_len);
pci_dma_sync_single_for_device(rp->pdev,
rp->rx_skbuff_dma[entry],
skb_put(skb, pkt_len);
pci_dma_sync_single_for_device(rp->pdev,
rp->rx_skbuff_dma[entry],
@@
-1803,9
+1810,6
@@
static const struct ethtool_ops netdev_ethtool_ops = {
.set_msglevel = netdev_set_msglevel,
.get_wol = rhine_get_wol,
.set_wol = rhine_set_wol,
.set_msglevel = netdev_set_msglevel,
.get_wol = rhine_get_wol,
.set_wol = rhine_set_wol,
- .get_sg = ethtool_op_get_sg,
- .get_tx_csum = ethtool_op_get_tx_csum,
- .get_perm_addr = ethtool_op_get_perm_addr,
};
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
};
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@
-1832,7
+1836,9
@@
static int rhine_close(struct net_device *dev)
spin_lock_irq(&rp->lock);
netif_stop_queue(dev);
spin_lock_irq(&rp->lock);
netif_stop_queue(dev);
- netif_poll_disable(dev);
+#ifdef CONFIG_VIA_RHINE_NAPI
+ napi_disable(&rp->napi);
+#endif
if (debug > 1)
printk(KERN_DEBUG "%s: Shutting down ethercard, "
if (debug > 1)
printk(KERN_DEBUG "%s: Shutting down ethercard, "
@@
-1931,6
+1937,9
@@
static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
if (!netif_running(dev))
return 0;
if (!netif_running(dev))
return 0;
+#ifdef CONFIG_VIA_RHINE_NAPI
+ napi_disable(&rp->napi);
+#endif
netif_device_detach(dev);
pci_save_state(pdev);
netif_device_detach(dev);
pci_save_state(pdev);