net/mlx5: fix flex item availability
PATCH 1/1 net/mlx5: fix flex item availability
Flex item availability is restricted to Blue Field 2 and Blue Field 3 PF ports.
The patch validates port type compliance before proceeding to flex item creation.
--- drivers/common/mlx5/linux/mlx5_common_os.h | 1 + drivers/net/mlx5/mlx5_flow.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
drivers/common/mlx5/linux/mlx5_common_os.h +1 -0
@@ -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>
drivers/net/mlx5/mlx5_flow.c +17 -0
@@ -10619,10 +10619,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 Blue Field 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,
Signature · 1 line
2.34.1
Hi,
Quoted 14 lines
-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Wednesday, March 2, 2022 1:07 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; [email protected]; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: fix flex item availabilityFlex item availability is restricted to Blue Field 2 and Blue Field 3 PF ports.
The patch validates port type compliance before proceeding to flex item creation.
Quoted 6 lines
Fixes db25cadc0887 ("net/mlx5: add flex item operations")Signed-off-by Gregory Etelson <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh