From patchwork Fri Apr 17 12:13:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 462044 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 E01151402BD for ; Fri, 17 Apr 2015 23:16:40 +1000 (AEST) Received: from localhost ([::1]:41342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj68M-0008KX-Om for incoming@patchwork.ozlabs.org; Fri, 17 Apr 2015 09:16:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj5Ah-0005Lb-Cf for qemu-devel@nongnu.org; Fri, 17 Apr 2015 08:15:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yj5Ad-00023M-3N for qemu-devel@nongnu.org; Fri, 17 Apr 2015 08:14:59 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:33504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj5Ac-000237-UM for qemu-devel@nongnu.org; Fri, 17 Apr 2015 08:14:55 -0400 Received: by paboj16 with SMTP id oj16so123772447pab.0 for ; Fri, 17 Apr 2015 05:14:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lGHgvjdXMc6EaVXBhhJCy+ST/cIcS/vmZrrDcBay3YM=; b=W05xoSr2LE6qQWKEMw2L7GYCVPo9VtgmUeoCagDp3wjKVyALEcshJ/XN5RigHFA9HB tvm30vQVUHpc75SRj9jRYKJ0OgD78amM9wjOeMBSpeTyTBwdMxv/R2L53jLXdg+vuAqG 8k2Rm6gQb1Kpg0effTB3F/kwOs6KhR6cmXDJUfe/MmQ5Z/u5qVom7sqsPExNtGsqVx0I xF9rr9EnmmH5WXC9zK8kWzUj+CXBItDL54mdHDDD+BzGwzN8p8vr5xWa1y2G9LMpXqgU m0jDbOphI2RkF09ikANnoXzFlVjXSePjtN3CsceRXho/Kc+M+t6azbP41/m9Ny3+tPJl zs1w== X-Gm-Message-State: ALoCoQklg512rceR9RbK8816622vqKYvO7+9lAWjaANX8xpW/OQWEHmScvfR4XdwO3ENiMu9b64g X-Received: by 10.68.252.106 with SMTP id zr10mr5006031pbc.79.1429272894536; Fri, 17 Apr 2015 05:14:54 -0700 (PDT) Received: from localhost.localdomain ([180.150.153.56]) by mx.google.com with ESMTPSA id nb10sm10006492pdb.76.2015.04.17.05.14.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Apr 2015 05:14:53 -0700 (PDT) From: Shannon Zhao To: qemu-devel@nongnu.org Date: Fri, 17 Apr 2015 20:13:45 +0800 Message-Id: <1429272826-4145-4-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1429272826-4145-1-git-send-email-shannon.zhao@linaro.org> References: <1429272826-4145-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.53 X-Mailman-Approved-At: Fri, 17 Apr 2015 09:13:08 -0400 Cc: peter.maydell@linaro.org, mst@redhat.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org, zhaoshenglong@huawei.com, pbonzini@redhat.com, christoffer.dall@linaro.org Subject: [Qemu-devel] [PATCH 3/4] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 31fdf94..49c13e2 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -517,7 +517,6 @@ static void virtio_s390_device_plugged(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 30ca377..acd3844 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1409,7 +1409,6 @@ static void virtio_ccw_device_plugged(DeviceState *d) 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;