Make zap_completion_queue() a globally visible symbol by changing its
linkage to non-static and adding EXPORT_SYMBOL_GPL.
This is a true netpoll function that will be needed by non-netpoll
functions that will be moved away from netpoll.
This will allow moving the skb pool management to netconsole, mainly
find_skb(), which invokes zap_completion_queue(), and will be moved to
netconsole.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
include/linux/netpoll.h | 1 +
net/core/netpoll.c | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 65bfade025f09..7f8b4d758a1e7 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -75,6 +75,7 @@ void __netpoll_free(struct netpoll *np);
void do_netpoll_cleanup(struct netpoll *np);
netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
struct sk_buff *find_skb(struct netpoll *np, int len, int reserve);
+void zap_completion_queue(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 9e12a667a5f0a..04a55ec392fd2 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -50,8 +50,6 @@
sizeof(struct udphdr) + \
MAX_UDP_CHUNK)
-static void zap_completion_queue(void);
-
static unsigned int carrier_timeout = 4;
module_param(carrier_timeout, uint, 0644);
@@ -240,7 +238,7 @@ static void refill_skbs(struct netpoll *np)
spin_unlock_irqrestore(&skb_pool->lock, flags);
}
-static void zap_completion_queue(void)
+void zap_completion_queue(void)
{
unsigned long flags;
struct softnet_data *sd = &get_cpu_var(softnet_data);
@@ -267,6 +265,7 @@ static void zap_completion_queue(void)
put_cpu_var(softnet_data);
}
+EXPORT_SYMBOL_GPL(zap_completion_queue);
struct sk_buff *find_skb(struct netpoll *np, int len, int reserve)
{
--
2.47.3
Breno Leitao wrote: > Make zap_completion_queue() a globally visible symbol by changing its > linkage to non-static and adding EXPORT_SYMBOL_GPL. > > This is a true netpoll function that will be needed by non-netpoll > functions that will be moved away from netpoll. > > This will allow moving the skb pool management to netconsole, mainly > find_skb(), which invokes zap_completion_queue(), and will be moved to > netconsole. > > Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Willem de Bruijn <willemb@google.com> > --- > include/linux/netpoll.h | 1 + > net/core/netpoll.c | 5 ++--- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h > index 65bfade025f09..7f8b4d758a1e7 100644 > --- a/include/linux/netpoll.h > +++ b/include/linux/netpoll.h > @@ -75,6 +75,7 @@ void __netpoll_free(struct netpoll *np); > void do_netpoll_cleanup(struct netpoll *np); > netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb); > struct sk_buff *find_skb(struct netpoll *np, int len, int reserve); > +void zap_completion_queue(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 9e12a667a5f0a..04a55ec392fd2 100644 > --- a/net/core/netpoll.c > +++ b/net/core/netpoll.c > @@ -50,8 +50,6 @@ > sizeof(struct udphdr) + \ > MAX_UDP_CHUNK) > > -static void zap_completion_queue(void); > - > static unsigned int carrier_timeout = 4; > module_param(carrier_timeout, uint, 0644); > > @@ -240,7 +238,7 @@ static void refill_skbs(struct netpoll *np) > spin_unlock_irqrestore(&skb_pool->lock, flags); > } > > -static void zap_completion_queue(void) > +void zap_completion_queue(void) > { > unsigned long flags; > struct softnet_data *sd = &get_cpu_var(softnet_data); > @@ -267,6 +265,7 @@ static void zap_completion_queue(void) > > put_cpu_var(softnet_data); > } > +EXPORT_SYMBOL_GPL(zap_completion_queue); consider EXPORT_SYMBOL_NS_GPL(zap_completion_queue, "NETDEV_INTERNAL");
On Tue, Sep 02, 2025 at 06:50:25PM -0400, Willem de Bruijn wrote: > Breno Leitao wrote: > > include/linux/netpoll.h | 1 + > > net/core/netpoll.c | 5 ++--- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > .... > > -static void zap_completion_queue(void) > > +void zap_completion_queue(void) > > { > > unsigned long flags; > > struct softnet_data *sd = &get_cpu_var(softnet_data); > > @@ -267,6 +265,7 @@ static void zap_completion_queue(void) > > > > put_cpu_var(softnet_data); > > } > > +EXPORT_SYMBOL_GPL(zap_completion_queue); > > consider EXPORT_SYMBOL_NS_GPL(zap_completion_queue, "NETDEV_INTERNAL"); Thanks for the suggestion. First time I've heard about the export by Namespace. I suppose then I need to have `MODULE_IMPORT_NS("NETDEV_INTERNAL");` called at the caller side, right? --breno
Breno Leitao wrote: > On Tue, Sep 02, 2025 at 06:50:25PM -0400, Willem de Bruijn wrote: > > Breno Leitao wrote: > > > include/linux/netpoll.h | 1 + > > > net/core/netpoll.c | 5 ++--- > > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > .... > > > -static void zap_completion_queue(void) > > > +void zap_completion_queue(void) > > > { > > > unsigned long flags; > > > struct softnet_data *sd = &get_cpu_var(softnet_data); > > > @@ -267,6 +265,7 @@ static void zap_completion_queue(void) > > > > > > put_cpu_var(softnet_data); > > > } > > > +EXPORT_SYMBOL_GPL(zap_completion_queue); > > > > consider EXPORT_SYMBOL_NS_GPL(zap_completion_queue, "NETDEV_INTERNAL"); > > Thanks for the suggestion. First time I've heard about the export by > Namespace. I suppose then I need to have > `MODULE_IMPORT_NS("NETDEV_INTERNAL");` called at the caller side, right? That's right. The feature is fairly new. I don't think we have clear guidelines what is and what isn't in scope yet. In this case, it seems clear to me that this API is not intended for broad use, so falls well within the area. More context in Documentation/networking/netdevices.rst
© 2016 - 2025 Red Hat, Inc.