[dpdk-dev] net/virtio: fix build without virtio-user
Checks
Commit Message
When CONFIG_RTE_VIRTIO_USER is disabled (default on FreeBSD),
the virtio driver cannot be compiled:
librte_pmd_virtio.a(virtio_ethdev.o): In function `eth_virtio_dev_init':
(.text+0x1eba): undefined reference to `virtio_user_ops'
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
Already applied on mainline git when sending,
in order to allow CI on FreeBSD.
---
drivers/net/virtio/virtio_ethdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Tue, Jan 17, 2017 at 11:22:41PM +0100, Thomas Monjalon wrote:
> When CONFIG_RTE_VIRTIO_USER is disabled (default on FreeBSD),
> the virtio driver cannot be compiled:
>
> librte_pmd_virtio.a(virtio_ethdev.o): In function `eth_virtio_dev_init':
> (.text+0x1eba): undefined reference to `virtio_user_ops'
Oops... and thanks!
--yliu
@@ -1461,9 +1461,12 @@ virtio_remap_pci(struct rte_pci_device *pci_dev, struct virtio_hw *hw)
static void
virtio_set_vtpci_ops(struct virtio_hw *hw)
{
+#ifdef RTE_VIRTIO_USER
if (hw->virtio_user_dev)
VTPCI_OPS(hw) = &virtio_user_ops;
- else if (hw->modern)
+ else
+#endif
+ if (hw->modern)
VTPCI_OPS(hw) = &modern_ops;
else
VTPCI_OPS(hw) = &legacy_ops;