net: stmmac: dwmac4: Fixes issues in dwmac4
Subsystems (4)
v3 cover net: stmmac: dwmac4: Fixes issues in dwmac4
This patch series fixes issues in the dwmac4 driver. These three patches don't cause any user-visible issues, so they are targeted for net-next.
Patch #1:
Corrects the masking logic in the MTL Operation Mode RTC mask and shift macros. The current code lacks the use of the ~ operator, which is necessary to clear the bits properly.
Patch #2:
Addresses inaccuracies in the MTL_OP_MODE_*_MASK macros. The RTC fields are located in bits [1:0], and this patch ensures the mask and shift macros use the appropriate values to reflect this.
Patch #3:
Moves the handling of the Receive Watchdog Timeout (RWT) out of the Abnormal Interrupt Summary (AIS) condition. According to the databook, the RWT interrupt is not included in the AIS.
Changes since v2:
- Added more description in cover letter.
- Fixed subject for the cover letter
Changes since v1:
- Updated CC list from get_maintainers.pl.
- Removed Fixes tag.
- Add more description in cover letter.
History:
v1: https://lore.kernel.org/linux-arm-kernel/[email protected]/T/
v2: https://lore.kernel.org/netdev/[email protected]/T/
Ley Foon Tan (3):
net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal
interrupt summary
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 4 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/3 net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
RTC fields are located in bits [1:0]. Correct the _MASK and _SHIFT macros to use the appropriate mask and shift.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4.h +2 -2
@@ -393,8 +393,8 @@ static inline u32 mtl_chanx_base_addr(const struct dwmac4_addrs *addrs,#define MTL_OP_MODE_EHFC BIT(7) -#define MTL_OP_MODE_RTC_MASK 0x18 -#define MTL_OP_MODE_RTC_SHIFT 3 +#define MTL_OP_MODE_RTC_MASK GENMASK(1, 0) +#define MTL_OP_MODE_RTC_SHIFT 0#define MTL_OP_MODE_RTC_32 (1 << MTL_OP_MODE_RTC_SHIFT)#define MTL_OP_MODE_RTC_64 0
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
Quoted 4 lines · Ley Foon Tan
RTC fields are located in bits [1:0]. Correct the
_MASKand_SHIFTmacros to use the appropriate mask and shift.Signed-off-by Ley Foon Tan <[email protected]>
PATCH v3 2/3 net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
In reply to Ley Foon TanIn order to mask off the bits, we need to use the '~' operator to invert all the bits of _MASK and clear them.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +2 -2
@@ -274,7 +274,7 @@ static void dwmac4_dma_rx_chan_op_mode(struct stmmac_priv *priv, }else {pr_debug ("GMAC: disable RX SF mode (threshold %d)\n" , mode); mtl_rx_op &= ~MTL_OP_MODE_RSF ; - mtl_rx_op &=MTL_OP_MODE_RTC_MASK ; + mtl_rx_op &= ~MTL_OP_MODE_RTC_MASK ;if (mode <=32 ) mtl_rx_op |=MTL_OP_MODE_RTC_32 ;else if (mode <=64 )
@@ -343,7 +343,7 @@ static void dwmac4_dma_tx_chan_op_mode(struct stmmac_priv *priv, }else {pr_debug ("GMAC: disabling TX SF (threshold %d)\n" , mode); mtl_tx_op &= ~MTL_OP_MODE_TSF ; - mtl_tx_op &=MTL_OP_MODE_TTC_MASK ; + mtl_tx_op &= ~MTL_OP_MODE_TTC_MASK ;/* Set the transmit threshold */ if (mode <=32 ) mtl_tx_op |=MTL_OP_MODE_TTC_32 ;
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 2/3] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation
Quoted 4 lines · Ley Foon Tan
In order to mask off the bits, we need to use the '~' operator to invert all the bits of
_MASKand clear them.Signed-off-by Ley Foon Tan <[email protected]>
PATCH v3 3/3 net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary
In reply to Ley Foon TanThe Receive Watchdog Timeout (RWT, bit[9]) is not part of Abnormal Interrupt Summary (AIS). Move the RWT handling out of the AIS condition statement.
From databook, the AIS is the logical OR of the following interrupt bits:
- Bit 1: Transmit Process Stopped
- Bit 7: Receive Buffer Unavailable
- Bit 8: Receive Process Stopped
- Bit 10: Early Transmit Interrupt
- Bit 12: Fatal Bus Error
- Bit 13: Context Descriptor Error
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +4 -2
@@ -185,8 +185,6 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, x->rx_buf_unav_irq++;if (unlikely (intr_status &DMA_CHAN_STATUS_RPS )) x->rx_process_stopped_irq++; -if (unlikely (intr_status &DMA_CHAN_STATUS_RWT )) - x->rx_watchdog_irq++;if (unlikely (intr_status &DMA_CHAN_STATUS_ETI )) x->tx_early_irq++;if (unlikely (intr_status &DMA_CHAN_STATUS_TPS )) {
@@ -198,6 +196,10 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, ret = tx_hard_error; } } + +if (unlikely (intr_status &DMA_CHAN_STATUS_RWT )) + x->rx_watchdog_irq++; +/* TX/RX NORMAL interrupts */ if (likely (intr_status &DMA_CHAN_STATUS_RI )) {u64_stats_update_begin (&stats->syncp);
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 3/3] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary
Quoted 6 lines · Ley Foon Tan
The Receive Watchdog Timeout (RWT, bit[9]) is not part of Abnormal Interrupt Summary (AIS). Move the RWT handling out of the AIS condition statement.
Quoted 1 line
From databook, the AIS is the logical OR of the following interrupt bits:
Quoted 8 lines
- Bit 1: Transmit Process Stopped
- Bit 7: Receive Buffer Unavailable
- Bit 8: Receive Process Stopped
- Bit 10: Early Transmit Interrupt
- Bit 12: Fatal Bus Error
- Bit 13: Context Descriptor ErrorSigned-off-by Ley Foon Tan <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 7 Nov 2024 14:36:33 +0800 you wrote:
This patch series fixes issues in the dwmac4 driver. These three patches don't cause any user-visible issues, so they are targeted for net-next.
Patch #1:
Corrects the masking logic in the MTL Operation Mode RTC mask and shift macros. The current code lacks the use of the ~ operator, which is necessary to clear the bits properly.[...]
Here is the summary with links:
- [net-next,v3,1/3] net: stmmac: dwmac4: Fix MTL_OP_MODE_RTC mask and shift macros
https://git.kernel.org/netdev/net-next/c/6d4a34fe429f - [net-next,v3,2/3] net: stmmac: dwmac4: Fix the MTL_OP_MODE_*_MASK operation https://git.kernel.org/netdev/net-next/c/3fccba8fdc1b - [net-next,v3,3/3] net: stmmac: dwmac4: Receive Watchdog Timeout is not in abnormal interrupt summary https://git.kernel.org/netdev/net-next/c/671672977012
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html