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

rte_virtio: removed eth_virtio_dev_init()



This patch also fixes segfault on startup when using
a PCI device as a DPDK secondary process.

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


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 8bd15fa1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -506,7 +506,7 @@ bdev_virtio_initialize(void)
	}

	/* TODO check rc, add virtio_dev_deinit() */
	eth_virtio_dev_init(hw);
	virtio_init_device(hw, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
	virtio_dev_start(hw);

	base->hw = hw;
+12 −35
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)
}

/* reset device and renegotiate features if needed */
static int
int
virtio_init_device(struct virtio_hw *hw, uint64_t req_features)
{
	int ret;
@@ -324,40 +324,6 @@ virtio_init_device(struct virtio_hw *hw, uint64_t req_features)
	return 0;
}

static void
virtio_set_vtpci_ops(struct virtio_hw *hw)
{
	VTPCI_OPS(hw) = &virtio_user_ops;
}

/*
 * This function is based on probe() function in virtio_pci.c
 * It returns 0 on success.
 */
int
eth_virtio_dev_init(struct virtio_hw *hw)
{
	int ret;

	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
		virtio_set_vtpci_ops(hw);
		return 0;
	}

	if (!hw->virtio_user_dev) {
		ret = vtpci_init(hw->pci_dev, hw);
		if (ret)
			return ret;
	}

	/* reset device and negotiate default features */
	ret = virtio_init_device(hw, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
	if (ret < 0)
		return ret;

	return 0;
}

int
virtio_dev_start(struct virtio_hw *hw)
{
@@ -392,7 +358,18 @@ static struct virtio_hw *g_pci_hw = NULL;
struct virtio_hw *
get_pci_virtio_hw(void)
{
	int ret;

	printf("%s[%d] %p\n", __func__, __LINE__, g_pci_hw);
	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
		PMD_DRV_LOG(ERR, "rte secondary process support is not implemented yet");
		return NULL;
	}

	ret = vtpci_init(g_pci_hw->pci_dev, g_pci_hw);
	if (ret)
		return NULL;

	return g_pci_hw;
}

+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ uint16_t virtio_recv_pkts(struct virtqueue *vq, struct virtio_req **reqs,

uint16_t virtio_xmit_pkts(struct virtqueue *vq, struct virtio_req *req);

int eth_virtio_dev_init(struct virtio_hw *hw);
int virtio_init_device(struct virtio_hw *hw, uint64_t req_features);
int virtio_dev_start(struct virtio_hw *hw);
struct virtio_hw *get_pci_virtio_hw(void);