[PATCH net-next 9/9] netconsole: move netpoll_wait_carrier() as netcons_wait_carrier()
From: Breno Leitao
Date: Fri Jul 24 2026 - 11:22:04 EST
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 <linux/netpoll.h>.
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 <leitao@xxxxxxxxxx>
---
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 <linux/utsname.h>
#include <linux/rtnetlink.h>
#include <linux/workqueue.h>
+#include <linux/delay.h>
MODULE_AUTHOR("Matt Mackall <mpm@xxxxxxxxxxx>");
MODULE_DESCRIPTION("Console driver for network interfaces");
@@ -356,6 +357,20 @@ static void netconsole_skb_pool_flush(struct netconsole_target *nt)
skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED);
}
+static void netcons_wait_carrier(struct netpoll *np, struct net_device *ndev)
+{
+ unsigned long atmost;
+
+ atmost = 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_target *nt)
}
rtnl_unlock();
- netpoll_wait_carrier(np, ndev);
+ netcons_wait_carrier(np, ndev);
rtnl_lock();
}
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);
#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_device *ndev)
}
EXPORT_SYMBOL_GPL(__netpoll_setup);
-void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev)
-{
- unsigned long atmost;
-
- atmost = 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 =
--
2.53.0-Meta