[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <158507357205.6925.17804771242752938867.stgit@toke.dk>
Date: Tue, 24 Mar 2020 19:12:52 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: netdev@...r.kernel.org
Cc: bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Lorenz Bauer <lmb@...udflare.com>, Andrey Ignatov <rdna@...com>
Subject: [PATCH bpf-next v3 0/4] XDP: Support atomic replacement of XDP
interface attachments
This series adds support for atomically replacing the XDP program loaded on an
interface. This is achieved by means of a new netlink attribute that can specify
the expected previous program to replace on the interface. If set, the kernel
will compare this "expected id" attribute with the program currently loaded on
the interface, and reject the operation if it does not match.
With this primitive, userspace applications can avoid stepping on each other's
toes when simultaneously updating the loaded XDP program.
Changelog:
v3:
- Pass existing ID instead of FD (Jakub)
- Use opts struct for new libbpf function (Andrii)
v2:
- Fix checkpatch nits and add .strict_start_type to netlink policy (Jakub)
---
Toke Høiland-Jørgensen (4):
xdp: Support specifying expected existing program when attaching XDP
tools: Add EXPECTED_ID-related definitions in if_link.h
libbpf: Add function to set link XDP fd while specifying old program
selftests/bpf: Add tests for attaching XDP programs
include/linux/netdevice.h | 2 +-
include/uapi/linux/if_link.h | 4 +-
net/core/dev.c | 14 ++--
net/core/rtnetlink.c | 13 ++++
tools/include/uapi/linux/if_link.h | 4 +-
tools/lib/bpf/libbpf.h | 8 +++
tools/lib/bpf/libbpf.map | 1 +
tools/lib/bpf/netlink.c | 34 +++++++++-
.../testing/selftests/bpf/prog_tests/xdp_attach.c | 74 ++++++++++++++++++++++
9 files changed, 145 insertions(+), 9 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_attach.c
Powered by blists - more mailing lists