Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= <bjorn.topel@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [RFC PATCH bpf-next 5/9] xsk: add busy-poll support for {recv, send}msg()
Date: Wed, 28 Oct 2020 14:34:33 +0100	[thread overview]
Message-ID: <20201028133437.212503-6-bjorn.topel@gmail.com> (raw)
In-Reply-To: <20201028133437.212503-1-bjorn.topel@gmail.com>

From: Bj?rn T?pel <bjorn.topel@intel.com>

Wire-up XDP socket busy-poll support for recvmsg() and sendmsg().

Signed-off-by: Bj?rn T?pel <bjorn.topel@intel.com>
---
 net/xdp/xsk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index 2e5b9f27c7a3..da649b4f377c 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -23,6 +23,7 @@
 #include <linux/netdevice.h>
 #include <linux/rculist.h>
 #include <net/xdp_sock_drv.h>
+#include <net/busy_poll.h>
 #include <net/xdp.h>
 
 #include "xsk_queue.h"
@@ -472,6 +473,9 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
 	if (unlikely(need_wait))
 		return -EOPNOTSUPP;
 
+	if (sk_can_busy_loop(sk))
+		sk_busy_loop(sk, 1); /* only support non-blocking sockets */
+
 	pool = xs->pool;
 	if (pool->cached_need_wakeup & XDP_WAKEUP_TX)
 		return __xsk_sendmsg(sk);
@@ -493,6 +497,9 @@ static int xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, int fl
 	if (unlikely(need_wait))
 		return -EOPNOTSUPP;
 
+	if (sk_can_busy_loop(sk))
+		sk_busy_loop(sk, 1); /* only support non-blocking sockets */
+
 	if (xs->pool->cached_need_wakeup & XDP_WAKEUP_RX && xs->zc)
 		return xsk_wakeup(xs, XDP_WAKEUP_RX);
 	return 0;
-- 
2.27.0


  parent reply	other threads:[~2020-10-28 13:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 13:34 [Intel-wired-lan] [RFC PATCH bpf-next 0/9] Introduce biased busy-polling =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 1/9] net: introduce " =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 2/9] net: add SO_BUSY_POLL_BUDGET socket option =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 3/9] xsk: add support for recvmsg() =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 4/9] xsk: check need wakeup flag in sendmsg() =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= [this message]
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 6/9] xsk: propagate napi_id to XDP socket Rx path =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 7/9] samples/bpf: use recvfrom() in xdpsock =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 8/9] samples/bpf: add busy-poll support to xdpsock =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 13:34 ` [Intel-wired-lan] [RFC PATCH bpf-next 9/9] samples/bpf: add option to set the busy-poll budget =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
2020-10-28 14:13 ` [Intel-wired-lan] [RFC PATCH bpf-next 0/9] Introduce biased busy-polling Eric Dumazet
2020-10-28 15:14   ` =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=

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=20201028133437.212503-6-bjorn.topel@gmail.com \
    --to=bjorn.topel@gmail.com \
    --cc=intel-wired-lan@osuosl.org \
    /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