aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2007-12-20 22:56:09 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:57:34 -0500
commit6d866ffc69b0c3e584782f212a3f783708d31e9a (patch)
treeb8a25c8fe7b53344b82c3c07eda5109c832a2b31 /drivers/net/bnx2.c
parentead7270b993bed77cb45a5bc786a879679e2b16a (diff)
[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 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)