[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1vIg8bR8NBnQ3J5@lunn.ch>
Date: Fri, 28 Oct 2022 14:18:11 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, corbet@....net, michael.chan@...adcom.com,
hkallweit1@...il.com, linux@...linux.org.uk,
huangguangbin2@...wei.com, chenhao288@...ilicon.com,
moshet@...dia.com, linux@...pel-privat.de,
linux-doc@...r.kernel.org
Subject: Re: [PATCH net-next v2] ethtool: linkstate: add a statistic for PHY
down events
> @@ -67,6 +67,7 @@ static void phy_link_down(struct phy_device *phydev)
> {
> phydev->phy_link_change(phydev, false);
> phy_led_trigger_change_speed(phydev);
> + WRITE_ONCE(phydev->link_down_events, phydev->link_down_events + 1);
I'm not sure the WRITE_ONCE adds much value. Many systems using PHYLIB
are 32 bit, and i don't think WRITE_ONCE will make that 64 bit write
atomic on 32 bit systems. And as Florian pointed out, you have bigger
problems if you manged to overflow a u32 into a u64.
> @@ -723,6 +724,8 @@ struct phy_device {
>
> int pma_extable;
>
> + unsigned int link_down_events;
And here is unsigned int, not u64? Or u32? It would be good to be
consistent.
> --- a/include/uapi/linux/ethtool_netlink.h
> +++ b/include/uapi/linux/ethtool_netlink.h
> @@ -262,6 +262,8 @@ enum {
> ETHTOOL_A_LINKSTATE_SQI_MAX, /* u32 */
> ETHTOOL_A_LINKSTATE_EXT_STATE, /* u8 */
> ETHTOOL_A_LINKSTATE_EXT_SUBSTATE, /* u8 */
> + ETHTOOL_A_LINKSTATE_PAD,
> + ETHTOOL_A_LINKSTATE_EXT_DOWN_CNT, /* u64 */
What is the PAD for?
Andrew
Powered by blists - more mailing lists