From patchwork Tue Jan 27 12:16:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Qiu X-Patchwork-Id: 2600 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D8A2E5F81; Tue, 27 Jan 2015 13:16:32 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 7EC275F80 for ; Tue, 27 Jan 2015 13:16:30 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 27 Jan 2015 04:10:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,474,1418112000"; d="scan'208";a="518287383" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 27 Jan 2015 04:09:22 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t0RCGPO5020932; Tue, 27 Jan 2015 20:16:25 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t0RCGNWU016988; Tue, 27 Jan 2015 20:16:25 +0800 Received: (from dayuqiu@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t0RCGJeG016984; Tue, 27 Jan 2015 20:16:19 +0800 From: Michael Qiu To: dev@dpdk.org Date: Tue, 27 Jan 2015 20:16:18 +0800 Message-Id: <1422360978-16954-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1421333111-22136-1-git-send-email-michael.qiu@intel.com> References: <1421333111-22136-1-git-send-email-michael.qiu@intel.com> Subject: [dpdk-dev] [PATCH v2] librte_pmd_ixgbe: Add queue start failure check 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For ixgbe, when queue start failure, for example, mbuf allocate failure, the device will still start success, which could be an issue. Add return status check of queue start to avoid this issue. Signed-off-by: Michael Qiu Acked-by: Thomas Monjalon --- v2 --> v1 . remove duplicated error message in ixgbe_dev_rxtx_start() . remove '\n' in PMD_INIT_LOG() lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 6 +++++- lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 2 +- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 20 +++++++++++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index b58ec45..ede8706 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -1495,7 +1495,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev) goto error; } - ixgbe_dev_rxtx_start(dev); + err = ixgbe_dev_rxtx_start(dev); + if (err < 0) { + PMD_INIT_LOG(ERR, "Unable to start rxtx queues"); + goto error; + } if (ixgbe_is_sfp(hw) && hw->phy.multispeed_fiber) { err = hw->mac.ops.setup_sfp(hw); diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h index 677c257..1383194 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h @@ -265,7 +265,7 @@ int ixgbe_dev_rx_init(struct rte_eth_dev *dev); void ixgbe_dev_tx_init(struct rte_eth_dev *dev); -void ixgbe_dev_rxtx_start(struct rte_eth_dev *dev); +int ixgbe_dev_rxtx_start(struct rte_eth_dev *dev); int ixgbe_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c index 840bc07..0224ed0 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -3806,7 +3806,7 @@ ixgbe_setup_loopback_link_82599(struct ixgbe_hw *hw) /* * Start Transmit and Receive Units. */ -void +int ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) { struct ixgbe_hw *hw; @@ -3816,6 +3816,7 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) uint32_t dmatxctl; uint32_t rxctrl; uint16_t i; + int ret = 0; PMD_INIT_FUNC_TRACE(); hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3838,14 +3839,22 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) { txq = dev->data->tx_queues[i]; - if (!txq->tx_deferred_start) - ixgbe_dev_tx_queue_start(dev, i); + if (!txq->tx_deferred_start) { + ret = ixgbe_dev_tx_queue_start(dev, i); + if (ret < 0) { + return ret; + } + } } for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; - if (!rxq->rx_deferred_start) - ixgbe_dev_rx_queue_start(dev, i); + if (!rxq->rx_deferred_start) { + ret = ixgbe_dev_rx_queue_start(dev, i); + if (ret < 0) { + return ret; + } + } } /* Enable Receive engine */ @@ -3860,6 +3869,7 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX) ixgbe_setup_loopback_link_82599(hw); + return 0; } /*