All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenzhuo Lu <wenzhuo.lu@intel.com>
To: dev@dpdk.org
Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>
Subject: [PATCH v3] ethdev: fix DCB config issue on ixgbe
Date: Fri,  6 May 2016 05:33:59 +0800	[thread overview]
Message-ID: <1462484040-1702-1-git-send-email-wenzhuo.lu@intel.com> (raw)
In-Reply-To: <1460363050-27962-1-git-send-email-wenzhuo.lu@intel.com>

An issue is found that DCB cannot be configured 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 configure this mode. But the input of
this API includes TX queue number. The problem is before
the mode is configured, we cannot decide the TX queue
number.

This patch adds an API to configure RX & TX multi-queue mode
separately. After the mode is configured, 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>
---
v2:
- Changed the release to 16.07.

v3:
- Changed the title prefix to ethdev.
- Reworded the commit log.

 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 |  7 ++++++
 4 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 26a174c..733f760 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1924,17 +1924,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;
@@ -1944,13 +1958,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;
@@ -1959,16 +1973,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 2757510..3015cec 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4253,6 +4253,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..c53ce80 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -132,3 +132,10 @@ DPDK_16.04 {
 	rte_eth_tx_buffer_set_err_callback;
 
 } DPDK_2.2;
+
+DPDK_16.07 {
+	global:
+
+	rte_eth_dev_mq_mode_set;
+
+} DPDK_16.04;
-- 
1.9.3

  parent reply	other threads:[~2016-05-05 21:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11  8:24 [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 ` [PATCH v2] " Wenzhuo Lu
2016-05-05 21:33 ` Wenzhuo Lu [this message]
2016-06-17 11:21   ` [PATCH v3] ethdev: " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462484040-1702-1-git-send-email-wenzhuo.lu@intel.com \
    --to=wenzhuo.lu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.