Skip to content

Commit 0ebd96f

Browse files
fancerPaolo Abeni
authored and
Paolo Abeni
committed
net: stmmac: Apply half-duplex-less constraint for DW QoS Eth only
There are three DW MAC IP-cores which can have the multiple Tx/Rx queues enabled: DW GMAC v3.7+ with AV feature, DW QoS Eth v4.x/v5.x, DW XGMAC/XLGMAC Based on the respective HW databooks, only the DW QoS Eth IP-core doesn't support the half-duplex link mode in case if more than one queues enabled: "In multiple queue/channel configurations, for half-duplex operation, enable only the Q0/CH0 on Tx and Rx. For single queue/channel in full-duplex operation, any queue/channel can be enabled." The rest of the IP-cores don't have such constraint. Thus in order to have the constraint applied for the DW QoS Eth MACs only, let's move the it' implementation to the respective MAC-capabilities getter and make sure the getter is called in the queues re-init procedure. Fixes: b6cfffa ("stmmac: fix DMA channel hang in half-duplex mode") Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Romain Gantois <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 24f4c99 commit 0ebd96f

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ static void dwmac4_core_init(struct mac_device_info *hw,
7171
static void dwmac4_phylink_get_caps(struct stmmac_priv *priv)
7272
{
7373
priv->phylink_config.mac_capabilities |= MAC_2500FD;
74+
75+
if (priv->plat->tx_queues_to_use > 1)
76+
priv->phylink_config.mac_capabilities &=
77+
~(MAC_10HD | MAC_100HD | MAC_1000HD);
78+
else
79+
priv->phylink_config.mac_capabilities |=
80+
(MAC_10HD | MAC_100HD | MAC_1000HD);
7481
}
7582

7683
static void dwmac4_rx_queue_enable(struct mac_device_info *hw,

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

+3-16
Original file line numberDiff line numberDiff line change
@@ -1198,17 +1198,6 @@ static int stmmac_init_phy(struct net_device *dev)
11981198
return ret;
11991199
}
12001200

1201-
static void stmmac_set_half_duplex(struct stmmac_priv *priv)
1202-
{
1203-
/* Half-Duplex can only work with single tx queue */
1204-
if (priv->plat->tx_queues_to_use > 1)
1205-
priv->phylink_config.mac_capabilities &=
1206-
~(MAC_10HD | MAC_100HD | MAC_1000HD);
1207-
else
1208-
priv->phylink_config.mac_capabilities |=
1209-
(MAC_10HD | MAC_100HD | MAC_1000HD);
1210-
}
1211-
12121201
static int stmmac_phy_setup(struct stmmac_priv *priv)
12131202
{
12141203
struct stmmac_mdio_bus_data *mdio_bus_data;
@@ -1237,10 +1226,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
12371226
priv->phylink_config.supported_interfaces);
12381227

12391228
priv->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
1240-
MAC_10FD | MAC_100FD |
1241-
MAC_1000FD;
1242-
1243-
stmmac_set_half_duplex(priv);
1229+
MAC_10 | MAC_100 | MAC_1000;
12441230

12451231
/* Get the MAC specific capabilities */
12461232
stmmac_mac_phylink_get_caps(priv);
@@ -7355,7 +7341,8 @@ int stmmac_reinit_queues(struct net_device *dev, u32 rx_cnt, u32 tx_cnt)
73557341
priv->rss.table[i] = ethtool_rxfh_indir_default(i,
73567342
rx_cnt);
73577343

7358-
stmmac_set_half_duplex(priv);
7344+
stmmac_mac_phylink_get_caps(priv);
7345+
73597346
stmmac_napi_add(dev);
73607347

73617348
if (netif_running(dev))

0 commit comments

Comments
 (0)