[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/8] virtio-net: replace redundant config_size field
From: |
Jesse Larrew |
Subject: |
[Qemu-devel] [PATCH 1/8] virtio-net: replace redundant config_size field with config_len |
Date: |
Mon, 18 Feb 2013 16:22:38 -0600 |
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 <address@hidden>
---
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;
--
1.7.11.7
- [Qemu-devel] [PATCH 0/8] virtio: set config size using host features, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 1/8] virtio-net: replace redundant config_size field with config_len,
Jesse Larrew <=
- [Qemu-devel] [PATCH 8/8] virtio-blk: fill in the feature table, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 6/8] virtio-serial: fill in the feature table, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 7/8] virtio-scsi: fill in table of feature sizes, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 2/8] virtio: put struct VirtIOFeature in a header, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 4/8] virtio: set config size using host features, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 5/8] virtio-balloon: fill in the table of feature_sizes, Jesse Larrew, 2013/02/18
- [Qemu-devel] [PATCH 3/8] virtio: pass host features to driver init functions, Jesse Larrew, 2013/02/18