Subject: Re: [PATCH RFC net-next 3/9] net: phylink: add function to resolve clause 73 negotiation

From: "Russell King (Oracle)" <[email-masked]>
Date: Sat, 13 May 2023 10:24:06 +0100

On Sat, May 13, 2023 at 01:57:46AM +0200, Andrew Lunn wrote:
> > +void phylink_resolve_c73(struct phylink_link_state *state)
> > +{
> > +	int i;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(phylink_c73_priority_resolution); i++) {
> > +		int bit = phylink_c73_priority_resolution[i].bit;
> > +		if (linkmode_test_bit(bit, state->advertising) &&
> > +		    linkmode_test_bit(bit, state->lp_advertising))
> > +			break;
> > +	}
> > +
> > +	if (i < ARRAY_SIZE(phylink_c73_priority_resolution)) {
> > +		state->speed = phylink_c73_priority_resolution[i].speed;
> > +		state->duplex = DUPLEX_FULL;
> > +	} else {
> > +		/* negotiation failure */
> > +		state->link = false;
> > +	}
> 
> Hi Russell
> 
> This looks asymmetric in that state->link is not set true if a
> resolution is found.
> 
> Can that set be moved here? Or are there other conditions which also
> need to be fulfilled before it is set?

It's intentionally so because it's a failure case. In theory, the
PHY shouldn't report link-up if the C73 priority resolution doesn't
give a valid result, but given that there are C73 advertisements
that we don't support, and that the future may add further
advertisements, if our software resolution fails to find a speed,
we need to stop the link coming up. Also... PHYs... hardware
bugs...

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