dpdk: code preparation for bumping to DPDK 22.11
[vpp.git] / src / plugins / dpdk / device / common.c
index f543723..e4a79e8 100644 (file)
@@ -58,7 +58,6 @@ dpdk_device_setup (dpdk_device_t * xd)
 {
   vlib_main_t *vm = vlib_get_main ();
   vnet_main_t *vnm = vnet_get_main ();
-  vlib_thread_main_t *tm = vlib_get_thread_main ();
   vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, xd->sw_if_index);
   vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, xd->hw_if_index);
   u16 buf_sz = vlib_buffer_get_default_data_size (vm);
@@ -66,7 +65,7 @@ dpdk_device_setup (dpdk_device_t * xd)
   struct rte_eth_dev_info dev_info;
   struct rte_eth_conf conf = {};
   u64 rxo, txo;
-  u16 max_frame_size;
+  u32 max_frame_size;
   int rv;
   int j;
 
@@ -135,11 +134,6 @@ dpdk_device_setup (dpdk_device_t * xd)
   dpdk_log_debug ("[%u] Configured TX offloads: %U", xd->port_id,
                  format_dpdk_tx_offload_caps, txo);
 
-  /* Enable flow director when flows exist */
-  if (xd->supported_flow_actions &&
-      (xd->flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) != 0)
-    conf.fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
-
   /* finalize configuration */
   conf.rxmode.offloads = rxo;
   conf.txmode.offloads = txo;
@@ -222,8 +216,7 @@ retry:
       if (rv < 0)
        dpdk_device_error (xd, "rte_eth_tx_queue_setup", rv);
 
-      if (xd->conf.n_tx_queues < tm->n_vlib_mains)
-       clib_spinlock_init (&vec_elt (xd->tx_queues, j).lock);
+      clib_spinlock_init (&vec_elt (xd->tx_queues, j).lock);
     }
 
   vec_validate_aligned (xd->rx_queues, xd->conf.n_rx_queues - 1,
@@ -489,7 +482,11 @@ dpdk_get_pci_device (const struct rte_eth_dev_info *info)
   const struct rte_bus *bus;
 
   bus = rte_bus_find_by_device (info->device);
+#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0)
+  if (bus && !strcmp (rte_bus_name (bus), "pci"))
+#else
   if (bus && !strcmp (bus->name, "pci"))
+#endif
     return RTE_DEV_TO_PCI (info->device);
   else
     return NULL;
@@ -502,7 +499,11 @@ dpdk_get_vmbus_device (const struct rte_eth_dev_info *info)
   const struct rte_bus *bus;
 
   bus = rte_bus_find_by_device (info->device);
+#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0)
+  if (bus && !strcmp (rte_bus_name (bus), "vmbus"))
+#else
   if (bus && !strcmp (bus->name, "vmbus"))
+#endif
     return container_of (info->device, struct rte_vmbus_device, device);
   else
     return NULL;