From: Konrad Leszczynski <konrad.leszczynski@intel.com>
To: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
cezary.rojewski@intel.com, sebastian.basierski@intel.com,
Karol Jurczenia <karol.jurczenia@intel.com>,
Konrad Leszczynski <konrad.leszczynski@intel.com>
Subject: [PATCH net-next 1/4] net: stmmac: enable ARP Offload on mac_link_up()
Date: Thu, 28 Aug 2025 16:45:55 +0200 [thread overview]
Message-ID: <20250828144558.304304-2-konrad.leszczynski@intel.com> (raw)
In-Reply-To: <20250828144558.304304-1-konrad.leszczynski@intel.com>
From: Karol Jurczenia <karol.jurczenia@intel.com>
Add Address Resolution Protocol (ARP) Offload support in
stmmac_mac_link_up() to enable ARP Offload beside the selftests.
Introduce STMMAC_FLAG_ARP_OFFLOAD_EN flag, which is used to enable the
feature with the stmmac_set_arp_offload().
Reviewed-by: Sebastian Basierski <sebastian.basierski@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Karol Jurczenia <karol.jurczenia@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++++++
include/linux/stmmac.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index fa3d26c28502..244ef484bb88 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -40,6 +40,7 @@
#include <linux/phylink.h>
#include <linux/udp.h>
#include <linux/bpf_trace.h>
+#include <linux/inetdevice.h>
#include <net/page_pool/helpers.h>
#include <net/pkt_cls.h>
#include <net/xdp_sock_drv.h>
@@ -964,6 +965,8 @@ static void stmmac_mac_link_up(struct phylink_config *config,
bool tx_pause, bool rx_pause)
{
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
+ struct in_device *in_dev;
+ struct in_ifaddr *ifa;
unsigned int flow_ctrl;
u32 old_ctrl, ctrl;
int ret;
@@ -1076,6 +1079,21 @@ static void stmmac_mac_link_up(struct phylink_config *config,
if (priv->plat->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
stmmac_hwtstamp_correct_latency(priv, priv);
+
+ if (priv->plat->flags & STMMAC_FLAG_ARP_OFFLOAD_EN) {
+ in_dev = in_dev_get(priv->dev);
+ if (!in_dev)
+ return;
+
+ rcu_read_lock();
+ ifa = rcu_dereference(in_dev->ifa_list);
+ if (ifa)
+ stmmac_set_arp_offload(priv, priv->hw, true,
+ ntohl(ifa->ifa_address));
+ rcu_read_unlock();
+
+ __in_dev_put(in_dev);
+ }
}
static void stmmac_mac_disable_tx_lpi(struct phylink_config *config)
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index e284f04964bf..afb45d8eb840 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -185,6 +185,7 @@ struct dwmac4_addrs {
#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)
#define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(12)
#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(13)
+#define STMMAC_FLAG_ARP_OFFLOAD_EN BIT(14)
struct plat_stmmacenet_data {
int bus_id;
--
2.34.1
next prev parent reply other threads:[~2025-08-28 14:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 14:45 [PATCH net-next 0/4] net: stmmac: new features Konrad Leszczynski
2025-08-28 14:45 ` Konrad Leszczynski [this message]
2025-08-28 14:45 ` [PATCH net-next 2/4] net: stmmac: set TE/RE bits for ARP Offload when interface down Konrad Leszczynski
2025-08-28 14:45 ` [PATCH net-next 3/4] net: stmmac: enhance VLAN protocol detection for GRO Konrad Leszczynski
2025-08-28 14:45 ` [PATCH net-next 4/4] net: stmmac: add TC flower filter support for IP EtherType Konrad Leszczynski
2025-08-29 21:23 ` [PATCH net-next 0/4] net: stmmac: new features Jacob Keller
2025-08-30 2:46 ` Joseph Steel
2025-09-02 21:02 ` Jacob Keller
2025-09-02 21:17 ` Andrew Lunn
2025-09-03 17:01 ` Cezary Rojewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250828144558.304304-2-konrad.leszczynski@intel.com \
--to=konrad.leszczynski@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=cezary.rojewski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=karol.jurczenia@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sebastian.basierski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).