Skip to content

Commit

Permalink
gve: Fix XDP TX completion handling when counters overflow
Browse files Browse the repository at this point in the history
[ Upstream commit 03b54ba ]

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: 75eaae1 ("gve: Add XDP DROP and TX support for GQI-QPL format")
Signed-off-by: Joshua Washington <[email protected]>
Signed-off-by: Praveen Kaligineedi <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
josh8551021 authored and gregkh committed Aug 3, 2024
1 parent c420cd5 commit c62bf09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/google/gve/gve_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,16 @@ static int gve_clean_xdp_done(struct gve_priv *priv, struct gve_tx_ring *tx,
u32 to_do)
{
struct gve_tx_buffer_state *info;
u32 clean_end = tx->done + to_do;
u64 pkts = 0, bytes = 0;
size_t space_freed = 0;
u32 xsk_complete = 0;
u32 idx;
int i;

for (; tx->done < clean_end; tx->done++) {
for (i = 0; i < to_do; i++) {
idx = tx->done & tx->mask;
info = &tx->info[idx];
tx->done++;

if (unlikely(!info->xdp.size))
continue;
Expand Down

0 comments on commit c62bf09

Please sign in to comment.