DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe
@ 2016-04-11  8:24 Wenzhuo Lu
  2016-04-11  9:52 ` Thomas Monjalon
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Wenzhuo Lu @ 2016-04-11  8:24 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu

An issue is found that DCB cannot be configged on ixgbe
NICs. It's said the TX queue number is not right.
On ixgbe the max TX queue number is not fixed, it depends
on the multi-queue mode. The API rte_eth_dev_configure
should be used to config this mode. But the input of this
API includes TX queue number. The problem is before the
mode is configged, we cannot decide the TX queue number.

This patch adds an API to config RX & TX multi-queue mode
separately. After the mode is configged, the max RX & TX
queue number is decided. Then we can set the appropriate
RX & TX queue number.

Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported Tx queues)
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/testpmd.c                 | 40 +++++++++++++++++++---------------
 lib/librte_ether/rte_ethdev.c          | 17 +++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 19 ++++++++++++++++
 lib/librte_ether/rte_ether_version.map |  1 +
 4 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1398c6c..c726e1c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1925,17 +1925,31 @@ init_port_dcb_config(portid_t pid,
 		     uint8_t pfc_en)
 {
 	struct rte_eth_conf port_conf;
-	struct rte_eth_dev_info dev_info;
 	struct rte_port *rte_port;
 	int retval;
 	uint16_t i;
 
-	rte_eth_dev_info_get(pid, &dev_info);
+	rte_port = &ports[pid];
+
+	memset(&port_conf, 0, sizeof(struct rte_eth_conf));
+	/* Enter DCB configuration status */
+	dcb_config = 1;
+
+	/*set configuration of DCB in vt mode and DCB in non-vt mode*/
+	retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
+	if (retval < 0)
+		return retval;
+
+	rte_eth_dev_mq_mode_set(pid,
+				port_conf.rxmode.mq_mode,
+				port_conf.txmode.mq_mode);
+	rte_eth_dev_info_get(pid, &rte_port->dev_info);
 
 	/* If dev_info.vmdq_pool_base is greater than 0,
 	 * the queue id of vmdq pools is started after pf queues.
 	 */
-	if (dcb_mode == DCB_VT_ENABLED && dev_info.vmdq_pool_base > 0) {
+	if (dcb_mode == DCB_VT_ENABLED &&
+	    rte_port->dev_info.vmdq_pool_base > 0) {
 		printf("VMDQ_DCB multi-queue mode is nonsensical"
 			" for port %d.", pid);
 		return -1;
@@ -1945,13 +1959,13 @@ init_port_dcb_config(portid_t pid,
 	 * and has the same number of rxq and txq in dcb mode
 	 */
 	if (dcb_mode == DCB_VT_ENABLED) {
-		nb_rxq = dev_info.max_rx_queues;
-		nb_txq = dev_info.max_tx_queues;
+		nb_rxq = rte_port->dev_info.max_rx_queues;
+		nb_txq = rte_port->dev_info.max_tx_queues;
 	} else {
 		/*if vt is disabled, use all pf queues */
-		if (dev_info.vmdq_pool_base == 0) {
-			nb_rxq = dev_info.max_rx_queues;
-			nb_txq = dev_info.max_tx_queues;
+		if (rte_port->dev_info.vmdq_pool_base == 0) {
+			nb_rxq = rte_port->dev_info.max_rx_queues;
+			nb_txq = rte_port->dev_info.max_tx_queues;
 		} else {
 			nb_rxq = (queueid_t)num_tcs;
 			nb_txq = (queueid_t)num_tcs;
@@ -1960,16 +1974,6 @@ init_port_dcb_config(portid_t pid,
 	}
 	rx_free_thresh = 64;
 
-	memset(&port_conf, 0, sizeof(struct rte_eth_conf));
-	/* Enter DCB configuration status */
-	dcb_config = 1;
-
-	/*set configuration of DCB in vt mode and DCB in non-vt mode*/
-	retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
-	if (retval < 0)
-		return retval;
-
-	rte_port = &ports[pid];
 	memcpy(&rte_port->dev_conf, &port_conf, sizeof(struct rte_eth_conf));
 
 	rxtx_port_config(rte_port);
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a31018e..b4eaa29 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3369,3 +3369,20 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
 				-ENOTSUP);
 	return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
 }
+
+int
+rte_eth_dev_mq_mode_set(uint8_t port_id,
+			enum rte_eth_rx_mq_mode rx_mq_mode,
+			enum rte_eth_tx_mq_mode tx_mq_mode)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	dev = &rte_eth_devices[port_id];
+
+	dev->data->dev_conf.rxmode.mq_mode = rx_mq_mode;
+	dev->data->dev_conf.txmode.mq_mode = tx_mq_mode;
+
+	return 0;
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 022733e..852acca 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4279,6 +4279,25 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
 				  uint32_t mask,
 				  uint8_t en);
 
+/**
+ * Set RX & TX multi_queue mode.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param rx_mq_mode
+ *   RX multi_queue mode.
+ * @param tx_mq_mode
+ *   TX multi_queue mode.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if port identifier is invalid.
+ */
+int
+rte_eth_dev_mq_mode_set(uint8_t port_id,
+			enum rte_eth_rx_mq_mode rx_mq_mode,
+			enum rte_eth_tx_mq_mode tx_mq_mode);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 214ecc7..8adea31 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -130,5 +130,6 @@ DPDK_16.04 {
 	rte_eth_tx_buffer_drop_callback;
 	rte_eth_tx_buffer_init;
 	rte_eth_tx_buffer_set_err_callback;
+	rte_eth_dev_mq_mode_set;
 
 } DPDK_2.2;
-- 
1.9.3

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

end of thread, other threads:[~2016-06-30  8:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-11  8:24 [dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe Wenzhuo Lu
2016-04-11  9:52 ` Thomas Monjalon
2016-04-12  0:39   ` Lu, Wenzhuo
2016-05-04 21:47 ` [dpdk-dev] [PATCH v2] " Wenzhuo Lu
2016-05-05 21:33 ` [dpdk-dev] [PATCH v3] ethdev: " Wenzhuo Lu
2016-06-17 11:21   ` De Lara Guarch, Pablo
2016-06-22 17:01   ` Thomas Monjalon
2016-06-23  1:04     ` Lu, Wenzhuo
2016-06-23 12:21       ` Thomas Monjalon
2016-06-24  0:45         ` Lu, Wenzhuo
2016-06-30  1:40           ` Lu, Wenzhuo
2016-06-30  7:41             ` Thomas Monjalon
2016-06-30  8:23               ` Lu, Wenzhuo
2016-06-30  8:47               ` Lu, Wenzhuo

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