From patchwork Wed Oct 5 09:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 117380 X-Patchwork-Delegate: andrew.rybchenko@oktetlabs.ru Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E6D2A0542; Wed, 5 Oct 2022 11:51:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6E514282E; Wed, 5 Oct 2022 11:50:51 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 32F5B42685 for ; Wed, 5 Oct 2022 11:50:48 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id CA5CC87; Wed, 5 Oct 2022 12:50:47 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mail1.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 9AE897B; Wed, 5 Oct 2022 12:50:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 9AE897B Authentication-Results: shelob.oktetlabs.ru/9AE897B; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Ciara Loftus , Qi Zhang Cc: dev@dpdk.org Subject: [PATCH v3 4/6] net/af_xdp: avoid version-based check for program load mech Date: Wed, 5 Oct 2022 12:50:35 +0300 Message-Id: <20221005095037.997006-6-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221005095037.997006-1-andrew.rybchenko@oktetlabs.ru> References: <20220624102354.1516606-1-ciara.loftus@intel.com> <20221005095037.997006-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Version-based checks are bad. It is better to check for required functions. Check for bpf_object__next_program() in this case since it appears last in libbpf among functions used to load program without bpf_prog_load() which is deprecated in libbpf v0.7.0. Signed-off-by: Andrew Rybchenko --- drivers/net/af_xdp/meson.build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build index a01a67c7e7..9d5ffab96b 100644 --- a/drivers/net/af_xdp/meson.build +++ b/drivers/net/af_xdp/meson.build @@ -22,11 +22,6 @@ if cc.has_header('linux/if_xdp.h') ext_deps += xdp_dep if bpf_dep.found() and cc.has_header('bpf/bpf.h') ext_deps += bpf_dep - bpf_ver_dep = dependency('libbpf', version : '>=0.7.0', - required: false, method: 'pkg-config') - if bpf_ver_dep.found() - cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN'] - endif else build = false reason = 'missing dependency, libbpf' @@ -64,4 +59,9 @@ if build dependencies : ext_deps) cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM'] endif + if cc.has_function('bpf_object__next_program', + prefix : '#include ', + dependencies : bpf_dep) + cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN'] + endif endif