From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D96BD678D for ; Thu, 14 Aug 2014 09:32:15 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 14 Aug 2014 00:27:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="372241789" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 14 Aug 2014 00:31:54 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id s7E7ZF9C029830; Thu, 14 Aug 2014 15:35:15 +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 s7E7ZDJR031052; Thu, 14 Aug 2014 15:35:15 +0800 Received: (from jingche2@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id s7E7ZDcE031048; Thu, 14 Aug 2014 15:35:13 +0800 From: "Chen Jing D(Mark)" To: dev@dpdk.org Date: Thu, 14 Aug 2014 15:35:02 +0800 Message-Id: <1408001703-30919-4-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 3/4] i40e: PF driver to support RX/TX config paramter 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:16 -0000 From: "Chen Jing D(Mark)" PF driver to support field start_rx_per_q in i40e_dev_rx_queue_setup and start_tx_per_q in i40e_dev_tx_queue_setup. In the meanwhile, Change dev_start/stop function to call per-queue RX/TX function. 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 | 46 +++++++++++++++++++++--------------- lib/librte_pmd_i40e/i40e_rxtx.c | 21 +++++----------- lib/librte_pmd_i40e/i40e_rxtx.h | 5 ++++ 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 81a1deb..d5dd6e3 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -690,7 +690,6 @@ i40e_dev_start(struct rte_eth_dev *dev) err_up: i40e_vsi_switch_queues(vsi, FALSE); - i40e_dev_clear_queues(dev); return ret; } @@ -704,9 +703,6 @@ i40e_dev_stop(struct rte_eth_dev *dev) /* Disable all queues */ i40e_vsi_switch_queues(vsi, FALSE); - /* Clear all queues and release memory */ - i40e_dev_clear_queues(dev); - /* un-map queues with interrupt registers */ i40e_vsi_disable_queues_intr(vsi); i40e_vsi_queues_unbind_intr(vsi); @@ -2845,17 +2841,23 @@ static int i40e_vsi_switch_tx_queues(struct i40e_vsi *vsi, bool on) { struct rte_eth_dev_data *dev_data = I40E_VSI_TO_DEV_DATA(vsi); - struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); struct i40e_tx_queue *txq; - uint16_t i, pf_q; + struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); + uint16_t i; int ret; - pf_q = vsi->base_queue; - for (i = 0; i < dev_data->nb_tx_queues; i++, pf_q++) { + for (i = 0; i < dev_data->nb_tx_queues; i++) { txq = dev_data->tx_queues[i]; - if (!txq->q_set) - continue; /* Queue not configured */ - ret = i40e_switch_tx_queue(hw, pf_q, on); + /** + * Don't operate the queue in 2 cases. One is queue is never configured, + * another is it's start operation and start_tx_per_q is set. + **/ + if (!txq->q_set || (on && txq->start_tx_per_q)) + continue; + if (on) + ret = i40e_dev_tx_queue_start(dev, i); + else + ret = i40e_dev_tx_queue_stop(dev, i); if ( ret != I40E_SUCCESS) return ret; } @@ -2919,18 +2921,24 @@ static int i40e_vsi_switch_rx_queues(struct i40e_vsi *vsi, bool on) { struct rte_eth_dev_data *dev_data = I40E_VSI_TO_DEV_DATA(vsi); - struct i40e_hw *hw = I40E_VSI_TO_HW(vsi); struct i40e_rx_queue *rxq; - uint16_t i, pf_q; + struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(vsi); + uint16_t i; int ret; - pf_q = vsi->base_queue; - for (i = 0; i < dev_data->nb_rx_queues; i++, pf_q++) { + for (i = 0; i < dev_data->nb_rx_queues; i++) { rxq = dev_data->rx_queues[i]; - if (!rxq->q_set) - continue; /* Queue not configured */ - ret = i40e_switch_rx_queue(hw, pf_q, on); - if ( ret != I40E_SUCCESS) + /** + * Don't operate the queue in 2 cases. One is queue is never configured, + * another is it's start operation and start_rx_per_q is set. + **/ + if (!rxq->q_set || (on && rxq->start_rx_per_q)) + continue; + if (on) + ret = i40e_dev_rx_queue_start(dev, i); + else + ret = i40e_dev_rx_queue_stop(dev, i); + if (ret != I40E_SUCCESS) return ret; } diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index 323c004..f153844 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -88,9 +88,6 @@ i40e_ring_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_id, uint32_t ring_size, int socket_id); -static void i40e_reset_rx_queue(struct i40e_rx_queue *rxq); -static void i40e_reset_tx_queue(struct i40e_tx_queue *txq); -static void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq); static uint16_t i40e_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); @@ -1594,6 +1591,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, 0 : ETHER_CRC_LEN); rxq->drop_en = rx_conf->rx_drop_en; rxq->vsi = vsi; + rxq->start_rx_per_q = rx_conf->start_rx_per_q; /* Allocate the maximun number of RX ring hardware descriptor. */ ring_size = sizeof(union i40e_rx_desc) * I40E_MAX_RING_DESC; @@ -1879,6 +1877,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->txq_flags = tx_conf->txq_flags; txq->vsi = vsi; + txq->start_tx_per_q = tx_conf->start_tx_per_q; #ifdef RTE_LIBRTE_XEN_DOM0 txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz->phys_addr); @@ -1986,7 +1985,7 @@ i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq) #endif /* RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC */ } -static void +void i40e_reset_rx_queue(struct i40e_rx_queue *rxq) { unsigned i; @@ -2017,7 +2016,7 @@ i40e_reset_rx_queue(struct i40e_rx_queue *rxq) rxq->pkt_last_seg = NULL; } -static void +void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) { uint16_t i; @@ -2035,7 +2034,7 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq) } } -static void +void i40e_reset_tx_queue(struct i40e_tx_queue *txq) { struct i40e_tx_entry *txe; @@ -2273,7 +2272,7 @@ i40e_rx_queue_init(struct i40e_rx_queue *rxq) } rxq->qrx_tail = hw->hw_addr + I40E_QRX_TAIL(pf_q); - err = i40e_alloc_rx_queue_mbufs(rxq); + mbp_priv = rte_mempool_get_priv(rxq->mp); buf_size = (uint16_t)(mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); @@ -2284,16 +2283,10 @@ i40e_rx_queue_init(struct i40e_rx_queue *rxq) dev->rx_pkt_burst = i40e_recv_scattered_pkts; } - rte_wmb(); - /* Init the RX tail regieter. */ - I40E_PCI_REG_WRITE(rxq->qrx_tail, 0); I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); - if (err) - PMD_DRV_LOG(ERR, "Failed to allocate RX queue mbuf\n"); - - return err; + return 0; } void diff --git a/lib/librte_pmd_i40e/i40e_rxtx.h b/lib/librte_pmd_i40e/i40e_rxtx.h index b67b4b3..687e23c 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.h +++ b/lib/librte_pmd_i40e/i40e_rxtx.h @@ -112,6 +112,7 @@ struct i40e_rx_queue { uint16_t max_pkt_len; /* Maximum packet length */ uint8_t hs_mode; /* Header Split mode */ bool q_set; /**< indicate if rx queue has been configured */ + bool start_rx_per_q; /**< don't start this queue in dev start */ }; struct i40e_tx_entry { @@ -150,6 +151,7 @@ struct i40e_tx_queue { uint16_t tx_next_dd; uint16_t tx_next_rs; bool q_set; /**< indicate if tx queue has been configured */ + bool start_tx_per_q; /**< don't Start this queue in dev start */ }; int i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); @@ -183,6 +185,9 @@ int i40e_rx_queue_init(struct i40e_rx_queue *rxq); void i40e_free_tx_resources(struct i40e_tx_queue *txq); void i40e_free_rx_resources(struct i40e_rx_queue *rxq); void i40e_dev_clear_queues(struct rte_eth_dev *dev); +void i40e_reset_rx_queue(struct i40e_rx_queue *rxq); +void i40e_reset_tx_queue(struct i40e_tx_queue *txq); +void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq); int i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq); void i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq); -- 1.7.7.6