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 7/9] samples/bpf: use recvfrom() in xdpsock
Date: Wed, 28 Oct 2020 14:34:35 +0100 [thread overview]
Message-ID: <20201028133437.212503-8-bjorn.topel@gmail.com> (raw)
In-Reply-To: <20201028133437.212503-1-bjorn.topel@gmail.com>
From: Bj?rn T?pel <bjorn.topel@intel.com>
Start using recvfrom() the rxdrop scenario.
Signed-off-by: Bj?rn T?pel <bjorn.topel@intel.com>
---
samples/bpf/xdpsock_user.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index 1149e94ca32f..96d0b6482ac4 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -1172,7 +1172,7 @@ static inline void complete_tx_only(struct xsk_socket_info *xsk,
}
}
-static void rx_drop(struct xsk_socket_info *xsk, struct pollfd *fds)
+static void rx_drop(struct xsk_socket_info *xsk)
{
unsigned int rcvd, i;
u32 idx_rx = 0, idx_fq = 0;
@@ -1182,7 +1182,7 @@ static void rx_drop(struct xsk_socket_info *xsk, struct pollfd *fds)
if (!rcvd) {
if (xsk_ring_prod__needs_wakeup(&xsk->umem->fq)) {
xsk->app_stats.rx_empty_polls++;
- ret = poll(fds, num_socks, opt_timeout);
+ recvfrom(xsk_socket__fd(xsk->xsk), NULL, 0, MSG_DONTWAIT, NULL, NULL);
}
return;
}
@@ -1193,7 +1193,7 @@ static void rx_drop(struct xsk_socket_info *xsk, struct pollfd *fds)
exit_with_error(-ret);
if (xsk_ring_prod__needs_wakeup(&xsk->umem->fq)) {
xsk->app_stats.fill_fail_polls++;
- ret = poll(fds, num_socks, opt_timeout);
+ recvfrom(xsk_socket__fd(xsk->xsk), NULL, 0, MSG_DONTWAIT, NULL, NULL);
}
ret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq);
}
@@ -1235,7 +1235,7 @@ static void rx_drop_all(void)
}
for (i = 0; i < num_socks; i++)
- rx_drop(xsks[i], fds);
+ rx_drop(xsks[i]);
if (benchmark_done)
break;
--
2.27.0
next prev 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 ` [Intel-wired-lan] [RFC PATCH bpf-next 5/9] xsk: add busy-poll support for {recv, send}msg() =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?=
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 ` =?unknown-8bit?q?Bj=C3=B6rn_T=C3=B6pel?= [this message]
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-8-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