Commit b9482461 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

virtio: remove vdev->id



Now that vtpci_internal has been removed,
the vdev->id and g_ctrlr_counter are
obsolete and can be removed as well.

Change-Id: Ia1e83cdc81552173f4b57283f83c5791e2b90daa
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/388301


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent a87768a2
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@
struct virtio_driver g_virtio_driver = {
	.init_ctrlrs = TAILQ_HEAD_INITIALIZER(g_virtio_driver.init_ctrlrs),
	.attached_ctrlrs = TAILQ_HEAD_INITIALIZER(g_virtio_driver.attached_ctrlrs),
	.ctrlr_counter = 0,
};

/* Chain all the descriptors in the ring with an END */
@@ -316,7 +315,6 @@ struct virtio_dev *
	virtio_dev_construct(const struct virtio_dev_ops *ops, void *ctx)
{
	struct virtio_dev *vdev;
	unsigned vdev_num;

	vdev = calloc(1, sizeof(*vdev));
	if (vdev == NULL) {
@@ -324,8 +322,6 @@ struct virtio_dev *
		return NULL;
	}

	vdev_num = __sync_add_and_fetch(&g_virtio_driver.ctrlr_counter, 1);
	vdev->id = vdev_num;
	pthread_mutex_init(&vdev->mutex, NULL);
	vdev->backend_ops = ops;
	vdev->ctx = ctx;
+0 −6
Original line number Diff line number Diff line
@@ -72,9 +72,6 @@ struct virtio_dev {
	/** Max number of queues the host supports. */
	uint16_t	max_queues;

	/** Device index. */
	uint32_t	id;

	/** Common device & guest features. */
	uint64_t	negotiated_features;

@@ -189,9 +186,6 @@ struct virtio_req {
struct virtio_driver {
	TAILQ_HEAD(, virtio_dev) init_ctrlrs;
	TAILQ_HEAD(, virtio_dev) attached_ctrlrs;

	/* Increment-only virtio_dev counter */
	unsigned ctrlr_counter;
};

extern struct virtio_driver g_virtio_driver;
+5 −1
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ struct virtio_hw {
#define PCI_CAP_ID_VNDR		0x09
#define PCI_CAP_ID_MSIX		0x11

static int g_dev_counter = 0;

static inline int
check_vq_phys_addr_ok(struct virtqueue *vq)
{
@@ -414,7 +416,9 @@ next:
static int
virtio_dev_pci_init(struct virtio_dev *vdev)
{
	vdev->name = spdk_sprintf_alloc("VirtioScsi%"PRIu32, vdev->id);
	int vdev_id = ++g_dev_counter;

	vdev->name = spdk_sprintf_alloc("VirtioScsi%"PRIu32, vdev_id);
	if (!vdev->name) {
		return -1;
	}