net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup
Subsystems (5)
Maxime Chevallier
maintainerPATCH 1/1 net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup
On dwmac sun8i, the TX pause behaviour is controlled via 2 registers:
- TX_FLOW_CTL_EN, to enable/disable TX pause and set a few extra pause params,
- EMAC_RX_CTL1, that configures the fifo thresholds to start/stop sending pause frames
EMAC_RX_CTL1 also configures the DMA engine, to enable/disable it as well as start/stop it. There's a chance for a race if we trigger an action that starts the DMA engine at the same time as we configure pause.
Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status. That's also what's done in other glues.
The thresholds are now configured unconditionnally, that's also OK as it doesn't affect anything else that TX FC, and only if it's enabled in HW.
This didn't happen before, as we didn't configure the thresholds up until:
commit 22fc89783468 ("net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills")
This was reported by Sashiko when submitting the above patch. I've tested this on Allwinner H2+, but only to make sure FC still works, I haven't tried to reproduce the race.
--- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +6 -11
@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv,else if (mode <128 ) v |=EMAC_RX_TH_128 ; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT |EMAC_RX_FLOW_CTL_TH_DEACT ); + v |=EMAC_RX_FIFO_FLOW_CTL | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT ,EMAC_RX_FLOW_CTL_TH_2K ) | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT ,EMAC_RX_FLOW_CTL_TH_4K ); +writel (v, ioaddr +EMAC_RX_CTL1 ); }
@@ -774,17 +780,6 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, v &= ~EMAC_RX_FLOW_CTL_EN ;writel (v, ioaddr +EMAC_RX_CTL0 ); - v =readl (ioaddr +EMAC_RX_CTL1 ); - v &= ~(EMAC_RX_FIFO_FLOW_CTL |EMAC_RX_FLOW_CTL_TH_ACT | -EMAC_RX_FLOW_CTL_TH_DEACT ); -if (fc &FLOW_TX ) - v |=EMAC_RX_FIFO_FLOW_CTL | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT , -EMAC_RX_FLOW_CTL_TH_2K ) | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT , -EMAC_RX_FLOW_CTL_TH_4K ); -writel (v, ioaddr +EMAC_RX_CTL1 ); - v =readl (ioaddr +EMAC_TX_FLOW_CTL ); v &= ~(EMAC_TX_FLOW_CTL_EN |EMAC_TX_FLOW_CTL_ZQP_FRM_EN |EMAC_TX_FLOW_CTL_PAUSE_TIME );
Signature · 1 line
2.56.1
Hi Maxime
Quoted 6 lines · Maxime Chevallier
[...]
Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status. That's also what's done in other glues.
nit: IMHO other functions still touch this register, maybe reword?
Quoted 4 lines
The thresholds are now configured unconditionnally, that's also OK as it doesn't affect anything else that TX FC, and only if it's enabled in HW.
unconditionnally -> unconditionally, that -> than
Quoted 7 lines
[...]
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-0
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void · line 568
Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +3
-0@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, else if (mode < 128) v |= EMAC_RX_TH_128; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT |EMAC_RX_FLOW_CTL_TH_DEACT ); + v |= EMAC_RX_FIFO_FLOW_CTL |
This bit is now always set. Is that fine with TX pause off?
Quoted 1 line
[...]
Thanks,
Nicolai
Maxime Chevallier
maintainerHi Nicolai,
Quoted 4 lines · Nicolai Buchwitz
Hi Maxime
On 3.12.2026 08:31, Maxime Chevallier wrote:
Quoted 8 lines
Quoted 6 lines
[...]
Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status. That's also what's done in other glues.
nit: IMHO other functions still touch this register, maybe reword?
Sure, I can reword
Quoted 7 lines
Quoted 5 lines
The thresholds are now configured unconditionnally, that's also OK as it doesn't affect anything else that TX FC, and only if it's enabled in HW.
unconditionnally -> unconditionally, that -> than
arg typos, sorry about that.
Quoted 16 lines
Quoted 8 lines
[...]
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-0drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, · line 567
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +3
-0@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, else if (mode < 128) v |= EMAC_RX_TH_128; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT | EMAC_RX_FLOW_CTL_TH_DEACT); + v |= EMAC_RX_FIFO_FLOW_CTL |This bit is now always set. Is that fine with TX pause off?
yes it's fine, I've tested that. As long as TX_FLOW_CTL_EN is clear in TX_FLOW_CTL, we don't emit pause frames so we're all good :)
Maxime
Quoted 5 lines
Quoted 2 lines
[...]
Thanks,
Nicolai
Nicolai Buchwitz
Reviewed-byQuoted 17 lines · Maxime Chevallier
[...]
Quoted 6 lines
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-0@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv,Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, · line 567
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +3
-0else if (mode < 128) v |= EMAC_RX_TH_128; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT | EMAC_RX_FLOW_CTL_TH_DEACT); + v |= EMAC_RX_FIFO_FLOW_CTL |This bit is now always set. Is that fine with TX pause off?
Quoted 2 lines
yes it's fine, I've tested that. As long as
TX_FLOW_CTL_ENis clear inTX_FLOW_CTL, we don't emit pause frames so we're all good :)
Thanks for the clarification!
Quoted 1 line
[...]
Regards
Nicolai
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] net: stmmac: dwmac-sun8i: missing Fixes trailer for commit 22fc89783468 --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] net: stmmac: dwmac-sun8i: missing Fixes trailer for commit 22fc89783468
--
commit 213e567f3a047f173c6e0138876f96d1067ef080
Author: Maxime Chevallier <[email protected]>
Quoted 27 lines
net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup
On dwmac sun8i, the TX pause behaviour is controlled via 2 registers:
-
TX_FLOW_CTL_EN, to enable/disable TX pause and set a few extra pause params,-
EMAC_RX_CTL1, that configures the fifo thresholds to start/stop sending pause frames
EMAC_RX_CTL1also configures the DMA engine, to enable/disable it as well as start/stop it. There's a chance for a race if we trigger an action that starts the DMA engine at the same time as we configure pause.Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status. That's also what's done in other glues.
The thresholds are now configured unconditionnally, that's also OK as it doesn't affect anything else that TX FC, and only if it's enabled in HW.
This didn't happen before, as we didn't configure the thresholds up until:
Quoted 7 lines
commit
22fc89783468("net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills")This was reported by Sashiko when submitting the above patch. I've tested this on Allwinner H2+, but only to make sure FC still works, I haven't tried to reproduce the race.
Signed-off-by Maxime Chevallier <[email protected]>
[Severity: Low]
This fixes a register read-modify-write race on EMAC_RX_CTL1 that could clobber RX DMA state. Per Documentation/process/maintainer-netdev.rst, should this include a Fixes tag?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The patch changes behaviour without saying so, and the commit message is inaccurate.
- [Low] The commit fixes a race that commit 22fc89783468 ("net: stmmac:
dwmac-sun8i: emit pause frames when the RX FIFO fills") introduced,…
--
net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup
This patch moves the EMAC_RX_CTL1 RX FIFO flow control threshold setup out of sun8i_dwmac_flow_ctrl() and into sun8i_dwmac_dma_operation_mode_rx(). The flow control path then no longer does a read-modify-write of the register that also holds the RX DMA start/enable bits. The thresholds and EMAC_RX_FIFO_FLOW_CTL are now set unconditionally.
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, · line 569
Quoted 13 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +5
-0@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv,else if (mode <128 ) v |=EMAC_RX_TH_128 ; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT |EMAC_RX_FLOW_CTL_TH_DEACT ); + v |=EMAC_RX_FIFO_FLOW_CTL | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT ,EMAC_RX_FLOW_CTL_TH_2K ) | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT ,EMAC_RX_FLOW_CTL_TH_4K );
[Severity: Medium]
Is this change in behaviour intended? Before this patch, sun8i_dwmac_flow_ctrl() cleared EMAC_RX_FIFO_FLOW_CTL unless fc & FLOW_TX was set:
v &= ~(EMAC_RX_FIFO_FLOW_CTL | EMAC_RX_FLOW_CTL_TH_ACT |
EMAC_RX_FLOW_CTL_TH_DEACT);
if (fc & FLOW_TX)
v |= EMAC_RX_FIFO_FLOW_CTL | ...Now this code always sets the bit, and the clear mask here does not include it. sun8i_dwmac_flow_ctrl() also no longer touches EMAC_RX_CTL1. The only thing that clears the bit is the writel(0, ioaddr + EMAC_RX_CTL1) in sun8i_dwmac_dma_reset(), and stmmac_hw_setup() sets it again right after.
When TX pause is disabled (ethtool -A tx off, or a link partner without pause support), only EMAC_TX_FLOW_CTL_EN in EMAC_TX_FLOW_CTL now gates TX pause.
If the sun8i EMAC does not gate RX FIFO threshold flow control on EMAC_TX_FLOW_CTL_EN, could the MAC now send pause frames in full duplex, or apply back-pressure in half duplex, while TX pause is off?
The other Synopsys cores do set the equivalent bit unconditionally in the rx mode path (DMA_CONTROL_EFC in dwmac1000, MTL_OP_MODE_EHFC in dwmac4, XGMAC_EHFC in dwxgmac2). I couldn't find anything showing that the Allwinner EMAC behaves the same way.
The commit message also says:
Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status.
EMAC_RX_FIFO_FLOW_CTL looks like an enable bit rather than a threshold.
sun8i_dwmac_dma_reset(), sun8i_dwmac_dma_start_rx() and sun8i_dwmac_dma_stop_rx() also still write EMAC_RX_CTL1, for example:
sun8i_dwmac_dma_start_rx() {
v = readl(ioaddr + EMAC_RX_CTL1);
v |= EMAC_RX_DMA_START;
v |= EMAC_RX_DMA_EN;
writel(v, ioaddr + EMAC_RX_CTL1);
}Could the commit message say that the flow control path no longer writes EMAC_RX_CTL1, and mention the EMAC_RX_FIFO_FLOW_CTL change?
[ ... ]
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-1@@ -774,17 +780,6 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, v &= ~EMAC_RX_FLOW_CTL_EN ;writel (v, ioaddr +EMAC_RX_CTL0 ); - v =readl (ioaddr +EMAC_RX_CTL1 );
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, · line 787
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-10- v &= ~(EMAC_RX_FIFO_FLOW_CTL |EMAC_RX_FLOW_CTL_TH_ACT | -EMAC_RX_FLOW_CTL_TH_DEACT ); -if (fc &FLOW_TX ) - v |=EMAC_RX_FIFO_FLOW_CTL | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT , -EMAC_RX_FLOW_CTL_TH_2K ) | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT , -EMAC_RX_FLOW_CTL_TH_4K ); -writel (v, ioaddr +EMAC_RX_CTL1 ); -
[Severity: Low]
This isn't a bug, but this removes the EMAC_RX_CTL1 read-modify-write that commit 22fc89783468 added. The commit message already names that commit as the source of the race. Should this carry a Fixes: tag?
The race comes from the phylink resolve worker calling stmmac_mac_link_up()->stmmac_mac_flow_ctrl()->sun8i_dwmac_flow_ctrl() without rtnl. That path can run at the same time as sun8i_dwmac_dma_start_rx() or sun8i_dwmac_dma_stop_rx(), which modify the same register.
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203073137.958539-1-maxime.chevallier%40bootlin.com
Maxime Chevallier
maintainerQuoted 27 lines · On 12/4/26 08:57, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] The patch changes behaviour without saying so, and the commit message is inaccurate.
- [Low] The commit fixes a race that commit22fc89783468("net: stmmac:
dwmac-sun8i: emit pause frames when the RX FIFO fills") introduced,…--
net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup
This patch moves the
EMAC_RX_CTL1RX FIFO flow control threshold setup out ofsun8i_dwmac_flow_ctrl()and intosun8i_dwmac_dma_operation_mode_rx(). The flow control path then no longer does a read-modify-write of the register that also holds the RX DMA start/enable bits. The thresholds andEMAC_RX_FIFO_FLOW_CTLare now set unconditionally.
Quoted 16 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, · line 569
Quoted 13 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +5
-0@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv,else if (mode <128 ) v |=EMAC_RX_TH_128 ; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT |EMAC_RX_FLOW_CTL_TH_DEACT ); + v |=EMAC_RX_FIFO_FLOW_CTL | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT ,EMAC_RX_FLOW_CTL_TH_2K ) | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT ,EMAC_RX_FLOW_CTL_TH_4K );[Severity: Medium]
Is this change in behaviour intended?
There's no change in behaviour.
Before this patch,
Quoted 18 lines
sun8i_dwmac_flow_ctrl()clearedEMAC_RX_FIFO_FLOW_CTLunless fc &FLOW_TXwas set:v &= ~(EMAC_RX_FIFO_FLOW_CTL | EMAC_RX_FLOW_CTL_TH_ACT | EMAC_RX_FLOW_CTL_TH_DEACT); if (fc & FLOW_TX) v |= EMAC_RX_FIFO_FLOW_CTL | ...Now this code always sets the bit, and the clear mask here does not include it.
sun8i_dwmac_flow_ctrl()also no longer touchesEMAC_RX_CTL1. The only thing that clears the bit is thewritel(0, ioaddr + EMAC_RX_CTL1)insun8i_dwmac_dma_reset(), andstmmac_hw_setup()sets it again right after.When TX pause is disabled (ethtool -A tx off, or a link partner without pause support), only
EMAC_TX_FLOW_CTL_ENinEMAC_TX_FLOW_CTLnow gates TX pause.
Quoted 8 lines
If the sun8i EMAC does not gate RX FIFO threshold flow control on
EMAC_TX_FLOW_CTL_EN, could the MAC now send pause frames in full duplex, or apply back-pressure in half duplex, while TX pause is off?The other Synopsys cores do set the equivalent bit unconditionally in the rx mode path (
DMA_CONTROL_EFCin dwmac1000,MTL_OP_MODE_EHFCin dwmac4,XGMAC_EHFCin dwxgmac2). I couldn't find anything showing that the Allwinner EMAC behaves the same way.
see my reply to Nicolai, "gating TX pause" with EMAC_TX_FLOW_CTL is enough.
Quoted 45 lines
The commit message also says:
Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status.
EMAC_RX_FIFO_FLOW_CTLlooks like an enable bit rather than a threshold.
sun8i_dwmac_dma_reset(),sun8i_dwmac_dma_start_rx()andsun8i_dwmac_dma_stop_rx()also still writeEMAC_RX_CTL1, for example:sun8i_dwmac_dma_start_rx() { v = readl(ioaddr + EMAC_RX_CTL1); v |= EMAC_RX_DMA_START; v |= EMAC_RX_DMA_EN; writel(v, ioaddr + EMAC_RX_CTL1); }Could the commit message say that the flow control path no longer writes
EMAC_RX_CTL1, and mention theEMAC_RX_FIFO_FLOW_CTLchange?[ ... ]
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-1@@ -774,17 +780,6 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, v &= ~EMAC_RX_FLOW_CTL_EN ;writel (v, ioaddr +EMAC_RX_CTL0 ); - v =readl (ioaddr +EMAC_RX_CTL1 );drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, · line 787
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +0
-10- v &= ~(EMAC_RX_FIFO_FLOW_CTL |EMAC_RX_FLOW_CTL_TH_ACT | -EMAC_RX_FLOW_CTL_TH_DEACT ); -if (fc &FLOW_TX ) - v |=EMAC_RX_FIFO_FLOW_CTL | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT , -EMAC_RX_FLOW_CTL_TH_2K ) | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT , -EMAC_RX_FLOW_CTL_TH_4K ); -writel (v, ioaddr +EMAC_RX_CTL1 ); -[Severity: Low]
This isn't a bug, but this removes theEMAC_RX_CTL1read-modify-write that commit22fc89783468added. The commit message already names that commit as the source of the race. Should this carry a Fixes: tag?
Quoted 1 line
Fixes 22fc89783468 ("net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills")
it's net-next, I can add it but not super necessary, no need to backport or anything.
Maxime
Quoted 25 lines
On dwmac sun8i, the TX pause behaviour is controlled via 2 registers:
-
TX_FLOW_CTL_EN, to enable/disable TX pause and set a few extra pause params,-
EMAC_RX_CTL1, that configures the fifo thresholds to start/stop sending pause frames
EMAC_RX_CTL1also configures the DMA engine, to enable/disable it as well as start/stop it. There's a chance for a race if we trigger an action that starts the DMA engine at the same time as we configure pause.Let's move the threshold setup in the DMA configuration path, making it the only piece of code that touches this register. This is OK, as we just set the thresholds, we don't change the FC status. That's also what's done in other glues.
The thresholds are now configured unconditionnally, that's also OK as it doesn't affect anything else that TX FC, and only if it's enabled in HW.
This didn't happen before, as we didn't configure the thresholds up until:
Quoted 7 lines
commit
22fc89783468("net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills")This was reported by Sashiko when submitting the above patch. I've tested this on Allwinner H2+, but only to make sure FC still works, I haven't tried to reproduce the race.
Signed-off-by Maxime Chevallier <[email protected]>
Quoted 42 lines
--- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +6
-11@@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv,else if (mode <128 ) v |=EMAC_RX_TH_128 ; } + + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT |EMAC_RX_FLOW_CTL_TH_DEACT ); + v |=EMAC_RX_FIFO_FLOW_CTL | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT ,EMAC_RX_FLOW_CTL_TH_2K ) | +FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT ,EMAC_RX_FLOW_CTL_TH_4K ); +writel (v, ioaddr +EMAC_RX_CTL1 ); }@@ -774,17 +780,6 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, v &= ~EMAC_RX_FLOW_CTL_EN ;writel (v, ioaddr +EMAC_RX_CTL0 ); - v =readl (ioaddr +EMAC_RX_CTL1 ); - v &= ~(EMAC_RX_FIFO_FLOW_CTL |EMAC_RX_FLOW_CTL_TH_ACT | -EMAC_RX_FLOW_CTL_TH_DEACT ); -if (fc &FLOW_TX ) - v |=EMAC_RX_FIFO_FLOW_CTL | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_ACT , -EMAC_RX_FLOW_CTL_TH_2K ) | -FIELD_PREP (EMAC_RX_FLOW_CTL_TH_DEACT , -EMAC_RX_FLOW_CTL_TH_4K ); -writel (v, ioaddr +EMAC_RX_CTL1 ); - v =readl (ioaddr +EMAC_TX_FLOW_CTL ); v &= ~(EMAC_TX_FLOW_CTL_EN |EMAC_TX_FLOW_CTL_ZQP_FRM_EN |EMAC_TX_FLOW_CTL_PAUSE_TIME );Signature · 1 line
2.56.1