From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jakub Kicinski Subject: [PATCH bpf] net: xsk: don't return frames via the allocator on error Date: Fri, 27 Jul 2018 20:20:08 -0700 Message-ID: <20180728032008.23402-1-jakub.kicinski@netronome.com> Cc: oss-drivers@netronome.com, netdev@vger.kernel.org, bjorn.topel@intel.com, Jakub Kicinski To: alexei.starovoitov@gmail.com, daniel@iogearbox.net Return-path: Received: from mail-qk0-f196.google.com ([209.85.220.196]:40678 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbeG1EpF (ORCPT ); Sat, 28 Jul 2018 00:45:05 -0400 Received: by mail-qk0-f196.google.com with SMTP id c126-v6so4581517qkd.7 for ; Fri, 27 Jul 2018 20:20:17 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: 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 --- Patch could as well be applied to bpf-next, since there are no drivers for AF_XDP in tree, yet. xdp_umem_get_dma() and xdp_umem_get_data() are not even exported. But one could reimplent those... As I mentioned I think this makes the entire MEM_TYPE_ZERO_COPY allocator handling dead code now :( net/xdp/xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 72335c2e8108..4e937cd7c17d 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -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; } -- 2.17.1