From patchwork Tue Sep 23 09:23:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Hongyang X-Patchwork-Id: 392325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2558C1400BE for ; Tue, 23 Sep 2014 19:39:16 +1000 (EST) Received: from localhost ([::1]:51892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWMZ0-0007Wv-3x for incoming@patchwork.ozlabs.org; Tue, 23 Sep 2014 05:39:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWMLS-0002DE-Pt for qemu-devel@nongnu.org; Tue, 23 Sep 2014 05:25:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWMLN-0008OZ-BF for qemu-devel@nongnu.org; Tue, 23 Sep 2014 05:25:14 -0400 Received: from [59.151.112.132] (port=47516 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWMLN-00083l-0y for qemu-devel@nongnu.org; Tue, 23 Sep 2014 05:25:09 -0400 X-IronPort-AV: E=Sophos;i="5.04,578,1406563200"; d="scan'208";a="36329460" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 23 Sep 2014 17:22:04 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s8N9P9dD018377; Tue, 23 Sep 2014 17:25:09 +0800 Received: from localhost (10.167.226.223) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 23 Sep 2014 17:25:07 +0800 From: Yang Hongyang To: Date: Tue, 23 Sep 2014 17:23:52 +0800 Message-ID: <1411464235-5653-21-git-send-email-yanghy@cn.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411464235-5653-1-git-send-email-yanghy@cn.fujitsu.com> References: <1411464235-5653-1-git-send-email-yanghy@cn.fujitsu.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: GuiJianfeng@cn.fujitsu.com, yunhong.jiang@intel.com, eddie.dong@intel.com, dgilbert@redhat.com, mrhines@linux.vnet.ibm.com, yanghy@cn.fujitsu.com Subject: [Qemu-devel] [RFC PATCH v2 20/23] COLO nic: implement colo nic device interface support_colo() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org implement colo nic device interface support_colo() Signed-off-by: Yang Hongyang --- net/colo-nic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/colo-nic.c b/net/colo-nic.c index 2f7ca23..7255a48 100644 --- a/net/colo-nic.c +++ b/net/colo-nic.c @@ -21,11 +21,17 @@ typedef struct nic_device { QTAILQ_HEAD(, nic_device) nic_devices = QTAILQ_HEAD_INITIALIZER(nic_devices); +static bool nic_support_colo(NetClientState *nc) +{ + return nc && nc->colo_script[0] && nc->colo_nicname[0]; +} + void colo_add_nic_devices(NetClientState *nc) { struct nic_device *nic = g_malloc0(sizeof(*nic)); - /* TODO: init colo function pointers */ + nic->support_colo = nic_support_colo; + /* * TODO * only support "-netdev tap,colo_scripte..." options