aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/test_offload.py
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2018-07-11 23:36:40 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-07-13 14:26:35 -0400
commit05296620f6d14dce0030b87e1e57891a770fb65c (patch)
treef66b194fc4fd081abce58cd6dd97c2bd95ffa842 /tools/testing/selftests/bpf/test_offload.py
parent6b8675897338f874c41612655a85d8e10cdb23d8 (diff)
xdp: factor out common program/flags handling from drivers
Basic operations drivers perform during xdp setup and query can be moved to helpers in the core. Encapsulate program and flags into a structure and add helpers. Note that the structure is intended as the "main" program information source in the driver. Most drivers will additionally place the program pointer in their fast path or ring structures. The helpers don't have a huge impact now, but they will decrease the code duplication when programs can be installed in HW and driver at the same time. Encapsulating the basic operations in helpers will hopefully also reduce the number of changes to drivers which adopt them. Helpers could really be static inline, but they depend on definition of struct netdev_bpf which means they'd have to be placed in netdevice.h, an already 4500 line header. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/test_offload.py')
-rwxr-xr-xtools/testing/selftests/bpf/test_offload.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/test_offload.py b/tools/testing/selftests/bpf/test_offload.py
index f8d9bd81d9a4..40401e9e9351 100755
--- a/tools/testing/selftests/bpf/test_offload.py
+++ b/tools/testing/selftests/bpf/test_offload.py
@@ -821,7 +821,7 @@ try:
821 ret, _, err = sim.set_xdp(obj, "", force=True, 821 ret, _, err = sim.set_xdp(obj, "", force=True,
822 fail=False, include_stderr=True) 822 fail=False, include_stderr=True)
823 fail(ret == 0, "Replaced XDP program with a program in different mode") 823 fail(ret == 0, "Replaced XDP program with a program in different mode")
824 check_extack_nsim(err, "program loaded with different flags.", args) 824 check_extack(err, "program loaded with different flags.", args)
825 825
826 start_test("Test XDP prog remove with bad flags...") 826 start_test("Test XDP prog remove with bad flags...")
827 ret, _, err = sim.unset_xdp("offload", force=True, 827 ret, _, err = sim.unset_xdp("offload", force=True,
@@ -831,7 +831,7 @@ try:
831 ret, _, err = sim.unset_xdp("", force=True, 831 ret, _, err = sim.unset_xdp("", force=True,
832 fail=False, include_stderr=True) 832 fail=False, include_stderr=True)
833 fail(ret == 0, "Removed program with a bad mode") 833 fail(ret == 0, "Removed program with a bad mode")
834 check_extack_nsim(err, "program loaded with different flags.", args) 834 check_extack(err, "program loaded with different flags.", args)
835 835
836 start_test("Test MTU restrictions...") 836 start_test("Test MTU restrictions...")
837 ret, _ = sim.set_mtu(9000, fail=False) 837 ret, _ = sim.set_mtu(9000, fail=False)