From: Maksym Kutsevol <max@kutsevol.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Breno Leitao <leitao@debian.org>,
Maksym Kutsevol <max@kutsevol.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] netpoll: Make netpoll_send_udp return status instead of void
Date: Wed, 28 Aug 2024 14:33:48 -0700 [thread overview]
Message-ID: <20240828214524.1867954-1-max@kutsevol.com> (raw)
In-Reply-To: <20240824215130.2134153-1-max@kutsevol.com>
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(-)
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);
base-commit: 3a0504d54b3b57f0d7bf3d9184a00c9f8887f6d7
--
2.43.5
next prev parent reply other threads:[~2024-08-28 21:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-24 21:50 [PATCH " Maksym Kutsevol
2024-08-24 21:50 ` [PATCH 2/2] netcons: Add udp send fail statistics to netconsole Maksym Kutsevol
2024-08-26 21:35 ` Jakub Kicinski
2024-08-26 23:55 ` Maksym Kutsevol
2024-08-27 13:59 ` Jakub Kicinski
2024-08-28 15:03 ` Maksym Kutsevol
2024-08-28 15:24 ` Breno Leitao
2024-08-28 15:33 ` Maksym Kutsevol
2024-08-27 6:32 ` kernel test robot
2024-08-27 9:36 ` kernel test robot
2024-08-27 12:18 ` Breno Leitao
2024-08-28 15:04 ` Maksym Kutsevol
[not found] ` <CAO6EAnVXXfQRK1xWoxO+dQwQsftw3bhOz27cQPNX=TzCutkrQQ@mail.gmail.com>
[not found] ` <Zs8//o3EDLtt+eTY@gmail.com>
2024-08-28 15:31 ` Maksym Kutsevol
2024-08-28 21:33 ` Maksym Kutsevol [this message]
2024-08-28 21:33 ` [PATCH v2 " Maksym Kutsevol
2024-08-30 8:45 ` Breno Leitao
2024-08-30 12:58 ` Maksym Kutsevol
2024-08-30 14:12 ` Breno Leitao
2024-08-30 15:37 ` Maksym Kutsevol
2024-08-28 22:57 ` [PATCH v2 1/2] netpoll: Make netpoll_send_udp return status instead of void Jakub Kicinski
2024-08-28 23:16 ` Maksym Kutsevol
2024-08-30 8:46 ` 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=20240828214524.1867954-1-max@kutsevol.com \
--to=max@kutsevol.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.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
all inboxes | Powered by JetHome®