net: xsk: don't return frames via the allocator on error
authorJakub Kicinski <[email protected]>
Sat, 28 Jul 2018 03:20:08 +0000 (20:20 -0700)
committerDaniel Borkmann <[email protected]>
Tue, 31 Jul 2018 00:03:19 +0000 (02:03 +0200)
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: 173d3adb6f43 ("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]>
net/xdp/xsk.c

index 72335c2e8108996d07702086f1f1391faa33fd7d..4e937cd7c17dc6b4b617f463336e9a8d2867ed6d 100644 (file)
@@ -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;
 }