Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203646
b: refs/heads/master
c: 379b39a
h: refs/heads/master
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Jul 20, 2010
1 parent 366d2ec commit 55b647a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6fdae995557f0ad16320951593d6f8f48f57c14a
refs/heads/master: 379b39a2ad613745bfbfe80256957d19689b7b94
24 changes: 20 additions & 4 deletions trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ bnx2_alloc_mem(struct bnx2 *bp)
bnapi->hw_rx_cons_ptr =
&bnapi->status_blk.msi->status_rx_quick_consumer_index0;
if (bp->flags & BNX2_FLAG_MSIX_CAP) {
for (i = 1; i < BNX2_MAX_MSIX_VEC; i++) {
for (i = 1; i < bp->irq_nvecs; i++) {
struct status_block_msix *sblk;

bnapi = &bp->bnx2_napi[i];
Expand Down Expand Up @@ -6152,7 +6152,7 @@ bnx2_free_irq(struct bnx2 *bp)
static void
bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
{
int i, rc;
int i, total_vecs, rc;
struct msix_entry msix_ent[BNX2_MAX_MSIX_VEC];
struct net_device *dev = bp->dev;
const int len = sizeof(bp->irq_tbl[0].name);
Expand All @@ -6171,13 +6171,29 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
msix_ent[i].vector = 0;
}

rc = pci_enable_msix(bp->pdev, msix_ent, BNX2_MAX_MSIX_VEC);
total_vecs = msix_vecs;
#ifdef BCM_CNIC
total_vecs++;
#endif
rc = -ENOSPC;
while (total_vecs >= BNX2_MIN_MSIX_VEC) {
rc = pci_enable_msix(bp->pdev, msix_ent, total_vecs);
if (rc <= 0)
break;
if (rc > 0)
total_vecs = rc;
}

if (rc != 0)
return;

msix_vecs = total_vecs;
#ifdef BCM_CNIC
msix_vecs--;
#endif
bp->irq_nvecs = msix_vecs;
bp->flags |= BNX2_FLAG_USING_MSIX | BNX2_FLAG_ONE_SHOT_MSI;
for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) {
for (i = 0; i < total_vecs; i++) {
bp->irq_tbl[i].vector = msix_ent[i].vector;
snprintf(bp->irq_tbl[i].name, len, "%s-%d", dev->name, i);
bp->irq_tbl[i].handler = bnx2_msi_1shot;
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/net/bnx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -6637,9 +6637,12 @@ struct flash_spec {

#define BNX2_MAX_MSIX_HW_VEC 9
#define BNX2_MAX_MSIX_VEC 9
#define BNX2_BASE_VEC 0
#define BNX2_TX_VEC 1
#define BNX2_TX_INT_NUM (BNX2_TX_VEC << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT)
#ifdef BCM_CNIC
#define BNX2_MIN_MSIX_VEC 2
#else
#define BNX2_MIN_MSIX_VEC 1
#endif


struct bnx2_irq {
irq_handler_t handler;
Expand Down

0 comments on commit 55b647a

Please sign in to comment.