DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: Slava Ovsiienko <viacheslavo@mellanox.com>,
	Yongseok Koh <yskoh@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3 5/6] net/mlx5: flow counters query function move and rename
Date: Sun, 21 Oct 2018 09:20:52 +0000	[thread overview]
Message-ID: <DB7PR05MB4426751F0105EC3CD631A806C3FB0@DB7PR05MB4426.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1539962470-10950-6-git-send-email-viacheslavo@mellanox.com>

Friday, October 19, 2018 6:21 PM, Slava Ovsiienko:
> Subject: [PATCH v3 5/6] net/mlx5: flow counters query function move and
> rename

How about: "net/mlx5: relocate flow counter query function" 

This patch should come before the glue library update

> 
> The flow_verbs_query_count() is moved into the the group of counter
> managing functions and renamed to flow_verbs_counter_query() in order to
> be in unified fashion with others.

The tcf engine has the same naming. However since you add new ones on the next commit it is OK. 
Will think if we want to rename tcf one later. 

> 
> Also minor function modification is made to avoid unreachable code warnings
> if there is no counter support at compile time.
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 111 +++++++++++++++++++----------
> --------
>  1 file changed, 56 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 3d6fedb..f720c35 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -110,6 +110,61 @@
>  }
> 
>  /**
> + * Query a flow counter via Verbs library call.
> + *
> + * @see rte_flow_query()
> + * @see rte_flow_ops
> + */
> +static int
> +flow_verbs_counter_query(struct rte_eth_dev *dev __rte_unused,
> +			 struct rte_flow *flow __rte_unused,
> +			 void *data __rte_unused,
> +			 struct rte_flow_error *error)
> +{
> +#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
> +	if (flow->actions & MLX5_FLOW_ACTION_COUNT) {
> +		struct rte_flow_query_count *qc = data;
> +		uint64_t counters[2] = {0, 0};
> +		struct ibv_query_counter_set_attr query_cs_attr = {
> +			.cs = flow->counter->cs,
> +			.query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
> +		};
> +		struct ibv_counter_set_data query_out = {
> +			.out = counters,
> +			.outlen = 2 * sizeof(uint64_t),
> +		};
> +		int err = mlx5_glue->query_counter_set(&query_cs_attr,
> +						       &query_out);
> +
> +		if (err)
> +			return rte_flow_error_set
> +				(error, err,
> +				 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +				 NULL,
> +				 "cannot read counter");
> +		qc->hits_set = 1;
> +		qc->bytes_set = 1;
> +		qc->hits = counters[0] - flow->counter->hits;
> +		qc->bytes = counters[1] - flow->counter->bytes;
> +		if (qc->reset) {
> +			flow->counter->hits = counters[0];
> +			flow->counter->bytes = counters[1];
> +		}
> +		return 0;
> +	}
> +	return rte_flow_error_set(error, EINVAL,
> +				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +				  NULL,
> +				  "flow does not have counter");
> +#else
> +	return rte_flow_error_set(error, ENOTSUP,
> +				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> +				  NULL,
> +				  "counters are not available");
> +#endif
> +}
> +
> +/**
>   * Add a verbs item specification into @p flow.
>   *
>   * @param[in, out] flow
> @@ -1654,60 +1709,6 @@
>  }
> 
>  /**
> - * Query a flows.
> - *
> - * @see rte_flow_query()
> - * @see rte_flow_ops
> - */
> -static int
> -flow_verbs_query_count(struct rte_eth_dev *dev __rte_unused,
> -		       struct rte_flow *flow __rte_unused,
> -		       void *data __rte_unused,
> -		       struct rte_flow_error *error)
> -{
> -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
> -	if (flow->actions & MLX5_FLOW_ACTION_COUNT) {
> -		struct rte_flow_query_count *qc = data;
> -		uint64_t counters[2] = {0, 0};
> -		struct ibv_query_counter_set_attr query_cs_attr = {
> -			.cs = flow->counter->cs,
> -			.query_flags = IBV_COUNTER_SET_FORCE_UPDATE,
> -		};
> -		struct ibv_counter_set_data query_out = {
> -			.out = counters,
> -			.outlen = 2 * sizeof(uint64_t),
> -		};
> -		int err = mlx5_glue->query_counter_set(&query_cs_attr,
> -						       &query_out);
> -
> -		if (err)
> -			return rte_flow_error_set
> -				(error, err,
> -				 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -				 NULL,
> -				 "cannot read counter");
> -		qc->hits_set = 1;
> -		qc->bytes_set = 1;
> -		qc->hits = counters[0] - flow->counter->hits;
> -		qc->bytes = counters[1] - flow->counter->bytes;
> -		if (qc->reset) {
> -			flow->counter->hits = counters[0];
> -			flow->counter->bytes = counters[1];
> -		}
> -		return 0;
> -	}
> -	return rte_flow_error_set(error, EINVAL,
> -				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -				  NULL,
> -				  "flow does not have counter");
> -#endif
> -	return rte_flow_error_set(error, ENOTSUP,
> -				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> -				  NULL,
> -				  "counters are not available");
> -}
> -
> -/**
>   * Query a flow.
>   *
>   * @see rte_flow_query()
> @@ -1727,7 +1728,7 @@
>  		case RTE_FLOW_ACTION_TYPE_VOID:
>  			break;
>  		case RTE_FLOW_ACTION_TYPE_COUNT:
> -			ret = flow_verbs_query_count(dev, flow, data,
> error);
> +			ret = flow_verbs_counter_query(dev, flow, data,
> error);
>  			break;
>  		default:
>  			return rte_flow_error_set(error, ENOTSUP,
> --
> 1.8.3.1

  reply	other threads:[~2018-10-21  9:20 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 13:34 [dpdk-dev] [RFC] mlx5: flow counters support on the linux-rdma v19 base viacheslavo
2018-09-27 23:40 ` Yongseok Koh
2018-10-03 15:29 ` [dpdk-dev] [PATCH] net/mlx5: flow counters support on the Linux-rdma " Slava Ovsiienko
2018-10-03 23:48   ` Yongseok Koh
2018-10-09 13:45     ` Shahaf Shuler
2018-10-11 14:51     ` Slava Ovsiienko
2018-10-14  5:32       ` Shahaf Shuler
2018-10-17 13:53   ` [dpdk-dev] [PATCH v2] " Viacheslav Ovsiienko
2018-10-18  6:34     ` Shahaf Shuler
2018-10-19 15:21     ` [dpdk-dev] [PATCH v3 0/6] net/mlx5: flow counters support for Linux-rdma v19 Viacheslav Ovsiienko
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 1/6] net/mlx5: flow counters object create function bugfix Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 2/6] net/mlx5: flow counters new configuration flags Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 3/6] net/mlx5: flow counters simplifying runtime support check Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 4/6] net/mlx5: flow counters mlx5 glue library update Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 5/6] net/mlx5: flow counters query function move and rename Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler [this message]
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 6/6] net/mlx5: flow counters Verbs interface functions update Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-21  9:21       ` [dpdk-dev] [PATCH v3 0/6] net/mlx5: flow counters support for Linux-rdma v19 Shahaf Shuler
2018-10-23 10:04       ` [dpdk-dev] " Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 1/8] net/mlx5: fix flow counters creation Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 2/8] net/mlx5: rename flow counter configuration macro Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 3/8] net/mlx5: introduce new flow counters " Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 4/8] net/mlx5: simplify flow counters support check Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 5/8] net/mlx5: relocate flow counters query function Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 6/8] net/mlx5: add new flow counter Verbs API to glue library Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 7/8] net/mlx5: remove unnecessary structure initializers Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 8/8] net/mlx5: support new flow counter API Slava Ovsiienko
2018-10-24 16:31           ` Ferruh Yigit
2018-10-24 16:35             ` Ferruh Yigit
2018-10-24 17:25               ` Shahaf Shuler
2018-10-25  8:59                 ` Ferruh Yigit
2018-10-27 10:54           ` [dpdk-dev] [PATCH] net/mlx5: fix flow counters deletion in Verbs Slava Ovsiienko
2018-10-28 12:53             ` Shahaf Shuler
     [not found]       ` <1540289541-30019-1-git-send-email-viacheslavo@mellanox.com>
2018-10-24 11:02         ` [dpdk-dev] [PATCH v4 0/8] net/mlx5: flow counters support for Linux-rdma v19 Shahaf Shuler

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=DB7PR05MB4426751F0105EC3CD631A806C3FB0@DB7PR05MB4426.eurprd05.prod.outlook.com \
    --to=shahafs@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=viacheslavo@mellanox.com \
    --cc=yskoh@mellanox.com \
    /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).