diff options
author | Eilon Greenstein <eilong@broadcom.com> | 2009-03-02 02:59:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-03 01:32:39 -0500 |
commit | 8534f32c2fb86bff629f7152bc3096245252062c (patch) | |
tree | cbf591739b1f5a3cf5c0c40c00ed06e8eff32756 /drivers/net/bnx2x_main.c | |
parent | 7961f79123604a395dc467c605a94bbaed74df83 (diff) |
bnx2x: napi_poll budget check
Check the napi_poll budget only when updating it. Also add a comment to explain
the rmb
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r-- | drivers/net/bnx2x_main.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index a66536ec10a4..e0851a744c42 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -10068,14 +10068,27 @@ static int bnx2x_poll(struct napi_struct *napi, int budget) | |||
10068 | if (bnx2x_has_tx_work(fp)) | 10068 | if (bnx2x_has_tx_work(fp)) |
10069 | bnx2x_tx_int(fp); | 10069 | bnx2x_tx_int(fp); |
10070 | 10070 | ||
10071 | if (bnx2x_has_rx_work(fp)) | 10071 | if (bnx2x_has_rx_work(fp)) { |
10072 | work_done = bnx2x_rx_int(fp, budget); | 10072 | work_done = bnx2x_rx_int(fp, budget); |
10073 | 10073 | ||
10074 | rmb(); /* BNX2X_HAS_WORK() reads the status block */ | 10074 | /* must not complete if we consumed full budget */ |
10075 | if (work_done >= budget) | ||
10076 | goto poll_again; | ||
10077 | } | ||
10075 | 10078 | ||
10076 | /* must not complete if we consumed full budget */ | 10079 | /* BNX2X_HAS_WORK() reads the status block, thus we need to |
10077 | if ((work_done < budget) && !BNX2X_HAS_WORK(fp)) { | 10080 | * ensure that status block indices have been actually read |
10081 | * (bnx2x_update_fpsb_idx) prior to this check (BNX2X_HAS_WORK) | ||
10082 | * so that we won't write the "newer" value of the status block to IGU | ||
10083 | * (if there was a DMA right after BNX2X_HAS_WORK and | ||
10084 | * if there is no rmb, the memory reading (bnx2x_update_fpsb_idx) | ||
10085 | * may be postponed to right before bnx2x_ack_sb). In this case | ||
10086 | * there will never be another interrupt until there is another update | ||
10087 | * of the status block, while there is still unhandled work. | ||
10088 | */ | ||
10089 | rmb(); | ||
10078 | 10090 | ||
10091 | if (!BNX2X_HAS_WORK(fp)) { | ||
10079 | #ifdef BNX2X_STOP_ON_ERROR | 10092 | #ifdef BNX2X_STOP_ON_ERROR |
10080 | poll_panic: | 10093 | poll_panic: |
10081 | #endif | 10094 | #endif |
@@ -10087,6 +10100,7 @@ poll_panic: | |||
10087 | le16_to_cpu(fp->fp_c_idx), IGU_INT_ENABLE, 1); | 10100 | le16_to_cpu(fp->fp_c_idx), IGU_INT_ENABLE, 1); |
10088 | } | 10101 | } |
10089 | 10102 | ||
10103 | poll_again: | ||
10090 | return work_done; | 10104 | return work_done; |
10091 | } | 10105 | } |
10092 | 10106 | ||