wl12xx: handle wrap-around overflow in released Tx blocks FW counter
When the FW Tx released blocks counter wraps around, we should correct our calculation of released blocks. Otherwise we add a large negative figure to our driver freed blocks counter Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
This commit is contained in:
parent
742246f8bc
commit
bdf91cfae6
|
@ -834,8 +834,15 @@ static void wl12xx_fw_status(struct wl1271 *wl,
|
||||||
wl->tx_pkts_freed[i] = status->tx_released_pkts[i];
|
wl->tx_pkts_freed[i] = status->tx_released_pkts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
freed_blocks = le32_to_cpu(status->total_released_blks) -
|
/* prevent wrap-around in total blocks counter */
|
||||||
wl->tx_blocks_freed;
|
if (likely(wl->tx_blocks_freed <=
|
||||||
|
le32_to_cpu(status->total_released_blks)))
|
||||||
|
freed_blocks = le32_to_cpu(status->total_released_blks) -
|
||||||
|
wl->tx_blocks_freed;
|
||||||
|
else
|
||||||
|
freed_blocks = 0x100000000LL - wl->tx_blocks_freed +
|
||||||
|
le32_to_cpu(status->total_released_blks);
|
||||||
|
|
||||||
wl->tx_blocks_freed = le32_to_cpu(status->total_released_blks);
|
wl->tx_blocks_freed = le32_to_cpu(status->total_released_blks);
|
||||||
|
|
||||||
wl->tx_allocated_blocks -= freed_blocks;
|
wl->tx_allocated_blocks -= freed_blocks;
|
||||||
|
|
Loading…
Reference in New Issue