[dpdk-dev] [PATCH v3 1/2] app/test: fix failures in the ring_pmd_autotest program

2015-11-27 Thread Thomas Monjalon
2015-11-27 16:40, Iremonger, Bernard:
> Will correct in v4.

Bernard, please use --in-reply-to 
'<1448640460-25249-1-git-send-email-bernard.iremonger at intel.com>'.
It will thread the v4 below the v3.
Thanks


[dpdk-dev] [PATCH v3 1/2] app/test: fix failures in the ring_pmd_autotest program

2015-11-27 Thread Iremonger, Bernard
Hi Bruce,


> Subject: Re: [dpdk-dev] [PATCH v3 1/2] app/test: fix failures in the
> ring_pmd_autotest program
> 
> On Fri, Nov 27, 2015 at 04:07:39PM +, Bernard Iremonger wrote:
> > If eth_ring vdevs are created from the command line with the --vdev
> > option, they create there own rings which are not shared by other vdevs.
> 
> Typo: s/their/there/

Will correct in v4.

> 
> > Some of tests in this suite require that the vdevs share rings, so
> > some of the tests fail.
> >
> > For vdevs to share rings they must be created in the test code with
> > the
> > rte_eth_from_rings() function using rings created with the
> > rte_ring_create() function.
> >
> > Use the command line option --vdev=eth_ring0 to create port 0.
> 
> As I understand it, this option is not mandatory for the tests to pass, it 
> only
> allows some additional functional tests on cmd-line created rings to be run.
> This should perhaps still be called out in the commit message.

I will add that this option is not mandatory to the commit message.

> 
> > Create two rings and five ethdevs in test_pmd_ring.c for ports 1 to 5.
> "... and then use these to run the unit tests on the pmd ring functionality"
> 
> 
> > Improve test output by adding the port number to printf statements,
> > and adding a printf describing each test.
> >
> 
> /Bruce

Regards,

Bernard.



[dpdk-dev] [PATCH v3 1/2] app/test: fix failures in the ring_pmd_autotest program

2015-11-27 Thread Bruce Richardson
On Fri, Nov 27, 2015 at 04:07:39PM +, Bernard Iremonger wrote:
> If eth_ring vdevs are created from the command line with the --vdev option,
> they create there own rings which are not shared by other vdevs.

Typo: s/their/there/

> Some of tests in this suite require that the vdevs share rings, so some
> of the tests fail.
> 
> For vdevs to share rings they must be created in the test code with the
> rte_eth_from_rings() function using rings created with the rte_ring_create()
> function.
> 
> Use the command line option --vdev=eth_ring0 to create port 0.

As I understand it, this option is not mandatory for the tests to pass, it only
allows some additional functional tests on cmd-line created rings to be run.
This should perhaps still be called out in the commit message.

> Create two rings and five ethdevs in test_pmd_ring.c for ports 1 to 5.
"... and then use these to run the unit tests on the pmd ring functionality"


> Improve test output by adding the port number to printf statements,
> and adding a printf describing each test.
>

/Bruce


[dpdk-dev] [PATCH v3 1/2] app/test: fix failures in the ring_pmd_autotest program

2015-11-27 Thread Bernard Iremonger
If eth_ring vdevs are created from the command line with the --vdev option,
they create there own rings which are not shared by other vdevs.
Some of tests in this suite require that the vdevs share rings, so some
of the tests fail.

For vdevs to share rings they must be created in the test code with the
rte_eth_from_rings() function using rings created with the rte_ring_create()
function.

Use the command line option --vdev=eth_ring0 to create port 0.
Create two rings and five ethdevs in test_pmd_ring.c for ports 1 to 5.
Improve test output by adding the port number to printf statements,
and adding a printf describing each test.

Signed-off-by: Bernard Iremonger 
Acked-by: Bruce Richardson 
---
 app/test/test_pmd_ring.c | 360 ---
 1 file changed, 219 insertions(+), 141 deletions(-)

diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c
index a555db8..5568759 100644
--- a/app/test/test_pmd_ring.c
+++ b/app/test/test_pmd_ring.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
@@ -38,108 +38,104 @@
 #include 

 static struct rte_mempool *mp;
+static int tx_porta, rx_portb, rxtx_portc, rxtx_portd, rxtx_porte;

-#define TX_PORT 0
-#define RX_PORT 1
-#define RXTX_PORT 2
-#define RXTX_PORT2 3
-#define RXTX_PORT3 4
 #define SOCKET0 0
-
 #define RING_SIZE 256
+#define NUM_RINGS 2
+#define NB_MBUF 512

-#define NB_MBUF   512

 static int
-test_ethdev_configure(void)
+test_ethdev_configure_port(int port)
 {
struct rte_eth_conf null_conf;
struct rte_eth_link link;

memset(&null_conf, 0, sizeof(struct rte_eth_conf));

-   if ((TX_PORT >= RTE_MAX_ETHPORTS) || (RX_PORT >= RTE_MAX_ETHPORTS)\
-   || (RXTX_PORT >= RTE_MAX_ETHPORTS)) {
-   printf(" TX/RX port exceed max eth ports\n");
-   return -1;
-   }
-   if (rte_eth_dev_configure(TX_PORT, 1, 2, &null_conf) < 0) {
-   printf("Configure failed for TX port\n");
+   if (rte_eth_dev_configure(port, 1, 2, &null_conf) < 0) {
+   printf("Configure failed for port %d\n", port);
return -1;
}

/* Test queue release */
-   if (rte_eth_dev_configure(TX_PORT, 1, 1, &null_conf) < 0) {
-   printf("Configure failed for TX port\n");
-   return -1;
-   }
-   if (rte_eth_dev_configure(RX_PORT, 1, 1, &null_conf) < 0) {
-   printf("Configure failed for RX port\n");
-   return -1;
-   }
-   if (rte_eth_dev_configure(RXTX_PORT, 1, 1, &null_conf) < 0) {
-   printf("Configure failed for RXTX port\n");
+   if (rte_eth_dev_configure(port, 1, 1, &null_conf) < 0) {
+   printf("Configure failed for port %d\n", port);
return -1;
}

-   if (rte_eth_tx_queue_setup(TX_PORT, 0, RING_SIZE, SOCKET0, NULL) < 0) {
-   printf("TX queue setup failed\n");
-   return -1;
-   }
-   if (rte_eth_rx_queue_setup(RX_PORT, 0, RING_SIZE, SOCKET0,
-   NULL, mp) < 0) {
-   printf("RX queue setup failed\n");
-   return -1;
-   }
-   if (rte_eth_tx_queue_setup(RXTX_PORT, 0, RING_SIZE, SOCKET0, NULL) < 0) 
{
-   printf("TX queue setup failed\n");
+   if (rte_eth_tx_queue_setup(port, 0, RING_SIZE, SOCKET0, NULL) < 0) {
+   printf("TX queue setup failed port %d\n", port);
return -1;
}
-   if (rte_eth_rx_queue_setup(RXTX_PORT, 0, RING_SIZE, SOCKET0,
+
+   if (rte_eth_rx_queue_setup(port, 0, RING_SIZE, SOCKET0,
NULL, mp) < 0) {
-   printf("RX queue setup failed\n");
+   printf("RX queue setup failed port %d\n", port);
return -1;
}

-   if (rte_eth_dev_start(TX_PORT) < 0) {
-   printf("Error starting TX port\n");
+   if (rte_eth_dev_start(port) < 0) {
+   printf("Error starting port %d\n", port);
return -1;
}
-   if (rte_eth_dev_start(RX_PORT) < 0) {
-   printf("Error starting RX port\n");
+
+   rte_eth_link_get(port, &link);
+
+   return 0;
+}
+
+static int
+test_send_basic_packets(void)
+{
+   struct rte_mbuf  bufs[RING_SIZE];
+   struct rte_mbuf *pbufs[RING_SIZE];
+   int i;
+
+   printf("Testing send and receive RING_SIZE/2 packets (tx_porta -> 
rx_portb)\n");
+
+   for (i = 0; i < RING_SIZE/2; i++)
+   pbufs[i] = &bufs[i];
+
+   if (rte_eth_tx_burst(tx_porta, 0, pbufs, RING_SIZE/2) < RING_SIZE/2) {
+   printf("Failed to transmit packet burst port %d\n", tx_porta);
return -1;
}
-   if (rte_eth_dev_start(RXTX_PORT) < 0) {
-