From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
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 <dev@dpdk.org>; Tue, 17 Jan 2017 23:22:46 +0100 (CET)
Received: by mail-wm0-f42.google.com with SMTP id c206so246139226wme.0
 for <dev@dpdk.org>; Tue, 17 Jan 2017 14:22:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=zeqCyWRpNo9B92DEx/oQjlDla17GbCn+DQdcPqClZ9I=;
 b=Jmb78cwCBmAyk9sYYHaXOu6K4oqpIi/Ogg8JirH9w/sMZGa1H3pAGlWfvMncYUnn9s
 tLqxZ3riQUm8O3tI9ds6hRurGOLhjWddfBSGY+ADjnV5+XbpSR+u7TlxNymsYQiQzEom
 WJbO20tHYVQGNpKjdoskE5RquaDx1uDR7qofrfLIWKHHZmImEOv9M3CxYfBjSFIslvbm
 f0S02mc9RbhbiVrNLHLfCMvXm1iL4pXzLGVHytqIFQrldvpBmbNhE/QDYex/7d1sxSw1
 sJXwyR8I9/H4w+bVyzE1x0XVZtviZbwi+Q/fyk0l4IIoirCKjeWPeljDQmGgFSh6aoRk
 jLtw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references;
 bh=zeqCyWRpNo9B92DEx/oQjlDla17GbCn+DQdcPqClZ9I=;
 b=pRljU1MjOG9ItyJ5cXalH6X2u+8rNFY3X4pzY0Xf4APy1zykxDialdAn/Jd+W+ruRU
 qEizvCFL2i/K+QmI7YuBJcWAJKuxrDVDRW0yV/BPJoyLMSnWt1VzrC42ndzJmrsaqIwZ
 vU9kbpvxmysSz9G0Q2EH/a2ixZKeC8p3fPxtFEIHJVFeG7FHzecWPQDCnoxpJ1haspSY
 1RdJleefeO70Pk9MSVLXtXgR6RDworCLkm0DZuNwjoQrMU4P3bx6Ymfr9vycHc02IcBi
 GxAhf8PAOh81sm3GKBRsoMzD71nCI+LVxDMqhajMv6plNn7P4eEdV+JPsT1EPAADsRwx
 xtSg==
X-Gm-Message-State: AIkVDXLkCr6tIz0xP00Y7Fow4F68tduxp/bzlicAQbhxyJtldq+3JcuiDFqsk1m+8JcIgOYr
X-Received: by 10.28.43.129 with SMTP id r123mr4003064wmr.120.1484691766051;
 Tue, 17 Jan 2017 14:22:46 -0800 (PST)
Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184])
 by smtp.gmail.com with ESMTPSA id e14sm40208408wmd.14.2017.01.17.14.22.44
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Tue, 17 Jan 2017 14:22:45 -0800 (PST)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: dev@dpdk.org
Date: Tue, 17 Jan 2017 23:22:41 +0100
Message-Id: <1484691761-1778-1-git-send-email-thomas.monjalon@6wind.com>
X-Mailer: git-send-email 2.7.0
In-Reply-To: <6199672.AS3ZBII79S@xps13>
References: <6199672.AS3ZBII79S@xps13>
Subject: [dpdk-dev] [PATCH] net/virtio: fix build without virtio-user
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Jan 2017 22:22:46 -0000

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(-)

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