Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103074
b: refs/heads/master
c: f0ea2e6
h: refs/heads/master
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Jun 19, 2008
1 parent 8e805f6 commit 697a320
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 60 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: 43e80b89b65cbc62b5e0fde09b47c9fc572a8b11
refs/heads/master: f0ea2e63859cf234b7017a2d7bba2a5a1db3bf25
99 changes: 40 additions & 59 deletions trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2996,9 +2996,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
static irqreturn_t
bnx2_msi(int irq, void *dev_instance)
{
struct net_device *dev = dev_instance;
struct bnx2 *bp = netdev_priv(dev);
struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
struct bnx2_napi *bnapi = dev_instance;
struct bnx2 *bp = bnapi->bp;
struct net_device *dev = bp->dev;

prefetch(bnapi->status_blk.msi);
REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
Expand All @@ -3017,9 +3017,9 @@ bnx2_msi(int irq, void *dev_instance)
static irqreturn_t
bnx2_msi_1shot(int irq, void *dev_instance)
{
struct net_device *dev = dev_instance;
struct bnx2 *bp = netdev_priv(dev);
struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
struct bnx2_napi *bnapi = dev_instance;
struct bnx2 *bp = bnapi->bp;
struct net_device *dev = bp->dev;

prefetch(bnapi->status_blk.msi);

Expand All @@ -3035,9 +3035,9 @@ bnx2_msi_1shot(int irq, void *dev_instance)
static irqreturn_t
bnx2_interrupt(int irq, void *dev_instance)
{
struct net_device *dev = dev_instance;
struct bnx2 *bp = netdev_priv(dev);
struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
struct bnx2_napi *bnapi = dev_instance;
struct bnx2 *bp = bnapi->bp;
struct net_device *dev = bp->dev;
struct status_block *sblk = bnapi->status_blk.msi;

/* When using INTx, it is possible for the interrupt to arrive
Expand Down Expand Up @@ -3072,23 +3072,6 @@ bnx2_interrupt(int irq, void *dev_instance)
return IRQ_HANDLED;
}

static irqreturn_t
bnx2_tx_msix(int irq, void *dev_instance)
{
struct net_device *dev = dev_instance;
struct bnx2 *bp = netdev_priv(dev);
struct bnx2_napi *bnapi = &bp->bnx2_napi[BNX2_TX_VEC];

prefetch(bnapi->status_blk.msix);

/* Return here if interrupt is disabled. */
if (unlikely(atomic_read(&bp->intr_sem) != 0))
return IRQ_HANDLED;

netif_rx_schedule(dev, &bnapi->napi);
return IRQ_HANDLED;
}

static inline int
bnx2_has_fast_work(struct bnx2_napi *bnapi)
{
Expand Down Expand Up @@ -3119,30 +3102,6 @@ bnx2_has_work(struct bnx2_napi *bnapi)
return 0;
}

static int bnx2_tx_poll(struct napi_struct *napi, int budget)
{
struct bnx2_napi *bnapi = container_of(napi, struct bnx2_napi, napi);
struct bnx2 *bp = bnapi->bp;
struct bnx2_tx_ring_info *txr = &bnapi->tx_ring;
int work_done = 0;
struct status_block_msix *sblk = bnapi->status_blk.msix;

do {
work_done += bnx2_tx_int(bp, bnapi, budget - work_done);
if (unlikely(work_done >= budget))
return work_done;

bnapi->last_status_idx = sblk->status_idx;
rmb();
} while (bnx2_get_hw_tx_cons(bnapi) != txr->hw_tx_cons);

netif_rx_complete(bp->dev, napi);
REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
bnapi->last_status_idx);
return work_done;
}

static void bnx2_poll_link(struct bnx2 *bp, struct bnx2_napi *bnapi)
{
struct status_block *sblk = bnapi->status_blk.msi;
Expand Down Expand Up @@ -3178,6 +3137,33 @@ static int bnx2_poll_work(struct bnx2 *bp, struct bnx2_napi *bnapi,
return work_done;
}

static int bnx2_poll_msix(struct napi_struct *napi, int budget)
{
struct bnx2_napi *bnapi = container_of(napi, struct bnx2_napi, napi);
struct bnx2 *bp = bnapi->bp;
int work_done = 0;
struct status_block_msix *sblk = bnapi->status_blk.msix;

while (1) {
work_done = bnx2_poll_work(bp, bnapi, work_done, budget);
if (unlikely(work_done >= budget))
break;

bnapi->last_status_idx = sblk->status_idx;
/* status idx must be read before checking for more work. */
rmb();
if (likely(!bnx2_has_fast_work(bnapi))) {

netif_rx_complete(bp->dev, napi);
REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
bnapi->last_status_idx);
break;
}
}
return work_done;
}

static int bnx2_poll(struct napi_struct *napi, int budget)
{
struct bnx2_napi *bnapi = container_of(napi, struct bnx2_napi, napi);
Expand Down Expand Up @@ -5636,7 +5622,6 @@ bnx2_timer(unsigned long data)
static int
bnx2_request_irq(struct bnx2 *bp)
{
struct net_device *dev = bp->dev;
unsigned long flags;
struct bnx2_irq *irq;
int rc = 0, i;
Expand All @@ -5649,7 +5634,7 @@ bnx2_request_irq(struct bnx2 *bp)
for (i = 0; i < bp->irq_nvecs; i++) {
irq = &bp->irq_tbl[i];
rc = request_irq(irq->vector, irq->handler, flags, irq->name,
dev);
&bp->bnx2_napi[i]);
if (rc)
break;
irq->requested = 1;
Expand All @@ -5660,14 +5645,13 @@ bnx2_request_irq(struct bnx2 *bp)
static void
bnx2_free_irq(struct bnx2 *bp)
{
struct net_device *dev = bp->dev;
struct bnx2_irq *irq;
int i;

for (i = 0; i < bp->irq_nvecs; i++) {
irq = &bp->irq_tbl[i];
if (irq->requested)
free_irq(irq->vector, dev);
free_irq(irq->vector, &bp->bnx2_napi[i]);
irq->requested = 0;
}
if (bp->flags & BNX2_FLAG_USING_MSI)
Expand All @@ -5694,10 +5678,7 @@ bnx2_enable_msix(struct bnx2 *bp)
msix_ent[i].vector = 0;

strcpy(bp->irq_tbl[i].name, bp->dev->name);
if (i == 0)
bp->irq_tbl[i].handler = bnx2_msi_1shot;
else
bp->irq_tbl[i].handler = bnx2_tx_msix;
bp->irq_tbl[i].handler = bnx2_msi_1shot;
}

rc = pci_enable_msix(bp->pdev, msix_ent, BNX2_MAX_MSIX_VEC);
Expand Down Expand Up @@ -7567,7 +7548,7 @@ bnx2_init_napi(struct bnx2 *bp)
if (i == 0)
poll = bnx2_poll;
else
poll = bnx2_tx_poll;
poll = bnx2_poll_msix;

netif_napi_add(bp->dev, &bp->bnx2_napi[i].napi, poll, 64);
bnapi->bp = bp;
Expand Down

0 comments on commit 697a320

Please sign in to comment.