public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Daniel Mack <daniel@zonque•org>, ast@fb•com
Cc: dh.herrmann@gmail•com, netdev@vger•kernel.org, davem@davemloft•net
Subject: Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation
Date: Thu, 05 Jan 2017 21:01:43 +0100	[thread overview]
Message-ID: <586EA627.6020404@iogearbox.net> (raw)
In-Reply-To: <586E7366.1010708@iogearbox.net>

On 01/05/2017 05:25 PM, Daniel Borkmann wrote:
> On 12/29/2016 06:28 PM, Daniel Mack wrote:
>> This trie implements a longest prefix match algorithm that can be used
>> to match IP addresses to a stored set of ranges.
>>
>> Internally, data is stored in an unbalanced trie of nodes that has a
>> maximum height of n, where n is the prefixlen the trie was created
>> with.
>>
>> Tries may be created with prefix lengths that are multiples of 8, in
>> the range from 8 to 2048. The key used for lookup and update operations
>> is a struct bpf_lpm_trie_key, and the value is a uint64_t.
>>
>> The code carries more information about the internal implementation.
>>
>> Signed-off-by: Daniel Mack <daniel@zonque•org>
>> Reviewed-by: David Herrmann <dh.herrmann@gmail•com>
>
> Thanks for working on it, and sorry for late reply. In addition to
> Alexei's earlier comments on the cover letter, a few comments inline:
>
[...]
>> +static struct bpf_map *trie_alloc(union bpf_attr *attr)
>> +{
>> +    struct lpm_trie *trie;
>> +
>> +    /* check sanity of attributes */
>> +    if (attr->max_entries == 0 || attr->map_flags ||
>> +        attr->key_size < sizeof(struct bpf_lpm_trie_key) + 1   ||
>> +        attr->key_size > sizeof(struct bpf_lpm_trie_key) + 256 ||
>> +        attr->value_size != sizeof(u64))
>> +        return ERR_PTR(-EINVAL);

One more question on this regarding value size as u64 (perhaps I
missed it along the way): reason this was chosen was because for
keeping stats? Why not making user choose a size as in other maps,
so also custom structs could be stored there?

Thanks,
Daniel

  parent reply	other threads:[~2017-01-05 20:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 17:28 [PATCH v1 0/2] bpf: add longest prefix match map Daniel Mack
2016-12-29 17:28 ` [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation Daniel Mack
2017-01-05 16:25   ` Daniel Borkmann
2017-01-05 16:40     ` Daniel Borkmann
2017-01-05 20:01     ` Daniel Borkmann [this message]
2017-01-05 20:14       ` Daniel Mack
2017-01-06 10:43         ` Daniel Borkmann
2017-01-06 19:59           ` Alexei Starovoitov
2017-01-05 20:04     ` Daniel Mack
2017-01-05 20:20       ` Daniel Borkmann
2016-12-29 17:28 ` [PATCH v1 2/2] bpf: Add tests for the lpm trie map Daniel Mack
2016-12-30 20:25 ` [PATCH v1 0/2] bpf: add longest prefix match map David Miller

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=586EA627.6020404@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=ast@fb$(echo .)com \
    --cc=daniel@zonque$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=dh.herrmann@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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