Skip to contentSkip to conversation

Add COLO-proxy virtio-net support

PATCH Superseded Zhang Chen 2 participants 12 messages Apr 20, 2017 – Apr 25, 2017

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

v2 cover Add COLO-proxy virtio-net support

If user use -device virtio-net-pci, virtio-net driver will add a header to raw net packet that colo-proxy can't handle it. COLO-proxy just focus on the packet payload, so we skip the virtio-net header to compare the sent packet that primary guest's to secondary guest's.

Zhang Chen (6):
net/filter-mirror.c: Add filter-mirror and filter-redirector vnet
support.
net/net.c: Add vnet header length to SocketReadState net/colo-compare.c: Make colo-compare support vnet_hdr_len net/socket.c: Add vnet packet support in net_socket_receive() net/colo.c: Add vnet packet parse feature in colo-proxy net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

 include/net/net.h     |  4 +++-
 net/colo-compare.c    | 48 +++++++++++++++++++++++++++++++++++++++---------
 net/colo.c            |  9 +++++----
 net/colo.h            |  4 +++-
 net/filter-mirror.c   | 25 ++++++++++++++++++++-----
 net/filter-rewriter.c |  2 +-
 net/net.c             | 24 ++++++++++++++++++++++--
 net/socket.c          |  6 ++++++
 8 files changed, 99 insertions(+), 23 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/6 net/filter-mirror.c: Add filter-mirror and filter-redirector vnet support.

In this patch, we change the send packet format from
struct {int size; const uint8_t buf[];} to {int size; int vnet_hdr_len; const uint8_t buf[];}. make other module(like colo-compare) know how to parse net packet correctly.

---
 net/filter-mirror.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
net/filter-mirror.c +20 -5
index 72fa7c2..5b4d616 100644
@@ -23,6 +23,7 @@
 #include "sysemu/char.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
+#include "hw/virtio/virtio-net.h"
 
 #define FILTER_MIRROR(obj) \
     OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_MIRROR)
@@ -43,12 +44,15 @@ typedef struct MirrorState {
     SocketReadState rs;
 } MirrorState;
 
-static int filter_mirror_send(CharBackend *chr_out,
+static int filter_mirror_send(MirrorState *s,
                               const struct iovec *iov,
                               int iovcnt)
 {
+    NetFilterState *nf = NETFILTER(s);
+    VirtIONet *n = qemu_get_nic_opaque(nf->netdev->peer);
     int ret = 0;
     ssize_t size = 0;
+    ssize_t vnet_hdr_len;
     uint32_t len = 0;
     char *buf;
 
@@ -58,14 +62,25 @@ static int filter_mirror_send(CharBackend *chr_out,
     }
 
     len = htonl(size);
-    ret = qemu_chr_fe_write_all(chr_out, (uint8_t *)&len, sizeof(len));
+    ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len));
+    if (ret != sizeof(len)) {
+        goto err;
+    }
+
+    /*
+     * We send vnet header len make other module(like colo-compare)
+     * know how to parse net packet correctly.
+     */
+    vnet_hdr_len = n->guest_hdr_len;
+    len = htonl(vnet_hdr_len);
+    ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len));
     if (ret != sizeof(len)) {
         goto err;
     }
 
     buf = g_malloc(size);
     iov_to_buf(iov, iovcnt, 0, buf, size);
-    ret = qemu_chr_fe_write_all(chr_out, (uint8_t *)buf, size);
+    ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size);
     g_free(buf);
     if (ret != size) {
         goto err;
@@ -141,7 +156,7 @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf,
     MirrorState *s = FILTER_MIRROR(nf);
     int ret;
 
-    ret = filter_mirror_send(&s->chr_out, iov, iovcnt);
+    ret = filter_mirror_send(s, iov, iovcnt);
     if (ret) {
         error_report("filter_mirror_send failed(%s)", strerror(-ret));
     }
@@ -164,7 +179,7 @@ static ssize_t filter_redirector_receive_iov(NetFilterState *nf,
     int ret;
 
     if (qemu_chr_fe_get_driver(&s->chr_out)) {
-        ret = filter_mirror_send(&s->chr_out, iov, iovcnt);
+        ret = filter_mirror_send(s, iov, iovcnt);
         if (ret) {
             error_report("filter_mirror_send failed(%s)", strerror(-ret));
         }
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/6 net/net.c: Add vnet header length to SocketReadState

In reply to Zhang Chen

Address Jason Wang's comments add vnet header length to SocketReadState. So we change net_fill_rstate() to read
struct {int size; int vnet_hdr_len; const uint8_t buf[];}.

---
 include/net/net.h |  4 +++-
 net/net.c         | 24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
include/net/net.h +3 -1
index 99b28d5..1204fe5 100644
@@ -111,9 +111,11 @@ typedef struct NICState {
 } NICState;
 
 struct SocketReadState {
-    int state; /* 0 = getting length, 1 = getting data */
+    /* 0 = getting length, 1 = getting vnet header length, 2 = getting data */
+    int state;
     uint32_t index;
     uint32_t packet_len;
+    uint32_t vnet_hdr_len;
     uint8_t buf[NET_BUFSIZE];
     SocketReadStateFinalize *finalize;
 };
net/net.c +22 -2
index 0ac3b9e..d467452 100644
@@ -1621,8 +1621,12 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size)
     unsigned int l;
 
     while (size > 0) {
-        /* reassemble a packet from the network */
-        switch (rs->state) { /* 0 = getting length, 1 = getting data */
+        /* Reassemble a packet from the network.
+         * 0 = getting length.
+         * 1 = getting vnet header length.
+         * 2 = getting data.
+         */
+        switch (rs->state) {
         case 0:
             l = 4 - rs->index;
             if (l > size) {
@@ -1640,6 +1644,22 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size)
             }
             break;
         case 1:
+            l = 4 - rs->index;
+            if (l > size) {
+                l = size;
+            }
+            memcpy(rs->buf + rs->index, buf, l);
+            buf += l;
+            size -= l;
+            rs->index += l;
+            if (rs->index == 4) {
+                /* got vnet header length */
+                rs->vnet_hdr_len = ntohl(*(uint32_t *)rs->buf);
+                rs->index = 0;
+                rs->state = 2;
+            }
+            break;
+        case 2:
             l = rs->packet_len - rs->index;
             if (l > size) {
                 l = size;
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/6 net/colo-compare.c: Make colo-compare support vnet_hdr_len

In reply to Zhang Chen

COLO-compare can get vnet header length from filter, Add vnet_hdr_len to struct packet and output packet with the vnet_hdr_len.

---
 net/colo-compare.c    | 39 ++++++++++++++++++++++++++++++++-------
 net/colo.c            |  3 ++-
 net/colo.h            |  4 +++-
 net/filter-rewriter.c |  2 +-
 4 files changed, 38 insertions(+), 10 deletions(-)
net/colo-compare.c +32 -7
index 54e6d40..b3e933c 100644
@@ -99,7 +99,8 @@ enum {
 
 static int compare_chr_send(CharBackend *out,
                             const uint8_t *buf,
-                            uint32_t size);
+                            uint32_t size,
+                            uint32_t vnet_hdr_len);
 
 static gint seq_sorter(Packet *a, Packet *b, gpointer data)
 {
@@ -121,9 +122,13 @@ static int packet_enqueue(CompareState *s, int mode)
     Connection *conn;
 
     if (mode == PRIMARY_IN) {
-        pkt = packet_new(s->pri_rs.buf, s->pri_rs.packet_len);
+        pkt = packet_new(s->pri_rs.buf,
+                         s->pri_rs.packet_len,
+                         s->pri_rs.vnet_hdr_len);
     } else {
-        pkt = packet_new(s->sec_rs.buf, s->sec_rs.packet_len);
+        pkt = packet_new(s->sec_rs.buf,
+                         s->sec_rs.packet_len,
+                         s->sec_rs.vnet_hdr_len);
     }
 
     if (parse_packet_early(pkt)) {
@@ -436,7 +441,10 @@ static void colo_compare_connection(void *opaque, void *user_data)
         }
 
         if (result) {
-            ret = compare_chr_send(&s->chr_out, pkt->data, pkt->size);
+            ret = compare_chr_send(&s->chr_out,
+                                   pkt->data,
+                                   pkt->size,
+                                   pkt->vnet_hdr_len);
             if (ret < 0) {
                 error_report("colo_send_primary_packet failed");
             }
@@ -459,7 +467,8 @@ static void colo_compare_connection(void *opaque, void *user_data)
 
 static int compare_chr_send(CharBackend *out,
                             const uint8_t *buf,
-                            uint32_t size)
+                            uint32_t size,
+                            uint32_t vnet_hdr_len)
 {
     int ret = 0;
     uint32_t len = htonl(size);
@@ -473,6 +482,16 @@ static int compare_chr_send(CharBackend *out,
         goto err;
     }
 
+    /*
+     * We send vnet header len make other module(like colo-compare)
+     * know how to parse net packet correctly.
+     */
+    len = htonl(vnet_hdr_len);
+    ret = qemu_chr_fe_write_all(out, (uint8_t *)&len, sizeof(len));
+    if (ret != sizeof(len)) {
+        goto err;
+    }
+
     ret = qemu_chr_fe_write_all(out, (uint8_t *)buf, size);
     if (ret != size) {
         goto err;
@@ -616,7 +635,10 @@ static void compare_pri_rs_finalize(SocketReadState *pri_rs)
 
     if (packet_enqueue(s, PRIMARY_IN)) {
         trace_colo_compare_main("primary: unsupported packet in");
-        compare_chr_send(&s->chr_out, pri_rs->buf, pri_rs->packet_len);
+        compare_chr_send(&s->chr_out,
+                         pri_rs->buf,
+                         pri_rs->packet_len,
+                         pri_rs->vnet_hdr_len);
     } else {
         /* compare connection */
         g_queue_foreach(&s->conn_list, colo_compare_connection, s);
@@ -725,7 +747,10 @@ static void colo_flush_packets(void *opaque, void *user_data)
 
     while (!g_queue_is_empty(&conn->primary_list)) {
         pkt = g_queue_pop_head(&conn->primary_list);
-        compare_chr_send(&s->chr_out, pkt->data, pkt->size);
+        compare_chr_send(&s->chr_out,
+                         pkt->data,
+                         pkt->size,
+                         pkt->vnet_hdr_len);
         packet_destroy(pkt, NULL);
     }
     while (!g_queue_is_empty(&conn->secondary_list)) {
net/colo.c +2 -1
index 8cc166b..180eaed 100644
@@ -153,13 +153,14 @@ void connection_destroy(void *opaque)
     g_slice_free(Connection, conn);
 }
 
-Packet *packet_new(const void *data, int size)
+Packet *packet_new(const void *data, int size, int vnet_hdr_len)
 {
     Packet *pkt = g_slice_new(Packet);
 
     pkt->data = g_memdup(data, size);
     pkt->size = size;
     pkt->creation_ms = qemu_clock_get_ms(QEMU_CLOCK_HOST);
+    pkt->vnet_hdr_len = vnet_hdr_len;
 
     return pkt;
 }
net/colo.h +3 -1
index 7c524f3..caedb0d 100644
@@ -43,6 +43,8 @@ typedef struct Packet {
     int size;
     /* Time of packet creation, in wall clock ms */
     int64_t creation_ms;
+    /* Get vnet_hdr_len from filter */
+    uint32_t vnet_hdr_len;
 } Packet;
 
 typedef struct ConnectionKey {
@@ -82,7 +84,7 @@ Connection *connection_get(GHashTable *connection_track_table,
                            ConnectionKey *key,
                            GQueue *conn_list);
 void connection_hashtable_reset(GHashTable *connection_track_table);
-Packet *packet_new(const void *data, int size);
+Packet *packet_new(const void *data, int size, int vnet_hdr_len);
 void packet_destroy(void *opaque, void *user_data);
 
 #endif /* QEMU_COLO_PROXY_H */
net/filter-rewriter.c +1 -1
index afa06e8..63256c7 100644
@@ -158,7 +158,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf,
     char *buf = g_malloc0(size);
 
     iov_to_buf(iov, iovcnt, 0, buf, size);
-    pkt = packet_new(buf, size);
+    pkt = packet_new(buf, size, 0);
     g_free(buf);
 
     /*
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 4/6 net/socket.c: Add vnet packet support in net_socket_receive()

In reply to Zhang Chen

Because of net_socket_send() add vnet header length argument, Avoid conflict with net_socket_send().

---
 net/socket.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/socket.c +6 -0
index fe3547b..1f1f3d2 100644
@@ -33,6 +33,7 @@
 #include "qemu/sockets.h"
 #include "qemu/iov.h"
 #include "qemu/main-loop.h"
+#include "hw/virtio/virtio-net.h"
 
 typedef struct NetSocketState {
     NetClientState nc;
@@ -81,12 +82,17 @@ static void net_socket_writable(void *opaque)
 static ssize_t net_socket_receive(NetClientState *nc, const uint8_t *buf, size_t size)
 {
     NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);
+    VirtIONet *n = qemu_get_nic_opaque(nc->peer);
     uint32_t len = htonl(size);
+    uint32_t vnet_hdr_len = htonl(n->guest_hdr_len);
     struct iovec iov[] = {
         {
             .iov_base = &len,
             .iov_len  = sizeof(len),
         }, {
+            .iov_base = &vnet_hdr_len,
+            .iov_len  = sizeof(vnet_hdr_len),
+        }, {
             .iov_base = (void *)buf,
             .iov_len  = size,
         },
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v2 5/6 net/colo.c: Add vnet packet parse feature in colo-proxy

In reply to Zhang Chen

Make colo-compare and filter-rewriter can parse vnet packet.

---
 net/colo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/colo.c +3 -3
index 180eaed..28ce7c8 100644
@@ -43,11 +43,11 @@ int parse_packet_early(Packet *pkt)
 {
     int network_length;
     static const uint8_t vlan[] = {0x81, 0x00};
-    uint8_t *data = pkt->data;
+    uint8_t *data = pkt->data + pkt->vnet_hdr_len;
     uint16_t l3_proto;
     ssize_t l2hdr_len = eth_get_l2_hdr_length(data);
 
-    if (pkt->size < ETH_HLEN) {
+    if (pkt->size < ETH_HLEN + pkt->vnet_hdr_len) {
         trace_colo_proxy_main("pkt->size < ETH_HLEN");
         return 1;
     }
@@ -73,7 +73,7 @@ int parse_packet_early(Packet *pkt)
     }
 
     network_length = pkt->ip->ip_hl * 4;
-    if (pkt->size < l2hdr_len + network_length) {
+    if (pkt->size < l2hdr_len + network_length + pkt->vnet_hdr_len) {
         trace_colo_proxy_main("pkt->size < network_header + network_length");
         return 1;
     }
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v2 6/6 net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

In reply to Zhang Chen

COLO-Proxy just focus on packet payload, So we skip vnet header.

---
 net/colo-compare.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
net/colo-compare.c +7 -2
index b3e933c..1941ad9 100644
@@ -187,6 +187,8 @@ static int packet_enqueue(CompareState *s, int mode)
  */
 static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)
 {
+    int offset_all;
+
     if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
         char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20];
 
@@ -200,9 +202,12 @@ static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)
                                    sec_ip_src, sec_ip_dst);
     }
 
+    offset_all = ppkt->vnet_hdr_len + offset;
+
     if (ppkt->size == spkt->size) {
-        return memcmp(ppkt->data + offset, spkt->data + offset,
-                      spkt->size - offset);
+        return memcmp(ppkt->data + offset_all,
+                      spkt->data + offset_all,
+                      spkt->size - offset_all);
     } else {
         trace_colo_compare_main("Net packet size are not the same");
         return -1;
Signature · 1 line
2.7.4
#7 lore raw
In reply to Zhang Chen
Quoted 14 lines · Zhang Chen

If user use -device virtio-net-pci, virtio-net driver will add a header to raw net packet that colo-proxy can't handle it. COLO-proxy just focus on the packet payload, so we skip the virtio-net header to compare the sent packet that primary guest's to secondary guest's.

Zhang Chen (6):
net/filter-mirror.c: Add filter-mirror and filter-redirector vnet
support.
net/net.c: Add vnet header length to SocketReadState net/colo-compare.c: Make colo-compare support vnet_hdr_len net/socket.c: Add vnet packet support in net_socket_receive() net/colo.c: Add vnet packet parse feature in colo-proxy net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

Quoted 10 lines
  include/net/net.h     |  4 +++-
  net/colo-compare.c    | 48 +++++++++++++++++++++++++++++++++++++++---------
  net/colo.c            |  9 +++++----
  net/colo.h            |  4 +++-
  net/filter-mirror.c   | 25 ++++++++++++++++++++-----
  net/filter-rewriter.c |  2 +-
  net/net.c             | 24 ++++++++++++++++++++++--
  net/socket.c          |  6 ++++++
  8 files changed, 99 insertions(+), 23 deletions(-)

A quick glance at the series and find two issues:

- We can't assume virtio-net is the only user for vnet header, you need query e.g NetClientState for a correct vnet header len.
- This series breaks qtest:

**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S39dd06f7f52013798111df2e4eb602c5
**
ERROR:tests/e1000e-test.c:365:e1000e_receive_verify: assertion failed (le32_to_cpu(descr.wb.upper.status_error) & esta_dd == esta_dd): (0x00000000 == 0x00000001)
GTester: last random seed: R02S8c8200b8ec86358cb7addb5c6fe1303c
**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S9be86025aa7ded4902bdf644c3964a6e
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S30cac33d7a98fa56806ca59b35910ea5
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S258359836760a723622abf56cf2e61e7
^C/home/devel/git/qemu/tests/Makefile.include:815: recipe for target 'check-qtest-x86_64' failed
make: *** [check-qtest-x86_64] Interrupt

Please fix them.

Thanks

author
#8 lore raw
Quoted 29 lines · Jason Wang
Quoted 14 lines · Zhang Chen

If user use -device virtio-net-pci, virtio-net driver will add a header to raw net packet that colo-proxy can't handle it. COLO-proxy just focus on the packet payload, so we skip the virtio-net header to compare the sent packet that primary guest's to secondary guest's.

Zhang Chen (6):
net/filter-mirror.c: Add filter-mirror and filter-redirector vnet
support.
net/net.c: Add vnet header length to SocketReadState net/colo-compare.c: Make colo-compare support vnet_hdr_len net/socket.c: Add vnet packet support in net_socket_receive() net/colo.c: Add vnet packet parse feature in colo-proxy net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

Quoted 11 lines
  include/net/net.h     |  4 +++-
  net/colo-compare.c    | 48 
+++++++++++++++++++++++++++++++++++++++---------
  net/colo.c            |  9 +++++----
  net/colo.h            |  4 +++-
  net/filter-mirror.c   | 25 ++++++++++++++++++++-----
  net/filter-rewriter.c |  2 +-
  net/net.c             | 24 ++++++++++++++++++++++--
  net/socket.c          |  6 ++++++
  8 files changed, 99 insertions(+), 23 deletions(-)
Quoted 4 lines

A quick glance at the series and find two issues:

- We can't assume virtio-net is the only user for vnet header, you need query e.g NetClientState for a correct vnet header len.

OK~~ I will fix it in next version.

Quoted 20 lines

- This series breaks qtest:

**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S39dd06f7f52013798111df2e4eb602c5
**
ERROR:tests/e1000e-test.c:365:e1000e_receive_verify: assertion failed (le32_to_cpu(descr.wb.upper.status_error) & esta_dd == esta_dd): (0x00000000 == 0x00000001)
GTester: last random seed: R02S8c8200b8ec86358cb7addb5c6fe1303c
**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S9be86025aa7ded4902bdf644c3964a6e
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S30cac33d7a98fa56806ca59b35910ea5
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S258359836760a723622abf56cf2e61e7
^C/home/devel/git/qemu/tests/Makefile.include:815: recipe for target 'check-qtest-x86_64' failed
make: *** [check-qtest-x86_64] Interrupt

Quoted 2 lines

Please fix them.

Oh~~ I will fix thrm.

Thanks
Zhang Chen

Quoted 5 lines

Thanks

.

Signature · 2 lines
Thanks
Zhang Chen
author
#9 lore raw
In reply to Jason Wang
Quoted 29 lines · Jason Wang
Quoted 14 lines · Zhang Chen

If user use -device virtio-net-pci, virtio-net driver will add a header to raw net packet that colo-proxy can't handle it. COLO-proxy just focus on the packet payload, so we skip the virtio-net header to compare the sent packet that primary guest's to secondary guest's.

Zhang Chen (6):
net/filter-mirror.c: Add filter-mirror and filter-redirector vnet
support.
net/net.c: Add vnet header length to SocketReadState net/colo-compare.c: Make colo-compare support vnet_hdr_len net/socket.c: Add vnet packet support in net_socket_receive() net/colo.c: Add vnet packet parse feature in colo-proxy net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

Quoted 11 lines
  include/net/net.h     |  4 +++-
  net/colo-compare.c    | 48 
+++++++++++++++++++++++++++++++++++++++---------
  net/colo.c            |  9 +++++----
  net/colo.h            |  4 +++-
  net/filter-mirror.c   | 25 ++++++++++++++++++++-----
  net/filter-rewriter.c |  2 +-
  net/net.c             | 24 ++++++++++++++++++++++--
  net/socket.c          |  6 ++++++
  8 files changed, 99 insertions(+), 23 deletions(-)
Quoted 4 lines

A quick glance at the series and find two issues:

- We can't assume virtio-net is the only user for vnet header, you need query e.g NetClientState for a correct vnet header len.

I don't know whether I understand your means.
I found that I can't get vnet_hdr_len from NetClientState,

typedef struct NetClientInfo {
.....

    HasVnetHdr *has_vnet_hdr;
    HasVnetHdrLen *has_vnet_hdr_len;
    UsingVnetHdr *using_vnet_hdr;
    SetOffload *set_offload;
    SetVnetHdrLen *set_vnet_hdr_len;

.....
}NetClientInfo;

This struct haven't a function like get_vnet_hdr_len.
Should I add the get_vnet_hdr_len callback here and write new function in tap.c,tap-wen32.c and netmap.c ?

Thanks
Zhang Chen

Quoted 27 lines

- This series breaks qtest:

**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S39dd06f7f52013798111df2e4eb602c5
**
ERROR:tests/e1000e-test.c:365:e1000e_receive_verify: assertion failed (le32_to_cpu(descr.wb.upper.status_error) & esta_dd == esta_dd): (0x00000000 == 0x00000001)
GTester: last random seed: R02S8c8200b8ec86358cb7addb5c6fe1303c
**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S9be86025aa7ded4902bdf644c3964a6e
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S30cac33d7a98fa56806ca59b35910ea5
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S258359836760a723622abf56cf2e61e7
^C/home/devel/git/qemu/tests/Makefile.include:815: recipe for target 'check-qtest-x86_64' failed
make: *** [check-qtest-x86_64] Interrupt

Please fix them.

Thanks

.

Signature · 2 lines
Thanks
Zhang Chen
#10 lore raw
Quoted 48 lines · Zhang Chen
Quoted 29 lines · Jason Wang
Quoted 14 lines · Zhang Chen

If user use -device virtio-net-pci, virtio-net driver will add a header to raw net packet that colo-proxy can't handle it. COLO-proxy just focus on the packet payload, so we skip the virtio-net header to compare the sent packet that primary guest's to secondary guest's.

Zhang Chen (6):
net/filter-mirror.c: Add filter-mirror and filter-redirector vnet
support.
net/net.c: Add vnet header length to SocketReadState net/colo-compare.c: Make colo-compare support vnet_hdr_len net/socket.c: Add vnet packet support in net_socket_receive() net/colo.c: Add vnet packet parse feature in colo-proxy net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

Quoted 11 lines
  include/net/net.h     |  4 +++-
  net/colo-compare.c    | 48 
+++++++++++++++++++++++++++++++++++++++---------
  net/colo.c            |  9 +++++----
  net/colo.h            |  4 +++-
  net/filter-mirror.c   | 25 ++++++++++++++++++++-----
  net/filter-rewriter.c |  2 +-
  net/net.c             | 24 ++++++++++++++++++++++--
  net/socket.c          |  6 ++++++
  8 files changed, 99 insertions(+), 23 deletions(-)
Quoted 4 lines

A quick glance at the series and find two issues:

- We can't assume virtio-net is the only user for vnet header, you need query e.g NetClientState for a correct vnet header len.

I don't know whether I understand your means.
I found that I can't get vnet_hdr_len from NetClientState,

typedef struct NetClientInfo {
.....

    HasVnetHdr *has_vnet_hdr;
    HasVnetHdrLen *has_vnet_hdr_len;
    UsingVnetHdr *using_vnet_hdr;
    SetOffload *set_offload;
    SetVnetHdrLen *set_vnet_hdr_len;
Quoted 8 lines

.....
}NetClientInfo;

This struct haven't a function like get_vnet_hdr_len.
Should I add the get_vnet_hdr_len callback here and write new function in tap.c,tap-wen32.c and netmap.c ?

Thanks
Zhang Chen

Yes, you need add such callbacks I think.

Thanks

Quoted 29 lines
Quoted 28 lines

- This series breaks qtest:

**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S39dd06f7f52013798111df2e4eb602c5
**
ERROR:tests/e1000e-test.c:365:e1000e_receive_verify: assertion failed (le32_to_cpu(descr.wb.upper.status_error) & esta_dd == esta_dd): (0x00000000 == 0x00000001)
GTester: last random seed: R02S8c8200b8ec86358cb7addb5c6fe1303c
**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S9be86025aa7ded4902bdf644c3964a6e
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S30cac33d7a98fa56806ca59b35910ea5
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S258359836760a723622abf56cf2e61e7
^C/home/devel/git/qemu/tests/Makefile.include:815: recipe for target 'check-qtest-x86_64' failed
make: *** [check-qtest-x86_64] Interrupt

Please fix them.

Thanks

.

author
#11 lore raw
Quoted 54 lines · Jason Wang
Quoted 51 lines · Zhang Chen
Quoted 29 lines · Jason Wang
Quoted 14 lines · Zhang Chen

If user use -device virtio-net-pci, virtio-net driver will add a header to raw net packet that colo-proxy can't handle it. COLO-proxy just focus on the packet payload, so we skip the virtio-net header to compare the sent packet that primary guest's to secondary guest's.

Zhang Chen (6):
net/filter-mirror.c: Add filter-mirror and filter-redirector vnet
support.
net/net.c: Add vnet header length to SocketReadState net/colo-compare.c: Make colo-compare support vnet_hdr_len net/socket.c: Add vnet packet support in net_socket_receive() net/colo.c: Add vnet packet parse feature in colo-proxy net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare

Quoted 11 lines
  include/net/net.h     |  4 +++-
  net/colo-compare.c    | 48 
+++++++++++++++++++++++++++++++++++++++---------
  net/colo.c            |  9 +++++----
  net/colo.h            |  4 +++-
  net/filter-mirror.c   | 25 ++++++++++++++++++++-----
  net/filter-rewriter.c |  2 +-
  net/net.c             | 24 ++++++++++++++++++++++--
  net/socket.c          |  6 ++++++
  8 files changed, 99 insertions(+), 23 deletions(-)
Quoted 4 lines

A quick glance at the series and find two issues:

- We can't assume virtio-net is the only user for vnet header, you need query e.g NetClientState for a correct vnet header len.

I don't know whether I understand your means.
I found that I can't get vnet_hdr_len from NetClientState,

typedef struct NetClientInfo {
.....

    HasVnetHdr *has_vnet_hdr;
    HasVnetHdrLen *has_vnet_hdr_len;
    UsingVnetHdr *using_vnet_hdr;
    SetOffload *set_offload;
    SetVnetHdrLen *set_vnet_hdr_len;

.....
}NetClientInfo;

Quoted 8 lines
Quoted 5 lines

This struct haven't a function like get_vnet_hdr_len.
Should I add the get_vnet_hdr_len callback here and write new function in tap.c,tap-wen32.c and netmap.c ?

Thanks
Zhang Chen

Yes, you need add such callbacks I think.

OK, I got your point~

Thanks
Zhang Chen

Quoted 36 lines

Thanks

Quoted 21 lines
Quoted 21 lines

- This series breaks qtest:

**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S39dd06f7f52013798111df2e4eb602c5
**
ERROR:tests/e1000e-test.c:365:e1000e_receive_verify: assertion failed (le32_to_cpu(descr.wb.upper.status_error) & esta_dd == esta_dd): (0x00000000 == 0x00000001)
GTester: last random seed: R02S8c8200b8ec86358cb7addb5c6fe1303c
**
ERROR:tests/e1000e-test.c:296:e1000e_send_verify: assertion failed (buffer == "TEST"): ("" == "TEST")
GTester: last random seed: R02S9be86025aa7ded4902bdf644c3964a6e
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S30cac33d7a98fa56806ca59b35910ea5
**
ERROR:tests/libqos/virtio.c:94:qvirtio_wait_queue_isr: assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
GTester: last random seed: R02S258359836760a723622abf56cf2e61e7
^C/home/devel/git/qemu/tests/Makefile.include:815: recipe for target 'check-qtest-x86_64' failed
make: *** [check-qtest-x86_64] Interrupt

Quoted 8 lines
Quoted 7 lines

Please fix them.

Thanks

.

.

Signature · 2 lines
Thanks
Zhang Chen