From nobody Fri Jul 24 21:30:21 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 38811363C45; Fri, 24 Jul 2026 15:05:18 +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=1784905520; cv=none; b=WF10cryAUAP97HA9XkIquG2DQb++zxPxOkZoVXR/TFHb58vrWIeWGo3LD0TQ3ym8O7nkJ+MN2AwjeulJtU+56tmijwTAYsy5EumL0uujblUk/sDk1DS7X6pAwk8EqtsjVrsS80F7moOjJ3xI41ZpUfp0hrx/NrqmnFfmVLSU0CU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905520; c=relaxed/simple; bh=xIVIdSWc3BSexOmpReadWo0F5PUNZbkIdaCjbZ12ONw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cp3OLyhDMMPsztK2xm7lTgtNCp/U/kuuOv0phkjIIRyZoUnwtimG6qPQmI3MFVlxhU5Hj2jbzBqfnNk5CqJleSrIEl4YhWPU9G2pS9x2zkJftWA4rPgF34CVFhwTRrnKnaw3q/gFeW5mw/ezAExtcdMmiKTAHwR5ihXFg9xXMV8= 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=rRmIKpLj; 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="rRmIKpLj" 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=EecT0FwLtdnkZ4RlJ1mzXRtA09QjugI2L2Nqcry/6OM=; b=rRmIKpLje7+iROgBGpzg+j5gEG UIKD+pc31IFGVDNLnKYTxbTuXmtgGdqlcmtsWEq7VVXlPOjv0IfbsEMcQ7bg3OzIsMRpOAGCyfpxS DbjVjgJp55T6uNBwINeAnr2xrj7DEtaPmScGqWdJPVrCmcsF2d3o4NOqkzC/RMn7uwgXPz3nWYjyG H7HBtDJgIkloXL/PAaFNoyjpJpJMWgd5Zctwzgou7tjweIs4ErFYn4crPB9BaiBUkTxBACQWab+Ts 95KUXZ4u5mxNaSHYE2QHCOgNYvurj0LXwYNoDN5DxHzi9lel2Hengg5BJIno2xFIwxLQze2ey47md 1GcXsTHw==; 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 1wnHSY-004dt4-2O; Fri, 24 Jul 2026 15:05:10 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:09 -0700 Subject: [PATCH net-next 1/9] netpoll: export carrier_timeout via netpoll_get_carrier_timeout() 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: <20260724-netconsole_move_more_final-v1-1-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=2868; i=leitao@debian.org; h=from:subject:message-id; bh=xIVIdSWc3BSexOmpReadWo0F5PUNZbkIdaCjbZ12ONw=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38dI/vd0UNaqPWul/C/0DKzOH0nqzyoSZuUe 5K1CKlBfyqJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HQAKCRA1o5Of/Hh3 bZH9EACTPA61Lgahk2wU3J8w/fWCWaL6mnMpU6xoJJmCO/Lwl0HkFXsRnN21daFVAjc6zR9UhVP tW/AmoK8slWf9DurdP8TqmFNc8mcORs9PtX/MKES0IOi7+vzXnzMN7DHEK6D6R3m1GLykPoTYaE 5x94UwQBj73xgoQ6dNWj2kPmsBFsQltdSm5El9fS5ozzPOfkipMSawU0JedcRP+EJ3bLi7ewOIT sZ4sAzNdjR7XP53QcFT2fZ+gWmggOiV8EwOrDy7lcmpCEQ/N5TjZZhDZy10bavT2HU8pGoYqO39 LIG74z3vWF0c4NzmZybmIGl547wiqt78Z8HHqIDZkEz2cEaFs7MkrldbFiUSD1Ifh/ApTU8bhep RlLgK06shMWwC5X36CZw6W/1mAg9i4XEAqNovo0Vv8m9hgKWy+ezT7MQKbGZ/lMTqYExIsi0549 QrxkwH19A+6mtfg2SYsIQ9wm6jYJW5k9yqllJmcfu85xjSO4kDkmHpLoNQXIFxDpgpdrjEtq6JW +tJaHyU3KO0JOt4+7elodhHLSIc+tCAfiH45YxZJE7WOBiYyTJtPIMG6QGnzNt0MxgTShV9j6FH YuG8Xqh/3ytO6Oeeq45FnHf3EGUqVgtdr1QJb+Zzw8IjXKlBekokA/3u7HNJ15Lqh1UYfQ6fTJF WpFnpGul5rCRRvQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao netpoll_wait_carrier() is only used in netconsole, and it will move to netconsole. The carrier_timeout module parameter has to stay in netpoll so the existing netpoll.carrier_timeout kernel parameter keeps working for current users, and we don't break user compatibility. Add a netpoll_get_carrier_timeout() accessor and export it so netconsole can read the value once the carrier wait lives there. Drop the now redundant timeout argument from netpoll_wait_carrier() (its only caller passed carrier_timeout) and read the parameter directly while the helper still lives here. Signed-off-by: Breno Leitao --- include/linux/netpoll.h | 1 + net/core/netpoll.c | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 79315461a7b1e..d426d1844cac7 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -72,6 +72,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); void netpoll_zap_completion_queue(void); +unsigned int netpoll_get_carrier_timeout(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 f8da1048ea3ab..9b9fcc307958f 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -38,9 +38,20 @@ =20 #define USEC_PER_POLL 50 =20 +/* + * carrier_timeout is netconsole-specific and only kept here to preserve t= he + * netpoll.carrier_timeout module-parameter ABI. Its value is exposed to + * netconsole through netpoll_get_carrier_timeout(). + */ static unsigned int carrier_timeout =3D 4; module_param(carrier_timeout, uint, 0644); =20 +unsigned int netpoll_get_carrier_timeout(void) +{ + return carrier_timeout; +} +EXPORT_SYMBOL_GPL(netpoll_get_carrier_timeout); + static netdev_tx_t netpoll_start_xmit(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq) @@ -397,12 +408,11 @@ static char *egress_dev(struct netpoll *np, char *buf= , size_t bufsz) return buf; } =20 -static void netpoll_wait_carrier(struct netpoll *np, struct net_device *nd= ev, - unsigned int timeout) +static void netpoll_wait_carrier(struct netpoll *np, struct net_device *nd= ev) { unsigned long atmost; =20 - atmost =3D jiffies + timeout * HZ; + atmost =3D jiffies + carrier_timeout * HZ; while (!netif_carrier_ok(ndev)) { if (time_after(jiffies, atmost)) { np_notice(np, "timeout waiting for carrier\n"); @@ -539,7 +549,7 @@ int netpoll_setup(struct netpoll *np) } =20 rtnl_unlock(); - netpoll_wait_carrier(np, ndev, carrier_timeout); + netpoll_wait_carrier(np, ndev); rtnl_lock(); } =20 --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 C5D054398F5; Fri, 24 Jul 2026 15:05:22 +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=1784905524; cv=none; b=X55Y4xCl+DutxOm5qbKCqORAjLLDG6L+LJ0h900DYWzptrTti5xeOS+/wT08oq5ReC9T34aQBgoocmI2JsT+E+YTLNBeuZTwalsq6+QvtUqvxL4TOJXaqqDwXl2/HUMzu3gGSTcyTFdPtqXWzzCqTU98TeiR2jUYsTzIp07TTas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905524; c=relaxed/simple; bh=RTJhgo0qKIxVbwnT35A+DaYO9R4Kmowt9+umEDkfiIE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nDTic+QVQvsawlsHELEC4Vo/IurVxyRgSboNz+IpZWZhDfHNgFZMiQ1Iledbcd9ZMVymqYSIFIjqynPs9r4zxpslKmIScddAKgYFQD9gv/wKNfT4lfGXYrr2MmSSYy6Hsxe/qrnFB/O7AFz+wz+VFao1tzS/7hn15DSHhapqU9I= 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=vrCNJn4t; 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="vrCNJn4t" 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=qFyYCGTdJ0C9A3OHrXAscHjlRAsB5lrGRwNkRohgOw8=; b=vrCNJn4tND0ehRHVnSlr4PNmhd dr7BYOHI3VgkF+3SW/C74ULpNI4xF02hzquFj1qwinQr4PUEq4s4WiHw9+kHJhyR7tbx+sCw7o7k/ eJudoT7BlcNlyuXji10MR2tjDmLGk3VhRwpH62E9vI1UMXyp104MCsjPOjRw0E4M+dCaSeN2EeeMS JfuhxMDs1laqZaGv9roX66gmn83G/nas9rMUiIMUTIjSAbki5dTMGCF9ywCOSJuweopCBsiyAubWR 5VUyG0gDOyA5hSsf8u9MF0SFkU/o/ExY0KLJIehe7CKr7cAIBasZsoFgSThmt1C+10kKPt1ARKpp+ 4/8NFqFw==; 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 1wnHSc-004dtF-2g; Fri, 24 Jul 2026 15:05:15 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:10 -0700 Subject: [PATCH net-next 2/9] netpoll: export the netpoll_setup() 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: <20260724-netconsole_move_more_final-v1-2-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4049; i=leitao@debian.org; h=from:subject:message-id; bh=RTJhgo0qKIxVbwnT35A+DaYO9R4Kmowt9+umEDkfiIE=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38dcC1Sx4Sq+MqmfDOe5hJOGjKvpjvpRjhpv w5ylkMwqsaJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HQAKCRA1o5Of/Hh3 beTuD/9nhNUpIOemr5M+U4Yn93Psy8C14chOxKQ7x+Mzys6gtKGaqgW9Pg6oIDRKQ+gSC0Oqlwx BSrSzpk97nbMFdgO6veKeARTpXT7i5SrJ/5qe759s1HCTdHidmnsG5bfPXo6CKJmG7yXfqtL9Qv 422gmgiD6hvsfSJ7NdSQxfKgwdNgMjOGKEyLk4dK3uzxLpQzFZ37tzvGD47FjP+gGtDuANEuLsb XFn9YesJnVvkmsTWnrRW50BpxMFeq6QIuZyjsdV/dOQP3w2EXi81M0edvvb4Gd6W7Ny1vDE34vz aad16Gz1f/s79ZU3HLWeI5kDAx7k5Vl2m/WGhObqkeOmeGBcQLYwt3egJ9VyteGj2UwMO0wN/Dj bgpmvwxCgrVkd5q2LiXf2lfz0Z7tfU7DDSOs/fncoDzxT1opPEFqrImFlsUlv+JxCzxlD6/fn4X QN3hLXXw/bFhS/zn1OFukW3ANdmVvwnfVXdRXv03judO30wlMu4v0GqS8u4VofZZzcs93SLoxfb F2z7TfTdYVHE0CW6xZuvd6hvRK6N5gTo+KcEj0S38ubGLPsoNaMdXJ/j0hsNauT1ktRSXvUaFN+ 1O14640LhYqUlsKINaGrWQ8bbxzT2iL6Lrvh2qniNcao+rxC6K4Kf0AmItUfm6BwcfQIvMq4dzx 0qbqoWsaYVolchA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Temporarily export leaf functions that will be moved to netconsole. The upcoming patch will move the setup function to netconsole, and continue to call these leaf functions here in netpoll, then other patches will move these exports functions to netconsole (and make them statics). In summary, these exports are temporary in order to make the patchset digestible. Signed-off-by: Breno Leitao --- include/linux/netpoll.h | 5 +++++ net/core/netpoll.c | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index d426d1844cac7..0877515fa7442 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -73,6 +73,11 @@ void do_netpoll_cleanup(struct netpoll *np); netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb); void netpoll_zap_completion_queue(void); unsigned int netpoll_get_carrier_timeout(void); +void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev); +char *egress_dev(struct netpoll *np, char *buf, size_t bufsz); +int netpoll_take_ipv4(struct netpoll *np, struct net_device *ndev); +int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev); +bool netpoll_local_ip_unset(const struct netpoll *np); =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 9b9fcc307958f..6a545063223ba 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -399,7 +399,7 @@ EXPORT_SYMBOL_GPL(__netpoll_setup); * be at least MAC_ADDR_STR_LEN + 1 to fit the formatted MAC address * and its NUL terminator. */ -static char *egress_dev(struct netpoll *np, char *buf, size_t bufsz) +char *egress_dev(struct netpoll *np, char *buf, size_t bufsz) { if (np->dev_name[0]) return np->dev_name; @@ -407,8 +407,9 @@ static char *egress_dev(struct netpoll *np, char *buf, = size_t bufsz) snprintf(buf, bufsz, "%pM", np->dev_mac); return buf; } +EXPORT_SYMBOL_GPL(egress_dev); =20 -static void netpoll_wait_carrier(struct netpoll *np, struct net_device *nd= ev) +void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev) { unsigned long atmost; =20 @@ -421,11 +422,12 @@ static void netpoll_wait_carrier(struct netpoll *np, = struct net_device *ndev) msleep(1); } } +EXPORT_SYMBOL_GPL(netpoll_wait_carrier); =20 /* * Take the IPv6 from ndev and populate local_ip structure in netpoll */ -static int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev) +int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev) { char buf[MAC_ADDR_STR_LEN + 1]; int err =3D -EDESTADDRREQ; @@ -462,11 +464,12 @@ static int netpoll_take_ipv6(struct netpoll *np, stru= ct net_device *ndev) np_info(np, "local IPv6 %pI6c\n", &np->local_ip.in6); return 0; } +EXPORT_SYMBOL_GPL(netpoll_take_ipv6); =20 /* * Take the IPv4 from ndev and populate local_ip structure in netpoll */ -static int netpoll_take_ipv4(struct netpoll *np, struct net_device *ndev) +int netpoll_take_ipv4(struct netpoll *np, struct net_device *ndev) { char buf[MAC_ADDR_STR_LEN + 1]; const struct in_ifaddr *ifa; @@ -491,6 +494,7 @@ static int netpoll_take_ipv4(struct netpoll *np, struct= net_device *ndev) =20 return 0; } +EXPORT_SYMBOL_GPL(netpoll_take_ipv4); =20 /* * Test whether the caller left np->local_ip unset, so that @@ -502,12 +506,13 @@ static int netpoll_take_ipv4(struct netpoll *np, stru= ct net_device *ndev) * doing so would misclassify a caller-supplied address as unset and * silently overwrite it with whatever address the device exposes. */ -static bool netpoll_local_ip_unset(const struct netpoll *np) +bool netpoll_local_ip_unset(const struct netpoll *np) { if (np->ipv6) return ipv6_addr_any(&np->local_ip.in6); return !np->local_ip.ip; } +EXPORT_SYMBOL_GPL(netpoll_local_ip_unset); =20 int netpoll_setup(struct netpoll *np) { --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 3C23B429033; Fri, 24 Jul 2026 15:05:21 +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=1784905523; cv=none; b=hV3aCsPj3yhiGX715ncxvCXRJAV9GyRpq1/hbupTGfn5CS1S5WQRPZpwksoMvaSK7bcNGZphRfEySriucBl7mSWhYCB/LLFuZyx3gK7iKajs+cl8wnnn02MLJiXQzueVeIyg6gfWUbXNuHXOmhkMgkMh3JY687QtwOQZF78iJ5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905523; c=relaxed/simple; bh=VOPTipKWdZmNLCeCt2EtDxonf9hu30SBjbEAgCTbvDI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hkNiPwlEFvFxONTyRz2912FTXmigtVL8dCwE8XMX/oPcbO6Mg5Yhku/n0Vbkab7Q0qbnfYxOtRz8XXQdPedBZfXlj1GmdV7HGwUjJXMoKxnul0pApsqhn9GnhG5TcnILbI2mZAcgIFXxPyVlR6Gc8C14lfhp5VNUf41wW/Vp51A= 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=tlDmh3oc; 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="tlDmh3oc" 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=fPHxL9ALCAXwk4u1NC60Vd+u61c1JjzYmBT2Ma0qfLo=; b=tlDmh3ocVBj8YegN6Sw+4Ej5SK PZWU6y3HAZno14j8cwORKXItkEvVQcUFXKJ14J8rCwbolXgn7zM7qoGhzvlBVTDBRQe99Wm0vYbGh 0Nlc8UoAzsqdlZVNoUDSpJAfyaujVUQZ+Cg5TB4oPYsUDm1MKPxVQZ9iXZKlsmxHIYjZYFRQy7lOQ bXvDUTZc3M6vC2CfqgC3H6H+s4WVNsXCNUpy2H40GZzBQO9yrBBeAa58BycUHcLtqMGqVinfWScWn mk2q5gizGSsEO/1+Mji8VrvUMs3F5k/aEXiiH6GpXvZ/Lh6KJa2ZQO3RAud+6f8mo0s59sgphbK1n XLKogFfg==; 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 1wnHSg-004dtS-2h; Fri, 24 Jul 2026 15:05:19 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:11 -0700 Subject: [PATCH net-next 3/9] netconsole: take over netpoll_setup() 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: <20260724-netconsole_move_more_final-v1-3-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=6656; i=leitao@debian.org; h=from:subject:message-id; bh=VOPTipKWdZmNLCeCt2EtDxonf9hu30SBjbEAgCTbvDI=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38dImdPpmDDVva8tFxX2WcsPlY+0JVfbPoZ7 bM+gbsK1/eJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HQAKCRA1o5Of/Hh3 bY2ND/9BulVt6dSxt1UDGYOf4xb10IgUMFD/jCFx5gV4rbgKyS9vU+qJ0YoRub7LffAjHsymiGY mxV2o2v39imleGOJ7gPNxE8ZVQEoWcYQOmXaKlfko40J1kQCp0bqWkWGBkjYQmoRV0BGjCZNWJL EO4x0OsMf//vggMKSeTYi36HLpDnuqMn1C8lahYvFkv7vS5RR2VS/WzCHzGYdhbemZCaWu1lnOO GZmFaNECDS8ipMFnHLXhUq24po1vaLnN/kawk5800VJSstOCsJbzD1/ONEPXBdgOeH56ETlmFsE I80L9xtK8zdufzS2amlZ4m4bolue2QMnvPRGyOrvasbJXws/9hHlfFVcnTJPTBBzIyltMjMOJkN YoTlpIyMGjJ2Ns4P+fg39WkonFsd6Ht7PcWjaxa9BJvfwD2aCkwnkGJAopWNS8VDZBD8ab9a59h z8Fc8OJzEGZpJ93OFCPL/P6er7vf7eUlixOOwq4C5ICI+AJMX8hRjQvKn2JEy5y8CTnBFZX3+MM b584Lsz/iAe0G0Wk1BgKKRoRZa7B0n4Zv18aRiTrjVIQM5U/2dk6V8tjAd1qQl0tSiA6HTJO9X6 z2QFSTxs56VFQ5EhdEa5xAgYCzhEakQKPROPrCYS5jxd9hnc3SWhDBZqBtuvMQA+Q/Fin1ys5rn BUQCsy2sYH+R6hA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao netpoll_setup() is only used by netconsole. All the other users use __netpoll_setup(). Move netpoll_setup() to netconsole, and rename it to netcons_netpoll_setup(). Pure code motion: the body is unchanged. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 86 ++++++++++++++++++++++++++++++++++++++++++++= ++-- include/linux/netpoll.h | 1 - net/core/netpoll.c | 81 --------------------------------------------- 3 files changed, 83 insertions(+), 85 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 7f8851a734fcd..3a7a2cafc6276 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -351,6 +351,86 @@ static void netconsole_skb_pool_flush(struct netconsol= e_target *nt) skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED); } =20 +static int netcons_netpoll_setup(struct netpoll *np) +{ + struct net *net =3D current->nsproxy->net_ns; + char buf[MAC_ADDR_STR_LEN + 1]; + struct net_device *ndev =3D NULL; + bool ip_overwritten =3D false; + int err; + + rtnl_lock(); + if (np->dev_name[0]) + ndev =3D __dev_get_by_name(net, np->dev_name); + else if (is_valid_ether_addr(np->dev_mac)) + ndev =3D dev_getbyhwaddr(net, ARPHRD_ETHER, np->dev_mac); + + if (!ndev) { + np_err(np, "%s doesn't exist, aborting\n", + egress_dev(np, buf, sizeof(buf))); + err =3D -ENODEV; + goto unlock; + } + netdev_hold(ndev, &np->dev_tracker, GFP_KERNEL); + + if (netdev_master_upper_dev_get(ndev)) { + np_err(np, "%s is a slave device, aborting\n", + egress_dev(np, buf, sizeof(buf))); + err =3D -EBUSY; + goto put; + } + + if (!netif_running(ndev)) { + np_info(np, "device %s not up yet, forcing it\n", + egress_dev(np, buf, sizeof(buf))); + + err =3D dev_open(ndev, NULL); + if (err) { + np_err(np, "failed to open %s\n", ndev->name); + goto put; + } + + rtnl_unlock(); + netpoll_wait_carrier(np, ndev); + rtnl_lock(); + } + + if (netpoll_local_ip_unset(np)) { + if (!np->ipv6) { + err =3D netpoll_take_ipv4(np, ndev); + if (err) + goto put; + } else { + err =3D netpoll_take_ipv6(np, ndev); + if (err) + goto put; + } + ip_overwritten =3D true; + } + + err =3D __netpoll_setup(np, ndev); + if (err) + goto put; + rtnl_unlock(); + + /* Make sure all NAPI polls which started before dev->npinfo + * was visible have exited before we start calling NAPI poll. + * NAPI skips locking if dev->npinfo is NULL. + */ + synchronize_rcu(); + + return 0; + +put: + DEBUG_NET_WARN_ON_ONCE(np->dev); + if (ip_overwritten) + memset(&np->local_ip, 0, sizeof(np->local_ip)); + netdev_put(ndev, &np->dev_tracker); +unlock: + rtnl_unlock(); + return err; +} + /* Attempts to resume logging to a deactivated target. */ static void resume_target(struct netconsole_target *nt) { @@ -361,7 +441,7 @@ static void resume_target(struct netconsole_target *nt) */ netconsole_skb_pool_init(nt); =20 - if (netpoll_setup(&nt->np)) { + if (netcons_netpoll_setup(&nt->np)) { /* netpoll fails setup once, do not try again. */ netconsole_skb_pool_flush(nt); nt->state =3D STATE_DISABLED; @@ -840,7 +920,7 @@ static ssize_t enabled_store(struct config_item *item, */ netconsole_skb_pool_init(nt); =20 - ret =3D netpoll_setup(&nt->np); + ret =3D netcons_netpoll_setup(&nt->np); if (ret) { netconsole_skb_pool_flush(nt); goto out_unlock; @@ -2430,7 +2510,7 @@ static struct netconsole_target *alloc_param_target(c= har *target_config, */ netconsole_skb_pool_init(nt); =20 - err =3D netpoll_setup(&nt->np); + err =3D netcons_netpoll_setup(&nt->np); if (err) { pr_err("Not enabling netconsole for %s%d. Netpoll setup failed\n", NETCONSOLE_PARAM_TARGET_PREFIX, cmdline_count); diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 0877515fa7442..cd455a5a013d2 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -66,7 +66,6 @@ static inline void netpoll_poll_enable(struct net_device = *dev) { return; } #endif =20 int __netpoll_setup(struct netpoll *np, struct net_device *ndev); -int netpoll_setup(struct netpoll *np); void __netpoll_free(struct netpoll *np); void netpoll_cleanup(struct netpoll *np); void do_netpoll_cleanup(struct netpoll *np); diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 6a545063223ba..d50d48a82def6 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -514,87 +514,6 @@ bool netpoll_local_ip_unset(const struct netpoll *np) } EXPORT_SYMBOL_GPL(netpoll_local_ip_unset); =20 -int netpoll_setup(struct netpoll *np) -{ - struct net *net =3D current->nsproxy->net_ns; - char buf[MAC_ADDR_STR_LEN + 1]; - struct net_device *ndev =3D NULL; - bool ip_overwritten =3D false; - int err; - - rtnl_lock(); - if (np->dev_name[0]) - ndev =3D __dev_get_by_name(net, np->dev_name); - else if (is_valid_ether_addr(np->dev_mac)) - ndev =3D dev_getbyhwaddr(net, ARPHRD_ETHER, np->dev_mac); - - if (!ndev) { - np_err(np, "%s doesn't exist, aborting\n", - egress_dev(np, buf, sizeof(buf))); - err =3D -ENODEV; - goto unlock; - } - netdev_hold(ndev, &np->dev_tracker, GFP_KERNEL); - - if (netdev_master_upper_dev_get(ndev)) { - np_err(np, "%s is a slave device, aborting\n", - egress_dev(np, buf, sizeof(buf))); - err =3D -EBUSY; - goto put; - } - - if (!netif_running(ndev)) { - np_info(np, "device %s not up yet, forcing it\n", - egress_dev(np, buf, sizeof(buf))); - - err =3D dev_open(ndev, NULL); - if (err) { - np_err(np, "failed to open %s\n", ndev->name); - goto put; - } - - rtnl_unlock(); - netpoll_wait_carrier(np, ndev); - rtnl_lock(); - } - - if (netpoll_local_ip_unset(np)) { - if (!np->ipv6) { - err =3D netpoll_take_ipv4(np, ndev); - if (err) - goto put; - } else { - err =3D netpoll_take_ipv6(np, ndev); - if (err) - goto put; - } - ip_overwritten =3D true; - } - - err =3D __netpoll_setup(np, ndev); - if (err) - goto put; - rtnl_unlock(); - - /* Make sure all NAPI polls which started before dev->npinfo - * was visible have exited before we start calling NAPI poll. - * NAPI skips locking if dev->npinfo is NULL. - */ - synchronize_rcu(); - - return 0; - -put: - DEBUG_NET_WARN_ON_ONCE(np->dev); - if (ip_overwritten) - memset(&np->local_ip, 0, sizeof(np->local_ip)); - netdev_put(ndev, &np->dev_tracker); -unlock: - rtnl_unlock(); - return err; -} -EXPORT_SYMBOL(netpoll_setup); - static void rcu_cleanup_netpoll_info(struct rcu_head *rcu_head) { struct netpoll_info *npinfo =3D --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 EE42B43BDC4; Fri, 24 Jul 2026 15:05:24 +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=1784905526; cv=none; b=SYmxcLK5fWRZW1Ey1lQzd7+OkPJ9TCImh/0YewqtkF+J2dBpELOERqe76s92uNFyEwucJNRNYMJYDsS0O4jEAPSO4587DnwunhSHdM0mXIOuk7xUKJFcPvttri29Ia15WU3pmqFKEj2/IQFSlXrmTX9a7rI7n5SO8ftR3uFz+0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905526; c=relaxed/simple; bh=PXM6xACVe72wHAS9AnEVwHbRC8VG1MH+vuha361yWjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oK+P9ReUcYw7zKvA5OnW7Evt0OB15G+PT6fD6dCG6QjU3hFlZoAX5a99gBFe2rY2Yqez+vp0zdLXI5hIRITAB8QKkWiYd6rx+dFhOi/tq1/e9NTxTje3qpX+wAZXswl1jrE5OYwWGekCbPRG3+ulIsXGW+eHmxKiRfeY5vzk5jQ= 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=HTKqvM/j; 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="HTKqvM/j" 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=HZWqqFB/sG9Ou+CAjbWms+SU/vlkUbbTXOQBwjRIFNg=; b=HTKqvM/jDFikVwX0Hao7HJjeQN M6SagyVKdM5VcjE9mEB34riMWYTFSYVUd25UfRnpcjLLuxiShhQHuyWNnvySlDdadLoeBj47KI5Hn R3U8ryu6btpr/ockJqVJPE8hWUnjH04qkXh/nO/5fybVssBNYyVq3Px+ssGlNgxPsmgtUbm39sK7d YfYKf21JfR1gqh89xvW3e58vN9smzQ23JEDjOtPfGT4ylwBBTiMeHjG3KC6c/0fSzWFAygdgjyDjv wg6i1dnj9XG7OdndaDKhEDU5DW398+3Fdv8K5LCMY7PiM1SnM9dBTchv224KDT95jZKi1/xD/Uq1x Y6Qh3iTg==; 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 1wnHSl-004dtd-08; Fri, 24 Jul 2026 15:05:23 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:12 -0700 Subject: [PATCH net-next 4/9] netconsole: move netpoll_local_ip_unset() as netcons_local_ip_unset() 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: <20260724-netconsole_move_more_final-v1-4-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=3526; i=leitao@debian.org; h=from:subject:message-id; bh=PXM6xACVe72wHAS9AnEVwHbRC8VG1MH+vuha361yWjw=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38dCqbrinbRGp2eyCaKGnpGumbBIaayOGbcY eVb1gg6yUqJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HQAKCRA1o5Of/Hh3 bchLEACgVluok5U1WLxHeCaJZHI0p8xshPzI68dm63DqNNJH9/ifMfwGE6Re7a0ZBprzvaNCMvo LEcud3//B+X5pqlQs1kjKuzb94UurSEubi/CIw13cR0ZaIaVfK56dRaHKRgpTg0uYXN1R7ic6Sf 5UzUM/D9MhMNZSQ1tFr7KMbqnY0rF0pGXu650BVJX33fkY53A7WHR4X6mDtWhwTgUf7Slkuasld w0GP0VASN8vKwb22k9a4FJXHEgtdE7i2SF2nGcGja2eVG7141NBDnF8KWPVxEqMFzjw+MDe1bDM UN8CYyb7m/ELkV1k3rqR8oNlBdkvDG41Qm3NHk2JVwsIuLO7Ic/XU6ufQ+2CbK9D/VR3SE8cqsi XDq6FrdZlCpW1IJBNB+8i+4YBpomtv2/a7m5Wzs2DSpik64Xx4QkV0ksFn8/xdHKiLxXVUv/+6e vz2i5CdzpfQPY7HGDvoI9/JdPpWdnKe01UZvQ6JFOn9hZS7HKX9/mutN5X2HFks6H0Fv9Epaysr PUbVpTbr8d6N6BWG8CLX7oRNFyXMlCFkT1gI9Uk8mXKdBceCVjVtuNUW4qQOaNJrB2vUwuuWeDI x3SYg3Rn+Or66QpB4BeH/WDA2fGuOyfaxhrOrGEXCdttAjPA0DWMvgoF6J+sxlc7nJa4TihrRCA ndTrTly0kxTv4vQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Move netpoll_local_ip_unset() from netpoll to netconsole and rename it to netcons_local_ip_unset(); The body is otherwise unchanged, only the comment's setup-function reference is updated. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 19 ++++++++++++++++++- include/linux/netpoll.h | 1 - net/core/netpoll.c | 18 ------------------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 3a7a2cafc6276..70f9c5bfb3720 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -351,6 +351,23 @@ static void netconsole_skb_pool_flush(struct netconsol= e_target *nt) skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED); } =20 +/* + * Test whether the caller left np->local_ip unset, so that + * netcons_netpoll_setup() should auto-populate it from the egress device. + * + * np->local_ip is a union of __be32 (IPv4) and struct in6_addr (IPv6), + * so an IPv6 address whose first 4 bytes are zero (e.g. ::1, ::2, + * IPv4-mapped ::ffff:a.b.c.d) must not be tested via the IPv4 arm =E2=80= =94 + * doing so would misclassify a caller-supplied address as unset and + * silently overwrite it with whatever address the device exposes. + */ +static bool netcons_local_ip_unset(const struct netpoll *np) +{ + if (np->ipv6) + return ipv6_addr_any(&np->local_ip.in6); + return !np->local_ip.ip; +} + static int netcons_netpoll_setup(struct netpoll *np) { struct net *net =3D current->nsproxy->net_ns; @@ -395,7 +412,7 @@ static int netcons_netpoll_setup(struct netpoll *np) rtnl_lock(); } =20 - if (netpoll_local_ip_unset(np)) { + if (netcons_local_ip_unset(np)) { if (!np->ipv6) { err =3D netpoll_take_ipv4(np, ndev); if (err) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index cd455a5a013d2..da05884f876e5 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -76,7 +76,6 @@ void netpoll_wait_carrier(struct netpoll *np, struct net_= device *ndev); char *egress_dev(struct netpoll *np, char *buf, size_t bufsz); int netpoll_take_ipv4(struct netpoll *np, struct net_device *ndev); int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev); -bool netpoll_local_ip_unset(const struct netpoll *np); =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 d50d48a82def6..f4b110cb04167 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -496,24 +496,6 @@ int netpoll_take_ipv4(struct netpoll *np, struct net_d= evice *ndev) } EXPORT_SYMBOL_GPL(netpoll_take_ipv4); =20 -/* - * Test whether the caller left np->local_ip unset, so that - * netpoll_setup() should auto-populate it from the egress device. - * - * np->local_ip is a union of __be32 (IPv4) and struct in6_addr (IPv6), - * so an IPv6 address whose first 4 bytes are zero (e.g. ::1, ::2, - * IPv4-mapped ::ffff:a.b.c.d) must not be tested via the IPv4 arm =E2=80= =94 - * doing so would misclassify a caller-supplied address as unset and - * silently overwrite it with whatever address the device exposes. - */ -bool netpoll_local_ip_unset(const struct netpoll *np) -{ - if (np->ipv6) - return ipv6_addr_any(&np->local_ip.in6); - return !np->local_ip.ip; -} -EXPORT_SYMBOL_GPL(netpoll_local_ip_unset); - static void rcu_cleanup_netpoll_info(struct rcu_head *rcu_head) { struct netpoll_info *npinfo =3D --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 9C4D32E06D2; Fri, 24 Jul 2026 15:05:29 +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=1784905531; cv=none; b=rUlKIuhnbAKuayt2V1fAIlnqr1NmaeJXPWHCgPMwu67DGIztqcH4ASBj9zmEt4E5m+8puDiVrp51fDGlAUnNfnEeB7FDR1Lq+fBKQrqg9HbxQASOObmy6JLscrONlQFkkQ+YfazWbhHFUYIsAA/Q4SXssndmNg9O7VBoVS30Cd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905531; c=relaxed/simple; bh=mlDY/zX2KTie5pzo4FqkW9q27O9eKpjbY7m3QfH26SI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GzrPGc+r5mhKJiaBvId3Q+Qxy9rba6qarlRo+bIpTGbZVHMPWuIYVugMomkIJ5318no+Xy8PWdH9Fc1b9PBViM0GwE28moTv5NljfDRIanSv8ax2PMirtGcGv4wRKhDzQ5YDw7URH/l+oXfjQLsZp41RsoslWEyq8tnsRmzjGGg= 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=CCoHBQ0y; 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="CCoHBQ0y" 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=x95ozE6vlaiEbH/s1wIisxnuJ0Bxj6JFRSh9n0PbKN4=; b=CCoHBQ0ya9YAtB7G6xPNP4iGKF /S/Fw6pgfIJZUjE41uKSnPhkvQGXqD+FRwL0b3wAsV6iPrwMFPKdX4/mhb9d64VIh6gHAVjoeXqOl /kk1WSxmfCw25zR/AzG1wgEuuj2DGUqV3vqoWpKrrvE2Qw43MkwLqdMpFmZ3ZtmnyZog0OkUqInh0 Pgezj6NCNuzIwMM/LG74mOyDaCQZ3o+CeLyboN5XbR0JAZbt14CRPTXi5FQzAcKu94I7f2heCfDQR 25rN36POsBffcvycgmzUUl+jI/i7RMRiF8l2vVzedlAdaE05N/JzRrkXO5WNwkh7IYR73f6MXafmK 1AF3oqjA==; 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 1wnHSo-004dtq-2q; Fri, 24 Jul 2026 15:05:27 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:13 -0700 Subject: [PATCH net-next 5/9] netconsole: move netpoll_take_ipv4() as netcons_take_ipv4() 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: <20260724-netconsole_move_more_final-v1-5-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=3903; i=leitao@debian.org; h=from:subject:message-id; bh=mlDY/zX2KTie5pzo4FqkW9q27O9eKpjbY7m3QfH26SI=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38e1nUf/pYpF31wSiMV9NPzjcXQyUGnLkXoX TVBstdv9piJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HgAKCRA1o5Of/Hh3 bSPYD/48+GyqUWq4wGPfVCbI3V4Z+sYISs5Z3XyCfiJhgqwe5rNi/X4PsVKETiUw1S8hT4Tu8ON OER0Ge0zswFnlNBGRJrIkp+QVjpvFb8XpHUIrT7cRF1MORmd84CvK44JZX311Zse2uqIjqH50OV 5AW7IMtSTROmkDKKvMdLU3EcvO0yizHUgW2uXlTu1+SAUWkFKky/VHoveGabTwbz1tWQkPYjYVt yZ/zRk49c8YsN8up7I65cwYREMCK3HwxcpzUKcdFixo65TdcpgvDaQglY4Hze1JprcGtv6rqm58 hTrFFulccsm0Ykp221gbMx8QhiGYZE6mAuhHlIHVrfVqO/LpFkPHZlcxXVTD3DriGXy46yL0Df9 jaND5XWfb9u3ZKBeYfWLfZj+jGwMe9jTlnfi5jbxs7n7SFVFbWyck+BULmxcOTyEbRz+l8PI13X p6CZ2PRRxGxSl5+Inv+dFkpbwbYIwrt0Q3/JXroozfVgeoakfRWwp8YzK4jY/zP5MHf0YKb8A67 uzNACu79E/QG5K5/Pv9LAcHsyHvAO3aM64bcoID9NUUNyjpScXzBaUVMaLuAJRtsbjqWm4sl4ls dc5ug7xtgH930QGN33d0+hdqCD3j0aGZS32TrGwaTtkExEHyrf+y/xk7KUOABVVDLFqL2YzHKFL /G5J8zJs1VpL+Ow== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Move netpoll_take_ipv4() to netconsole, which is the only user. Rename it to netcons_take_ipv4() for the netcons_ prefix. The body is unchanged. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 32 +++++++++++++++++++++++++++++++- include/linux/netpoll.h | 1 - net/core/netpoll.c | 30 ------------------------------ 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 70f9c5bfb3720..9506b1e1193fd 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -351,6 +352,35 @@ static void netconsole_skb_pool_flush(struct netconsol= e_target *nt) skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED); } =20 +/* + * Take the IPv4 from ndev and populate local_ip structure in netpoll + */ +static int netcons_take_ipv4(struct netpoll *np, struct net_device *ndev) +{ + char buf[MAC_ADDR_STR_LEN + 1]; + const struct in_ifaddr *ifa; + struct in_device *in_dev; + + in_dev =3D __in_dev_get_rtnl(ndev); + if (!in_dev) { + np_err(np, "no IP address for %s, aborting\n", + egress_dev(np, buf, sizeof(buf))); + return -EDESTADDRREQ; + } + + ifa =3D rtnl_dereference(in_dev->ifa_list); + if (!ifa) { + np_err(np, "no IP address for %s, aborting\n", + egress_dev(np, buf, sizeof(buf))); + return -EDESTADDRREQ; + } + + np->local_ip.ip =3D ifa->ifa_local; + np_info(np, "local IP %pI4\n", &np->local_ip.ip); + + return 0; +} + /* * Test whether the caller left np->local_ip unset, so that * netcons_netpoll_setup() should auto-populate it from the egress device. @@ -414,7 +444,7 @@ static int netcons_netpoll_setup(struct netpoll *np) =20 if (netcons_local_ip_unset(np)) { if (!np->ipv6) { - err =3D netpoll_take_ipv4(np, ndev); + err =3D netcons_take_ipv4(np, ndev); if (err) goto put; } else { diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index da05884f876e5..e212cb86a9429 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -74,7 +74,6 @@ void netpoll_zap_completion_queue(void); unsigned int netpoll_get_carrier_timeout(void); void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev); char *egress_dev(struct netpoll *np, char *buf, size_t bufsz); -int netpoll_take_ipv4(struct netpoll *np, struct net_device *ndev); int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev); =20 #ifdef CONFIG_NETPOLL diff --git a/net/core/netpoll.c b/net/core/netpoll.c index f4b110cb04167..60c3faf9ea944 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -466,36 +466,6 @@ int netpoll_take_ipv6(struct netpoll *np, struct net_d= evice *ndev) } EXPORT_SYMBOL_GPL(netpoll_take_ipv6); =20 -/* - * Take the IPv4 from ndev and populate local_ip structure in netpoll - */ -int netpoll_take_ipv4(struct netpoll *np, struct net_device *ndev) -{ - char buf[MAC_ADDR_STR_LEN + 1]; - const struct in_ifaddr *ifa; - struct in_device *in_dev; - - in_dev =3D __in_dev_get_rtnl(ndev); - if (!in_dev) { - np_err(np, "no IP address for %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); - return -EDESTADDRREQ; - } - - ifa =3D rtnl_dereference(in_dev->ifa_list); - if (!ifa) { - np_err(np, "no IP address for %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); - return -EDESTADDRREQ; - } - - np->local_ip.ip =3D ifa->ifa_local; - np_info(np, "local IP %pI4\n", &np->local_ip.ip); - - return 0; -} -EXPORT_SYMBOL_GPL(netpoll_take_ipv4); - static void rcu_cleanup_netpoll_info(struct rcu_head *rcu_head) { struct netpoll_info *npinfo =3D --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 800C32E06D2; Fri, 24 Jul 2026 15:05: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=1784905535; cv=none; b=FveJqeFgj19ZovicbEpzp2YY1fkWnrTRECRLlqY0Jm5WmVbKl+XB6aB/44SJJDPzxjdDFSHxUq27Mm1pj/p5utks+S4TcBCHpJCf1LVGTlbj+I4KWcKDYR6WKIINjWdaNaItxU/7/vpbxKYO3GXwMr/X4NUIYZs4hWShLV0WWTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905535; c=relaxed/simple; bh=5NWr276nfsb9wy6M3mzvluqmgGsc9a7+js9/Cs1kgH4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k16sMQhNlkkphhaZszFI5CZFgIiDavdj+Vyl9cqt4WNre5Mt+08+TfNZ7XeWtEUs432zgCSphks542K+VXP69nrcR1xvOstL41tX9fAXNRHwPS+2hL9Wj4v+uwV9CHcA1m88ui5usjkINudCz0LZtcDODLy6MuEd1oQ9LfDecMU= 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=QhzP7qAm; 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="QhzP7qAm" 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=0UTvVrKvQbjV2z09c5HIhwKfNEpVhCVsdba1S1ijn7E=; b=QhzP7qAmhCRBJRWIBRUtZRfncZ 0vNk1UcaKKKgQ8TWfjtU5uo5NBsNszCD/kXGsdOO7UBkTCM+MlOUUwKlB5uU03SGthvEyeR3ZKDfy lgMd3ib62N9rDULcMRM/pc+GL0TxdONRSsrc8ZQTx3GADHtdHylaio5FVFBxuhyo7k3HeZJjmtmkb L6D7UHJ7HLkwUgRF5RD087k/js9LuxumSgvdkg06o6pDnaFBv/gCH1j/Mr0osccL3RPAatqnD9FrN OK8zcQSZvshrfllcNAxyBxGhDe4iZV3lQ5tOexE4xyL+28CMXodBiudZrFDBVY+yKHymxUC8eR3dW Nz7567qg==; 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 1wnHSu-004duB-1u; Fri, 24 Jul 2026 15:05:32 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:14 -0700 Subject: [PATCH net-next 6/9] netconsole: move netpoll_take_ipv6() as netcons_take_ipv6() 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: <20260724-netconsole_move_more_final-v1-6-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4448; i=leitao@debian.org; h=from:subject:message-id; bh=5NWr276nfsb9wy6M3mzvluqmgGsc9a7+js9/Cs1kgH4=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38eQMhOplqT7oNojJmVOaNgO5b0d2/cjSsHo wvhWcaWoOOJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HgAKCRA1o5Of/Hh3 bcg1EACHGr1Bfelbbnq1xYAcovUdbhas6OC35weclVb2Qi+2v2qi4Q6gFzARTudI5EyiM9fCbb8 iDfpf8QibuItBWfs0gvVUZfEbM2KsIO1jDUuztt7dCur+gMS2it4NqZDlyBpA3om9pl8RMdY+3q cyAF73CIqGsfn5prs593We8QD3qrIEoRE9vFYcnajbVW11qy5N+89MC5sGbKWTX6/OTGrxmI+xy ilD2EniEZq272xDrp4ce4mMs1yDUOvMbERQSBPc8Yu+wWDw2Aflwn3Yet45AM8ElZwNC5vi37JX pOGCLTNHiE3c+K0qifPH0BEZ7IU1SeIwxGH6irtqDMvFJrxQl3B7Y4rx9pLYOfaaFoCI/avSZD8 wHJA7ItyAhxedn+tqCZcHT/cpZh26IdfRbcBw1ZG17tt4H7y06hRCnbHlJJ/wxW6jgH1YnMkBn/ 11F7DuCabujpHvI+FjtkXk1eycW/chL3cugcdWxO7Y4tmE45VvIL0GDJ86JvQO1FnjZr+ta3Sy8 df4Yb18DgE9Mz5vP5sxuJ3Kqi3gIUH5UqN06o+kHQRET5A8zi4htfIaXvft6d1c1xPSHQ6xU7xZ I4XnWxGDVA/e/kdmkHUozLQAFG9V1L8yLcokgM/e9CkTIaAaHH5x7t0tPF3UasIzxFigLfiV2qi 5RmR1hn+jF+sGvg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Move netpoll_take_ipv6() to netconsole, and add netcons_ prefix. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 44 +++++++++++++++++++++++++++++++++++++++++++- include/linux/netpoll.h | 1 - net/core/netpoll.c | 42 ------------------------------------------ 3 files changed, 43 insertions(+), 44 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 9506b1e1193fd..b6cbda4722d5b 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -352,6 +353,47 @@ static void netconsole_skb_pool_flush(struct netconsol= e_target *nt) skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED); } =20 +/* + * Take the IPv6 from ndev and populate local_ip structure in netpoll + */ +static int netcons_take_ipv6(struct netpoll *np, struct net_device *ndev) +{ + char buf[MAC_ADDR_STR_LEN + 1]; + int err =3D -EDESTADDRREQ; + struct inet6_dev *idev; + + if (!IS_ENABLED(CONFIG_IPV6)) { + np_err(np, "IPv6 is not supported %s, aborting\n", + egress_dev(np, buf, sizeof(buf))); + return -EINVAL; + } + + idev =3D __in6_dev_get(ndev); + if (idev) { + struct inet6_ifaddr *ifp; + + read_lock_bh(&idev->lock); + list_for_each_entry(ifp, &idev->addr_list, if_list) { + if (!!(ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL) !=3D + !!(ipv6_addr_type(&np->remote_ip.in6) & IPV6_ADDR_LINKLOCAL)) + continue; + /* Got the IP, let's return */ + np->local_ip.in6 =3D ifp->addr; + err =3D 0; + break; + } + read_unlock_bh(&idev->lock); + } + if (err) { + np_err(np, "no IPv6 address for %s, aborting\n", + egress_dev(np, buf, sizeof(buf))); + return err; + } + + np_info(np, "local IPv6 %pI6c\n", &np->local_ip.in6); + return 0; +} + /* * Take the IPv4 from ndev and populate local_ip structure in netpoll */ @@ -448,7 +490,7 @@ static int netcons_netpoll_setup(struct netpoll *np) if (err) goto put; } else { - err =3D netpoll_take_ipv6(np, ndev); + err =3D netcons_take_ipv6(np, ndev); if (err) goto put; } diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index e212cb86a9429..7736339f9880e 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -74,7 +74,6 @@ void netpoll_zap_completion_queue(void); unsigned int netpoll_get_carrier_timeout(void); void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev); char *egress_dev(struct netpoll *np, char *buf, size_t bufsz); -int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev); =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 60c3faf9ea944..246aa2bfd7805 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -424,48 +424,6 @@ void netpoll_wait_carrier(struct netpoll *np, struct n= et_device *ndev) } EXPORT_SYMBOL_GPL(netpoll_wait_carrier); =20 -/* - * Take the IPv6 from ndev and populate local_ip structure in netpoll - */ -int netpoll_take_ipv6(struct netpoll *np, struct net_device *ndev) -{ - char buf[MAC_ADDR_STR_LEN + 1]; - int err =3D -EDESTADDRREQ; - struct inet6_dev *idev; - - if (!IS_ENABLED(CONFIG_IPV6)) { - np_err(np, "IPv6 is not supported %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); - return -EINVAL; - } - - idev =3D __in6_dev_get(ndev); - if (idev) { - struct inet6_ifaddr *ifp; - - read_lock_bh(&idev->lock); - list_for_each_entry(ifp, &idev->addr_list, if_list) { - if (!!(ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL) !=3D - !!(ipv6_addr_type(&np->remote_ip.in6) & IPV6_ADDR_LINKLOCAL)) - continue; - /* Got the IP, let's return */ - np->local_ip.in6 =3D ifp->addr; - err =3D 0; - break; - } - read_unlock_bh(&idev->lock); - } - if (err) { - np_err(np, "no IPv6 address for %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); - return err; - } - - np_info(np, "local IPv6 %pI6c\n", &np->local_ip.in6); - return 0; -} -EXPORT_SYMBOL_GPL(netpoll_take_ipv6); - static void rcu_cleanup_netpoll_info(struct rcu_head *rcu_head) { struct netpoll_info *npinfo =3D --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 6DB96442B23; Fri, 24 Jul 2026 15:05:38 +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=1784905540; cv=none; b=SkGgD2XGu4r4EwuL/bwDIB+2wN0JQZ7JhoCCI519lKVvg1Nlq1WCSK9kYNLoT4dMCD0wnfzTKj90ddGb4IAqWeK10odfE2FNYu2CRxsl1K2smDBRN3hlvgIQFBg5j6zbQ0YRd5mv1sTpYttHK6rm24bbjnwcc+y9jIAnY+ZIJOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905540; c=relaxed/simple; bh=0GT3H6luF68DLEJYuF2v8B2YQnks5PYIrQ6WewmJIUc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gfk+CqELeZhfHc6ady2FVVZFATJIoKt8ifuHsE24kUU5kuVebF2Vh8I3OOI6CN+z3fYwAU+H+BJwvWl6NKH2Tysf8euowwNGodyDIyrxqc8+x+TkuUMgSAuKrTS+QTz3Tt71jUxCYhZ2tFK/+P2JhBzcKpR5F1+/6wukdXyyWXA= 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=nJfMDqeB; 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="nJfMDqeB" 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=o1W+gUNCPN3ikfxj2HMnWY41j2z+OLXY31chZvXltFQ=; b=nJfMDqeBBmZ/98QV+syCXWkcCx /Llz/t+O1VG3SOXcwVS/7q3dNR/fVvgOlG5ptrMDP7kP/Otlz5axMYO3Pr7LMZnqMTXWHjK5I/T+m uogjgWN56yXfi4ta1W99AwHG/2yWQgqaOk8hU3xxoQqPiUYwOfAlqF6ZcXSmRyOpWjXH+e0HdG+zq iYVn8Pmdp+zRx/cdMC6jlpI8bJBmbL8raRBT0zFitwZRpDAwbM3K+i2lEQdpXqXcg7i9RNQqSq3xl evWaWUkA9rmtOK3NukC8oyFjW5zklQxJ3NSOKK3QMXMqNTqsoXt1R186c75BtT/t9ydfH9k9Rfy47 CG2kd7JA==; 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 1wnHSy-004duS-1Q; Fri, 24 Jul 2026 15:05:36 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:15 -0700 Subject: [PATCH net-next 7/9] netconsole: move egress_dev() as netcons_egress_dev() 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: <20260724-netconsole_move_more_final-v1-7-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=4819; i=leitao@debian.org; h=from:subject:message-id; bh=0GT3H6luF68DLEJYuF2v8B2YQnks5PYIrQ6WewmJIUc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38e3Jt6sC1N3+oOagaxQbgMdNc0spH4kE81s gEJLlS/DOqJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HgAKCRA1o5Of/Hh3 bQ43EACcVZYkfYy7M5l88DK2ZDkJlY4QpEGlMBV23W5H8drQYXH6bSN/Ed/+42KhtFteufGvvAG yYyqB9WJEcirP4x5/o8NEKfLaR8b5oFdXUgRYNRWxBDv0cvzPqIo2yv0bxje259ua694drpky+C FVLAZuCapTIvU63/1k74eAgii4505SGP/rM2Uq1l4llFLVntmoFB+FwQiLUi0rxS5u/7/Yy32UZ LdI79OHHnl484YqX8xB6Q+QvZtBKW6O7qIR/rp7+DOftz76X1XUunjB3nVN/GAnXrQnFfGdUyj1 MiwbwkwGPJqIjI/6xdhb4mnuXR2mYz2UA8+RvVfJT+1zgBZ+1oWdFPxN2pXsCq9UN31kzE3mg+a 0E4xjzXvsJY92A+VgzIIoa537Dq4LFwdEnv7nF0rFiLy2/bgkP58oTipdXqknfK3KxL9Q91A7y+ MxL56I9R5AN8MMC5DJAiBP/FrVEz0ioP9/u0pSC9f5LsION7QFyzWY3CEy0+yD03jVJV/ZBcB5o 1AmzVcwCwQY7D+PQtHKMk/ueWTTyST0vasBcK2eJZrsOzx1DrmkUVvh6HEPrZL2G7XXD8xft6VS SHHQBeFfyr2oZQgVQOoxPZ2rcWqVVvt8SnZpOOO3gWJlG9cjbOPYsp0DNQCJ/LSUATRdwwWtlPk E/S1F+t14ItqBQw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao move egress_dev() from netpoll to netconsole, and append netcons_ prefix. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 30 +++++++++++++++++++++++------- include/linux/netpoll.h | 1 - net/core/netpoll.c | 17 ----------------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index b6cbda4722d5b..fc575adc29bd7 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -353,6 +353,22 @@ static void netconsole_skb_pool_flush(struct netconsol= e_target *nt) skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED); } =20 +/* + * Returns a pointer to a string representation of the identifier used + * to select the egress interface for the given netpoll instance. buf + * is used to format np->dev_mac when np->dev_name is empty; bufsz must + * be at least MAC_ADDR_STR_LEN + 1 to fit the formatted MAC address + * and its NUL terminator. + */ +static char *netcons_egress_dev(struct netpoll *np, char *buf, size_t bufs= z) +{ + if (np->dev_name[0]) + return np->dev_name; + + snprintf(buf, bufsz, "%pM", np->dev_mac); + return buf; +} + /* * Take the IPv6 from ndev and populate local_ip structure in netpoll */ @@ -364,7 +380,7 @@ static int netcons_take_ipv6(struct netpoll *np, struct= net_device *ndev) =20 if (!IS_ENABLED(CONFIG_IPV6)) { np_err(np, "IPv6 is not supported %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); return -EINVAL; } =20 @@ -386,7 +402,7 @@ static int netcons_take_ipv6(struct netpoll *np, struct= net_device *ndev) } if (err) { np_err(np, "no IPv6 address for %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); return err; } =20 @@ -406,14 +422,14 @@ static int netcons_take_ipv4(struct netpoll *np, stru= ct net_device *ndev) in_dev =3D __in_dev_get_rtnl(ndev); if (!in_dev) { np_err(np, "no IP address for %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); return -EDESTADDRREQ; } =20 ifa =3D rtnl_dereference(in_dev->ifa_list); if (!ifa) { np_err(np, "no IP address for %s, aborting\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); return -EDESTADDRREQ; } =20 @@ -456,7 +472,7 @@ static int netcons_netpoll_setup(struct netpoll *np) =20 if (!ndev) { np_err(np, "%s doesn't exist, aborting\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); err =3D -ENODEV; goto unlock; } @@ -464,14 +480,14 @@ static int netcons_netpoll_setup(struct netpoll *np) =20 if (netdev_master_upper_dev_get(ndev)) { np_err(np, "%s is a slave device, aborting\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); err =3D -EBUSY; goto put; } =20 if (!netif_running(ndev)) { np_info(np, "device %s not up yet, forcing it\n", - egress_dev(np, buf, sizeof(buf))); + netcons_egress_dev(np, buf, sizeof(buf))); =20 err =3D dev_open(ndev, NULL); if (err) { diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 7736339f9880e..dac8dc2529de0 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -73,7 +73,6 @@ netdev_tx_t netpoll_send_skb(struct netpoll *np, struct s= k_buff *skb); void netpoll_zap_completion_queue(void); unsigned int netpoll_get_carrier_timeout(void); void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev); -char *egress_dev(struct netpoll *np, char *buf, size_t bufsz); =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 246aa2bfd7805..f385ae4b70f5c 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -392,23 +392,6 @@ int __netpoll_setup(struct netpoll *np, struct net_dev= ice *ndev) } EXPORT_SYMBOL_GPL(__netpoll_setup); =20 -/* - * Returns a pointer to a string representation of the identifier used - * to select the egress interface for the given netpoll instance. buf - * is used to format np->dev_mac when np->dev_name is empty; bufsz must - * be at least MAC_ADDR_STR_LEN + 1 to fit the formatted MAC address - * and its NUL terminator. - */ -char *egress_dev(struct netpoll *np, char *buf, size_t bufsz) -{ - if (np->dev_name[0]) - return np->dev_name; - - snprintf(buf, bufsz, "%pM", np->dev_mac); - return buf; -} -EXPORT_SYMBOL_GPL(egress_dev); - void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev) { unsigned long atmost; --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:21 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 AF33B442FC2; Fri, 24 Jul 2026 15:05:42 +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=1784905544; cv=none; b=MZKbM3G6ews1bgqXrASQEYHpIhoYKaQe0XHi+pIcVP4PDN8gunN6j3Vw/zmdp3pmCnkUpGitQp7EanTbp7nZy2LKKh4SYBiFRUYznZ1hPHp2BtMLOW5DqfCMAcKIWC4SHIQQjp6Gff+vU3LX1gptOSu2AIYZQ25FQGmO+i273qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905544; c=relaxed/simple; bh=T6zfCgyixfhFVf6mf7wUgxE7TI3tXpKbZSGQeq1uEzw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ovHOt4D8597J6O3B5JzNsXueRl8rRZOqX+Z13fD8v94yeJhpBORhpSLMNC7Ib/dRPp6thppdTgHSI5PCxa8DifMTgoUISeAz+HnY9hZntHhEkrv0Qlp9tNfIpAMIqMRG7Y0LpqCWNtxR7UZKUxOGju8AW5ma4RMoodtmJUuiS8s= 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=n6pp7OLO; 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="n6pp7OLO" 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=90xnO+J2mJ+eHNoKZAPHI75XwrWJYe6aVGfen1xqeg4=; b=n6pp7OLOSVsL3hf4AGjURX9+Iw HPrul7uIiSU9kpzgWZfH8qwCDTMqHQ1+iCFgzriSEewvUBHavvKHrevFxaQSTlTNIqcT92rBmjxsS 3sNhcARzNs/8Bo+tSPK7d/tdVaSwJyI6KYg8woD6U1jfsdTXme4gfqngOuJIgApawspaAoZWp51DL 9+EVgEwO/jdrasFnxKw33SAkY+GXk31CKlemPdXG+VXleIPh4RKJS9YMSsZez42iplYdEwxoZ4FQ2 QmyBFrv0CqAukTK7MZ+tGNJY5WvYoKIUUSb925VKVgG1YsZEwB78cxGldRt10RsX834LwhEDrhSrb /vMYaTIw==; 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 1wnHT2-004duy-1k; Fri, 24 Jul 2026 15:05:40 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:16 -0700 Subject: [PATCH net-next 8/9] netconsole: move local_ip/remote_ip/ipv6 to netconsole_target 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: <20260724-netconsole_move_more_final-v1-8-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=14995; i=leitao@debian.org; h=from:subject:message-id; bh=T6zfCgyixfhFVf6mf7wUgxE7TI3tXpKbZSGQeq1uEzw=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38eq/951/Jwq5/GaKGErp9PrkhX2TvYIKnsW to6aM7sq32JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HgAKCRA1o5Of/Hh3 bXP5D/9CZgw+J//ES7ydu3yNqpBFpZoR7GrTntXg3WEnOoS724UIwRUDbRkg1eADKA3Z0dEVoTW zqmETve9JoS4XWddND+WInkdVqdr23w5E4vf34qWkxwEk6Qg3W+Xq3xrZawS0/ng6G8zrhu0hGl nl6jUXYCW3bBOybpjeuF8EVaghoNX2jvJRmUISa2Pe6lbWwLWFLCK6YtIB1jhvvqveYuqN0sGja nbxcfhUsj4jIQsr+HNlx5ggvZhOxIXd/CkX1VyIZQvmOYJucL0J4/xg62Zh5/o1e+zgrqORs+J3 VEttVuhmBNeYqj8tBZJBd9B5GVVTD98L7LqHkgOAitM4eVGu9RygX2JZy4KW4qK8Kzdts5H3Ox2 jP+IjUMvBJQJL651lVcWfPm4m7fOO9zjKC8TWjrFsRuAiucgwQjTWlh7DOXOz+bb5hayEDJ+nP6 pJ9Myz8DJyRNp8RIlrnL016+QmyPfGCEzTiQaK2SRLpl4U3O/DPV4bBpR/5Vf+IPUD96MzKeS7i qbqsoKW9wYN02tOYYWSeXQ/JV5gXsRvzLffANhy7OV3dYj9d7HkWlM0ZWQ3t0slp8VLZGqtzsG1 fSx6RYiBhyj2dIx8aHncitP+/u0O/UhIjdZCFHnm0Rr63+W3YweNeWdZ3aN32I83aQqEls85gqO rZZ+cVoE94CtpXw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao With netpoll_setup() and the packet-building path now living in netconsole, local_ip, remote_ip and ipv6 in struct netpoll are read and written only by netconsole. No other netpoll user touches them. Move the three fields into netconsole_target and switch the packet builders and setup helpers to take the target instead of the netpoll handle. struct netpoll is left holding only the device-binding state that the shared netpoll transport needs. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 143 +++++++++++++++++++++++++------------------= ---- include/linux/netpoll.h | 3 - 2 files changed, 76 insertions(+), 70 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index fc575adc29bd7..199d0e1ac17b2 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -177,9 +177,10 @@ enum target_state { * @np: The netpoll structure for this target. * Contains the other userspace visible parameters: * dev_name (read-write) - * local_ip (read-write) - * remote_ip (read-write) * local_mac (read-only) + * @local_ip: Source IP address of the target (read-write). + * @remote_ip: Destination IP address of the target (read-write). + * @ipv6: Whether the target addresses are IPv6 (read-write). * @local_port: Source UDP port of the target (read-write). * @remote_port: Destination UDP port of the target (read-write). * @remote_mac: Destination ethernet address of the target (read-write). @@ -210,6 +211,8 @@ struct netconsole_target { bool extended; bool release; struct netpoll np; + union inet_addr local_ip, remote_ip; + bool ipv6; u16 local_port, remote_port; u8 remote_mac[ETH_ALEN]; /* protected by target_list_lock; +1 gives scnprintf() room for its @@ -370,11 +373,13 @@ static char *netcons_egress_dev(struct netpoll *np, c= har *buf, size_t bufsz) } =20 /* - * Take the IPv6 from ndev and populate local_ip structure in netpoll + * Populate the target's local_ip with the IPv6 address from ndev. */ -static int netcons_take_ipv6(struct netpoll *np, struct net_device *ndev) +static int netcons_take_ipv6(struct netconsole_target *nt, + struct net_device *ndev) { char buf[MAC_ADDR_STR_LEN + 1]; + struct netpoll *np =3D &nt->np; int err =3D -EDESTADDRREQ; struct inet6_dev *idev; =20 @@ -391,10 +396,10 @@ static int netcons_take_ipv6(struct netpoll *np, stru= ct net_device *ndev) read_lock_bh(&idev->lock); list_for_each_entry(ifp, &idev->addr_list, if_list) { if (!!(ipv6_addr_type(&ifp->addr) & IPV6_ADDR_LINKLOCAL) !=3D - !!(ipv6_addr_type(&np->remote_ip.in6) & IPV6_ADDR_LINKLOCAL)) + !!(ipv6_addr_type(&nt->remote_ip.in6) & IPV6_ADDR_LINKLOCAL)) continue; /* Got the IP, let's return */ - np->local_ip.in6 =3D ifp->addr; + nt->local_ip.in6 =3D ifp->addr; err =3D 0; break; } @@ -406,16 +411,18 @@ static int netcons_take_ipv6(struct netpoll *np, stru= ct net_device *ndev) return err; } =20 - np_info(np, "local IPv6 %pI6c\n", &np->local_ip.in6); + np_info(np, "local IPv6 %pI6c\n", &nt->local_ip.in6); return 0; } =20 /* - * Take the IPv4 from ndev and populate local_ip structure in netpoll + * Populate the target's local_ip with the IPv4 address from ndev. */ -static int netcons_take_ipv4(struct netpoll *np, struct net_device *ndev) +static int netcons_take_ipv4(struct netconsole_target *nt, + struct net_device *ndev) { char buf[MAC_ADDR_STR_LEN + 1]; + struct netpoll *np =3D &nt->np; const struct in_ifaddr *ifa; struct in_device *in_dev; =20 @@ -433,34 +440,35 @@ static int netcons_take_ipv4(struct netpoll *np, stru= ct net_device *ndev) return -EDESTADDRREQ; } =20 - np->local_ip.ip =3D ifa->ifa_local; - np_info(np, "local IP %pI4\n", &np->local_ip.ip); + nt->local_ip.ip =3D ifa->ifa_local; + np_info(np, "local IP %pI4\n", &nt->local_ip.ip); =20 return 0; } =20 /* - * Test whether the caller left np->local_ip unset, so that + * Test whether the caller left nt->local_ip unset, so that * netcons_netpoll_setup() should auto-populate it from the egress device. * - * np->local_ip is a union of __be32 (IPv4) and struct in6_addr (IPv6), + * nt->local_ip is a union of __be32 (IPv4) and struct in6_addr (IPv6), * so an IPv6 address whose first 4 bytes are zero (e.g. ::1, ::2, * IPv4-mapped ::ffff:a.b.c.d) must not be tested via the IPv4 arm =E2=80= =94 * doing so would misclassify a caller-supplied address as unset and * silently overwrite it with whatever address the device exposes. */ -static bool netcons_local_ip_unset(const struct netpoll *np) +static bool netcons_local_ip_unset(const struct netconsole_target *nt) { - if (np->ipv6) - return ipv6_addr_any(&np->local_ip.in6); - return !np->local_ip.ip; + if (nt->ipv6) + return ipv6_addr_any(&nt->local_ip.in6); + return !nt->local_ip.ip; } =20 -static int netcons_netpoll_setup(struct netpoll *np) +static int netcons_netpoll_setup(struct netconsole_target *nt) { struct net *net =3D current->nsproxy->net_ns; char buf[MAC_ADDR_STR_LEN + 1]; struct net_device *ndev =3D NULL; + struct netpoll *np =3D &nt->np; bool ip_overwritten =3D false; int err; =20 @@ -500,13 +508,13 @@ static int netcons_netpoll_setup(struct netpoll *np) rtnl_lock(); } =20 - if (netcons_local_ip_unset(np)) { - if (!np->ipv6) { - err =3D netcons_take_ipv4(np, ndev); + if (netcons_local_ip_unset(nt)) { + if (!nt->ipv6) { + err =3D netcons_take_ipv4(nt, ndev); if (err) goto put; } else { - err =3D netcons_take_ipv6(np, ndev); + err =3D netcons_take_ipv6(nt, ndev); if (err) goto put; } @@ -529,7 +537,7 @@ static int netcons_netpoll_setup(struct netpoll *np) put: DEBUG_NET_WARN_ON_ONCE(np->dev); if (ip_overwritten) - memset(&np->local_ip, 0, sizeof(np->local_ip)); + memset(&nt->local_ip, 0, sizeof(nt->local_ip)); netdev_put(ndev, &np->dev_tracker); unlock: rtnl_unlock(); @@ -546,7 +554,7 @@ static void resume_target(struct netconsole_target *nt) */ netconsole_skb_pool_init(nt); =20 - if (netcons_netpoll_setup(&nt->np)) { + if (netcons_netpoll_setup(nt)) { /* netpoll fails setup once, do not try again. */ netconsole_skb_pool_flush(nt); nt->state =3D STATE_DISABLED; @@ -691,17 +699,17 @@ static void netconsole_print_banner(struct netconsole= _target *nt) struct netpoll *np =3D &nt->np; =20 np_info(np, "local port %d\n", nt->local_port); - if (np->ipv6) - np_info(np, "local IPv6 address %pI6c\n", &np->local_ip.in6); + if (nt->ipv6) + np_info(np, "local IPv6 address %pI6c\n", &nt->local_ip.in6); else - np_info(np, "local IPv4 address %pI4\n", &np->local_ip.ip); + np_info(np, "local IPv4 address %pI4\n", &nt->local_ip.ip); np_info(np, "interface name '%s'\n", np->dev_name); np_info(np, "local ethernet address '%pM'\n", np->dev_mac); np_info(np, "remote port %d\n", nt->remote_port); - if (np->ipv6) - np_info(np, "remote IPv6 address %pI6c\n", &np->remote_ip.in6); + if (nt->ipv6) + np_info(np, "remote IPv6 address %pI6c\n", &nt->remote_ip.in6); else - np_info(np, "remote IPv4 address %pI4\n", &np->remote_ip.ip); + np_info(np, "remote IPv4 address %pI4\n", &nt->remote_ip.ip); np_info(np, "remote ethernet address %pM\n", nt->remote_mac); } =20 @@ -832,20 +840,20 @@ static ssize_t local_ip_show(struct config_item *item= , char *buf) { struct netconsole_target *nt =3D to_target(item); =20 - if (nt->np.ipv6) - return sysfs_emit(buf, "%pI6c\n", &nt->np.local_ip.in6); + if (nt->ipv6) + return sysfs_emit(buf, "%pI6c\n", &nt->local_ip.in6); else - return sysfs_emit(buf, "%pI4\n", &nt->np.local_ip); + return sysfs_emit(buf, "%pI4\n", &nt->local_ip); } =20 static ssize_t remote_ip_show(struct config_item *item, char *buf) { struct netconsole_target *nt =3D to_target(item); =20 - if (nt->np.ipv6) - return sysfs_emit(buf, "%pI6c\n", &nt->np.remote_ip.in6); + if (nt->ipv6) + return sysfs_emit(buf, "%pI6c\n", &nt->remote_ip.in6); else - return sysfs_emit(buf, "%pI4\n", &nt->np.remote_ip); + return sysfs_emit(buf, "%pI4\n", &nt->remote_ip); } =20 static ssize_t local_mac_show(struct config_item *item, char *buf) @@ -1025,7 +1033,7 @@ static ssize_t enabled_store(struct config_item *item, */ netconsole_skb_pool_init(nt); =20 - ret =3D netcons_netpoll_setup(&nt->np); + ret =3D netcons_netpoll_setup(nt); if (ret) { netconsole_skb_pool_flush(nt); goto out_unlock; @@ -1199,10 +1207,10 @@ static ssize_t local_ip_store(struct config_item *i= tem, const char *buf, goto out_unlock; } =20 - ipv6 =3D netpoll_parse_ip_addr(buf, &nt->np.local_ip); + ipv6 =3D netpoll_parse_ip_addr(buf, &nt->local_ip); if (ipv6 =3D=3D -1) goto out_unlock; - nt->np.ipv6 =3D !!ipv6; + nt->ipv6 =3D !!ipv6; =20 ret =3D count; out_unlock: @@ -1224,10 +1232,10 @@ static ssize_t remote_ip_store(struct config_item *= item, const char *buf, goto out_unlock; } =20 - ipv6 =3D netpoll_parse_ip_addr(buf, &nt->np.remote_ip); + ipv6 =3D netpoll_parse_ip_addr(buf, &nt->remote_ip); if (ipv6 =3D=3D -1) goto out_unlock; - nt->np.ipv6 =3D !!ipv6; + nt->ipv6 =3D !!ipv6; =20 ret =3D count; out_unlock: @@ -2027,8 +2035,8 @@ static struct sk_buff *find_skb(struct netconsole_tar= get *nt, int len, return skb; } =20 -static void netpoll_udp_checksum(struct netpoll *np, struct sk_buff *skb, - int len) +static void netpoll_udp_checksum(struct netconsole_target *nt, + struct sk_buff *skb, int len) { struct udphdr *udph; int udp_len; @@ -2038,14 +2046,14 @@ static void netpoll_udp_checksum(struct netpoll *np= , struct sk_buff *skb, =20 /* 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, + if (nt->ipv6) + udph->check =3D csum_ipv6_magic(&nt->local_ip.in6, + &nt->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, + udph->check =3D csum_tcpudp_magic(nt->local_ip.ip, + nt->remote_ip.ip, udp_len, IPPROTO_UDP, csum_partial(udph, udp_len, 0)); if (udph->check =3D=3D 0) @@ -2054,7 +2062,6 @@ static void netpoll_udp_checksum(struct netpoll *np, = struct sk_buff *skb, =20 static void push_udp(struct netconsole_target *nt, struct sk_buff *skb, in= t len) { - struct netpoll *np =3D &nt->np; struct udphdr *udph; int udp_len; =20 @@ -2068,7 +2075,7 @@ static void push_udp(struct netconsole_target *nt, st= ruct sk_buff *skb, int len) udph->dest =3D htons(nt->remote_port); udp_set_len_short(udph, udp_len); =20 - netpoll_udp_checksum(np, skb, len); + netpoll_udp_checksum(nt, skb, len); } =20 static void push_eth(struct netconsole_target *nt, struct sk_buff *skb) @@ -2080,13 +2087,14 @@ static void push_eth(struct netconsole_target *nt, = struct sk_buff *skb) skb_reset_mac_header(skb); ether_addr_copy(eth->h_source, np->dev->dev_addr); ether_addr_copy(eth->h_dest, nt->remote_mac); - if (np->ipv6) + if (nt->ipv6) eth->h_proto =3D htons(ETH_P_IPV6); else eth->h_proto =3D htons(ETH_P_IP); } =20 -static void push_ipv4(struct netpoll *np, struct sk_buff *skb, int len) +static void push_ipv4(struct netconsole_target *nt, struct sk_buff *skb, + int len) { static atomic_t ip_ident; struct iphdr *iph; @@ -2107,13 +2115,14 @@ static void push_ipv4(struct netpoll *np, struct sk= _buff *skb, int len) 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); + put_unaligned(nt->local_ip.ip, &iph->saddr); + put_unaligned(nt->remote_ip.ip, &iph->daddr); iph->check =3D ip_fast_csum((unsigned char *)iph, iph->ihl); skb->protocol =3D htons(ETH_P_IP); } =20 -static void push_ipv6(struct netpoll *np, struct sk_buff *skb, int len) +static void push_ipv6(struct netconsole_target *nt, struct sk_buff *skb, + int len) { struct ipv6hdr *ip6h; =20 @@ -2130,8 +2139,8 @@ static void push_ipv6(struct netpoll *np, struct sk_b= uff *skb, int len) 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; + ip6h->saddr =3D nt->local_ip.in6; + ip6h->daddr =3D nt->remote_ip.in6; =20 skb->protocol =3D htons(ETH_P_IPV6); } @@ -2147,7 +2156,7 @@ static int netpoll_send_udp(struct netconsole_target = *nt, const char *msg, WARN_ON_ONCE(!irqs_disabled()); =20 udp_len =3D len + sizeof(struct udphdr); - if (np->ipv6) + if (nt->ipv6) ip_len =3D udp_len + sizeof(struct ipv6hdr); else ip_len =3D udp_len + sizeof(struct iphdr); @@ -2163,10 +2172,10 @@ static int netpoll_send_udp(struct netconsole_targe= t *nt, const char *msg, skb_put(skb, len); =20 push_udp(nt, skb, len); - if (np->ipv6) - push_ipv6(np, skb, len); + if (nt->ipv6) + push_ipv6(nt, skb, len); else - push_ipv4(np, skb, len); + push_ipv4(nt, skb, len); push_eth(nt, skb); skb->dev =3D np->dev; =20 @@ -2505,11 +2514,11 @@ static int netconsole_parser_cmdline(struct netcons= ole_target *nt, char *opt) if (!delim) goto parse_failed; *delim =3D 0; - ipv6 =3D netpoll_parse_ip_addr(cur, &np->local_ip); + ipv6 =3D netpoll_parse_ip_addr(cur, &nt->local_ip); if (ipv6 < 0) goto parse_failed; else - np->ipv6 =3D (bool)ipv6; + nt->ipv6 =3D (bool)ipv6; cur =3D delim; } cur++; @@ -2551,13 +2560,13 @@ static int netconsole_parser_cmdline(struct netcons= ole_target *nt, char *opt) if (!delim) goto parse_failed; *delim =3D 0; - ipv6 =3D netpoll_parse_ip_addr(cur, &np->remote_ip); + ipv6 =3D netpoll_parse_ip_addr(cur, &nt->remote_ip); if (ipv6 < 0) goto parse_failed; - else if (ipversion_set && np->ipv6 !=3D (bool)ipv6) + else if (ipversion_set && nt->ipv6 !=3D (bool)ipv6) goto parse_failed; else - np->ipv6 =3D (bool)ipv6; + nt->ipv6 =3D (bool)ipv6; cur =3D delim + 1; =20 if (*cur !=3D 0) { @@ -2615,7 +2624,7 @@ static struct netconsole_target *alloc_param_target(c= har *target_config, */ netconsole_skb_pool_init(nt); =20 - err =3D netcons_netpoll_setup(&nt->np); + err =3D netcons_netpoll_setup(nt); if (err) { pr_err("Not enabling netconsole for %s%d. Netpoll setup failed\n", NETCONSOLE_PARAM_TARGET_PREFIX, cmdline_count); diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index dac8dc2529de0..ef88a30b11f40 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -32,9 +32,6 @@ struct netpoll { char dev_name[IFNAMSIZ]; u8 dev_mac[ETH_ALEN]; const char *name; - - union inet_addr local_ip, remote_ip; - bool ipv6; }; =20 #define np_info(np, fmt, ...) \ --=20 2.53.0-Meta From nobody Fri Jul 24 21:30:22 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 8940F3FF8BD; Fri, 24 Jul 2026 15:05:46 +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=1784905548; cv=none; b=caisosJ1nuR0PFpMsAFIukrHDvPXBf0M9CDTwPU5ZBMKeC1yqXmOGQObo/f3Egct2nunLOR4bXIC4Q0a9SC/sVi4bj4YwGyCze5ZFHNsXb/9xkfsqWJWgcvUC7jIiSBRF+2d5CVrPOZEmB599IKIS4hVoRFbfUizNPn1rCjA4bA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784905548; c=relaxed/simple; bh=+A8B0JPSmD/xUyC+pYs2LiOcJ/XUtyBFB0JYHXAm1MQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qqj3kdHyUZG3L0Ujzcl4zUuHq6VPe134JhszKC0wwa8FtDRXMeV3Rv11x68CV04qv4zFWm9lfr+cUm5EQh03Uy9HJiGd87uLZY7JpRPYBK6P6r5SrnaeQ1Hv6sopwbQFcjewtQOWHELYtgaYvNk7Fk01B3TY/U8kOJ/+1LyOL0U= 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=T3cVR16e; 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="T3cVR16e" 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=lv/c+QRGRLtWRpVznQafej5v9W18F2xyE1OZZGHaCVg=; b=T3cVR16e1Gru5GfYXPU98uH7Yw eeygEj8Wj0xF2dSkfBkXUHMgXP0oSF1a97ZJGRt6EDWN1PTY49eV2Jo/mVRIeTPQFtzFOpPXr9DXW v/AHk1Q3F+ADJzquM4wMGjMfJ2BEkdG9mQo+aIGyP+NlyYbjhLuz/P23rlkSvrjnvYsqMwzEYuc/4 dMMfTyN03bGlB1hFehkBAvAHM3IsnS763vfavgIT75l/gc27Wqre96ppVEL8cavTo9249BA288Y6g 7KZRQs8/Ks8WLxgC0f6AqWmNMFNYNC8Z78TEZXccKH9GVHxRZ0GQv91UATsCvsk1sykxpHH9+BBbw BEKPkOxA==; 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 1wnHT6-004dvE-1x; Fri, 24 Jul 2026 15:05:44 +0000 From: Breno Leitao Date: Fri, 24 Jul 2026 08:04:17 -0700 Subject: [PATCH net-next 9/9] netconsole: move netpoll_wait_carrier() as netcons_wait_carrier() 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: <20260724-netconsole_move_more_final-v1-9-a5f7691db81c@debian.org> References: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrew Lunn Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, gustavold@gmail.com, asantostc@gmail.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-d5d98 X-Developer-Signature: v=1; a=openpgp-sha256; l=3360; i=leitao@debian.org; h=from:subject:message-id; bh=+A8B0JPSmD/xUyC+pYs2LiOcJ/XUtyBFB0JYHXAm1MQ=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqY38evC/p7PSLCmKg+KA8GeI40lbdTs3SyQCcO tzwUg9d5iuJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCamN/HgAKCRA1o5Of/Hh3 bWWWD/0f837U/WtUTf+1lifEKya6uv/6rvbOlgxHyN89bxp5aGjVRT+Qr4nO+UW1it235G9muFl ZtC1BbLPmJ84lBcxWllGf5pafDhG4qgklm8nbnyv/Ww11JJnDIXvVG4dK1Y5TA5ADCIyPWYUD4a 5XzS62MDANo0S4Uz+f8cPcEDZvvYODP0QDLXZPaCy33L3kvyBceIBGjBb/07w8B8tn2LdbETQuJ uZv+m2BWmgA54OAi85V22wfslfuqMp4ufOc4bBzrlJZFsW9V6QUhz+hwkwex6tlR6CMf0/qte54 CMJisqDW0BiazmMhloBIaDOExnXaoSPQB9uQaP3NcRL1fKE32konzkY2rjrVUMad7v5IKbNTdV4 oGvfxl50liP/h+TK0gEekV8jA0e/jwNogCep5r7hf5oTEwX1QmHr6ks8IsJOTkXPUIqB4K/lSOO TrnTQxcSPME7IdOzLJqpTuFizjNpA0y3VPyHRLkRPQeq7SmxikEoVnZfbCIpBLWj4zBjunUUtGg Jls0BaNRnsxQN00ZZtfF2yEcr+EXng7lkAGlVjK0Uk/6gvK1UozljIv/OmWkGytKwCquUKMs2O3 OF9Vt3GT4tNadcrzbn+P+1km/SYLvjZ5jQjtnZYXrbQeKT6gjqrd8v5aMZVtGos34R7ba0Kcuej EU5tVcgzZjqZVKw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao netpoll_wait_carrier() waits for the egress device carrier during netconsole setup. Its only caller, netcons_netpoll_setup(), already lives in netconsole. Move the function into drivers/net/netconsole.c, drop EXPORT_SYMBOL_GPL() and remove the prototype from . Rename it to netcons_wait_carrier() for the netcons_ prefix. It now reads the timeout through netpoll_get_carrier_timeout(), since carrier_timeout stays in netpoll to keep the netpoll.carrier_timeout parameter. Signed-off-by: Breno Leitao --- drivers/net/netconsole.c | 17 ++++++++++++++++- include/linux/netpoll.h | 1 - net/core/netpoll.c | 15 --------------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 199d0e1ac17b2..03913302328cc 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -48,6 +48,7 @@ #include #include #include +#include =20 MODULE_AUTHOR("Matt Mackall "); MODULE_DESCRIPTION("Console driver for network interfaces"); @@ -356,6 +357,20 @@ static void netconsole_skb_pool_flush(struct netconsol= e_target *nt) skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED); } =20 +static void netcons_wait_carrier(struct netpoll *np, struct net_device *nd= ev) +{ + unsigned long atmost; + + atmost =3D jiffies + netpoll_get_carrier_timeout() * HZ; + while (!netif_carrier_ok(ndev)) { + if (time_after(jiffies, atmost)) { + np_notice(np, "timeout waiting for carrier\n"); + break; + } + msleep(1); + } +} + /* * Returns a pointer to a string representation of the identifier used * to select the egress interface for the given netpoll instance. buf @@ -504,7 +519,7 @@ static int netcons_netpoll_setup(struct netconsole_targ= et *nt) } =20 rtnl_unlock(); - netpoll_wait_carrier(np, ndev); + netcons_wait_carrier(np, ndev); rtnl_lock(); } =20 diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index ef88a30b11f40..1c6b1eec5efd6 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -69,7 +69,6 @@ void do_netpoll_cleanup(struct netpoll *np); netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb); void netpoll_zap_completion_queue(void); unsigned int netpoll_get_carrier_timeout(void); -void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev); =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 f385ae4b70f5c..fe1e0cda5d6bf 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -392,21 +392,6 @@ int __netpoll_setup(struct netpoll *np, struct net_dev= ice *ndev) } EXPORT_SYMBOL_GPL(__netpoll_setup); =20 -void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev) -{ - unsigned long atmost; - - atmost =3D jiffies + carrier_timeout * HZ; - while (!netif_carrier_ok(ndev)) { - if (time_after(jiffies, atmost)) { - np_notice(np, "timeout waiting for carrier\n"); - break; - } - msleep(1); - } -} -EXPORT_SYMBOL_GPL(netpoll_wait_carrier); - static void rcu_cleanup_netpoll_info(struct rcu_head *rcu_head) { struct netpoll_info *npinfo =3D --=20 2.53.0-Meta