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

2017-01-23 Thread Daniel Mack
On 01/23/2017 05:39 PM, Daniel Borkmann wrote: > On 01/21/2017 05:26 PM, Daniel Mack wrote: > [...] >> +/* Called from syscall or from eBPF program */ >> +static int trie_update_elem(struct bpf_map *map, >> +void *_key, void *value, u64 flags) >> +{ >> +struct lpm_trie

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

2017-01-23 Thread Daniel Borkmann
On 01/21/2017 05:26 PM, Daniel Mack wrote: [...] +/* Called from syscall or from eBPF program */ +static int trie_update_elem(struct bpf_map *map, + void *_key, void *value, u64 flags) +{ + struct lpm_trie *trie = container_of(map, struct lpm_trie, map); +

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

2017-01-22 Thread Alexei Starovoitov
On Sat, Jan 21, 2017 at 05:26:11PM +0100, 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

[PATCH v4 1/3] bpf: add a longest prefix match trie map implementation

2017-01-21 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