Skip to content

Commit 95201f3

Browse files
michaelsit-iotgdavem330
authored andcommitted
net: stmmac: update MAC capabilities when tx queues are updated
Upon boot up, the driver will configure the MAC capabilities based on the maximum number of tx and rx queues. When the user changes the tx queues to single queue, the MAC should be capable of supporting Half Duplex, but the driver does not update the MAC capabilities when it is configured so. Using the stmmac_reinit_queues() to check the number of tx queues and set the MAC capabilities accordingly. Fixes: 0366f7e ("net: stmmac: add ethtool support for get/set channels") Cc: <[email protected]> # 5.17+ Signed-off-by: Michael Sit Wei Hong <[email protected]> Signed-off-by: Gan, Yi Fang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d2ca43f commit 95201f3

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,17 @@ static int stmmac_init_phy(struct net_device *dev)
11971197
return ret;
11981198
}
11991199

1200+
static void stmmac_set_half_duplex(struct stmmac_priv *priv)
1201+
{
1202+
/* Half-Duplex can only work with single tx queue */
1203+
if (priv->plat->tx_queues_to_use > 1)
1204+
priv->phylink_config.mac_capabilities &=
1205+
~(MAC_10HD | MAC_100HD | MAC_1000HD);
1206+
else
1207+
priv->phylink_config.mac_capabilities |=
1208+
(MAC_10HD | MAC_100HD | MAC_1000HD);
1209+
}
1210+
12001211
static int stmmac_phy_setup(struct stmmac_priv *priv)
12011212
{
12021213
struct stmmac_mdio_bus_data *mdio_bus_data;
@@ -1228,10 +1239,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
12281239
MAC_10FD | MAC_100FD |
12291240
MAC_1000FD;
12301241

1231-
/* Half-Duplex can only work with single queue */
1232-
if (priv->plat->tx_queues_to_use <= 1)
1233-
priv->phylink_config.mac_capabilities |= MAC_10HD | MAC_100HD |
1234-
MAC_1000HD;
1242+
stmmac_set_half_duplex(priv);
12351243

12361244
/* Get the MAC specific capabilities */
12371245
stmmac_mac_phylink_get_caps(priv);
@@ -7172,6 +7180,7 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
71727180
priv->rss.table[i] = ethtool_rxfh_indir_default(i,
71737181
rx_cnt);
71747182

7183+
stmmac_set_half_duplex(priv);
71757184
stmmac_napi_add(dev);
71767185

71777186
if (netif_running(dev))

0 commit comments

Comments
 (0)