From patchwork Tue Mar 8 11:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 12773554 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DE04C433F5 for ; Tue, 8 Mar 2022 11:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241704AbiCHLel (ORCPT ); Tue, 8 Mar 2022 06:34:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbiCHLel (ORCPT ); Tue, 8 Mar 2022 06:34:41 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2106.outbound.protection.outlook.com [40.107.236.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 503CB3BA53 for ; Tue, 8 Mar 2022 03:33:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e3Db2hlJ5Po3C+VeZ5Ak5bcoicfuPMSNNz/Iafi2OrClA6XIh1YBsUuUUPGh93iErqU9uUdeFRBFIlJe7CuwWRJ3qgdV78OHJ11J6s5iUqbAsAz/rnwXiPrOBtMKt1vwbAWRDHj1czOiKtDx1uXd3LiJMyfRDTFnn3mC+sK8ZVt3wqUm0ix1Zy5wcMCbVWLQjR43asmGlEjiv9yPjH7+3QJgZg8QlV2q3HjQ0gyBV1iG9iPoZrzPeE7sg6Y21GvExGlY4qm1kgdLx5lR8nha7mO4ZIVv0u4ToTFIi+6LPA6LhAvUnYPrft9ypeGhnq/p5fA6jc1J1So7Ss91IxSerA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QwZIYS+R4tf8nAIWWzPCBX4bR4F2v85uf7JeFg4RVG4=; b=Ywxi/xDbKqmgI3wPNk9oySsito2Rn5zAu7dA9T5ccsXvJM2amWEkZD+eHQbrhnZBrwmJmVLWW1lAQY9V7jlsy6ikhVVHyURPHULrEtel6Zic3OI74SYxfPOlA49JjN7+C7h0MD/UgjBSDJCtCE+iiWayQTHfwvc3dcccdXAs7o9qraEpCsXmP8Ft8bhxbcRe+MLtCWVpWzlJzSFT2OmgV9bw+XI4x5Y/nNH2TVm0YmYzWuKXfu9LuxTC+On5piLAOGWUN+k9ayk30lsctVTXfw9uwlOueBruLPiagO9mzE+am8WcZ84YmwW6XCY0EnphSW4bPPVfEZUrogVX3yfKMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QwZIYS+R4tf8nAIWWzPCBX4bR4F2v85uf7JeFg4RVG4=; b=p4I/9e1qlI1HHeDnUQ9N6mqegMMN0nicih5sJdI9TGiK6rkhLwBwaB/qrNa4HApFRKjzvspTDJwytignCzEsno5MOEgXJt94gdjI7ADcK+CJk73AMjchTWE/JeszjeIPgswqveAWdgpKKpXujlQmiv4hVQ3uB1dVXX64uTypWnw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB4431.namprd13.prod.outlook.com (2603:10b6:5:1bb::21) by MN2PR13MB3646.namprd13.prod.outlook.com (2603:10b6:208:1e3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.6; Tue, 8 Mar 2022 11:33:42 +0000 Received: from DM6PR13MB4431.namprd13.prod.outlook.com ([fe80::e035:ce64:e29e:54f6]) by DM6PR13MB4431.namprd13.prod.outlook.com ([fe80::e035:ce64:e29e:54f6%5]) with mapi id 15.20.5061.018; Tue, 8 Mar 2022 11:33:42 +0000 From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: bpf@vger.kernel.org, Quentin Monnet , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann Cc: Simon Horman , oss-drivers@corigine.com, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH bpf-next] bpftool: Restore support for BPF offload-enabled feature probing Date: Tue, 8 Mar 2022 12:30:56 +0100 Message-Id: <20220308113056.3779069-1-niklas.soderlund@corigine.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: AS9PR06CA0076.eurprd06.prod.outlook.com (2603:10a6:20b:464::29) To DM6PR13MB4431.namprd13.prod.outlook.com (2603:10b6:5:1bb::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67de1bdc-add5-473f-50cb-08da00f77f67 X-MS-TrafficTypeDiagnostic: MN2PR13MB3646:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tyYo/0koCquFYQPzyI4vil04tB33HGTRkJPbHG/KrZQhvJAzN3kjKvW4notRpNPSug6mIGHjgS8lxta2v0kshXxBt/N5YRlb3+zhhS1BXvH5edbdvbKiyX7k3SiumV3Kt+WgGRp0UpxKVo+UdjFb2LFVjypOACK0hsgMpgmGQwZIdNraoDaMt6uSz+v/9IhBcarAuX7d9zEEAKs1csHpMy3NjAnGtORfOC2DFZssuTyPJvq1Z5Uoqa8scIfqkd6ZiOKn0r5ru6Qstc4SdaDpuaHldPid/7AZHmruqz3LQqLYTllC8b4iwDIjcZEk7c19k4kCIOizdoUNmMD6rXqmzmze0LWGx3CZ6YoSR0DCVJbo7o3gr2J7+BN8Kew/t87Gw1WyiGOLkm/T8m1X4HLKtWKC8ihqAtPj7Jqm5zn9uHSiPBp4zDx32rN7LLgmZLiR1Qi4XcpcBaNA+6S5tFPun24S5+8ZLiF59PYa9dEXHvVJsZXJwoWAAJp7QSum38ngunrv+dqVcdqlfUte3XdJWrdVdTU1iEUo8slc7+g/+/G6mj43BnFvLNwozC5rskW3abqgPqdxK7j7LO893KggCTiWzy5Dyo+2QSqjWwGItSzlv+PuETjY/zMRczLwOsqGC4y9PIG04et3hAmBUKdCIjP1szOOuKjxDJmDfdbUDfcEUlEFLZFdlDJWKH1ohbGTcxTPFIQZPk/T+1j0v0v5iq6U4822KA60z9WV2gZrdvE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR13MB4431.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(376002)(136003)(396003)(346002)(366004)(39840400004)(6486002)(8676002)(107886003)(508600001)(2906002)(38100700002)(38350700002)(6512007)(6666004)(52116002)(8936002)(6506007)(66574015)(54906003)(110136005)(86362001)(316002)(1076003)(2616005)(186003)(36756003)(83380400001)(26005)(4326008)(66946007)(66476007)(5660300002)(66556008)(309714004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?4YZYF/1WxHSuRR7dHyoLA4laICjX?= =?utf-8?q?g/EVzkQGKkAmr6Ei5L5fdlnkz8mQ2bEFh7WPxoelmaDVUXHMR8GA1dzYK5KdwXsUH?= =?utf-8?q?4a2CA3UPJ3ugTpjqP29NnGNgQRnTNscr5iJhgsAFoz1kYkfbNydMonhuBoDRdAr62?= =?utf-8?q?YORCzIJF/YqjjdrENhs47PwITv1VhRJhEUeuCUk2NX7/gJsTtedYz6xJpvExB5HaH?= =?utf-8?q?Hye356N59zOel/TDrbafjJzebIi2tOawL2UrvpaBh3LViJYlcP/NR7fQensGSNorh?= =?utf-8?q?WkuR91BAtGXXOASLEJtK5sSXgyHQkw9EeIRdVM9EHsV32NbCYZd6cZdvTtN1PtEs2?= =?utf-8?q?A7gbs99MTzWaRS2K3EDW56F7NN6SUIF8BvXSSGFLvMKMNco67WBbqDKJ3Rm3B7pky?= =?utf-8?q?Xio5v2U+QZ28ilXyFfZuLTpf9vqOTAL2MFovSm60+Bkq+zVJZ0n1nmAb4+A98RmL8?= =?utf-8?q?46spP2fWw9KlbmWtwmiPCRu6zSA9ET8a+9Od6seZUQMtGNJsZ9aDLx0UgXxlmgWk2?= =?utf-8?q?FsOlDOrAzEhtOyBstpDaU8xxeMNcYLBMh5/hwXsVDoRasI6KnL+WwSKn662nIZfcU?= =?utf-8?q?qnW/LwRoo7vLWzoykqt/xyhSZ5MF6Dd+6S56P657jLc5sWLxyppM2kaHZRzJTL7hY?= =?utf-8?q?7W9YSastZg1CiFlkTWQbqT8sbep+Jha2Hoq3U/OBZAa/xUnt1CNJ5U2/NgqMFQeZk?= =?utf-8?q?jQ0ZmcFUA4NIf52NGNrIsmEc4KnIQ/F3Yfb6I2fBALEdr0uqt26WLWSiRhrgOW1Sn?= =?utf-8?q?QBnu06vREox1Wb9wpqczlHhf2T8deDxp0TRanF/t/3m+Us2R2jI3Z6WtihwRDEe1M?= =?utf-8?q?AM11pwUiSd7iITWYTBxm2A/dN7RhJMVBZ6HGfC124w2TqKp8WYpe5qO5+jHPSp5Et?= =?utf-8?q?J2bWgNpmkxhU8M0ife1L659uvVPxHFmLLpSfF6YSf50fBtfE5w9pc/2K00ACRc9Rv?= =?utf-8?q?CkwgAaAvv7NQAEPJm42HZdz68gnEqk4x6r1QTNy3rLVRGvDQVuYzqmGV6XJCazwcD?= =?utf-8?q?bcoRxuZIclx4pJMC0CLgKwKp0h+kdjXBftR7yxKmDPnzLlpX+IgszbJ0nPMDk9YuO?= =?utf-8?q?/i0okRvVmhcfAXCrN68jxDVn6F0PwN3/9uW0xi5I0Wc3weSOj0aMAR+4m2W7Fi10d?= =?utf-8?q?K1xBZpWTnCYvVwcbaQttKPPZGCMjxqRfBRYUkx/JbMVOt8pncmkAitUzPbF375Hb5?= =?utf-8?q?qJgK2S91ZgLiMGM3mFU6UsdJe6s5xqN2BPjIM13u/jcvOURKYBB/DySmveC2FAwH5?= =?utf-8?q?fWS1tDYmzjXqB9qJTl1NtzR/HUGi9afcgH84NbMt0PngQLridcgNMsa9UBgyzqAqC?= =?utf-8?q?v0ZLzf9leSX9kLD8wvBlDAGy3KQ0yxSTFiomPRPG14iydsfzEXcnvU+lqnfrdfEA4?= =?utf-8?q?OhgbiBqmOGrTcgjZnCj+fOFEx2EVS1kkj7+g=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67de1bdc-add5-473f-50cb-08da00f77f67 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB4431.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 11:33:42.2933 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Lh0dqAGy2taIUMTZjOaqnmicu+he9a2pSNh0z8ERDScNSe1p7XTVtJlrt6lYunzm2skO9Qhpj243Hgs/Hdvt/ycDtjBW0CdZWnLAMkhkx+E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3646 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Commit 1a56c18e6c2e4e74 ("bpftool: Stop supporting BPF offload-enabled feature probing") removed the support to probe for BPF offload features. This is still something that is useful for NFP NIC that can support offloading of BPF programs. The reason for the dropped support was that libbpf starting with v1.0 would drop support for passing the ifindex to the BPF prog/map/helper feature probing APIs. In order to keep this useful feature for NFP restore the functionality by moving it directly into bpftool. The code restored is a simplified version of the code that existed in libbpf which supposed passing the ifindex. The simplification is that it only targets the cases where ifindex is given and call into libbpf for the cases where it's not. Before restoring support for probing offload features: # bpftool feature probe dev ens4np0 Scanning system call availability... bpf() syscall is available Scanning eBPF program types... Scanning eBPF map types... Scanning eBPF helper functions... eBPF helpers supported for program type sched_cls: eBPF helpers supported for program type xdp: Scanning miscellaneous eBPF features... Large program size limit is NOT available Bounded loop support is NOT available ISA extension v2 is NOT available ISA extension v3 is NOT available With support for probing offload features restored: # bpftool feature probe dev ens4np0 Scanning system call availability... bpf() syscall is available Scanning eBPF program types... eBPF program_type sched_cls is available eBPF program_type xdp is available Scanning eBPF map types... eBPF map_type hash is available eBPF map_type array is available eBPF map_type prog_array is NOT available eBPF map_type perf_event_array is NOT available eBPF map_type percpu_hash is NOT available eBPF map_type percpu_array is NOT available eBPF map_type stack_trace is NOT available eBPF map_type cgroup_array is NOT available eBPF map_type lru_hash is NOT available eBPF map_type lru_percpu_hash is NOT available eBPF map_type lpm_trie is NOT available eBPF map_type array_of_maps is NOT available eBPF map_type hash_of_maps is NOT available eBPF map_type devmap is NOT available eBPF map_type sockmap is NOT available eBPF map_type cpumap is NOT available eBPF map_type xskmap is NOT available eBPF map_type sockhash is NOT available eBPF map_type cgroup_storage is NOT available eBPF map_type reuseport_sockarray is NOT available eBPF map_type percpu_cgroup_storage is NOT available eBPF map_type queue is NOT available eBPF map_type stack is NOT available eBPF map_type sk_storage is NOT available eBPF map_type devmap_hash is NOT available eBPF map_type struct_ops is NOT available eBPF map_type ringbuf is NOT available eBPF map_type inode_storage is NOT available eBPF map_type task_storage is NOT available eBPF map_type bloom_filter is NOT available Scanning eBPF helper functions... eBPF helpers supported for program type sched_cls: - bpf_map_lookup_elem - bpf_get_prandom_u32 - bpf_perf_event_output eBPF helpers supported for program type xdp: - bpf_map_lookup_elem - bpf_get_prandom_u32 - bpf_perf_event_output - bpf_xdp_adjust_head - bpf_xdp_adjust_tail Scanning miscellaneous eBPF features... Large program size limit is NOT available Bounded loop support is NOT available ISA extension v2 is NOT available ISA extension v3 is NOT available Signed-off-by: Niklas Söderlund Signed-off-by: Simon Horman --- tools/bpf/bpftool/feature.c | 185 +++++++++++++++++++++++++++++++++--- 1 file changed, 170 insertions(+), 15 deletions(-) diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c index 9c894b1447de8cf0..4943beb1823111c8 100644 --- a/tools/bpf/bpftool/feature.c +++ b/tools/bpf/bpftool/feature.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -45,6 +46,11 @@ static bool run_as_unprivileged; /* Miscellaneous utility functions */ +static bool grep(const char *buffer, const char *pattern) +{ + return !!strstr(buffer, pattern); +} + static bool check_procfs(void) { struct statfs st_fs; @@ -135,6 +141,32 @@ static void print_end_section(void) /* Probing functions */ +static int get_vendor_id(int ifindex) +{ + char ifname[IF_NAMESIZE], path[64], buf[8]; + ssize_t len; + int fd; + + if (!if_indextoname(ifindex, ifname)) + return -1; + + snprintf(path, sizeof(path), "/sys/class/net/%s/device/vendor", ifname); + + fd = open(path, O_RDONLY | O_CLOEXEC); + if (fd < 0) + return -1; + + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len < 0) + return -1; + if (len >= (ssize_t)sizeof(buf)) + return -1; + buf[len] = '\0'; + + return strtol(buf, NULL, 0); +} + static int read_procfs(const char *path) { char *endptr, *line = NULL; @@ -478,6 +510,69 @@ static bool probe_bpf_syscall(const char *define_prefix) return res; } +static int +probe_prog_load_ifindex(enum bpf_prog_type prog_type, + const struct bpf_insn *insns, size_t insns_cnt, + char *log_buf, size_t log_buf_sz, + __u32 ifindex) +{ + LIBBPF_OPTS(bpf_prog_load_opts, opts, + .log_buf = log_buf, + .log_size = log_buf_sz, + .log_level = log_buf ? 1 : 0, + .prog_ifindex = ifindex, + ); + const char *exp_msg = NULL; + int fd, err, exp_err = 0; + char buf[4096]; + + switch (prog_type) { + case BPF_PROG_TYPE_SCHED_CLS: + case BPF_PROG_TYPE_XDP: + break; + default: + return -EOPNOTSUPP; + } + + fd = bpf_prog_load(prog_type, NULL, "GPL", insns, insns_cnt, &opts); + err = -errno; + if (fd >= 0) + close(fd); + if (exp_err) { + if (fd >= 0 || err != exp_err) + return 0; + if (exp_msg && !strstr(buf, exp_msg)) + return 0; + return 1; + } + return fd >= 0 ? 1 : 0; +} + +static bool probe_prog_type_ifindex(enum bpf_prog_type prog_type, __u32 ifindex) +{ + struct bpf_insn insns[2] = { + BPF_MOV64_IMM(BPF_REG_0, 0), + BPF_EXIT_INSN() + }; + + switch (prog_type) { + case BPF_PROG_TYPE_SCHED_CLS: + /* nfp returns -EINVAL on exit(0) with TC offload */ + insns[0].imm = 2; + break; + case BPF_PROG_TYPE_XDP: + break; + default: + return false; + } + + errno = 0; + probe_prog_load_ifindex(prog_type, insns, ARRAY_SIZE(insns), NULL, 0, + ifindex); + + return errno != EINVAL && errno != EOPNOTSUPP; +} + static void probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types, const char *define_prefix, __u32 ifindex) @@ -488,11 +583,19 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types, bool res; if (ifindex) { - p_info("BPF offload feature probing is not supported"); - return; + switch (prog_type) { + case BPF_PROG_TYPE_SCHED_CLS: + case BPF_PROG_TYPE_XDP: + break; + default: + return; + } + + res = probe_prog_type_ifindex(prog_type, ifindex); + } else { + res = libbpf_probe_bpf_prog_type(prog_type, NULL); } - res = libbpf_probe_bpf_prog_type(prog_type, NULL); #ifdef USE_LIBCAP /* Probe may succeed even if program load fails, for unprivileged users * check that we did not fail because of insufficient permissions @@ -521,6 +624,35 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types, define_prefix); } +static bool probe_map_type_ifindex(enum bpf_map_type map_type, __u32 ifindex) +{ + LIBBPF_OPTS(bpf_map_create_opts, opts); + int key_size, value_size, max_entries; + int fd; + + opts.map_ifindex = ifindex; + + key_size = sizeof(__u32); + value_size = sizeof(__u32); + max_entries = 1; + + switch (map_type) { + case BPF_MAP_TYPE_HASH: + case BPF_MAP_TYPE_ARRAY: + break; + default: + return false; + } + + fd = bpf_map_create(map_type, NULL, key_size, value_size, max_entries, + &opts); + + if (fd >= 0) + close(fd); + + return fd >= 0; +} + static void probe_map_type(enum bpf_map_type map_type, const char *define_prefix, __u32 ifindex) @@ -530,12 +662,10 @@ probe_map_type(enum bpf_map_type map_type, const char *define_prefix, size_t maxlen; bool res; - if (ifindex) { - p_info("BPF offload feature probing is not supported"); - return; - } - - res = libbpf_probe_bpf_map_type(map_type, NULL); + if (ifindex) + res = probe_map_type_ifindex(map_type, ifindex); + else + res = libbpf_probe_bpf_map_type(map_type, NULL); /* Probe result depends on the success of map creation, no additional * check required for unprivileged users @@ -559,6 +689,33 @@ probe_map_type(enum bpf_map_type map_type, const char *define_prefix, define_prefix); } +static bool +probe_helper_ifindex(enum bpf_func_id id, enum bpf_prog_type prog_type, + __u32 ifindex) +{ + struct bpf_insn insns[2] = { + BPF_EMIT_CALL(id), + BPF_EXIT_INSN() + }; + char buf[4096] = {}; + bool res; + + probe_prog_load_ifindex(prog_type, insns, ARRAY_SIZE(insns), buf, + sizeof(buf), ifindex); + res = !grep(buf, "invalid func ") && !grep(buf, "unknown func "); + + switch (get_vendor_id(ifindex)) { + case 0x19ee: /* Netronome specific */ + res = res && !grep(buf, "not supported by FW") && + !grep(buf, "unsupported function id"); + break; + default: + break; + } + + return res; +} + static void probe_helper_for_progtype(enum bpf_prog_type prog_type, bool supported_type, const char *define_prefix, unsigned int id, @@ -567,12 +724,10 @@ probe_helper_for_progtype(enum bpf_prog_type prog_type, bool supported_type, bool res = false; if (supported_type) { - if (ifindex) { - p_info("BPF offload feature probing is not supported"); - return; - } - - res = libbpf_probe_bpf_helper(prog_type, id, NULL); + if (ifindex) + res = probe_helper_ifindex(id, prog_type, ifindex); + else + res = libbpf_probe_bpf_helper(prog_type, id, NULL); #ifdef USE_LIBCAP /* Probe may succeed even if program load fails, for * unprivileged users check that we did not fail because of