mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user