All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Xueming Li <xuemingl@mellanox.com>
Cc: Shahaf Shuler <shahafs@mellanox.com>,
	Nelio Laranjeiro <notifications@github.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	dev@dpdk.org
Subject: Re: [PATCH v4 1/2] ethdev: add supported hash function check
Date: Fri, 20 Apr 2018 10:10:26 +0200	[thread overview]
Message-ID: <20180420081026.GI4957@6wind.com> (raw)
In-Reply-To: <20180419154840.80006-1-xuemingl@mellanox.com>

On Thu, Apr 19, 2018 at 11:48:39PM +0800, Xueming Li wrote:
> Add supported RSS hash function check in device configuration to
> have better error verbosity for application developers.
> 
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>

In general, I do not like API/wrappers generating log messages on their own,
as those can't be caught and interpreted by applications. I believe error
codes should be explicit enough. However in this specific instance,
rte_eth_dev_configure() already does it a lot, so I guess it's fine:

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

One nit below.

> ---
>  lib/librte_ether/rte_ethdev.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 3c049ef43..4ac0fadae 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -1179,6 +1179,18 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
>  							ETHER_MAX_LEN;
>  	}
>  
> +	/* Check that device supports requested rss hash functions. */
> +	if ((dev_info.flow_type_rss_offloads |
> +	     dev_conf->rx_adv_conf.rss_conf.rss_hf) !=
> +	    dev_info.flow_type_rss_offloads) {
> +		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d invalid rss_hf: "
> +				    "0x%"PRIx64", valid value: 0x%"PRIx64"\n",
> +				    port_id,
> +				    dev_conf->rx_adv_conf.rss_conf.rss_hf,
> +				    dev_info.flow_type_rss_offloads);
> +		return -EINVAL;
> +	}
> +
>  	/*
>  	 * Setup new number of RX/TX queues and reconfigure device.
>  	 */
> @@ -2835,9 +2847,20 @@ rte_eth_dev_rss_hash_update(uint16_t port_id,
>  			    struct rte_eth_rss_conf *rss_conf)
>  {
>  	struct rte_eth_dev *dev;
> +	struct rte_eth_dev_info dev_info = {0};

A "{0}" initializer for structures is nonstandard and may trigger compiler
warnings. I encourage you to initialize one field C99-style instead:

 struct rte_eth_dev_info dev_info = { .device = NULL };

> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
> +	rte_eth_dev_info_get(port_id, &dev_info);
> +	if ((dev_info.flow_type_rss_offloads | rss_conf->rss_hf) !=
> +	    dev_info.flow_type_rss_offloads) {
> +		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d invalid rss_hf: "
> +				    "0x%"PRIx64", valid value: 0x%"PRIx64"\n",
> +				    port_id,
> +				    rss_conf->rss_hf,
> +				    dev_info.flow_type_rss_offloads);
> +		return -EINVAL;
> +	}
>  	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
>  	return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev,
>  								 rss_conf));
> -- 
> 2.13.3
> 

-- 
Adrien Mazarguil
6WIND

  reply	other threads:[~2018-04-20  8:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-18  7:37 [PATCH] net/mlx5: add supported hash function check Xueming Li
2018-03-19  8:29 ` Nélio Laranjeiro
2018-03-22 10:42   ` Xueming(Steven) Li
2018-03-26 11:39     ` Nélio Laranjeiro
2018-04-02 12:41       ` Xueming(Steven) Li
2018-04-04  7:35         ` Nélio Laranjeiro
2018-04-09 12:10 ` [PATCH v1 1/2] ethdev: " Xueming Li
2018-04-16 22:56   ` Thomas Monjalon
2018-04-17 14:24   ` [PATCH v2 " Xueming Li
2018-04-17 22:00     ` Thomas Monjalon
2018-04-18 11:55       ` Xueming(Steven) Li
2018-04-18 12:15         ` Thomas Monjalon
2018-04-17 14:24   ` [PATCH v2 2/2] app/testpmd: only config supported RSS hash types Xueming Li
2018-04-18  8:11   ` [PATCH v3 1/2] ethdev: add supported hash function check Xueming Li
2018-04-18  8:11   ` [PATCH v3 2/2] app/testpmd: only config supported RSS hash types Xueming Li
2018-04-18 11:06   ` [PATCH v3 1/2] ethdev: add supported hash function check Xueming Li
2018-04-18 11:06   ` [PATCH v3 2/2] app/testpmd: only config supported RSS hash types Xueming Li
2018-04-18 13:25     ` Adrien Mazarguil
2018-04-18 13:54       ` Xueming(Steven) Li
2018-04-18 14:16         ` Adrien Mazarguil
2018-04-18 14:26           ` Xueming(Steven) Li
2018-04-18 14:47             ` Adrien Mazarguil
2018-04-18 14:10       ` Xueming(Steven) Li
2018-04-18 14:30         ` Adrien Mazarguil
2018-04-19 15:50           ` Xueming(Steven) Li
2018-04-19 15:48   ` [PATCH v4 1/2] ethdev: add supported hash function check Xueming Li
2018-04-20  8:10     ` Adrien Mazarguil [this message]
2018-04-19 15:48   ` [PATCH v4 2/2] app/testpmd: new parameter for port config all rss command Xueming Li
2018-04-20  8:10     ` Adrien Mazarguil
2018-04-20 13:06   ` [PATCH v5 1/2] ethdev: introduce generic IP/UDP tunnel checksum and TSO Xueming Li
2018-04-20 13:48     ` Ferruh Yigit
2018-04-20 14:23       ` Ferruh Yigit
2018-04-20 14:23       ` Xueming(Steven) Li
2018-04-20 13:06   ` [PATCH v5 2/2] app/testpmd: testpmd support Tx generic tunnel offloads Xueming Li
2018-04-20 14:29     ` Xueming(Steven) Li
2018-04-20 14:30   ` [PATCH v5 1/2] ethdev: add supported hash function check Xueming Li
2018-04-20 14:35     ` Ferruh Yigit
2018-04-20 14:44       ` Xueming(Steven) Li
2018-04-23 15:20     ` Thomas Monjalon
2018-04-23 16:07       ` Ferruh Yigit
2018-04-23 16:06     ` Ferruh Yigit
2018-04-23 18:14       ` Thomas Monjalon
2018-05-01 11:04         ` Ferruh Yigit
2018-05-01 14:04           ` Thomas Monjalon
2018-04-20 14:30   ` [PATCH v5 2/2] app/testpmd: new parameter for port config all rss command Xueming Li
2018-04-09 12:10 ` [PATCH v1 2/2] app/testpmd: config all supported RSS functions Xueming Li
2018-04-16 22:53   ` Thomas Monjalon

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=20180420081026.GI4957@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=notifications@github.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    --cc=xuemingl@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.