Commit d1f0a5e1 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET

Ido suggests we add a comment about the init of stats to -1.
This is unlikely to be clear to first time readers.
Suggested-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 37434782
...@@ -114,6 +114,9 @@ static int stats_prepare_data(const struct ethnl_req_info *req_base, ...@@ -114,6 +114,9 @@ static int stats_prepare_data(const struct ethnl_req_info *req_base,
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Mark all stats as unset (see ETHTOOL_STAT_NOT_SET) to prevent them
* from being reported to user space in case driver did not set them.
*/
memset(&data->phy_stats, 0xff, sizeof(data->phy_stats)); memset(&data->phy_stats, 0xff, sizeof(data->phy_stats));
memset(&data->mac_stats, 0xff, sizeof(data->mac_stats)); memset(&data->mac_stats, 0xff, sizeof(data->mac_stats));
memset(&data->ctrl_stats, 0xff, sizeof(data->mac_stats)); memset(&data->ctrl_stats, 0xff, sizeof(data->mac_stats));
......
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