From patchwork Wed Mar 23 04:10:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [13/18] net: insert event-tap to qemu_send_packet() and qemu_sendv_packet_async(). Date: Tue, 22 Mar 2011 18:10:21 -0000 From: Yoshiaki Tamura X-Patchwork-Id: 87994 Message-Id: <1300853426-7054-14-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> To: kvm@vger.kernel.org, qemu-devel@nongnu.org Cc: kwolf@redhat.com, aliguori@us.ibm.com, mtosatti@redhat.com, ohmura.kei@lab.ntt.co.jp, ananth@in.ibm.com, mst@redhat.com, dlaor@redhat.com, vatsa@linux.vnet.ibm.com, Yoshiaki Tamura , blauwirbel@gmail.com, quintela@redhat.com, avi@redhat.com, pbonzini@redhat.com, psuriset@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com event-tap function is called only when it is on. Signed-off-by: Yoshiaki Tamura --- net.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/net.c b/net.c index ddcca97..a541ede 100644 --- a/net.c +++ b/net.c @@ -37,6 +37,7 @@ #include "qemu_socket.h" #include "hw/qdev.h" #include "iov.h" +#include "event-tap.h" static QTAILQ_HEAD(, VLANState) vlans; static QTAILQ_HEAD(, VLANClientState) non_vlan_clients; @@ -519,6 +520,10 @@ ssize_t qemu_send_packet_async(VLANClientState *sender, void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size) { + if (event_tap_is_on()) { + return event_tap_send_packet(vc, buf, size); + } + qemu_send_packet_async(vc, buf, size, NULL); } @@ -600,6 +605,10 @@ ssize_t qemu_sendv_packet_async(VLANClientState *sender, { NetQueue *queue; + if (event_tap_is_on()) { + return event_tap_sendv_packet_async(sender, iov, iovcnt, sent_cb); + } + if (sender->link_down || (!sender->peer && !sender->vlan)) { return iov_size(iov, iovcnt); }