All of lore.kernel.org
 help / color / mirror / Atom feed
* mt753x DSA switch support - bug?
@ 2021-11-21 17:27 Russell King (Oracle)
  0 siblings, 0 replies; only message in thread
From: Russell King (Oracle) @ 2021-11-21 17:27 UTC (permalink / raw)
  To: Landen Chao, Sean Wang; +Cc: netdev

Hi,

While updating drivers that use phylink, I came across this code in
the mt7530 driver in mt753x_phylink_validate():

        if (state->interface != PHY_INTERFACE_MODE_TRGMII ||
            !phy_interface_mode_is_8023z(state->interface)) {
                phylink_set(mask, 10baseT_Half);
                phylink_set(mask, 10baseT_Full);
                phylink_set(mask, 100baseT_Half);
                phylink_set(mask, 100baseT_Full);
                phylink_set(mask, Autoneg);
        }

which looks wrong to me. The if() condition is always true, so all
these modes are always set in the mask.

If state->interface is PHY_INTERFACE_MODE_TRGMII, then the first
part of the condition is false. phy_interface_mode_is_8023z() is
also false, so !phy_interface_mode_is_8023z() will be true. The
logical-or results in the if() condition being true.

If state->interface is PHY_INTERFACE_MODE_1000BASEX, then the first
part of the condition is true, and due to the logical-or not needing
to be further evaluated, results in the if() condition being true.

If state->interface is PHY_INTERFACE_MODE_RGMII, then the first part
of the condition is true, and this is exactly the same as the second
case above.

I think that "||" should be "&&", since I believe you intend these
modes not to be available in TRGMII nor 802.3z modes. Please confirm.
Thanks.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-21 17:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21 17:27 mt753x DSA switch support - bug? Russell King (Oracle)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.