From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id BE3F53237 for ; Mon, 11 Apr 2016 10:24:18 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 11 Apr 2016 01:24:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="scan'208";a="929776499" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 11 Apr 2016 01:24:17 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u3B8OFg4005589; Mon, 11 Apr 2016 16:24:15 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u3B8OBnu027999; Mon, 11 Apr 2016 16:24:13 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u3B8OBga027995; Mon, 11 Apr 2016 16:24:11 +0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Mon, 11 Apr 2016 16:24:09 +0800 Message-Id: <1460363050-27962-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2016 08:24:19 -0000 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 --- 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