Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-06 Thread Alexei Starovoitov
On 1/6/17 2:43 AM, Daniel Borkmann wrote: On 01/05/2017 09:14 PM, Daniel Mack wrote: [...] In my use case, the actual value of a node is in fact ignored, all that matters is whether a node exists in a trie or not. The test code uses u64 for its tests. I can change it around so that the value

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-06 Thread Daniel Borkmann
On 01/05/2017 09:14 PM, Daniel Mack wrote: [...] In my use case, the actual value of a node is in fact ignored, all that matters is whether a node exists in a trie or not. The test code uses u64 for its tests. I can change it around so that the value size can be defined by userspace, but

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-05 Thread Daniel Borkmann
Hi Daniel, On 01/05/2017 09:04 PM, Daniel Mack wrote: On 01/05/2017 05:25 PM, Daniel Borkmann wrote: On 12/29/2016 06:28 PM, Daniel Mack wrote: diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c new file mode 100644 index 000..8b6a61d --- /dev/null +++ b/kernel/bpf/lpm_trie.c

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-05 Thread Daniel Mack
Hi, On 01/05/2017 09:01 PM, Daniel Borkmann wrote: > On 01/05/2017 05:25 PM, Daniel Borkmann wrote: >> On 12/29/2016 06:28 PM, Daniel Mack wrote: > [...] >>> +static struct bpf_map *trie_alloc(union bpf_attr *attr) >>> +{ >>> +struct lpm_trie *trie; >>> + >>> +/* check sanity of

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-05 Thread Daniel Mack
Hi Daniel, Thanks for your feedback! I agree on all points. Two questions below. On 01/05/2017 05:25 PM, Daniel Borkmann wrote: > On 12/29/2016 06:28 PM, Daniel Mack wrote: >> diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c >> new file mode 100644 >> index 000..8b6a61d >> ---

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-05 Thread Daniel Borkmann
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

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-05 Thread Daniel Borkmann
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

Re: [PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2017-01-05 Thread Daniel Borkmann
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

[PATCH v1 1/2] bpf: add a longest prefix match trie map implementation

2016-12-29 Thread Daniel Mack
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