forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic: mtk_eth_soc: add support for flow-control settings
Add patch implementing operations to get and set flow-control link parameters of mtk_eth_soc to Linux 6.1 and Linux 6.6 generic patchset. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
- Loading branch information
Showing
10 changed files
with
185 additions
and
39 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
.../linux/generic/pending-6.1/733-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
From 0f4a54053f0ca66817ef492db68479b2be4dc1f4 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Golle <daniel@makrotopia.org> | ||
Date: Tue, 26 Mar 2024 10:35:09 +0000 | ||
Subject: [PATCH] net: ethernet: mtk_eth_soc: implement .{get,set}_pauseparam | ||
ethtool ops | ||
|
||
Implement operations to get and set flow-control link parameters. | ||
Use *_MCR_FORCE_{RX,TX}_FC flags to read current use of RX and TX | ||
pause frames with the exception of the GMAC1 when used as link to the | ||
built-in switch of MT7988 SoC, it does not support accessing XMAC_MCR. | ||
|
||
Setting flow-control parameters is done by calling | ||
phylink_ethtool_set_pauseparam(). | ||
|
||
Signed-off-by: Daniel Golle <daniel@makrotopia.org> | ||
--- | ||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 37 ++++++++++++++++++++- | ||
1 file changed, 36 insertions(+), 1 deletion(-) | ||
|
||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
@@ -4441,6 +4441,39 @@ static int mtk_set_rxnfc(struct net_devi | ||
return ret; | ||
} | ||
|
||
+static void mtk_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) | ||
+{ | ||
+ struct mtk_mac *mac = netdev_priv(dev); | ||
+ struct mtk_eth *eth = mac->hw; | ||
+ u32 val; | ||
+ | ||
+ if (mtk_interface_mode_is_xgmii(mac->interface)) { | ||
+ if (mac->id == MTK_GMAC1_ID) { | ||
+ /* always report all OFF for internal GSW */ | ||
+ pause->autoneg = 0; | ||
+ pause->rx_pause = 0; | ||
+ pause->tx_pause = 0; | ||
+ return; | ||
+ } | ||
+ val = mtk_r32(eth, MTK_XMAC_MCR(mac->id)); | ||
+ | ||
+ pause->rx_pause = !!(val & XMAC_MCR_FORCE_RX_FC); | ||
+ pause->tx_pause = !!(val & XMAC_MCR_FORCE_TX_FC); | ||
+ } else { | ||
+ val = mtk_r32(eth, MTK_MAC_MCR(mac->id)); | ||
+ | ||
+ pause->rx_pause = !!(val & MAC_MCR_FORCE_RX_FC); | ||
+ pause->tx_pause = !!(val & MAC_MCR_FORCE_TX_FC); | ||
+ } | ||
+} | ||
+ | ||
+static int mtk_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) | ||
+{ | ||
+ struct mtk_mac *mac = netdev_priv(dev); | ||
+ | ||
+ return phylink_ethtool_set_pauseparam(mac->phylink, pause); | ||
+} | ||
+ | ||
static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
struct net_device *sb_dev) | ||
{ | ||
@@ -4469,8 +4502,10 @@ static const struct ethtool_ops mtk_etht | ||
.get_strings = mtk_get_strings, | ||
.get_sset_count = mtk_get_sset_count, | ||
.get_ethtool_stats = mtk_get_ethtool_stats, | ||
+ .get_pauseparam = mtk_get_pauseparam, | ||
+ .set_pauseparam = mtk_set_pauseparam, | ||
.get_rxnfc = mtk_get_rxnfc, | ||
- .set_rxnfc = mtk_set_rxnfc, | ||
+ .set_rxnfc = mtk_set_rxnfc, | ||
}; | ||
|
||
static const struct net_device_ops mtk_netdev_ops = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
.../linux/generic/pending-6.6/733-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
From 0f4a54053f0ca66817ef492db68479b2be4dc1f4 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Golle <daniel@makrotopia.org> | ||
Date: Tue, 26 Mar 2024 10:35:09 +0000 | ||
Subject: [PATCH] net: ethernet: mtk_eth_soc: implement .{get,set}_pauseparam | ||
ethtool ops | ||
|
||
Implement operations to get and set flow-control link parameters. | ||
Use *_MCR_FORCE_{RX,TX}_FC flags to read current use of RX and TX | ||
pause frames with the exception of the GMAC1 when used as link to the | ||
built-in switch of MT7988 SoC, it does not support accessing XMAC_MCR. | ||
|
||
Setting flow-control parameters is done by calling | ||
phylink_ethtool_set_pauseparam(). | ||
|
||
Signed-off-by: Daniel Golle <daniel@makrotopia.org> | ||
--- | ||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 37 ++++++++++++++++++++- | ||
1 file changed, 36 insertions(+), 1 deletion(-) | ||
|
||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
@@ -4460,6 +4460,39 @@ static int mtk_set_rxnfc(struct net_devi | ||
return ret; | ||
} | ||
|
||
+static void mtk_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) | ||
+{ | ||
+ struct mtk_mac *mac = netdev_priv(dev); | ||
+ struct mtk_eth *eth = mac->hw; | ||
+ u32 val; | ||
+ | ||
+ if (mtk_interface_mode_is_xgmii(mac->interface)) { | ||
+ if (mac->id == MTK_GMAC1_ID) { | ||
+ /* always report all OFF for internal GSW */ | ||
+ pause->autoneg = 0; | ||
+ pause->rx_pause = 0; | ||
+ pause->tx_pause = 0; | ||
+ return; | ||
+ } | ||
+ val = mtk_r32(eth, MTK_XMAC_MCR(mac->id)); | ||
+ | ||
+ pause->rx_pause = !!(val & XMAC_MCR_FORCE_RX_FC); | ||
+ pause->tx_pause = !!(val & XMAC_MCR_FORCE_TX_FC); | ||
+ } else { | ||
+ val = mtk_r32(eth, MTK_MAC_MCR(mac->id)); | ||
+ | ||
+ pause->rx_pause = !!(val & MAC_MCR_FORCE_RX_FC); | ||
+ pause->tx_pause = !!(val & MAC_MCR_FORCE_TX_FC); | ||
+ } | ||
+} | ||
+ | ||
+static int mtk_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) | ||
+{ | ||
+ struct mtk_mac *mac = netdev_priv(dev); | ||
+ | ||
+ return phylink_ethtool_set_pauseparam(mac->phylink, pause); | ||
+} | ||
+ | ||
static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
struct net_device *sb_dev) | ||
{ | ||
@@ -4488,8 +4521,10 @@ static const struct ethtool_ops mtk_etht | ||
.get_strings = mtk_get_strings, | ||
.get_sset_count = mtk_get_sset_count, | ||
.get_ethtool_stats = mtk_get_ethtool_stats, | ||
+ .get_pauseparam = mtk_get_pauseparam, | ||
+ .set_pauseparam = mtk_set_pauseparam, | ||
.get_rxnfc = mtk_get_rxnfc, | ||
- .set_rxnfc = mtk_set_rxnfc, | ||
+ .set_rxnfc = mtk_set_rxnfc, | ||
}; | ||
|
||
static const struct net_device_ops mtk_netdev_ops = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
c684039
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, what happened to this commit? I saw some rj45 sfp modules need it to work correctly.