From b0aa73bf081da6810dacd750b9f8186640e172db Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Tue, 19 Mar 2013 14:49:44 -0400 Subject: net: Add socket() system call self test. Signed-off-by: David S. Miller --- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/testing/selftests/Makefile') diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 3cc0ad7ae863..7c6280f1cf4d 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -5,6 +5,7 @@ TARGETS += vm TARGETS += cpu-hotplug TARGETS += memory-hotplug TARGETS += efivarfs +TARGETS += net-socket all: for TARGET in $(TARGETS); do \ -- cgit v1.2.1 From 77f65ebdca506870d99bfabe52bde222511022ec Mon Sep 17 00:00:00 2001 From: Willem de Bruijn Date: Tue, 19 Mar 2013 10:18:11 +0000 Subject: packet: packet fanout rollover during socket overload Changes: v3->v2: rebase (no other changes) passes selftest v2->v1: read f->num_members only once fix bug: test rollover mode + flag Minimize packet drop in a fanout group. If one socket is full, roll over packets to another from the group. Maintain flow affinity during normal load using an rxhash fanout policy, while dispersing unexpected traffic storms that hit a single cpu, such as spoofed-source DoS flows. Rollover breaks affinity for flows arriving at saturated sockets during those conditions. The patch adds a fanout policy ROLLOVER that rotates between sockets, filling each socket before moving to the next. It also adds a fanout flag ROLLOVER. If passed along with any other fanout policy, the primary policy is applied until the chosen socket is full. Then, rollover selects another socket, to delay packet drop until the entire system is saturated. Probing sockets is not free. Selecting the last used socket, as rollover does, is a greedy approach that maximizes chance of success, at the cost of extreme load imbalance. In practice, with sufficiently long queues to absorb bursts, sockets are drained in parallel and load balance looks uniform in `top`. To avoid contention, scales counters with number of sockets and accesses them lockfree. Values are bounds checked to ensure correctness. Tested using an application with 9 threads pinned to CPUs, one socket per thread and sufficient busywork per packet operation to limits each thread to handling 32 Kpps. When sent 500 Kpps single UDP stream packets, a FANOUT_CPU setup processes 32 Kpps in total without this patch, 270 Kpps with the patch. Tested with read() and with a packet ring (V1). Also, passes psock_fanout.c unit test added to selftests. Signed-off-by: Willem de Bruijn Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller --- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/testing/selftests/Makefile') diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 7c6280f1cf4d..7f50078d0e8c 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -6,6 +6,7 @@ TARGETS += cpu-hotplug TARGETS += memory-hotplug TARGETS += efivarfs TARGETS += net-socket +TARGETS += net-afpacket all: for TARGET in $(TARGETS); do \ -- cgit v1.2.1 From a6f68034de8a5784dfeabb337506254c80b4c8c6 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 20 Mar 2013 15:07:56 -0400 Subject: net: Move selftests to common net/ subdirectory. Suggested-by: Daniel Baluta Signed-off-by: David S. Miller --- tools/testing/selftests/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools/testing/selftests/Makefile') diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 7f50078d0e8c..a4805932972b 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -5,8 +5,7 @@ TARGETS += vm TARGETS += cpu-hotplug TARGETS += memory-hotplug TARGETS += efivarfs -TARGETS += net-socket -TARGETS += net-afpacket +TARGETS += net all: for TARGET in $(TARGETS); do \ -- cgit v1.2.1