[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHvrtGSbYbVm/xLK@shredder>
Date: Sun, 18 Apr 2021 11:20:04 +0300
From: Ido Schimmel <idosch@...sch.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, davem@...emloft.net, andrew@...n.ch,
mkubecek@...e.cz, idosch@...dia.com, saeedm@...dia.com,
michael.chan@...adcom.com
Subject: Re: [PATCH net-next v2 3/9] ethtool: add a new command for reading
standard stats
On Fri, Apr 16, 2021 at 12:27:39PM -0700, Jakub Kicinski wrote:
> +static int stats_prepare_data(const struct ethnl_req_info *req_base,
> + struct ethnl_reply_data *reply_base,
> + struct genl_info *info)
> +{
> + const struct stats_req_info *req_info = STATS_REQINFO(req_base);
> + struct stats_reply_data *data = STATS_REPDATA(reply_base);
> + struct net_device *dev = reply_base->dev;
> + int ret;
> +
> + ret = ethnl_ops_begin(dev);
> + if (ret < 0)
> + return ret;
> +
Nit: A comment here would be nice. Something like:
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));
> +
> + if (test_bit(ETHTOOL_STATS_ETH_PHY, req_info->stat_mask) &&
> + dev->ethtool_ops->get_eth_phy_stats)
> + dev->ethtool_ops->get_eth_phy_stats(dev, &data->phy_stats);
> +
> + ethnl_ops_complete(dev);
> + return 0;
> +}
Powered by blists - more mailing lists