Enable DPDK KNI code based on DPDK config 90/390/2
authorDamjan Marion <damarion@cisco.com>
Tue, 23 Feb 2016 18:20:28 +0000 (19:20 +0100)
committerGerrit Code Review <gerrit@fd.io>
Tue, 23 Feb 2016 20:41:32 +0000 (20:41 +0000)
Change-Id: Iab579c4a7e615c723d10acf0532490cdaa6db05a
Signed-off-by: Damjan Marion <damarion@cisco.com>
vnet/vnet/devices/dpdk/device.c
vnet/vnet/devices/dpdk/dpdk.h
vnet/vnet/devices/dpdk/dpdk_priv.h
vnet/vnet/devices/dpdk/init.c

index b871300..2f9f135 100644 (file)
@@ -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)
index 3e287a9..48c1772 100644 (file)
@@ -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>
index 443c81c..476e705 100644 (file)
@@ -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);
index db0b838..a67ee45 100644 (file)
@@ -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",