diff mbox

[13/19] net: insert event-tap to qemu_send_packet() and qemu_sendv_packet_async().

Message ID 1294743594-19193-14-git-send-email-tamura.yoshiaki@lab.ntt.co.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Yoshiaki Tamura Jan. 11, 2011, 10:59 a.m. UTC
None
diff mbox

Patch

diff --git a/net.c b/net.c
index 9ba5be2..1176124 100644
--- a/net.c
+++ b/net.c
@@ -36,6 +36,7 @@ 
 #include "qemu-common.h"
 #include "qemu_socket.h"
 #include "hw/qdev.h"
+#include "event-tap.h"
 
 static QTAILQ_HEAD(, VLANState) vlans;
 static QTAILQ_HEAD(, VLANClientState) non_vlan_clients;
@@ -559,6 +560,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);
 }
 
@@ -657,6 +662,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 calc_iov_length(iov, iovcnt);
     }