On Tue, Feb 16, 2021 at 10:00 AM Denis Salopek <denis.salopek@xxxxxxxxxx> wrote: > > On Mon, Feb 08, 2021 at 09:44:59PM -0800, Andrii Nakryiko wrote: > > On Wed, Jan 27, 2021 at 9:15 AM Denis Salopek <denis.salopek@xxxxxxxxxx> wrote: > > > > > > Extend the existing bpf_map_lookup_and_delete_elem() functionality to > > > hashtab maps, in addition to stacks and queues. > > > Create a new hashtab bpf_map_ops function that does lookup and deletion > > > of the element under the same bucket lock and add the created map_ops to > > > bpf.h. > > > Add the appropriate test case to 'maps' selftests. > > > > > > Signed-off-by: Denis Salopek <denis.salopek@xxxxxxxxxx> > > > Cc: Juraj Vijtiuk <juraj.vijtiuk@xxxxxxxxxx> > > > Cc: Luka Oreskovic <luka.oreskovic@xxxxxxxxxx> > > > Cc: Luka Perkov <luka.perkov@xxxxxxxxxx> > > > --- > > > > I think this patch somehow got lost, even though it seems like a good > > addition. I'd recommend rebasing and re-submitting to let people take > > a fresh look at this. > > > > It would also be nice to have a test_progs test added, not just > > test_maps. I'd also look at supporting lookup_and_delete for other > > kinds of hash maps (LRU, per-CPU), so that the support is more > > complete. Thanks! > > > > Hi Andrii, > > I'll also implement the LRU and per-CPU ones and resubmit. I don't quite > understand the test_progs, what kind of test(s) exactly should I add there? test_progs is our preferred test runner. It's a collection of independent tests (sometimes including subtests). See any of the recently added tests to get a feel for it. test_progs' tests resemble real-world applications much closer than test_verifier or test_maps tests, so it serves both as a readable test and as an API demo. > > Denis > > > > include/linux/bpf.h | 1 + > > > kernel/bpf/hashtab.c | 38 +++++++++++++++++++++++++ > > > kernel/bpf/syscall.c | 9 ++++++ > > > tools/testing/selftests/bpf/test_maps.c | 7 +++++ > > > 4 files changed, 55 insertions(+) > > > > > > > [...]