From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795963406; b=HbQSTKjXRzeexsC7/YNn2rXsCXqPTnM0KIQly8imVy8A69z0ofBMdCU940pcvmV4lnya Dbi9mEBh//OhxGR5Z83uhKEt0GrqXH/ktC4IMw07zAKNMJkauljLrqe8qvJ7Uw8BYREbd qV26wF/mJsfWXxG5ojwRur64paU9z4XeS5eXNLpgz5a/SGf+5n/kW4dWXh46NzV7Ceo6h xiqDyumvZ8ef8cvmOo9PkAzwpzkcXYLllhQn3IXNMIM7ZEI8u2fvRqmAVHhkQ+mc4QT1E 5fRZXEL5z61hbOmptW6O2jJH65YtmR2MYjHXLJGPPkWG9imy2bMDnOqrtHonHyYYAhg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795963406; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=ZLONH2ggxPn2ZJxzkeaSCdKhhH5vq3uyZ0Ku25c4v8k=; b=B7zr330AEB7AgRu2fCCBdeHQORi2yNqkl/aJO4BXH4O+nDXrTVRXr4hN4J3hufjpk5n3 AugG+E199DtLmVFuVldqrA2KdoAvkH/ahxBK+D9PkxIFPBoHIDJcirmAsgcjJdEmr3d8G /RnhvV3Ir+ifAtBGF0vJ3T3SpOhs7kfknRwKEknwstx0d8zvCzPH8L+fMR67yAY6I0v1e XX1VCingA5zDGMVPZuUG5tk5TWrpCigciB6TijdWxJ4u1VOTU5Jy+vmojLeaYFUHK5itT IpJV11JJU9NWqZm6AD/spkBm61kQfeBaFjKTcvu8ES7o32pBWbHX8iv+8FdHwfrFdGw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=qTlSsH9y; arc=none smtp.remote-ip=209.85.218.48 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81DE9606A331 for ; Sun, 29 Nov 2026 14:43:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 81DE9606A331 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=qTlSsH9y Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-c51373ae637so584074566b.3 for ; Sun, 29 Nov 2026 06:43:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795963405; x=1796568205; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZLONH2ggxPn2ZJxzkeaSCdKhhH5vq3uyZ0Ku25c4v8k=; b=qTlSsH9yu7D8X9hwZe/g7c0qCbmZqYFWuYMJ01ilZVaurpl5bU5WRHBvGm3K2Di0Nf oEeqrDsWcRKmEX22LBxab3AI0F+dcHK9V5zZ3VGi3ZD/bcpc0DrJxEOdOMSRuwAInESm U98hAkv96B7E4e48D03kjXBmyWcCIhv5Cb2+mWza+HyHf3AMnn0hvUZSdBVnmDBC2CK6 aS9W4/gbndxcNmgQ6KkQXGeaw9shbrpeLG1m4o1uC+P/fU/0EORJnUDHYnQ/RQoXclSh raEZxatLzWKJ59hajtf+7mawpg2/Mz42a2Nu0/5kbNylM/1QNIvKqpII2MEXrNc25Jm1 bP9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795963405; x=1796568205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ZLONH2ggxPn2ZJxzkeaSCdKhhH5vq3uyZ0Ku25c4v8k=; b=sADIoYYh4qFrdxBS+35qJ2HtrafMUvRxdw+Kq5a/lzY36G0NDJq8Hbf7A6/E6SXrZX u4BSXEOamoWQHMXYtw6KjNeAOcLIWA5/7pIvicKDJ2Fd5uXt2KygquFSwsummbzFlc3i hrXLEeqij5+WoHd+3IycuzCd1yYbWvgxPxS8sQgF5hr08LatQw+mJuaEdXh/xd7EaBsC UhW+XAe/joYI9Mlngxwb0uHCHwJKe+4y46jlybQdkOUl7iYifMvg99RAahl6CjintUYg jnK9eCp7E2vMtiHkl52XnXFMLhFbVaRPO/t6Aa1E19Zjc1p9olbkQRkQ+2wqYbdDAbZ1 vXCg== X-Forwarded-Encrypted: i=1; AL+hErGc5g4QCD1dJc1cEftmjX5c5putDuDApcF0b7Vf96Oker/D/KbDE1GIQrBTYcRiFhCOkFeGVKAfWem5JII=@vger.kernel.org X-Gm-Message-State: APuU4Z/QK6sv3pl+liGc0GJIuPwtTPge+fQF72Do8sp3McE3AZam6rb9 xnq318BktQmYjMmD3XNlpaYyR/bDIBfGF2Gtv/AJmf1Q3Wx+G9kDvapsMgopkYY/RA== X-Gm-Gg: AZFdTZcJso3clSW6sMbiiEpCHTOUKO1F7bbmC/ZPuOZ76LpTag2MCL9xgmgTHcyfjr2 jBx4OJTvdU1cu0T6aOCCLo1ramWVGcWagPp7KMUtFvP7jH3fHaeh7H/RsknEHjV8bOL7sPDr8l8 bn4zyRL/LNLhSeS91P1yaXP0S08ADj/f6nlFmJKzH1LnPEV+kzBotfGyjf2NHO5ZPvaz/zyWITm F7BErfjdyNPD7IhSIsbofnknQJWAc9jvYdYXQgkz6GOcwpLQw1yeoS0XZqEF3CJ3Muk2uc4ZOJw MdEW+VxPputagjdJlHkAKLk6/Zln57w1zgw6LHYW/WQCAmlP5SNsZ5vBjNnhGVOCalSuTaQCIWX 1bjYacXY0gV+8XzjMr2QQXeXkm1Gf8vN+yKBBLkWi0jWYsOXDgTqNk338msZezPNZzKvlczdUBA IWLywdhNpGbL1OomG/DLUPWPJQHCelZ/nl/vdu2VqavNrHjdlQMVfIY3MRxr00dOLktdNWV4cX6 Wg9LHv/2ageV3Ss3egv9nQfQ5OgjaMPUJkokNvl/2TQp0Dsi4inwzojgIpFmEIsBfPjr9Vt5ZyQ fPZB98LbViESJy+NsvMyTN6rubby6ROus+i6n8AR0nfEH/vqwaLoTmS1atKJaGq1YaDnBdLMUiP Q9yUzkXVioJVmhTYgH0qsdvPaUoPvZduF6DYYm4wBr9826a+mMzsR+wsy+c+Wn75eD8h5PD3G+6 qYVq0WoyCNRCtuW116/zMFhyDwZvdGBIMQNb5jl5Ivsq9MC2xAxaZLA6Kw6nvQ2k/PmlbdP1eL4 kBK+ncBe4Guo8Vlez2FiN5WJssTJacqT24bDP/HH1es9y2GRw9KrhB/aQ+9T23AL2+7qkj7nFwD WLE5SSjHmBVm X-Received: by 2002:a17:906:4750:b0:c3f:dce3:20d5 with SMTP id a640c23a62f3a-c513a88a462mr1944433466b.22.1795963404770; Sun, 29 Nov 2026 06:43:24 -0800 (PST) Received: from Desktop.tail070c67.ts.net ([217.26.234.239]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae8db37sm1057883266b.35.2026.11.29.06.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 06:43:24 -0800 (PST) From: Julius Bairaktaris To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Willem de Bruijn , Simon Horman , Shuah Khan , Qingfang Deng , Guillaume Nault , Sebastian Andrzej Siewior , Haoli Zhang <26031212468@stu.xidian.edu.cn>, linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH net-next 3/3] selftests: net: ppp: send on PPPoE from every CPU at once Date: Sun, 29 Nov 2026 15:43:19 +0100 Message-ID: <20261129144319.1489366-4-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261129144319.1489366-1-julius@bairaktaris.de> References: <20261129144319.1489366-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Run one iperf3 stream per CPU, each pinned with taskset, over the PPPoE session. Count the IPv4 and IPv6 session frames leaving the client's veth with flower filters and check that they match the frames and bytes ppp0 counted. A frame sent while the counters are read can be counted by only one of them, so they are read until two reads 100 ms apart agree. This covers concurrent use of the PPP transmit path and its per-CPU statistics. Signed-off-by: Julius Bairaktaris --- tools/testing/selftests/net/ppp/config | 4 ++ tools/testing/selftests/net/ppp/pppoe.sh | 83 ++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/tools/testing/selftests/net/ppp/config b/tools/testing/selftests/net/ppp/config index 843545df8f03..e7ba52a36026 100644 --- a/tools/testing/selftests/net/ppp/config +++ b/tools/testing/selftests/net/ppp/config @@ -1,5 +1,9 @@ CONFIG_IPV6=y CONFIG_L2TP=m +CONFIG_NET_ACT_GACT=m +CONFIG_NET_CLS_ACT=y +CONFIG_NET_CLS_FLOWER=m +CONFIG_NET_SCH_INGRESS=m CONFIG_PACKET=y CONFIG_PPP=m CONFIG_PPP_ASYNC=m diff --git a/tools/testing/selftests/net/ppp/pppoe.sh b/tools/testing/selftests/net/ppp/pppoe.sh index f67b51df7490..93c8dbb58818 100755 --- a/tools/testing/selftests/net/ppp/pppoe.sh +++ b/tools/testing/selftests/net/ppp/pppoe.sh @@ -17,6 +17,8 @@ cleanup() { trap cleanup EXIT require_command pppoe-server +require_command taskset +require_command jq ppp_common_init modprobe -q pppoe @@ -34,6 +36,82 @@ ip link set "$VETH_CLIENT" netns "$NS_CLIENT" ip -netns "$NS_SERVER" link set "$VETH_SERVER" up ip -netns "$NS_CLIENT" link set "$VETH_CLIENT" up +# Print the client's ppp0 transmit counters, then those of the IPv4 and +# IPv6 PPPoE session frames leaving its veth. PPP control frames go to +# the channel directly and are counted by neither. +client_tx_stats() { + local stat + + for stat in tx_packets tx_bytes; do + ip netns exec "$NS_CLIENT" \ + cat "/sys/class/net/ppp0/statistics/$stat" + done + tc -n "$NS_CLIENT" -s -j filter show dev "$VETH_CLIENT" egress | + jq '[.[].options.actions[0].stats // empty] | + (map(.packets) | add), (map(.bytes) | add)' +} + +# A frame sent while the counters are read can be counted by only one of +# them. Read them until two reads 100 ms apart agree. +client_tx_stats_settled() { + local prev cur i + + prev=$(client_tx_stats) + for ((i = 0; i < 50; i++)); do + sleep 0.1 + cur=$(client_tx_stats) + [ "$cur" = "$prev" ] && break + prev=$cur + done + echo "$cur" +} + +# Send TCP streams from every CPU at once, then check that each frame +# counted by the PPP device left the Ethernet device exactly once. +ppp_test_parallel() { + local ncpus cpu i pids=() before after d=() proto + + # PPP protocol numbers of IPv4 and IPv6 + tc -n "$NS_CLIENT" qdisc add dev "$VETH_CLIENT" clsact + for proto in 0x0021 0x0057; do + tc -n "$NS_CLIENT" filter add dev "$VETH_CLIENT" egress \ + protocol ppp_ses flower ppp_proto "$proto" action pass + done + + ncpus=$(nproc) + [ "$ncpus" -gt 8 ] && ncpus=8 + for ((cpu = 0; cpu < ncpus; cpu++)); do + ip netns exec "$NS_SERVER" iperf3 -s -1 -D -p $((5301 + cpu)) + wait_local_port_listen "$NS_SERVER" $((5301 + cpu)) tcp + done + + mapfile -t before < <(client_tx_stats_settled) + for ((cpu = 0; cpu < ncpus; cpu++)); do + ip netns exec "$NS_CLIENT" taskset -c "$cpu" \ + iperf3 -c "$IP_SERVER" -p $((5301 + cpu)) -Z -t 3 \ + > /dev/null & + pids+=($!) + done + for i in "${pids[@]}"; do + wait "$i" + check_err $? "iperf3 client failed" + done + mapfile -t after < <(client_tx_stats_settled) + + # 0-1: ppp0 packets and bytes; 2-3: the same on the veth + for i in 0 1 2 3; do + d[i]=$((after[i] - before[i])) + done + echo "ppp0: ${d[0]} packets, ${d[1]} bytes; veth: ${d[2]}, ${d[3]}" + + [ "${d[0]}" -gt 0 ] && [ "${d[0]}" -eq "${d[2]}" ] + check_err $? "PPP and Ethernet packet counts differ" + + # Ethernet (14), PPPoE (6) and PPP protocol (2) header per frame + [ "${d[3]}" -eq $((d[1] + 22 * d[0])) ] + check_err $? "PPP and Ethernet byte counts differ" +} + # Start socat as syslog listener socat -v -u UNIX-RECV:/dev/log OPEN:/dev/null > "$PPPOE_LOG" 2>&1 & SOCAT_PID=$! @@ -53,6 +131,11 @@ ppp_test_connectivity log_test "PPPoE" +RET=0 +ppp_test_parallel + +log_test "PPPoE parallel transmit" + # Dump syslog messages if the test failed if [ "$RET" -ne 0 ]; then while read -r _sign _date _time len _from _to -- 2.53.0