Skip to content

Commit

Permalink
net: xsk: don't return frames via the allocator on error
Browse files Browse the repository at this point in the history
xdp_return_buff() is used when frame has been successfully
handled (transmitted) or if an error occurred during delayed
processing and there is no way to report it back to
xdp_do_redirect().

In case of __xsk_rcv_zc() error is propagated all the way
back to the driver, so there is no need to call
xdp_return_buff().  Driver will recycle the frame anyway
after seeing that error happened.

Fixes: 173d3ad ("xsk: add zero-copy support for Rx")
Signed-off-by: Jakub Kicinski <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
Jakub Kicinski authored and borkmann committed Jul 31, 2018
1 parent 573b3aa commit 2d55d61
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ static int __xsk_rcv_zc(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
{
int err = xskq_produce_batch_desc(xs->rx, (u64)xdp->handle, len);

if (err) {
xdp_return_buff(xdp);
if (err)
xs->rx_dropped++;
}

return err;
}
Expand Down

0 comments on commit 2d55d61

Please sign in to comment.