Skip to contentSkip to conversation

net: stmmac: Batch set RX OWN flag and other flags

PATCH Applied [email protected] 2 participants 2 messages Aug 31, 2024 – Sep 5, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: stmmac: Batch set RX OWN flag and other flags

From: Tan En De <[email protected]>

Minimize access to the RX descriptor by collecting all the flags in a local variable and then updating the descriptor at once.

---
v4:
- Batch the endian conversion cpu_to_le32()
v3: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
- Use local variable to batch set the descriptor flags.
- This reduces the number of accesses to the descriptor.
v2: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
- Avoid introducing a new function just to set the interrupt-on-completion
bit, as it is wasteful to do so.
- Delegate the responsibility of calling dma_wmb() from main driver code
to set_rx_owner() callbacks (i.e. let callbacks to manage the low-level
ordering/barrier rather than cluttering up the main driver code).
v1: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c   | 6 ++++--
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +4 -2
index 1c5802e0d7f4..e99401bcc1f8 100644
@@ -186,10 +186,12 @@ 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);
+	u32 flags = (RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
 
 	if (!disable_rx_ic)
-		p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
+		flags |= RDES3_INT_ON_COMPLETION_EN;
+
+	p->des3 |= cpu_to_le32(flags);
 }
 
 static int dwmac4_get_tx_ls(struct dma_desc *p)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +4 -2
index fc82862a612c..389aad7b5c1e 100644
@@ -56,10 +56,12 @@ static void dwxgmac2_set_tx_owner(struct dma_desc *p)
 
 static void dwxgmac2_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
 {
-	p->des3 |= cpu_to_le32(XGMAC_RDES3_OWN);
+	u32 flags = XGMAC_RDES3_OWN;
 
 	if (!disable_rx_ic)
-		p->des3 |= cpu_to_le32(XGMAC_RDES3_IOC);
+		flags |= XGMAC_RDES3_IOC;
+
+	p->des3 |= cpu_to_le32(flags);
 }
 
 static int dwxgmac2_get_tx_ls(struct dma_desc *p)
Signature · 1 line
2.34.1
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Sat, 31 Aug 2024 09:11:14 +0800 you wrote:

From: Tan En De <[email protected]>

Minimize access to the RX descriptor by collecting all the flags in a local variable and then updating the descriptor at once.

[...]

Here is the summary with links:
- [net-next,v4,1/1] net: stmmac: Batch set RX OWN flag and other flags

    https://git.kernel.org/netdev/net-next/c/d2095989943b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html