From patchwork Thu Jun 30 08:41:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 932372 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5U8jc6l019262 for ; Thu, 30 Jun 2011 08:45:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758921Ab1F3Ipf (ORCPT ); Thu, 30 Jun 2011 04:45:35 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:43568 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757363Ab1F3Ipc (ORCPT ); Thu, 30 Jun 2011 04:45:32 -0400 Received: by mail-iw0-f174.google.com with SMTP id 6so1718423iwn.19 for ; Thu, 30 Jun 2011 01:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=SwOaUlEHqgcjCEGsArhKg7XCvVOb65V3fu9W38AVd+I=; b=llMEhofJAtCOpQ+B4FP0X9esqPYLAQFnAqFTL5SK4pmsd1EUwYj67+nVdKw4WwlQ60 n0f3jE0RlVqIhycJ4vYIq6Brpx87IAMh3fxnGdo0EBOqjvWfgg8FLcnacXyTLhrk0cTZ IWYvvxsKYXwEre98hc1lgpMWT3UVv+XJJIzVw= Received: by 10.42.108.68 with SMTP id g4mr2035267icp.410.1309423532721; Thu, 30 Jun 2011 01:45:32 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id d6sm1967338icx.1.2011.06.30.01.45.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Jun 2011 01:45:32 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org, Asias He Subject: [PATCH v2 24/31] kvm tools: Add MACRO for user and tap mode for virtio net Date: Thu, 30 Jun 2011 16:41:12 +0800 Message-Id: <1309423279-3093-25-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1309423279-3093-1-git-send-email-asias.hejun@gmail.com> References: <1309423279-3093-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 30 Jun 2011 08:45:38 +0000 (UTC) This patch prepares the user and tap mode for virtio net. Signed-off-by: Asias He --- tools/kvm/include/kvm/virtio-net.h | 4 ++++ tools/kvm/virtio/net.c | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/tools/kvm/include/kvm/virtio-net.h b/tools/kvm/include/kvm/virtio-net.h index 00f3220..e93e8e4 100644 --- a/tools/kvm/include/kvm/virtio-net.h +++ b/tools/kvm/include/kvm/virtio-net.h @@ -8,8 +8,12 @@ struct virtio_net_parameters { const char *host_ip; char guest_mac[6]; const char *script; + int mode; }; void virtio_net__init(const struct virtio_net_parameters *params); +#define NET_MODE_USER 0 +#define NET_MODE_TAP 1 + #endif /* KVM__VIRTIO_NET_H */ diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c index 6916af6..68967f2 100644 --- a/tools/kvm/virtio/net.c +++ b/tools/kvm/virtio/net.c @@ -63,6 +63,9 @@ struct net_device { int tap_fd; char tap_name[IFNAMSIZ]; + + int mode; + }; static struct net_device ndev = {