* [PATCH bpf v2] libbpf: Remove getsockopt() check for XDP_OPTIONS
@ 2019-09-16 12:33 Toke Høiland-Jørgensen
2019-09-17 4:12 ` Andrii Nakryiko
2019-09-19 12:31 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-09-16 12:33 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, netdev, bpf
Cc: Björn Töpel, Toke Høiland-Jørgensen, Yonghong Song
The xsk_socket__create() function fails and returns an error if it cannot
get the XDP_OPTIONS through getsockopt(). However, support for XDP_OPTIONS
was not added until kernel 5.3, so this means that creating XSK sockets
always fails on older kernels.
Since the option is just used to set the zero-copy flag in the xsk struct,
and that flag is not really used for anything yet, just remove the
getsockopt() call until a proper use for it is introduced.
Suggested-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
v2:
- Remove the call entirely.
tools/lib/bpf/xsk.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index 680e63066cf3..14aea315c914 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -65,7 +65,6 @@ struct xsk_socket {
int xsks_map_fd;
__u32 queue_id;
char ifname[IFNAMSIZ];
- bool zc;
};
struct xsk_nl_info {
@@ -481,7 +480,6 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
void *rx_map = NULL, *tx_map = NULL;
struct sockaddr_xdp sxdp = {};
struct xdp_mmap_offsets off;
- struct xdp_options opts;
struct xsk_socket *xsk;
socklen_t optlen;
int err;
@@ -601,15 +599,6 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
xsk->prog_fd = -1;
- optlen = sizeof(opts);
- err = getsockopt(xsk->fd, SOL_XDP, XDP_OPTIONS, &opts, &optlen);
- if (err) {
- err = -errno;
- goto out_mmap_tx;
- }
-
- xsk->zc = opts.flags & XDP_OPTIONS_ZEROCOPY;
-
if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) {
err = xsk_setup_xdp_prog(xsk);
if (err)
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf v2] libbpf: Remove getsockopt() check for XDP_OPTIONS
2019-09-16 12:33 [PATCH bpf v2] libbpf: Remove getsockopt() check for XDP_OPTIONS Toke Høiland-Jørgensen
@ 2019-09-17 4:12 ` Andrii Nakryiko
2019-09-19 12:31 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2019-09-17 4:12 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Alexei Starovoitov, Daniel Borkmann, Networking, bpf,
Björn Töpel, Yonghong Song
On Mon, Sep 16, 2019 at 6:05 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> The xsk_socket__create() function fails and returns an error if it cannot
> get the XDP_OPTIONS through getsockopt(). However, support for XDP_OPTIONS
> was not added until kernel 5.3, so this means that creating XSK sockets
> always fails on older kernels.
>
> Since the option is just used to set the zero-copy flag in the xsk struct,
> and that flag is not really used for anything yet, just remove the
> getsockopt() call until a proper use for it is introduced.
>
> Suggested-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
> v2:
> - Remove the call entirely.
>
> tools/lib/bpf/xsk.c | 11 -----------
> 1 file changed, 11 deletions(-)
>
Who doesn't like removal of code?.. :)
Acked-by: Andrii Nakryiko <andriin@fb.com>
[...]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf v2] libbpf: Remove getsockopt() check for XDP_OPTIONS
2019-09-16 12:33 [PATCH bpf v2] libbpf: Remove getsockopt() check for XDP_OPTIONS Toke Høiland-Jørgensen
2019-09-17 4:12 ` Andrii Nakryiko
@ 2019-09-19 12:31 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-09-19 12:31 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Alexei Starovoitov, netdev, bpf, Björn Töpel, Yonghong Song
On Mon, Sep 16, 2019 at 02:33:42PM +0200, Toke Høiland-Jørgensen wrote:
> The xsk_socket__create() function fails and returns an error if it cannot
> get the XDP_OPTIONS through getsockopt(). However, support for XDP_OPTIONS
> was not added until kernel 5.3, so this means that creating XSK sockets
> always fails on older kernels.
>
> Since the option is just used to set the zero-copy flag in the xsk struct,
> and that flag is not really used for anything yet, just remove the
> getsockopt() call until a proper use for it is introduced.
>
> Suggested-by: Yonghong Song <yhs@fb.com>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-19 12:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16 12:33 [PATCH bpf v2] libbpf: Remove getsockopt() check for XDP_OPTIONS Toke Høiland-Jørgensen
2019-09-17 4:12 ` Andrii Nakryiko
2019-09-19 12:31 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).