From patchwork Mon Feb 18 22:22:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Larrew X-Patchwork-Id: 221559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 904372C0089 for ; Tue, 19 Feb 2013 10:45:41 +1100 (EST) Received: from localhost ([::1]:48913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7aOx-0003Fs-KI for incoming@patchwork.ozlabs.org; Mon, 18 Feb 2013 18:45:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7ZSa-0007zp-3a for qemu-devel@nongnu.org; Mon, 18 Feb 2013 17:45:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7ZSU-0003rr-9x for qemu-devel@nongnu.org; Mon, 18 Feb 2013 17:45:17 -0500 Received: from [32.97.110.55] (port=60150 helo=jlarrew.austin.ibm.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7ZSU-0003mY-07 for qemu-devel@nongnu.org; Mon, 18 Feb 2013 17:45:14 -0500 Received: from jlarrew.austin.ibm.com (localhost [127.0.0.1]) by jlarrew.austin.ibm.com (8.14.5/8.14.5) with ESMTP id r1IMMqJN019123; Mon, 18 Feb 2013 16:22:52 -0600 Received: (from jlarrew@localhost) by jlarrew.austin.ibm.com (8.14.5/8.14.5/Submit) id r1IMMpkS019122; Mon, 18 Feb 2013 16:22:51 -0600 From: Jesse Larrew To: qemu-devel@nongnu.org Date: Mon, 18 Feb 2013 16:22:38 -0600 Message-Id: <1361226165-19030-2-git-send-email-jlarrew@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1361226165-19030-1-git-send-email-jlarrew@linux.vnet.ibm.com> References: <1361226165-19030-1-git-send-email-jlarrew@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.55 Cc: aliguori@us.ibm.com, Jesse Larrew Subject: [Qemu-devel] [PATCH 1/8] virtio-net: replace redundant config_size field with config_len 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 Commit 14f9b664b34bbd37a488cb5c762aa278c60e1fb6 added a config_size field to struct VirtIONet. However, struct VirtIONet has an embedded struct VirtIODevice that already contains a config_len field for this purpose, so config_size is unnecessary. This patch simply replaces it with vdev->config_len instead. Signed-off-by: Jesse Larrew Reviewed-by: Anthony Liguori --- hw/virtio-net.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 573c669..bdbfc18 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -73,7 +73,6 @@ typedef struct VirtIONet int multiqueue; uint16_t max_queues; uint16_t curr_queues; - size_t config_size; } VirtIONet; /* @@ -127,7 +126,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) stw_p(&netcfg.status, n->status); stw_p(&netcfg.max_virtqueue_pairs, n->max_queues); memcpy(netcfg.mac, n->mac, ETH_ALEN); - memcpy(config, &netcfg, n->config_size); + memcpy(config, &netcfg, vdev->config_len); } static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config) @@ -135,7 +134,7 @@ static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t *config) VirtIONet *n = to_virtio_net(vdev); struct virtio_net_config netcfg = {}; - memcpy(&netcfg, config, n->config_size); + memcpy(&netcfg, config, vdev->config_len); if (!(n->vdev.guest_features >> VIRTIO_NET_F_CTRL_MAC_ADDR & 1) && memcmp(netcfg.mac, n->mac, ETH_ALEN)) { @@ -1316,7 +1315,6 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf, n = (VirtIONet *)virtio_common_init("virtio-net", VIRTIO_ID_NET, config_size, sizeof(VirtIONet)); - n->config_size = config_size; n->vdev.get_config = virtio_net_get_config; n->vdev.set_config = virtio_net_set_config; n->vdev.get_features = virtio_net_get_features;