diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-12-03 00:27:58 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2017-12-03 00:27:59 +0100 |
commit | 6720f1084c066a5ba051a250e9d5d8c2ad4f554c (patch) | |
tree | 2d7bbfe3daa1af1ae3b45ce6901e651e19624c57 /net/core/rtnetlink.c | |
parent | 4485166519e00ba1ba313a5b55ad2a0423c10952 (diff) | |
parent | c33616109a63aa64235108fb7f3b60cb2117ef3b (diff) |
Merge branch 'bpf-xdp-stack-uninit-and-offload-tests'
Jakub Kicinski says:
====================
The purpose of this series is to add a software model of BPF offloads
to make it easier for everyone to test them and make some of the more
arcane rules and assumptions more clear.
The series starts with 3 patches aiming to make XDP handling in the
drivers less error prone. Currently driver authors have to remember
to free XDP programs if XDP is active during unregister. With this
series the core will disable XDP on its own. It will take place
after close, drivers are not expected to perform reconfiguration
when disabling XDP on a downed device.
Next two patches add the software netdev driver, followed by a python
test which exercises all the corner cases which came to my mind.
Test needs to be run as root. It will print basic information to
stdout, but can also create a more detailed log of all commands
when --log option is passed. Log is in Emacs Org-mode format.
./tools/testing/selftests/bpf/test_offload.py --log /tmp/log
Last two patches replace the SR-IOV API implementation of dummy.
v3:
- move the freeing of vfs to release (Phil).
v2:
- free device from the release function;
- use bus-based name generatin instead of netdev name.
v1:
- replace the SR-IOV API implementation of dummy;
- make the dev_xdp_uninstall() also handle the XDP generic (Daniel).
====================
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index dabba2a91fc8..9c4cb584bfb0 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1261,6 +1261,7 @@ static u8 rtnl_xdp_attached_mode(struct net_device *dev, u32 *prog_id) { const struct net_device_ops *ops = dev->netdev_ops; const struct bpf_prog *generic_xdp_prog; + struct netdev_bpf xdp; ASSERT_RTNL(); @@ -1273,7 +1274,10 @@ static u8 rtnl_xdp_attached_mode(struct net_device *dev, u32 *prog_id) if (!ops->ndo_bpf) return XDP_ATTACHED_NONE; - return __dev_xdp_attached(dev, ops->ndo_bpf, prog_id); + __dev_xdp_query(dev, ops->ndo_bpf, &xdp); + *prog_id = xdp.prog_id; + + return xdp.prog_attached; } static int rtnl_xdp_fill(struct sk_buff *skb, struct net_device *dev) |