aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-02-06 19:56:20 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-06 19:56:20 -0500
commite90b1fd83c94d536375d8b9f4916afd15f4db0ed (patch)
treeba50688cc9a6712575aa861ff37b1db53dc472b8 /net/core/dev.c
parent907bea9cb8e9b7c4cb6a8042c164f3c24f141006 (diff)
parentdd9cef43c222df7c0d76d34451808e789952379d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2019-02-07 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Add a riscv64 JIT for BPF, from Björn. 2) Implement BTF deduplication algorithm for libbpf which takes BTF type information containing duplicate per-compilation unit information and reduces it to an equivalent set of BTF types with no duplication and without loss of information, from Andrii. 3) Offloaded and native BPF XDP programs can coexist today, enable also offloaded and generic ones as well, from Jakub. 4) Expose various BTF related helper functions in libbpf as API which are in particular helpful for JITed programs, from Yonghong. 5) Fix the recently added JMP32 code emission in s390x JIT, from Heiko. 6) Fix BPF kselftests' tcp_{server,client}.py to be able to run inside a network namespace, also add a fix for libbpf to get libbpf_print() working, from Stanislav. 7) Fixes for bpftool documentation, from Prashant. 8) Type cleanup in BPF kselftests' test_maps.c to silence a gcc8 warning, from Breno. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 8c6d5cf8a308..ecbe419e05ab 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8033,11 +8033,13 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
8033 enum bpf_netdev_command query; 8033 enum bpf_netdev_command query;
8034 struct bpf_prog *prog = NULL; 8034 struct bpf_prog *prog = NULL;
8035 bpf_op_t bpf_op, bpf_chk; 8035 bpf_op_t bpf_op, bpf_chk;
8036 bool offload;
8036 int err; 8037 int err;
8037 8038
8038 ASSERT_RTNL(); 8039 ASSERT_RTNL();
8039 8040
8040 query = flags & XDP_FLAGS_HW_MODE ? XDP_QUERY_PROG_HW : XDP_QUERY_PROG; 8041 offload = flags & XDP_FLAGS_HW_MODE;
8042 query = offload ? XDP_QUERY_PROG_HW : XDP_QUERY_PROG;
8041 8043
8042 bpf_op = bpf_chk = ops->ndo_bpf; 8044 bpf_op = bpf_chk = ops->ndo_bpf;
8043 if (!bpf_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE))) { 8045 if (!bpf_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE))) {
@@ -8050,8 +8052,7 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
8050 bpf_chk = generic_xdp_install; 8052 bpf_chk = generic_xdp_install;
8051 8053
8052 if (fd >= 0) { 8054 if (fd >= 0) {
8053 if (__dev_xdp_query(dev, bpf_chk, XDP_QUERY_PROG) || 8055 if (!offload && __dev_xdp_query(dev, bpf_chk, XDP_QUERY_PROG)) {
8054 __dev_xdp_query(dev, bpf_chk, XDP_QUERY_PROG_HW)) {
8055 NL_SET_ERR_MSG(extack, "native and generic XDP can't be active at the same time"); 8056 NL_SET_ERR_MSG(extack, "native and generic XDP can't be active at the same time");
8056 return -EEXIST; 8057 return -EEXIST;
8057 } 8058 }
@@ -8066,8 +8067,7 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
8066 if (IS_ERR(prog)) 8067 if (IS_ERR(prog))
8067 return PTR_ERR(prog); 8068 return PTR_ERR(prog);
8068 8069
8069 if (!(flags & XDP_FLAGS_HW_MODE) && 8070 if (!offload && bpf_prog_is_dev_bound(prog->aux)) {
8070 bpf_prog_is_dev_bound(prog->aux)) {
8071 NL_SET_ERR_MSG(extack, "using device-bound program without HW_MODE flag is not supported"); 8071 NL_SET_ERR_MSG(extack, "using device-bound program without HW_MODE flag is not supported");
8072 bpf_prog_put(prog); 8072 bpf_prog_put(prog);
8073 return -EINVAL; 8073 return -EINVAL;