Netdev List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Andrew Lunn <andrew+netdev@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 gustavold@gmail.com, asantostc@gmail.com,
	Breno Leitao <leitao@debian.org>,
	 kernel-team@meta.com
Subject: [PATCH net-next 7/9] netconsole: move egress_dev() as netcons_egress_dev()
Date: Fri, 24 Jul 2026 08:04:15 -0700	[thread overview]
Message-ID: <20260724-netconsole_move_more_final-v1-7-a5f7691db81c@debian.org> (raw)
In-Reply-To: <20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org>

move egress_dev() from netpoll to netconsole, and append netcons_
prefix.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 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 netconsole_target *nt)
 	skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED);
 }
 
+/*
+ * 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 bufsz)
+{
+	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)
 
 	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;
 	}
 
@@ -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;
 	}
 
@@ -406,14 +422,14 @@ static int netcons_take_ipv4(struct netpoll *np, struct net_device *ndev)
 	in_dev = __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;
 	}
 
 	ifa = 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;
 	}
 
@@ -456,7 +472,7 @@ static int netcons_netpoll_setup(struct netpoll *np)
 
 	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 = -ENODEV;
 		goto unlock;
 	}
@@ -464,14 +480,14 @@ static int netcons_netpoll_setup(struct netpoll *np)
 
 	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 = -EBUSY;
 		goto put;
 	}
 
 	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)));
 
 		err = 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 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);
 
 #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_device *ndev)
 }
 EXPORT_SYMBOL_GPL(__netpoll_setup);
 
-/*
- * 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;

-- 
2.53.0-Meta


  parent reply	other threads:[~2026-07-24 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 15:04 [PATCH net-next 0/9] netpoll: finish untangling netconsole from netpoll Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 1/9] netpoll: export carrier_timeout via netpoll_get_carrier_timeout() Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 2/9] netpoll: export the netpoll_setup() helpers for netconsole Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 3/9] netconsole: take over netpoll_setup() from netpoll Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 4/9] netconsole: move netpoll_local_ip_unset() as netcons_local_ip_unset() Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 5/9] netconsole: move netpoll_take_ipv4() as netcons_take_ipv4() Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 6/9] netconsole: move netpoll_take_ipv6() as netcons_take_ipv6() Breno Leitao
2026-07-24 15:04 ` Breno Leitao [this message]
2026-07-24 15:04 ` [PATCH net-next 8/9] netconsole: move local_ip/remote_ip/ipv6 to netconsole_target Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 9/9] netconsole: move netpoll_wait_carrier() as netcons_wait_carrier() Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260724-netconsole_move_more_final-v1-7-a5f7691db81c@debian.org \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=asantostc@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavold@gmail.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox