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 B01F17DFB for ; Fri, 26 Sep 2014 06:54:41 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Sep 2014 22:01:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,603,1406617200"; d="scan'208";a="579287673" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2014 22:00:59 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s8Q50wCH000909; Fri, 26 Sep 2014 13:00:58 +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 s8Q50u09010694; Fri, 26 Sep 2014 13:00:58 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8Q50uwJ010690; Fri, 26 Sep 2014 13:00:56 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Fri, 26 Sep 2014 13:00:53 +0800 Message-Id: <1411707653-10661-1-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH v3] ethdev: Rename RX/TX enable queue field for queue start and 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: Fri, 26 Sep 2014 04:54:42 -0000 V3 change: - Rename field name to rx_deferred_start/tx_deferred_start in both ixgbe and i40e PMD. - Move the doxygen comments for rx_deferred_start after it is declared. - Simplify/split the long description and move some to doxygen comments of rte_eth_dev_rx_queue_start and rte_eth_dev_tx_queue_start. V2 and V1 change: - Update comments for the field start_rx_per_q for better readability. - Rename the field name to rx_enable_queue for better readability too. - Accordingly Update its reference in sample vhost. Signed-off-by: Changchun Ouyang --- examples/vhost/main.c | 9 +++++++-- lib/librte_ether/rte_ethdev.h | 11 +++++++---- lib/librte_pmd_i40e/i40e_ethdev.c | 4 ++-- lib/librte_pmd_i40e/i40e_ethdev_vf.c | 4 ++-- lib/librte_pmd_i40e/i40e_rxtx.c | 4 ++-- lib/librte_pmd_i40e/i40e_rxtx.h | 4 ++-- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 8 ++++---- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 6 ++++-- 8 files changed, 30 insertions(+), 20 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 85ee8b8..4fd164d 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -3607,9 +3607,14 @@ MAIN(int argc, char *argv[]) char pool_name[RTE_MEMPOOL_NAMESIZE]; char ring_name[RTE_MEMPOOL_NAMESIZE]; - rx_conf_default.start_rx_per_q = (uint8_t)zero_copy; + /* + * Zero copy defers queue RX/TX start to the time when guest + * finishes its startup and packet buffers from that guest are + * available. + */ + rx_conf_default.rx_deferred_start = (uint8_t)zero_copy; rx_conf_default.rx_drop_en = 0; - tx_conf_default.start_tx_per_q = (uint8_t)zero_copy; + tx_conf_default.tx_deferred_start = (uint8_t)zero_copy; nb_mbuf = num_rx_descriptor + num_switching_cores * MBUF_CACHE_SIZE_ZCP + num_switching_cores * MAX_PKT_BURST; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 60b24c5..bef8962 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -604,7 +604,7 @@ struct rte_eth_rxconf { struct rte_eth_thresh rx_thresh; /**< RX ring threshold registers. */ uint16_t rx_free_thresh; /**< Drives the freeing of RX descriptors. */ uint8_t rx_drop_en; /**< Drop packets if no descriptors are available. */ - uint8_t start_rx_per_q; /**< start rx per queue. */ + uint8_t rx_deferred_start; /**< RX not start in rte_eth_dev_start(). */ }; #define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001 /**< nb_segs=1 for all mbufs */ @@ -625,7 +625,7 @@ struct rte_eth_txconf { uint16_t tx_rs_thresh; /**< Drives the setting of RS bit on TXDs. */ uint16_t tx_free_thresh; /**< Drives the freeing of TX buffers. */ uint32_t txq_flags; /**< Set flags for the Tx queue */ - uint8_t start_tx_per_q; /**< start tx per queue. */ + uint8_t tx_deferred_start; /**< TX not start in rte_eth_dev_start(). */ }; /** @@ -1795,7 +1795,9 @@ extern int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, extern int rte_eth_dev_socket_id(uint8_t port_id); /* - * Start specified RX queue of a port + * Allocate mbuf from mempool, setup the DMA physical address + * and then start RX for specified queue of a port. It is used + * when rx_deferred_start flag of the specified queue is true. * * @param port_id * The port identifier of the Ethernet device @@ -1827,7 +1829,8 @@ extern int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id); extern int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id); /* - * Start specified TX queue of a port + * Start TX for specified queue of a port. It is used when tx_deferred_start + * flag of the specified queue is true. * * @param port_id * The port identifier of the Ethernet device diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index a00d6ca..26f1799 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -3017,7 +3017,7 @@ i40e_vsi_switch_tx_queues(struct i40e_vsi *vsi, bool on) txq = dev_data->tx_queues[i]; /* Don't operate the queue if not configured or * if starting only per queue */ - if (!txq->q_set || (on && txq->start_tx_per_q)) + if (!txq->q_set || (on && txq->tx_deferred_start)) continue; if (on) ret = i40e_dev_tx_queue_start(dev, i); @@ -3095,7 +3095,7 @@ i40e_vsi_switch_rx_queues(struct i40e_vsi *vsi, bool on) rxq = dev_data->rx_queues[i]; /* Don't operate the queue if not configured or * if starting only per queue */ - if (!rxq->q_set || (on && rxq->start_rx_per_q)) + if (!rxq->q_set || (on && rxq->rx_deferred_start)) continue; if (on) ret = i40e_dev_rx_queue_start(dev, i); diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c index f6c4873..809c1f0 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c +++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c @@ -675,7 +675,7 @@ i40evf_start_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev_data->rx_queues[i]; - if (rxq->start_rx_per_q) + if (rxq->rx_deferred_start) continue; if (i40evf_dev_rx_queue_start(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to start queue %u", i); @@ -685,7 +685,7 @@ i40evf_start_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) { txq = dev_data->tx_queues[i]; - if (txq->start_tx_per_q) + if (txq->tx_deferred_start) continue; if (i40evf_dev_tx_queue_start(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to start queue %u", i); diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index 099699c..7c5b6a8 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -1609,7 +1609,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; + rxq->rx_deferred_start = rx_conf->rx_deferred_start; /* Allocate the maximun number of RX ring hardware descriptor. */ ring_size = sizeof(union i40e_rx_desc) * I40E_MAX_RING_DESC; @@ -1895,7 +1895,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; + txq->tx_deferred_start = tx_conf->tx_deferred_start; #ifdef RTE_LIBRTE_XEN_DOM0 txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz->phys_addr); diff --git a/lib/librte_pmd_i40e/i40e_rxtx.h b/lib/librte_pmd_i40e/i40e_rxtx.h index 4478592..af932e3 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.h +++ b/lib/librte_pmd_i40e/i40e_rxtx.h @@ -112,7 +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 */ + bool rx_deferred_start; /**< don't start this queue in dev start */ }; struct i40e_tx_entry { @@ -151,7 +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 */ + bool tx_deferred_start; /**< don't start this queue in dev start */ }; int i40e_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 52ec99e..d436151 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -1851,7 +1851,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->txq_flags = tx_conf->txq_flags; txq->ops = &def_txq_ops; - txq->start_tx_per_q = tx_conf->start_tx_per_q; + txq->tx_deferred_start = tx_conf->tx_deferred_start; /* * Modification to set VFTDT for virtual function if vf is detected @@ -2121,7 +2121,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ? 0 : ETHER_CRC_LEN); rxq->drop_en = rx_conf->rx_drop_en; - rxq->start_rx_per_q = rx_conf->start_rx_per_q; + rxq->rx_deferred_start = rx_conf->rx_deferred_start; /* * Allocate RX ring hardware descriptors. A memzone large enough to @@ -3693,13 +3693,13 @@ 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->start_tx_per_q) + if (!txq->tx_deferred_start) ixgbe_dev_tx_queue_start(dev, i); } for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; - if (!rxq->start_rx_per_q) + if (!rxq->rx_deferred_start) ixgbe_dev_rx_queue_start(dev, i); } diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h index 7b5ac0e..228ee02 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h @@ -126,7 +126,8 @@ struct igb_rx_queue { uint8_t port_id; /**< Device port identifier. */ uint8_t crc_len; /**< 0 if CRC stripped, 4 otherwise. */ uint8_t drop_en; /**< If not 0, set SRRCTL.Drop_En. */ - uint8_t start_rx_per_q; + uint8_t rx_deferred_start; + /**< don't start this queue in dev start. */ #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC /** need to alloc dummy mbuf, for wraparound when scanning hw ring */ struct rte_mbuf fake_mbuf; @@ -207,7 +208,8 @@ struct igb_tx_queue { /** Hardware context0 history. */ struct ixgbe_advctx_info ctx_cache[IXGBE_CTX_NUM]; struct ixgbe_txq_ops *ops; /**< txq ops */ - uint8_t start_tx_per_q; + uint8_t tx_deferred_start; + /**< don't start this queue in dev start. */ }; struct ixgbe_txq_ops { -- 1.8.4.2