Commit 775501a1 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: Add new RSS hash algorithm support for PF

This patch adds ETH_RSS_HASH_XOR hash algorithm supports, which
is supported by hw revision 0x21.
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9047fa5d
...@@ -678,12 +678,13 @@ static int hns3_set_rss(struct net_device *netdev, const u32 *indir, ...@@ -678,12 +678,13 @@ static int hns3_set_rss(struct net_device *netdev, const u32 *indir,
if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->set_rss) if (!h->ae_algo || !h->ae_algo->ops || !h->ae_algo->ops->set_rss)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* currently we only support Toeplitz hash */ if ((h->pdev->revision == 0x20 &&
if ((hfunc != ETH_RSS_HASH_NO_CHANGE) && (hfunc != ETH_RSS_HASH_TOP)) { hfunc != ETH_RSS_HASH_TOP) || (hfunc != ETH_RSS_HASH_NO_CHANGE &&
netdev_err(netdev, hfunc != ETH_RSS_HASH_TOP && hfunc != ETH_RSS_HASH_XOR)) {
"hash func not supported (only Toeplitz hash)\n"); netdev_err(netdev, "hash func not supported\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (!indir) { if (!indir) {
netdev_err(netdev, netdev_err(netdev,
"set rss failed for indir is empty\n"); "set rss failed for indir is empty\n");
......
...@@ -2806,8 +2806,19 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, ...@@ -2806,8 +2806,19 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir,
int i; int i;
/* Get hash algorithm */ /* Get hash algorithm */
if (hfunc) if (hfunc) {
*hfunc = vport->rss_algo; switch (vport->rss_algo) {
case HCLGE_RSS_HASH_ALGO_TOEPLITZ:
*hfunc = ETH_RSS_HASH_TOP;
break;
case HCLGE_RSS_HASH_ALGO_SIMPLE:
*hfunc = ETH_RSS_HASH_XOR;
break;
default:
*hfunc = ETH_RSS_HASH_UNKNOWN;
break;
}
}
/* Get the RSS Key required by the user */ /* Get the RSS Key required by the user */
if (key) if (key)
...@@ -2831,12 +2842,20 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, ...@@ -2831,12 +2842,20 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir,
/* Set the RSS Hash Key if specififed by the user */ /* Set the RSS Hash Key if specififed by the user */
if (key) { if (key) {
switch (hfunc) {
if (hfunc == ETH_RSS_HASH_TOP || case ETH_RSS_HASH_TOP:
hfunc == ETH_RSS_HASH_NO_CHANGE)
hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
else break;
case ETH_RSS_HASH_XOR:
hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
break;
case ETH_RSS_HASH_NO_CHANGE:
hash_algo = vport->rss_algo;
break;
default:
return -EINVAL; return -EINVAL;
}
ret = hclge_set_rss_algo_key(hdev, hash_algo, key); ret = hclge_set_rss_algo_key(hdev, hash_algo, key);
if (ret) if (ret)
return ret; return ret;
......
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