net/mlx5: fix the error in VLAN actions creation
PATCH 7/7 net/mlx5: fix the error in VLAN actions creation
When a failure occurs during the VLAN actions creating, the value of "rte_errno" is already set by the mlx5dr_action_create*. The value can be returned directly to reflect the actual reason.
In the meanwhile, the "rte_flow_error" structure should also be set with explict message.
--- drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -5
@@ -7125,27 +7125,28 @@ flow_hw_create_vlan(struct rte_eth_dev *dev)MLX5DR_ACTION_FLAG_HWS_FDB }; +/* rte_errno is set in the mlx5dr_action* functions. */ for (i =MLX5DR_TABLE_TYPE_NIC_RX ; i <=MLX5DR_TABLE_TYPE_NIC_TX ; i++) { priv->hw_pop_vlan[i] =mlx5dr_action_create_pop_vlan (priv->dr_ctx, flags[i]);if (!priv->hw_pop_vlan[i]) -return -ENOENT ; +return -rte_errno; priv->hw_push_vlan[i] =mlx5dr_action_create_push_vlan (priv->dr_ctx, flags[i]);if (!priv->hw_pop_vlan[i]) -return -ENOENT ; +return -rte_errno; }if (priv->sh->config.dv_esw_en && priv->master) { priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ] =mlx5dr_action_create_pop_vlan (priv->dr_ctx,MLX5DR_ACTION_FLAG_HWS_FDB );if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ]) -return -ENOENT ; +return -rte_errno; priv->hw_push_vlan[MLX5DR_TABLE_TYPE_FDB ] =mlx5dr_action_create_push_vlan (priv->dr_ctx,MLX5DR_ACTION_FLAG_HWS_FDB );if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ]) -return -ENOENT ; +return -rte_errno; }return 0 ; }
@@ -7920,8 +7921,11 @@ flow_hw_configure(struct rte_eth_dev *dev, } } ret =flow_hw_create_vlan (dev); -if (ret) +if (ret) { +rte_flow_error_set (error, -ret,RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"Failed to VLAN actions." ); goto err; + }if (_queue_attr)mlx5_free (_queue_attr);if (port_attr->flags &RTE_FLOW_PORT_FLAG_STRICT_QUEUE )
Signature · 1 line
2.34.1
PATCH v2 1/1 net/mlx5: fix the error in VLAN actions creation
When a failure occurs during the VLAN actions creating, the value of "rte_errno" is already set by the mlx5dr_action_create*. The value can be returned directly to reflect the actual reason.
In the meanwhile, the "rte_flow_error" structure should also be set with explict message.
---
v2: add CC stable
--- drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -5
@@ -7125,27 +7125,28 @@ flow_hw_create_vlan(struct rte_eth_dev *dev)MLX5DR_ACTION_FLAG_HWS_FDB }; +/* rte_errno is set in the mlx5dr_action* functions. */ for (i =MLX5DR_TABLE_TYPE_NIC_RX ; i <=MLX5DR_TABLE_TYPE_NIC_TX ; i++) { priv->hw_pop_vlan[i] =mlx5dr_action_create_pop_vlan (priv->dr_ctx, flags[i]);if (!priv->hw_pop_vlan[i]) -return -ENOENT ; +return -rte_errno; priv->hw_push_vlan[i] =mlx5dr_action_create_push_vlan (priv->dr_ctx, flags[i]);if (!priv->hw_pop_vlan[i]) -return -ENOENT ; +return -rte_errno; }if (priv->sh->config.dv_esw_en && priv->master) { priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ] =mlx5dr_action_create_pop_vlan (priv->dr_ctx,MLX5DR_ACTION_FLAG_HWS_FDB );if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ]) -return -ENOENT ; +return -rte_errno; priv->hw_push_vlan[MLX5DR_TABLE_TYPE_FDB ] =mlx5dr_action_create_push_vlan (priv->dr_ctx,MLX5DR_ACTION_FLAG_HWS_FDB );if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ]) -return -ENOENT ; +return -rte_errno; }return 0 ; }
@@ -7920,8 +7921,11 @@ flow_hw_configure(struct rte_eth_dev *dev, } } ret =flow_hw_create_vlan (dev); -if (ret) +if (ret) { +rte_flow_error_set (error, -ret,RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"Failed to VLAN actions." ); goto err; + }if (_queue_attr)mlx5_free (_queue_attr);if (port_attr->flags &RTE_FLOW_PORT_FLAG_STRICT_QUEUE )
Signature · 1 line
2.34.1
PATCH v3 1/1 net/mlx5: fix the error in VLAN actions creation
When a failure occurs during the VLAN actions creating, the value of "rte_errno" is already set by the mlx5dr_action_create*. The value can be returned directly to reflect the actual reason.
In the meanwhile, the "rte_flow_error" structure should also be set with clear message explicitly.
---
v2: add CC stable
v3: fix typo
--- drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -5
@@ -7125,27 +7125,28 @@ flow_hw_create_vlan(struct rte_eth_dev *dev)MLX5DR_ACTION_FLAG_HWS_FDB }; +/* rte_errno is set in the mlx5dr_action* functions. */ for (i =MLX5DR_TABLE_TYPE_NIC_RX ; i <=MLX5DR_TABLE_TYPE_NIC_TX ; i++) { priv->hw_pop_vlan[i] =mlx5dr_action_create_pop_vlan (priv->dr_ctx, flags[i]);if (!priv->hw_pop_vlan[i]) -return -ENOENT ; +return -rte_errno; priv->hw_push_vlan[i] =mlx5dr_action_create_push_vlan (priv->dr_ctx, flags[i]);if (!priv->hw_pop_vlan[i]) -return -ENOENT ; +return -rte_errno; }if (priv->sh->config.dv_esw_en && priv->master) { priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ] =mlx5dr_action_create_pop_vlan (priv->dr_ctx,MLX5DR_ACTION_FLAG_HWS_FDB );if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ]) -return -ENOENT ; +return -rte_errno; priv->hw_push_vlan[MLX5DR_TABLE_TYPE_FDB ] =mlx5dr_action_create_push_vlan (priv->dr_ctx,MLX5DR_ACTION_FLAG_HWS_FDB );if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB ]) -return -ENOENT ; +return -rte_errno; }return 0 ; }
@@ -7920,8 +7921,11 @@ flow_hw_configure(struct rte_eth_dev *dev, } } ret =flow_hw_create_vlan (dev); -if (ret) +if (ret) { +rte_flow_error_set (error, -ret,RTE_FLOW_ERROR_TYPE_UNSPECIFIED , +NULL ,"Failed to VLAN actions." ); goto err; + }if (_queue_attr)mlx5_free (_queue_attr);if (port_attr->flags &RTE_FLOW_PORT_FLAG_STRICT_QUEUE )
Signature · 1 line
2.34.1
Hi,
Quoted 22 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Friday, June 30, 2023 2:02 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: [email protected]; Gregory Etelson <[email protected]>; [email protected]
Subject: [PATCH v3] net/mlx5: fix the error in VLAN actions creationWhen a failure occurs during the VLAN actions creating, the value of "
rte_errno" is already set by the mlx5dr_action_create*. The value can be returned directly to reflect the actual reason.In the meanwhile, the "
rte_flow_error" structure should also be set with clear message explicitly.Fixes 773ca0e91ba1 ("net/mlx5: support VLAN push/pop/modify withHWS")
Cc: [email protected]
Cc: [email protected]
Quoted 5 lines
Signed-off-by Bing Zhao <[email protected]>Acked-by Ori Kam <[email protected]>---
v2: add CC stable
v3: fix typo
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh