Commit 6d866ffc authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

[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: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ead7270b
...@@ -5234,18 +5234,15 @@ static int ...@@ -5234,18 +5234,15 @@ static int
bnx2_request_irq(struct bnx2 *bp) bnx2_request_irq(struct bnx2 *bp)
{ {
struct net_device *dev = bp->dev; struct net_device *dev = bp->dev;
int rc = 0; unsigned long flags;
struct bnx2_irq *irq = &bp->irq_tbl[0];
if (bp->flags & USING_MSI_FLAG) { int rc;
irq_handler_t fn = bnx2_msi;
if (bp->flags & ONE_SHOT_MSI_FLAG)
fn = bnx2_msi_1shot;
rc = request_irq(bp->pdev->irq, fn, 0, dev->name, dev); if (bp->flags & USING_MSI_FLAG)
} else flags = 0;
rc = request_irq(bp->pdev->irq, bnx2_interrupt, else
IRQF_SHARED, dev->name, dev); flags = IRQF_SHARED;
rc = request_irq(irq->vector, irq->handler, flags, dev->name, dev);
return rc; return rc;
} }
...@@ -5254,12 +5251,31 @@ bnx2_free_irq(struct bnx2 *bp) ...@@ -5254,12 +5251,31 @@ bnx2_free_irq(struct bnx2 *bp)
{ {
struct net_device *dev = bp->dev; struct net_device *dev = bp->dev;
free_irq(bp->irq_tbl[0].vector, dev);
if (bp->flags & USING_MSI_FLAG) { if (bp->flags & USING_MSI_FLAG) {
free_irq(bp->pdev->irq, dev);
pci_disable_msi(bp->pdev); pci_disable_msi(bp->pdev);
bp->flags &= ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG); 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 */ /* Called with rtnl_lock */
...@@ -5278,15 +5294,8 @@ bnx2_open(struct net_device *dev) ...@@ -5278,15 +5294,8 @@ bnx2_open(struct net_device *dev)
if (rc) if (rc)
return rc; return rc;
bnx2_setup_int_mode(bp, disable_msi);
napi_enable(&bp->napi); 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); rc = bnx2_request_irq(bp);
if (rc) { if (rc) {
...@@ -5325,6 +5334,8 @@ bnx2_open(struct net_device *dev) ...@@ -5325,6 +5334,8 @@ bnx2_open(struct net_device *dev)
bnx2_disable_int(bp); bnx2_disable_int(bp);
bnx2_free_irq(bp); bnx2_free_irq(bp);
bnx2_setup_int_mode(bp, 1);
rc = bnx2_init_nic(bp); rc = bnx2_init_nic(bp);
if (!rc) if (!rc)
......
...@@ -6494,6 +6494,15 @@ struct flash_spec { ...@@ -6494,6 +6494,15 @@ struct flash_spec {
u8 *name; u8 *name;
}; };
#define BNX2_MAX_MSIX_HW_VEC 9
#define BNX2_MAX_MSIX_VEC 1
struct bnx2_irq {
irq_handler_t handler;
u16 vector;
char name[16];
};
struct bnx2 { struct bnx2 {
/* Fields used in the tx and intr/napi performance paths are grouped */ /* Fields used in the tx and intr/napi performance paths are grouped */
/* together in the beginning of the structure. */ /* together in the beginning of the structure. */
...@@ -6721,6 +6730,9 @@ struct bnx2 { ...@@ -6721,6 +6730,9 @@ struct bnx2 {
u32 flash_size; u32 flash_size;
int status_stats_size; int status_stats_size;
struct bnx2_irq irq_tbl[BNX2_MAX_MSIX_VEC];
int irq_nvecs;
}; };
static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset); static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);
......
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