From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [bpf-next PATCH v2 2/3] bpf: sockmap, add hash map support Date: Fri, 27 Apr 2018 17:09:16 -0700 Message-ID: <20180428000914.5k5xzgdbcadnx32g@ast-mbp> References: <20180427232047.9985.3540.stgit@john-Precision-Tower-5810> <20180427232437.9985.16313.stgit@john-Precision-Tower-5810> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org To: John Fastabend Return-path: Received: from mail-pf0-f196.google.com ([209.85.192.196]:35680 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933115AbeD1AJU (ORCPT ); Fri, 27 Apr 2018 20:09:20 -0400 Received: by mail-pf0-f196.google.com with SMTP id j5so2591073pfh.2 for ; Fri, 27 Apr 2018 17:09:20 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180427232437.9985.16313.stgit@john-Precision-Tower-5810> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Apr 27, 2018 at 04:24:38PM -0700, John Fastabend wrote: > Sockmap is currently backed by an array and enforces keys to be > four bytes. This works well for many use cases and was originally > modeled after devmap which also uses four bytes keys. However, > this has become limiting in larger use cases where a hash would > be more appropriate. For example users may want to use the 5-tuple > of the socket as the lookup key. > > To support this add hash support. > > Signed-off-by: John Fastabend > --- > include/linux/bpf.h | 8 + > include/linux/bpf_types.h | 1 > include/uapi/linux/bpf.h | 6 > kernel/bpf/core.c | 1 > kernel/bpf/sockmap.c | 494 +++++++++++++++++++++++++++++++++++++++- > kernel/bpf/verifier.c | 14 + > net/core/filter.c | 58 +++++ > tools/bpf/bpftool/map.c | 1 > tools/include/uapi/linux/bpf.h | 6 > 9 files changed, 570 insertions(+), 19 deletions(-) please split tools/* update into separate commit. Also add man-page style documentation for new helpers to uapi/bpf.h