Skip to content

Commit 76649fc

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: stmmac: convert half-duplex support to positive logic
Rather than detecting when half-duplex is not supported, and clearing the MAC capabilities, reverse the if() condition and use it to set the capabilities instead. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://lore.kernel.org/r/E1qZAXn-005pUb-SP@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 64961f1 commit 76649fc

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,16 +1223,17 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
12231223
priv->phylink_config.supported_interfaces);
12241224

12251225
priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
1226-
MAC_10 | MAC_100 | MAC_1000;
1226+
MAC_10FD | MAC_100FD |
1227+
MAC_1000FD;
1228+
1229+
/* Half-Duplex can only work with single queue */
1230+
if (priv->plat->tx_queues_to_use <= 1)
1231+
priv->phylink_config.mac_capabilities |= MAC_10HD | MAC_100HD |
1232+
MAC_1000HD;
12271233

12281234
/* Get the MAC specific capabilities */
12291235
stmmac_mac_phylink_get_caps(priv);
12301236

1231-
/* Half-Duplex can only work with single queue */
1232-
if (priv->plat->tx_queues_to_use > 1)
1233-
priv->phylink_config.mac_capabilities &=
1234-
~(MAC_10HD | MAC_100HD | MAC_1000HD);
1235-
12361237
max_speed = priv->plat->max_speed;
12371238
if (max_speed)
12381239
phylink_limit_mac_speed(&priv->phylink_config, max_speed);

0 commit comments

Comments
 (0)