lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181206113230.70b788d7@cakuba.netronome.com>
Date:   Thu, 6 Dec 2018 11:32:39 -0800
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Igor Russkikh <Igor.Russkikh@...antia.com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Dmitry Bogdanov <Dmitry.Bogdanov@...antia.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 4/4] net: aquantia: add support of RSS
 configuration

On Thu, 6 Dec 2018 15:02:52 +0000, Igor Russkikh wrote:
> From: Dmitry Bogdanov <dmitry.bogdanov@...antia.com>
> 
> Add support of configuration of RSS hash key and RSS indirection table.
> 
> Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@...antia.com>
> Signed-off-by: Igor Russkikh <igor.russkikh@...antia.com>
> ---
>  .../ethernet/aquantia/atlantic/aq_ethtool.c   | 42 +++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
> index a5fd71692c8b..2f2e12c2b632 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
> @@ -202,6 +202,47 @@ static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key,
>  	return 0;
>  }
>  
> +static int aq_ethtool_set_rss(struct net_device *netdev, const u32 *indir,
> +			      const u8 *key, const u8 hfunc)
> +{
> +	struct aq_nic_s *aq_nic = netdev_priv(netdev);
> +	struct aq_nic_cfg_s *cfg;
> +	unsigned int i = 0U;
> +	u32 rss_entries;
> +	int err = 0;
> +
> +	cfg = aq_nic_get_cfg(aq_nic);
> +	rss_entries = cfg->aq_rss.indirection_table_size;
> +
> +	/* We do not allow change in unsupported parameters */
> +	if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
> +		return -EOPNOTSUPP;
> +	/* Fill out the redirection table */
> +	if (indir) {
> +		/* Verify user input. */
> +		for (i = 0; i < rss_entries; i++)
> +			if (indir[i] >= cfg->num_rss_queues)
> +				return -EINVAL;

nit: you shouldn't have to do this, see ethtool_copy_validate_indir().

> +		for (i = 0; i < rss_entries; i++)
> +			cfg->aq_rss.indirection_table[i] = indir[i];
> +	}
> +
> +	/* Fill out the rss hash key */
> +	if (key) {
> +		memcpy(cfg->aq_rss.hash_secret_key, key,
> +		       sizeof(cfg->aq_rss.hash_secret_key));
> +		err = aq_nic->aq_hw_ops->hw_rss_hash_set(aq_nic->aq_hw,
> +			&cfg->aq_rss);
> +		if (err)
> +			return err;
> +	}
> +
> +	err = aq_nic->aq_hw_ops->hw_rss_set(aq_nic->aq_hw, &cfg->aq_rss);
> +
> +	return err;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ