Re: [PATCH net-next v19 2/4] hinic3: Add ethtool statistic ops part(2/2)
From: netdev-bot+sashiko
Date: Fri Dec 04 2026 - 23:18:01 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message does not mention a structural and behavioural
change.
--
hinic3: Add ethtool statistic ops part(2/2)
This commit adds five standard ethtool statistics callbacks to hinic3
(eth-phy, eth-mac, eth-ctrl, rmon and pause). Each one reads the physical
port counters from firmware with hinic3_get_phy_port_stats(). The commit
also adds a separate VF ethtool_ops table and selects between the PF and
VF tables in hinic3_set_ethtool_ops().
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c
> index 0ec5d7f21e098..1a62668a65f77 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c
[ ... ]
> @@ -674,9 +867,32 @@ static const struct ethtool_ops hinic3_ethtool_ops = {
> .get_strings = hinic3_get_strings,
> .get_sset_count = hinic3_get_sset_count,
> .get_ethtool_stats = hinic3_get_ethtool_stats,
> + .get_eth_phy_stats = hinic3_get_eth_phy_stats,
> + .get_eth_mac_stats = hinic3_get_eth_mac_stats,
> + .get_eth_ctrl_stats = hinic3_get_eth_ctrl_stats,
> + .get_rmon_stats = hinic3_get_rmon_stats,
> + .get_pause_stats = hinic3_get_pause_stats,
> +};
> +
> +static const struct ethtool_ops hinic3vf_ethtool_ops = {
> + .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
> + ETHTOOL_COALESCE_PKT_RATE_RX_USECS,
> + .get_link_ksettings = hinic3_get_link_ksettings,
> + .get_drvinfo = hinic3_get_drvinfo,
> + .get_msglevel = hinic3_get_msglevel,
> + .set_msglevel = hinic3_set_msglevel,
> + .get_link = ethtool_op_get_link,
> + .get_strings = hinic3_get_strings,
> + .get_sset_count = hinic3_get_sset_count,
> + .get_ethtool_stats = hinic3_get_ethtool_stats,
> };
>
> void hinic3_set_ethtool_ops(struct net_device *netdev)
> {
> - netdev->ethtool_ops = &hinic3_ethtool_ops;
> + struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
> +
> + if (!HINIC3_IS_VF(nic_dev->hwdev))
> + netdev->ethtool_ops = &hinic3_ethtool_ops;
> + else
> + netdev->ethtool_ops = &hinic3vf_ethtool_ops;
> }
[Severity: Low]
This isn't a bug, but could the commit message describe the PF/VF split?
The commit message only says:
This commit adds five standard ethtool statistics callbacks to the hinic3
driver: get_eth_phy_stats, get_eth_mac_stats, get_eth_ctrl_stats,
get_rmon_stats and get_pause_stats. Each callback reads the physical port
counters from firmware via hinic3_get_phy_port_stats() and copies them
into the standard ethtool structures.
The patch also does two other things:
- It adds hinic3vf_ethtool_ops, which is mostly a copy of
hinic3_ethtool_ops.
- hinic3_set_ethtool_ops() now chooses between the two tables based on
HINIC3_IS_VF().
So VF netdevs get none of the new eth-phy, eth-mac, eth-ctrl, rmon or
pause stats groups.
The exclusion looks intentional. It matches the !HINIC3_IS_VF() check
around the port stats in hinic3_get_ethtool_stats(), presumably because
VFs cannot query the physical port counters.
The driver now keeps two ops tables that have to stay in sync. Any op
added only to hinic3_ethtool_ops will be missing on VFs without warning.
The later patch in this series, "hinic3: Add ethtool pause param ops",
adds get/set_pauseparam only to the PF table. That commit message does
not explain the split either.
Would it help to say in the commit message that VFs are excluded on
purpose, and why?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796348433.git.gongfan1%40huawei.com