]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
net: hns: Correct HNS RSS key set function
authorlipeng <lipeng321@huawei.com>
Sat, 1 Apr 2017 11:03:39 +0000 (12:03 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Wed, 28 Jun 2017 14:24:09 +0000 (11:24 -0300)
BugLink: https://bugs.launchpad.net/bugs/1696031
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: lipeng <lipeng321@huawei.com>
Reviewed-by: Yisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 64ec10dc2ab8ef5bc6e76b1d4bc8203c08a6da1e)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c

index cd7e88e433b60e009bc8eccd9d0b4a2ef2894768..f0142e50048e7037fa16b92e5a2a1cdb8dbaf98a 100644 (file)
@@ -826,8 +826,9 @@ 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);
 
        /* update the current hash->queue mappings from the shadow RSS table */
-       memcpy(indir, ppe_cb->rss_indir_table,
-              HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));
+       if (indir)
+               memcpy(indir, ppe_cb->rss_indir_table,
+                      HNS_PPEV2_RSS_IND_TBL_SIZE  * sizeof(*indir));
 
        return 0;
 }
@@ -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);
 
        /* set the RSS Hash Key if specififed by the user */
-       if (key)
-               hns_ppe_set_rss_key(ppe_cb, (u32 *)key);
+       if (key) {
+               memcpy(ppe_cb->rss_key, key, HNS_PPEV2_RSS_KEY_SIZE);
+               hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
+       }
 
-       /* update the shadow RSS table with user specified qids */
-       memcpy(ppe_cb->rss_indir_table, indir,
-              HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir));
+       if (indir) {
+               /* update the shadow RSS table with user specified qids */
+               memcpy(ppe_cb->rss_indir_table, indir,
+                      HNS_PPEV2_RSS_IND_TBL_SIZE  * sizeof(*indir));
 
-       /* now update the hardware */
-       hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table);
+               /* now update the hardware */
+               hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table);
+       }
 
        return 0;
 }
index 3404eacaed7f9cff0a7128cb7580edc0ea8cf6e8..3a2a34250cc068c0f6646e5637c1726da7c9a8b5 100644 (file)
@@ -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 hnae_ae_ops *ops;
+       int ret;
 
        if (AE_IS_VER1(priv->enet_ver)) {
                netdev_err(netdev,
@@ -1253,12 +1254,10 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key,
 
        ops = priv->ae_handle->dev->ops;
 
-       /* currently hfunc can only be Toeplitz hash */
-       if (key ||
-           (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP))
+       if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP) {
+               netdev_err(netdev, "Invalid hfunc!\n");
                return -EOPNOTSUPP;
-       if (!indir)
-               return 0;
+       }
 
        return ops->set_rss(priv->ae_handle, indir, key, hfunc);
 }