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