DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions
@ 2018-01-23 21:54 Ophir Munk
  2018-01-24 11:05 ` Van Haaren, Harry
  0 siblings, 1 reply; 3+ messages in thread
From: Ophir Munk @ 2018-01-23 21:54 UTC (permalink / raw)
  To: dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, Ophir Munk

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 <linux/bpf.h>

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
 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 <tap_autoconf.h>
 
-#ifdef HAVE_BPF_PROG_LOAD
-#include <linux/bpf.h>
-#else
+/* Do not #include <linux/bpf.h> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions
  2018-01-23 21:54 [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions Ophir Munk
@ 2018-01-24 11:05 ` Van Haaren, Harry
  2018-01-24 18:03   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Van Haaren, Harry @ 2018-01-24 11:05 UTC (permalink / raw)
  To: Ophir Munk, dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ophir Munk
> Sent: Tuesday, January 23, 2018 9:54 PM
> To: dev@dpdk.org; Pascal Mazon <pascal.mazon@6wind.com>
> Cc: Thomas Monjalon <thomas@monjalon.net>; Olga Shern <olgas@mellanox.com>;
> Ophir Munk <ophirmu@mellanox.com>
> Subject: [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions
> 
> 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 <linux/bpf.h>
> 
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>

Tested on a Fedora 20 vm, uname -r = 3.15.6-200.fc20.x86_64

Confirmed before patch was failing, with patch build is fixed.

Tested-by: Harry van Haaren <harry.van.haaren@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions
  2018-01-24 11:05 ` Van Haaren, Harry
@ 2018-01-24 18:03   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-01-24 18:03 UTC (permalink / raw)
  To: Ophir Munk; +Cc: dev, Van Haaren, Harry, Pascal Mazon, Olga Shern

24/01/2018 12:05, Van Haaren, Harry:
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ophir Munk
> > Sent: Tuesday, January 23, 2018 9:54 PM
> > To: dev@dpdk.org; Pascal Mazon <pascal.mazon@6wind.com>
> > Cc: Thomas Monjalon <thomas@monjalon.net>; Olga Shern <olgas@mellanox.com>;
> > Ophir Munk <ophirmu@mellanox.com>
> > Subject: [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions
> > 
> > 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 <linux/bpf.h>
> > 
> > Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
> 
> Tested on a Fedora 20 vm, uname -r = 3.15.6-200.fc20.x86_64
> 
> Confirmed before patch was failing, with patch build is fixed.
> 
> Tested-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-24 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-23 21:54 [dpdk-dev] [PATCH v1] net/tap: use local eBPF definitions Ophir Munk
2018-01-24 11:05 ` Van Haaren, Harry
2018-01-24 18:03   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).