diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-12 12:17:22 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-12 12:17:22 -0400 |
| commit | 000233e4d1321e54033d097e98f6868b11614217 (patch) | |
| tree | 2e25104862039bb95a1f82a9e19e2150aa0daffa | |
| parent | bfab36e81611e60573b84eb4e4b4c8d8545b2320 (diff) | |
| parent | 6dee6421581d3484e9a01d403dbf158161942db6 (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
[BNX2]: Refine napi poll loop.
[TG3]: Refine napi poll loop.
| -rw-r--r-- | drivers/net/bnx2.c | 16 | ||||
| -rw-r--r-- | drivers/net/tg3.c | 24 |
2 files changed, 24 insertions, 16 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index d68accea380b..78ed633ceb82 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
| @@ -2652,10 +2652,10 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget) | |||
| 2652 | REG_RD(bp, BNX2_HC_COMMAND); | 2652 | REG_RD(bp, BNX2_HC_COMMAND); |
| 2653 | } | 2653 | } |
| 2654 | 2654 | ||
| 2655 | if (bp->status_blk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) | 2655 | if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) |
| 2656 | bnx2_tx_int(bp); | 2656 | bnx2_tx_int(bp); |
| 2657 | 2657 | ||
| 2658 | if (bp->status_blk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) | 2658 | if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) |
| 2659 | work_done += bnx2_rx_int(bp, budget - work_done); | 2659 | work_done += bnx2_rx_int(bp, budget - work_done); |
| 2660 | 2660 | ||
| 2661 | return work_done; | 2661 | return work_done; |
| @@ -2665,6 +2665,7 @@ static int bnx2_poll(struct napi_struct *napi, int budget) | |||
| 2665 | { | 2665 | { |
| 2666 | struct bnx2 *bp = container_of(napi, struct bnx2, napi); | 2666 | struct bnx2 *bp = container_of(napi, struct bnx2, napi); |
| 2667 | int work_done = 0; | 2667 | int work_done = 0; |
| 2668 | struct status_block *sblk = bp->status_blk; | ||
| 2668 | 2669 | ||
| 2669 | while (1) { | 2670 | while (1) { |
| 2670 | work_done = bnx2_poll_work(bp, work_done, budget); | 2671 | work_done = bnx2_poll_work(bp, work_done, budget); |
| @@ -2672,16 +2673,19 @@ static int bnx2_poll(struct napi_struct *napi, int budget) | |||
| 2672 | if (unlikely(work_done >= budget)) | 2673 | if (unlikely(work_done >= budget)) |
| 2673 | break; | 2674 | break; |
| 2674 | 2675 | ||
| 2676 | /* bp->last_status_idx is used below to tell the hw how | ||
| 2677 | * much work has been processed, so we must read it before | ||
| 2678 | * checking for more work. | ||
| 2679 | */ | ||
| 2680 | bp->last_status_idx = sblk->status_idx; | ||
| 2681 | rmb(); | ||
| 2675 | if (likely(!bnx2_has_work(bp))) { | 2682 | if (likely(!bnx2_has_work(bp))) { |
| 2676 | bp->last_status_idx = bp->status_blk->status_idx; | ||
| 2677 | rmb(); | ||
| 2678 | |||
| 2679 | netif_rx_complete(bp->dev, napi); | 2683 | netif_rx_complete(bp->dev, napi); |
| 2680 | if (likely(bp->flags & USING_MSI_FLAG)) { | 2684 | if (likely(bp->flags & USING_MSI_FLAG)) { |
| 2681 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 2685 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
| 2682 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | 2686 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | |
| 2683 | bp->last_status_idx); | 2687 | bp->last_status_idx); |
| 2684 | return 0; | 2688 | break; |
| 2685 | } | 2689 | } |
| 2686 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 2690 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
| 2687 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | 2691 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index e795c33b982d..30b1cca8144c 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
| @@ -3576,7 +3576,7 @@ static int tg3_poll_work(struct tg3 *tp, int work_done, int budget) | |||
| 3576 | if (sblk->idx[0].tx_consumer != tp->tx_cons) { | 3576 | if (sblk->idx[0].tx_consumer != tp->tx_cons) { |
| 3577 | tg3_tx(tp); | 3577 | tg3_tx(tp); |
| 3578 | if (unlikely(tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING)) | 3578 | if (unlikely(tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING)) |
| 3579 | return 0; | 3579 | return work_done; |
| 3580 | } | 3580 | } |
| 3581 | 3581 | ||
| 3582 | /* run RX thread, within the bounds set by NAPI. | 3582 | /* run RX thread, within the bounds set by NAPI. |
| @@ -3593,6 +3593,7 @@ static int tg3_poll(struct napi_struct *napi, int budget) | |||
| 3593 | { | 3593 | { |
| 3594 | struct tg3 *tp = container_of(napi, struct tg3, napi); | 3594 | struct tg3 *tp = container_of(napi, struct tg3, napi); |
| 3595 | int work_done = 0; | 3595 | int work_done = 0; |
| 3596 | struct tg3_hw_status *sblk = tp->hw_status; | ||
| 3596 | 3597 | ||
| 3597 | while (1) { | 3598 | while (1) { |
| 3598 | work_done = tg3_poll_work(tp, work_done, budget); | 3599 | work_done = tg3_poll_work(tp, work_done, budget); |
| @@ -3603,15 +3604,17 @@ static int tg3_poll(struct napi_struct *napi, int budget) | |||
| 3603 | if (unlikely(work_done >= budget)) | 3604 | if (unlikely(work_done >= budget)) |
| 3604 | break; | 3605 | break; |
| 3605 | 3606 | ||
| 3606 | if (likely(!tg3_has_work(tp))) { | 3607 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) { |
| 3607 | struct tg3_hw_status *sblk = tp->hw_status; | 3608 | /* tp->last_tag is used in tg3_restart_ints() below |
| 3608 | 3609 | * to tell the hw how much work has been processed, | |
| 3609 | if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) { | 3610 | * so we must read it before checking for more work. |
| 3610 | tp->last_tag = sblk->status_tag; | 3611 | */ |
| 3611 | rmb(); | 3612 | tp->last_tag = sblk->status_tag; |
| 3612 | } else | 3613 | rmb(); |
| 3613 | sblk->status &= ~SD_STATUS_UPDATED; | 3614 | } else |
| 3615 | sblk->status &= ~SD_STATUS_UPDATED; | ||
| 3614 | 3616 | ||
| 3617 | if (likely(!tg3_has_work(tp))) { | ||
| 3615 | netif_rx_complete(tp->dev, napi); | 3618 | netif_rx_complete(tp->dev, napi); |
| 3616 | tg3_restart_ints(tp); | 3619 | tg3_restart_ints(tp); |
| 3617 | break; | 3620 | break; |
| @@ -3621,9 +3624,10 @@ static int tg3_poll(struct napi_struct *napi, int budget) | |||
| 3621 | return work_done; | 3624 | return work_done; |
| 3622 | 3625 | ||
| 3623 | tx_recovery: | 3626 | tx_recovery: |
| 3627 | /* work_done is guaranteed to be less than budget. */ | ||
| 3624 | netif_rx_complete(tp->dev, napi); | 3628 | netif_rx_complete(tp->dev, napi); |
| 3625 | schedule_work(&tp->reset_task); | 3629 | schedule_work(&tp->reset_task); |
| 3626 | return 0; | 3630 | return work_done; |
| 3627 | } | 3631 | } |
| 3628 | 3632 | ||
| 3629 | static void tg3_irq_quiesce(struct tg3 *tp) | 3633 | static void tg3_irq_quiesce(struct tg3 *tp) |
