diff options
author | Kejian Yan <yankejian@huawei.com> | 2016-03-22 04:06:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-22 15:45:58 -0400 |
commit | 717dd807383b074c1ff3852a05ea5d1289827993 (patch) | |
tree | 7fb06b70329a8b305b94f23756bcf64434201aec | |
parent | beecfe9e269574973ea1b37472dc81dd0364d012 (diff) |
net: hns: fixes a bug of RSS
If trying to get receive flow hash indirection table by ethtool, it needs
to call .get_rxnfc to get ring number first. So this patch implements the
.get_rxnfc of ethtool. And the data type of rss_indir_table is u32, it has
to be multiply by the width of data type when using memcpy.
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 18 |
2 files changed, 22 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c index 648b31a5425d..285c893ab135 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c | |||
@@ -791,7 +791,8 @@ static int hns_ae_get_rss(struct hnae_handle *handle, u32 *indir, u8 *key, | |||
791 | memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); | 791 | memcpy(key, ppe_cb->rss_key, HNS_PPEV2_RSS_KEY_SIZE); |
792 | 792 | ||
793 | /* update the current hash->queue mappings from the shadow RSS table */ | 793 | /* update the current hash->queue mappings from the shadow RSS table */ |
794 | memcpy(indir, ppe_cb->rss_indir_table, HNS_PPEV2_RSS_IND_TBL_SIZE); | 794 | memcpy(indir, ppe_cb->rss_indir_table, |
795 | HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); | ||
795 | 796 | ||
796 | return 0; | 797 | return 0; |
797 | } | 798 | } |
@@ -806,7 +807,8 @@ static int hns_ae_set_rss(struct hnae_handle *handle, const u32 *indir, | |||
806 | hns_ppe_set_rss_key(ppe_cb, (u32 *)key); | 807 | hns_ppe_set_rss_key(ppe_cb, (u32 *)key); |
807 | 808 | ||
808 | /* update the shadow RSS table with user specified qids */ | 809 | /* update the shadow RSS table with user specified qids */ |
809 | memcpy(ppe_cb->rss_indir_table, indir, HNS_PPEV2_RSS_IND_TBL_SIZE); | 810 | memcpy(ppe_cb->rss_indir_table, indir, |
811 | HNS_PPEV2_RSS_IND_TBL_SIZE * sizeof(*indir)); | ||
810 | 812 | ||
811 | /* now update the hardware */ | 813 | /* now update the hardware */ |
812 | hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); | 814 | hns_ppe_set_indir_table(ppe_cb, ppe_cb->rss_indir_table); |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c index 2229905625ca..9c3ba65988e1 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | |||
@@ -1245,6 +1245,23 @@ hns_set_rss(struct net_device *netdev, const u32 *indir, const u8 *key, | |||
1245 | return ops->set_rss(priv->ae_handle, indir, key, hfunc); | 1245 | return ops->set_rss(priv->ae_handle, indir, key, hfunc); |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | static int hns_get_rxnfc(struct net_device *netdev, | ||
1249 | struct ethtool_rxnfc *cmd, | ||
1250 | u32 *rule_locs) | ||
1251 | { | ||
1252 | struct hns_nic_priv *priv = netdev_priv(netdev); | ||
1253 | |||
1254 | switch (cmd->cmd) { | ||
1255 | case ETHTOOL_GRXRINGS: | ||
1256 | cmd->data = priv->ae_handle->q_num; | ||
1257 | break; | ||
1258 | default: | ||
1259 | return -EOPNOTSUPP; | ||
1260 | } | ||
1261 | |||
1262 | return 0; | ||
1263 | } | ||
1264 | |||
1248 | static struct ethtool_ops hns_ethtool_ops = { | 1265 | static struct ethtool_ops hns_ethtool_ops = { |
1249 | .get_drvinfo = hns_nic_get_drvinfo, | 1266 | .get_drvinfo = hns_nic_get_drvinfo, |
1250 | .get_link = hns_nic_get_link, | 1267 | .get_link = hns_nic_get_link, |
@@ -1268,6 +1285,7 @@ static struct ethtool_ops hns_ethtool_ops = { | |||
1268 | .get_rxfh_indir_size = hns_get_rss_indir_size, | 1285 | .get_rxfh_indir_size = hns_get_rss_indir_size, |
1269 | .get_rxfh = hns_get_rss, | 1286 | .get_rxfh = hns_get_rss, |
1270 | .set_rxfh = hns_set_rss, | 1287 | .set_rxfh = hns_set_rss, |
1288 | .get_rxnfc = hns_get_rxnfc, | ||
1271 | }; | 1289 | }; |
1272 | 1290 | ||
1273 | void hns_ethtool_set_ops(struct net_device *ndev) | 1291 | void hns_ethtool_set_ops(struct net_device *ndev) |