From patchwork Thu Aug 15 07:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13764478 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 113B6198E78; Thu, 15 Aug 2024 08:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723708814; cv=none; b=sEulDzUQAKFNI7oTmOrBvqXBIz2b/s4wO2+qIIzOl0wvcwvW//mpjhy9vWXVK1vD2Uqjp6zwRx9ReZIeY8/kzv60ydPnJ8mls7i6K+SW+4Ko9z5cJinDQji5Bz2FsvYMWkWkSGRyOO7hGlfFTlSVF11DdfbPcNoXUZATynEYfCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723708814; c=relaxed/simple; bh=/Mz/boUjXmOmN32HvNGQfixcUt/wZi69BHjt1UV0Bnk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hBfIX5UB0mGYZBfuLd7tSMgwFk9bKtL3iR9jtDZnbyEMM4H4Fd9ydSq6Si8YTbCzmTVOBpZxGIFz08z/iNvUpLniDT1VVLE/u0eHU1Tcl33L2LVppVkKJ7fNZUje1PFtMw+2fzqeiXmzsW7DHZvXwSnBPp1SVPFl/RfYN2Pd9IA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CMfydG7N; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CMfydG7N" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1fc56fd4de1so4992605ad.0; Thu, 15 Aug 2024 01:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723708812; x=1724313612; 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; bh=2hiH07ToBeYPOHQhWubo3If8QklSP7VD5jj+EhGHa3U=; b=CMfydG7N9GP0titnfHZzxBYwYvURl7l9O49wPx2N5uzkDSS8+SH5pRMRcmFYUePVGt C6Ez3qrcEd5G1lSyzXPN94FJiUnsfgKwmzEh4piTbBnRcIS1niHgZ1O/cVjnthvk+NN2 r4sLKxyehyXob1Zp7l0XzTUASiwTEBTw7G6BONlggw+zFTFvvuiKD3+2ZMarInzY+Zvy 5NoYmYStqdPh0QeC0WVeNYMJD5+1tSU7T3qsFsL4ul7ChaQGUMFqwM/meXzgMigus13L YKpFpUGHhOCEPD/H0zHrp6J5vEgw90/DozTZoM3KB7trVp5r/iRulAJ+vyeUFF9x4kic yvvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723708812; x=1724313612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2hiH07ToBeYPOHQhWubo3If8QklSP7VD5jj+EhGHa3U=; b=RCl+F09btA+l/S/2I5kTvcBdP+3n3ETXMPPTid4S6MmGNm2gbmeSUneaHx+ECeno80 POjsUwdh4+ayvvEj4agfnZtjaeiNW8mwmk0nPLDW+8Rv/B/lmOJ8LqMOIFw0cHlglZgo eW1i1yGpEmWcz/QfTMVxlGorZO02PPfbFtrwJKfDOuiQK4kMzSEw3S1IgXl3gZCYQYLV 4ziAGqme2ktGRKFWPxtYoHRnb00/HXcW/S+xNFhWZ/q0Rh/K9JMu9YenfPoR3pKa1xIn ao4rxbU5tFxuepQnBkjQz6X5Vmuk2HNgQsVYxiuOQw5CNE4B6apKsjfagQxZqERc4jAf n6uQ== X-Forwarded-Encrypted: i=1; AJvYcCWSNbh7jxlUkKnsEC7T8Ql3jTA6eyM4jco8dTISRPA+a/3rc2app3UY8LYhk5r0tN3ctD9wNU8VSgYvaWhk45eBN741BYRBHY6jeNzI+PjWaZ1pBgzj52c0gZMYbJoIZP0kh2h8 X-Gm-Message-State: AOJu0Yx4CdIJcwqbdyWxRFYpHuuFSbujzG5zMABwx5nMyv1p04J284u/ 6CQpqtTm23DB9dayGpPY550M5/bXreByOP32Ca8BgYMAOTLowNQOLHNGlu0L X-Google-Smtp-Source: AGHT+IGRtQzMUFIQNdBN1SXClgGfpcrknv45ij3BGzsmSDhz/5haklkzl772ncKUn1lyzFwH10QBYQ== X-Received: by 2002:a17:903:41ca:b0:1fd:a412:5df2 with SMTP id d9443c01a7336-201ee515b17mr37563005ad.29.1723708811839; Thu, 15 Aug 2024 01:00:11 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201f0375649sm6250515ad.124.2024.08.15.01.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 01:00:11 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , Ignat Korchagin , linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu Subject: [PATCHv2 net 1/2] selftests: udpgro: report error when receive failed Date: Thu, 15 Aug 2024 15:59:50 +0800 Message-ID: <20240815075951.189059-2-liuhangbin@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240815075951.189059-1-liuhangbin@gmail.com> References: <20240815075951.189059-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently, we only check the latest senders's exit code. If the receiver report failed, it is not recoreded. Fix it by checking the exit code of all the involved processes. Before: bad GRO lookup ok multiple GRO socks ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 failed $ echo $? 0 After: bad GRO lookup ok multiple GRO socks ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 failed $ echo $? 1 Fixes: 3327a9c46352 ("selftests: add functionals test for UDP GRO") Suggested-by: Paolo Abeni Signed-off-by: Hangbin Liu --- v2: init local ret for check_err. With this the current failure will not affect later test result. --- tools/testing/selftests/net/udpgro.sh | 44 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/net/udpgro.sh b/tools/testing/selftests/net/udpgro.sh index 11a1ebda564f..4659cf01e438 100755 --- a/tools/testing/selftests/net/udpgro.sh +++ b/tools/testing/selftests/net/udpgro.sh @@ -46,17 +46,19 @@ run_one() { local -r all="$@" local -r tx_args=${all%rx*} local -r rx_args=${all#*rx} + local ret=0 cfg_veth - ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} && \ - echo "ok" || \ - echo "failed" & + ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} & + local PID1=$! wait_local_port_listen ${PEER_NS} 8000 udp ./udpgso_bench_tx ${tx_args} - ret=$? - wait $(jobs -p) + check_err $? + wait ${PID1} + check_err $? + [ "$ret" -eq 0 ] && echo "ok" || echo "failed" return $ret } @@ -73,6 +75,7 @@ run_one_nat() { local -r all="$@" local -r tx_args=${all%rx*} local -r rx_args=${all#*rx} + local ret=0 if [[ ${tx_args} = *-4* ]]; then ipt_cmd=iptables @@ -93,16 +96,17 @@ run_one_nat() { # ... so that GRO will match the UDP_GRO enabled socket, but packets # will land on the 'plain' one ip netns exec "${PEER_NS}" ./udpgso_bench_rx -G ${family} -b ${addr1} -n 0 & - pid=$! - ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} && \ - echo "ok" || \ - echo "failed"& + local PID1=$! + ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} & + local PID2=$! wait_local_port_listen "${PEER_NS}" 8000 udp ./udpgso_bench_tx ${tx_args} - ret=$? - kill -INT $pid - wait $(jobs -p) + check_err $? + kill -INT ${PID1} + wait ${PID2} + check_err $? + [ "$ret" -eq 0 ] && echo "ok" || echo "failed" return $ret } @@ -111,20 +115,26 @@ run_one_2sock() { local -r all="$@" local -r tx_args=${all%rx*} local -r rx_args=${all#*rx} + local ret=0 cfg_veth ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 & - ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \ - echo "ok" || \ - echo "failed" & + local PID1=$! + ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} & + local PID2=$! wait_local_port_listen "${PEER_NS}" 12345 udp ./udpgso_bench_tx ${tx_args} -p 12345 + check_err $? wait_local_port_listen "${PEER_NS}" 8000 udp ./udpgso_bench_tx ${tx_args} - ret=$? - wait $(jobs -p) + check_err $? + wait ${PID1} + check_err $? + wait ${PID2} + check_err $? + [ "$ret" -eq 0 ] && echo "ok" || echo "failed" return $ret } From patchwork Thu Aug 15 07:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13764479 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A80F719E7C8; Thu, 15 Aug 2024 08:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723708821; cv=none; b=rT9hAPYBRhLC+ZtgJzjgNuuNbUdKK5O21rf/canTM3Kkcexb3tTP9SdKxjuk9+2q2ofKgHeJmKNuGgF/Uc2loTKXZT486JiF9mlY0+PHNlXnJGQcvAZAOf/DleTJTo2waFGQQYse4Jo8/YWVV2cj+8PeLKmam2lqvvRKu17Y7K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723708821; c=relaxed/simple; bh=/PSAS6fGscIZZGwr+tXSEVxTQmx2lfatLsRY05pzoyo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aX4CdbJdBvFnEFjAbYUqnDrTgYfGSrBlTP7bOiBs6beFMGwZE4T49lcQmfZevNgsd9k2GTj3MX+qR/jQOMS1TJ/vcUH62QrM+iTRiT+6o6BvoIihLBENXIXoksKrwiF0r/w2f5Ys6hM/IJ0Bxt+E8h/TfY2rX+esXRDjSWughSo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M3uZQVr4; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M3uZQVr4" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7a263f6439eso550054a12.3; Thu, 15 Aug 2024 01:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723708819; x=1724313619; 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; bh=XfRMP9yHEwG0TQMvHjZIar43XCUon3TZcQShYdfW53A=; b=M3uZQVr4tsM1Ru3DPDysrdxQ/PEFpweGv1YOuUU3oK0qx3bxuc8v6/6RXYmpKuB6PW Ne/iF4U3ADhW+Gi4GkKYwQ6Ibdp2MLVoBddlWvlgH1UB0ZPaOZOih4KiZ8IIVP6ay4tD SfLzRyJF6Az134uV5iSdyDC+e7YeTlm04xkThHevdjMn8CnZIDa3j5DU1IYUoHkW+3uw AE5JvEpyNxE+fDo50IgWm6eBO1dHXZAFEG6P5UB/bhY+jMivLUWLKv8iKXXLm8//4GRU aBKZqgt69ExVuhvvYqWdIsLO6FdxtASTv1BW/zTekSNWaOa/ZGj98gkAMnyzz+dCPAAL 0Bzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723708819; x=1724313619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XfRMP9yHEwG0TQMvHjZIar43XCUon3TZcQShYdfW53A=; b=iUSj0QJaCK3pvUup3lXW0/WJYVZn7MnX/V2/KLCEgvkSx7U1Q0ABnd9B8QEtK56vwR lGuyRlKseto1ZgwV9yKK5p8TeLirTTM2YrmjXSyxx4UKB49h/7y/x4sBOTQz0MwOzwqx jNBTYc0+DY/PIC4Idiha0zBWTq7QFrnqbrhXhKzMtsZFny9ZLs+QDfL0z1zzfUuN6erw THoJnMKtxX8GG6WWzB7slOrwJzntxYoKyPqC6B3NgSWOfbWP3Y094T5Pl+kaEHLa6yP9 YBTSw3XSdJSHDX3x07Bnn3fb8M/G26b7mWLCg7kpBlDrRalRWRega8s0OMl8rL6iSFkc 4dcA== X-Forwarded-Encrypted: i=1; AJvYcCVnIRyDFF82t2MGUnvc+AKFp9lFQ8BpCUTJUt681TCkPOG212gTd8DbFoxoBRlhrxH1zuXyTD1P0GJkn/1ecFDIDT4o6KRKs4y0wvbqk7O0mKuhcc6ULdpCY4x+6d2OeVDhaj3N X-Gm-Message-State: AOJu0Yx2pebVDRq23y1xaZAIL8K+96kisXtSY5zZ5jkutEdlWxgB1XLG IWFQCa+c7Gz801I+K36e2pNwAoE7Wct1jFIm+MgbpP2zX4S3qU6g/0Cc9Mc2 X-Google-Smtp-Source: AGHT+IEbYTmoog3EB+Mrw2CDH49mp3bDC5vNbIyQ4pn+4hrgp7pS8ROqq/Rp5zAOYTdiWuRlhgfEvA== X-Received: by 2002:a05:6a20:c887:b0:1c2:8fd1:a47d with SMTP id adf61e73a8af0-1c8eae59c9dmr7405017637.6.1723708818277; Thu, 15 Aug 2024 01:00:18 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201f0375649sm6250515ad.124.2024.08.15.01.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 01:00:18 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , Ignat Korchagin , linux-kselftest@vger.kernel.org, bpf@vger.kernel.org, Hangbin Liu , Yi Chen Subject: [PATCHv2 net 2/2] selftests: udpgro: no need to load xdp for gro Date: Thu, 15 Aug 2024 15:59:51 +0800 Message-ID: <20240815075951.189059-3-liuhangbin@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240815075951.189059-1-liuhangbin@gmail.com> References: <20240815075951.189059-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After commit d7db7775ea2e ("net: veth: do not manipulate GRO when using XDP"), there is no need to load XDP program to enable GRO. On the other hand, the current test is failed due to loading the XDP program. e.g. # selftests: net: udpgro.sh # ipv4 # no GRO ok # no GRO chk cmsg ok # GRO ./udpgso_bench_rx: recv: bad packet len, got 1472, expected 14720 # # failed [...] # bad GRO lookup ok # multiple GRO socks ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 # # ./udpgso_bench_rx: recv: bad packet len, got 1452, expected 14520 # # failed ok 1 selftests: net: udpgro.sh After fix, all the test passed. # ./udpgro.sh ipv4 no GRO ok [...] multiple GRO socks ok Fixes: d7db7775ea2e ("net: veth: do not manipulate GRO when using XDP") Reported-by: Yi Chen Closes: https://issues.redhat.com/browse/RHEL-53858 Reviewed-by: Toke Høiland-Jørgensen Acked-by: Paolo Abeni Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/udpgro.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/udpgro.sh b/tools/testing/selftests/net/udpgro.sh index 4659cf01e438..d5ffd8c9172e 100755 --- a/tools/testing/selftests/net/udpgro.sh +++ b/tools/testing/selftests/net/udpgro.sh @@ -7,8 +7,6 @@ source net_helper.sh readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="xdp_dummy.bpf.o" - # set global exit status, but never reset nonzero one. check_err() { @@ -38,7 +36,7 @@ cfg_veth() { ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24 ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad ip -netns "${PEER_NS}" link set dev veth1 up - ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp + ip netns exec "${PEER_NS}" ethtool -K veth1 gro on } run_one() { @@ -206,11 +204,6 @@ run_all() { return $ret } -if [ ! -f ${BPF_FILE} ]; then - echo "Missing ${BPF_FILE}. Run 'make' first" - exit -1 -fi - if [[ $# -eq 0 ]]; then run_all elif [[ $1 == "__subprocess" ]]; then