Commit 64ec10dc authored by lipeng's avatar lipeng Committed by David S. Miller

net: hns: Correct HNS RSS key set function

This patch fixes below ethtool configuration error:

localhost:~ # ethtool -X eth0 hkey XX:XX:XX...
Cannot set Rx flow hash configuration: Operation not supported
Signed-off-by: default avatarlipeng <lipeng321@huawei.com>
Reviewed-by: default avatarYisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f2aaed55
...@@ -826,6 +826,7 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key, ...@@ -826,6 +826,7 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key,
memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE);
/* update the current hash->queue mappings from the shadow RSS table */ /* update the current hash->queue mappings from the shadow RSS table */
if (indir)
memcpy(indir, ppe_cb->rss_indir_table, memcpy(indir, ppe_cb->rss_indir_table,
HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));
...@@ -838,15 +839,19 @@ static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir, ...@@ -838,15 +839,19 @@ static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir,
struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle); struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle);
/* set the RSS Hash Key if specififed by the user */ /* set the RSS Hash Key if specififed by the user */
if (key) if (key) {
hns_ppe_set_rss_key(ppe_cb, (u32 *)key); memcpy(ppe_cb->rss_key, key, HNS_PPEV2_RSS_KEY_SIZE);
hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
}
if (indir) {
/* update the shadow RSS table with user specified qids */ /* update the shadow RSS table with user specified qids */
memcpy(ppe_cb->rss_indir_table, indir, memcpy(ppe_cb->rss_indir_table, indir,
HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));
/* now update the hardware */ /* now update the hardware */
hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table);
}
return 0; return 0;
} }
......
...@@ -1244,6 +1244,7 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key, ...@@ -1244,6 +1244,7 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key,
{ {
struct hns_nic_priv *priv = netdev_priv(netdev); struct hns_nic_priv *priv = netdev_priv(netdev);
struct hnae_ae_ops *ops; struct hnae_ae_ops *ops;
int ret;
if (AE_IS_VER1(priv->enet_ver)) { if (AE_IS_VER1(priv->enet_ver)) {
netdev_err(netdev, netdev_err(netdev,
...@@ -1253,12 +1254,10 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key, ...@@ -1253,12 +1254,10 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key,
ops = priv->ae_handle->dev->ops; ops = priv->ae_handle->dev->ops;
/* currently hfunc can only be Toeplitz hash */ if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) {
if (key || netdev_err(netdev, "Invalid hfunc!\n");
(hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!indir) }
return 0;
return ops->set_rss(priv->ae_handle, indir, key, hfunc); return ops->set_rss(priv->ae_handle, indir, key, hfunc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment