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: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/376622 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
8bd15fa161
commit
9eabe8dc6b
@ -506,7 +506,7 @@ bdev_virtio_initialize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO check rc, add virtio_dev_deinit() */
|
/* 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);
|
virtio_dev_start(hw);
|
||||||
|
|
||||||
base->hw = hw;
|
base->hw = hw;
|
||||||
|
@ -294,7 +294,7 @@ virtio_negotiate_features(struct virtio_hw *hw, uint64_t req_features)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reset device and renegotiate features if needed */
|
/* reset device and renegotiate features if needed */
|
||||||
static int
|
int
|
||||||
virtio_init_device(struct virtio_hw *hw, uint64_t req_features)
|
virtio_init_device(struct virtio_hw *hw, uint64_t req_features)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -324,40 +324,6 @@ virtio_init_device(struct virtio_hw *hw, uint64_t req_features)
|
|||||||
return 0;
|
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
|
int
|
||||||
virtio_dev_start(struct virtio_hw *hw)
|
virtio_dev_start(struct virtio_hw *hw)
|
||||||
{
|
{
|
||||||
@ -392,7 +358,18 @@ static struct virtio_hw *g_pci_hw = NULL;
|
|||||||
struct virtio_hw *
|
struct virtio_hw *
|
||||||
get_pci_virtio_hw(void)
|
get_pci_virtio_hw(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
printf("%s[%d] %p\n", __func__, __LINE__, g_pci_hw);
|
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;
|
return g_pci_hw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
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);
|
int virtio_dev_start(struct virtio_hw *hw);
|
||||||
struct virtio_hw *get_pci_virtio_hw(void);
|
struct virtio_hw *get_pci_virtio_hw(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user