Subject: Re: [PATCH v4 net-next 2/8] net: phylink: introduce generic method to query PHY in-band autoneg capability

From: "Russell King (Oracle)" <[email-masked]>
Date: Tue, 22 Nov 2022 09:21:36 +0000

On Fri, Nov 18, 2022 at 02:01:18AM +0200, Vladimir Oltean wrote:
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 9a3752c0c444..56a431d88dd9 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -761,6 +761,12 @@ struct phy_tdr_config {
>  };
>  #define PHY_PAIR_ALL -1
>  
> +enum phy_an_inband {
> +	PHY_AN_INBAND_UNKNOWN		= BIT(0),
> +	PHY_AN_INBAND_OFF		= BIT(1),
> +	PHY_AN_INBAND_ON		= BIT(2),
> +};

There is another option here:

- unknown (basically, PHY driver doesn't implement the function or
  can't report)
- off (PHY driver knows for certain that in-band isn't used)
- on (PHY driver knows that in-band is required and must be
  acknowledged)
- on-but-not-required (PHY driver knows that in-band can be used, but
  the PHY has hardware support for timing out waiting for the in-band
  acknowledgement - Marvell PHYs support this.)

Maybe the fourth state can be indicated by setting both _OFF and _ON ?

Given that there's four states, does it make sense for this to be a
bitfield?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!