Daniel Borkmann says: ==================== bpf-next 2021-08-10 We've added 31 non-merge commits during the last 8 day(s) which contain a total of 28 files changed, 3644 insertions(+), 519 deletions(-). 1) Native XDP support for bonding driver & related BPF selftests, from Jussi Maki. 2) Large batch of new BPF JIT tests for test_bpf.ko that came out as a result from 32-bit MIPS JIT development, from Johan Almbladh. 3) Rewrite of netcnt BPF selftest and merge into test_progs, from Stanislav Fomichev. 4) Fix XDP bpf_prog_test_run infra after net to net-next merge, from Andrii Nakryiko. 5) Follow-up fix in unix_bpf_update_proto() to enforce socket type, from Cong Wang. 6) Fix bpf-iter-tcp4 selftest to print the correct dest IP, from Jose Blanquicet. 7) Various misc BPF XDP sample improvements, from Niklas Söderlund, Matthew Cover, and Muhammad Falak R Wani. * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (31 commits) bpf, tests: Add tail call test suite bpf, tests: Add tests for BPF_CMPXCHG bpf, tests: Add tests for atomic operations bpf, tests: Add test for 32-bit context pointer argument passing bpf, tests: Add branch conversion JIT test bpf, tests: Add word-order tests for load/store of double words bpf, tests: Add tests for ALU operations implemented with function calls bpf, tests: Add more ALU64 BPF_MUL tests bpf, tests: Add more BPF_LSH/RSH/ARSH tests for ALU64 bpf, tests: Add more ALU32 tests for BPF_LSH/RSH/ARSH bpf, tests: Add more tests of ALU32 and ALU64 bitwise operations bpf, tests: Fix typos in test case descriptions bpf, tests: Add BPF_MOV tests for zero and sign extension bpf, tests: Add BPF_JMP32 test cases samples, bpf: Add an explict comment to handle nested vlan tagging. selftests/bpf: Add tests for XDP bonding selftests/bpf: Fix xdp_tx.c prog section name net, core: Allow netdev_lower_get_next_private_rcu in bh context bpf, devmap: Exclude XDP broadcast to master device net, bonding: Add XDP support to the bonding driver ... ==================== Link: https://lore.kernel.org/r/20210810130038.16927-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -7532,7 +7532,7 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev,
|
||||
{
|
||||
struct netdev_adjacent *lower;
|
||||
|
||||
WARN_ON_ONCE(!rcu_read_lock_held());
|
||||
WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
|
||||
|
||||
lower = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
|
||||
|
||||
@@ -9297,7 +9297,7 @@ static struct bpf_prog *dev_xdp_prog(struct net_device *dev,
|
||||
return dev->xdp_state[mode].prog;
|
||||
}
|
||||
|
||||
static u8 dev_xdp_prog_count(struct net_device *dev)
|
||||
u8 dev_xdp_prog_count(struct net_device *dev)
|
||||
{
|
||||
u8 count = 0;
|
||||
int i;
|
||||
@@ -9307,6 +9307,7 @@ static u8 dev_xdp_prog_count(struct net_device *dev)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_xdp_prog_count);
|
||||
|
||||
u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode)
|
||||
{
|
||||
@@ -9400,6 +9401,8 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
|
||||
{
|
||||
unsigned int num_modes = hweight32(flags & XDP_FLAGS_MODES);
|
||||
struct bpf_prog *cur_prog;
|
||||
struct net_device *upper;
|
||||
struct list_head *iter;
|
||||
enum bpf_xdp_mode mode;
|
||||
bpf_op_t bpf_op;
|
||||
int err;
|
||||
@@ -9438,6 +9441,14 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/* don't allow if an upper device already has a program */
|
||||
netdev_for_each_upper_dev_rcu(dev, upper, iter) {
|
||||
if (dev_xdp_prog_count(upper) > 0) {
|
||||
NL_SET_ERR_MSG(extack, "Cannot attach when an upper device already has a program");
|
||||
return -EEXIST;
|
||||
}
|
||||
}
|
||||
|
||||
cur_prog = dev_xdp_prog(dev, mode);
|
||||
/* can't replace attached prog with link */
|
||||
if (link && cur_prog) {
|
||||
|
||||
Reference in New Issue
Block a user