Skip to content

Commit 3916376

Browse files
logostdavem330
authored andcommitted
net: aquantia: add support of RSS configuration
Add support of configuration of RSS hash key and RSS indirection table. Signed-off-by: Dmitry Bogdanov <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a8c69ca commit 3916376

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

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,

0 commit comments

Comments
 (0)