diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-19 13:05:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-19 13:05:34 -0400 |
| commit | 1200b6809dfd9d73bc4c7db76d288c35fa4b2ebe (patch) | |
| tree | 552e03de245cdbd0780ca1215914edc4a26540f7 /tools/testing | |
| parent | 6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f (diff) | |
| parent | fe30937b65354c7fec244caebbdaae68e28ca797 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:
"Highlights:
1) Support more Realtek wireless chips, from Jes Sorenson.
2) New BPF types for per-cpu hash and arrap maps, from Alexei
Starovoitov.
3) Make several TCP sysctls per-namespace, from Nikolay Borisov.
4) Allow the use of SO_REUSEPORT in order to do per-thread processing
of incoming TCP/UDP connections. The muxing can be done using a
BPF program which hashes the incoming packet. From Craig Gallek.
5) Add a multiplexer for TCP streams, to provide a messaged based
interface. BPF programs can be used to determine the message
boundaries. From Tom Herbert.
6) Add 802.1AE MACSEC support, from Sabrina Dubroca.
7) Avoid factorial complexity when taking down an inetdev interface
with lots of configured addresses. We were doing things like
traversing the entire address less for each address removed, and
flushing the entire netfilter conntrack table for every address as
well.
8) Add and use SKB bulk free infrastructure, from Jesper Brouer.
9) Allow offloading u32 classifiers to hardware, and implement for
ixgbe, from John Fastabend.
10) Allow configuring IRQ coalescing parameters on a per-queue basis,
from Kan Liang.
11) Extend ethtool so that larger link mode masks can be supported.
From David Decotigny.
12) Introduce devlink, which can be used to configure port link types
(ethernet vs Infiniband, etc.), port splitting, and switch device
level attributes as a whole. From Jiri Pirko.
13) Hardware offload support for flower classifiers, from Amir Vadai.
14) Add "Local Checksum Offload". Basically, for a tunneled packet
the checksum of the outer header is 'constant' (because with the
checksum field filled into the inner protocol header, the payload
of the outer frame checksums to 'zero'), and we can take advantage
of that in various ways. From Edward Cree"
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits)
bonding: fix bond_get_stats()
net: bcmgenet: fix dma api length mismatch
net/mlx4_core: Fix backward compatibility on VFs
phy: mdio-thunder: Fix some Kconfig typos
lan78xx: add ndo_get_stats64
lan78xx: handle statistics counter rollover
RDS: TCP: Remove unused constant
RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
net: smc911x: convert pxa dma to dmaengine
team: remove duplicate set of flag IFF_MULTICAST
bonding: remove duplicate set of flag IFF_MULTICAST
net: fix a comment typo
ethernet: micrel: fix some error codes
ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it
bpf, dst: add and use dst_tclassid helper
bpf: make skb->tc_classid also readable
net: mvneta: bm: clarify dependencies
cls_bpf: reset class and reuse major in da
ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c
ldmvsw: Add ldmvsw.c driver code
...
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/lib/Makefile | 2 | ||||
| -rwxr-xr-x | tools/testing/selftests/lib/bitmap.sh | 10 | ||||
| -rw-r--r-- | tools/testing/selftests/net/.gitignore | 1 | ||||
| -rw-r--r-- | tools/testing/selftests/net/Makefile | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/net/reuseport_bpf.c | 117 | ||||
| -rw-r--r-- | tools/testing/selftests/net/reuseport_bpf_cpu.c | 258 |
6 files changed, 381 insertions, 9 deletions
diff --git a/tools/testing/selftests/lib/Makefile b/tools/testing/selftests/lib/Makefile index 47147b968514..08360060ab14 100644 --- a/tools/testing/selftests/lib/Makefile +++ b/tools/testing/selftests/lib/Makefile | |||
| @@ -3,6 +3,6 @@ | |||
| 3 | # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" | 3 | # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" |
| 4 | all: | 4 | all: |
| 5 | 5 | ||
| 6 | TEST_PROGS := printf.sh | 6 | TEST_PROGS := printf.sh bitmap.sh |
| 7 | 7 | ||
| 8 | include ../lib.mk | 8 | include ../lib.mk |
diff --git a/tools/testing/selftests/lib/bitmap.sh b/tools/testing/selftests/lib/bitmap.sh new file mode 100755 index 000000000000..2da187b6ddad --- /dev/null +++ b/tools/testing/selftests/lib/bitmap.sh | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Runs bitmap infrastructure tests using test_bitmap kernel module | ||
| 3 | |||
| 4 | if /sbin/modprobe -q test_bitmap; then | ||
| 5 | /sbin/modprobe -q -r test_bitmap | ||
| 6 | echo "bitmap: ok" | ||
| 7 | else | ||
| 8 | echo "bitmap: [FAIL]" | ||
| 9 | exit 1 | ||
| 10 | fi | ||
diff --git a/tools/testing/selftests/net/.gitignore b/tools/testing/selftests/net/.gitignore index 6fb23366b258..69bb3fc38fb2 100644 --- a/tools/testing/selftests/net/.gitignore +++ b/tools/testing/selftests/net/.gitignore | |||
| @@ -2,3 +2,4 @@ socket | |||
| 2 | psock_fanout | 2 | psock_fanout |
| 3 | psock_tpacket | 3 | psock_tpacket |
| 4 | reuseport_bpf | 4 | reuseport_bpf |
| 5 | reuseport_bpf_cpu | ||
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 41449b5ad0a9..c658792d47b4 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile | |||
| @@ -4,7 +4,7 @@ CFLAGS = -Wall -O2 -g | |||
| 4 | 4 | ||
| 5 | CFLAGS += -I../../../../usr/include/ | 5 | CFLAGS += -I../../../../usr/include/ |
| 6 | 6 | ||
| 7 | NET_PROGS = socket psock_fanout psock_tpacket reuseport_bpf | 7 | NET_PROGS = socket psock_fanout psock_tpacket reuseport_bpf reuseport_bpf_cpu |
| 8 | 8 | ||
| 9 | all: $(NET_PROGS) | 9 | all: $(NET_PROGS) |
| 10 | %: %.c | 10 | %: %.c |
diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c index bec1b5dd2530..96ba386b1b7b 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c | |||
| @@ -9,10 +9,12 @@ | |||
| 9 | 9 | ||
| 10 | #include <errno.h> | 10 | #include <errno.h> |
| 11 | #include <error.h> | 11 | #include <error.h> |
| 12 | #include <fcntl.h> | ||
| 12 | #include <linux/bpf.h> | 13 | #include <linux/bpf.h> |
| 13 | #include <linux/filter.h> | 14 | #include <linux/filter.h> |
| 14 | #include <linux/unistd.h> | 15 | #include <linux/unistd.h> |
| 15 | #include <netinet/in.h> | 16 | #include <netinet/in.h> |
| 17 | #include <netinet/tcp.h> | ||
| 16 | #include <stdio.h> | 18 | #include <stdio.h> |
| 17 | #include <stdlib.h> | 19 | #include <stdlib.h> |
| 18 | #include <string.h> | 20 | #include <string.h> |
| @@ -169,9 +171,15 @@ static void build_recv_group(const struct test_params p, int fd[], uint16_t mod, | |||
| 169 | if (bind(fd[i], addr, sockaddr_size())) | 171 | if (bind(fd[i], addr, sockaddr_size())) |
| 170 | error(1, errno, "failed to bind recv socket %d", i); | 172 | error(1, errno, "failed to bind recv socket %d", i); |
| 171 | 173 | ||
| 172 | if (p.protocol == SOCK_STREAM) | 174 | if (p.protocol == SOCK_STREAM) { |
| 175 | opt = 4; | ||
| 176 | if (setsockopt(fd[i], SOL_TCP, TCP_FASTOPEN, &opt, | ||
| 177 | sizeof(opt))) | ||
| 178 | error(1, errno, | ||
| 179 | "failed to set TCP_FASTOPEN on %d", i); | ||
| 173 | if (listen(fd[i], p.recv_socks * 10)) | 180 | if (listen(fd[i], p.recv_socks * 10)) |
| 174 | error(1, errno, "failed to listen on socket"); | 181 | error(1, errno, "failed to listen on socket"); |
| 182 | } | ||
| 175 | } | 183 | } |
| 176 | free(addr); | 184 | free(addr); |
| 177 | } | 185 | } |
| @@ -189,10 +197,8 @@ static void send_from(struct test_params p, uint16_t sport, char *buf, | |||
| 189 | 197 | ||
| 190 | if (bind(fd, saddr, sockaddr_size())) | 198 | if (bind(fd, saddr, sockaddr_size())) |
| 191 | error(1, errno, "failed to bind send socket"); | 199 | error(1, errno, "failed to bind send socket"); |
| 192 | if (connect(fd, daddr, sockaddr_size())) | ||
| 193 | error(1, errno, "failed to connect"); | ||
| 194 | 200 | ||
| 195 | if (send(fd, buf, len, 0) < 0) | 201 | if (sendto(fd, buf, len, MSG_FASTOPEN, daddr, sockaddr_size()) < 0) |
| 196 | error(1, errno, "failed to send message"); | 202 | error(1, errno, "failed to send message"); |
| 197 | 203 | ||
| 198 | close(fd); | 204 | close(fd); |
| @@ -260,7 +266,7 @@ static void test_recv_order(const struct test_params p, int fd[], int mod) | |||
| 260 | } | 266 | } |
| 261 | } | 267 | } |
| 262 | 268 | ||
| 263 | static void test_reuseport_ebpf(const struct test_params p) | 269 | static void test_reuseport_ebpf(struct test_params p) |
| 264 | { | 270 | { |
| 265 | int i, fd[p.recv_socks]; | 271 | int i, fd[p.recv_socks]; |
| 266 | 272 | ||
| @@ -268,6 +274,7 @@ static void test_reuseport_ebpf(const struct test_params p) | |||
| 268 | build_recv_group(p, fd, p.recv_socks, attach_ebpf); | 274 | build_recv_group(p, fd, p.recv_socks, attach_ebpf); |
| 269 | test_recv_order(p, fd, p.recv_socks); | 275 | test_recv_order(p, fd, p.recv_socks); |
| 270 | 276 | ||
| 277 | p.send_port_min += p.recv_socks * 2; | ||
| 271 | fprintf(stderr, "Reprograming, testing mod %zd...\n", p.recv_socks / 2); | 278 | fprintf(stderr, "Reprograming, testing mod %zd...\n", p.recv_socks / 2); |
| 272 | attach_ebpf(fd[0], p.recv_socks / 2); | 279 | attach_ebpf(fd[0], p.recv_socks / 2); |
| 273 | test_recv_order(p, fd, p.recv_socks / 2); | 280 | test_recv_order(p, fd, p.recv_socks / 2); |
| @@ -276,7 +283,7 @@ static void test_reuseport_ebpf(const struct test_params p) | |||
| 276 | close(fd[i]); | 283 | close(fd[i]); |
| 277 | } | 284 | } |
| 278 | 285 | ||
| 279 | static void test_reuseport_cbpf(const struct test_params p) | 286 | static void test_reuseport_cbpf(struct test_params p) |
| 280 | { | 287 | { |
| 281 | int i, fd[p.recv_socks]; | 288 | int i, fd[p.recv_socks]; |
| 282 | 289 | ||
| @@ -284,6 +291,7 @@ static void test_reuseport_cbpf(const struct test_params p) | |||
| 284 | build_recv_group(p, fd, p.recv_socks, attach_cbpf); | 291 | build_recv_group(p, fd, p.recv_socks, attach_cbpf); |
| 285 | test_recv_order(p, fd, p.recv_socks); | 292 | test_recv_order(p, fd, p.recv_socks); |
| 286 | 293 | ||
| 294 | p.send_port_min += p.recv_socks * 2; | ||
| 287 | fprintf(stderr, "Reprograming, testing mod %zd...\n", p.recv_socks / 2); | 295 | fprintf(stderr, "Reprograming, testing mod %zd...\n", p.recv_socks / 2); |
| 288 | attach_cbpf(fd[0], p.recv_socks / 2); | 296 | attach_cbpf(fd[0], p.recv_socks / 2); |
| 289 | test_recv_order(p, fd, p.recv_socks / 2); | 297 | test_recv_order(p, fd, p.recv_socks / 2); |
| @@ -377,7 +385,7 @@ static void test_filter_no_reuseport(const struct test_params p) | |||
| 377 | 385 | ||
| 378 | static void test_filter_without_bind(void) | 386 | static void test_filter_without_bind(void) |
| 379 | { | 387 | { |
| 380 | int fd1, fd2; | 388 | int fd1, fd2, opt = 1; |
| 381 | 389 | ||
| 382 | fprintf(stderr, "Testing filter add without bind...\n"); | 390 | fprintf(stderr, "Testing filter add without bind...\n"); |
| 383 | fd1 = socket(AF_INET, SOCK_DGRAM, 0); | 391 | fd1 = socket(AF_INET, SOCK_DGRAM, 0); |
| @@ -386,6 +394,10 @@ static void test_filter_without_bind(void) | |||
| 386 | fd2 = socket(AF_INET, SOCK_DGRAM, 0); | 394 | fd2 = socket(AF_INET, SOCK_DGRAM, 0); |
| 387 | if (fd2 < 0) | 395 | if (fd2 < 0) |
| 388 | error(1, errno, "failed to create socket 2"); | 396 | error(1, errno, "failed to create socket 2"); |
| 397 | if (setsockopt(fd1, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt))) | ||
| 398 | error(1, errno, "failed to set SO_REUSEPORT on socket 1"); | ||
| 399 | if (setsockopt(fd2, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt))) | ||
| 400 | error(1, errno, "failed to set SO_REUSEPORT on socket 2"); | ||
| 389 | 401 | ||
| 390 | attach_ebpf(fd1, 10); | 402 | attach_ebpf(fd1, 10); |
| 391 | attach_cbpf(fd2, 10); | 403 | attach_cbpf(fd2, 10); |
| @@ -394,6 +406,32 @@ static void test_filter_without_bind(void) | |||
| 394 | close(fd2); | 406 | close(fd2); |
| 395 | } | 407 | } |
| 396 | 408 | ||
| 409 | void enable_fastopen(void) | ||
| 410 | { | ||
| 411 | int fd = open("/proc/sys/n | ||
