From nobody Tue Nov 4 15:15:42 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 1530133437034463.76195404211535; Wed, 27 Jun 2018 14:03:57 -0700 (PDT) Received: from localhost ([::1]:33215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYHbV-0002lN-2N for importer@patchew.org; Wed, 27 Jun 2018 17:03:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYHHQ-0004Qq-EE for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYHHP-0006rm-Ik for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:08 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:39601) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYHHP-0006qu-Bv for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:07 -0400 Received: by mail-pl0-x243.google.com with SMTP id s24-v6so1590772plq.6 for ; Wed, 27 Jun 2018 13:43:07 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id c67-v6sm9690428pfj.173.2018.06.27.13.43.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 13:43:05 -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=Abb4T//uHh4P68qhN6MzsusgRCJnnTDffWntB+KBgsQ=; b=HHat3ZKGrxrs5+IXfrntd/CjHX6ECrYyXGTHJrj2IiRGaXiVPCki+24ZCccamG5IX+ ImerzWSO1vd8Mv+O9S/OsUEA66JZp3LPNfEVvLvA2ECwGjUVYKeR90uGYYamfZcppBq+ dzGkn/X6a6dwG5mk3ELpGwHqLsTwhzZnAprHAP8dAOGn7Lrpi2vnMAQEdI/miOXfjKop FPb4TGjUJ1AK9mOvKTKtsyXajJfPrRClDFclf1Cr/QDVrtPncB73l798kKYqWMc9OdBx z6ZWfu8QYUV85G1f7pLH3xFIawUv7Ork4yuAXBGvbu/21kierFf2zxBi27AYJ8x9xRZG UHzQ== 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=Abb4T//uHh4P68qhN6MzsusgRCJnnTDffWntB+KBgsQ=; b=QXcZQalFh8dAJaEnEiRBCVxpEd8zSSOnVfW/mNvAmdPwt9gXtx7HbI8Eq7QTr1ERNy nKC27zfKsQjm20tMhIpZ2pLlWewYSu20ZmbestZDCkqapgH+Sx4hud46A3JKXLjduQhF yw3Q9nvDtDroiHfSwN1d9jG/crhLcbUuvCNRLUuehI5FX1jj7r1WPmplkcYL3dPok+mB RSnLIPjP5V+KLc/ZK3stC5CSTbrAkb6jtCzSGSiFedHIKoDZVwhbbfczlQqosw4yhnwt p1ww+cWc027qpJ1J0InQUjCLXC4I7C+qea2mXDAOn47AUneyuLqvTRZDr29FxS3QxCVA OEBg== X-Gm-Message-State: APt69E15GzXX7i5l3FfULeA+zJey/luntly6uDyxg2W9IpL5QLOv3xaA vEg0cTcuI2h1qKptkyEPEgeSFw== X-Google-Smtp-Source: ADUXVKKM/jAxdk35YOL8QjcaoGhqdu0DYEoD/yd0gsvtUAB141DBOMIW1If11rCbv3OFjG0Vhh5uMg== X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr7808933plt.288.1530132186073; Wed, 27 Jun 2018 13:43:06 -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: Thu, 28 Jun 2018 04:41:31 +0800 Message-Id: <20180627204136.4177-16-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180627204136.4177-1-zhangckid@gmail.com> References: <20180627204136.4177-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH V9 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: 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 --- 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