[PATCH] selftests/net: udpgso_bench_tx: fix dst ip argument

Subsystems: kernel selftest framework, networking [general], the rest

STALE1745d LANDED

Landed in mainline as 9c1952aeaa98 on 2021-12-30.

3 messages, 3 authors, 2021-12-30 · open the first message on its own page

[PATCH] selftests/net: udpgso_bench_tx: fix dst ip argument

From: Jianguo Wu <hidden>
Date: 2021-12-29 10:58:30

From: wujianguo <redacted>

udpgso_bench_tx call setup_sockaddr() for dest address before
parsing all arguments, if we specify "-p ${dst_port}" after "-D ${dst_ip}",
then ${dst_port} will be ignored, and using default cfg_port 8000.

This will cause test case "multiple GRO socks" failed in udpgro.sh.

Setup sockaddr after after parsing all arguments.

Fixes: 3a687bef148d ("selftests: udp gso benchmark")
Signed-off-by: Jianguo Wu <redacted>
---
 tools/testing/selftests/net/udpgso_bench_tx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
index 17512a4..f1fdaa2 100644
--- a/tools/testing/selftests/net/udpgso_bench_tx.c
+++ b/tools/testing/selftests/net/udpgso_bench_tx.c
@@ -419,6 +419,7 @@ static void usage(const char *filepath)

 static void parse_opts(int argc, char **argv)
 {
+	const char *bind_addr = NULL;
 	int max_len, hdrlen;
 	int c;
@@ -446,7 +447,7 @@ static void parse_opts(int argc, char **argv)
 			cfg_cpu = strtol(optarg, NULL, 0);
 			break;
 		case 'D':
-			setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
+			bind_addr = optarg;
 			break;
 		case 'l':
 			cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
@@ -492,6 +493,11 @@ static void parse_opts(int argc, char **argv)
 		}
 	}

+	if (!bind_addr)
+		bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
+
+	setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr);
+
 	if (optind != argc)
 		usage(argv[0]);
-- 
1.8.3.1

Re: [PATCH] selftests/net: udpgso_bench_tx: fix dst ip argument

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2021-12-29 14:17:17

On Wed, Dec 29, 2021 at 5:58 AM Jianguo Wu [off-list ref] wrote:
From: wujianguo <redacted>

udpgso_bench_tx call setup_sockaddr() for dest address before
parsing all arguments, if we specify "-p ${dst_port}" after "-D ${dst_ip}",
then ${dst_port} will be ignored, and using default cfg_port 8000.

This will cause test case "multiple GRO socks" failed in udpgro.sh.

Setup sockaddr after after parsing all arguments.

Fixes: 3a687bef148d ("selftests: udp gso benchmark")
Signed-off-by: Jianguo Wu <redacted>
Reviewed-by: Willem de Bruijn <willemb@google.com>

The udpgso_bench_tx equivalent to commit d336509cb9d0 ("selftests/net:
udpgso_bench_rx: fix port argument"). Thanks.

Re: [PATCH] selftests/net: udpgso_bench_tx: fix dst ip argument

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-12-30 02:25:20

On Wed, 29 Dec 2021 09:16:37 -0500 Willem de Bruijn wrote:
On Wed, Dec 29, 2021 at 5:58 AM Jianguo Wu [off-list ref] wrote:
quoted
From: wujianguo <redacted>

udpgso_bench_tx call setup_sockaddr() for dest address before
parsing all arguments, if we specify "-p ${dst_port}" after "-D ${dst_ip}",
then ${dst_port} will be ignored, and using default cfg_port 8000.

This will cause test case "multiple GRO socks" failed in udpgro.sh.

Setup sockaddr after after parsing all arguments.
s/after after/after/
quoted
Fixes: 3a687bef148d ("selftests: udp gso benchmark")
Signed-off-by: Jianguo Wu <redacted>  
Reviewed-by: Willem de Bruijn <willemb@google.com>

The udpgso_bench_tx equivalent to commit d336509cb9d0 ("selftests/net:
udpgso_bench_rx: fix port argument"). Thanks.
Applied, thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help