Re: [Qemu-devel] [RFC v2 2/2] virtio-net: Example Patch for using BPF

2018-06-25 Thread Sameeh Jubran
On Mon, Jun 25, 2018 at 2:22 PM, Daniel P. Berrangé 
wrote:

> On Mon, Jun 25, 2018 at 02:07:06PM +0300, Sameeh Jubran wrote:
> > From: Sameeh Jubran 
> >
> > This commit is a sample only for using the libbpf in the code and
> > shouldn't be committed.
> >
> > Signed-off-by: Sameeh Jubran 
> > ---
> >  hw/net/Makefile.objs | 4 
> >  hw/net/virtio-net.c  | 4 
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs
> > index fa461d4463..0fb271436d 100644
> > --- a/hw/net/Makefile.objs
> > +++ b/hw/net/Makefile.objs
> > @@ -37,6 +37,10 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o
> >  obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o
> >
> >  obj-$(CONFIG_VIRTIO_NET) += virtio-net.o
> > +ifeq ($(CONFIG_BPF),y)
> > + virtio-net.o-cflags := $(CFLAGS_BPF)
> > + virtio-net.o-libs := $(LIBS_BPF)
> > +endif
> >  obj-y += vhost_net.o
> >
> >  obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index 90502fca7c..b4840838c1 100644
> > --- a/hw/net/virtio-net.c
> > +++ b/hw/net/virtio-net.c
> > @@ -27,6 +27,7 @@
> >  #include "hw/virtio/virtio-access.h"
> >  #include "migration/misc.h"
> >  #include "standard-headers/linux/ethtool.h"
> > +#include "standard-headers/linux/libbpf.h"
> >
> >  #define VIRTIO_NET_VM_VERSION11
> >
> > @@ -1329,6 +1330,9 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue
> *q)
> >  VirtQueueElement *elem;
> >  int32_t num_packets = 0;
> >  int queue_index = vq2q(virtio_get_queue_index(q->tx_vq));
> > +
> > +struct bpf_object *obj = NULL;
> > +bpf_object__load(obj);
>
> This really doesn't tell us anything useful about how this will be
> used and integrated in qemu. I'd expect this patch to actually
> be doing a real feature complete impl of RSS for virtio-net.
>
No problem, I'll be sending the full series ASAP,
Thanks :)

>
> 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 .*


Re: [Qemu-devel] [RFC v2 2/2] virtio-net: Example Patch for using BPF

2018-06-25 Thread Daniel P . Berrangé
On Mon, Jun 25, 2018 at 02:07:06PM +0300, Sameeh Jubran wrote:
> From: Sameeh Jubran 
> 
> This commit is a sample only for using the libbpf in the code and
> shouldn't be committed.
> 
> Signed-off-by: Sameeh Jubran 
> ---
>  hw/net/Makefile.objs | 4 
>  hw/net/virtio-net.c  | 4 
>  2 files changed, 8 insertions(+)
> 
> diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs
> index fa461d4463..0fb271436d 100644
> --- a/hw/net/Makefile.objs
> +++ b/hw/net/Makefile.objs
> @@ -37,6 +37,10 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o
>  obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o
>  
>  obj-$(CONFIG_VIRTIO_NET) += virtio-net.o
> +ifeq ($(CONFIG_BPF),y)
> + virtio-net.o-cflags := $(CFLAGS_BPF)
> + virtio-net.o-libs := $(LIBS_BPF)
> +endif
>  obj-y += vhost_net.o
>  
>  obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 90502fca7c..b4840838c1 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -27,6 +27,7 @@
>  #include "hw/virtio/virtio-access.h"
>  #include "migration/misc.h"
>  #include "standard-headers/linux/ethtool.h"
> +#include "standard-headers/linux/libbpf.h"
>  
>  #define VIRTIO_NET_VM_VERSION11
>  
> @@ -1329,6 +1330,9 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
>  VirtQueueElement *elem;
>  int32_t num_packets = 0;
>  int queue_index = vq2q(virtio_get_queue_index(q->tx_vq));
> +
> +struct bpf_object *obj = NULL;
> +bpf_object__load(obj);

This really doesn't tell us anything useful about how this will be
used and integrated in qemu. I'd expect this patch to actually
be doing a real feature complete impl of RSS for virtio-net.

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 :|



[Qemu-devel] [RFC v2 2/2] virtio-net: Example Patch for using BPF

2018-06-25 Thread Sameeh Jubran
From: Sameeh Jubran 

This commit is a sample only for using the libbpf in the code and
shouldn't be committed.

Signed-off-by: Sameeh Jubran 
---
 hw/net/Makefile.objs | 4 
 hw/net/virtio-net.c  | 4 
 2 files changed, 8 insertions(+)

diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs
index fa461d4463..0fb271436d 100644
--- a/hw/net/Makefile.objs
+++ b/hw/net/Makefile.objs
@@ -37,6 +37,10 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o
 obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o
 
 obj-$(CONFIG_VIRTIO_NET) += virtio-net.o
+ifeq ($(CONFIG_BPF),y)
+   virtio-net.o-cflags := $(CFLAGS_BPF)
+   virtio-net.o-libs := $(LIBS_BPF)
+endif
 obj-y += vhost_net.o
 
 obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 90502fca7c..b4840838c1 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -27,6 +27,7 @@
 #include "hw/virtio/virtio-access.h"
 #include "migration/misc.h"
 #include "standard-headers/linux/ethtool.h"
+#include "standard-headers/linux/libbpf.h"
 
 #define VIRTIO_NET_VM_VERSION11
 
@@ -1329,6 +1330,9 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
 VirtQueueElement *elem;
 int32_t num_packets = 0;
 int queue_index = vq2q(virtio_get_queue_index(q->tx_vq));
+
+struct bpf_object *obj = NULL;
+bpf_object__load(obj);
 if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
 return num_packets;
 }
-- 
2.13.6