drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Ensure that all other bits in the RDES3 descriptor are configured before
transferring ownership of the descriptor to DMA via the OWN bit.
Signed-off-by: Tan En De <ende.tan@starfivetech.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index 1c5802e0d7f4..95aea6ad485b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -186,10 +186,13 @@ static void dwmac4_set_tx_owner(struct dma_desc *p)
static void dwmac4_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
{
- p->des3 |= cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
+ p->des3 |= cpu_to_le32(RDES3_BUFFER1_VALID_ADDR);
if (!disable_rx_ic)
p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
+
+ dma_wmb();
+ p->des3 |= cpu_to_le32(RDES3_OWN);
}
static int dwmac4_get_tx_ls(struct dma_desc *p)
--
2.34.1
On Fri, Aug 09, 2024 at 10:42:29PM +0800, Tan En De wrote:
> Ensure that all other bits in the RDES3 descriptor are configured before
> transferring ownership of the descriptor to DMA via the OWN bit.
Are you seeing things going wrong with real hardware, or is this just
code review? If this is a real problem, please add a description of
what the user would see.
Does this need to be backported in stable?
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
If it does, you should add a Fixes: tag and 'Cc: stable@vger.kernel.org'
This will also decide which tree you need to base the patch on:
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq
> static void dwmac4_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
> {
> - p->des3 |= cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
> + p->des3 |= cpu_to_le32(RDES3_BUFFER1_VALID_ADDR);
>
> if (!disable_rx_ic)
> p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
> +
> + dma_wmb();
> + p->des3 |= cpu_to_le32(RDES3_OWN);
Is the problem here that RDES3_INT_ON_COMPLETION_EN is added after the
RDES3_OWN above has hit the hardware, so it gets ignored?
It seems like it would be better to calculate the value in a local
variable, and then assign to p->des3 once.
Andrew
© 2016 - 2026 Red Hat, Inc.