From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 7B9EAB364 for ; Thu, 14 Aug 2014 09:32:14 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 Aug 2014 00:35:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,861,1400050800"; d="scan'208";a="584703910" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 14 Aug 2014 00:35:15 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id s7E7ZDVi028902; Thu, 14 Aug 2014 15:35:13 +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 s7E7ZA4P031044; Thu, 14 Aug 2014 15:35:13 +0800 Received: (from jingche2@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id s7E7ZAV0031040; Thu, 14 Aug 2014 15:35:10 +0800 From: "Chen Jing D(Mark)" To: dev@dpdk.org Date: Thu, 14 Aug 2014 15:35:01 +0800 Message-Id: <1408001703-30919-3-git-send-email-jing.d.chen@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1408001703-30919-1-git-send-email-jing.d.chen@intel.com> References: <1408001703-30919-1-git-send-email-jing.d.chen@intel.com> Subject: [dpdk-dev] [PATCH 2/4] i40e: PF Add support for per-queue start/stop 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: Thu, 14 Aug 2014 07:32:15 -0000 From: "Chen Jing D(Mark)" I40E driver add function pointer to start/stop specific RX/TX queue. Signed-off-by: Chen Jing D(Mark) Reviewed-by: Konstantin Ananyev Reviewed-by: Changchun Ouyang Reviewed-by: Huawei Xie --- lib/librte_pmd_i40e/i40e_ethdev.c | 4 + lib/librte_pmd_i40e/i40e_rxtx.c | 112 +++++++++++++++++++++++++++++++++++++ lib/librte_pmd_i40e/i40e_rxtx.h | 4 + 3 files changed, 120 insertions(+), 0 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 9ed31b5..81a1deb 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -232,6 +232,10 @@ static struct eth_dev_ops i40e_eth_dev_ops = { .vlan_offload_set = i40e_vlan_offload_set, .vlan_strip_queue_set = i40e_vlan_strip_queue_set, .vlan_pvid_set = i40e_vlan_pvid_set, + .rx_queue_start = i40e_dev_rx_queue_start, + .rx_queue_stop = i40e_dev_rx_queue_stop, + .tx_queue_start = i40e_dev_tx_queue_start, + .tx_queue_stop = i40e_dev_tx_queue_stop, .rx_queue_setup = i40e_dev_rx_queue_setup, .rx_queue_release = i40e_dev_rx_queue_release, .rx_queue_count = i40e_dev_rx_queue_count, diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index 83b9462..323c004 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -1429,6 +1429,118 @@ i40e_xmit_pkts_simple(void *tx_queue, } int +i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct i40e_vsi *vsi = I40E_DEV_PRIVATE_TO_VSI(dev->data->dev_private); + struct i40e_rx_queue *rxq; + int err = -1; + struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); + uint16_t q_base = vsi->base_queue; + + PMD_INIT_FUNC_TRACE(); + + if (rx_queue_id < dev->data->nb_rx_queues) { + rxq = dev->data->rx_queues[rx_queue_id]; + + err = i40e_alloc_rx_queue_mbufs(rxq); + if (err) { + PMD_DRV_LOG(ERR, "Failed to allocate RX queue mbuf\n"); + return err; + } + + rte_wmb(); + + /* Init the RX tail regieter. */ + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); + + err = i40e_switch_rx_queue(hw, rx_queue_id + q_base, TRUE); + + if (err) { + PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on\n", + rx_queue_id); + + i40e_rx_queue_release_mbufs(rxq); + i40e_reset_rx_queue(rxq); + } + } + + return err; +} + +int +i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) +{ + struct i40e_vsi *vsi = I40E_DEV_PRIVATE_TO_VSI(dev->data->dev_private); + struct i40e_rx_queue *rxq; + int err; + struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); + uint16_t q_base = vsi->base_queue; + + if (rx_queue_id < dev->data->nb_rx_queues) { + rxq = dev->data->rx_queues[rx_queue_id]; + + err = i40e_switch_rx_queue(hw, rx_queue_id + q_base, FALSE); + + if (err) { + PMD_DRV_LOG(ERR, "Failed to switch RX queue %u off\n", + rx_queue_id); + return err; + } + i40e_rx_queue_release_mbufs(rxq); + i40e_reset_rx_queue(rxq); + } + + return 0; +} + +int +i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) +{ + struct i40e_vsi *vsi = I40E_DEV_PRIVATE_TO_VSI(dev->data->dev_private); + int err = -1; + struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); + uint16_t q_base = vsi->base_queue; + + PMD_INIT_FUNC_TRACE(); + + if (tx_queue_id < dev->data->nb_tx_queues) { + err = i40e_switch_tx_queue(hw, tx_queue_id + q_base, TRUE); + if (err) + PMD_DRV_LOG(ERR, "Failed to switch TX queue %u on\n", + tx_queue_id); + } + + return err; +} + +int +i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) +{ + struct i40e_vsi *vsi = I40E_DEV_PRIVATE_TO_VSI(dev->data->dev_private); + struct i40e_tx_queue *txq; + int err; + struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); + uint16_t q_base = vsi->base_queue; + + if (tx_queue_id < dev->data->nb_tx_queues) { + txq = dev->data->tx_queues[tx_queue_id]; + + err = i40e_switch_tx_queue(hw, tx_queue_id + q_base, FALSE); + + if (err) { + PMD_DRV_LOG(ERR, "Failed to switch TX queue %u of\n", + tx_queue_id); + return err; + } + + i40e_tx_queue_release_mbufs(txq); + i40e_reset_tx_queue(txq); + } + + return 0; +} + +int i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, diff --git a/lib/librte_pmd_i40e/i40e_rxtx.h b/lib/librte_pmd_i40e/i40e_rxtx.h index 6db2faf..b67b4b3 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.h +++ b/lib/librte_pmd_i40e/i40e_rxtx.h @@ -152,6 +152,10 @@ struct i40e_tx_queue { bool q_set; /**< indicate if tx queue has been configured */ }; +int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); +int i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); +int i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); +int i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); int i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, -- 1.7.7.6