All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sameeh Jubran <sameeh@daynix.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Jason Wang <jasowang@redhat.com>, Yan Vugenfirer <yan@daynix.com>
Subject: Re: [Qemu-devel] [RFC 1/6] Add bpf support to qemu
Date: Mon, 3 Sep 2018 15:18:33 +0300	[thread overview]
Message-ID: <CAKPgXcH+tuHux+Hwjs9_SCnbv874T1VdGpy0-tQZ92K1QM3bOw@mail.gmail.com> (raw)
In-Reply-To: <20180903115926.GB14377@redhat.com>

On Mon, Sep 3, 2018 at 2:59 PM, Daniel P. Berrangé <berrange@redhat.com> wrote:
> On Thu, Aug 30, 2018 at 05:27:03PM +0300, Sameeh Jubran wrote:
>> From: Sameeh Jubran <sjubran@redhat.com>
>>
>> This commit adds the bpf header provided by Linux to Qemu.
>
> s/Qemu/QEMU/
>
>>
>> Signed-off-by: Sameeh Jubran <sjubran@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 <sameeh@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
I'll use the x prefix, for anyone wondering why this is necessary ( I
didn't realize this before), checkout the following explanation:
https://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes
>
>> +    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 :|



-- 
Respectfully,
Sameeh Jubran
Linkedin
Software Engineer @ Daynix.

  reply	other threads:[~2018-09-03 12:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 14:27 [Qemu-devel] [RFC 0/6] Virtio-net: Support RSS Sameeh Jubran
2018-08-30 14:27 ` [Qemu-devel] [RFC 1/6] Add bpf support to qemu Sameeh Jubran
2018-09-03 11:59   ` Daniel P. Berrangé
2018-09-03 12:18     ` Sameeh Jubran [this message]
2018-09-03 12:24     ` Peter Maydell
2018-09-03 12:28       ` Sameeh Jubran
2018-09-03 12:29       ` Daniel P. Berrangé
2018-08-30 14:27 ` [Qemu-devel] [RFC 2/6] tap: Add support for bpf ioctls Sameeh Jubran
2018-08-30 15:21   ` Eric Blake
2018-09-03 11:34     ` Sameeh Jubran
2018-09-03  3:24   ` Jason Wang
2018-09-03 11:33     ` Sameeh Jubran
2018-08-30 14:27 ` [Qemu-devel] [RFC 3/6] vhost-net: Expose vhost_net_get_fd Sameeh Jubran
2018-09-03  3:24   ` Jason Wang
2018-09-03 11:56     ` Sameeh Jubran
2018-08-30 14:27 ` [Qemu-devel] [RFC 4/6] virtio-net: implement steering mode feature Sameeh Jubran
2018-09-03  3:34   ` Jason Wang
2018-09-03 12:51     ` Sameeh Jubran
2018-08-30 14:27 ` [Qemu-devel] [RFC 5/6] virtio-net: steering mode: Implement rss support Sameeh Jubran
2018-09-03  3:48   ` Jason Wang
2018-09-03 11:45     ` Sameeh Jubran
2018-08-30 14:27 ` [Qemu-devel] [RFC 6/6] virtio-net: rss: Add bpf filter Sameeh Jubran
2018-09-03  4:12   ` Jason Wang
2018-09-03 13:16     ` Sameeh Jubran
2018-09-04  3:03       ` Jason Wang
2018-09-03 11:54   ` Daniel P. Berrangé
2018-09-03 12:35     ` Sameeh Jubran
2018-09-03 12:49       ` Daniel P. Berrangé
2018-09-04  3:07     ` Jason Wang
2018-09-04  8:14       ` Daniel P. Berrangé
2018-09-06  5:26         ` Jason Wang
2018-10-04 13:30           ` Daniel P. Berrangé
2018-09-03 12:11   ` Daniel P. Berrangé
2018-09-04 20:11   ` Eric Blake
2018-09-03  4:15 ` [Qemu-devel] [RFC 0/6] Virtio-net: Support RSS Jason Wang
2018-09-03  9:52   ` Sameeh Jubran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKPgXcH+tuHux+Hwjs9_SCnbv874T1VdGpy0-tQZ92K1QM3bOw@mail.gmail.com \
    --to=sameeh@daynix.com \
    --cc=berrange@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.