brcms_b_txstatus and brcms_b_recv are off by one when
doing bounds checking on number of packets to process
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
s1 = bcma_read32(core, D11REGOFFS(frmtxstatus));
while (!(*fatal)
&& (s1 & TXS_V)) {
s1 = bcma_read32(core, D11REGOFFS(frmtxstatus));
while (!(*fatal)
&& (s1 & TXS_V)) {
+ /* !give others some time to run! */
+ if (n >= max_tx_num) {
+ morepending = true;
+ break;
+ }
if (s1 == 0xffffffff) {
brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit,
__func__);
if (s1 == 0xffffffff) {
brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit,
__func__);
+ *fatal = true;
+ return false;
}
s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2));
}
s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2));
*fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs);
*fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs);
- /* !give others some time to run! */
- if (++n >= max_tx_num)
- break;
s1 = bcma_read32(core, D11REGOFFS(frmtxstatus));
s1 = bcma_read32(core, D11REGOFFS(frmtxstatus));
- return 0;
-
- if (n >= max_tx_num)
- morepending = true;
uint n = 0;
uint bound_limit = bound ? RXBND : -1;
uint n = 0;
uint bound_limit = bound ? RXBND : -1;
skb_queue_head_init(&recv_frames);
/* gather received frames */
skb_queue_head_init(&recv_frames);
/* gather received frames */
- while (dma_rx(wlc_hw->di[fifo], &recv_frames)) {
-
/* !give others some time to run! */
/* !give others some time to run! */
- if (++n >= bound_limit)
+
+ morepending = dma_rx(wlc_hw->di[fifo], &recv_frames);
+ n++;
+ } while (morepending);
/* post more rbufs */
dma_rxfill(wlc_hw->di[fifo]);
/* post more rbufs */
dma_rxfill(wlc_hw->di[fifo]);
brcms_c_recv(wlc_hw->wlc, p);
}
brcms_c_recv(wlc_hw->wlc, p);
}
- return n >= bound_limit;
}
/* second-level interrupt processing
}
/* second-level interrupt processing