AF_XDP-interaction: Fix function tx_pkt

If there were more transmit slots, then we umem free the
packet, but we continued sending it anyhow.

The places tx_pkt() is currently used this never happened.
Still fix the bug.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
Jesper Dangaard Brouer
2022-02-21 19:03:49 +01:00
parent dd24bce55c
commit ce714625ce

View File

@@ -884,8 +884,9 @@ static int tx_pkt(struct config *cfg, struct xsk_socket_info *xsk)
if (ret != 1) {
/* No more transmit slots, drop the packet */
mem_free_umem_frame(&umem->mem, pkt_addr);
fprintf(stderr, "ERR - %s() failed transmit\n",
fprintf(stderr, "ERR: %s() failed transmit, no slots\n",
__func__);
return ENOSPC;
}
xsk_ring_prod__tx_desc(&xsk->tx, tx_idx)->addr = pkt_addr;