* [PATCH 21.11] net/mlx5: fix flex item availability
@ 2022-04-03 16:08 Michael Baum
2022-04-04 15:51 ` Kevin Traynor
0 siblings, 1 reply; 2+ messages in thread
From: Michael Baum @ 2022-04-03 16:08 UTC (permalink / raw)
To: stable; +Cc: Matan Azrad, Viacheslav Ovsiienko, Gregory Etelson, Kevin Traynor
From: Gregory Etelson <getelson@nvidia.com>
[ upstream commit 71adf25dbfb3a60731bd922342cc0f171714db81 ]
Flex item availability is restricted to BlueField-2 and BlueField-3
PF ports.
The patch validates port type compliance before proceeding to
flex item creation.
Fixes: db25cadc0887 ("net/mlx5: add flex item operations")
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
It was checked on Windows, it is successfully compiled.
drivers/common/mlx5/linux/mlx5_common_os.h | 1 +
drivers/net/mlx5/mlx5_flow.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index edf356a30a..a6190a34e6 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -9,6 +9,7 @@
#include <malloc.h>
#include <rte_pci.h>
+#include <rte_bus_pci.h>
#include <rte_debug.h>
#include <rte_atomic.h>
#include <rte_log.h>
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index e603e39447..1ea6d030f3 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -18,6 +18,7 @@
#include <rte_flow_driver.h>
#include <rte_malloc.h>
#include <rte_ip.h>
+#include <rte_bus_pci.h>
#include <mlx5_glue.h>
#include <mlx5_devx_cmds.h>
@@ -9925,10 +9926,27 @@ mlx5_flow_flex_item_create(struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
static const char err_msg[] = "flex item creation unsupported";
+ struct mlx5_priv *priv = dev->data->dev_private;
struct rte_flow_attr attr = { .transfer = 0 };
const struct mlx5_flow_driver_ops *fops =
flow_get_drv_ops(flow_get_drv_type(dev, &attr));
+ if (!priv->pci_dev) {
+ rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+ "create flex item on PF only");
+ return NULL;
+ }
+ switch (priv->pci_dev->id.device_id) {
+ case PCI_DEVICE_ID_MELLANOX_CONNECTX6DXBF:
+ case PCI_DEVICE_ID_MELLANOX_CONNECTX7BF:
+ break;
+ default:
+ rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+ "flex item available on BlueField ports only");
+ return NULL;
+ }
if (!fops->item_create) {
DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 21.11] net/mlx5: fix flex item availability
2022-04-03 16:08 [PATCH 21.11] net/mlx5: fix flex item availability Michael Baum
@ 2022-04-04 15:51 ` Kevin Traynor
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Traynor @ 2022-04-04 15:51 UTC (permalink / raw)
To: Michael Baum, stable; +Cc: Matan Azrad, Viacheslav Ovsiienko, Gregory Etelson
On 03/04/2022 17:08, Michael Baum wrote:
> From: Gregory Etelson <getelson@nvidia.com>
>
> [ upstream commit 71adf25dbfb3a60731bd922342cc0f171714db81 ]
>
> Flex item availability is restricted to BlueField-2 and BlueField-3
> PF ports.
>
> The patch validates port type compliance before proceeding to
> flex item creation.
>
> Fixes: db25cadc0887 ("net/mlx5: add flex item operations")
>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>
> It was checked on Windows, it is successfully compiled.
>
Applied, thanks for checking the build. This is on dpdk.org now but it
missed RC1. No plans for an RC2 at present, so suggest if you are doing
some validation, to pull the branch or apply locally.
Kevin.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-04 15:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-03 16:08 [PATCH 21.11] net/mlx5: fix flex item availability Michael Baum
2022-04-04 15:51 ` Kevin Traynor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).