[v3,6/7] net/mlx5: add eCPRI flex parser capacity check

Message ID 1594909426-64843-7-git-send-email-bingz@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series add eCPRI support in mlx5 driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bing Zhao July 16, 2020, 2:23 p.m. UTC
  If the NIC or the FW does not support the dynamic flex parser,
it will return error when trying to create the parser for eCRPI.
Then it is hard to know the detail error reason of the failure.
Before creating the parser node and the following usage of the
parser, the capacity bit saved in the HCA_CAP could be used to
confirm if the dynamic flex parser is supported.
If no, an error will be returned directly with ENOTSUP to prevent
the following steps to be executed.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
---
v3: fix the wrong member name in the private structure.
---
 drivers/net/mlx5/mlx5.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Slava Ovsiienko July 16, 2020, 3:05 p.m. UTC | #1
> -----Original Message-----
> From: Bing Zhao <bingz@mellanox.com>
> Sent: Thursday, July 16, 2020 17:24
> To: Ori Kam <orika@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>
> Cc: Raslan Darawsheh <rasland@mellanox.com>; Matan Azrad
> <matan@mellanox.com>; dev@dpdk.org; Netanel Gonen
> <netanelg@mellanox.com>
> Subject: [PATCH v3 6/7] net/mlx5: add eCPRI flex parser capacity check
> 
> If the NIC or the FW does not support the dynamic flex parser, it will return
> error when trying to create the parser for eCRPI.
> Then it is hard to know the detail error reason of the failure.
> Before creating the parser node and the following usage of the parser, the
> capacity bit saved in the HCA_CAP could be used to confirm if the dynamic
> flex parser is supported.
> If no, an error will be returned directly with ENOTSUP to prevent the
> following steps to be executed.
> 
> Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index aec0173..137bb5c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -636,6 +636,11 @@  mlx5_flex_parser_ecpri_alloc(struct rte_eth_dev *dev)
 	uint32_t ids[8];
 	int ret;
 
+	if (!priv->config.hca_attr.parse_graph_flex_node) {
+		DRV_LOG(ERR, "Dynamic flex parser is not supported "
+			"for device %s.", priv->dev_data->name);
+		return -ENOTSUP;
+	}
 	node.header_length_mode = MLX5_GRAPH_NODE_LEN_FIXED;
 	/* 8 bytes now: 4B common header + 4B message body header. */
 	node.header_length_base_value = 0x8;