Skip to contentSkip to conversation

ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET

PATCH Applied Jakub Kicinski 2 participants 2 messages Apr 19, 2021

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 net/ethtool/stats.c | 3 +++
 1 file changed, 3 insertions(+)
net/ethtool/stats.c +3 -0
index acb2b080c358..b7642dc96d50 100644
@@ -114,6 +114,9 @@ static int stats_prepare_data(const struct ethnl_req_info *req_base,
 	if (ret < 0)
 		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->mac_stats, 0xff, sizeof(data->mac_stats));
 	memset(&data->ctrl_stats, 0xff, sizeof(data->mac_stats));
Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Mon, 19 Apr 2021 13:03:45 -0700 you wrote:

Ido suggests we add a comment about the init of stats to -1. This is unlikely to be clear to first time readers.

---
 net/ethtool/stats.c | 3 +++
 1 file changed, 3 insertions(+)

Here is the summary with links:
- [net-next] ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET

    https://git.kernel.org/netdev/net-next/c/d1f0a5e1fb4e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html