DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/1] test/pmd_perf: handling of unknown connection speed
@ 2022-05-11 16:33 Heinrich Schuchardt
  2022-06-26 15:15 ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2022-05-11 16:33 UTC (permalink / raw)
  To: Thomas Monjalon, David Marchand
  Cc: Ferruh Yigit, Chenbo Xia, Konstantin Ananyev, Ajit Khaparde,
	Rosen Xu, Stephen Hemminger, Joyce Kong, Jie Zhou, dev,
	Heinrich Schuchardt

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] test/pmd_perf: handling of unknown connection speed
  2022-05-11 16:33 [PATCH 1/1] test/pmd_perf: handling of unknown connection speed Heinrich Schuchardt
@ 2022-06-26 15:15 ` Thomas Monjalon
  2022-06-26 22:23   ` Ajit Khaparde
  2022-06-27  7:18   ` Heinrich Schuchardt
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Monjalon @ 2022-06-26 15:15 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: David Marchand, dev, Chenbo Xia, Ajit Khaparde, Rosen Xu,
	Stephen Hemminger, Joyce Kong, Jie Zhou, dev,
	konstantin.v.ananyev, ferruh.yigit, andrew.rybchenko

11/05/2022 18:33, Heinrich Schuchardt:
> 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;

This is redundant with below.

> +	} 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;

Why not just inserting this:

if (link_mbps == RTE_ETH_SPEED_NUM_UNKNOWN)
	link_mbps = RTE_ETH_SPEED_NUM_10G;




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] test/pmd_perf: handling of unknown connection speed
  2022-06-26 15:15 ` Thomas Monjalon
@ 2022-06-26 22:23   ` Ajit Khaparde
  2022-06-27  7:18   ` Heinrich Schuchardt
  1 sibling, 0 replies; 5+ messages in thread
From: Ajit Khaparde @ 2022-06-26 22:23 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Heinrich Schuchardt, David Marchand, dpdk-dev, Chenbo Xia,
	Rosen Xu, Stephen Hemminger, Joyce Kong, Jie Zhou,
	konstantin.v.ananyev, Ferruh Yigit, Andrew Rybchenko

[-- Attachment #1: Type: text/plain, Size: 2957 bytes --]

On Sun, Jun 26, 2022 at 8:15 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 11/05/2022 18:33, Heinrich Schuchardt:
> > 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;
>
> This is redundant with below.
>
> > +     } 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;
>
> Why not just inserting this:
>
> if (link_mbps == RTE_ETH_SPEED_NUM_UNKNOWN)
>         link_mbps = RTE_ETH_SPEED_NUM_10G;
+1
I think this is better.

>
>
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] test/pmd_perf: handling of unknown connection speed
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2022-06-27  7:18 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: David Marchand, dev, Chenbo Xia, Ajit Khaparde, Rosen Xu,
	Stephen Hemminger, Joyce Kong, Jie Zhou, konstantin.v.ananyev,
	ferruh.yigit, andrew.rybchenko, Ajit Khaparde

On 6/26/22 17:15, Thomas Monjalon wrote:
> 11/05/2022 18:33, Heinrich Schuchardt:
>> 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;

Yes this line should be removed.

> 
> This is redundant with below.
> 
>> +	} 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;
> 
> Why not just inserting this:
> 
> if (link_mbps == RTE_ETH_SPEED_NUM_UNKNOWN)
> 	link_mbps = RTE_ETH_SPEED_NUM_10G;

Following your suggestion the message "Each port will do %"PRIu64" 
packets per second\n" would provide misleading information to the user. 
This should be avoided.

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] test/pmd_perf: handling of unknown connection speed
  2022-06-27  7:18   ` Heinrich Schuchardt
@ 2022-06-27  7:54     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2022-06-27  7:54 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: David Marchand, dev, Chenbo Xia, Ajit Khaparde, Rosen Xu,
	Stephen Hemminger, Joyce Kong, Jie Zhou, konstantin.v.ananyev,
	ferruh.yigit, andrew.rybchenko, Ajit Khaparde

27/06/2022 09:18, Heinrich Schuchardt:
> On 6/26/22 17:15, Thomas Monjalon wrote:
> > 11/05/2022 18:33, Heinrich Schuchardt:
> >> 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;
> 
> Yes this line should be removed.
> 
> > 
> > This is redundant with below.
> > 
> >> +	} 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;
> > 
> > Why not just inserting this:
> > 
> > if (link_mbps == RTE_ETH_SPEED_NUM_UNKNOWN)
> > 	link_mbps = RTE_ETH_SPEED_NUM_10G;
> 
> Following your suggestion the message "Each port will do %"PRIu64" 
> packets per second\n" would provide misleading information to the user. 
> This should be avoided.

OK so we can have the printf inside an "if condition":

bool speed_unknown = (link_mbps == RTE_ETH_SPEED_NUM_UNKNOWN);
if (speed_unknown)
	link_mbps = RTE_ETH_SPEED_NUM_10G;
packets_per_second = ...;
if (!speed_unknown)
	printf(...);
total_packets = ...;




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-27  7:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 16:33 [PATCH 1/1] test/pmd_perf: handling of unknown connection speed Heinrich Schuchardt
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

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).