aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bnx2.c55
-rw-r--r--drivers/net/bnx2.h12
2 files changed, 45 insertions, 22 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f19a1e9a6b7f..83cdbde5d2d6 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5234,18 +5234,15 @@ static int
5234bnx2_request_irq(struct bnx2 *bp) 5234bnx2_request_irq(struct bnx2 *bp)
5235{ 5235{
5236 struct net_device *dev = bp->dev; 5236 struct net_device *dev = bp->dev;
5237 int rc = 0; 5237 unsigned long flags;
5238 5238 struct bnx2_irq *irq = &bp->irq_tbl[0];
5239 if (bp->flags & USING_MSI_FLAG) { 5239 int rc;
5240 irq_handler_t fn = bnx2_msi;
5241
5242 if (bp->flags & ONE_SHOT_MSI_FLAG)
5243 fn = bnx2_msi_1shot;
5244 5240
5245 rc = request_irq(bp->pdev->irq, fn, 0, dev->name, dev); 5241 if (bp->flags & USING_MSI_FLAG)
5246 } else 5242 flags = 0;
5247 rc = request_irq(bp->pdev->irq, bnx2_interrupt, 5243 else
5248 IRQF_SHARED, dev->name, dev); 5244 flags = IRQF_SHARED;
5245 rc = request_irq(irq->vector, irq->handler, flags, dev->name, dev);
5249 return rc; 5246 return rc;
5250} 5247}
5251 5248
@@ -5254,12 +5251,31 @@ bnx2_free_irq(struct bnx2 *bp)
5254{ 5251{
5255 struct net_device *dev = bp->dev; 5252 struct net_device *dev = bp->dev;
5256 5253
5254 free_irq(bp->irq_tbl[0].vector, dev);
5257 if (bp->flags & USING_MSI_FLAG) { 5255 if (bp->flags & USING_MSI_FLAG) {
5258 free_irq(bp->pdev->irq, dev);
5259 pci_disable_msi(bp->pdev); 5256 pci_disable_msi(bp->pdev);
5260 bp->flags &= ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG); 5257 bp->flags &= ~(USING_MSI_FLAG | ONE_SHOT_MSI_FLAG);
5261 } else 5258 }
5262 free_irq(bp->pdev->irq, dev); 5259}
5260
5261static void
5262bnx2_setup_int_mode(struct bnx2 *bp, int dis_msi)
5263{
5264 bp->irq_tbl[0].handler = bnx2_interrupt;
5265 strcpy(bp->irq_tbl[0].name, bp->dev->name);
5266
5267 if ((bp->flags & MSI_CAP_FLAG) && !dis_msi) {
5268 if (pci_enable_msi(bp->pdev) == 0) {
5269 bp->flags |= USING_MSI_FLAG;
5270 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
5271 bp->flags |= ONE_SHOT_MSI_FLAG;
5272 bp->irq_tbl[0].handler = bnx2_msi_1shot;
5273 } else
5274 bp->irq_tbl[0].handler = bnx2_msi;
5275 }
5276 }
5277
5278 bp->irq_tbl[0].vector = bp->pdev->irq;
5263} 5279}
5264 5280
5265/* Called with rtnl_lock */ 5281/* Called with rtnl_lock */
@@ -5278,15 +5294,8 @@ bnx2_open(struct net_device *dev)
5278 if (rc) 5294 if (rc)
5279 return rc; 5295 return rc;
5280 5296
5297 bnx2_setup_int_mode(bp, disable_msi);
5281 napi_enable(&bp->napi); 5298 napi_enable(&bp->napi);
5282
5283 if ((bp->flags & MSI_CAP_FLAG) && !disable_msi) {
5284 if (pci_enable_msi(bp->pdev) == 0) {
5285 bp->flags |= USING_MSI_FLAG;
5286 if (CHIP_NUM(bp) == CHIP_NUM_5709)
5287 bp->flags |= ONE_SHOT_MSI_FLAG;
5288 }
5289 }
5290 rc = bnx2_request_irq(bp); 5299 rc = bnx2_request_irq(bp);
5291 5300
5292 if (rc) { 5301 if (rc) {
@@ -5325,6 +5334,8 @@ bnx2_open(struct net_device *dev)
5325 bnx2_disable_int(bp); 5334 bnx2_disable_int(bp);
5326 bnx2_free_irq(bp); 5335 bnx2_free_irq(bp);
5327 5336
5337 bnx2_setup_int_mode(bp, 1);
5338
5328 rc = bnx2_init_nic(bp); 5339 rc = bnx2_init_nic(bp);
5329 5340
5330 if (!rc) 5341 if (!rc)
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 1f244faf3624..1accf0093126 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6494,6 +6494,15 @@ struct flash_spec {
6494 u8 *name; 6494 u8 *name;
6495}; 6495};
6496 6496
6497#define BNX2_MAX_MSIX_HW_VEC 9
6498#define BNX2_MAX_MSIX_VEC 1
6499
6500struct bnx2_irq {
6501 irq_handler_t handler;
6502 u16 vector;
6503 char name[16];
6504};
6505
6497struct bnx2 { 6506struct bnx2 {
6498 /* Fields used in the tx and intr/napi performance paths are grouped */ 6507 /* Fields used in the tx and intr/napi performance paths are grouped */
6499 /* together in the beginning of the structure. */ 6508 /* together in the beginning of the structure. */
@@ -6721,6 +6730,9 @@ struct bnx2 {
6721 u32 flash_size; 6730 u32 flash_size;
6722 6731
6723 int status_stats_size; 6732 int status_stats_size;
6733
6734 struct bnx2_irq irq_tbl[BNX2_MAX_MSIX_VEC];
6735 int irq_nvecs;
6724}; 6736};
6725 6737
6726static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset); 6738static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);