DPDK patches and discussions
 help / color / mirror / Atom feed
From: Slava Ovsiienko <viacheslavo@nvidia.com>
To: "wenxu@ucloud.cn" <wenxu@ucloud.cn>,
	Raslan Darawsheh <rasland@nvidia.com>,
	Thomas Monjalon <tmonjalon@nvidia.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH v2] net/mlx5: fix NULL err msg in mlx5_flow_tunnel_validate
Date: Wed, 17 Nov 2021 14:02:57 +0000	[thread overview]
Message-ID: <DM6PR12MB37536B6C0C0F0C6C0591C540DF9A9@DM6PR12MB3753.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1632285618-7830-1-git-send-email-wenxu@ucloud.cn>

Hi, Wenxu

I'm sorry, we unintentionally provided the very similar fix there:
http://patches.dpdk.org/project/dpdk/patch/20211103085556.25214-1-getelson@nvidia.com/

It’s my personal mistake - I did not recall about your patch while reviewing ours ☹
My sincere apologizes, I'm sorry indeed.

With best regards,
Slava

> -----Original Message-----
> From: wenxu@ucloud.cn <wenxu@ucloud.cn>
> Sent: Wednesday, September 22, 2021 7:40
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v2] net/mlx5: fix NULL err msg in mlx5_flow_tunnel_validate
> 
> From: wenxu <wenxu@ucloud.cn>
> 
> If the mlx5_flow_tunnel_validate validating the flow tunnel rule failed, the
> err_msg will be NULL in the rte_flow_error.
> 
> Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload")
> 
> Signed-off-by: wenxu <wenxu@ucloud.cn>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 43 ++++++++++++++++++++-----------------------
>  1 file changed, 20 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index e63a297..3c5aca0 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -9081,30 +9081,31 @@ int mlx5_alloc_tunnel_hub(struct
> mlx5_dev_ctx_shared *sh)
>  	return err;
>  }
> 
> -static inline bool
> +static inline int
>  mlx5_flow_tunnel_validate(struct rte_eth_dev *dev,
>  			  struct rte_flow_tunnel *tunnel,
> -			  const char *err_msg)
> +			  struct rte_flow_error *error)
>  {
> -	err_msg = NULL;
>  	if (!is_tunnel_offload_active(dev)) {
> -		err_msg = "tunnel offload was not activated";
> -		goto out;
> +		return rte_flow_error_set(error, EINVAL,
> +
> RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
> +					  "tunnel offload was not activated");
>  	} else if (!tunnel) {
> -		err_msg = "no application tunnel";
> -		goto out;
> +		return rte_flow_error_set(error, EINVAL,
> +
> RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
> +					  "no application tunnel");
>  	}
> 
>  	switch (tunnel->type) {
>  	default:
> -		err_msg = "unsupported tunnel type";
> -		goto out;
> +		return rte_flow_error_set(error, EINVAL,
> +
> RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
> +					  "unsupported tunnel type");
>  	case RTE_FLOW_ITEM_TYPE_VXLAN:
>  		break;
>  	}
> 
> -out:
> -	return !err_msg;
> +	return 0;
>  }
> 
>  static int
> @@ -9116,13 +9117,11 @@ int mlx5_alloc_tunnel_hub(struct
> mlx5_dev_ctx_shared *sh)  {
>  	int ret;
>  	struct mlx5_flow_tunnel *tunnel;
> -	const char *err_msg = NULL;
> -	bool verdict = mlx5_flow_tunnel_validate(dev, app_tunnel, err_msg);
> 
> -	if (!verdict)
> -		return rte_flow_error_set(error, EINVAL,
> -
> RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
> -					  err_msg);
> +	ret = mlx5_flow_tunnel_validate(dev, app_tunnel, error);
> +	if (ret < 0)
> +		return ret;
> +
>  	ret = mlx5_get_flow_tunnel(dev, app_tunnel, &tunnel);
>  	if (ret < 0) {
>  		return rte_flow_error_set(error, ret, @@ -9143,13 +9142,11
> @@ int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh)  {
>  	int ret;
>  	struct mlx5_flow_tunnel *tunnel;
> -	const char *err_msg = NULL;
> -	bool verdict = mlx5_flow_tunnel_validate(dev, app_tunnel, err_msg);
> 
> -	if (!verdict)
> -		return rte_flow_error_set(error, EINVAL,
> -					  RTE_FLOW_ERROR_TYPE_HANDLE,
> NULL,
> -					  err_msg);
> +	ret = mlx5_flow_tunnel_validate(dev, app_tunnel, error);
> +	if (ret < 0)
> +		return ret;
> +
>  	ret = mlx5_get_flow_tunnel(dev, app_tunnel, &tunnel);
>  	if (ret < 0) {
>  		return rte_flow_error_set(error, ret,
> --
> 1.8.3.1


      reply	other threads:[~2021-11-17 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22  4:40 [dpdk-dev] " wenxu
2021-11-17 14:02 ` Slava Ovsiienko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR12MB37536B6C0C0F0C6C0591C540DF9A9@DM6PR12MB3753.namprd12.prod.outlook.com \
    --to=viacheslavo@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=rasland@nvidia.com \
    --cc=tmonjalon@nvidia.com \
    --cc=wenxu@ucloud.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).