From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 01160A00C2; Thu, 21 Jul 2022 14:14:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EA404282E; Thu, 21 Jul 2022 14:14:36 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 66CF1400D7 for ; Thu, 21 Jul 2022 14:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658405674; x=1689941674; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YqigU2exCG0QJCY1P2vxLFleyIQkS3TnDEmBrd6IPag=; b=Bak/wcOER1EgyX3zMwfcm0KpdjClpuzhbsTQ+EEfxveTLbQ3dR2T6gvX Z451xcDJWnF/v/0wjslSYs9CQ44EyRfaCwjn6V4Uw/rXrrf2I7Ao2o1Ta YlgWeQKLwS44EIJC4vjnC7uzb/Ff0YUY3GMoYtCeoev2ih3CdzbU6ja+f WjrgUxG/PlDseaVXWgLwa1Jjrw/F26crbRKMMyP4QduWQ62vucRvmHmeV BH8dAuE9peEQDYyH6CtSj7bH738pNy093oxxaqmypwA9tXYEM1FmgNeJz l2ij1QUAimBQngfu2PBj7IiOSd6mizlFXeZtUAxvVV8iCmZaTUrQ0sWT7 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10414"; a="351017364" X-IronPort-AV: E=Sophos;i="5.92,289,1650956400"; d="scan'208";a="351017364" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2022 05:14:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,289,1650956400"; d="scan'208";a="573715916" Received: from silpixa00401086.ir.intel.com (HELO localhost.localdomain) ([10.55.128.124]) by orsmga006.jf.intel.com with ESMTP; 21 Jul 2022 05:14:29 -0700 From: Ciara Loftus To: dev@dpdk.org Cc: andrew.rybchenko@oktetlabs.ru, Ciara Loftus Subject: [RFC PATCH 3/3] net/af_xdp: use autoconf file instead of cflags Date: Thu, 21 Jul 2022 12:14:15 +0000 Message-Id: <20220721121415.1709202-3-ciara.loftus@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220721121415.1709202-1-ciara.loftus@intel.com> References: <20220721121415.1709202-1-ciara.loftus@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Generate af_xdp_autoconf.h which contains the different features detected by the meson build instead of using cflags. Suggested-by: Andrew Rybchenko Signed-off-by: Ciara Loftus --- drivers/net/af_xdp/compat.h | 8 +++++--- drivers/net/af_xdp/meson.build | 15 ++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/af_xdp/compat.h b/drivers/net/af_xdp/compat.h index 28ea64aeaa..e1f8ead7c8 100644 --- a/drivers/net/af_xdp/compat.h +++ b/drivers/net/af_xdp/compat.h @@ -2,7 +2,9 @@ * Copyright(c) 2020 Intel Corporation. */ -#ifdef RTE_NET_AF_XDP_LIBXDP +#include "af_xdp_autoconf.h" + +#ifdef HAVE_LIBXDP #include #else #include @@ -12,7 +14,7 @@ #include #if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE && \ - defined(RTE_NET_AF_XDP_SHARED_UMEM) + defined(HAVE_LIBBPF_SHARED_UMEM) #define ETH_AF_XDP_SHARED_UMEM 1 #endif @@ -60,7 +62,7 @@ tx_syscall_needed(struct xsk_ring_prod *q __rte_unused) } #endif -#ifdef RTE_NET_AF_XDP_LIBBPF_OBJ_OPEN +#ifdef HAVE_LIBBPF_OBJ_OPEN static int load_program(const char *prog_path, struct bpf_object **obj) { struct bpf_program *prog; diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build index d91545f9c3..d1f6febbca 100644 --- a/drivers/net/af_xdp/meson.build +++ b/drivers/net/af_xdp/meson.build @@ -23,15 +23,17 @@ if bpf_dep.found() and cc.has_header('bpf/bpf.h') and cc.has_header_symbol('bpf/ libbpf070 = true endif +config = configuration_data() + if cc.has_header('linux/if_xdp.h') if xdp_dep.found() and cc.has_header('xdp/xsk.h') if bpf_dep.found() and cc.has_header('bpf/bpf.h') - cflags += ['-DRTE_NET_AF_XDP_LIBXDP'] - cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM'] + config.set('HAVE_LIBXDP', 1) + config.set('HAVE_LIBBPF_SHARED_UMEM', 1) ext_deps += xdp_dep ext_deps += bpf_dep if libbpf070 - cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN'] + config.set('HAVE_LIBBPF_OBJ_OPEN', 1) endif else build = false @@ -42,10 +44,7 @@ if cc.has_header('linux/if_xdp.h') # which is only available in versions < v0.7.0. if not libbpf070 ext_deps += bpf_dep - bpf_shumem_ver_dep = cc.has_header_symbol('bpf/bpf.h', 'bpf_prog_bind_map') - if bpf_shumem_ver_dep - cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM'] - endif + config.set('HAVE_LIBBPF_SHARED_UMEM', cc.has_header_symbol('bpf/bpf.h', 'bpf_prog_bind_map')) else build = false reason = 'missing dependency, "libxdp" or "libbpf <= v0.6.0"' @@ -58,3 +57,5 @@ else build = false reason = 'missing header, "linux/if_xdp.h"' endif + +configure_file(output : 'af_xdp_autoconf.h', configuration : config) -- 2.25.1