Skip to content

Commit 6b241e4

Browse files
committed
Merge branch 'net-aquantia-add-RSS-configuration'
Igor Russkikh says: ==================== 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. v2: removed extra arg check ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents ef2df7f + 3916376 commit 6b241e4

File tree

4 files changed

+43
-7
lines changed

4 files changed

+43
-7
lines changed

drivers/net/ethernet/aquantia/atlantic/aq_cfg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#ifndef AQ_CFG_H
1313
#define AQ_CFG_H
1414

15-
#define AQ_CFG_VECS_DEF 4U
15+
#define AQ_CFG_VECS_DEF 8U
1616
#define AQ_CFG_TCS_DEF 1U
1717

1818
#define AQ_CFG_TXDS_DEF 4096U
@@ -42,8 +42,8 @@
4242
#define AQ_CFG_IS_LRO_DEF 1U
4343

4444
/* RSS */
45-
#define AQ_CFG_RSS_INDIRECTION_TABLE_MAX 128U
46-
#define AQ_CFG_RSS_HASHKEY_SIZE 320U
45+
#define AQ_CFG_RSS_INDIRECTION_TABLE_MAX 64U
46+
#define AQ_CFG_RSS_HASHKEY_SIZE 40U
4747

4848
#define AQ_CFG_IS_RSS_DEF 1U
4949
#define AQ_CFG_NUM_RSS_QUEUES_DEF AQ_CFG_VECS_DEF

drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,41 @@ static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key,
202202
return 0;
203203
}
204204

205+
static int aq_ethtool_set_rss(struct net_device *netdev, const u32 *indir,
206+
const u8 *key, const u8 hfunc)
207+
{
208+
struct aq_nic_s *aq_nic = netdev_priv(netdev);
209+
struct aq_nic_cfg_s *cfg;
210+
unsigned int i = 0U;
211+
u32 rss_entries;
212+
int err = 0;
213+
214+
cfg = aq_nic_get_cfg(aq_nic);
215+
rss_entries = cfg->aq_rss.indirection_table_size;
216+
217+
/* We do not allow change in unsupported parameters */
218+
if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
219+
return -EOPNOTSUPP;
220+
/* Fill out the redirection table */
221+
if (indir)
222+
for (i = 0; i < rss_entries; i++)
223+
cfg->aq_rss.indirection_table[i] = indir[i];
224+
225+
/* Fill out the rss hash key */
226+
if (key) {
227+
memcpy(cfg->aq_rss.hash_secret_key, key,
228+
sizeof(cfg->aq_rss.hash_secret_key));
229+
err = aq_nic->aq_hw_ops->hw_rss_hash_set(aq_nic->aq_hw,
230+
&cfg->aq_rss);
231+
if (err)
232+
return err;
233+
}
234+
235+
err = aq_nic->aq_hw_ops->hw_rss_set(aq_nic->aq_hw, &cfg->aq_rss);
236+
237+
return err;
238+
}
239+
205240
static int aq_ethtool_get_rxnfc(struct net_device *ndev,
206241
struct ethtool_rxnfc *cmd,
207242
u32 *rule_locs)
@@ -549,6 +584,7 @@ const struct ethtool_ops aq_ethtool_ops = {
549584
.set_pauseparam = aq_ethtool_set_pauseparam,
550585
.get_rxfh_key_size = aq_ethtool_get_rss_key_size,
551586
.get_rxfh = aq_ethtool_get_rss,
587+
.set_rxfh = aq_ethtool_set_rss,
552588
.get_rxnfc = aq_ethtool_get_rxnfc,
553589
.set_rxnfc = aq_ethtool_set_rxnfc,
554590
.get_sset_count = aq_ethtool_get_sset_count,

drivers/net/ethernet/aquantia/atlantic/aq_nic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void aq_nic_rss_init(struct aq_nic_s *self, unsigned int num_rss_queues)
4444
struct aq_rss_parameters *rss_params = &cfg->aq_rss;
4545
int i = 0;
4646

47-
static u8 rss_key[40] = {
47+
static u8 rss_key[AQ_CFG_RSS_HASHKEY_SIZE] = {
4848
0x1e, 0xad, 0x71, 0x87, 0x65, 0xfc, 0x26, 0x7d,
4949
0x0d, 0x45, 0x67, 0x74, 0xcd, 0x06, 0x1a, 0x18,
5050
0xb6, 0xc1, 0xf0, 0xc7, 0xbb, 0x18, 0xbe, 0xf8,
@@ -84,8 +84,6 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
8484

8585
cfg->is_lro = AQ_CFG_IS_LRO_DEF;
8686

87-
aq_nic_rss_init(self, cfg->num_rss_queues);
88-
8987
/*descriptors */
9088
cfg->rxds = min(cfg->aq_hw_caps->rxds_max, AQ_CFG_RXDS_DEF);
9189
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)
106104

107105
cfg->num_rss_queues = min(cfg->vecs, AQ_CFG_NUM_RSS_QUEUES_DEF);
108106

107+
aq_nic_rss_init(self, cfg->num_rss_queues);
108+
109109
cfg->irq_type = aq_pci_func_get_irq_type(self);
110110

111111
if ((cfg->irq_type == AQ_HW_IRQ_LEGACY) ||

drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define DEFAULT_B0_BOARD_BASIC_CAPABILITIES \
2323
.is_64_dma = true, \
24-
.msix_irqs = 4U, \
24+
.msix_irqs = 8U, \
2525
.irq_mask = ~0U, \
2626
.vecs = HW_ATL_B0_RSS_MAX, \
2727
.tcs = HW_ATL_B0_TC_MAX, \

0 commit comments

Comments
 (0)