Skip to content

Commit 16756d3

Browse files
kuba-moodavem330
authored andcommitted
ethtool: pause: make sure we init driver stats
The intention was for pause statistics to not be reported when driver does not have the relevant callback (only report an empty netlink nest). What happens currently we report all 0s instead. Make sure statistics are initialized to "not set" (which is -1) so the dumping code skips them. Fixes: 9a27a33 ("ethtool: add standard pause stats") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2afeec0 commit 16756d3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/ethtool/pause.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ static int pause_prepare_data(const struct ethnl_req_info *req_base,
3838
if (!dev->ethtool_ops->get_pauseparam)
3939
return -EOPNOTSUPP;
4040

41+
ethtool_stats_init((u64 *)&data->pausestat,
42+
sizeof(data->pausestat) / 8);
43+
4144
ret = ethnl_ops_begin(dev);
4245
if (ret < 0)
4346
return ret;
4447
dev->ethtool_ops->get_pauseparam(dev, &data->pauseparam);
4548
if (req_base->flags & ETHTOOL_FLAG_STATS &&
46-
dev->ethtool_ops->get_pause_stats) {
47-
ethtool_stats_init((u64 *)&data->pausestat,
48-
sizeof(data->pausestat) / 8);
49+
dev->ethtool_ops->get_pause_stats)
4950
dev->ethtool_ops->get_pause_stats(dev, &data->pausestat);
50-
}
5151
ethnl_ops_complete(dev);
5252

5353
return 0;

0 commit comments

Comments
 (0)