[PATCH net-next 6/8] netconsole: move push_udp() from netpoll
From: Breno Leitao
Date: Fri May 08 2026 - 09:35:15 EST
push_udp() builds the UDP header (and triggers the checksum) for
netconsole's UDP packets. Move it into drivers/net/netconsole.c as
a file-static helper; drop its EXPORT_SYMBOL_GPL and remove the
prototype from include/linux/netpoll.h.
push_udp() was the last udp_hdr() consumer in net/core/netpoll.c,
so swap <net/udp.h> for <linux/udp.h> there: MAX_SKB_SIZE still
needs struct udphdr.
Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
drivers/net/netconsole.c | 18 ++++++++++++++++++
include/linux/netpoll.h | 1 -
net/core/netpoll.c | 21 +--------------------
3 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index bcedc161b13ec..e8d96e482fe05 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -1652,6 +1652,24 @@ static struct notifier_block netconsole_netdev_notifier = {
.notifier_call = netconsole_netdev_event,
};
+static void push_udp(struct netpoll *np, struct sk_buff *skb, int len)
+{
+ struct udphdr *udph;
+ int udp_len;
+
+ udp_len = len + sizeof(struct udphdr);
+
+ skb_push(skb, sizeof(struct udphdr));
+ skb_reset_transport_header(skb);
+
+ udph = udp_hdr(skb);
+ udph->source = htons(np->local_port);
+ udph->dest = htons(np->remote_port);
+ udph->len = htons(udp_len);
+
+ netpoll_udp_checksum(np, skb, len);
+}
+
static void push_eth(struct netpoll *np, struct sk_buff *skb)
{
struct ethhdr *eth;
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 11eb95b3248e2..03a49953a3d8a 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -75,7 +75,6 @@ void do_netpoll_cleanup(struct netpoll *np);
netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
struct sk_buff *find_skb(struct netpoll *np, int len, int reserve);
void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, int len);
-void push_udp(struct netpoll *np, struct sk_buff *skb, int len);
#ifdef CONFIG_NETPOLL
static inline void *netpoll_poll_lock(struct napi_struct *napi)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 12165667705f3..4ec9e309dfe6c 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -29,8 +29,8 @@
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/if_vlan.h>
+#include <linux/udp.h>
#include <net/tcp.h>
-#include <net/udp.h>
#include <net/addrconf.h>
#include <net/ndisc.h>
#include <net/ip6_checksum.h>
@@ -412,25 +412,6 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
}
EXPORT_SYMBOL(netpoll_send_skb);
-void push_udp(struct netpoll *np, struct sk_buff *skb, int len)
-{
- struct udphdr *udph;
- int udp_len;
-
- udp_len = len + sizeof(struct udphdr);
-
- skb_push(skb, sizeof(struct udphdr));
- skb_reset_transport_header(skb);
-
- udph = udp_hdr(skb);
- udph->source = htons(np->local_port);
- udph->dest = htons(np->remote_port);
- udph->len = htons(udp_len);
-
- netpoll_udp_checksum(np, skb, len);
-}
-EXPORT_SYMBOL_GPL(push_udp);
-
static void skb_pool_flush(struct netpoll *np)
{
struct sk_buff_head *skb_pool;
--
2.53.0-Meta