From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A59E395AE4; Tue, 12 May 2026 10:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582917; cv=none; b=H+3zPXofqA+Nk9R7DwQPwT42P5QE+Q/fPKCNeC9LjMvr6koUs5MKdOb0ulL931nVOt5kYzwLPU3sBzawlEx27Fi6msWOgb+NN3YW3sSK64yCPs7igMSH+R4jlEOdwyfF94PxVT3uoLIs6a9LzPM36tu1W7Ohg7ySFqbn/SdOA0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582917; c=relaxed/simple; bh=07fpaNueP6L3dRf3qAgX/iGIbF3PMuZyCj3Rbbal+1s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e31jcyMaFeyNxkeKjq76pGN5Z0Reanfkq3bUK8FZqmD/C2foeWe+7rJtA1LiyyLRkM4TVNhnPNpUFmTCHRxRDVPSTS8rAUlhLM60SdBYCTS9rVJGSfo8rPelvPvJLf8SU6dEjlQmBVKpvJnG31nADPlOkVJVjYhZg3aMUAcIfJY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=uTbKbL9k; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="uTbKbL9k" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=yVdjh0Hy07tpCUlFlB396VlkTSHh7UpPORhLbR9du7k=; b=uTbKbL9k9NG1WXWvLGNg5BBLFT 8i87gsU1xTLMIaigkvL+lGGNUxGzyDEsCJoV68l2o8ZP+D+uM15MQ3RRNTr02qDBpgHW7By7JcEzr aLEYAkBjOTmNhdwNAm/VIbvZrH8ouO6xzB+NWqBEb7Nf67UcrZiqGW6VnVIl2WagLEsnLTfDJLP00 7Sv4AlL8xLA4dKNGKgvpy8pjVoq8UrEHBFYCM1rNPlPAm7EVuuGSaodbg634Qqw2eQ0Zd/PcgH3g2 ga3IK7qU4TjAXyBh909NNgHv8HPw66WHYpcd9KWhQxwKt7+cGY9Y5iZsGtf+jJIX8RUI2hxQNF3a6 tHJ1Hqsg==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkez-002K1N-28; Tue, 12 May 2026 10:48:21 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:34 -0700 Subject: [PATCH net-next v2 1/9] netpoll: expose UDP packet builder helpers for netconsole Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-1-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4355; i=leitao@debian.org; h=from:subject:message-id; bh=07fpaNueP6L3dRf3qAgX/iGIbF3PMuZyCj3Rbbal+1s=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrcrsvPmME5oqQnZbk7whQQn3mi1pmT6sSJ fQegAs9HnSJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bbMrD/9CRDhCXIutckTm7iTek7SDX2rcXDv2BL3998vvg78RsC5hv70ClL3ZcsiCLn0an4xcA5g 9/EICpHLXLHbj86VxDt2dbujONHvY9b77ryFQW030hDln9QyPVJiAEuCw8+XptnTLWRVRvoCqkv lXxSk+SM+LvNG5A3fUA/H/4bkHYTkD1KFox+mvsKxHd9Uqq+ChWhCMXO0sNiXX9SSVUVW0uG9lX K2Vzy3NQYmfJk1t53vpPJkMR7FUXERuUdOYZ27Zg0tzzhBvinCy2a5mCXndm/oubZ4vWPue3jYk 5LxG5GANTeDvGnYMpKX668mhZvTuGGDJb5XJX5QKpkjWq9TbWpQWIsDdY4/ql7+JTGJna+S+RyZ 4lZ35ybckazvuxrpONvLV9XSq4T8Kyv/lEPCrjk76pap+/Vxa/f2jYkp6NdbKvs3vemjGQql/8i m1iaNfppu3EmLVQ0aDQpgubmI/nhxWdfeUvAbhbCd/wD4jz/YeWIjid21jgE6qz28lG4CMN8+6s MXy/n2OzpqTKDom/DAJP3wkG+Mn4X7foz4+WUM0Ht2Mufm5cejwUU/LHUXHh97B08track5O++u xVG2GwCSvD0Jq4o0InWTxyyrYxNBh+YibY+03o0N3raUYtDy9Dlkw3B7RYvXalhE9hLoQngk+yr rmCzXV3f1s5N16A== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Promote each from file-static to EXPORT_SYMBOL_GPL and forward- declare them in include/linux/netpoll.h so netconsole can call them once netpoll_send_udp() moves out. These exports are kept until the end of the series, when al of them move into netconsole. No functional change. Signed-off-by: Breno Leitao --- include/linux/netpoll.h | 6 ++++++ net/core/netpoll.c | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index f22eec4660405..e68c80b329411 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -74,6 +74,12 @@ void __netpoll_free(struct netpoll *np); void netpoll_cleanup(struct netpoll *np); 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_ipv6(struct netpoll *np, struct sk_buff *skb, int len); +void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len); +void push_udp(struct netpoll *np, struct sk_buff *skb, int len); +void push_eth(struct netpoll *np, struct sk_buff *skb); =20 #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 84faace50ac28..41305056c56ff 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -268,7 +268,7 @@ static void zap_completion_queue(void) put_cpu_var(softnet_data); } =20 -static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) +struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) { int count =3D 0; struct sk_buff *skb; @@ -294,6 +294,7 @@ static struct sk_buff *find_skb(struct netpoll *np, int= len, int reserve) skb_reserve(skb, reserve); return skb; } +EXPORT_SYMBOL_GPL(find_skb); =20 static int netpoll_owner_active(struct net_device *dev) { @@ -369,8 +370,8 @@ static netdev_tx_t __netpoll_send_skb(struct netpoll *n= p, struct sk_buff *skb) return ret; } =20 -static void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, - int len) +void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, + int len) { struct udphdr *udph; int udp_len; @@ -393,6 +394,7 @@ static void netpoll_udp_checksum(struct netpoll *np, st= ruct sk_buff *skb, if (udph->check =3D=3D 0) udph->check =3D CSUM_MANGLED_0; } +EXPORT_SYMBOL_GPL(netpoll_udp_checksum); =20 netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) { @@ -411,7 +413,7 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struct= sk_buff *skb) } EXPORT_SYMBOL(netpoll_send_skb); =20 -static void push_ipv6(struct netpoll *np, struct sk_buff *skb, int len) +void push_ipv6(struct netpoll *np, struct sk_buff *skb, int len) { struct ipv6hdr *ip6h; =20 @@ -433,8 +435,9 @@ static void push_ipv6(struct netpoll *np, struct sk_buf= f *skb, int len) =20 skb->protocol =3D htons(ETH_P_IPV6); } +EXPORT_SYMBOL_GPL(push_ipv6); =20 -static void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) +void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) { static atomic_t ip_ident; struct iphdr *iph; @@ -460,8 +463,9 @@ static void push_ipv4(struct netpoll *np, struct sk_buf= f *skb, int len) iph->check =3D ip_fast_csum((unsigned char *)iph, iph->ihl); skb->protocol =3D htons(ETH_P_IP); } +EXPORT_SYMBOL_GPL(push_ipv4); =20 -static void push_udp(struct netpoll *np, struct sk_buff *skb, int len) +void push_udp(struct netpoll *np, struct sk_buff *skb, int len) { struct udphdr *udph; int udp_len; @@ -478,8 +482,9 @@ static void push_udp(struct netpoll *np, struct sk_buff= *skb, int len) =20 netpoll_udp_checksum(np, skb, len); } +EXPORT_SYMBOL_GPL(push_udp); =20 -static void push_eth(struct netpoll *np, struct sk_buff *skb) +void push_eth(struct netpoll *np, struct sk_buff *skb) { struct ethhdr *eth; =20 @@ -492,6 +497,7 @@ static void push_eth(struct netpoll *np, struct sk_buff= *skb) else eth->h_proto =3D htons(ETH_P_IP); } +EXPORT_SYMBOL_GPL(push_eth); =20 int netpoll_send_udp(struct netpoll *np, const char *msg, int len) { --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86A2B384CDA; Tue, 12 May 2026 10:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582918; cv=none; b=JjfEODs76tiGF905j1E6ZaVMsKtmk1PVNqQIEzXVPl9syk4K+l3bpDCjaFnCY9Hf21z3abOncl6dOJ6ByzDMifKWCaUGvI+r2t6op4UIXA6dLWxyMihddA5RX6mZukbue8vynTBfTnWIPyZMHO264aNVu1ZfH65uhBkeMYJdlbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582918; c=relaxed/simple; bh=g51YoIxKxK7pAG4HD08tG6mrbm89uoSU90lVR64Mqdc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XqpulSXT5cOVyp6HzrQpyCUu9CmCqLWhwIhezp8zHk2Wym/1gmOC8SSKqCR5Fi9dSzsMyGf9GXW4wTepNYr/rU3+RVhFlTKvZ2iYq14zk/w9j0LpIA8ikeIvPzFbTmBqVfhvPLo4ocL/FSZlCkQb/ymbOaQhIz/abzCplmbofsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=AW5y2Kh2; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="AW5y2Kh2" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=kCBhypCSxo5qvVndamNwauiU6sS5fgJGsBY2nx0+uIo=; b=AW5y2Kh2IaYC+A6DSyviRzZMO3 W7p92ht908R5ydBqA0xXKpRaF+kQK484HPWZd/aOwVT32AUEGYJNTCvlFKywPI8MNS9+v6ATr6rmt yW+o1ok4Yk5trqA1tqfphXKK2XMd5AEdTIf3DHLFruX4osev+IPnna28FwuAFTfcaKr0MnaAPicQB x2khFbcgtdXfLHMN9cHrMtNDINGcTCEyYPM46zRABeSybOyCYGb+KPhNlHdH3tEhCCcBMt4/W3LZH e3Sej7Yi36kduAxqpS23yaEnevu7YfFLlhbhLBXD4eHRkZqDCWsMm9cWe+5X1E4qm1tfdTVE3R507 Pv+iA2fQ==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkf4-002K1P-1q; Tue, 12 May 2026 10:48:26 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:35 -0700 Subject: [PATCH net-next v2 2/9] netconsole: move netpoll_send_udp() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-2-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4492; i=leitao@debian.org; h=from:subject:message-id; bh=g51YoIxKxK7pAG4HD08tG6mrbm89uoSU90lVR64Mqdc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrauihravVKRdjFaNJKJIeaP4MpTlNA9JNb GULtmiD+1yJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bYwUD/9NwN0txHpu9FdmhlUxzm0uB1+C9D0Hwi77e0oBJ4fSI8/tmhilh7MHk8Ww61hzh8jtKQA 6H/wkq/F6dqhH3j8a9Ipaz520wAo8j/kOB+aTQtOVAvPQ/UP9fwR8guHT9h5Lx01unF5gSGbtx0 WXZcPTxrbg4ZFpSp76cgf5+KeB/8E0caRAC0T1OFvxiW/Q8cHXVxGBB+Cv/++iYW5zxSbggHNjv FQerag6bTL8nkPYpJovDEQkfJTrkjFqi8JGRC8T9FrmLdrRrV8fbBvgtQDYSAiHO+65FF/DBZQv rD9x0fX6DMhS4C7uTyOI7pHc7ylTR1p36rVkprsEJVz2iqx3VgB3C1Ta21mtq7s4mQqNTl4U0JE aEk6Q9QIPKJ1tpjHWO5Yy6oP4Fu82AuGID0JSZwILbaugfL/Yvex9g/BAZTbAAP2k9kMjVbngcq bVn+zblHyXexEg8n4QukzW65MtLby8Pj/Tv0S6s6ntF1xsMWxacMUDFM7XDK/MWyf1qstqHvUic +q+icc5UVsd04efQfpsSVg4TvCm/ANDmYAdIkxL+jXgfljE+ovenJ2Z30Li0QhlI84dr7Ram9ls TPkan98zY6gBYKaq4t8AFkAkHqk+Njapwx52/Qy6aSpwapPizd/5c+ti0ZdF9deBvccDxUsiD0t dFbN/ciwGaaR/kQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Move netpoll_send_udp() from net/core/netpoll.c into drivers/net/netconsole.c as a static helper, drop EXPORT_SYMBOL(), and remove the prototype from include/linux/netpoll.h. netconsole was the only in-tree caller of this entry point. Every other netpoll consumer (bonding, team, vlan, bridge, macvlan, dsa) already builds its own sk_buff and hands it to netpoll_send_skb(), so the netpoll send-side interface is now skb-only. The helpers it depends on (find_skb(), push_ipv6(), push_ipv4(), push_udp(), push_eth(), netpoll_udp_checksum()) were exposed in the previous patches and stay in net/core/netpoll.c for now. Subsequent patches move each of them into netconsole one at a time and drop the corresponding EXPORT_SYMBOL_GPL. Pull , and into netconsole.c so the moved code can name the header structures. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 38 ++++++++++++++++++++++++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 37 ------------------------------------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 57dd6821a8aa9..56f310041ebda 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -1648,6 +1651,41 @@ static struct notifier_block netconsole_netdev_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static int netpoll_send_udp(struct netpoll *np, const char *msg, int len) +{ + int total_len, ip_len, udp_len; + struct sk_buff *skb; + + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) + WARN_ON_ONCE(!irqs_disabled()); + + udp_len =3D len + sizeof(struct udphdr); + if (np->ipv6) + ip_len =3D udp_len + sizeof(struct ipv6hdr); + else + ip_len =3D udp_len + sizeof(struct iphdr); + + total_len =3D ip_len + LL_RESERVED_SPACE(np->dev); + + skb =3D find_skb(np, total_len + np->dev->needed_tailroom, + total_len - len); + if (!skb) + return -ENOMEM; + + skb_copy_to_linear_data(skb, msg, len); + skb_put(skb, len); + + push_udp(np, skb, len); + if (np->ipv6) + push_ipv6(np, skb, len); + else + push_ipv4(np, skb, len); + push_eth(np, skb); + skb->dev =3D np->dev; + + return (int)netpoll_send_skb(np, skb); +} + /** * send_udp - Wrapper for netpoll_send_udp that counts errors * @nt: target to send message to diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index e68c80b329411..57be72bb82dc9 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -67,7 +67,6 @@ static inline void netpoll_poll_disable(struct net_device= *dev) { return; } static inline void netpoll_poll_enable(struct net_device *dev) { return; } #endif =20 -int netpoll_send_udp(struct netpoll *np, const char *msg, int len); int __netpoll_setup(struct netpoll *np, struct net_device *ndev); int netpoll_setup(struct netpoll *np); void __netpoll_free(struct netpoll *np); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 41305056c56ff..39209308efad0 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -499,43 +499,6 @@ void push_eth(struct netpoll *np, struct sk_buff *skb) } EXPORT_SYMBOL_GPL(push_eth); =20 -int netpoll_send_udp(struct netpoll *np, const char *msg, int len) -{ - int total_len, ip_len, udp_len; - struct sk_buff *skb; - - if (!IS_ENABLED(CONFIG_PREEMPT_RT)) - WARN_ON_ONCE(!irqs_disabled()); - - udp_len =3D len + sizeof(struct udphdr); - if (np->ipv6) - ip_len =3D udp_len + sizeof(struct ipv6hdr); - else - ip_len =3D udp_len + sizeof(struct iphdr); - - total_len =3D ip_len + LL_RESERVED_SPACE(np->dev); - - skb =3D find_skb(np, total_len + np->dev->needed_tailroom, - total_len - len); - if (!skb) - return -ENOMEM; - - skb_copy_to_linear_data(skb, msg, len); - skb_put(skb, len); - - push_udp(np, skb, len); - if (np->ipv6) - push_ipv6(np, skb, len); - else - push_ipv4(np, skb, len); - push_eth(np, skb); - skb->dev =3D np->dev; - - return (int)netpoll_send_skb(np, skb); -} -EXPORT_SYMBOL(netpoll_send_udp); - - static void skb_pool_flush(struct netpoll *np) { struct sk_buff_head *skb_pool; --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C29E72F99B8; Tue, 12 May 2026 10:48:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582918; cv=none; b=gUW2ARtx9nKcOKc1B6dU78VKhf+4YpHV9mWMWgV8LfiTPe0ToHkz5e48hT6XzU8XH/ZV8csttMTQmpbvohQr9PIpVzqMknaaj/r2XVlgkNG7IhxVCq1fNmGkqgc81SpYWS8CZqOGbR7wHmBmQMVKLC3kZoucMgfTC8iEgnQmYSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582918; c=relaxed/simple; bh=mxUAmZ420X85haUIzTp19glhWGQdZTf/bXmydQ7s+/8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pG0jIvvDqUZQ9QoAA3qalA18Tp8Gy9yKNNtTkn0CSfbVmTyuSPH01ZDiZt82TKnr9QTimUrcsZkC+SyPbJHPyhNDij39mcpt1KDXG7YhIS8H2fOnlJyyCSKmtlE87fTEKZWgoBy8/KU+2foFXCSzmcsH/1qvmc0HbJY/ZcyOVss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=hPx7PY0B; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="hPx7PY0B" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=LesysH0/MXvQZiIFUdo6p+9o+QMWkku83rRBrC3W1pg=; b=hPx7PY0BxebRciZVujWrG+O1sK +48MnAoSLvQFj2KfqR8cMHccbHDFyYUo7RdyWur7nFUGYUNMROilgMTLx1VFdCKgUGblidx4EWVll ng7e9G0T3+h0h/++xMXlOOxTSTOvecOIZ+lx3cigKsXfjQHLHKROijIdj4x3o9MtMRTpuk3aeeoqa IqasY+uOrTkBggsix4/mjoFhz2M5eD3CR9Ho6XF2714BVIwujotavvmwVEwdUveJePeQFCEG86bBB tluJAvirlKWwhciY8jAAo2aHpQGClTErbV20j+9CYZOlHA62+qBErH1kil0RIEKyhktTX0d5GoLJY /l4ZxufQ==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkf8-002K1g-2v; Tue, 12 May 2026 10:48:31 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:36 -0700 Subject: [PATCH net-next v2 3/9] netconsole: move push_ipv6() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-3-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=3314; i=leitao@debian.org; h=from:subject:message-id; bh=mxUAmZ420X85haUIzTp19glhWGQdZTf/bXmydQ7s+/8=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrBwrxNSqorccZj9Dp1HkWwwLY42YsPJcOS FT+3Vk+vjWJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bfmPEACv+FHlLksLvTMxFXgjiLrNFrGpumEDz+L12Exoo6CtizCmOmJgaiiwox3FjAP0LvYmXlt vnoJjyFXAz3l/pkg6TY/WHVFfwlvB9ZRi0KoRteoa23D65e2QSdIvJT9OGCaPU+lb2CQrMMzNL4 TFScAedxuuAw+xha4evDm9Up0Z8myl7PRD2mwa52neb6YTakdwZ4CrxzCy3LH+gD+Fp+WiALdKf sF901VCk+wZxhZWUOdK8GLhf6sYkD716e64SxDSXmNYtkG+1Y6xkPV8aaLIG5DW0YM/WVJxQ+zB TxuswtB8qmhCP2tjEJGeblbPzdhzqdQCj4zQ8g4JnMV7mtu3D3pXWpkO967fYlaTUzY9SnP1SPZ IEsJe56eVMfm9fbzJwuyKTKGI8ULxAbptmnrz5z25Q+nlns0bpSdIi0Xa6yMtSuFXjce+Jg0Lf1 6oK018KJsmCXgpQIVkw+Gsv7JLn34WnmLe4AVliheeB1561WyRC7MNFVUGEYSDc/gs1NqdSEy3g Kl1xZAxoQ6TBH8V/S7+kP/2uPZ6atSkJVx7mWUkh22sLdQNjbCMPCPD+fLSQ6Fu4TN3+fIfy6P5 o5cBUMRnI+i/6mSMAPmAhWuMrJLAkDhr9DfzhFnSnRjNePBugszcLbC7QxA5PtlStxUeN5kIZBp Sz5XtW80MnMC4Ig== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao push_ipv6() builds the IPv6 header for netconsole's UDP packets. Its only caller, netpoll_send_udp(), now lives in netconsole, so the helper can move there as a file-static function. Drop its EXPORT_SYMBOL_GPL and remove the prototype from include/linux/netpoll.h. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 23 +++++++++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 24 ------------------------ 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 56f310041ebda..f805ae95ce7b1 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1651,6 +1651,29 @@ static struct notifier_block netconsole_netdev_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static void push_ipv6(struct netpoll *np, struct sk_buff *skb, int len) +{ + struct ipv6hdr *ip6h; + + skb_push(skb, sizeof(struct ipv6hdr)); + skb_reset_network_header(skb); + ip6h =3D ipv6_hdr(skb); + + /* ip6h->version =3D 6; ip6h->priority =3D 0; */ + *(unsigned char *)ip6h =3D 0x60; + ip6h->flow_lbl[0] =3D 0; + ip6h->flow_lbl[1] =3D 0; + ip6h->flow_lbl[2] =3D 0; + + ip6h->payload_len =3D htons(sizeof(struct udphdr) + len); + ip6h->nexthdr =3D IPPROTO_UDP; + ip6h->hop_limit =3D 32; + ip6h->saddr =3D np->local_ip.in6; + ip6h->daddr =3D np->remote_ip.in6; + + skb->protocol =3D htons(ETH_P_IPV6); +} + static int netpoll_send_udp(struct netpoll *np, const char *msg, int len) { int total_len, ip_len, udp_len; diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 57be72bb82dc9..7f57bd0eac66d 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_ipv6(struct netpoll *np, struct sk_buff *skb, int len); void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len); void push_udp(struct netpoll *np, struct sk_buff *skb, int len); void push_eth(struct netpoll *np, struct sk_buff *skb); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 39209308efad0..6a10ca5eaa093 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -413,30 +413,6 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struc= t sk_buff *skb) } EXPORT_SYMBOL(netpoll_send_skb); =20 -void push_ipv6(struct netpoll *np, struct sk_buff *skb, int len) -{ - struct ipv6hdr *ip6h; - - skb_push(skb, sizeof(struct ipv6hdr)); - skb_reset_network_header(skb); - ip6h =3D ipv6_hdr(skb); - - /* ip6h->version =3D 6; ip6h->priority =3D 0; */ - *(unsigned char *)ip6h =3D 0x60; - ip6h->flow_lbl[0] =3D 0; - ip6h->flow_lbl[1] =3D 0; - ip6h->flow_lbl[2] =3D 0; - - ip6h->payload_len =3D htons(sizeof(struct udphdr) + len); - ip6h->nexthdr =3D IPPROTO_UDP; - ip6h->hop_limit =3D 32; - ip6h->saddr =3D np->local_ip.in6; - ip6h->daddr =3D np->remote_ip.in6; - - skb->protocol =3D htons(ETH_P_IPV6); -} -EXPORT_SYMBOL_GPL(push_ipv6); - void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) { static atomic_t ip_ident; --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46EA33AC0FD; Tue, 12 May 2026 10:48:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582920; cv=none; b=Z1Gq1HFA2J+oesGLK/3xg/RdNkut/ZpX7V1/iAEs+rLNtGpjwRWrehwDBuqnoF9Qaao/f8fuO4zDbdW1m0byEFczVONSjWU4Vz0GYXSSgrJXzlndpm8VogsoDAbbO7yiKtjWWJ+phJpeMXlgM7rN+jATVrkOwBhCO8Md6qmCgx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582920; c=relaxed/simple; bh=cLO+HVbzM/630mHJi4qoFZSolx/5RGQx4SlxSfx1DMg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZaavbjYsiCYnl/FI9V355ARyyph8kszrPkH9w5XUpSUxW/wdA33XU8Re2esWfO6hIwGJuHxS4CIvPj9Nfqep0+OBb2qc08NbPj5ctg/weV2DRUpwt6cXiI3BZnn++pdEZQvHO6z91dWhoH9XbZ5urHVfDsG9XOwO3bA4OPnP0Qk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=Wqo68ZF6; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="Wqo68ZF6" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=NzIMdK4kCc1Qj9zvLOEZvz2a+qMp6//MJYzsoIv7p4Q=; b=Wqo68ZF6IBcHxPrQDJ7Zh3G7x1 GfSMimyfvPyBKFFfOIikexKomtxiJHsCNbGnzWqHjHJvZswjr6Xd9kZL9uit/n/S2gf9jkoFVfGPq 1yxy2ECfQKsQQJHYw1iZO791h/9ozMIceo6fWvOAB8QCqSMv6xq7o2jVu004QIv0Kwx+KqtxjbxQb +9Up3yhEGnWVvl1hVnI8JQWxGU3S0Ex3jaUF3qDZzKb2S7gCKcL4pkeXniZDrpoxTf86Jpzc8lyFJ zSD/z2m5MrAFVz+fQ71HX1YSKm31TjdWyyBw0i0dzBFmz/999u7qw+R5fIq4Nm0TMvdi0Oxpquj19 /thmn8mQ==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkfD-002K1w-0Q; Tue, 12 May 2026 10:48:35 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:37 -0700 Subject: [PATCH net-next v2 4/9] netconsole: move push_ipv4() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-4-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4161; i=leitao@debian.org; h=from:subject:message-id; bh=cLO+HVbzM/630mHJi4qoFZSolx/5RGQx4SlxSfx1DMg=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrtJFMo64itpwYoOPT/42kQwswYfQRDOn+Z 5Tofoph/meJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bcLzD/4zBgdB9CzslQqLOISaprRg99F0EAL2qEHrpwemgRnxIor1ZdZtuXTVcxf/WBhTTXjg4SW btSuOX7FpZGhcuzIIhsW2qw6FBNIBGLEI49H+FpJ+ld4d83T/exDTSKBTFOT4h7oi0hCOHPeCeW tlByO6IdMXe8lPc70MnT9aw7i/soJYkAVqZCwVW8VO3WuPVoQm4+ERqWYlApBPB/Nb5ZcWpuqGP YyHeEZLN8GzZA4w9pqqmJA7l30OgnyLDLZ/ioqNZktf3YRQC+n8k7Tpwh/AZFMPQQNZ8MJ3R1Rt DfVNszxAs/6SPY2Z2SZizm2DYHzZmptvjR6ytoaDMEU2hmw2X0PTH8mw01JGOpS9vZFTs4huvUg a/iyp4EnpIhJHlm5Ri7xUcqfssk78NS9Ig8Xt3PI9GucFUr1cyeAp5WZw+WNwFBEf7wbe+tLqin +F8R7W6idmafXIvmx4+HNL1ep4ijo7eVdtB34QKq19qMmP8JeTd5LHrVGbzIvC2/DdMOpWxoqLZ Zcmeh9fMfBs3x1GYokfLpVqgfMTOmEAAuQKyXjNgSffmO9+omaxapTJuz1IIy37lgz9zC0I/mMX 6uSzxvczHWibsrdF/GSAMw2h5jDSOGCCSAIOxCtN1JA5FPqaEGtUm8qcPP35U54UU9YShyx0Cjv p7so/1nJjLa5YDw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao push_ipv4() builds the IPv4 header 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. put_unaligned() is no longer used in net/core/netpoll.c, so drop the now-stale include from there. Pull it into netconsole.c so the moved code keeps building. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 28 ++++++++++++++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 29 ----------------------------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index f805ae95ce7b1..84f90b53a10f7 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1651,6 +1652,33 @@ static struct notifier_block netconsole_netdev_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) +{ + static atomic_t ip_ident; + struct iphdr *iph; + int ip_len; + + ip_len =3D len + sizeof(struct udphdr) + sizeof(struct iphdr); + + skb_push(skb, sizeof(struct iphdr)); + skb_reset_network_header(skb); + iph =3D ip_hdr(skb); + + /* iph->version =3D 4; iph->ihl =3D 5; */ + *(unsigned char *)iph =3D 0x45; + iph->tos =3D 0; + put_unaligned(htons(ip_len), &iph->tot_len); + iph->id =3D htons(atomic_inc_return(&ip_ident)); + iph->frag_off =3D 0; + iph->ttl =3D 64; + iph->protocol =3D IPPROTO_UDP; + iph->check =3D 0; + put_unaligned(np->local_ip.ip, &iph->saddr); + put_unaligned(np->remote_ip.ip, &iph->daddr); + iph->check =3D ip_fast_csum((unsigned char *)iph, iph->ihl); + skb->protocol =3D htons(ETH_P_IP); +} + static void push_ipv6(struct netpoll *np, struct sk_buff *skb, int len) { struct ipv6hdr *ip6h; diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 7f57bd0eac66d..1fcde9c87b8c2 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_ipv4(struct netpoll *np, struct sk_buff *skb, int len); void push_udp(struct netpoll *np, struct sk_buff *skb, int len); void push_eth(struct netpoll *np, struct sk_buff *skb); =20 diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 6a10ca5eaa093..030424e43bfb4 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include =20 @@ -413,34 +412,6 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struc= t sk_buff *skb) } EXPORT_SYMBOL(netpoll_send_skb); =20 -void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) -{ - static atomic_t ip_ident; - struct iphdr *iph; - int ip_len; - - ip_len =3D len + sizeof(struct udphdr) + sizeof(struct iphdr); - - skb_push(skb, sizeof(struct iphdr)); - skb_reset_network_header(skb); - iph =3D ip_hdr(skb); - - /* iph->version =3D 4; iph->ihl =3D 5; */ - *(unsigned char *)iph =3D 0x45; - iph->tos =3D 0; - put_unaligned(htons(ip_len), &iph->tot_len); - iph->id =3D htons(atomic_inc_return(&ip_ident)); - iph->frag_off =3D 0; - iph->ttl =3D 64; - iph->protocol =3D IPPROTO_UDP; - iph->check =3D 0; - put_unaligned(np->local_ip.ip, &iph->saddr); - put_unaligned(np->remote_ip.ip, &iph->daddr); - iph->check =3D ip_fast_csum((unsigned char *)iph, iph->ihl); - skb->protocol =3D htons(ETH_P_IP); -} -EXPORT_SYMBOL_GPL(push_ipv4); - void push_udp(struct netpoll *np, struct sk_buff *skb, int len) { struct udphdr *udph; --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6EA238C2C0; Tue, 12 May 2026 10:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582925; cv=none; b=lRQWyAK97UsCCJoclmicU0SZmJDQcSVzo4SaJZTjBnmOW6wGA4HjE48Jd7CGv2ONEAd6eQuspmsh3b+xF18uVU0M729wsuRegr1XXK3CYqh+0mFyMjueFsTtxJq93Kk3XFpxKqaZeE6RxQ8N+VLV/y1DyBUa6bmSSsvZrMb40do= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582925; c=relaxed/simple; bh=PMpPkJWHttQX5kh4Gi1+W+Qb2aqcl2x//u13feAjgAU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oV8BArmDUPjjUNvylBp4DZLrRskj7VrQmqJc0Si0DeR/mjl/trpmMzg+tH1NLwhWHoduuE9g5qQJowZNma4P2pCqwu/yNNzH+n6DbzAHKSIXHY9E3L7BXPlEX7e/Ovf+7xN1L3vefKCiZYUT7nJF4GoGb4phbOUVueBQu3DK/aU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=RjlqZSjh; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="RjlqZSjh" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=ZvvQm/zY3VAgs6XRZ+pEkISjtTM4U0Plb8SiYTnxo3M=; b=RjlqZSjh4On2ZkrUMvm78qqLEz d9wKtmWKN+45c4fqqqgp4ei7tlMqmqlq2xjmzJnx2pDnE5DS877pU3ZXaMsxCn7lFK+PKiNkfH7xm 4fChRk1Pe/7L3MEbYIj+TIY3+qEcFhrBGM8PLQbw89V/KX/2MR2CtQiECZkyjCg6Gd7KYorNdOmAr 4pLBR0KRHsOczfY+cB8XJETJbIXJdXyMtXkT00+UcX3oQf493TtkdXdw8Wco7xwUXFpOrhAhRwl1J EUvfSr2YM9J+BnnhHWYAVfGn6NaoRw1T3UJ24L8JRTF5GwUH8z69WEBN+zxQPisep85I6K31Vx6Y4 IuXQ7bUw==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkfH-002K2D-1o; Tue, 12 May 2026 10:48:39 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:38 -0700 Subject: [PATCH net-next v2 5/9] netconsole: move push_eth() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-5-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=2639; i=leitao@debian.org; h=from:subject:message-id; bh=PMpPkJWHttQX5kh4Gi1+W+Qb2aqcl2x//u13feAjgAU=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVr6pZmenfFsoBbW78vH44duPepVBAEJEazX Xy7pUetPiuJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bWHYD/47+lCw3Alw4OsYTwvkkyKnG05vlZx5CpImwwOTlvvKDUeMi0kdN3l65+AY3t+h1piMUww vN+xGkPyEcKUWV86KNTGCEoakfhuuzwMzkVQL0tWS0yxFCIV5FspJx0fZCxiD5H9hdZub2FCGtk GC0W7Ls2dibL0h/CzcY1af9LrpVohcd48s0eH+Bx1ilZZlYRJiRZ7BHsCb184SEkDR/cSjd6LrV bROwHKBKCx/ymtc4bMNkAFnA+t7Dvy+k+R81gHyQzlo7sDEjnwoIve/InjqXzSqUQUM2dkWAvFJ cePxcBexe2fZF4ZDyOs1m60bKsL55VmcPQlSG3RLY2zXbdxQgd4UHuEIxZDCFOQOAnhNIOdiD9k Vices7f9eMNQDhVQV09Zqz9xbyECHUMww4bqHQfl3uKEcCjYgMpB0EwlXJbX5XHt+yO/hw8eBte l6BWUZ49p+ycE3FdVnZDWmN5mQS4E9UmL9kWQpjQmnjfo9SEY+tq8RgVOEbKw3JWgrdrr4BFJfr zxasqetaNNFLXrJk+y3AJxIbFblJ//w/9/4NwUQ6cl6xI4NSB8a3upErEdWObx39NzxPuXrjTX4 jpHP4Yn6S7EFnxzt3SXErV3Nd3KJSiV01oKWDiTNXoTRubTS86v00EEz8+H3u/B2gvIEZMaSld/ pFHbDscYzFSh1bA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao push_eth() builds the Ethernet header 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. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 14 ++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 15 --------------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 84f90b53a10f7..bcedc161b13ec 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1652,6 +1652,20 @@ static struct notifier_block netconsole_netdev_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static void push_eth(struct netpoll *np, struct sk_buff *skb) +{ + struct ethhdr *eth; + + eth =3D skb_push(skb, ETH_HLEN); + skb_reset_mac_header(skb); + ether_addr_copy(eth->h_source, np->dev->dev_addr); + ether_addr_copy(eth->h_dest, np->remote_mac); + if (np->ipv6) + eth->h_proto =3D htons(ETH_P_IPV6); + else + eth->h_proto =3D htons(ETH_P_IP); +} + static void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) { static atomic_t ip_ident; diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 1fcde9c87b8c2..11eb95b3248e2 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -76,7 +76,6 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struct s= k_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); -void push_eth(struct netpoll *np, struct sk_buff *skb); =20 #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 030424e43bfb4..12165667705f3 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -431,21 +431,6 @@ void push_udp(struct netpoll *np, struct sk_buff *skb,= int len) } EXPORT_SYMBOL_GPL(push_udp); =20 -void push_eth(struct netpoll *np, struct sk_buff *skb) -{ - struct ethhdr *eth; - - eth =3D skb_push(skb, ETH_HLEN); - skb_reset_mac_header(skb); - ether_addr_copy(eth->h_source, np->dev->dev_addr); - ether_addr_copy(eth->h_dest, np->remote_mac); - if (np->ipv6) - eth->h_proto =3D htons(ETH_P_IPV6); - else - eth->h_proto =3D htons(ETH_P_IP); -} -EXPORT_SYMBOL_GPL(push_eth); - static void skb_pool_flush(struct netpoll *np) { struct sk_buff_head *skb_pool; --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5427238E8B4; Tue, 12 May 2026 10:48:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582929; cv=none; b=kA21Kqida9gCAFYq3sDICgrJQPevyUf8VyiyPuqJ9Oedu8ozrKw00JsgmKWyVmdOIqossm87Fg9ZL3iZkw2v1R1xO813yySEzBll8lWPnhXQFRUl6ZToSYHaGX7Feut46JfFLuvFskSafA5mcKRrLYi17s1iXAth93CKhNScLS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582929; c=relaxed/simple; bh=mRwKfnxxfVXe6omB8CCXs7tkRoeFLNGdpMOH91sc03k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sd3hHwcr7aDYUotu6Tjn7xcVDXQ+wFaVVZcoFpLLPMyqaYewhIp7lrmk0BiRAajQXUQ3+S/eQMHy82uSWm2gMaLPNsE8/iFJxgjEHWNe4Bbvwlb9yhNGSuU3BMU4H4a2ZzmGBPLNIE3QARcgbstqQl+AVpUZORHpicZ2LJCaGH0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=OGRBkqWm; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="OGRBkqWm" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=RGd1zeSSfhBs2Ow87ossMBrvi4URY2nN5utaSeWk84g=; b=OGRBkqWm1VH0jxBdXjyn49srY8 hiSD3DgLiIYEVCdKB+dc7CEC4wWGK819kDfyx//zGaCcFK1DyzhyA+KKEmvdFJTiD0+JeVDP/KCOr 8eI2CDbofBTOHTlCuUF2zzDeiKuohMKGVuMShOb2fLTxlz11nsN6S4qDvItYfiUOzYI4bKNjtr6ky up3t0y8ty6e49JaBsuXYv7BXSWXHB3FV38jRzOW2GV0OYMLuztah7F9HGhJe7UoJf1MECxDGOTLw2 NoYOdPaJlpQjBOtsVWGZFJACH/Zy7iVKxN6/GfrwEQcK/Fikp6jG7t5jHXAqOK+7p0Cz/6XP3i6uY x+9in2fQ==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkfL-002K2c-38; Tue, 12 May 2026 10:48:44 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:39 -0700 Subject: [PATCH net-next v2 6/9] netconsole: move push_udp() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-6-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=2779; i=leitao@debian.org; h=from:subject:message-id; bh=mRwKfnxxfVXe6omB8CCXs7tkRoeFLNGdpMOH91sc03k=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrjtgU/GPTiNfPOt4Uv4Tv1YTxYcPq9jmsQ dTBN5NO0aeJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bb7OD/0Y0Hthcw1FeX6IwWu1Ewf/bUSH1Kpo50wNiMow7aeUIAFaZOzjucWMcu76KFnP31aaOf4 yV7oith897zKBIwWYskSpXhTVBXhsZW85/5QibFB8SuFoW9Pl1rku4EfX7dn8N/O/9xvZR09L2t O1aSCPqUi5mkOLJZLjsrHXsTLj7cKwmnIDH9irtNe/jxEeloXP4qGlBVH7n67QF+4B2/2otbDAJ qcNVPv/fgtwRBnDPHWPA52Mb3fg+jWYVMbuR5QsIrsaAM4czTJl6vmDxvJ/ZEG2G3qCl7uXp1+D 6ygOQ415ldRaOOjsYkr64qtlPYchL8EyjyCKJARkrJcqKelefqtyBu8aHzuuvBDk7f2+wXYMehw KqxRvkYNxzjJ2po/RoSqtvGA5xqMY+wiyPkpY9JlRsdpqpsXyCLYwSqLIENARLM3/uc3KkExYID Y28BTxdCykXovN4RvvhpDKYEVgXOcPIQ1inBLA+1Q19QzGPm76A6szDcYIf1VPf7XuDvlZ2BW/H JhgFlzyVetByw91q/mrA8FGGeVtBQQymLIzrkwJcLTjOXsIdCtJZm4Ng+UUCiz4MN8fcUiXKsuu olQJs3kHIRF0khzx3+ef8rPjQY1in95ME/y2EuPK9f6Fbz4hTMIoVLmXkvZGXeFyzwLfXKoJYYk LWuAOx/7P7Q3xDg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao 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. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 18 ++++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 19 ------------------- 3 files changed, 18 insertions(+), 20 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_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static void push_udp(struct netpoll *np, struct sk_buff *skb, int len) +{ + struct udphdr *udph; + int udp_len; + + udp_len =3D len + sizeof(struct udphdr); + + skb_push(skb, sizeof(struct udphdr)); + skb_reset_transport_header(skb); + + udph =3D udp_hdr(skb); + udph->source =3D htons(np->local_port); + udph->dest =3D htons(np->remote_port); + udph->len =3D 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); =20 #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..96c65625f4cbb 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -412,25 +412,6 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struc= t sk_buff *skb) } EXPORT_SYMBOL(netpoll_send_skb); =20 -void push_udp(struct netpoll *np, struct sk_buff *skb, int len) -{ - struct udphdr *udph; - int udp_len; - - udp_len =3D len + sizeof(struct udphdr); - - skb_push(skb, sizeof(struct udphdr)); - skb_reset_transport_header(skb); - - udph =3D udp_hdr(skb); - udph->source =3D htons(np->local_port); - udph->dest =3D htons(np->remote_port); - udph->len =3D 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; --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FBD838E8B4; Tue, 12 May 2026 10:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582934; cv=none; b=uhhZW5XolANOca05jrO6Q/kFQtDVOwkmatQYHTfXg/duwhf5AMLYUZYI6kYCCgq5RIR9I9us4YI79ZIl9NzP0l6AHj/hYZyw+uinne+rXCKrRkdNWLh1lw2tNCJolKIryUqEkNU7UVcAIHPjuYYIhlVgPNM1sg1xylzvqHhx5bU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582934; c=relaxed/simple; bh=o2la3FpojMCWYm5YdfXVmSJd8P30baL8VRsdI90OtzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=auYqK7N7N5H9B+mW2VRxoEqVcpAofKskSZckfgrGyYhCIb6b5g+w+S7tIu21mUsfeZ838e/CPGNE6vkDQC0XebTGD6rxNuBsAZOANRoxtGPX5IHFVTf10CgSYNVBw4WhzavIW1yqpsvQTfNbtCrtNWNBm4fM8VO89WUHc+jAPsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=KIvBg4YD; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="KIvBg4YD" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=vayD2/eCHc4xdo2eyVn7CS6S0o4Ml1KGLPEIuGg6um8=; b=KIvBg4YDJaIT36hlPzHeyi9K+S IyAvEsMwexFgJRrZT+K42QnaGWMoJgOuQvoW8kC9HgMbgtrK9fKf3VNcdiJv+U35s6oBws+gpHY96 9KOT7K3V2Y77Q07qskrE/BO2ILJ5NAgVu/9X1unA1GG4mt/NfBU4N6zPXLW7lX9DYfsxkMhl/hjlI OsX75g68bZHeb78fN3qJs/r9OmoEFLS1gkrTXzijwYHzuHe10e1rrqpCc1RWaRRr8quYPE40IFCSO uv0nTx1Mfcr6KZr2d/779FIuuYRe8FVDADhPh8wKBICC4FHpoV9rsKKhq8C8CuSg611HgCBLX8W6Z K2qlw1tA==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkfQ-002K2o-19; Tue, 12 May 2026 10:48:48 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:40 -0700 Subject: [PATCH net-next v2 7/9] netconsole: move netpoll_udp_checksum() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-7-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4352; i=leitao@debian.org; h=from:subject:message-id; bh=o2la3FpojMCWYm5YdfXVmSJd8P30baL8VRsdI90OtzA=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVriwQkx4DHrYbKGD8tZMJcizn0ha9IOjGPH sTDbUuihkyJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bQBVEACuYRmTygv33yiq++pCN3A727REq2jhiSEmK7cGCU+foEb44Lxi5z30ga0gyUrFJ+LEKlQ Q0OnmFMdx1EJg9jEbnhP/igfNgo8N8fKwD7iCQ6c9Np1Gg/KEJAVvzuIrNbPED9u2Jkpn4ldLeB 58P65a6qmNlTOG3k0SQzviXcWqjJEHNsyNa0cz9Qapn/Sukvh81jqQ/xumJiFxvg4C6mYmQUajr x5ctW3E3Rzbapo6DCfp9guZSHR04pupmlufEiQI5QnHEY+TE2d7cxKlRCH8QaY7dw8M9HG5dStN wjxGPm0ZV8VsElL7+yokQ/My189yhOrZdnNQ7n/Xa6ng14P/GRrbgyXDUI0Rx8yG78E9ptshJke szhLQDMkw9i5Hmry8COJcbkjdxiPZZacdUhEbi06EF0s2i5FkhRqGfvHZLqD5DSYHudwnEjbPJG DKL8DP0cxQ/3jeBmWbSlgLbzd0QPwBBpwQdNfErkZgFzhsEf7HGVVcCjMrzjyo2ZpTR9xsr7pF3 UgIcUtryY8y4m7kDKdIOGR/5D84SjY707DV3GFRp2XDFbvKT9Lk9vN8rBL3IM4jqNn7MGVs9ayl UebAmh+JePKhAdSUC98/THJAFxfRZWNLpBFp5zPFV2Ibamur/zozMuM6DyEDtbc7mEUj++V0B+m 6rZk6g3jPTtz9Gw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao netpoll_udp_checksum() computes the UDP checksum for netconsole's 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. This was the last csum_ipv6_magic() consumer in net/core/netpoll.c, so drop the now-stale include there. Pull it into netconsole.c so the moved code keeps building. It was also the last udp_hdr() consumer in net/core/netpoll.c. The file no longer needs anything from (the UDP socket-layer helpers); MAX_SKB_SIZE only needs struct udphdr, which is provided by the lighter . Swap the include accordingly. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 26 ++++++++++++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 29 +---------------------------- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index e8d96e482fe05..48d2670bbdef5 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1652,6 +1653,31 @@ static struct notifier_block netconsole_netdev_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, + int len) +{ + struct udphdr *udph; + int udp_len; + + udp_len =3D len + sizeof(struct udphdr); + udph =3D udp_hdr(skb); + + /* check needs to be set, since it will be consumed in csum_partial */ + udph->check =3D 0; + if (np->ipv6) + udph->check =3D csum_ipv6_magic(&np->local_ip.in6, + &np->remote_ip.in6, + udp_len, IPPROTO_UDP, + csum_partial(udph, udp_len, 0)); + else + udph->check =3D csum_tcpudp_magic(np->local_ip.ip, + np->remote_ip.ip, + udp_len, IPPROTO_UDP, + csum_partial(udph, udp_len, 0)); + if (udph->check =3D=3D 0) + udph->check =3D CSUM_MANGLED_0; +} + static void push_udp(struct netpoll *np, struct sk_buff *skb, int len) { struct udphdr *udph; diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 03a49953a3d8a..1877d42ccbccf 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -74,7 +74,6 @@ void netpoll_cleanup(struct netpoll *np); 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= ); =20 #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 96c65625f4cbb..c148b3b68cec9 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -29,11 +29,10 @@ #include #include #include +#include #include -#include #include #include -#include #include #include =20 @@ -369,32 +368,6 @@ static netdev_tx_t __netpoll_send_skb(struct netpoll *= np, struct sk_buff *skb) return ret; } =20 -void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, - int len) -{ - struct udphdr *udph; - int udp_len; - - udp_len =3D len + sizeof(struct udphdr); - udph =3D udp_hdr(skb); - - /* check needs to be set, since it will be consumed in csum_partial */ - udph->check =3D 0; - if (np->ipv6) - udph->check =3D csum_ipv6_magic(&np->local_ip.in6, - &np->remote_ip.in6, - udp_len, IPPROTO_UDP, - csum_partial(udph, udp_len, 0)); - else - udph->check =3D csum_tcpudp_magic(np->local_ip.ip, - np->remote_ip.ip, - udp_len, IPPROTO_UDP, - csum_partial(udph, udp_len, 0)); - if (udph->check =3D=3D 0) - udph->check =3D CSUM_MANGLED_0; -} -EXPORT_SYMBOL_GPL(netpoll_udp_checksum); - netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) { unsigned long flags; --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A5504C77CE; Tue, 12 May 2026 10:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582939; cv=none; b=GyzPwgj3UqxB13ca36w2SERNyiiFX2sEUJdsCiTa8gaSuJdvUlE9nEev+13UEEXbikEAeFbE3KTbeJMgdi/No4NvU2XX8BzbTZuNe29XsqP0Yx0Rz4ubpS7hbCMtoAkQxX8ynRSXCvyh+v5SvAE5S6dXNWeYgNF4rMUlAJCwi10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582939; c=relaxed/simple; bh=5rvLrUfVlAc9YY6CTOwDMsWJsP8QYsUXdm5THTFk/bc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U8URz9xXZh1R2Tob9Wj8SqG8V9viHSQRIzBWoHl9WNy5/8Hdu8d4NcetERqD10/zBPYqWGl3o0kS4rQlMTZYMaOodVoqjCyiTU39fUZiQCGS17gTIttotzArMKzc75NUDKwzFvwAiJ6pdPTILYyQqPuYd6j9c1uOfOllUOimn1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=ua+MAGPr; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="ua+MAGPr" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=kt/HkCI3dMRdzBCOx4Mnncl2c/BCOwyYQvNx7VAiknA=; b=ua+MAGPrWDir47R6YXtcnaZqW8 nGMeAySBt2Z3ji95obNDtlYuzyxo+U752NivvePNKTyHgBczutHbBCln3pfxIytSDck5PB1UkP3ZV /wG4PerSCHfaIqvoL32Kzm+GfbD+oHu1fUAAYw6J3+dSRYmy/gwJY1ytCXcbado15vhAArQHPm4LV oFI/mwthUMzACNDmyqpI3SlkE2PY0J3R2jq4oUHcp2i8WL7hUYvOWqVcnVqo7/ju4OPYlj+Oepi0T EaeVpCqWUOIAv+F+YwMtmcXEp42TMTbHDD/w0NO/SN/6c8o6gBSYd9AOVEP8Dfl4cSMfz5ocP1Zbd awbN5Jng==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkfV-002K6n-0O; Tue, 12 May 2026 10:48:53 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:41 -0700 Subject: [PATCH net-next v2 8/9] netpoll: rename and export netpoll_zap_completion_queue() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-8-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=2487; i=leitao@debian.org; h=from:subject:message-id; bh=5rvLrUfVlAc9YY6CTOwDMsWJsP8QYsUXdm5THTFk/bc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrVTkxup0d0pkrEhAA5A+RzkCqUBfzXBvfb g10Bh/Lh0iJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bbh3D/9BG+EbI4AT1fO+gQlw0iNgFZRxQPuZSUZscGWLeIt/S1iVgs8/CzWHEF3HpORKr33FWMO XW5rluyMOmNUHqW4MuFrc4jjnPk/zNXgQ5/OJ1oHhmwb+7PIcnep6Qnxo/dIrIIDvetfZV23giP oAsB38RqpX89sx7yg7xs5CEq9lVhkuJ4e3YKoWwqkV1sOr7ghaHYSR69HTk42GNJcfxe4B+9qZT cUKkBBzkr6/z80swpkC+Sy7Qj9fbFtFRCgk/b++CDHrzzG2zK1Dp5XUgofqHB+q5df+wkuSf1lj bU8KUORFxEzNWGZAjKGy6xjLuvvYKSXI6Rhuuz1MnJ8cJCnVTTYKi7B5V/c7uNrAbpyNH8DOsuv YtIlQIHvWa8117HAav7LjEy6CLad+KZPxnR3DexRxmR7VG+39h4zpBnEg2sLwnyY+bhvgDXOjfX Cdyb/6L4jrVqhQR697EiF09n5cPTtoA0oD35PUctsgdI9ZEksV/AEqD7U2oVyqIjcu7QeDj9/Ci ZN35blcudZ0+F+dryye7E/gH9s0u5BkzugPg8+Lz6zwDXInkHmxpuhIqvqAvUWvsOvnXysBgei2 8kz+31459FrAzLBVr+zaq2nI99S6TAYLYTBR9s56p5o7dAI/aKUYGhVR5LJI2f1MHj88vBmr8Ty Ejj4QmyiE+lx23w== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao zap_completion_queue() drains the per-CPU softnet completion queue. Rename it with the netpoll_ prefix shared by the rest of the subsystem's public API, and promote it from file-static to EXPORT_SYMBOL_NS_GPL in the NETDEV_INTERNAL namespace so the upcoming netconsole-side find_skb() can call it once the function moves out. A forward declaration is added to include/linux/netpoll.h, and the old file-static forward declaration is dropped. No functional change. Suggested-by: Jakub Kicinski Signed-off-by: Breno Leitao --- include/linux/netpoll.h | 1 + net/core/netpoll.c | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 1877d42ccbccf..f986f7486cb8c 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -74,6 +74,7 @@ void netpoll_cleanup(struct netpoll *np); 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_zap_completion_queue(void); =20 #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 c148b3b68cec9..e4cda0aa4d488 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -51,8 +51,6 @@ sizeof(struct udphdr) + \ MAX_UDP_CHUNK) =20 -static void zap_completion_queue(void); - static unsigned int carrier_timeout =3D 4; module_param(carrier_timeout, uint, 0644); =20 @@ -199,7 +197,7 @@ void netpoll_poll_dev(struct net_device *dev) =20 up(&ni->dev_lock); =20 - zap_completion_queue(); + netpoll_zap_completion_queue(); } EXPORT_SYMBOL(netpoll_poll_dev); =20 @@ -238,7 +236,7 @@ static void refill_skbs(struct netpoll *np) } } =20 -static void zap_completion_queue(void) +void netpoll_zap_completion_queue(void) { unsigned long flags; struct softnet_data *sd =3D &get_cpu_var(softnet_data); @@ -265,13 +263,14 @@ static void zap_completion_queue(void) =20 put_cpu_var(softnet_data); } +EXPORT_SYMBOL_NS_GPL(netpoll_zap_completion_queue, "NETDEV_INTERNAL"); =20 struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) { int count =3D 0; struct sk_buff *skb; =20 - zap_completion_queue(); + netpoll_zap_completion_queue(); repeat: =20 skb =3D alloc_skb(len, GFP_ATOMIC); --=20 2.53.0-Meta From nobody Fri Jun 12 21:38:08 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8309A4C77CE; Tue, 12 May 2026 10:49:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582944; cv=none; b=rza/ZrmjDnAphLK0w72MHHeMAqv1HRrpW84NwMAu4MBdbOhduz/4KvDUkwVGYU6fffCuN1IaIA1nQQkgDUa0pjCTz7bn3jV0iey256Kc8uet0TgXOoJ7a8BYN0VQuzdrZ7TXonYCIqK6eDUq97HZ6eXATRapu6r7xrXZ5yRaqb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778582944; c=relaxed/simple; bh=XQvzmY4vaSa4UD/90PLNRuFbhAlYqaPSI0Ghbpbvnc4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kg4DQhnvQYGoB4h6roCMks+YxcbcdrFdegXt29z24P0Ru3BsJv9jDnuUtFLrXDP0JgkzbdoCQ3RWS621JpaCaTfg95xttAkzprwAwY9abVor1dcJcWsBpR9E4sW7ncKTi3xgfdwt1ZcGitwq641bRy7VdEDkneXQio8kvr3elqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=giBh91f7; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="giBh91f7" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=Kfq/mwsfIihE3OBSsEqceJwCjhDjYN8um9ygjxIr+B4=; b=giBh91f74FjzNDZTEBZyX1AQP+ igmgTkoIgD5QZEuwItXbptyGM+mfwdmtC9Wopxvm0IZIqQvrazWym6dd2cC+MX4bytt3W+8pxKCUN JZYD/kxmW6EVVB0uuaG43Jo9mCtOwcU0b9pYj37KM8NTszk3/a6M0LPfnsf4Tew80oafFehgTanlH 8S600lBF0/OzcShyQ/HWSnDavT9XgzP4Krfcpmtm8/tNh52einsmKzU2bt//Ye0wZgvETADd7/FAx 92U2raLjQSqenjPLJPn4jHHdWBV1jTJOLTpPzkfHaar4lkeLTOjJ0Pj38hX2NeHXc0ct/OaxAkHCC qfXSM+3Q==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wMkfZ-002K90-21; Tue, 12 May 2026 10:48:57 +0000 From: Breno Leitao Date: Tue, 12 May 2026 03:46:42 -0700 Subject: [PATCH net-next v2 9/9] netconsole: move find_skb() from netpoll Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260512-netconsole_split-v2-9-1191d14ad66d@debian.org> References: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> In-Reply-To: <20260512-netconsole_split-v2-0-1191d14ad66d@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4547; i=leitao@debian.org; h=from:subject:message-id; bh=XQvzmY4vaSa4UD/90PLNRuFbhAlYqaPSI0Ghbpbvnc4=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqAwVrTh8s6njfqDyP6OeEFSh0wbkzryFKmuS7k Dfj1EC8ch6JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCagMFawAKCRA1o5Of/Hh3 bfUoD/90KoY9HvtqUdjILi/IUfoQMLiquzA7Ipgk/ZnE8xiZUYAOPPbH+QdI8NjJBXfT+KnTFHk +yz0EJE1PbiJXcFkm0h0OhKUijALflsJHpka6XwXrX6KMxifltwyy7oV7FCxu08wLqCGbCqQqik j6r+r44uXjD/Fr1rRqx6B7RWS/06Hcxv2P72wmX7cZAb6xkj3HvnSNHI2FJVwLHHV6DtYH2pChX dwwprpRkETfdOeQTp3YBST9CUNQ4ESiTHEZTtr4rFSZ7B21GDsZ/j13hXzlHRgMjyqZgFxDEotC AK945ajZjpCVqV5qmTo2aVofBjWNwxCkhXY/6xMAZFjKDajKgJkYIWpRGXSXR6AS5mIhggC+d2V rnJH0UnknPLGczdrRhAdaYQJdo6k2Gzf85BtrMd67ru6tb4W8xV3lDfh0SwgQzUZZ2Jrss0Orqk yEj1n86C+Vn4sR6sfuhikaLtNCadDVyvb+iMq/VGl7VDQfpXeeAFP1N26XXaLyyoccHVPZlHl3m c1LWyeppHQV4XQh0PWIu8U+c1oXsdw0JGXYbXzcdTHebIJ6jY3HiZSwAliD0LRabvw4ZvGp+C1D Hg7uIWt1lSfJZdIUmHSnh+c1M28FKE4NbVgV0j9INwMyf4J4s7A0SmQxItM0u+1KhdOQEh5Hd86 tJiQzr2Rdtfzscg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao find_skb() is the netconsole-specific entry into the netpoll skb pool: every other netpoll consumer (bonding, team, vlan, bridge, macvlan, dsa) builds its own sk_buff and never touches the pool. With netpoll_send_udp() (its only caller) now living in netconsole, find_skb() can join it. Move find_skb() into drivers/net/netconsole.c as a file-static helper, drop EXPORT_SYMBOL_GPL(find_skb) and remove its prototype from include/linux/netpoll.h. find_skb() drains TX completions via netpoll_zap_completion_queue(), which is already exported in the NETDEV_INTERNAL namespace, so netconsole picks up MODULE_IMPORT_NS("NETDEV_INTERNAL") to consume it. The skb pool's lifecycle (np->skb_pool, np->refill_wq, refill_skbs(), refill_skbs_work_handler(), skb_pool_flush()) stays in netpoll: it is initialised in __netpoll_setup() and torn down in __netpoll_cleanup(), both of which remain netpoll's responsibility. The refill work queued via schedule_work(&np->refill_wq) from the moved find_skb() runs refill_skbs_work_handler() in netpoll without any further plumbing. This is pure code motion: the function body is unchanged and its sole caller (netpoll_send_udp(), already moved by an earlier patch) keeps invoking it the same way. Pre-existing concerns about find_skb() running from NMI/printk context (zap_completion_queue() re-entry, skb_pool spinlocks, GFP_ATOMIC allocation, fallback skb sizing vs. MAX_SKB_SIZE, PREEMPT_RT semantics of __kfree_skb()) are inherited as-is and are not addressed here; they predate this series and are out of scope. Fixing them is left for follow-up work. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 28 ++++++++++++++++++++++++++++ include/linux/netpoll.h | 1 - net/core/netpoll.c | 28 ---------------------------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 48d2670bbdef5..d804d44af87c8 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -50,6 +50,7 @@ MODULE_AUTHOR("Matt Mackall "); MODULE_DESCRIPTION("Console driver for network interfaces"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("NETDEV_INTERNAL"); =20 #define MAX_PARAM_LENGTH 256 #define MAX_EXTRADATA_ENTRY_LEN 256 @@ -1653,6 +1654,33 @@ static struct notifier_block netconsole_netdev_notif= ier =3D { .notifier_call =3D netconsole_netdev_event, }; =20 +static struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) +{ + int count =3D 0; + struct sk_buff *skb; + + netpoll_zap_completion_queue(); +repeat: + + skb =3D alloc_skb(len, GFP_ATOMIC); + if (!skb) { + skb =3D skb_dequeue(&np->skb_pool); + schedule_work(&np->refill_wq); + } + + if (!skb) { + if (++count < 10) { + netpoll_poll_dev(np->dev); + goto repeat; + } + return NULL; + } + + refcount_set(&skb->users, 1); + skb_reserve(skb, reserve); + return skb; +} + static void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, int len) { diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index f986f7486cb8c..e4b8f1f91e54b 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -73,7 +73,6 @@ void __netpoll_free(struct netpoll *np); void netpoll_cleanup(struct netpoll *np); 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_zap_completion_queue(void); =20 #ifdef CONFIG_NETPOLL diff --git a/net/core/netpoll.c b/net/core/netpoll.c index e4cda0aa4d488..33ab3d827a427 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -265,34 +265,6 @@ void netpoll_zap_completion_queue(void) } EXPORT_SYMBOL_NS_GPL(netpoll_zap_completion_queue, "NETDEV_INTERNAL"); =20 -struct sk_buff *find_skb(struct netpoll *np, int len, int reserve) -{ - int count =3D 0; - struct sk_buff *skb; - - netpoll_zap_completion_queue(); -repeat: - - skb =3D alloc_skb(len, GFP_ATOMIC); - if (!skb) { - skb =3D skb_dequeue(&np->skb_pool); - schedule_work(&np->refill_wq); - } - - if (!skb) { - if (++count < 10) { - netpoll_poll_dev(np->dev); - goto repeat; - } - return NULL; - } - - refcount_set(&skb->users, 1); - skb_reserve(skb, reserve); - return skb; -} -EXPORT_SYMBOL_GPL(find_skb); - static int netpoll_owner_active(struct net_device *dev) { struct napi_struct *napi; --=20 2.53.0-Meta