Skip to contentSkip to conversation

net: aquantia: add RSS configuration

PATCH Superseded Igor Russkikh 2 participants 7 messages Dec 6, 2018 – Dec 7, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover net: aquantia: add RSS configuration

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(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/4 net: aquantia: fix RSS table and key sizes

From: Dmitry Bogdanov <[email protected]>

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

---
 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(-)
drivers/net/ethernet/aquantia/atlantic/aq_cfg.h +2 -2
index 91eb8910b1c9..90a0e1d0d622 100644
@@ -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
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +1 -1
index 279ea58f4a9e..d617289d95f7 100644
@@ -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,
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/4 net: aquantia: increase max number of hw queues

In reply to Igor Russkikh

From: Dmitry Bogdanov <[email protected]>

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.

---
 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(-)
drivers/net/ethernet/aquantia/atlantic/aq_cfg.h +1 -1
index 90a0e1d0d622..3944ce7f0870 100644
@@ -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
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +1 -1
index 6af7d7f0cdca..08596a7a6486 100644
@@ -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,	  \
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/4 net: aquantia: fix initialization of RSS table

In reply to Igor Russkikh

From: Dmitry Bogdanov <[email protected]>

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.

---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +2 -2
index d617289d95f7..0147c037ca96 100644
@@ -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) ||
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/4 net: aquantia: add support of RSS configuration

In reply to Igor Russkikh

From: Dmitry Bogdanov <[email protected]>

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

---
 .../ethernet/aquantia/atlantic/aq_ethtool.c   | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +42 -0
index a5fd71692c8b..2f2e12c2b632 100644
@@ -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,
Signature · 1 line
2.17.1
#5 lore raw

Re: [PATCH net-next 4/4] net: aquantia: add support of RSS configuration

Quoted 29 lines · Igor Russkikh

From: Dmitry Bogdanov <[email protected]>

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

---
 .../ethernet/aquantia/atlantic/aq_ethtool.c   | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +11 -0
index a5fd71692c8b..2f2e12c2b632 100644
@@ -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;

drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key, · line 225

Quoted 10 lines
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +10 -0
+
+	/* 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().

Quoted 18 lines
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +18 -0
+		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;
+}
#6 lore raw

Re: [PATCH net-next 4/4] net: aquantia: add support of RSS configuration

Quoted 10 lines

drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key, · line 225

Quoted 7 lines
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +6 -0
+	/* 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