From 00cdb7afa260387ef86d3ab89d5dbd998d2934a7 Mon Sep 17 00:00:00 2001 From: Yanqin Wei Date: Wed, 7 Dec 2022 15:22:35 +0800 Subject: [PATCH] net: zperf: fix incorrect statistics of zperf The sequence id from iperf starts with 1. The commit changes the initial value of "next_id" in zperf from 0 to 1. In addition, the error output of "error" and "out of order" packets is corrected. Signed-off-by: Yanqin Wei --- subsys/net/lib/zperf/zperf_session.c | 2 +- subsys/net/lib/zperf/zperf_udp_receiver.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/lib/zperf/zperf_session.c b/subsys/net/lib/zperf/zperf_session.c index fe6964d6445..19e866d0a59 100644 --- a/subsys/net/lib/zperf/zperf_session.c +++ b/subsys/net/lib/zperf/zperf_session.c @@ -129,7 +129,7 @@ void zperf_reset_session_stats(struct session *session) session->counter = 0U; session->start_time = 0U; - session->next_id = 0U; + session->next_id = 1U; session->length = 0U; session->outorder = 0U; session->error = 0U; diff --git a/subsys/net/lib/zperf/zperf_udp_receiver.c b/subsys/net/lib/zperf/zperf_udp_receiver.c index 7ee7dea37d4..65988860ccf 100644 --- a/subsys/net/lib/zperf/zperf_udp_receiver.c +++ b/subsys/net/lib/zperf/zperf_udp_receiver.c @@ -195,10 +195,10 @@ static void udp_received(const struct shell *sh, int sock, session->counter); shell_fprintf(sh, SHELL_NORMAL, " nb packets lost:\t%u\n", - session->outorder); + session->error); shell_fprintf(sh, SHELL_NORMAL, " nb packets outorder:\t%u\n", - session->error); + session->outorder); shell_fprintf(sh, SHELL_NORMAL, " jitter:\t\t\t");