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 3/6] net/mlx5: flow counters simplifying runtime support check
Date: Sun, 21 Oct 2018 09:20:46 +0000	[thread overview]
Message-ID: <DB7PR05MB4426C6C026C7568E2A27503DC3FB0@DB7PR05MB4426.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1539962470-10950-4-git-send-email-viacheslavo@mellanox.com>

Friday, October 19, 2018 6:21 PM, Slava Ovsiienko:
> Subject: [PATCH v3 3/6] net/mlx5: flow counters simplifying runtime support
> check

How about "net/mlx5: simplify flow counters support check

> 
> This part of patchset removes the redundant check of counters support in
> runtime. The flag flow_counter_en is eliminated from the code. The Verbs
> create counter function just returns an error if no counter support presented
> in kernel.
> 
> Some log messages regarding the counter support type and presence are
> added.
> 
> mlx5_flow_validate_action_count() is also updated due to flow_counter_en
> flag removal.

In continue to previous patch comments, this patch should only make the needed preparation for the new counters. 
The new counters macro along with implementation should be on a separate commit. 

> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5.c      | 15 ++++++++++-----
>  drivers/net/mlx5/mlx5.h      |  1 -
>  drivers/net/mlx5/mlx5_flow.c | 16 +++++++++-------
>  3 files changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> bb19085..8a33639 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1009,12 +1009,17 @@
>  	config.hw_csum = !!(attr.device_cap_flags_ex &
> IBV_DEVICE_RAW_IP_CSUM);
>  	DRV_LOG(DEBUG, "checksum offloading is %ssupported",
>  		(config.hw_csum ? "" : "not "));
> -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
> -	config.flow_counter_en = !!attr.max_counter_sets;
> +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42)
>  	mlx5_glue->describe_counter_set(ctx, 0, &cs_desc);
> -	DRV_LOG(DEBUG, "counter type = %d, num of cs = %ld, attributes =
> %d",
> -		cs_desc.counter_type, cs_desc.num_of_cs,
> -		cs_desc.attributes);
> +	DRV_LOG(DEBUG, "Flow counters are supported (4.2), "
> +		       "type = %d, num of cs = %ld, attr = %d",
> +		       cs_desc.counter_type,
> +		       cs_desc.num_of_cs,
> +		       cs_desc.attributes);

I would refine on saying the counters are supported (since you cannot be sure). 
I would recommend to have a message log only if the macro is not defined to say "flow counters are not supported". This is the only thing we know for sure. 

> +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45)
> +	DRV_LOG(DEBUG, "Flow counters are supported (4.5)"); #else
> +	DRV_LOG(DEBUG, "Flow counters are not supported");
>  #endif
>  	config.ind_table_max_size =
>  		attr.rss_caps.max_rwq_indirection_table_size;
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index
> d14239c..74d87c0 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -114,7 +114,6 @@ struct mlx5_dev_config {
>  	unsigned int tunnel_en:1;
>  	/* Whether tunnel stateless offloads are supported. */
>  	unsigned int mpls_en:1; /* MPLS over GRE/UDP is enabled. */
> -	unsigned int flow_counter_en:1; /* Whether flow counter is
> supported. */
>  	unsigned int cqe_comp:1; /* CQE compression is enabled. */
>  	unsigned int tso:1; /* Whether TSO is supported. */
>  	unsigned int tx_vec_en:1; /* Tx vector is enabled. */ diff --git
> a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index
> fcabab0..c15722d 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -921,22 +921,24 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
>   *   0 on success, a negative errno value otherwise and rte_ernno is set.
>   */
>  int
> -mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
> +mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused,
>  				const struct rte_flow_attr *attr,
>  				struct rte_flow_error *error)
>  {
> -	struct priv *priv = dev->data->dev_private;
> -
> -	if (!priv->config.flow_counter_en)
> -		return rte_flow_error_set(error, ENOTSUP,
> -					  RTE_FLOW_ERROR_TYPE_ACTION,
> NULL,
> -					  "flow counters are not supported.");
> +#if !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) && \
> +	!defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45)
> +	(void)attr;
> +	return rte_flow_error_set(error, ENOTSUP,
> +				  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
> +				  "flow counters are not supported."); #else

This ifdef addition is not needed. Just let It fall on the counter creation (like you commit log says). 

>  	if (attr->egress)
>  		return rte_flow_error_set(error, ENOTSUP,
> 
> RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL,
>  					  "count action not supported for "
>  					  "egress");
>  	return 0;
> +#endif
>  }
> 
>  /**
> --
> 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 [this message]
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
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 5/8] net/mlx5: relocate flow counters query function 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 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=DB7PR05MB4426C6C026C7568E2A27503DC3FB0@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).