OSDN Git Service

net: phylink: rejig SFP interface selection in ksettings_set()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 19 Oct 2021 10:00:04 +0000 (11:00 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Oct 2021 12:07:35 +0000 (13:07 +0100)
commitdc90604b5836998bb2911faf80dc204f35db08a0
tree041bdab34c93461c5d62ccb34c9718855b9c07f8
parent1bd297988b75c0768e34e983b2a61a6d3dcda999
net: phylink: rejig SFP interface selection in ksettings_set()

Commit ea269a6f7207 ("net: phylink: Update SFP selected interface on
advertising changes") added a better solution to selecting the
interface mode for SFPs using the advertisement mask. This method will
work for mvneta and mvpp2 when selecting between 2500base-X and
1000base-X without needing to use the basex helper, or indicate that
we support both 1000base-X and 2500base-X when in either of these two
interface modes.

Hence, we need to eliminate the validation prior to selecting the
interface, otherwise when we clean up mvneta's validation function, we
will end up locking to 2500base-X as we validate with an interface mode
of PHY_INERFACE_MODE_2500BASEX.

The supported mask will already have been reduced down to the union of
support for the SFP and MAC already, so we can be confident that the
advertisement mask is already appropriately restricted. We only need to
select the appropriate interface, and then revalidate with the new
interface mode.

We get rid of the check for pl->sfp_port too, this is meaningless here
as it doesn't get cleared when a module is removed, so it doesn't
indicate if a module is present. Just rely on pl->sfp_bus.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c