projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[NET]: Make NAPI polling independent of struct net_device objects.
[deliverable/linux.git]
/
drivers
/
net
/
epic100.c
diff --git
a/drivers/net/epic100.c
b/drivers/net/epic100.c
index 119778401e486f9ea808f6266702adfe2ee7e403..f8446e373bddab9675d64998ac2d87ac97b9c824 100644
(file)
--- a/
drivers/net/epic100.c
+++ b/
drivers/net/epic100.c
@@
-262,6
+262,7
@@
struct epic_private {
/* Ring pointers. */
spinlock_t lock; /* Group with Tx control cache line. */
spinlock_t napi_lock;
/* Ring pointers. */
spinlock_t lock; /* Group with Tx control cache line. */
spinlock_t napi_lock;
+ struct napi_struct napi;
unsigned int reschedule_in_poll;
unsigned int cur_tx, dirty_tx;
unsigned int reschedule_in_poll;
unsigned int cur_tx, dirty_tx;
@@
-294,7
+295,7
@@
static void epic_tx_timeout(struct net_device *dev);
static void epic_init_ring(struct net_device *dev);
static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev);
static int epic_rx(struct net_device *dev, int budget);
static void epic_init_ring(struct net_device *dev);
static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev);
static int epic_rx(struct net_device *dev, int budget);
-static int epic_poll(struct n
et_device *dev, int *
budget);
+static int epic_poll(struct n
api_struct *napi, int
budget);
static irqreturn_t epic_interrupt(int irq, void *dev_instance);
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static const struct ethtool_ops netdev_ethtool_ops;
static irqreturn_t epic_interrupt(int irq, void *dev_instance);
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static const struct ethtool_ops netdev_ethtool_ops;
@@
-487,8
+488,7
@@
static int __devinit epic_init_one (struct pci_dev *pdev,
dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
dev->tx_timeout = &epic_tx_timeout;
dev->ethtool_ops = &netdev_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
dev->tx_timeout = &epic_tx_timeout;
- dev->poll = epic_poll;
- dev->weight = 64;
+ netif_napi_add(dev, &ep->napi, epic_poll, 64);
ret = register_netdev(dev);
if (ret < 0)
ret = register_netdev(dev);
if (ret < 0)
@@
-660,8
+660,11
@@
static int epic_open(struct net_device *dev)
/* Soft reset the chip. */
outl(0x4001, ioaddr + GENCTL);
/* Soft reset the chip. */
outl(0x4001, ioaddr + GENCTL);
- if ((retval = request_irq(dev->irq, &epic_interrupt, IRQF_SHARED, dev->name, dev)))
+ napi_enable(&ep->napi);
+ if ((retval = request_irq(dev->irq, &epic_interrupt, IRQF_SHARED, dev->name, dev))) {
+ napi_disable(&ep->napi);
return retval;
return retval;
+ }
epic_init_ring(dev);
epic_init_ring(dev);
@@
-1103,9
+1106,9
@@
static irqreturn_t epic_interrupt(int irq, void *dev_instance)
if ((status & EpicNapiEvent) && !ep->reschedule_in_poll) {
spin_lock(&ep->napi_lock);
if ((status & EpicNapiEvent) && !ep->reschedule_in_poll) {
spin_lock(&ep->napi_lock);
- if (netif_rx_schedule_prep(dev)) {
+ if (netif_rx_schedule_prep(dev
, &ep->napi
)) {
epic_napi_irq_off(dev, ep);
epic_napi_irq_off(dev, ep);
- __netif_rx_schedule(dev);
+ __netif_rx_schedule(dev
, &ep->napi
);
} else
ep->reschedule_in_poll++;
spin_unlock(&ep->napi_lock);
} else
ep->reschedule_in_poll++;
spin_unlock(&ep->napi_lock);
@@
-1257,26
+1260,22
@@
static void epic_rx_err(struct net_device *dev, struct epic_private *ep)
outw(RxQueued, ioaddr + COMMAND);
}
outw(RxQueued, ioaddr + COMMAND);
}
-static int epic_poll(struct n
et_device *dev, int *
budget)
+static int epic_poll(struct n
api_struct *napi, int
budget)
{
{
- struct epic_private *ep = dev->priv;
- int work_done = 0, orig_budget;
+ struct epic_private *ep = container_of(napi, struct epic_private, napi);
+ struct net_device *dev = ep->mii.dev;
+ int work_done = 0;
long ioaddr = dev->base_addr;
long ioaddr = dev->base_addr;
- orig_budget = (*budget > dev->quota) ? dev->quota : *budget;
-
rx_action:
epic_tx(dev, ep);
rx_action:
epic_tx(dev, ep);
- work_done += epic_rx(dev,
*
budget);
+ work_done += epic_rx(dev, budget);
epic_rx_err(dev, ep);
epic_rx_err(dev, ep);
- *budget -= work_done;
- dev->quota -= work_done;
-
- if (netif_running(dev) && (work_done < orig_budget)) {
+ if (netif_running(dev) && (work_done < budget)) {
unsigned long flags;
int more;
unsigned long flags;
int more;
@@
-1286,7
+1285,7
@@
rx_action:
more = ep->reschedule_in_poll;
if (!more) {
more = ep->reschedule_in_poll;
if (!more) {
- __netif_rx_complete(dev);
+ __netif_rx_complete(dev
, napi
);
outl(EpicNapiEvent, ioaddr + INTSTAT);
epic_napi_irq_on(dev, ep);
} else
outl(EpicNapiEvent, ioaddr + INTSTAT);
epic_napi_irq_on(dev, ep);
} else
@@
-1298,7
+1297,7
@@
rx_action:
goto rx_action;
}
goto rx_action;
}
- return
(work_done >= orig_budget)
;
+ return
work_done
;
}
static int epic_close(struct net_device *dev)
}
static int epic_close(struct net_device *dev)
@@
-1309,6
+1308,7
@@
static int epic_close(struct net_device *dev)
int i;
netif_stop_queue(dev);
int i;
netif_stop_queue(dev);
+ napi_disable(&ep->napi);
if (debug > 1)
printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n",
if (debug > 1)
printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n",
This page took
0.041359 seconds
and
5
git commands to generate.