AF_XDP-interaction: warning if code completed more than possible

Give a print WARN if code/AF_XDP somehow have MORE packets to
complete from CQ than our counter for xsk->outstanding_tx packets.
This should not happen, but currently hunting for a TX issue.

The code (below) reset xsk->outstanding_tx, which were introduced
via a discussion on xdp-tutorial:
 https://github.com/xdp-project/xdp-tutorial/issues/180

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
Jesper Dangaard Brouer
2022-01-14 14:33:11 +01:00
parent 49c1efadf8
commit 6d6ac23f3b

View File

@@ -568,6 +568,12 @@ static void complete_tx(struct xsk_socket_info *xsk)
}
xsk_ring_cons__release(&xsk->cq, completed);
if (completed > xsk->outstanding_tx) {
fprintf(stderr, "WARN: %s() "
"reset outstanding_tx(%d) as completed(%d)"
"more than outstanding TX pakcets\n",
__func__, xsk->outstanding_tx, completed);
}
xsk->outstanding_tx -= completed < xsk->outstanding_tx ?
completed : xsk->outstanding_tx;
}