From patchwork Mon Apr 20 08:20:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47331 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E529421550 for ; Mon, 20 Apr 2015 08:22:09 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf36210374wgt.1 for ; Mon, 20 Apr 2015 01:22:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=5LMqHgXXMiKvjyUmQZDuOal6ceG0AyS+xuQPHtP2j8E=; b=NEQra9SD0Ey/91+bKKnbukKCe5OUprlSLnS2QeAsE8HIFk+Gof3xuFoPpxQ2vDwAPj wnEFmNP+SlD7NQ6tCw6E3CtLupnWzRt4CS+gFH5Ds/JUiB9rdFmbOjsAHnvbzTg7v37O uvu8Bz6DN9tJxWxcqDhw36g8s6QV7gPCR6R95rcUqw2dCombt5qGz2j+ygqJ4x6Ecs0d z0vSJQhSz06CDidrJrH+Ose32kh9uUnPMCESl9+NJ4+ETLz/d2gbkaQlo+wkIqV+JKLA 7KC4fdPXvDrbznut4fTCJ3Zz2or9cpRL+4Ai0IEobL9eIL9mDDV4ou4pl4rLZL0o6+22 ZM0A== X-Gm-Message-State: ALoCoQkb6S87EB2deSPkErorgVvQENtmSUYZhVHc2OYMBOaofFqOp3zVtdSl7WrZtMwWXSKqeJ8/ X-Received: by 10.180.105.226 with SMTP id gp2mr5578848wib.1.1429518129210; Mon, 20 Apr 2015 01:22:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.228.169 with SMTP id sj9ls809351lac.35.gmail; Mon, 20 Apr 2015 01:22:09 -0700 (PDT) X-Received: by 10.112.159.162 with SMTP id xd2mr14394884lbb.67.1429518128981; Mon, 20 Apr 2015 01:22:08 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id n7si14466080lbs.61.2015.04.20.01.22.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 01:22:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labbd9 with SMTP id bd9so121070757lab.2 for ; Mon, 20 Apr 2015 01:22:08 -0700 (PDT) X-Received: by 10.112.160.227 with SMTP id xn3mr14394633lbb.112.1429518128811; Mon, 20 Apr 2015 01:22:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1295871lbt; Mon, 20 Apr 2015 01:22:08 -0700 (PDT) X-Received: by 10.55.20.159 with SMTP id 31mr26362240qku.64.1429518127050; Mon, 20 Apr 2015 01:22:07 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e2si10828544qhc.45.2015.04.20.01.22.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Apr 2015 01:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:52292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yk6xx-0001Um-VX for patch@linaro.org; Mon, 20 Apr 2015 04:22:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yk6wW-0008BS-66 for qemu-devel@nongnu.org; Mon, 20 Apr 2015 04:20:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yk6wQ-0004Df-OE for qemu-devel@nongnu.org; Mon, 20 Apr 2015 04:20:36 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yk6wQ-0004DU-Jf for qemu-devel@nongnu.org; Mon, 20 Apr 2015 04:20:30 -0400 Received: by paboj16 with SMTP id oj16so199782696pab.0 for ; Mon, 20 Apr 2015 01:20:29 -0700 (PDT) X-Received: by 10.66.149.163 with SMTP id ub3mr25705788pab.125.1429518029855; Mon, 20 Apr 2015 01:20:29 -0700 (PDT) Received: from localhost ([107.181.77.18]) by mx.google.com with ESMTPSA id og11sm17313528pdb.91.2015.04.20.01.20.26 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Apr 2015 01:20:28 -0700 (PDT) From: shannon.zhao@linaro.org To: qemu-devel@nongnu.org, peter.maydell@linaro.org, cornelia.huck@de.ibm.com, mst@redhat.com, pbonzini@redhat.com, christoffer.dall@linaro.org Date: Mon, 20 Apr 2015 16:20:00 +0800 Message-Id: <1429518001-1040-2-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1429518001-1040-1-git-send-email-shannon.zhao@linaro.org> References: <1429518001-1040-1-git-send-email-shannon.zhao@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.46 Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH v2 1/2] hw/net/virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Move DEFINE_VIRTIO_NET_FEATURES to the backend virtio-net. The transports just sync the host features from backend. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/net/virtio-net.c | 4 ++++ hw/s390x/s390-virtio-bus.c | 1 - hw/s390x/virtio-ccw.c | 1 - hw/virtio/virtio-pci.c | 1 - include/hw/virtio/virtio-net.h | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 27adcc5..5d72e2d 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -446,6 +446,9 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) VirtIONet *n = VIRTIO_NET(vdev); NetClientState *nc = qemu_get_queue(n->nic); + /* First sync all virtio-net possible supported features */ + features |= n->host_features; + virtio_add_feature(&features, VIRTIO_NET_F_MAC); if (!peer_has_vnet_hdr(n)) { @@ -1714,6 +1717,7 @@ static void virtio_net_instance_init(Object *obj) } static Property virtio_net_properties[] = { + DEFINE_VIRTIO_NET_FEATURES(VirtIONet, host_features), DEFINE_NIC_PROPERTIES(VirtIONet, nic_conf), DEFINE_PROP_UINT32("x-txtimer", VirtIONet, net_conf.txtimer, TX_TIMER_INTERVAL), diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 047c963..1987873 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -508,7 +508,6 @@ static unsigned virtio_s390_get_features(DeviceState *d) static Property s390_virtio_net_properties[] = { DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), - DEFINE_VIRTIO_NET_FEATURES(VirtIOS390Device, host_features), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 130535c..d9dc80c 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1399,7 +1399,6 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) static Property virtio_ccw_net_properties[] = { DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id), - DEFINE_VIRTIO_NET_FEATURES(VirtioCcwDevice, host_features[0]), DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags, VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c7c3f72..772244e 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1360,7 +1360,6 @@ static Property virtio_net_properties[] = { DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false), DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 3), - DEFINE_VIRTIO_NET_FEATURES(VirtIOPCIProxy, host_features), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 4c2fe83..5bee4df 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -68,6 +68,7 @@ typedef struct VirtIONet { uint32_t has_vnet_hdr; size_t host_hdr_len; size_t guest_hdr_len; + uint32_t host_features; uint8_t has_ufo; int mergeable_rx_bufs; uint8_t promisc;