netconsole: move netpoll_wait_carrier() as netcons_wait_carrier()

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@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-9-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Breno Leitao 2026-07-24 08:04:17 -07:00 committed by Paolo Abeni
parent a111639647
commit dc50a5c9cd
3 changed files with 16 additions and 17 deletions

View File

@ -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@selenic.com>");
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();
}

View File

@ -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)

View File

@ -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 =