Skip to contentSkip to conversation

net: stmmac: Remove ARP offload code

PATCH Applied Maxime Chevallier 3 participants 3 messages Aug 31 – Sep 1

Subsystems (5)
lore
Share & tools
lore

Maxime Chevallier

author maintainer
#0 lore raw

PATCH 1/1 net: stmmac: Remove ARP offload code

dwmac can do ARP offloading, where the HW replies to incoming ARP requests. This requires multiple steps to work well :
- Program the local IP address in a dedicated register
- Enable ARP offloading

This is halfway implemented in stmmac, as it's only ever used by selftests, and these selftests are failing on at least 2 platforms :
stm32mp1, and jh7110.

There have been some attempts in the past to support this feature, but this never made it upstream. Let's just remove the test and that code, until someone actually wants that to work. We should likely have a proper API for that so that drivers can use it.

Let's also not mention ARP offload in the stmmac documentation.

Leave the defines in place and the capability detection, this doesn't hurt and gives some information about how the IP is synthesized.

---
 .../ethernet/stmicro/stmmac.rst               |   1 -
 .../net/ethernet/stmicro/stmmac/dwmac4_core.c |  19 ---
 .../ethernet/stmicro/stmmac/dwxgmac2_core.c   |  18 ---
 drivers/net/ethernet/stmicro/stmmac/hwif.h    |   3 -
 .../stmicro/stmmac/stmmac_selftests.c         | 112 ------------------
 5 files changed, 153 deletions(-)
Documentation/networking/device_drivers/ethernet/stmicro/stmmac.rst +0 -1
index 5d46e5036129..ea347b7e93a2 100644
@@ -69,7 +69,6 @@ The following features are available in this driver:
  - Pulse-Per-Second Output (PPS)
  - MDIO Clause 22 / Clause 45 Interface
  - MAC Loopback
- - ARP Offloading
  - Automatic CRC / PAD Insertion and Checking
  - Checksum Offload for Received and Transmitted Packets
  - Standard or Jumbo Ethernet Packets
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +0 -19
index fb5b96a43505..cd6c5d6f42b5 100644
@@ -819,22 +819,6 @@ static void dwmac4_sarc_configure(void __iomem *ioaddr, int val)
 	writel(value, ioaddr + GMAC_CONFIG);
 }
 
-static void dwmac4_set_arp_offload(struct mac_device_info *hw, bool en,
-				   u32 addr)
-{
-	void __iomem *ioaddr = hw->pcsr;
-	u32 value;
-
-	writel(addr, ioaddr + GMAC_ARP_ADDR);
-
-	value = readl(ioaddr + GMAC_CONFIG);
-	if (en)
-		value |= GMAC_CONFIG_ARPEN;
-	else
-		value &= ~GMAC_CONFIG_ARPEN;
-	writel(value, ioaddr + GMAC_CONFIG);
-}
-
 static int dwmac4_config_l3_filter(struct mac_device_info *hw, u32 filter_no,
 				   bool en, bool ipv6, bool sa, bool inv,
 				   u32 match)
@@ -966,7 +950,6 @@ const struct stmmac_ops dwmac4_ops = {
 	.set_filter = dwmac4_set_filter,
 	.set_mac_loopback = dwmac4_set_mac_loopback,
 	.sarc_configure = dwmac4_sarc_configure,
-	.set_arp_offload = dwmac4_set_arp_offload,
 	.config_l3_filter = dwmac4_config_l3_filter,
 	.config_l4_filter = dwmac4_config_l4_filter,
 };
@@ -1003,7 +986,6 @@ const struct stmmac_ops dwmac410_ops = {
 	.flex_pps_config = dwmac5_flex_pps_config,
 	.set_mac_loopback = dwmac4_set_mac_loopback,
 	.sarc_configure = dwmac4_sarc_configure,
-	.set_arp_offload = dwmac4_set_arp_offload,
 	.config_l3_filter = dwmac4_config_l3_filter,
 	.config_l4_filter = dwmac4_config_l4_filter,
 	.fpe_map_preemption_class = dwmac5_fpe_map_preemption_class,
@@ -1045,7 +1027,6 @@ const struct stmmac_ops dwmac510_ops = {
 	.flex_pps_config = dwmac5_flex_pps_config,
 	.set_mac_loopback = dwmac4_set_mac_loopback,
 	.sarc_configure = dwmac4_sarc_configure,
-	.set_arp_offload = dwmac4_set_arp_offload,
 	.config_l3_filter = dwmac4_config_l3_filter,
 	.config_l4_filter = dwmac4_config_l4_filter,
 	.fpe_map_preemption_class = dwmac5_fpe_map_preemption_class,
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +0 -18
index fc6ddb51c682..1a88cbaed70c 100644
@@ -1410,22 +1410,6 @@ static int dwxgmac2_config_l4_filter(struct mac_device_info *hw, u32 filter_no,
 	return 0;
 }
 
-static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en,
-				     u32 addr)
-{
-	void __iomem *ioaddr = hw->pcsr;
-	u32 value;
-
-	writel(addr, ioaddr + XGMAC_ARP_ADDR);
-
-	value = readl(ioaddr + XGMAC_RX_CONFIG);
-	if (en)
-		value |= XGMAC_CONFIG_ARPEN;
-	else
-		value &= ~XGMAC_CONFIG_ARPEN;
-	writel(value, ioaddr + XGMAC_RX_CONFIG);
-}
-
 const struct stmmac_ops dwxgmac210_ops = {
 	.core_init = dwxgmac2_core_init,
 	.irq_modify = dwxgmac2_irq_modify,
@@ -1464,7 +1448,6 @@ const struct stmmac_ops dwxgmac210_ops = {
 	.sarc_configure = dwxgmac2_sarc_configure,
 	.config_l3_filter = dwxgmac2_config_l3_filter,
 	.config_l4_filter = dwxgmac2_config_l4_filter,
-	.set_arp_offload = dwxgmac2_set_arp_offload,
 	.fpe_map_preemption_class = dwxgmac3_fpe_map_preemption_class,
 };
 
@@ -1519,7 +1502,6 @@ const struct stmmac_ops dwxlgmac2_ops = {
 	.sarc_configure = dwxgmac2_sarc_configure,
 	.config_l3_filter = dwxgmac2_config_l3_filter,
 	.config_l4_filter = dwxgmac2_config_l4_filter,
-	.set_arp_offload = dwxgmac2_set_arp_offload,
 	.fpe_map_preemption_class = dwxgmac3_fpe_map_preemption_class,
 };
 
drivers/net/ethernet/stmicro/stmmac/hwif.h +0 -3
index 04dafec021b4..fe18f98fae45 100644
@@ -407,7 +407,6 @@ struct stmmac_ops {
 	int (*config_l4_filter)(struct mac_device_info *hw, u32 filter_no,
 				bool en, bool udp, bool sa, bool inv,
 				u32 match);
-	void (*set_arp_offload)(struct mac_device_info *hw, bool en, u32 addr);
 	int (*fpe_map_preemption_class)(struct net_device *ndev,
 					struct netlink_ext_ack *extack,
 					u32 pclass);
@@ -491,8 +490,6 @@ struct stmmac_ops {
 	stmmac_do_callback(__priv, mac, config_l3_filter, __args)
 #define stmmac_config_l4_filter(__priv, __args...) \
 	stmmac_do_callback(__priv, mac, config_l4_filter, __args)
-#define stmmac_set_arp_offload(__priv, __args...) \
-	stmmac_do_void_callback(__priv, mac, set_arp_offload, __args)
 #define stmmac_fpe_map_preemption_class(__priv, __args...) \
 	stmmac_do_void_callback(__priv, mac, fpe_map_preemption_class, __args)
 
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +0 -112

130 lines not on this page · raw message

Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Maxime

Quoted 16 lines · Maxime Chevallier

dwmac can do ARP offloading, where the HW replies to incoming ARP requests. This requires multiple steps to work well :
- Program the local IP address in a dedicated register
- Enable ARP offloading

This is halfway implemented in stmmac, as it's only ever used by selftests, and these selftests are failing on at least 2 platforms :
stm32mp1, and jh7110.

There have been some attempts in the past to support this feature, but this never made it upstream. Let's just remove the test and that code, until someone actually wants that to work. We should likely have a proper API for that so that drivers can use it.

Let's also not mention ARP offload in the stmmac documentation.

Quoted 7 lines

Leave the defines in place and the capability detection, this doesn't hurt and gives some information about how the IP is synthesized.

---

[...]

Thanks,
Nicolai

#2 lore raw
In reply to Maxime Chevallier
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 10 lines · On Mon, 31 Aug 2026 09:13:50 +0200 you wrote:

dwmac can do ARP offloading, where the HW replies to incoming ARP requests. This requires multiple steps to work well :
- Program the local IP address in a dedicated register
- Enable ARP offloading

This is halfway implemented in stmmac, as it's only ever used by selftests, and these selftests are failing on at least 2 platforms :
stm32mp1, and jh7110.

[...]

Here is the summary with links:
- [net-next] net: stmmac: Remove ARP offload code

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

You are awesome, thank you!

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