From: Zhang Chen <chen.zhang@intel.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Zhang Chen <chen.zhang@intel.com>,
qemu-dev <qemu-devel@nongnu.org>,
Li Zhijian <lizhijian@cn.fujitsu.com>,
Markus Armbruster <armbru@redhat.com>
Subject: [PATCH V5 3/3] net/colo-compare.c: Optimize transfer protocol for colo-compare
Date: Thu, 28 Oct 2021 17:05:56 +0800 [thread overview]
Message-ID: <20211028090556.3168043-4-chen.zhang@intel.com> (raw)
In-Reply-To: <20211028090556.3168043-1-chen.zhang@intel.com>
Enable vnet_hdr in payload by default. Make it easier to find module
communication configuration errors.
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
net/colo-compare.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index b100e7b51f..fb61b0eea9 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -119,7 +119,9 @@ struct CompareState {
SocketReadState notify_rs;
SendCo out_sendco;
SendCo notify_sendco;
+ /* Keep compatibility for the management layer */
bool vnet_hdr;
+ int local_vnet_hdr_len;
uint64_t compare_timeout;
uint32_t expired_scan_cycle;
@@ -725,7 +727,6 @@ static void colo_compare_connection(void *opaque, void *user_data)
static void coroutine_fn _compare_chr_send(void *opaque)
{
SendCo *sendco = opaque;
- CompareState *s = sendco->s;
int ret = 0;
while (!g_queue_is_empty(&sendco->send_list)) {
@@ -740,7 +741,7 @@ static void coroutine_fn _compare_chr_send(void *opaque)
goto err;
}
- if (!sendco->notify_remote_frame && s->vnet_hdr) {
+ if (!sendco->notify_remote_frame) {
/*
* We send vnet header len make other module(like filter-redirector)
* know how to parse net packet correctly.
@@ -1157,6 +1158,9 @@ static void compare_pri_rs_finalize(SocketReadState *pri_rs)
CompareState *s = container_of(pri_rs, CompareState, pri_rs);
Connection *conn = NULL;
+ /* Update colo-compare local vnet_hdr_len */
+ s->local_vnet_hdr_len = pri_rs->vnet_hdr_len;
+
if (packet_enqueue(s, PRIMARY_IN, &conn)) {
trace_colo_compare_main("primary: unsupported packet in");
compare_chr_send(s,
@@ -1176,6 +1180,12 @@ static void compare_sec_rs_finalize(SocketReadState *sec_rs)
CompareState *s = container_of(sec_rs, CompareState, sec_rs);
Connection *conn = NULL;
+ /* Check the secondary vnet_hdr_len to ensure parse packet correctly */
+ if (s->local_vnet_hdr_len != sec_rs->vnet_hdr_len) {
+ error_report("colo-compare got a different packet vnet_hdr_len"
+ " from local, please check the nodes -device configuration");
+ }
+
if (packet_enqueue(s, SECONDARY_IN, &conn)) {
trace_colo_compare_main("secondary: unsupported packet in");
} else {
@@ -1289,8 +1299,8 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp)
return;
}
- net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, s->vnet_hdr);
- net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, s->vnet_hdr);
+ net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize, true);
+ net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize, true);
/* Try to enable remote notify chardev, currently just for Xen COLO */
if (s->notify_dev) {
@@ -1299,8 +1309,7 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp)
return;
}
- net_socket_rs_init(&s->notify_rs, compare_notify_rs_finalize,
- s->vnet_hdr);
+ net_socket_rs_init(&s->notify_rs, compare_notify_rs_finalize, false);
}
s->out_sendco.s = s;
@@ -1397,7 +1406,8 @@ static void colo_compare_init(Object *obj)
get_max_queue_size,
set_max_queue_size, NULL, NULL);
- s->vnet_hdr = false;
+ s->vnet_hdr = true;
+ s->local_vnet_hdr_len = 0;
object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr,
compare_set_vnet_hdr);
}
--
2.25.1
prev parent reply other threads:[~2021-10-28 9:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 9:05 [PATCH V5 0/3] net/filter: Optimize filters vnet_hdr support Zhang Chen
2021-10-28 9:05 ` [PATCH V5 1/3] net/filter: Optimize transfer protocol for filter-mirror/redirector Zhang Chen
2021-10-29 3:11 ` Jason Wang
2021-10-29 8:08 ` Zhang, Chen
2021-11-01 3:46 ` Jason Wang
2021-11-01 7:15 ` Zhang, Chen
2021-11-04 5:37 ` Zhang, Chen
2021-11-05 3:16 ` Jason Wang
2021-11-05 3:27 ` Zhang, Chen
2021-11-05 4:03 ` Jason Wang
2021-11-05 5:29 ` Zhang, Chen
2021-11-05 6:10 ` Markus Armbruster
2021-11-05 8:30 ` Jason Wang
2021-11-05 8:43 ` Zhang, Chen
2021-11-08 2:41 ` Jason Wang
2021-11-08 2:50 ` Zhang, Chen
2021-11-09 6:42 ` Jason Wang
2021-11-09 7:20 ` Zhang, Chen
2021-11-09 7:26 ` Jason Wang
2021-11-09 7:31 ` Zhang, Chen
2021-11-09 7:42 ` Jason Wang
2021-11-09 7:47 ` Zhang, Chen
2021-11-10 2:31 ` Zhang, Chen
2021-10-28 9:05 ` [PATCH V5 2/3] net/filter: Optimize transfer protocol for filter-rewriter Zhang Chen
2021-10-28 9:05 ` Zhang Chen [this message]
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=20211028090556.3168043-4-chen.zhang@intel.com \
--to=chen.zhang@intel.com \
--cc=armbru@redhat.com \
--cc=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
/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).