Allow empty DPDK device init config
[vpp.git] / vnet / vnet / devices / dpdk / init.c
index 7045e45..e06d6bf 100644 (file)
@@ -431,7 +431,11 @@ dpdk_lib_init (dpdk_main_t * dm)
 
       /* workaround for drivers not setting driver_name */
       if ((!dev_info.driver_name) && (dev_info.pci_dev))
+#if RTE_VERSION < RTE_VERSION_NUM(16, 11, 0, 0)
        dev_info.driver_name = dev_info.pci_dev->driver->name;
+#else
+       dev_info.driver_name = dev_info.pci_dev->driver->driver.name;
+#endif
       ASSERT (dev_info.driver_name);
 
       if (!xd->pmd)
@@ -902,6 +906,7 @@ dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
   if (!input)
     return 0;
 
+  unformat_skip_white_space (input);
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (input, "num-rx-queues %u", &devconf->num_rx_queues))
@@ -1554,7 +1559,11 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
            struct rte_eth_dev_info dev_info;
            rte_eth_dev_info_get (i, &dev_info);
            if (!dev_info.driver_name)
+#if RTE_VERSION < RTE_VERSION_NUM(16, 11, 0, 0)
              dev_info.driver_name = dev_info.pci_dev->driver->name;
+#else
+             dev_info.driver_name = dev_info.pci_dev->driver->driver.name;
+#endif
            ASSERT (dev_info.driver_name);
            if (strncmp (dev_info.driver_name, "rte_bond_pmd", 12) == 0)
              {
@@ -1699,10 +1708,15 @@ dpdk_init (vlib_main_t * vm)
   vlib_thread_main_t *tm = vlib_get_thread_main ();
 
   /* verify that structs are cacheline aligned */
-  ASSERT (offsetof (dpdk_device_t, cacheline0) == 0);
-  ASSERT (offsetof (dpdk_device_t, cacheline1) == CLIB_CACHE_LINE_BYTES);
-  ASSERT (offsetof (dpdk_worker_t, cacheline0) == 0);
-  ASSERT (offsetof (frame_queue_trace_t, cacheline0) == 0);
+  STATIC_ASSERT (offsetof (dpdk_device_t, cacheline0) == 0,
+                "Cache line marker must be 1st element in dpdk_device_t");
+  STATIC_ASSERT (offsetof (dpdk_device_t, cacheline1) ==
+                CLIB_CACHE_LINE_BYTES,
+                "Data in cache line 0 is bigger than cache line size");
+  STATIC_ASSERT (offsetof (dpdk_worker_t, cacheline0) == 0,
+                "Cache line marker must be 1st element in dpdk_worker_t");
+  STATIC_ASSERT (offsetof (frame_queue_trace_t, cacheline0) == 0,
+                "Cache line marker must be 1st element in frame_queue_trace_t");
 
   dm->vlib_main = vm;
   dm->vnet_main = vnet_get_main ();