From: Dave Taht <dave.taht@gmail.com>
To: cerowrt-devel <cerowrt-devel@lists.bufferbloat.net>
Subject: [Cerowrt-devel] Fwd: [PATCH net] pktgen: Fix the inaccurate bps calculation
Date: Fri, 8 Jul 2022 09:04:18 -0700 [thread overview]
Message-ID: <CAA93jw4cBQjx0PBxOWZ7wK1cui299ZXKvkT1mU_vNh9eMcX0=g@mail.gmail.com> (raw)
In-Reply-To: <OSZP286MB14047FAFB44F13D76137DFFA95829@OSZP286MB1404.JPNP286.PROD.OUTLOOK.COM>
heh. Fastest way to change the observed speed of the internet I've yet seen.
---------- Forwarded message ---------
From: <gfree.wind@outlook.com>
Date: Fri, Jul 8, 2022 at 8:51 AM
Subject: [PATCH net] pktgen: Fix the inaccurate bps calculation
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <netdev@vger.kernel.org>
Cc: <gfree.wind@outlook.com>, Gao Feng <gfree.wind@gmail.com>
From: Gao Feng <gfree.wind@gmail.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@gmail.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
--
FQ World Domination pending: https://blog.cerowrt.org/post/state_of_fq_codel/
Dave Täht CEO, TekLibre, LLC
parent reply other threads:[~2022-07-08 16:04 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <OSZP286MB14047FAFB44F13D76137DFFA95829@OSZP286MB1404.JPNP286.PROD.OUTLOOK.COM>]
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
List information: https://lists.bufferbloat.net/postorius/lists/cerowrt-devel.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAA93jw4cBQjx0PBxOWZ7wK1cui299ZXKvkT1mU_vNh9eMcX0=g@mail.gmail.com' \
--to=dave.taht@gmail.com \
--cc=cerowrt-devel@lists.bufferbloat.net \
/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