Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3506619imb; Tue, 5 Mar 2019 11:05:55 -0800 (PST) X-Google-Smtp-Source: APXvYqysG0xoC4v5aDzGZsnpya14nbE32kDaimUbSxQtqGhjOGQzw4Js4RVU5atbvuSs6DBf4aBF X-Received: by 2002:a63:c705:: with SMTP id n5mr2669316pgg.73.1551812755224; Tue, 05 Mar 2019 11:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551812755; cv=none; d=google.com; s=arc-20160816; b=PG8vHAiGoI9UrH1EMBihBscsITNRRWA6rkbJVDAIt72XsZei638zkLPHRv1oa7+gle Tr40tfYvgH19nVRxfovSWDUBIldiedZj/m5ZAllGnZp74+OaFqOAa7oHM+7zRd1HaCk9 H67EFPFBf/aWjeFwLfoiQNq4zYgztEqWXpY/ltHJ7LF82ZGRpVVrOJnVU6X6Lokky+9Q yfdcxDxtW7DNtPKwSaF+Pwp8F+m0hBZJi7B2486G/oR9Hld7dcQaTIpsxOwj2CHrnSfs 6DPXUXh92u0x74+n89bGPMRwInOK+siHD4CoFRisoF20SwjuZFnLlCSZXp2B6ZnaKXT2 sgzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:openpgp:from:references:cc:to :dkim-signature; bh=KKBb0F0mLsM0IaZh02AGpd5qe9JwtI+GVMPaoPv06Xc=; b=AOZUjgaAvi+ifnoWSdlLprziSN4o4z42SFQx8u43Wn4Rok5U8LbzLoPbmHUNSpEQU/ V05ZIIrBQr+U7/OAOsOWm9/3WdZPjNChj3Lt6JXC0FEs5M9eLR9+7As9zF/dOaBlXNi4 F/O/m4owbQtEcANAJ+2eo1Q6iaUZ+25iMSg54rgzmjNB3kB2q1RkJCUKO0ebaG37kdmN shN0VrtqtkLEF2Dc5VCCBEhYMyJN4u3IcpBeMZnDwgQ8G1WC2vbbH7YCo2Epsug9uJ5s P1zgZ0K//UTcyyaYHrG3otfTqoGsLSNwL5cUrg0wTVWCd/AvvP4fir9fO+6JEUZAo2/N uoKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=0rOiXqUY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si8569198pgq.591.2019.03.05.11.05.38; Tue, 05 Mar 2019 11:05:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=0rOiXqUY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727720AbfCES14 (ORCPT + 99 others); Tue, 5 Mar 2019 13:27:56 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46264 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726256AbfCES1z (ORCPT ); Tue, 5 Mar 2019 13:27:55 -0500 Received: by mail-wr1-f68.google.com with SMTP id i16so10556636wrs.13 for ; Tue, 05 Mar 2019 10:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=to:cc:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KKBb0F0mLsM0IaZh02AGpd5qe9JwtI+GVMPaoPv06Xc=; b=0rOiXqUYBH+bs2tZhjfpSbND9RKQKyFyLe8abxNRMgyQ/LC3vXONcdmmp+HO2ukwLI b6xLqIp3XKEXX+/Uh0TJ7pyB8dVByfW3P6E7h+hFXxkqRrLzbFveUZQA7V8Qa84XyDG7 Ye+thvOFLTIJD/vQxsjJ+ptpcywMViXgw6KJcoUY0nuwYQXLO/0CGCnZ0TDprxWzHzx1 Kt+e938l5nKRHscc5l8J1vjHi1yck9ur4Q1Dm2qR5CzJmUpf970ysnvt9IWoCeiAp2fP GrZO4LFr4+9MG+mBO14dZF+N8hgfQ2KZvHjtE3+ZUXa247Aw6YTMXKD5D5dOnCWWR1l7 zxoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:openpgp:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=KKBb0F0mLsM0IaZh02AGpd5qe9JwtI+GVMPaoPv06Xc=; b=AlAyb9foq++tWe3/4/WL73VSYjALC9L521eoNPF5t9v76HyXDW3ZEv3bDViFM5RJWc iL9ooplelDmmTHaKwF4XDPPo70d5rMBmA61A1vx6GqYQ2IMs2iTt7F+4Qp7tJKbmFtJ1 avDpWzBb0ee37Apd5ey+mzmJeAJGMQclVR9WgFo+U9Vx5KwOsWEHy3q0i4B3qCUf7pGf 4JIYMez7oKbBeJVbUITBm6kKl8PVCbShfu1DK7UcspRphLFchMbhbyoKgMr7tGcQkYf0 bRKRJqW2Cse4P7eAlIKpOKkT8Zh2O+FegJfHr14Hd9mOk5VeIhB4zvcrr9V1sc287flH vFJw== X-Gm-Message-State: APjAAAUnsG2Zo8RsW60+RFNbvifUGdEHGoTbTQR7x55SByittHEsUJxV Q9gN+4BVVqVMUnRs5sc/jxIbAIBAow8= X-Received: by 2002:a5d:5506:: with SMTP id b6mr157807wrv.33.1551810473028; Tue, 05 Mar 2019 10:27:53 -0800 (PST) Received: from [172.20.1.107] ([217.38.71.146]) by smtp.gmail.com with ESMTPSA id c2sm12593834wrt.93.2019.03.05.10.27.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 10:27:52 -0800 (PST) To: Alban Crequy , ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alban@kinvolk.io, iago@kinvolk.io References: <20190305163803.18915-1-alban@kinvolk.io> From: Quentin Monnet Openpgp: preference=signencrypt Autocrypt: addr=quentin.monnet@netronome.com; prefer-encrypt=mutual; keydata= mQINBFnqRlsBEADfkCdH/bkkfjbglpUeGssNbYr/TD4aopXiDZ0dL2EwafFImsGOWmCIIva2 MofTQHQ0tFbwY3Ir74exzU9X0aUqrtHirQHLkKeMwExgDxJYysYsZGfM5WfW7j8X4aVwYtfs AVRXxAOy6/bw1Mccq8ZMTYKhdCgS3BfC7qK+VYC4bhM2AOWxSQWlH5WKQaRbqGOVLyq8Jlxk 2FGLThUsPRlXKz4nl+GabKCX6x3rioSuNoHoWdoPDKsRgYGbP9LKRRQy3ZeJha4x+apy8rAM jcGHppIrciyfH38+LdV1FVi6sCx8sRKX++ypQc3fa6O7d7mKLr6uy16xS9U7zauLu1FYLy2U N/F1c4F+bOlPMndxEzNc/XqMOM9JZu1XLluqbi2C6JWGy0IYfoyirddKpwzEtKIwiDBI08JJ Cv4jtTWKeX8pjTmstay0yWbe0sTINPh+iDw+ybMwgXhr4A/jZ1wcKmPCFOpb7U3JYC+ysD6m 6+O/eOs21wVag/LnnMuOKHZa2oNsi6Zl0Cs6C7Vve87jtj+3xgeZ8NLvYyWrQhIHRu1tUeuf T8qdexDphTguMGJbA8iOrncHXjpxWhMWykIyN4TYrNwnyhqP9UgqRPLwJt5qB1FVfjfAlaPV sfsxuOEwvuIt19B/3pAP0nbevNymR3QpMPRl4m3zXCy+KPaSSQARAQABtC1RdWVudGluIE1v bm5ldCA8cXVlbnRpbi5tb25uZXRAbmV0cm9ub21lLmNvbT6J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h2xBhWGuZ9CpBuXjtPrnRSd8xdrw36AL53goTt/NiLHUd RHhSHGnKaQ6MfrTge5Q0h5A= Subject: Re: [PATCH bpf-next v1] tools/bpftool: create map of maps Message-ID: Date: Tue, 5 Mar 2019 18:27:51 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.2 MIME-Version: 1.0 In-Reply-To: <20190305163803.18915-1-alban@kinvolk.io> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2019-03-05 17:38 UTC+0100 ~ Alban Crequy > From: Alban Crequy > > Before this patch, there was no way to fill attr.inner_map_fd, necessary > for array_of_maps or hash_of_maps. > > This patch adds keyword 'innermap' to pass the innermap, either as an id > or as a pinned map. > > Example of commands: > > $ sudo bpftool map create /sys/fs/bpf/innermap type hash \ > key 8 value 8 entries 64 name innermap flags 1 > $ sudo bpftool map create /sys/fs/bpf/outermap type hash_of_maps \ > innermap pinned /sys/fs/bpf/innermap key 64 value 4 \ > entries 64 name myoutermap flags 1 > $ sudo bpftool map show pinned /sys/fs/bpf/outermap > 47: hash_of_maps name myoutermap flags 0x1 > key 64B value 4B max_entries 64 memlock 12288B > > Documentation and bash completion updated as well. > > Signed-off-by: Alban Crequy Thanks Alban! > --- > tools/bpf/bpftool/Documentation/bpftool-prog.rst | 2 +- > tools/bpf/bpftool/bash-completion/bpftool | 13 +++++++++++++ > tools/bpf/bpftool/map.c | 5 ++++- > 3 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst > index 9386bd6e0396..35902ab95cc5 100644 > --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst > +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst > @@ -25,7 +25,7 @@ PROG COMMANDS > | **bpftool** **prog dump xlated** *PROG* [{**file** *FILE* | **opcodes** | **visual** | **linum**}] > | **bpftool** **prog dump jited** *PROG* [{**file** *FILE* | **opcodes** | **linum**}] > | **bpftool** **prog pin** *PROG* *FILE* > -| **bpftool** **prog { load | loadall }** *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] > +| **bpftool** **prog { load | loadall }** *OBJ* *PATH* [**type** *TYPE*] [**map** {**idx** *IDX* | **name** *NAME*} *MAP*] [**dev** *NAME*] [**innermap** MAP] This page is the documentation for "bpftool prog" commands. You want "bpftool map" (tools/bpf/bpftool/Documentation/bpftool-map.rst) instead. You also need to update the description line for the "bpftool map create" command further down in the bpftool-map.rst page. And could you please add a sentence to that description to explain what the argument is for? > | **bpftool** **prog attach** *PROG* *ATTACH_TYPE* [*MAP*] > | **bpftool** **prog detach** *PROG* *ATTACH_TYPE* [*MAP*] > | **bpftool** **prog tracelog** > diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool > index b803827d01e8..dcdc39510dc3 100644 > --- a/tools/bpf/bpftool/bash-completion/bpftool > +++ b/tools/bpf/bpftool/bash-completion/bpftool > @@ -461,6 +461,18 @@ _bpftool() > _sysfs_get_netdevs > return 0 > ;; > + innermap) > + COMPREPLY+=( $( compgen -W "id pinned" -- "$cur" ) ) > + return 0 > + ;; > + id) > + _bpftool_get_map_ids > + return 0 > + ;; > + pinned) > + _filedir > + return 0 > + ;; No need to add completion here for "pinned", it is handled already [0]. [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/bpf/bpftool/bash-completion/bpftool?h=v5.0#n172 > *) > _bpftool_once_attr 'type' > _bpftool_once_attr 'key' > @@ -469,6 +481,7 @@ _bpftool() > _bpftool_once_attr 'name' > _bpftool_once_attr 'flags' > _bpftool_once_attr 'dev' > + _bpftool_once_attr 'innermap' > return 0 > ;; > esac > diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c > index e0c650d91784..7d8ce903a471 100644 > --- a/tools/bpf/bpftool/map.c > +++ b/tools/bpf/bpftool/map.c > @@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv) > return -1; > } > NEXT_ARG(); > + } else if (is_prefix(*argv, "innermap")) { > + NEXT_ARG(); > + attr.inner_map_fd = map_parse_fd(&argc, &argv); > } > } > > @@ -1231,7 +1234,7 @@ static int do_help(int argc, char **argv) > "Usage: %s %s { show | list } [MAP]\n" > " %s %s create FILE type TYPE key KEY_SIZE value VALUE_SIZE \\\n" > " entries MAX_ENTRIES name NAME [flags FLAGS] \\\n" > - " [dev NAME]\n" > + " [dev NAME] [innermap MAP]\n" > " %s %s dump MAP\n" > " %s %s update MAP [key DATA] [value VALUE] [UPDATE_FLAGS]\n" > " %s %s lookup MAP [key DATA]\n" >