Skip to contentSkip to conversation

net: stmmac: update MAC capabilities when tx queues are updated

PATCH Superseded Gan, Yi Fang 3 participants 4 messages Oct 18, 2023 – Oct 20, 2023

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: stmmac: update MAC capabilities when tx queues are updated

From: Michael Sit Wei Hong <[email protected]>

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 0366f7e06a6b ("net: stmmac: add ethtool support for get/set channels")
Cc <[email protected]> # 5.17+
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -0
index ed1a5a31a491..7ddc33fa0cb5 100644
@@ -7172,6 +7172,14 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
 			priv->rss.table[i] = ethtool_rxfh_indir_default(i,
 									rx_cnt);
 
+	/* Half-Duplex can only work with single tx queue */
+	if (priv->plat->tx_queues_to_use > 1)
+		priv->phylink_config.mac_capabilities &=
+			~(MAC_10HD | MAC_100HD | MAC_1000HD);
+	else
+		priv->phylink_config.mac_capabilities |=
+			(MAC_10HD | MAC_100HD | MAC_1000HD);
+
 	stmmac_napi_add(dev);
 
 	if (netif_running(dev))
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · Yi Fang

From: Michael Sit Wei Hong <[email protected]>

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.

There is other setup elsewhere in the driver that fiddles with this in stmmac_phy_setup(). Maybe provide a helper function so that this decision making can be made in one function called from both these locations, so if the decision making for HD support changes, only one place needs changing?

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
maintainer
#2 lore raw
Quoted 9 lines · Russell King (Oracle)
Quoted 8 lines · Yi Fang

From: Michael Sit Wei Hong <[email protected]>

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.

Quoted 8 lines
Quoted 2 lines

Using the stmmac_reinit_queues() to check the number of tx queues and set the MAC capabilities accordingly.

There is other setup elsewhere in the driver that fiddles with this in stmmac_phy_setup(). Maybe provide a helper function so that this decision making can be made in one function called from both these locations, so if the decision making for HD support changes, only one place needs changing?

Indeed that looks both straight-forward and more robust.

@Gan, Yi Fang: please send a v2 introducing and using such helper, thanks!

Paolo

#3 lore raw

Hi Russell King and Paolo,

Thank you for the feedbacks. I already submit V2 with the helper.

BR,
Fang

Quoted 42 lines

-----Original Message-----
From: Paolo Abeni <[email protected]>
Sent: Thursday, October 19, 2023 6:25 PM
To: Russell King (Oracle) <[email protected]>; Gan, Yi Fang <[email protected]>
Cc: Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; David S . Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Maxime Coquelin <[email protected]>; Ong, Boon Leong <[email protected]>; [email protected]; linux-stm32@st-md- mailman.stormreply.com; [email protected]; linux- [email protected]; Sit, Michael Wei Hong <[email protected]>; Looi, Hong Aun <[email protected]>; Voon, Weifeng <[email protected]>; Song, Yoong Siang <[email protected]>
Subject: Re: [PATCH net 1/1] net: stmmac: update MAC capabilities when tx queues are updated

Quoted 9 lines · Russell King (Oracle)
Quoted 8 lines · Yi Fang

From: Michael Sit Wei Hong <[email protected]>

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.

Quoted 8 lines
Quoted 2 lines

Using the stmmac_reinit_queues() to check the number of tx queues and set the MAC capabilities accordingly.

There is other setup elsewhere in the driver that fiddles with this in stmmac_phy_setup(). Maybe provide a helper function so that this decision making can be made in one function called from both these locations, so if the decision making for HD support changes, only one place needs changing?

Indeed that looks both straight-forward and more robust.

@Gan, Yi Fang: please send a v2 introducing and using such helper, thanks!

Paolo