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