Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Yang Yang <yang.yang29@zte.com.cn>
To: davem@davemloft.net, edumazet@google.com,
	willemdebruijn.kernel@gmail.com
Cc: yang.yang29@zte.com.cn, kuba@kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org,
	zhang.yunkai@zte.com.cn, xu.xin16@zte.com.cn,
	Xuexin Jiang <jiang.xuexin@zte.com.cn>
Subject: [PATCH linux-next 3/3] selftests: net: udpgso_bench_rx: Fix packet number exceptions
Date: Mon, 17 Apr 2023 20:25:04 +0800	[thread overview]
Message-ID: <20230417122504.193350-1-yang.yang29@zte.com.cn> (raw)
In-Reply-To: <202304172017351308785@zte.com.cn>

From: Zhang Yunkai (CGEL ZTE) <zhang.yunkai@zte.com.cn>

The -n parameter is confusing and seems to only affect the frequency of
determining whether the time reaches 1s. However, the final print of the
program is the number of messages expected to be received, which is always
0.

bash# udpgso_bench_rx -4 -n 100
bash# udpgso_bench_tx -l 1 -4 -D "$DST"
udpgso_bench_rx: wrong packet number! got 0, expected 100

This is because the packets are always cleared after print.

Signed-off-by: Zhang Yunkai (CGEL ZTE) <zhang.yunkai@zte.com.cn>
Reviewed-by: xu xin (CGEL ZTE) <xu.xin16@zte.com.cn>
Reviewed-by: Yang Yang (CGEL ZTE) <yang.yang29@zte.com.cn>
Cc: Xuexin Jiang (CGEL ZTE) <jiang.xuexin@zte.com.cn>
---
 tools/testing/selftests/net/udpgso_bench_rx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c
index 784e88b31f7d..b66bb53af19f 100644
--- a/tools/testing/selftests/net/udpgso_bench_rx.c
+++ b/tools/testing/selftests/net/udpgso_bench_rx.c
@@ -50,7 +50,7 @@ static int  cfg_rcv_timeout_ms;
 static struct sockaddr_storage cfg_bind_addr;
 
 static bool interrupted;
-static unsigned long packets, bytes;
+static unsigned long packets, total_packets, bytes;
 
 static void sigint_handler(int signum)
 {
@@ -405,6 +405,7 @@ static void do_recv(void)
 					"%s rx: %6lu MB/s %8lu calls/s\n",
 					cfg_tcp ? "tcp" : "udp",
 					bytes >> 20, packets);
+			total_packets += packets;
 			bytes = packets = 0;
 			treport = tnow + 1000;
 		}
@@ -415,7 +416,7 @@ static void do_recv(void)
 
 	if (cfg_expected_pkt_nr && (packets != cfg_expected_pkt_nr))
 		error(1, 0, "wrong packet number! got %ld, expected %d\n",
-		      packets, cfg_expected_pkt_nr);
+		      total_packets + packets, cfg_expected_pkt_nr);
 
 	if (close(fd))
 		error(1, errno, "close");
-- 
2.15.2

  parent reply	other threads:[~2023-04-17 12:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 12:17 [PATCH linux-next 0/3] selftests: net: udpgso_bench_rx: Fix verifty, gsosize, and packet number exceptions yang.yang29
2023-04-17 12:24 ` [PATCH linux-next 1/3] selftests: net: udpgso_bench_rx: Fix verifty exceptions Yang Yang
2023-04-17 15:16   ` Willem de Bruijn
2023-04-18  1:29     ` Yang Yang
2023-04-18 13:01       ` Willem de Bruijn
2023-04-18 14:20   ` Paolo Abeni
2023-04-17 12:24 ` [PATCH linux-next 2/3] selftests: net: udpgso_bench_rx: Fix gsosize exceptions Yang Yang
2023-04-17 12:25 ` Yang Yang [this message]
2023-04-17 15:27   ` [PATCH linux-next 3/3] selftests: net: udpgso_bench_rx: Fix packet number exceptions Willem de Bruijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230417122504.193350-1-yang.yang29@zte.com.cn \
    --to=yang.yang29@zte.com.cn \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=xu.xin16@zte.com.cn \
    --cc=zhang.yunkai@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox