Skip to contentSkip to conversation

test/event_eth_rx_intr_adapter: support NICs with fewer int vectors

PATCH Applied Bruce Richardson 3 participants 3 messages Mar 26 – Jun 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/event_eth_rx_intr_adapter: support NICs with fewer int vectors

Some NICs may not be able to support interrupts on all queues that are advertised, which will cause the test to fail if the queues supporting interrupts are fewer than 64. We can work around this by retrying the NIC configuration multiple times with fewer queues in case of failure. This allows the test to pass with NICs using ixgbe driver, for example.

---
 app/test/test_event_eth_rx_adapter.c | 52 +++++++++++++++++-----------
 1 file changed, 32 insertions(+), 20 deletions(-)
app/test/test_event_eth_rx_adapter.c +32 -20
index ae428b3333..7b38935bec 100644
@@ -60,6 +60,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 {
 	const uint16_t rx_ring_size = 512, tx_ring_size = 512;
 	int retval;
+	bool started = false;
 	uint16_t q;
 	struct rte_eth_dev_info dev_info;
 
@@ -76,32 +77,43 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 					MAX_NUM_RX_QUEUE);
 	default_params.tx_rings = 1;
 
-	/* Configure the Ethernet device. */
-	retval = rte_eth_dev_configure(port, default_params.rx_rings,
+	while (!started) {
+		/* Configure the Ethernet device. */
+		retval = rte_eth_dev_configure(port, default_params.rx_rings,
 				default_params.tx_rings, port_conf);
-	if (retval != 0)
-		return retval;
-
-	for (q = 0; q < default_params.rx_rings; q++) {
-		retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
-				rte_eth_dev_socket_id(port), NULL, mp);
-		if (retval < 0)
+		if (retval != 0)
 			return retval;
-	}
 
-	/* Allocate and set up 1 TX queue per Ethernet port. */
-	for (q = 0; q < default_params.tx_rings; q++) {
-		retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
-				rte_eth_dev_socket_id(port), NULL);
-		if (retval < 0)
+		for (q = 0; q < default_params.rx_rings; q++) {
+			retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
+					rte_eth_dev_socket_id(port), NULL, mp);
+			if (retval < 0)
+				return retval;
+		}
+
+		/* Allocate and set up 1 TX queue per Ethernet port. */
+		for (q = 0; q < default_params.tx_rings; q++) {
+			retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
+					rte_eth_dev_socket_id(port), NULL);
+			if (retval < 0)
+				return retval;
+		}
+
+		/* Start the Ethernet port. */
+		retval = rte_eth_dev_start(port);
+		if (retval < 0) {
+			/* Some NICs may not support interrupts on all reported queues.
+			 * Therefore try to reconfigure and start with fewer queues
+			 */
+			if (default_params.rx_rings > 2) {
+				default_params.rx_rings /= 2;
+				continue;
+			}
 			return retval;
+		}
+		started = true;
 	}
 
-	/* Start the Ethernet port. */
-	retval = rte_eth_dev_start(port);
-	if (retval < 0)
-		return retval;
-
 	/* Display the port MAC address. */
 	struct rte_ether_addr addr;
 	retval = rte_eth_macaddr_get(port, &addr);
Signature · 1 line
2.51.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

Subject: [PATCH] test/event_eth_rx_intr_adapter: support NICs with fewer int vectors

Some NICs may not be able to support interrupts on all queues that are advertised, which will cause the test to fail if the queues supporting interrupts are fewer than 64. We can work around this by retrying the NIC configuration multiple times with fewer queues in case of failure. This allows the test to pass with NICs using ixgbe driver, for example.

LGTM.

Quoted 88 lines
---
 app/test/test_event_eth_rx_adapter.c | 52 +++++++++++++++++-----------
 1 file changed, 32 insertions(+), 20 deletions(-)
app/test/test_event_eth_rx_adapter.c +24 -15
index ae428b3333..7b38935bec 100644
@@ -60,6 +60,7 @@ port_init_common(uint16_t port, const struct
 rte_eth_conf *port_conf,
 {
 	const uint16_t rx_ring_size = 512, tx_ring_size = 512;
 	int retval;
+	bool started = false;
 	uint16_t q;
 	struct rte_eth_dev_info dev_info;
@@ -76,32 +77,43 @@ port_init_common(uint16_t port, const struct
 rte_eth_conf *port_conf,
 					MAX_NUM_RX_QUEUE);
 	default_params.tx_rings = 1;
 
-	/* Configure the Ethernet device. */
-	retval = rte_eth_dev_configure(port, default_params.rx_rings,
+	while (!started) {
+		/* Configure the Ethernet device. */
+		retval = rte_eth_dev_configure(port, default_params.rx_rings,
 				default_params.tx_rings, port_conf);
-	if (retval != 0)
-		return retval;
-
-	for (q = 0; q < default_params.rx_rings; q++) {
-		retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
-				rte_eth_dev_socket_id(port), NULL, mp);
-		if (retval < 0)
+		if (retval != 0)
 			return retval;
-	}
 
-	/* Allocate and set up 1 TX queue per Ethernet port. */
-	for (q = 0; q < default_params.tx_rings; q++) {
-		retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
-				rte_eth_dev_socket_id(port), NULL);
-		if (retval < 0)
+		for (q = 0; q < default_params.rx_rings; q++) {
+			retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
+					rte_eth_dev_socket_id(port), NULL,
 mp);
+			if (retval < 0)
+				return retval;
+		}
+
+		/* Allocate and set up 1 TX queue per Ethernet port. */
+		for (q = 0; q < default_params.tx_rings; q++) {
+			retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
+					rte_eth_dev_socket_id(port), NULL);
+			if (retval < 0)
+				return retval;
+		}
+
+		/* Start the Ethernet port. */
+		retval = rte_eth_dev_start(port);
+		if (retval < 0) {
+			/* Some NICs may not support interrupts on all

reported queues.

app/test/test_event_eth_rx_adapter.c +1 -0
+			 * Therefore try to reconfigure and start with fewer

queues

app/test/test_event_eth_rx_adapter.c +7 -6
+			 */
+			if (default_params.rx_rings > 2) {
+				default_params.rx_rings /= 2;
+				continue;
+			}
 			return retval;
+		}
+		started = true;
 	}
 
-	/* Start the Ethernet port. */
-	retval = rte_eth_dev_start(port);
-	if (retval < 0)
-		return retval;
-
 	/* Display the port MAC address. */
 	struct rte_ether_addr addr;
 	retval = rte_eth_macaddr_get(port, &addr);
--

2.51.0

Applied
#2 lore raw
Quoted 10 lines · Ciara
Quoted 10 lines

Subject: [PATCH] test/event_eth_rx_intr_adapter: support NICs with fewer int vectors

Some NICs may not be able to support interrupts on all queues that are advertised, which will cause the test to fail if the queues supporting interrupts are fewer than 64. We can work around this by retrying the NIC configuration multiple times with fewer queues in case of failure. This allows the test to pass with NICs using ixgbe driver, for example.

Quoted 4 lines
Quoted 1 line

LGTM.

Applied to dpdk-next-eventdev/for-main. Thanks

Quoted 90 lines
Quoted 89 lines
---
 app/test/test_event_eth_rx_adapter.c | 52 +++++++++++++++++-----------
 1 file changed, 32 insertions(+), 20 deletions(-)
app/test/test_event_eth_rx_adapter.c +24 -15
index ae428b3333..7b38935bec 100644
@@ -60,6 +60,7 @@ port_init_common(uint16_t port, const struct
 rte_eth_conf *port_conf,
 {
      const uint16_t rx_ring_size = 512, tx_ring_size = 512;
      int retval;
+     bool started = false;
      uint16_t q;
      struct rte_eth_dev_info dev_info;
@@ -76,32 +77,43 @@ port_init_common(uint16_t port, const struct
 rte_eth_conf *port_conf,
                                      MAX_NUM_RX_QUEUE);
      default_params.tx_rings = 1;
 
-     /* Configure the Ethernet device. */
-     retval = rte_eth_dev_configure(port, default_params.rx_rings,
+     while (!started) {
+             /* Configure the Ethernet device. */
+             retval = rte_eth_dev_configure(port, default_params.rx_rings,
                              default_params.tx_rings, port_conf);
-     if (retval != 0)
-             return retval;
-
-     for (q = 0; q < default_params.rx_rings; q++) {
-             retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
-                             rte_eth_dev_socket_id(port), NULL, mp);
-             if (retval < 0)
+             if (retval != 0)
                      return retval;
-     }
 
-     /* Allocate and set up 1 TX queue per Ethernet port. */
-     for (q = 0; q < default_params.tx_rings; q++) {
-             retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
-                             rte_eth_dev_socket_id(port), NULL);
-             if (retval < 0)
+             for (q = 0; q < default_params.rx_rings; q++) {
+                     retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
+                                     rte_eth_dev_socket_id(port), NULL,
 mp);
+                     if (retval < 0)
+                             return retval;
+             }
+
+             /* Allocate and set up 1 TX queue per Ethernet port. */
+             for (q = 0; q < default_params.tx_rings; q++) {
+                     retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
+                                     rte_eth_dev_socket_id(port), NULL);
+                     if (retval < 0)
+                             return retval;
+             }
+
+             /* Start the Ethernet port. */
+             retval = rte_eth_dev_start(port);
+             if (retval < 0) {
+                     /* Some NICs may not support interrupts on all

reported queues.
+ * Therefore try to reconfigure and start with fewer
queues

app/test/test_event_eth_rx_adapter.c +7 -6
+                      */
+                     if (default_params.rx_rings > 2) {
+                             default_params.rx_rings /= 2;
+                             continue;
+                     }
                      return retval;
+             }
+             started = true;
      }
 
-     /* Start the Ethernet port. */
-     retval = rte_eth_dev_start(port);
-     if (retval < 0)
-             return retval;
-
      /* Display the port MAC address. */
      struct rte_ether_addr addr;
      retval = rte_eth_macaddr_get(port, &addr);
--

2.51.0