[PATCH] net/mlx5: fix flex item capability check

Dariusz Sosnowski
2026-03-23T10:21:38Z

Whenever installed BlueField FW was too old and it did not support
flex parser, mlx5 PMD reported an unrelated error
on flex item creation.
For example it reported that:

unsupported header length field mode (FIXED)

This was caused by lack of check for flex parser support.

This patch adds missing capability check and
adds proper error reporting.
Limitations of flex item described in PMD docs are also adjusted.

Fixes: 71adf25dbfb3 ("net/mlx5: fix flex item availability")
Cc: getelson@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
doc/guides/nics/mlx5.rst | 39 +++++++++++++++++++++++++++++++++---
drivers/net/mlx5/mlx5_flow.c | 6 ++++++
2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 9dcc93cc23..64d3c96332 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -3100,15 +3100,48 @@ See :ref:`mlx5_firmware_config` for more details about the flex parser profile.
Limitations
^^^^^^^^^^^

+#. Minimum FW version ``XX.31.1002``.
+
#. Flex item is supported on PF only.

#. The header length mask width can go up to 6 bits.

-#. The Firmware supports 8 global sample fields.
+#. Following number of global sample fields is available based on FW version.
Each flex item allocates non-shared sample fields from that pool.

-#. The flex item can have 1 input link - ``eth`` or ``udp``
- and up to 3 output links - ``ipv4`` or ``ipv6``.
+ +---------------+------------+
+ | Sample fields | FW version |
+ +===============+============+
+ | 3 | XX.31.1002 |
+ +---------------+------------+
+ | 8 | XX.33.1048 |
+ +---------------+------------+
+
+#. The flex item can have 1 input link and up to 3 output links.
+
+#. Following types of input links are supported:
+
+ +------+------------+
+ | Type | FW version |
+ +======+============+
+ | ETH | XX.31.1002 |
+ +------+------------+
+ | UDP | XX.31.1002 |
+ +------+------------+
+
+#. Following types of output links are supported:
+
+ +------+------------+
+ | Type | FW version |
+ +======+============+
+ | IPV4 | XX.31.1002 |
+ +------+------------+
+ | IPV6 | XX.31.1002 |
+ +------+------------+
+ | TCP | XX.36.1010 |
+ +------+------------+
+ | UDP | XX.36.1010 |
+ +------+------------+

#. In flex item configuration, ``next_header.field_base`` value
must be byte aligned (multiple of 8).
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 7df64d634d..915ea29a5a 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -11904,6 +11904,12 @@ mlx5_flow_flex_item_create(struct rte_eth_dev *dev,
"flex item available on BlueField ports only");
return NULL;
}
+ if (!priv->sh->cdev->config.hca_attr.parse_graph_flex_node) {
+ rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+ "flex item not supported on current FW");
+ 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.47.3