[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250627-netpoll_untagle_ip-v1-6-61a21692f84a@debian.org>
Date: Fri, 27 Jun 2025 10:55:52 -0700
From: Breno Leitao <leitao@...ian.org>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Andrew Lunn <andrew+netdev@...n.ch>, Shuah Khan <shuah@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, Breno Leitao <leitao@...ian.org>,
gustavold@...il.com
Subject: [PATCH net-next 6/7] netpoll: move Ethernet setup to push_eth()
helper
Refactor Ethernet header population into dedicated function, completing
the layered abstraction with:
- push_eth() for link layer
- push_udp() for transport
- push_ipv4()/push_ipv6() for network
Signed-off-by: Breno Leitao <leitao@...ian.org>
---
net/core/netpoll.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 70035e27d91cc..9ab3cf78a393c 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -491,11 +491,19 @@ static void push_udp(struct netpoll *np, struct sk_buff *skb, int len)
netpoll_udp_checksum(np, skb, len);
}
+static void push_eth(struct netpoll *np, struct sk_buff *skb)
+{
+ struct ethhdr *eth;
+
+ eth = eth_hdr(skb);
+ ether_addr_copy(eth->h_source, np->dev->dev_addr);
+ ether_addr_copy(eth->h_dest, np->remote_mac);
+}
+
int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
{
int total_len, ip_len, udp_len;
struct sk_buff *skb;
- struct ethhdr *eth;
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
WARN_ON_ONCE(!irqs_disabled());
@@ -521,11 +529,7 @@ int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
push_ipv6(np, skb, len);
else
push_ipv4(np, skb, len);
-
- eth = eth_hdr(skb);
- ether_addr_copy(eth->h_source, np->dev->dev_addr);
- ether_addr_copy(eth->h_dest, np->remote_mac);
-
+ push_eth(np, skb);
skb->dev = np->dev;
return (int)netpoll_send_skb(np, skb);
--
2.47.1
Powered by blists - more mailing lists