summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-02-23 19:20:28 +0100
committerGerrit Code Review <gerrit@fd.io>2016-02-23 20:41:32 +0000
commite90892e0632a05febc1bb3b2eec272378383a8b2 (patch)
tree3e9b9e5ce8479aba5a91aedb7b7ee123e1d6fa73
parent4ee137baf87fb1261122d4bee4bc15e1432bd0bd (diff)
Enable DPDK KNI code based on DPDK config
Change-Id: Iab579c4a7e615c723d10acf0532490cdaa6db05a Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vnet/vnet/devices/dpdk/device.c11
-rw-r--r--vnet/vnet/devices/dpdk/dpdk.h2
-rw-r--r--vnet/vnet/devices/dpdk/dpdk_priv.h2
-rw-r--r--vnet/vnet/devices/dpdk/init.c2
4 files changed, 16 insertions, 1 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index b8713008330..2f9f135a260 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -332,6 +332,7 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
n_retry = (rv == DPDK_TX_RING_SIZE - tx_tail) ? 1 : 0;
}
}
+#if RTE_LIBRTE_KNI
else if (xd->dev_type == VNET_DPDK_DEV_KNI)
{
if (PREDICT_TRUE(tx_head > tx_tail))
@@ -362,6 +363,7 @@ u32 tx_burst_vector_internal (vlib_main_t * vm,
n_retry = (rv == DPDK_TX_RING_SIZE - tx_tail) ? 1 : 0;
}
}
+#endif
else
{
ASSERT(0);
@@ -781,9 +783,12 @@ static u8 * format_dpdk_device_name (u8 * s, va_list * args)
else
devname_format = "%s%x/%x/%x";
+#ifdef RTE_LIBRTE_KNI
if (dm->devices[i].dev_type == VNET_DPDK_DEV_KNI) {
return format(s, "kni%d", dm->devices[i].kni_port_id);
- } else if (dm->devices[i].dev_type == VNET_DPDK_DEV_VHOST_USER) {
+ } else
+#endif
+ if (dm->devices[i].dev_type == VNET_DPDK_DEV_VHOST_USER) {
return format(s, "VirtualEthernet0/0/%d", dm->devices[i].vu_if_id);
}
switch (dm->devices[i].port_type)
@@ -1169,6 +1174,7 @@ static void dpdk_clear_hw_interface_counters (u32 instance)
rte_eth_xstats_reset(xd->device_index);
}
+#ifdef RTE_LIBRTE_KNI
static int
kni_config_network_if(u8 port_id, u8 if_up)
{
@@ -1213,6 +1219,7 @@ kni_change_mtu(u8 port_id, unsigned new_mtu)
return 0;
}
+#endif
static clib_error_t *
dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
@@ -1223,6 +1230,7 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
dpdk_device_t * xd = vec_elt_at_index (dm->devices, hif->dev_instance);
int rv = 0;
+#ifdef RTE_LIBRTE_KNI
if (xd->dev_type == VNET_DPDK_DEV_KNI)
{
if (is_up)
@@ -1257,6 +1265,7 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
}
return 0;
}
+#endif
if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER)
{
if (is_up)
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h
index 3e287a9a166..48c17729f50 100644
--- a/vnet/vnet/devices/dpdk/dpdk.h
+++ b/vnet/vnet/devices/dpdk/dpdk.h
@@ -45,7 +45,9 @@
#include <rte_ring.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
+#ifdef RTE_LIBRTE_KNI
#include <rte_kni.h>
+#endif
#include <rte_virtio_net.h>
#include <rte_pci_dev_ids.h>
#include <rte_version.h>
diff --git a/vnet/vnet/devices/dpdk/dpdk_priv.h b/vnet/vnet/devices/dpdk/dpdk_priv.h
index 443c81cfe4b..476e70571f9 100644
--- a/vnet/vnet/devices/dpdk/dpdk_priv.h
+++ b/vnet/vnet/devices/dpdk/dpdk_priv.h
@@ -412,11 +412,13 @@ dpdk_rx_burst ( dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
}
}
+#ifdef RTE_LIBRTE_KNI
else if (xd->dev_type == VNET_DPDK_DEV_KNI)
{
n_buffers = rte_kni_rx_burst(xd->kni, xd->rx_vectors[queue_id], VLIB_FRAME_SIZE);
rte_kni_handle_request(xd->kni);
}
+#endif
else
{
ASSERT(0);
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index db0b8384dd9..a67ee45804c 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -620,6 +620,7 @@ dpdk_lib_init (dpdk_main_t * dm)
rte_eth_dev_set_mtu(xd->device_index, hi->max_packet_bytes);
}
+#ifdef RTE_LIBRTE_KNI
if (dm->num_kni) {
clib_warning("Initializing KNI interfaces...");
rte_kni_init(dm->num_kni);
@@ -696,6 +697,7 @@ dpdk_lib_init (dpdk_main_t * dm)
hi = vnet_get_hw_interface (dm->vnet_main, xd->vlib_hw_if_index);
}
}
+#endif
if (nb_desc > dm->num_mbufs)
clib_warning ("%d mbufs allocated but total rx/tx ring size is %d\n",