aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-10-25 18:27:29 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-10-26 14:52:00 +0000
commitb21b60eae51dd0da6df2e88662b0bb44270ccb8b (patch)
tree3c27ffdddd9170072925c6a52e4bd2b921cfce45
parentf195019a300e9f0d375f74cd11ee1dd0cc64aecf (diff)
dpdk: remove KNI support
This code is outdated and without real use case Change-Id: I30628cc4ca293e5249aea3891173507cbfad8b61 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vnet/vnet/devices/dpdk/device.c126
-rw-r--r--vnet/vnet/devices/dpdk/dpdk.h9
-rw-r--r--vnet/vnet/devices/dpdk/format.c13
-rw-r--r--vnet/vnet/devices/dpdk/init.c74
-rw-r--r--vnet/vnet/devices/dpdk/node.c8
5 files changed, 2 insertions, 228 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index cd22d8a4689..5f884a4a400 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -523,38 +523,6 @@ static_always_inline
*xd->lockp[queue_id] = 0;
}
#endif
-#if RTE_LIBRTE_KNI
- else if (xd->flags & DPDK_DEVICE_FLAG_KNI)
- {
- if (PREDICT_TRUE (tx_head > tx_tail))
- {
- /* no wrap, transmit in one burst */
- rv = rte_kni_tx_burst (xd->kni,
- &tx_vector[tx_tail],
- (uint16_t) (tx_head - tx_tail));
- }
- else
- {
- /*
- * This can only happen if there is a flowcontrol callback.
- * We need to split the transmit into two calls: one for
- * the packets up to the wrap point, and one to continue
- * at the start of the ring.
- * Transmit pkts up to the wrap point.
- */
- rv = rte_kni_tx_burst (xd->kni,
- &tx_vector[tx_tail],
- (uint16_t) (xd->nb_tx_desc - tx_tail));
-
- /*
- * If we transmitted everything we wanted, then allow 1 retry
- * so we can try to transmit the rest. If we didn't transmit
- * everything, stop now.
- */
- n_retry = (rv == xd->nb_tx_desc - tx_tail) ? 1 : 0;
- }
- }
-#endif
else
{
ASSERT (0);
@@ -1001,59 +969,6 @@ dpdk_clear_hw_interface_counters (u32 instance)
#endif
}
-#ifdef RTE_LIBRTE_KNI
-static int
-kni_config_network_if (u8 port_id, u8 if_up)
-{
- vnet_main_t *vnm = vnet_get_main ();
- dpdk_main_t *dm = &dpdk_main;
- dpdk_device_t *xd;
- uword *p;
-
- p = hash_get (dm->dpdk_device_by_kni_port_id, port_id);
- if (p == 0)
- {
- clib_warning ("unknown interface");
- return 0;
- }
- else
- {
- xd = vec_elt_at_index (dm->devices, p[0]);
- }
-
- vnet_hw_interface_set_flags (vnm, xd->vlib_hw_if_index,
- if_up ? VNET_HW_INTERFACE_FLAG_LINK_UP |
- ETH_LINK_FULL_DUPLEX : 0);
- return 0;
-}
-
-static int
-kni_change_mtu (u8 port_id, unsigned new_mtu)
-{
- vnet_main_t *vnm = vnet_get_main ();
- dpdk_main_t *dm = &dpdk_main;
- dpdk_device_t *xd;
- uword *p;
- vnet_hw_interface_t *hif;
-
- p = hash_get (dm->dpdk_device_by_kni_port_id, port_id);
- if (p == 0)
- {
- clib_warning ("unknown interface");
- return 0;
- }
- else
- {
- xd = vec_elt_at_index (dm->devices, p[0]);
- }
- hif = vnet_get_hw_interface (vnm, xd->vlib_hw_if_index);
-
- hif->max_packet_bytes = new_mtu;
-
- return 0;
-}
-#endif
-
static clib_error_t *
dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
@@ -1063,47 +978,6 @@ 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->flags & DPDK_DEVICE_FLAG_KNI)
- {
- if (is_up)
- {
- struct rte_kni_conf conf;
- struct rte_kni_ops ops;
- vlib_main_t *vm = vlib_get_main ();
- vlib_buffer_main_t *bm = vm->buffer_main;
- memset (&conf, 0, sizeof (conf));
- snprintf (conf.name, RTE_KNI_NAMESIZE, "vpp%u", xd->kni_port_id);
- conf.mbuf_size = VLIB_BUFFER_DATA_SIZE;
- memset (&ops, 0, sizeof (ops));
- ops.port_id = xd->kni_port_id;
- ops.change_mtu = kni_change_mtu;
- ops.config_network_if = kni_config_network_if;
-
- xd->kni =
- rte_kni_alloc (bm->pktmbuf_pools[rte_socket_id ()], &conf, &ops);
- if (!xd->kni)
- {
- clib_warning ("failed to allocate kni interface");
- }
- else
- {
- hif->max_packet_bytes = 1500; /* kni interface default value */
- xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
- }
- }
- else
- {
- xd->flags &= ~DPDK_DEVICE_FLAG_ADMIN_UP;
- int kni_rv;
-
- kni_rv = rte_kni_release (xd->kni);
- if (kni_rv < 0)
- clib_warning ("rte_kni_release returned %d", kni_rv);
- }
- return 0;
- }
-#endif
#if DPDK_VHOST_USER
if (xd->flags & DPDK_DEVICE_FLAG_VHOST_USER)
{
diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h
index 603a67d80b7..f216a27019d 100644
--- a/vnet/vnet/devices/dpdk/dpdk.h
+++ b/vnet/vnet/devices/dpdk/dpdk.h
@@ -44,9 +44,6 @@
#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_version.h>
#include <rte_eth_bond.h>
@@ -238,7 +235,7 @@ typedef struct
#define DPDK_DEVICE_FLAG_ADMIN_UP (1 << 0)
#define DPDK_DEVICE_FLAG_PROMISC (1 << 1)
#define DPDK_DEVICE_FLAG_PMD (1 << 2)
-#define DPDK_DEVICE_FLAG_KNI (1 << 3)
+
#define DPDK_DEVICE_FLAG_VHOST_USER (1 << 4)
#define DPDK_DEVICE_FLAG_HAVE_SUBIF (1 << 5)
#define DPDK_DEVICE_FLAG_HQOS (1 << 6)
@@ -263,10 +260,6 @@ typedef struct
dpdk_device_hqos_per_worker_thread_t *hqos_wt;
dpdk_device_hqos_per_hqos_thread_t *hqos_ht;
- /* KNI related */
- struct rte_kni *kni;
- u8 kni_port_id;
-
#if DPDK_VHOST_USER
/* vhost-user related */
u32 vu_if_id;
diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c
index 1b3fb5ef37d..5865174990b 100644
--- a/vnet/vnet/devices/dpdk/format.c
+++ b/vnet/vnet/devices/dpdk/format.c
@@ -165,13 +165,6 @@ format_dpdk_device_name (u8 * s, va_list * args)
else
devname_format = "%s%x/%x/%x";
-#ifdef RTE_LIBRTE_KNI
- if (dm->devices[i].flags & DPDK_DEVICE_FLAG_KNI)
- {
- return format (s, "kni%d", dm->devices[i].kni_port_id);
- }
- else
-#endif
#if DPDK_VHOST_USER
if (dm->devices[i].flags & DPDK_DEVICE_FLAG_VHOST_USER)
{
@@ -226,11 +219,7 @@ format_dpdk_device_type (u8 * s, va_list * args)
char *dev_type;
u32 i = va_arg (*args, u32);
- if (dm->devices[i].flags & DPDK_DEVICE_FLAG_KNI)
- {
- return format (s, "Kernel NIC Interface");
- }
- else if (dm->devices[i].flags & DPDK_DEVICE_FLAG_VHOST_USER)
+ if (dm->devices[i].flags & DPDK_DEVICE_FLAG_VHOST_USER)
{
return format (s, "vhost-user interface");
}
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 73edc4a97a5..64623c14260 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -810,80 +810,6 @@ 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->conf->num_kni)
- {
- clib_warning ("Initializing KNI interfaces...");
- rte_kni_init (dm->conf->num_kni);
- for (i = 0; i < dm->conf->num_kni; i++)
- {
- u8 addr[6];
- int j;
-
- /* Create vnet interface */
- vec_add2_aligned (dm->devices, xd, 1, CLIB_CACHE_LINE_BYTES);
- xd->flags |= DPDK_DEVICE_FLAG_KNI;
-
- xd->device_index = xd - dm->devices;
- ASSERT (nports + i == xd->device_index);
- xd->per_interface_next_index = ~0;
- xd->kni_port_id = i;
- xd->cpu_socket = -1;
- hash_set (dm->dpdk_device_by_kni_port_id, i, xd - dm->devices);
- xd->rx_q_used = 1;
-
- /* assign interface to input thread */
- dpdk_device_and_queue_t *dq;
- vec_add2 (dm->devices_by_cpu[dm->input_cpu_first_index], dq, 1);
- dq->device = xd->device_index;
- dq->queue_id = 0;
-
- vec_validate_aligned (xd->tx_vectors, tm->n_vlib_mains,
- CLIB_CACHE_LINE_BYTES);
- for (j = 0; j < tm->n_vlib_mains; j++)
- {
- vec_validate_ha (xd->tx_vectors[j], xd->nb_tx_desc,
- sizeof (tx_ring_hdr_t), CLIB_CACHE_LINE_BYTES);
- vec_reset_length (xd->tx_vectors[j]);
- }
-
- vec_validate_aligned (xd->rx_vectors, xd->rx_q_used,
- CLIB_CACHE_LINE_BYTES);
- for (j = 0; j < xd->rx_q_used; j++)
- {
- vec_validate_aligned (xd->rx_vectors[j], VLIB_FRAME_SIZE - 1,
- CLIB_CACHE_LINE_BYTES);
- vec_reset_length (xd->rx_vectors[j]);
- }
-
- /* FIXME Set up one TX-queue per worker thread */
-
- {
- f64 now = vlib_time_now (vm);
- u32 rnd;
- rnd = (u32) (now * 1e6);
- rnd = random_u32 (&rnd);
-
- clib_memcpy (addr + 2, &rnd, sizeof (rnd));
- addr[0] = 2;
- addr[1] = 0xfe;
- }
-
- error = ethernet_register_interface
- (dm->vnet_main, dpdk_device_class.index, xd->device_index,
- /* ethernet address */ addr,
- &xd->vlib_hw_if_index, dpdk_flag_change);
-
- if (error)
- return error;
-
- sw = vnet_get_hw_sw_interface (dm->vnet_main, xd->vlib_hw_if_index);
- xd->vlib_sw_if_index = sw->sw_if_index;
- hi = vnet_get_hw_interface (dm->vnet_main, xd->vlib_hw_if_index);
- }
- }
-#endif
-
if (nb_desc > dm->conf->num_mbufs)
clib_warning ("%d mbufs allocated but total rx/tx ring size is %d\n",
dm->conf->num_mbufs, nb_desc);
diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c
index 63e7e559286..d1db5e23165 100644
--- a/vnet/vnet/devices/dpdk/node.c
+++ b/vnet/vnet/devices/dpdk/node.c
@@ -367,14 +367,6 @@ dpdk_rx_burst (dpdk_main_t * dm, dpdk_device_t * xd, u16 queue_id)
}
#endif
-#ifdef RTE_LIBRTE_KNI
- else if (xd->flags & DPDK_DEVICE_FLAG_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);