summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
diff options
context:
space:
mode:
authorXinyao Cai <xinyao.cai@intel.com>2023-04-12 18:35:23 +0800
committerDamjan Marion <dmarion@0xa5.net>2023-04-25 15:13:22 +0000
commitefad24a84d35458e2c672b94027e54923a42fd25 (patch)
treee3ebb21f1c3274d81e5d1b9fbcf874f0685a5dbc /src/plugins/dpdk/device
parent140ca0fa95b4b8c037dfa83e99fd08620e93c646 (diff)
dpdk: code preparation for bumping to DPDK 22.11
This patch prepares code for bumping DPDK version to 22.11, but the DPDK version of this patch keeps at 22.07 for compatibility. the "no-dsa" parameter in DPDK configuration is removed, the "blacklist" parameter can be used to block the related DSA devices. Type: feature Signed-off-by: Xinyao Cai <xinyao.cai@intel.com> Change-Id: I08787c6584bba66383fc0a784963f33171196910
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r--src/plugins/dpdk/device/common.c13
-rw-r--r--src/plugins/dpdk/device/dpdk.h9
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h1
-rw-r--r--src/plugins/dpdk/device/format.c17
-rw-r--r--src/plugins/dpdk/device/init.c18
5 files changed, 41 insertions, 17 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index b8c6eddd34b..e4a79e88286 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -134,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;
@@ -487,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;
@@ -500,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;
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index 7238ecf5515..3f02f20237f 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -28,6 +28,15 @@
#include <rte_ethdev.h>
#include <rte_version.h>
#include <rte_net.h>
+#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0)
+#include <rte_bus.h>
+#include <rte_pci.h>
+#include <ctype.h>
+
+#include <bus_driver.h>
+#include <bus_pci_driver.h>
+#include <bus_vmbus_driver.h>
+#endif
#include <vnet/devices/devices.h>
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index 013ab41637e..d1a44fd28a1 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -36,6 +36,7 @@ _(proc-type) \
_(file-prefix) \
_(vdev) \
_(log-level) \
+_(block) \
_(iova-mode) \
_(base-virtaddr)
/* clang-format on */
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index ab14231d5f7..d3234d16f00 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -384,6 +384,16 @@ format_dpdk_rte_device (u8 *s, va_list *args)
if (!d)
return format (s, "not available");
+#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0)
+ s =
+ format (s, "name: %s, numa: %d", rte_dev_name (d), rte_dev_numa_node (d));
+
+ if (rte_dev_driver (d))
+ s = format (s, ", driver: %s", rte_driver_name (rte_dev_driver (d)));
+
+ if (rte_dev_bus (d))
+ s = format (s, ", bus: %s", rte_bus_name (rte_dev_bus (d)));
+#else
s = format (s, "name: %s, numa: %d", d->name, d->numa_node);
if (d->driver)
@@ -391,6 +401,7 @@ format_dpdk_rte_device (u8 *s, va_list *args)
if (d->bus)
s = format (s, ", bus: %s", d->bus->name);
+#endif
return s;
}
@@ -421,9 +432,15 @@ format_dpdk_device (u8 * s, va_list * args)
format_white_space, indent + 2, format_dpdk_link_status, xd);
s = format (s, "%Uflags: %U\n",
format_white_space, indent + 2, format_dpdk_device_flags, xd);
+#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0)
+ if (rte_dev_devargs (di.device) && rte_dev_devargs (di.device)->args)
+ s = format (s, "%UDevargs: %s\n", format_white_space, indent + 2,
+ rte_dev_devargs (di.device)->args);
+#else
if (di.device->devargs && di.device->devargs->args)
s = format (s, "%UDevargs: %s\n",
format_white_space, indent + 2, di.device->devargs->args);
+#endif
s = format (s,
"%Urx: queues %d (max %d), desc %d "
"(min %d max %d align %d)\n",
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 847affea243..3eb1da55919 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -205,8 +205,12 @@ dpdk_find_startup_config (struct rte_eth_dev_info *di)
if ((vmbus_dev = dpdk_get_vmbus_device (di)))
{
unformat_input_t input_vmbus;
- unformat_init_string (&input_vmbus, di->device->name,
- strlen (di->device->name));
+#if RTE_VERSION >= RTE_VERSION_NUM(22, 11, 0, 0)
+ const char *dev_name = rte_dev_name (di->device);
+#else
+ const char *dev_name = di->device->name;
+#endif
+ unformat_init_string (&input_vmbus, dev_name, strlen (dev_name));
if (unformat (&input_vmbus, "%U", unformat_vlib_vmbus_addr, &vmbus_addr))
p = mhash_get (&dm->conf->device_config_index_by_vmbus_addr,
&vmbus_addr);
@@ -997,7 +1001,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
int eal_no_hugetlb = 0;
u8 no_pci = 0;
u8 no_vmbus = 0;
- u8 no_dsa = 0;
u8 file_prefix = 0;
u8 *socket_mem = 0;
u8 *huge_dir_path = 0;
@@ -1108,8 +1111,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
tmp = format (0, "--no-pci%c", 0);
vec_add1 (conf->eal_init_args, tmp);
}
- else if (unformat (input, "no-dsa"))
- no_dsa = 1;
else if (unformat (input, "blacklist %U", unformat_vlib_vmbus_addr,
&vmbus_addr))
{
@@ -1319,13 +1320,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
vm = vlib_get_main ();
- if (no_dsa)
- {
- struct rte_bus *bus;
- bus = rte_bus_find_by_name ("dsa");
- if (bus)
- rte_bus_unregister (bus);
- }
/* make copy of args as rte_eal_init tends to mess up with arg array */
for (i = 1; i < vec_len (conf->eal_init_args); i++)
conf->eal_init_args_str = format (conf->eal_init_args_str, "%s ",