bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: William Tu <u9012063@gmail.com>
Cc: "Magnus Karlsson" <magnus.karlsson@intel.com>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Network Development" <netdev@vger.kernel.org>,
	"Jonathan Lemon" <jonathan.lemon@gmail.com>,
	bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next 0/5] Extend libbpf to support shared umems and Rx|Tx-only sockets
Date: Fri, 8 Nov 2019 19:09:27 +0100	[thread overview]
Message-ID: <CAJ8uoz2oNHtyBaHtKJv-37oKRZykAtC3Q_ok8CmvO7RmdJoTNg@mail.gmail.com> (raw)
In-Reply-To: <20191108145738.GC36440@gmail.com>

On Fri, Nov 8, 2019 at 3:58 PM William Tu <u9012063@gmail.com> wrote:
>
> On Thu, Nov 07, 2019 at 06:47:35PM +0100, Magnus Karlsson wrote:
> > This patch set extends libbpf and the xdpsock sample program to
> > demonstrate the shared umem mode (XDP_SHARED_UMEM) as well as Rx-only
> > and Tx-only sockets. This in order for users to have an example to use
> > as a blue print and also so that these modes will be exercised more
> > frequently.
> >
> > Note that the user needs to supply an XDP program with the
> > XDP_SHARED_UMEM mode that distributes the packets over the sockets
> > according to some policy. There is an example supplied with the
> > xdpsock program, but there is no default one in libbpf similarly to
> > when XDP_SHARED_UMEM is not used. The reason for this is that I felt
> > that supplying one that would work for all users in this mode is
> > futile. There are just tons of ways to distribute packets, so whatever
> > I come up with and build into libbpf would be wrong in most cases.
> >
> Hi Magnus,
>
> Thanks for the patch.
> I look at the sample code and it's sharing a umem among multiple queues in
> the same netdev. Is it possible to shared one umem across multiple netdevs?

It should be possible to register the same umem area multiple times
(wasting memory in the current implementation though). I have not
tried this though, so I might be surprised. You really have to make
sure that you only give a buffer (through the Tx or fill rings) to a
single device. If you do not, your packets will be garbled. But this
needs some testing first and some extension to libbpf to make it
simple. I can try it out, but this will be another patch set.

/Magnus

> For example in OVS, one might create multiple tap/veth devices (using skb-mode
> or native-mode). And I want to save memory by having just one shared umem for
> these devices.
>
> Thanks
> --William
>
> > This patch has been applied against commit 30ee348c1267 ("Merge branch 'bpf-libbpf-fixes'")
> >
> > Structure of the patch set:
> >
> > Patch 1: Adds shared umem support to libbpf
> > Patch 2: Shared umem support and example XPD program added to xdpsock sample
> > Patch 3: Adds Rx-only and Tx-only support to libbpf
> > Patch 4: Uses Rx-only sockets for rxdrop and Tx-only sockets for txpush in
> >          the xdpsock sample
> > Patch 5: Add documentation entries for these two features
> >
> > Thanks: Magnus
> >
> > Magnus Karlsson (5):
> >   libbpf: support XDP_SHARED_UMEM with external XDP program
> >   samples/bpf: add XDP_SHARED_UMEM support to xdpsock
> >   libbpf: allow for creating Rx or Tx only AF_XDP sockets
> >   samples/bpf: use Rx-only and Tx-only sockets in xdpsock
> >   xsk: extend documentation for Rx|Tx-only sockets and shared umems
> >
> >  Documentation/networking/af_xdp.rst |  28 +++++--
> >  samples/bpf/Makefile                |   1 +
> >  samples/bpf/xdpsock.h               |  11 +++
> >  samples/bpf/xdpsock_kern.c          |  24 ++++++
> >  samples/bpf/xdpsock_user.c          | 158 ++++++++++++++++++++++++++----------
> >  tools/lib/bpf/xsk.c                 |  32 +++++---
> >  6 files changed, 195 insertions(+), 59 deletions(-)
> >  create mode 100644 samples/bpf/xdpsock.h
> >  create mode 100644 samples/bpf/xdpsock_kern.c
> >
> > --
> > 2.7.4

  reply	other threads:[~2019-11-08 18:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 17:47 [PATCH bpf-next 0/5] Extend libbpf to support shared umems and Rx|Tx-only sockets Magnus Karlsson
2019-11-07 17:47 ` [PATCH bpf-next 1/5] libbpf: support XDP_SHARED_UMEM with external XDP program Magnus Karlsson
2019-11-08 18:03   ` William Tu
2019-11-08 18:19     ` Magnus Karlsson
2019-11-08 18:43       ` William Tu
2019-11-08 19:17         ` Magnus Karlsson
2019-11-08 22:31           ` William Tu
2019-11-08 22:56   ` Jonathan Lemon
2019-11-10 18:34     ` William Tu
2019-11-07 17:47 ` [PATCH bpf-next 2/5] samples/bpf: add XDP_SHARED_UMEM support to xdpsock Magnus Karlsson
2019-11-08 18:13   ` William Tu
2019-11-08 18:33     ` Magnus Karlsson
2019-11-08 19:09       ` William Tu
2019-11-08 22:59   ` Jonathan Lemon
2019-11-10 18:34     ` William Tu
2019-11-07 17:47 ` [PATCH bpf-next 3/5] libbpf: allow for creating Rx or Tx only AF_XDP sockets Magnus Karlsson
2019-11-08 23:00   ` Jonathan Lemon
2019-11-10 18:34     ` William Tu
2019-11-07 17:47 ` [PATCH bpf-next 4/5] samples/bpf: use Rx-only and Tx-only sockets in xdpsock Magnus Karlsson
2019-11-08 23:02   ` Jonathan Lemon
2019-11-10 18:34     ` William Tu
2019-11-07 17:47 ` [PATCH bpf-next 5/5] xsk: extend documentation for Rx|Tx-only sockets and shared umems Magnus Karlsson
2019-11-08 23:03   ` Jonathan Lemon
2019-11-10 18:35     ` William Tu
2019-11-08 14:57 ` [PATCH bpf-next 0/5] Extend libbpf to support shared umems and Rx|Tx-only sockets William Tu
2019-11-08 18:09   ` Magnus Karlsson [this message]
2019-11-11  3:32 ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ8uoz2oNHtyBaHtKJv-37oKRZykAtC3Q_ok8CmvO7RmdJoTNg@mail.gmail.com \
    --to=magnus.karlsson@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jonathan.lemon@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=u9012063@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).