diff mbox series

[v2,1/2] netpoll: Make netpoll_send_udp return status instead of void

Message ID 20240828214524.1867954-1-max@kutsevol.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2,1/2] netpoll: Make netpoll_send_udp return status instead of void | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Maksym Kutsevol Aug. 28, 2024, 9:33 p.m. UTC
netpoll_send_udp can return if send was successful.
It will allow client code to be aware of the send status.

Possible return values are the result of __netpoll_send_skb (cast to int)
and -ENOMEM. This doesn't cover the case when TX was not successful
instantaneously and was scheduled for later, __netpoll__send_skb returns
success in that case.

Signed-off-by: Maksym Kutsevol <max@kutsevol.com>
---
Used in the next patch to expose send failure stats in netconsole

Changelog:

v2: No changes, resend.

v1:
 * https://lore.kernel.org/netdev/20240824215130.2134153-1-max@kutsevol.com/

 include/linux/netpoll.h | 2 +-
 net/core/netpoll.c      | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)


base-commit: 3a0504d54b3b57f0d7bf3d9184a00c9f8887f6d7

Comments

Jakub Kicinski Aug. 28, 2024, 10:57 p.m. UTC | #1
On Wed, 28 Aug 2024 14:33:48 -0700 Maksym Kutsevol wrote:
> netpoll_send_udp can return if send was successful.
> It will allow client code to be aware of the send status.
> 
> Possible return values are the result of __netpoll_send_skb (cast to int)
> and -ENOMEM. This doesn't cover the case when TX was not successful
> instantaneously and was scheduled for later, __netpoll__send_skb returns
> success in that case.

no need to repost but, quoting documentation:

  Resending after review
  ~~~~~~~~~~~~~~~~~~~~~~
  
  Allow at least 24 hours to pass between postings. This will ensure reviewers
  from all geographical locations have a chance to chime in. Do not wait
  too long (weeks) between postings either as it will make it harder for reviewers
  to recall all the context.
  
  Make sure you address all the feedback in your new posting. Do not post a new
  version of the code if the discussion about the previous version is still
  ongoing, unless directly instructed by a reviewer.
  
  The new version of patches should be posted as a separate thread,
  not as a reply to the previous posting. Change log should include a link
  to the previous posting (see :ref:`Changes requested`).
  
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#resending-after-review
Maksym Kutsevol Aug. 28, 2024, 11:16 p.m. UTC | #2
Hey Jakub,

On Wed, Aug 28, 2024 at 6:58 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed, 28 Aug 2024 14:33:48 -0700 Maksym Kutsevol wrote:
> > netpoll_send_udp can return if send was successful.
> > It will allow client code to be aware of the send status.
> >
> > Possible return values are the result of __netpoll_send_skb (cast to int)
> > and -ENOMEM. This doesn't cover the case when TX was not successful
> > instantaneously and was scheduled for later, __netpoll__send_skb returns
> > success in that case.
>
> no need to repost but, quoting documentation:
I definitely didn't find this doc, thanks for the link, looked at it,
and I see at least another error in
this submission - there's no designation which tree it's for, it
should be net-next. Will follow
the doc for in the future.
Breno Leitao Aug. 30, 2024, 8:46 a.m. UTC | #3
On Wed, Aug 28, 2024 at 02:33:48PM -0700, Maksym Kutsevol wrote:
> netpoll_send_udp can return if send was successful.
> It will allow client code to be aware of the send status.
> 
> Possible return values are the result of __netpoll_send_skb (cast to int)
> and -ENOMEM. This doesn't cover the case when TX was not successful
> instantaneously and was scheduled for later, __netpoll__send_skb returns
> success in that case.
> 
> Signed-off-by: Maksym Kutsevol <max@kutsevol.com>

Reviewed-by: Breno Leitao <leitao@debian.org>
diff mbox series

Patch

diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index bd19c4b91e31..10ceef618e40 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -56,7 +56,7 @@  static inline void netpoll_poll_disable(struct net_device *dev) { return; }
 static inline void netpoll_poll_enable(struct net_device *dev) { return; }
 #endif
 
-void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
+int netpoll_send_udp(struct netpoll *np, const char *msg, int len);
 void netpoll_print_options(struct netpoll *np);
 int netpoll_parse_options(struct netpoll *np, char *opt);
 int __netpoll_setup(struct netpoll *np, struct net_device *ndev);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index d657b042d5a0..664343e3b688 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -395,7 +395,7 @@  netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
 }
 EXPORT_SYMBOL(netpoll_send_skb);
 
-void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
+int netpoll_send_udp(struct netpoll *np, const char *msg, int len)
 {
 	int total_len, ip_len, udp_len;
 	struct sk_buff *skb;
@@ -419,7 +419,7 @@  void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
 	skb = find_skb(np, total_len + np->dev->needed_tailroom,
 		       total_len - len);
 	if (!skb)
-		return;
+		return -ENOMEM;
 
 	skb_copy_to_linear_data(skb, msg, len);
 	skb_put(skb, len);
@@ -495,7 +495,7 @@  void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
 
 	skb->dev = np->dev;
 
-	netpoll_send_skb(np, skb);
+	return (int)netpoll_send_skb(np, skb);
 }
 EXPORT_SYMBOL(netpoll_send_udp);