DPDK patches and discussions
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Thomas Monjalon <thomas@monjalon.net>,
	David Marchand <david.marchand@redhat.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	Chenbo Xia <chenbo.xia@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Rosen Xu <rosen.xu@intel.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Joyce Kong <joyce.kong@arm.com>,
	Jie Zhou <jizh@linux.microsoft.com>,
	dev@dpdk.org,
	Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: [PATCH 1/1] test/pmd_perf: handling of unknown connection speed
Date: Wed, 11 May 2022 18:33:10 +0200	[thread overview]
Message-ID: <20220511163310.50892-1-heinrich.schuchardt@canonical.com> (raw)

When running DPDK in QEMU it cannot determine the connection speed.
pmd_perf_autotest treats this as if the connection speed where
UNIT32_MAX Mbps:

    RTE>>pmd_perf_autotest
    Start PMD RXTX cycles cost test.
    Allocated mbuf pool on socket 0
    CONFIG RXD=1024 TXD=1024
    Performance test runs on lcore 1 socket 0
    Port 0 Address:52:54:00:12:34:57
    Port 1 Address:52:54:00:12:34:58
    Checking link statuses...
    Port 0 Link up at Unknown FDX Autoneg
    Port 1 Link up at Unknown FDX Autoneg
    IPv4 pktlen 46
    UDP pktlen 26
    Generate 4096 packets @socket 0
    inject 2048 packet to port 0
    inject 2048 packet to port 1
    Total packets inject to prime ports = 4096
    Each port will do 6391320379464 packets per second
    Test will stop after at least 25565281517856 packets received

This will not allow the test to terminate in a reasonable timespan.
Just assume 10 Gbps in this case instead:

    ...
    Test will stop after at least 59523808 packets received

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 app/test/test_pmd_perf.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 25611bfe9b..ee08c8aade 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -486,10 +486,17 @@ main_loop(__rte_unused void *args)
 	}
 	printf("Total packets inject to prime ports = %u\n", idx);
 
-	packets_per_second = (link_mbps * 1000 * 1000) /
-		((PACKET_SIZE + FRAME_GAP + MAC_PREAMBLE) * CHAR_BIT);
-	printf("Each port will do %"PRIu64" packets per second\n",
-	       packets_per_second);
+	if (link_mbps != RTE_ETH_SPEED_NUM_UNKNOWN) {
+		packets_per_second = (link_mbps * 1000 * 1000) /
+			((PACKET_SIZE + FRAME_GAP + MAC_PREAMBLE) * CHAR_BIT);
+		printf("Each port will do %"PRIu64" packets per second\n",
+		       packets_per_second);
+		total_packets = RTE_TEST_DURATION * conf->nb_ports * packets_per_second;
+	} else {
+		/* We don't know the speed. Pretend it is 10G */
+		packets_per_second = ((uint64_t)RTE_ETH_SPEED_NUM_10G * 1000 * 1000) /
+			((PACKET_SIZE + FRAME_GAP + MAC_PREAMBLE) * CHAR_BIT);
+	}
 
 	total_packets = RTE_TEST_DURATION * conf->nb_ports * packets_per_second;
 	printf("Test will stop after at least %"PRIu64" packets received\n",
-- 
2.34.1


             reply	other threads:[~2022-05-11 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 16:33 Heinrich Schuchardt [this message]
2022-06-26 15:15 ` Thomas Monjalon
2022-06-26 22:23   ` Ajit Khaparde
2022-06-27  7:18   ` Heinrich Schuchardt
2022-06-27  7:54     ` Thomas Monjalon

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=20220511163310.50892-1-heinrich.schuchardt@canonical.com \
    --to=heinrich.schuchardt@canonical.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jizh@linux.microsoft.com \
    --cc=joyce.kong@arm.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.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;
as well as URLs for NNTP newsgroup(s).