From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH] net/virtio: fix build without virtio-user Date: Tue, 17 Jan 2017 23:22:41 +0100 Message-ID: <1484691761-1778-1-git-send-email-thomas.monjalon@6wind.com> References: <6199672.AS3ZBII79S@xps13> Cc: dev@dpdk.org To: Yuanhan Liu Return-path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 5CC605589 for ; Tue, 17 Jan 2017 23:22:46 +0100 (CET) Received: by mail-wm0-f42.google.com with SMTP id c206so246139226wme.0 for ; Tue, 17 Jan 2017 14:22:46 -0800 (PST) In-Reply-To: <6199672.AS3ZBII79S@xps13> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 0fe99d5..1d51942 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -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; -- 2.7.0