netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: aquantia: add RSS configuration
@ 2018-12-06 15:02 Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 1/4] net: aquantia: fix RSS table and key sizes Igor Russkikh
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Igor Russkikh @ 2018-12-06 15:02 UTC (permalink / raw)
  To: David S . Miller; +Cc: Dmitry Bogdanov, netdev@vger.kernel.org, Igor Russkikh

In this patchset few bugs related to RSS are fixed and RSS table and
hash key configuration is added.

We also do increase max number of HW rings upto 8.

Dmitry Bogdanov (4):
  net: aquantia: fix RSS table and key sizes
  net: aquantia: increase max number of hw queues
  net: aquantia: fix initialization of RSS table
  net: aquantia: add support of RSS configuration

 .../net/ethernet/aquantia/atlantic/aq_cfg.h   |  6 +--
 .../ethernet/aquantia/atlantic/aq_ethtool.c   | 42 +++++++++++++++++++
 .../net/ethernet/aquantia/atlantic/aq_nic.c   |  6 +--
 .../aquantia/atlantic/hw_atl/hw_atl_b0.c      |  2 +-
 4 files changed, 49 insertions(+), 7 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/4] net: aquantia: fix RSS table and key sizes
  2018-12-06 15:02 [PATCH net-next 0/4] net: aquantia: add RSS configuration Igor Russkikh
@ 2018-12-06 15:02 ` Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 2/4] net: aquantia: increase max number of hw queues Igor Russkikh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2018-12-06 15:02 UTC (permalink / raw)
  To: David S . Miller; +Cc: Dmitry Bogdanov, netdev@vger.kernel.org, Igor Russkikh

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

Set RSS indirection table and RSS hash key sizes to their real size.

Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_cfg.h | 4 ++--
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h b/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h
index 91eb8910b1c9..90a0e1d0d622 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h
@@ -42,8 +42,8 @@
 #define AQ_CFG_IS_LRO_DEF           1U
 
 /* RSS */
-#define AQ_CFG_RSS_INDIRECTION_TABLE_MAX  128U
-#define AQ_CFG_RSS_HASHKEY_SIZE           320U
+#define AQ_CFG_RSS_INDIRECTION_TABLE_MAX  64U
+#define AQ_CFG_RSS_HASHKEY_SIZE           40U
 
 #define AQ_CFG_IS_RSS_DEF           1U
 #define AQ_CFG_NUM_RSS_QUEUES_DEF   AQ_CFG_VECS_DEF
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 279ea58f4a9e..d617289d95f7 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -44,7 +44,7 @@ static void aq_nic_rss_init(struct aq_nic_s *self, unsigned int num_rss_queues)
 	struct aq_rss_parameters *rss_params = &cfg->aq_rss;
 	int i = 0;
 
-	static u8 rss_key[40] = {
+	static u8 rss_key[AQ_CFG_RSS_HASHKEY_SIZE] = {
 		0x1e, 0xad, 0x71, 0x87, 0x65, 0xfc, 0x26, 0x7d,
 		0x0d, 0x45, 0x67, 0x74, 0xcd, 0x06, 0x1a, 0x18,
 		0xb6, 0xc1, 0xf0, 0xc7, 0xbb, 0x18, 0xbe, 0xf8,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/4] net: aquantia: increase max number of hw queues
  2018-12-06 15:02 [PATCH net-next 0/4] net: aquantia: add RSS configuration Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 1/4] net: aquantia: fix RSS table and key sizes Igor Russkikh
@ 2018-12-06 15:02 ` Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 3/4] net: aquantia: fix initialization of RSS table Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 4/4] net: aquantia: add support of RSS configuration Igor Russkikh
  3 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2018-12-06 15:02 UTC (permalink / raw)
  To: David S . Miller; +Cc: Dmitry Bogdanov, netdev@vger.kernel.org, Igor Russkikh

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

Increase the upper limit of the hw queues up to 8.
This makes RSS better on multiheaded cpus.

This is a maximum AQC hardware supports in one traffic class.

The actual value is still limited by a number of available cpu cores.

Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_cfg.h           | 2 +-
 drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h b/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h
index 90a0e1d0d622..3944ce7f0870 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_cfg.h
@@ -12,7 +12,7 @@
 #ifndef AQ_CFG_H
 #define AQ_CFG_H
 
-#define AQ_CFG_VECS_DEF   4U
+#define AQ_CFG_VECS_DEF   8U
 #define AQ_CFG_TCS_DEF    1U
 
 #define AQ_CFG_TXDS_DEF    4096U
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 6af7d7f0cdca..08596a7a6486 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -21,7 +21,7 @@
 
 #define DEFAULT_B0_BOARD_BASIC_CAPABILITIES \
 	.is_64_dma = true,		  \
-	.msix_irqs = 4U,		  \
+	.msix_irqs = 8U,		  \
 	.irq_mask = ~0U,		  \
 	.vecs = HW_ATL_B0_RSS_MAX,	  \
 	.tcs = HW_ATL_B0_TC_MAX,	  \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 3/4] net: aquantia: fix initialization of RSS table
  2018-12-06 15:02 [PATCH net-next 0/4] net: aquantia: add RSS configuration Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 1/4] net: aquantia: fix RSS table and key sizes Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 2/4] net: aquantia: increase max number of hw queues Igor Russkikh
@ 2018-12-06 15:02 ` Igor Russkikh
  2018-12-06 15:02 ` [PATCH net-next 4/4] net: aquantia: add support of RSS configuration Igor Russkikh
  3 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2018-12-06 15:02 UTC (permalink / raw)
  To: David S . Miller; +Cc: Dmitry Bogdanov, netdev@vger.kernel.org, Igor Russkikh

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

Now RSS indirection table is initialized before setting up the number of
hw queues, consequently the table may be filled by non existing queues.
This patch moves the initialization when the number of hw queues is
known.

Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index d617289d95f7..0147c037ca96 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -84,8 +84,6 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
 
 	cfg->is_lro = AQ_CFG_IS_LRO_DEF;
 
-	aq_nic_rss_init(self, cfg->num_rss_queues);
-
 	/*descriptors */
 	cfg->rxds = min(cfg->aq_hw_caps->rxds_max, AQ_CFG_RXDS_DEF);
 	cfg->txds = min(cfg->aq_hw_caps->txds_max, AQ_CFG_TXDS_DEF);
@@ -106,6 +104,8 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
 
 	cfg->num_rss_queues = min(cfg->vecs, AQ_CFG_NUM_RSS_QUEUES_DEF);
 
+	aq_nic_rss_init(self, cfg->num_rss_queues);
+
 	cfg->irq_type = aq_pci_func_get_irq_type(self);
 
 	if ((cfg->irq_type == AQ_HW_IRQ_LEGACY) ||
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 4/4] net: aquantia: add support of RSS configuration
  2018-12-06 15:02 [PATCH net-next 0/4] net: aquantia: add RSS configuration Igor Russkikh
                   ` (2 preceding siblings ...)
  2018-12-06 15:02 ` [PATCH net-next 3/4] net: aquantia: fix initialization of RSS table Igor Russkikh
@ 2018-12-06 15:02 ` Igor Russkikh
  2018-12-06 19:32   ` Jakub Kicinski
  3 siblings, 1 reply; 7+ messages in thread
From: Igor Russkikh @ 2018-12-06 15:02 UTC (permalink / raw)
  To: David S . Miller; +Cc: Dmitry Bogdanov, netdev@vger.kernel.org, Igor Russkikh

From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>

Add support of configuration of RSS hash key and RSS indirection table.

Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.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;
+
+		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;
+}
+
 static int aq_ethtool_get_rxnfc(struct net_device *ndev,
 				struct ethtool_rxnfc *cmd,
 				u32 *rule_locs)
@@ -549,6 +590,7 @@ const struct ethtool_ops aq_ethtool_ops = {
 	.set_pauseparam      = aq_ethtool_set_pauseparam,
 	.get_rxfh_key_size   = aq_ethtool_get_rss_key_size,
 	.get_rxfh            = aq_ethtool_get_rss,
+	.set_rxfh            = aq_ethtool_set_rss,
 	.get_rxnfc           = aq_ethtool_get_rxnfc,
 	.set_rxnfc           = aq_ethtool_set_rxnfc,
 	.get_sset_count      = aq_ethtool_get_sset_count,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 4/4] net: aquantia: add support of RSS configuration
  2018-12-06 15:02 ` [PATCH net-next 4/4] net: aquantia: add support of RSS configuration Igor Russkikh
@ 2018-12-06 19:32   ` Jakub Kicinski
  2018-12-07 11:48     ` Igor Russkikh
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2018-12-06 19:32 UTC (permalink / raw)
  To: Igor Russkikh; +Cc: David S . Miller, Dmitry Bogdanov, netdev@vger.kernel.org

On Thu, 6 Dec 2018 15:02:52 +0000, Igor Russkikh wrote:
> From: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
> 
> Add support of configuration of RSS hash key and RSS indirection table.
> 
> Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.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;
> +}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 4/4] net: aquantia: add support of RSS configuration
  2018-12-06 19:32   ` Jakub Kicinski
@ 2018-12-07 11:48     ` Igor Russkikh
  0 siblings, 0 replies; 7+ messages in thread
From: Igor Russkikh @ 2018-12-07 11:48 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David S . Miller, Dmitry Bogdanov, netdev@vger.kernel.org


>> +	/* 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().
> 

Thanks, Jakub, indeed. Will resubmit.

Regards,
  Igor

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-07 11:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06 15:02 [PATCH net-next 0/4] net: aquantia: add RSS configuration Igor Russkikh
2018-12-06 15:02 ` [PATCH net-next 1/4] net: aquantia: fix RSS table and key sizes Igor Russkikh
2018-12-06 15:02 ` [PATCH net-next 2/4] net: aquantia: increase max number of hw queues Igor Russkikh
2018-12-06 15:02 ` [PATCH net-next 3/4] net: aquantia: fix initialization of RSS table Igor Russkikh
2018-12-06 15:02 ` [PATCH net-next 4/4] net: aquantia: add support of RSS configuration Igor Russkikh
2018-12-06 19:32   ` Jakub Kicinski
2018-12-07 11:48     ` Igor Russkikh

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).