Re: [PATCH net-next v2] ethtool: linkstate: add a statistic for PHY down events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux