From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0561DC83000 for ; Wed, 29 Apr 2020 14:45:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9A7B21D7F for ; Wed, 29 Apr 2020 14:45:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=isovalent-com.20150623.gappssmtp.com header.i=@isovalent-com.20150623.gappssmtp.com header.b="wUbi7mkp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726654AbgD2OpS (ORCPT ); Wed, 29 Apr 2020 10:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726739AbgD2OpO (ORCPT ); Wed, 29 Apr 2020 10:45:14 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE03C035494 for ; Wed, 29 Apr 2020 07:45:12 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id 188so2327746wmc.2 for ; Wed, 29 Apr 2020 07:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isovalent-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aRCfBdadPVTEiQclG9/KJeo/s7dbbAmCdTeG8F+tkxA=; b=wUbi7mkpnNEN5zj8+u1ht0k7eGCD4TBzIziguxbHRtKxdpq702xSX1p0yi+H7Pmy79 q/QyCXAMqlHh4OFoXREH9QVKGlfkidf+KNl7b7jbaYtb1Bd8nOggBQMOEsv3lREyI6MW S+7FutxSUe65+1EuBYmtb3vz9fb9y7lhiCkrT/nwY5jvx5v1qB9dfDTgsDx5FFdRhDyv HnxWsvajaIw9XWTics3PDB5GNkOnrIuwyfHNQcWrFYwW9eSZmR1z1ggpiD1xCEj6w/SC fPJKmK0cqSXBLtBrSCLvsKgdN7OPIYMha/rtVR7BpOjShPQWAZs76TUSlzcTdivjTeOj Rs2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aRCfBdadPVTEiQclG9/KJeo/s7dbbAmCdTeG8F+tkxA=; b=G4pIsWtSwm7UieIVZbXe/thVikfe/gmrl88pFqnB8PvhMTF2IC8Ny93AsYU+N0YWmq tin/Oe2sK4gB81PBoBvShJ+pGLDOLcWE66qYMrLNaUnDVfEZZQYfo7SiV6Rq7dgn8Vam 6+X5zL/5iYfUc4Q+lrFispRYf1re3L4HV17ssjFvDuLRO2b3KSvhUYTdjdjH1WMdH9Mj IxAl4Jg07N9bX7h7SLpug8p4s3OGQrR0qk2/s4Le199iR5jNVZpFwFboFakULWPLy6Q3 jGXsBqx3rCEWqkh1cUMLIV7HwKoEEONAQcyxMzO6lB5j0uQ/ymARxYdnNzPsjwJEP6VQ +Dhg== X-Gm-Message-State: AGi0PuZ2uwvsNrZ7TIyUy1s5VdvaL0lLu6wwXdMxHvqIzg42B1Ca6jlK xlJ/eCyFw/m7lhXdQfpGGeMXdg== X-Google-Smtp-Source: APiQypLwdrvK53EjnxC1heRJ+0O+lYXa9rz26GtDEw4NdoFZtPrvL2dF2E9fefS7WeDR/I3BG2Pkfw== X-Received: by 2002:a05:600c:441a:: with SMTP id u26mr3883647wmn.154.1588171511003; Wed, 29 Apr 2020 07:45:11 -0700 (PDT) Received: from localhost.localdomain ([194.53.185.38]) by smtp.gmail.com with ESMTPSA id a10sm20071739wrg.32.2020.04.29.07.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 07:45:10 -0700 (PDT) From: Quentin Monnet To: Alexei Starovoitov , Daniel Borkmann Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, Quentin Monnet , Richard Palethorpe , Michael Kerrisk Subject: [PATCH bpf-next v3 1/3] tools: bpftool: for "feature probe" define "full_mode" bool as global Date: Wed, 29 Apr 2020 15:45:04 +0100 Message-Id: <20200429144506.8999-2-quentin@isovalent.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429144506.8999-1-quentin@isovalent.com> References: <20200429144506.8999-1-quentin@isovalent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org The "full_mode" variable used for switching between full or partial feature probing (i.e. with or without probing helpers that will log warnings in kernel logs) was piped from the main do_probe() function down to probe_helpers_for_progtype(), where it is needed. Define it as a global variable: the calls will be more readable, and if other similar flags were to be used in the future, we could use global variables as well instead of extending again the list of arguments with new flags. Signed-off-by: Quentin Monnet --- tools/bpf/bpftool/feature.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c index 88718ee6a438..59e4cb44efbc 100644 --- a/tools/bpf/bpftool/feature.c +++ b/tools/bpf/bpftool/feature.c @@ -35,6 +35,8 @@ static const char * const helper_name[] = { #undef BPF_HELPER_MAKE_ENTRY +static bool full_mode; + /* Miscellaneous utility functions */ static bool check_procfs(void) @@ -540,8 +542,7 @@ probe_helper_for_progtype(enum bpf_prog_type prog_type, bool supported_type, static void probe_helpers_for_progtype(enum bpf_prog_type prog_type, bool supported_type, - const char *define_prefix, bool full_mode, - __u32 ifindex) + const char *define_prefix, __u32 ifindex) { const char *ptype_name = prog_type_name[prog_type]; char feat_name[128]; @@ -678,8 +679,7 @@ static void section_map_types(const char *define_prefix, __u32 ifindex) } static void -section_helpers(bool *supported_types, const char *define_prefix, - bool full_mode, __u32 ifindex) +section_helpers(bool *supported_types, const char *define_prefix, __u32 ifindex) { unsigned int i; @@ -704,8 +704,8 @@ section_helpers(bool *supported_types, const char *define_prefix, define_prefix, define_prefix, define_prefix, define_prefix); for (i = BPF_PROG_TYPE_UNSPEC + 1; i < ARRAY_SIZE(prog_type_name); i++) - probe_helpers_for_progtype(i, supported_types[i], - define_prefix, full_mode, ifindex); + probe_helpers_for_progtype(i, supported_types[i], define_prefix, + ifindex); print_end_section(); } @@ -725,7 +725,6 @@ static int do_probe(int argc, char **argv) enum probe_component target = COMPONENT_UNSPEC; const char *define_prefix = NULL; bool supported_types[128] = {}; - bool full_mode = false; __u32 ifindex = 0; char *ifname; @@ -803,7 +802,7 @@ static int do_probe(int argc, char **argv) goto exit_close_json; section_program_types(supported_types, define_prefix, ifindex); section_map_types(define_prefix, ifindex); - section_helpers(supported_types, define_prefix, full_mode, ifindex); + section_helpers(supported_types, define_prefix, ifindex); section_misc(define_prefix, ifindex); exit_close_json: -- 2.20.1