From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Cc: jasowang@redhat.com, mrhines@linux.vnet.ibm.com,
thuth@redhat.com, stefanha@redhat.com,
Yang Hongyang <yanghy@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH 2/9] virtio-net: add filter support
Date: Fri, 24 Jul 2015 18:55:52 +0800 [thread overview]
Message-ID: <1437735359-17415-3-git-send-email-yanghy@cn.fujitsu.com> (raw)
In-Reply-To: <1437735359-17415-1-git-send-email-yanghy@cn.fujitsu.com>
virtio-net explicity check for tap device, aupport for tap
with filter attached.
Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
---
hw/net/virtio-net.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 304d3dd..59e9707 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -16,6 +16,7 @@
#include "net/net.h"
#include "net/checksum.h"
#include "net/tap.h"
+#include "net/filter.h"
#include "qemu/error-report.h"
#include "qemu/timer.h"
#include "hw/virtio/virtio-net.h"
@@ -406,11 +407,15 @@ static int peer_attach(VirtIONet *n, int index)
return 0;
}
- if (nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {
+ if (nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_FILTER) {
+ nc = filter_backend(nc->peer);
+ }
+
+ if (nc->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {
return 0;
}
- return tap_enable(nc->peer);
+ return tap_enable(nc);
}
static int peer_detach(VirtIONet *n, int index)
@@ -421,11 +426,15 @@ static int peer_detach(VirtIONet *n, int index)
return 0;
}
- if (nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {
+ if (nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_FILTER) {
+ nc = filter_backend(nc->peer);
+ }
+
+ if (nc->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {
return 0;
}
- return tap_disable(nc->peer);
+ return tap_disable(nc);
}
static void virtio_net_set_queues(VirtIONet *n)
--
1.9.1
next prev parent reply other threads:[~2015-07-24 10:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 10:55 [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 1/9] netdev: Add a net filter Yang Hongyang
2015-07-27 12:38 ` Thomas Huth
2015-07-27 13:15 ` Yang Hongyang
2015-07-24 10:55 ` Yang Hongyang [this message]
2015-07-24 10:55 ` [Qemu-devel] [PATCH 3/9] filter: remove plugins when remove filter Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 4/9] filter: remove filter before remove network backend Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 5/9] filter: add netbuffer plugin Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 6/9] introduce qemu_find_net_clients_by_model Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 7/9] net/queue: export qemu_net_queue_append Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 8/9] move out net queue structs define Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 9/9] add a public api to release buffer Yang Hongyang
2015-07-25 5:06 ` [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter zhanghailiang
2015-07-26 14:13 ` Yang Hongyang
2015-07-27 10:32 ` Daniel P. Berrange
2015-07-27 13:23 ` Yang Hongyang
2015-07-27 4:53 ` Jason Wang
2015-07-27 5:01 ` Yang Hongyang
2015-07-29 10:34 ` Yang Hongyang
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=1437735359-17415-3-git-send-email-yanghy@cn.fujitsu.com \
--to=yanghy@cn.fujitsu.com \
--cc=jasowang@redhat.com \
--cc=mrhines@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.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 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).