* [PATCH net-next] ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET
@ 2021-04-19 20:03 Jakub Kicinski
2021-04-19 23:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Kicinski @ 2021-04-19 20:03 UTC (permalink / raw)
To: davem; +Cc: netdev, idosch, Jakub Kicinski, Ido Schimmel
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: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/ethtool/stats.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ethtool/stats.c b/net/ethtool/stats.c
index acb2b080c358..b7642dc96d50 100644
--- a/net/ethtool/stats.c
+++ b/net/ethtool/stats.c
@@ -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));
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET
2021-04-19 20:03 [PATCH net-next] ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET Jakub Kicinski
@ 2021-04-19 23:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-19 23:30 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, idosch, idosch
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
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.
>
> Suggested-by: Ido Schimmel <idosch@nvidia.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-19 23:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-19 20:03 [PATCH net-next] ethtool: stats: clarify the initialization to ETHTOOL_STAT_NOT_SET Jakub Kicinski
2021-04-19 23:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).