]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add uniqueness invariant to trivial lpm test implementation
authorCraig Gallek <kraig@google.com>
Mon, 18 Sep 2017 19:30:56 +0000 (15:30 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Sep 2017 20:55:15 +0000 (13:55 -0700)
commitbfd8d8ea3a37183a8c19608ad21af49f153e964e
tree55e96d451e143911d36be93038b0cd17f53a5683
parent77f1747d1e633562bdfff26923426763210fafa1
bpf: Add uniqueness invariant to trivial lpm test implementation

The 'trivial' lpm implementation in this test allows equivalent nodes
to be added (that is, nodes consisting of the same prefix and prefix
length).  For lookup operations, this is fine because insertion happens
at the head of the (singly linked) list and the first, best match is
returned.  In order to support deletion, the tlpm data structue must
first enforce uniqueness.  This change modifies the insertion algorithm
to search for equivalent nodes and remove them.  Note: the
BPF_MAP_TYPE_LPM_TRIE already has a uniqueness invariant that is
implemented as node replacement.

Signed-off-by: Craig Gallek <kraig@google.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/bpf/test_lpm_map.c