mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 12:25:18 +02:00
gve: Fix XDP TX completion handling when counters overflow
[ Upstream commit03b54bad26
] In gve_clean_xdp_done, the driver processes the TX completions based on a 32-bit NIC counter and a 32-bit completion counter stored in the tx queue. Fix the for loop so that the counter wraparound is handled correctly. Fixes:75eaae158b
("gve: Add XDP DROP and TX support for GQI-QPL format") Signed-off-by: Joshua Washington <joshwash@google.com> Signed-off-by: Praveen Kaligineedi <pkaligineedi@google.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20240716171041.1561142-1-pkaligineedi@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3dd428039e
commit
9b66bb1c58
|
@ -158,15 +158,16 @@ static int gve_clean_xdp_done(struct gve_priv *priv, struct gve_tx_ring *tx,
|
||||||
u32 to_do)
|
u32 to_do)
|
||||||
{
|
{
|
||||||
struct gve_tx_buffer_state *info;
|
struct gve_tx_buffer_state *info;
|
||||||
u32 clean_end = tx->done + to_do;
|
|
||||||
u64 pkts = 0, bytes = 0;
|
u64 pkts = 0, bytes = 0;
|
||||||
size_t space_freed = 0;
|
size_t space_freed = 0;
|
||||||
u32 xsk_complete = 0;
|
u32 xsk_complete = 0;
|
||||||
u32 idx;
|
u32 idx;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (; tx->done < clean_end; tx->done++) {
|
for (i = 0; i < to_do; i++) {
|
||||||
idx = tx->done & tx->mask;
|
idx = tx->done & tx->mask;
|
||||||
info = &tx->info[idx];
|
info = &tx->info[idx];
|
||||||
|
tx->done++;
|
||||||
|
|
||||||
if (unlikely(!info->xdp.size))
|
if (unlikely(!info->xdp.size))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user