lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  8 Jul 2022 23:14:01 +0800
From:   gfree.wind@...look.com
To:     davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, netdev@...r.kernel.org
Cc:     gfree.wind@...look.com, Gao Feng <gfree.wind@...il.com>
Subject: [PATCH net] pktgen: Fix the inaccurate bps calculation

From: Gao Feng <gfree.wind@...il.com>

The prior codes use 1000000 as divisor to convert to the Mbps. But it isn't
accurate, because the NIC uses 1024*1024 from bps to Mbps. The result of
the codes is 1.05 times as the real value, even it may cause the result is
more than the nic's physical rate.

Signed-off-by: Gao Feng <gfree.wind@...il.com>
---
 net/core/pktgen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 84b62cd7bc57..e5cd3da63035 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3305,7 +3305,7 @@ static void show_results(struct pktgen_dev *pkt_dev, int nr_frags)
 	}
 
 	mbps = bps;
-	do_div(mbps, 1000000);
+	do_div(mbps, 1024 * 1024);
 	p += sprintf(p, "  %llupps %lluMb/sec (%llubps) errors: %llu",
 		     (unsigned long long)pps,
 		     (unsigned long long)mbps,
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ