summaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2007-12-20 19:56:09 -0800
committerDavid S. Miller <davem@davemloft.net>2008-01-28 14:57:34 -0800
commit6d866ffc69b0c3e584782f212a3f783708d31e9a (patch)
treeb8a25c8fe7b53344b82c3c07eda5109c832a2b31 /drivers/net/bnx2.c
parentead7270b993bed77cb45a5bc786a879679e2b16a (diff)
downloadop-kernel-dev-6d866ffc69b0c3e584782f212a3f783708d31e9a.zip
op-kernel-dev-6d866ffc69b0c3e584782f212a3f783708d31e9a.tar.gz
[BNX2]: Restructure IRQ datastructures.
Add a table to keep track of multiple IRQs and restructure the IRQ request and free functions so that they can be easily expanded to handle multiple IRQs. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f19a1e9..83cdbde 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5234,18 +5234,15 @@ static int
bnx2_request_irq(struct bnx2 *bp)
{
struct net_device *dev = bp->dev;
- int rc = 0;
-
- if (bp->flags & USING_MSI_FLAG) {
- irq_handler_t fn = bnx2_msi;
-
- if (bp->flags & ONE_SHOT_MSI_FLAG)
- fn = bnx2_msi_1shot;
+ unsigned long flags;
+ struct bnx2_irq *irq = &bp->irq_tbl[0];
+ int rc;
- rc = request_irq(bp->pdev->irq, fn, 0, dev->name, dev);
- } else
- rc = request_irq(bp->pdev->irq, bnx2_interrupt,
- IRQF_SHARED, dev->name, dev);
+ if (bp->flags & USING_MSI_FLAG)
+ flags = 0;
+ else
+ flags = IRQF_SHARED;
+ rc = request_irq(irq->vector, irq->handler, flags, dev->name, dev);
return rc;
}
@@ -5254,12 +5251,31 @@ bnx2_free_irq(struct bnx2 *bp)
{
struct net_device *dev = bp->dev;
+ free_irq(bp->irq_tbl[0].vector, dev);
if (bp->flags & USING_MSI_FLAG) {
- free_irq(bp->pdev->irq, dev);
pci_disable_msi(bp->pdev);
bp->flags &= ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG);
- } else
- free_irq(bp->pdev->irq, dev);
+ }
+}
+
+static void
+bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
+{
+ bp->irq_tbl[0].handler = bnx2_interrupt;
+ strcpy(bp->irq_tbl[0].name, bp->dev->name);
+
+ if ((bp->flags & MSI_CAP_FLAG) && !dis_msi) {
+ if (pci_enable_msi(bp->pdev) == 0) {
+ bp->flags |= USING_MSI_FLAG;
+ if (CHIP_NUM(bp) == CHIP_NUM_5709) {
+ bp->flags |= ONE_SHOT_MSI_FLAG;
+ bp->irq_tbl[0].handler = bnx2_msi_1shot;
+ } else
+ bp->irq_tbl[0].handler = bnx2_msi;
+ }
+ }
+
+ bp->irq_tbl[0].vector = bp->pdev->irq;
}
/* Called with rtnl_lock */
@@ -5278,15 +5294,8 @@ bnx2_open(struct net_device *dev)
if (rc)
return rc;
+ bnx2_setup_int_mode(bp, disable_msi);
napi_enable(&bp->napi);
-
- if ((bp->flags & MSI_CAP_FLAG) && !disable_msi) {
- if (pci_enable_msi(bp->pdev) == 0) {
- bp->flags |= USING_MSI_FLAG;
- if (CHIP_NUM(bp) == CHIP_NUM_5709)
- bp->flags |= ONE_SHOT_MSI_FLAG;
- }
- }
rc = bnx2_request_irq(bp);
if (rc) {
@@ -5325,6 +5334,8 @@ bnx2_open(struct net_device *dev)
bnx2_disable_int(bp);
bnx2_free_irq(bp);
+ bnx2_setup_int_mode(bp, 1);
+
rc = bnx2_init_nic(bp);
if (!rc)
OpenPOWER on IntegriCloud