From: Sameeh Jubran <sameeh@daynix.com>
To: qemu-devel@nongnu.org
Cc: Yan Vugenfirer <yan@daynix.com>, Jason Wang <jasowang@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Amnon Ilan <ailan@redhat.com>
Subject: [Qemu-devel] [RFC v2 2/2] virtio-net: Example Patch for using BPF
Date: Mon, 25 Jun 2018 14:07:06 +0300 [thread overview]
Message-ID: <20180625110706.23332-3-sameeh@daynix.com> (raw)
In-Reply-To: <20180625110706.23332-1-sameeh@daynix.com>
From: Sameeh Jubran <sjubran@redhat.com>
This commit is a sample only for using the libbpf in the code and
shouldn't be committed.
Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
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_VERSION 11
@@ -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
next prev parent reply other threads:[~2018-06-25 11:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 11:07 [Qemu-devel] [RFC v2 0/2] Add BPF suuport to Qemu Sameeh Jubran
2018-06-25 11:07 ` [Qemu-devel] [RFC v2 1/2] Add bpf support to qemu Sameeh Jubran
2018-06-25 11:07 ` Sameeh Jubran [this message]
2018-06-25 11:22 ` [Qemu-devel] [RFC v2 2/2] virtio-net: Example Patch for using BPF Daniel P. Berrangé
2018-06-25 15:29 ` Sameeh Jubran
2018-06-25 11:16 ` [Qemu-devel] [RFC v2 0/2] Add BPF suuport to Qemu Peter Maydell
2018-06-25 11:21 ` Sameeh Jubran
2018-06-25 15:35 ` Daniel P. Berrangé
2018-06-30 18:56 ` no-reply
2018-07-02 5:20 ` no-reply
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=20180625110706.23332-3-sameeh@daynix.com \
--to=sameeh@daynix.com \
--cc=ailan@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@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.