From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ophir Munk Subject: [PATCH v1] net/tap: use local eBPF definitions Date: Tue, 23 Jan 2018 21:54:09 +0000 Message-ID: <1516744449-16158-1-git-send-email-ophirmu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Thomas Monjalon , Olga Shern , Ophir Munk To: dev@dpdk.org, Pascal Mazon Return-path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50047.outbound.protection.outlook.com [40.107.5.47]) by dpdk.org (Postfix) with ESMTP id AAB2F2BF3 for ; Tue, 23 Jan 2018 22:54:36 +0100 (CET) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" eBPF has a graceful approach: it must successfully compile on all Linux distributions. If a specific kernel cannot support eBPF it will gracefully refuse the eBPF netlink message sent to it. The kernel header file linux/bpf.h (if present) on different Linux distributions may not include all definitions required for TAP compilation. In order to guarantee a successful eBPF compilation everywhere all the required definitions for TAP have been locally added instead of including file Signed-off-by: Ophir Munk --- drivers/net/tap/Makefile | 5 ----- drivers/net/tap/tap_bpf.h | 9 +++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile index e23c3a2..315c6bd 100644 --- a/drivers/net/tap/Makefile +++ b/drivers/net/tap/Makefile @@ -82,11 +82,6 @@ tap_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh linux/tc_act/tc_bpf.h \ enum TCA_ACT_BPF_FD \ $(AUTOCONF_OUTPUT) - $Q sh -- '$<' '$@' \ - HAVE_BPF_PROG_LOAD \ - linux/bpf.h \ - enum BPF_PROG_LOAD \ - $(AUTOCONF_OUTPUT) # Create tap_autoconf.h or update it in case it differs from the new one. diff --git a/drivers/net/tap/tap_bpf.h b/drivers/net/tap/tap_bpf.h index 30eefb3..8d6f9a2 100644 --- a/drivers/net/tap/tap_bpf.h +++ b/drivers/net/tap/tap_bpf.h @@ -7,9 +7,11 @@ #include -#ifdef HAVE_BPF_PROG_LOAD -#include -#else +/* Do not #include since eBPF must compile on different + * distros which may include partial definitions for eBPF (while the + * kernel itself may support eBPF). Instead define here all that is needed + */ + /* BPF_MAP_UPDATE_ELEM command flags */ #define BPF_ANY 0 /* create a new element or update an existing */ @@ -83,7 +85,6 @@ union bpf_attr { __u32 prog_flags; }; } __attribute__((aligned(8))); -#endif #ifndef __NR_bpf # if defined(__i386__) -- 2.7.4