Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
net: hns: Fix ethtool private flags
Browse files Browse the repository at this point in the history
The driver implementation returns support for private flags, while
no private flags are present. When asked for the number of private
flags it returns the number of statistic flag names.

Fix this by returning EOPNOTSUPP for not implemented ethtool flags.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
mbgg authored and davem330 committed Mar 17, 2018
1 parent bcdd5de commit d61d263
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data)

static int hns_gmac_get_sset_count(int stringset)
{
if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
if (stringset == ETH_SS_STATS)
return ARRAY_SIZE(g_gmac_stats_string);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void hns_ppe_update_stats(struct hns_ppe_cb *ppe_cb)

int hns_ppe_get_sset_count(int stringset)
{
if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
if (stringset == ETH_SS_STATS)
return ETH_PPE_STATIC_NUM;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ void hns_rcb_get_stats(struct hnae_queue *queue, u64 *data)
*/
int hns_rcb_get_ring_sset_count(int stringset)
{
if (stringset == ETH_SS_STATS || stringset == ETH_SS_PRIV_FLAGS)
if (stringset == ETH_SS_STATS)
return HNS_RING_STATIC_REG_NUM;

return 0;
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,10 @@ int hns_get_sset_count(struct net_device *netdev, int stringset)
cnt--;

return cnt;
} else {
} else if (stringset == ETH_SS_STATS) {
return (HNS_NET_STATS_CNT + ops->get_sset_count(h, stringset));
} else {
return -EOPNOTSUPP;
}
}

Expand Down

0 comments on commit d61d263

Please sign in to comment.