From: Jason Wang <jasowang@redhat.com>
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>,
Jason Wang <jasowang@redhat.com>
Subject: [Qemu-devel] [PULL 06/14] net/colo.c: Make vnet_hdr_len as packet property
Date: Mon, 17 Jul 2017 20:21:37 +0800 [thread overview]
Message-ID: <1500294105-13713-7-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1500294105-13713-1-git-send-email-jasowang@redhat.com>
From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
We can use this property flush and send packet with vnet_hdr_len.
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/colo-compare.c | 8 ++++++--
net/colo.c | 3 ++-
net/colo.h | 4 +++-
net/filter-rewriter.c | 2 +-
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index ea9bccc..9c2b1ea 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -121,9 +121,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)) {
diff --git a/net/colo.c b/net/colo.c
index 8cc166b..180eaed 100644
--- a/net/colo.c
+++ b/net/colo.c
@@ -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;
}
diff --git a/net/colo.h b/net/colo.h
index 7c524f3..caedb0d 100644
--- a/net/colo.h
+++ b/net/colo.h
@@ -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 */
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index afa06e8..63256c7 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -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);
/*
--
2.7.4
next prev parent reply other threads:[~2017-07-17 12:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 12:21 [Qemu-devel] [PULL 00/14] Net patches Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 01/14] net: Add vnet_hdr_len arguments in NetClientState Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 02/14] net/net.c: Add vnet_hdr support in SocketReadState Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 03/14] net/filter-mirror.c: Introduce parameter for filter_send() Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 04/14] net/filter-mirror.c: Make filter mirror support vnet support Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 05/14] net/filter-mirror.c: Add new option to enable vnet support for filter-redirector Jason Wang
2017-07-17 12:21 ` Jason Wang [this message]
2017-07-17 12:21 ` [Qemu-devel] [PULL 07/14] net/colo-compare.c: Introduce parameter for compare_chr_send() Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 08/14] net/colo-compare.c: Make colo-compare support vnet_hdr_len Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 09/14] net/colo.c: Add vnet packet parse feature in colo-proxy Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 10/14] net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 11/14] net/filter-rewriter.c: Make filter-rewriter support vnet_hdr_len Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 12/14] docs/colo-proxy.txt: Update colo-proxy usage of net driver with vnet_header Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 13/14] virtion-net: Prefer is_power_of_2() Jason Wang
2017-07-17 12:21 ` [Qemu-devel] [PULL 14/14] virtio-net: fix offload ctrl endian Jason Wang
2017-07-18 9:34 ` [Qemu-devel] [PULL 00/14] Net patches Peter Maydell
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=1500294105-13713-7-git-send-email-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhangchen.fnst@cn.fujitsu.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).