aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
authorAyaz Abdulla <aabdulla@nvidia.com>2009-03-05 03:02:03 -0500
committerDavid S. Miller <davem@davemloft.net>2009-03-10 08:29:46 -0400
commit582806be066bd35dc5d2739b090b561a5efd787a (patch)
tree0546c97440fb527dcc81f749f6af99599d9c645f /drivers/net/forcedeth.c
parentd41c628c514bceb33037c26f83585c629594bed5 (diff)
forcedeth: save irq events for napi processing
This patch will save the irq events in the driver's context so that the napi routine knows which interrupts have occurred. Subsequent changes will be moving all interrupt processing into the napi poll routine. Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a4f2f146ae68..37cd23fb9e44 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -759,6 +759,7 @@ struct fe_priv {
759 dma_addr_t ring_addr; 759 dma_addr_t ring_addr;
760 struct pci_dev *pci_dev; 760 struct pci_dev *pci_dev;
761 u32 orig_mac[2]; 761 u32 orig_mac[2];
762 u32 events;
762 u32 irqmask; 763 u32 irqmask;
763 u32 desc_ver; 764 u32 desc_ver;
764 u32 txrxctl_bits; 765 u32 txrxctl_bits;
@@ -3417,21 +3418,20 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3417 struct net_device *dev = (struct net_device *) data; 3418 struct net_device *dev = (struct net_device *) data;
3418 struct fe_priv *np = netdev_priv(dev); 3419 struct fe_priv *np = netdev_priv(dev);
3419 u8 __iomem *base = get_hwbase(dev); 3420 u8 __iomem *base = get_hwbase(dev);
3420 u32 events;
3421 int i; 3421 int i;
3422 3422
3423 dprintk(KERN_DEBUG "%s: nv_nic_irq\n", dev->name); 3423 dprintk(KERN_DEBUG "%s: nv_nic_irq\n", dev->name);
3424 3424
3425 for (i=0; ; i++) { 3425 for (i=0; ; i++) {
3426 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { 3426 if (!(np->msi_flags & NV_MSI_X_ENABLED)) {
3427 events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; 3427 np->events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK;
3428 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); 3428 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
3429 } else { 3429 } else {
3430 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; 3430 np->events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
3431 writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); 3431 writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
3432 } 3432 }
3433 dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); 3433 dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, np->events);
3434 if (!(events & np->irqmask)) 3434 if (!(np->events & np->irqmask))
3435 break; 3435 break;
3436 3436
3437 nv_msi_workaround(np); 3437 nv_msi_workaround(np);
@@ -3441,7 +3441,7 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3441 spin_unlock(&np->lock); 3441 spin_unlock(&np->lock);
3442 3442
3443#ifdef CONFIG_FORCEDETH_NAPI 3443#ifdef CONFIG_FORCEDETH_NAPI
3444 if (events & NVREG_IRQ_RX_ALL) { 3444 if (np->events & NVREG_IRQ_RX_ALL) {
3445 spin_lock(&np->lock); 3445 spin_lock(&np->lock);
3446 napi_schedule(&np->napi); 3446 napi_schedule(&np->napi);
3447 3447
@@ -3464,7 +3464,7 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3464 } 3464 }
3465 } 3465 }
3466#endif 3466#endif
3467 if (unlikely(events & NVREG_IRQ_LINK)) { 3467 if (unlikely(np->events & NVREG_IRQ_LINK)) {
3468 spin_lock(&np->lock); 3468 spin_lock(&np->lock);
3469 nv_link_irq(dev); 3469 nv_link_irq(dev);
3470 spin_unlock(&np->lock); 3470 spin_unlock(&np->lock);
@@ -3475,15 +3475,15 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3475 spin_unlock(&np->lock); 3475 spin_unlock(&np->lock);
3476 np->link_timeout = jiffies + LINK_TIMEOUT; 3476 np->link_timeout = jiffies + LINK_TIMEOUT;
3477 } 3477 }
3478 if (unlikely(events & (NVREG_IRQ_TX_ERR))) { 3478 if (unlikely(np->events & (NVREG_IRQ_TX_ERR))) {
3479 dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", 3479 dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n",
3480 dev->name, events); 3480 dev->name, np->events);
3481 } 3481 }
3482 if (unlikely(events & (NVREG_IRQ_UNKNOWN))) { 3482 if (unlikely(np->events & (NVREG_IRQ_UNKNOWN))) {
3483 printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", 3483 printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n",
3484 dev->name, events); 3484 dev->name, np->events);
3485 } 3485 }
3486 if (unlikely(events & NVREG_IRQ_RECOVER_ERROR)) { 3486 if (unlikely(np->events & NVREG_IRQ_RECOVER_ERROR)) {
3487 spin_lock(&np->lock); 3487 spin_lock(&np->lock);
3488 /* disable interrupts on the nic */ 3488 /* disable interrupts on the nic */
3489 if (!(np->msi_flags & NV_MSI_X_ENABLED)) 3489 if (!(np->msi_flags & NV_MSI_X_ENABLED))
@@ -3534,21 +3534,20 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3534 struct net_device *dev = (struct net_device *) data; 3534 struct net_device *dev = (struct net_device *) data;
3535 struct fe_priv *np = netdev_priv(dev); 3535 struct fe_priv *np = netdev_priv(dev);
3536 u8 __iomem *base = get_hwbase(dev); 3536 u8 __iomem *base = get_hwbase(dev);
3537 u32 events;
3538 int i; 3537 int i;
3539 3538
3540 dprintk(KERN_DEBUG "%s: nv_nic_irq_optimized\n", dev->name); 3539 dprintk(KERN_DEBUG "%s: nv_nic_irq_optimized\n", dev->name);
3541 3540
3542 for (i=0; ; i++) { 3541 for (i=0; ; i++) {
3543 if (!(np->msi_flags & NV_MSI_X_ENABLED)) { 3542 if (!(np->msi_flags & NV_MSI_X_ENABLED)) {
3544 events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK; 3543 np->events = readl(base + NvRegIrqStatus) & NVREG_IRQSTAT_MASK;
3545 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); 3544 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
3546 } else { 3545 } else {
3547 events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; 3546 np->events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
3548 writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus); 3547 writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
3549 } 3548 }
3550 dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, events); 3549 dprintk(KERN_DEBUG "%s: irq: %08x\n", dev->name, np->events);
3551 if (!(events & np->irqmask)) 3550 if (!(np->events & np->irqmask))
3552 break; 3551 break;
3553 3552
3554 nv_msi_workaround(np); 3553 nv_msi_workaround(np);
@@ -3558,7 +3557,7 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3558 spin_unlock(&np->lock); 3557 spin_unlock(&np->lock);
3559 3558
3560#ifdef CONFIG_FORCEDETH_NAPI 3559#ifdef CONFIG_FORCEDETH_NAPI
3561 if (events & NVREG_IRQ_RX_ALL) { 3560 if (np->events & NVREG_IRQ_RX_ALL) {
3562 spin_lock(&np->lock); 3561 spin_lock(&np->lock);
3563 napi_schedule(&np->napi); 3562 napi_schedule(&np->napi);
3564 3563
@@ -3581,7 +3580,7 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3581 } 3580 }
3582 } 3581 }
3583#endif 3582#endif
3584 if (unlikely(events & NVREG_IRQ_LINK)) { 3583 if (unlikely(np->events & NVREG_IRQ_LINK)) {
3585 spin_lock(&np->lock); 3584 spin_lock(&np->lock);
3586 nv_link_irq(dev); 3585 nv_link_irq(dev);
3587 spin_unlock(&np->lock); 3586 spin_unlock(&np->lock);
@@ -3592,15 +3591,15 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3592 spin_unlock(&np->lock); 3591 spin_unlock(&np->lock);
3593 np->link_timeout = jiffies + LINK_TIMEOUT; 3592 np->link_timeout = jiffies + LINK_TIMEOUT;
3594 } 3593 }
3595 if (unlikely(events & (NVREG_IRQ_TX_ERR))) { 3594 if (unlikely(np->events & (NVREG_IRQ_TX_ERR))) {
3596 dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n", 3595 dprintk(KERN_DEBUG "%s: received irq with events 0x%x. Probably TX fail.\n",
3597 dev->name, events); 3596 dev->name, np->events);
3598 } 3597 }
3599 if (unlikely(events & (NVREG_IRQ_UNKNOWN))) { 3598 if (unlikely(np->events & (NVREG_IRQ_UNKNOWN))) {
3600 printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n", 3599 printk(KERN_DEBUG "%s: received irq with unknown events 0x%x. Please report\n",
3601 dev->name, events); 3600 dev->name, np->events);
3602 } 3601 }
3603 if (unlikely(events & NVREG_IRQ_RECOVER_ERROR)) { 3602 if (unlikely(np->events & NVREG_IRQ_RECOVER_ERROR)) {
3604 spin_lock(&np->lock); 3603 spin_lock(&np->lock);
3605 /* disable interrupts on the nic */ 3604 /* disable interrupts on the nic */
3606 if (!(np->msi_flags & NV_MSI_X_ENABLED)) 3605 if (!(np->msi_flags & NV_MSI_X_ENABLED))