diff mbox series

[V1,1/1] net/mlx5: support item type error message in flow Verbs

Message ID 20200928065546.26742-1-lizh@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers show
Series [V1,1/1] net/mlx5: support item type error message in flow Verbs | expand

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Li Zhang Sept. 28, 2020, 6:55 a.m. UTC
Update the flow verbs error message to "item type X not supported",
when it is not supported,
instead of a generic error message "item not supported".

Signed-off-by: Li Zhang <lizh@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Slava Ovsiienko Oct. 26, 2020, 2:10 p.m. UTC | #1
> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Monday, September 28, 2020 9:56
> To: Dekel Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>;
> Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH V1 1/1] net/mlx5: support item type error message in flow
> Verbs
> 
> Update the flow verbs error message to "item type X not supported", when it
> is not supported, instead of a generic error message "item not supported".
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Raslan Darawsheh Oct. 27, 2020, 12:08 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: Li Zhang <lizh@nvidia.com>
> Sent: Monday, September 28, 2020 9:56 AM
> To: Dekel Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>
> Cc: dev@dpdk.org; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Raslan Darawsheh <rasland@nvidia.com>
> Subject: [PATCH V1 1/1] net/mlx5: support item type error message in flow
> Verbs
> 
> Update the flow verbs error message to "item type X not supported",
> when it is not supported,
> instead of a generic error message "item not supported".
> 
> Signed-off-by: Li Zhang <lizh@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 62c18b834f..0e0042f17b 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -1258,6 +1258,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
>  	uint64_t last_item = 0;
>  	uint8_t next_protocol = 0xff;
>  	uint16_t ether_type = 0;
> +	char errstr[32];
> 
>  	if (items == NULL)
>  		return -1;
> @@ -1408,9 +1409,11 @@ flow_verbs_validate(struct rte_eth_dev *dev,
>  			last_item = MLX5_FLOW_LAYER_MPLS;
>  			break;
>  		default:
> +			snprintf(errstr, sizeof(errstr), "item type %d not
> supported",
> +				 items->type);
>  			return rte_flow_error_set(error, ENOTSUP,
> 
> RTE_FLOW_ERROR_TYPE_ITEM,
> -						  NULL, "item not
> supported");
> +						  NULL, errstr);
>  		}
>  		item_flags |= last_item;
>  	}
> @@ -1704,6 +1707,7 @@ flow_verbs_translate(struct rte_eth_dev *dev,
>  	struct mlx5_flow_rss_desc *rss_desc = &((struct
> mlx5_flow_rss_desc *)
>  					      priv->rss_desc)
>  					      [!!priv->flow_nested_idx];
> +	char errstr[32];
> 
>  	if (priority == MLX5_FLOW_PRIO_RSVD)
>  		priority = priv->config.flow_prio - 1;
> @@ -1849,10 +1853,11 @@ flow_verbs_translate(struct rte_eth_dev *dev,
>  			item_flags |= MLX5_FLOW_LAYER_MPLS;
>  			break;
>  		default:
> +			snprintf(errstr, sizeof(errstr), "item type %d not
> supported",
> +				 items->type);
>  			return rte_flow_error_set(error, ENOTSUP,
> 
> RTE_FLOW_ERROR_TYPE_ITEM,
> -						  NULL,
> -						  "item not supported");
> +						  NULL, errstr);
>  		}
>  	}
>  	dev_flow->handle->layers = item_flags;
> --
> 2.21.0


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 62c18b834f..0e0042f17b 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1258,6 +1258,7 @@  flow_verbs_validate(struct rte_eth_dev *dev,
 	uint64_t last_item = 0;
 	uint8_t next_protocol = 0xff;
 	uint16_t ether_type = 0;
+	char errstr[32];
 
 	if (items == NULL)
 		return -1;
@@ -1408,9 +1409,11 @@  flow_verbs_validate(struct rte_eth_dev *dev,
 			last_item = MLX5_FLOW_LAYER_MPLS;
 			break;
 		default:
+			snprintf(errstr, sizeof(errstr), "item type %d not supported",
+				 items->type);
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ITEM,
-						  NULL, "item not supported");
+						  NULL, errstr);
 		}
 		item_flags |= last_item;
 	}
@@ -1704,6 +1707,7 @@  flow_verbs_translate(struct rte_eth_dev *dev,
 	struct mlx5_flow_rss_desc *rss_desc = &((struct mlx5_flow_rss_desc *)
 					      priv->rss_desc)
 					      [!!priv->flow_nested_idx];
+	char errstr[32];
 
 	if (priority == MLX5_FLOW_PRIO_RSVD)
 		priority = priv->config.flow_prio - 1;
@@ -1849,10 +1853,11 @@  flow_verbs_translate(struct rte_eth_dev *dev,
 			item_flags |= MLX5_FLOW_LAYER_MPLS;
 			break;
 		default:
+			snprintf(errstr, sizeof(errstr), "item type %d not supported",
+				 items->type);
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ITEM,
-						  NULL,
-						  "item not supported");
+						  NULL, errstr);
 		}
 	}
 	dev_flow->handle->layers = item_flags;