From nobody Wed Nov 5 10:29:48 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534021897782704.1864245772227; Sat, 11 Aug 2018 14:11:37 -0700 (PDT) Received: from localhost ([::1]:33228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fobAe-0006Lt-JV for importer@patchew.org; Sat, 11 Aug 2018 17:11:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fob0O-0005Ov-AK for qemu-devel@nongnu.org; Sat, 11 Aug 2018 17:01:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fob0N-0001Z2-Ih for qemu-devel@nongnu.org; Sat, 11 Aug 2018 17:01:00 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:46832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fob0N-0001Ym-CV for qemu-devel@nongnu.org; Sat, 11 Aug 2018 17:00:59 -0400 Received: by mail-pg1-x536.google.com with SMTP id f14-v6so5850797pgv.13 for ; Sat, 11 Aug 2018 14:00:59 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id h24-v6sm23502641pfk.113.2018.08.11.14.00.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Aug 2018 14:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kUQIPs69dPjU+OLFvSIP7I8hJ4jrJ7hci6aj9qXare4=; b=VM20Qo+zYM0YoOuNIYjt2ImNkEuT4xnfWRfFYSDowjVDSee9sK/vwMj4p7nyjeC71B tNX+WFOKj1fnfhgSAaPLJFYULLiLZfpVg9F4POWzwTH5n09nSwjLjpKPZreGbQv1aSgE airkJ9w5vCKXKrUs2xi8xMTrkl82Wy+LTPNp2ufUObrPjXlADQreR05FLMcWpaxwiNNI a5yCUL/MhFcfori/pjSzg0QKSMrn8yrKci/sES1SMraidU/jvc/YueZt75KE/pAPzsoN v9KYlrt+wE10ixeWuxIytpeI4oPfk1whZIXistieREgUL5fLLuw2NcD8Oq9VdoAAgniE CZvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kUQIPs69dPjU+OLFvSIP7I8hJ4jrJ7hci6aj9qXare4=; b=V1lzgs4dvNj2iHcjfoIrafGM0Tj1x9nwhi3qzYEfPLJXX12BpQbLLk/zrfm1WKAn9M roofg9ots6t7LAXFORzqZQZbgqLMa8UkK6VRRppdyL85gOs9cQokE8u32AKnLWu8LLeQ 40w03PT8WjHTMHHxrp2N1DAAD73yJL//V9zEbvTtN72zfCHffgrHG00WmcvuM6wNEZaq Y4R518TEiX9AMNbkM/q0EN8DenEy2p2pONt4adabuBXAOgh/+NB3aOfk5TV2ltkETcmv FVUKqWR0kSdTHyNTE6ihrnGibnjKw3oEcSi+R0l9mn06o4k2C/zCy2PMzVMJAhZGSnD3 YgnQ== X-Gm-Message-State: AOUpUlGL8yCZZuQcrT5yen3hYVOaQJ2lp2+CvTZ7zXI/J8rm8WajMPAa kFSvXJB/s8oPmpYLUYs4CpS9dXl0 X-Google-Smtp-Source: AA+uWPxmA/Ni+S3D8QeszkMxXYpX3QHVMyJhmXlvRbucl3BGGTLzOT8liFmlR9aD5ZDEELF/IZRcVA== X-Received: by 2002:a63:7c5c:: with SMTP id l28-v6mr11562876pgn.352.1534021258091; Sat, 11 Aug 2018 14:00:58 -0700 (PDT) From: Zhang Chen To: qemu-devel@nongnu.org, Paolo Bonzini , Juan Quintela , "Dr . David Alan Gilbert" , Jason Wang , Eric Blake , Markus Armbruster Date: Sun, 12 Aug 2018 04:59:19 +0800 Message-Id: <20180811205924.4113-16-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180811205924.4113-1-zhangckid@gmail.com> References: <20180811205924.4113-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::536 Subject: [Qemu-devel] [PATCH V11 15/20] net/net.c: Add net client type check function for COLO X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , zhanghailiang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen We add is_colo_support_client_type() to check the net client type for COLO-compare. Currently we just support TAP. Suggested by Jason. Signed-off-by: Zhang Chen Signed-off-by: Zhang Chen --- include/net/net.h | 1 + net/colo-compare.c | 5 +++++ net/net.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 1425960f76..dcbc7ba9c0 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -212,6 +212,7 @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict); void hmp_host_net_remove(Monitor *mon, const QDict *qdict); void netdev_add(QemuOpts *opts, Error **errp); void qmp_netdev_add(QDict *qdict, QObject **ret, Error **errp); +bool is_colo_support_client_type(void); =20 int net_hub_id_for_client(NetClientState *nc, int *id); NetClientState *net_hub_port_find(int hub_id); diff --git a/net/colo-compare.c b/net/colo-compare.c index 426eab5973..b8c0240725 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -996,6 +996,11 @@ static void colo_compare_complete(UserCreatable *uc, E= rror **errp) return; } =20 + if (!is_colo_support_client_type()) { + error_setg(errp, "COLO-compare: Net client type is not supported"); + 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); =20 diff --git a/net/net.c b/net/net.c index 2a3133990c..a77ea88fff 100644 --- a/net/net.c +++ b/net/net.c @@ -1733,3 +1733,17 @@ int net_fill_rstate(SocketReadState *rs, const uint8= _t *buf, int size) assert(size =3D=3D 0); return 0; } + +/* Currently, COLO just support TAP */ +bool is_colo_support_client_type(void) +{ + NetClientState *nc; + + QTAILQ_FOREACH(nc, &net_clients, next) { + if (nc->info->type !=3D NET_CLIENT_DRIVER_TAP) { + return false; + } + } + + return true; +} --=20 2.17.GIT