On Thu, Aug 30, 2018 at 05:27:03PM +0300, Sameeh Jubran wrote: > From: Sameeh Jubran <sjub...@redhat.com> > > This commit adds the bpf header provided by Linux to Qemu.
s/Qemu/QEMU/ > > Signed-off-by: Sameeh Jubran <sjub...@redhat.com> > --- > MAINTAINERS | 5 +++++ > configure | 44 > +++++++++++++++++++++++++++++++++++++++++ > scripts/update-linux-headers.sh | 8 ++++++-- > 3 files changed, 55 insertions(+), 2 deletions(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 0fb5f38f9f..bf2619239c 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2126,6 +2126,11 @@ F: hw/rdma/* > F: hw/rdma/vmw/* > F: docs/pvrdma.txt > > +BPF > +M: Sameeh Jubran <sam...@daynix.com> > +S: Maintained > +F: linux-headers/linux/bpf.h > + > Build and test automation > ------------------------- > Build and test automation > diff --git a/configure b/configure > index a8c4094c87..21edaf59aa 100755 > --- a/configure > +++ b/configure > @@ -348,6 +348,7 @@ libattr="" > xfs="" > tcg="yes" > membarrier="" > +bpf="no" This should really default to "", with the check below automatically doing the right thing to automatically enable/disable it. > vhost_net="no" > vhost_crypto="no" > vhost_scsi="no" > @@ -1173,6 +1174,10 @@ for opt do > ;; > --enable-membarrier) membarrier="yes" > ;; > + --disable-bpf) bpf="no" > + ;; > + --enable-bpf) bpf="yes" > + ;; > --disable-blobs) blobs="no" > ;; > --with-pkgversion=*) pkgversion="$optarg" > @@ -1593,6 +1598,7 @@ disabled with --disable-FEATURE, default is enabled if > available: > brlapi BrlAPI (Braile) > curl curl connectivity > membarrier membarrier system call (for Linux 4.14+ or Windows) > + bpf bpf system calls (for Linux 3.18+) > fdt fdt device tree > bluez bluez stack connectivity > kvm KVM acceleration support > @@ -5232,6 +5238,38 @@ else > fi > > ########################################## > +# check for usable bpf system call > +if test "$bpf" = "yes"; then if test "x$bpf" != "xno"; then > + have_bpf=no > + if test "$linux" = "yes" ; then > + cat > $TMPC << EOF > + #include <sys/syscall.h> > + #include "linux/bpf.h" > + #include <unistd.h> > + #include <stdlib.h> > + #include <string.h> > + int main(void) { > + union bpf_attr * attr = NULL; > + syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr)); > + exit(0); > + } > +EOF > + bpf_include="-Iinclude/standard-headers/linux" > + bpf_cflags="" > + bpf_libs="" > + if compile_prog "$bpf_include" "$bpf_libs" ; then > + have_bpf=yes > + fi > + fi > + if test "$have_bpf" = "no"; then > + feature_not_found "bpf" "libelf libs are not available or else \ > +the bpf system call is not available" if test "$have_bpf" = "no"; then if test "x$bpf" = "xyes" ; then feature_not_found .... else bpf=no fi else bpf=yes fi > + fi > +else > + bpf=no > +fi > + Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|