All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Y Song <ys114321@gmail.com>
Cc: "Daniel Borkmann" <daniel@iogearbox.net>,
	"Alexei Starovoitov" <ast@kernel.org>,
	netdev <netdev@vger.kernel.org>,
	"David Miller" <davem@davemloft.net>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	"Jakub Kicinski" <jakub.kicinski@netronome.com>,
	"Björn Töpel" <bjorn.topel@gmail.com>
Subject: Re: [PATCH bpf-next 3/3] xdp: Add devmap_hash map type for looking up devices by hashed index
Date: Sat, 06 Jul 2019 10:41:41 +0200	[thread overview]
Message-ID: <87d0in1rne.fsf@toke.dk> (raw)
In-Reply-To: <CAH3MdRVHnG+cbHUmwFpkjdtBMVOVasoekxKHKn_upQuDxe5v7Q@mail.gmail.com>

Y Song <ys114321@gmail.com> writes:

> On Fri, Jul 5, 2019 at 11:14 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> From: Toke Høiland-Jørgensen <toke@redhat.com>
>>
>> A common pattern when using xdp_redirect_map() is to create a device map
>> where the lookup key is simply ifindex. Because device maps are arrays,
>> this leaves holes in the map, and the map has to be sized to fit the
>> largest ifindex, regardless of how many devices actually are actually
>> needed in the map.
>>
>> This patch adds a second type of device map where the key is looked up
>> using a hashmap, instead of being used as an array index. This allows maps
>> to be densely packed, so they can be smaller.
>>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  include/linux/bpf.h                     |    7 +
>>  include/linux/bpf_types.h               |    1
>>  include/trace/events/xdp.h              |    3
>>  include/uapi/linux/bpf.h                |    7 +
>>  kernel/bpf/devmap.c                     |  192 +++++++++++++++++++++++++++++++
>>  kernel/bpf/verifier.c                   |    2
>>  net/core/filter.c                       |    9 +
>>  tools/bpf/bpftool/map.c                 |    1
>>  tools/include/uapi/linux/bpf.h          |    7 +
>>  tools/lib/bpf/libbpf_probes.c           |    1
>>  tools/testing/selftests/bpf/test_maps.c |   16 +++
>>  11 files changed, 237 insertions(+), 9 deletions(-)
>
> Could you break this patch into multiple commits for easy backporting
> and easy syncing to libbpf repo?
> For example, you can break it into 4 patches:
>    . kernel patch
>    . sync uapi bpf.h
>    . tools/lib/bpf/libbpf_probes.c
>    . other tools changes.

Sure, I'll send a v2.

-Toke

  reply	other threads:[~2019-07-06  8:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05 17:56 [PATCH bpf-next 0/3] xdp: Add devmap_hash map type Toke Høiland-Jørgensen
2019-07-05 17:56 ` [PATCH bpf-next 1/3] include/bpf.h: Remove map_insert_ctx() stubs Toke Høiland-Jørgensen
2019-07-05 17:56 ` [PATCH bpf-next 3/3] xdp: Add devmap_hash map type for looking up devices by hashed index Toke Høiland-Jørgensen
2019-07-05 22:04   ` Y Song
2019-07-06  8:41     ` Toke Høiland-Jørgensen [this message]
2019-07-05 17:56 ` [PATCH bpf-next 2/3] xdp: Refactor devmap allocation code for reuse Toke Høiland-Jørgensen
2019-07-08 15:06   ` Jonathan Lemon
2019-07-08 15:19     ` Toke Høiland-Jørgensen
2019-07-08 15:10 ` [PATCH bpf-next 0/3] xdp: Add devmap_hash map type Jonathan Lemon
2019-07-08 15:40   ` Toke Høiland-Jørgensen
2019-07-08 16:50     ` Jonathan Lemon

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=87d0in1rne.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=ast@kernel.org \
    --cc=bjorn.topel@gmail.com \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=ys114321@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 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.