All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] net: xsk: don't return frames via the allocator on error
@ 2018-07-28  3:20 Jakub Kicinski
  2018-07-30 11:04 ` Björn Töpel
  2018-07-31  0:05 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2018-07-28  3:20 UTC (permalink / raw)
  To: alexei.starovoitov, daniel
  Cc: oss-drivers, netdev, bjorn.topel, Jakub Kicinski

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 <jakub.kicinski@netronome.com>
---
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf] net: xsk: don't return frames via the allocator on error
  2018-07-28  3:20 [PATCH bpf] net: xsk: don't return frames via the allocator on error Jakub Kicinski
@ 2018-07-30 11:04 ` Björn Töpel
  2018-07-31  0:05 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Björn Töpel @ 2018-07-30 11:04 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Alexei Starovoitov, Daniel Borkmann, oss-drivers, Netdev,
	Björn Töpel

Den lör 28 juli 2018 kl 05:21 skrev Jakub Kicinski
<jakub.kicinski@netronome.com>:
>
> 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 <jakub.kicinski@netronome.com>
> ---
> 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 :(
>

Nice Jakub!

Indeed, as you state, there's no ZC driver implementation yet. So,
either bpf or bpf-next.

Acked-by: Björn Töpel <bjorn.topel@intel.com>

>  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf] net: xsk: don't return frames via the allocator on error
  2018-07-28  3:20 [PATCH bpf] net: xsk: don't return frames via the allocator on error Jakub Kicinski
  2018-07-30 11:04 ` Björn Töpel
@ 2018-07-31  0:05 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2018-07-31  0:05 UTC (permalink / raw)
  To: Jakub Kicinski, alexei.starovoitov; +Cc: oss-drivers, netdev, bjorn.topel

On 07/28/2018 05:20 AM, Jakub Kicinski wrote:
> 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 <jakub.kicinski@netronome.com>

Applied to bpf, thanks Jakub!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-31  1:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-28  3:20 [PATCH bpf] net: xsk: don't return frames via the allocator on error Jakub Kicinski
2018-07-30 11:04 ` Björn Töpel
2018-07-31  0:05 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.