[PATCH net-next 1/9] netpoll: export carrier_timeout via netpoll_get_carrier_timeout()
From: Breno Leitao
Date: Fri Jul 24 2026 - 11:15:06 EST
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 <leitao@xxxxxxxxxx>
---
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);
#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 @@
#define USEC_PER_POLL 50
+/*
+ * carrier_timeout is netconsole-specific and only kept here to preserve the
+ * netpoll.carrier_timeout module-parameter ABI. Its value is exposed to
+ * netconsole through netpoll_get_carrier_timeout().
+ */
static unsigned int carrier_timeout = 4;
module_param(carrier_timeout, uint, 0644);
+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;
}
-static void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev,
- unsigned int timeout)
+static void netpoll_wait_carrier(struct netpoll *np, struct net_device *ndev)
{
unsigned long atmost;
- atmost = jiffies + timeout * HZ;
+ atmost = 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)
}
rtnl_unlock();
- netpoll_wait_carrier(np, ndev, carrier_timeout);
+ netpoll_wait_carrier(np, ndev);
rtnl_lock();
}
--
2.53.0-Meta