DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information
@ 2015-07-20 12:19 Konstantin Ananyev
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
                   ` (4 more replies)
  0 siblings, 5 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-20 12:19 UTC (permalink / raw)
  To: dev

Add the ability for the upper layer to query RX/TX queue information.
Right now supported for:
ixgbe, i40e, e1000 PMDs.

Konstantin Ananyev (5):
  ethdev: add new API to retrieve RX/TX queue information
  i40e: add support for eth_(rxq|txq)_info_get
  ixgbe: add support for eth_(rxq|txq)_info_get
  e1000: add support for eth_(rxq|txq)_info_get
  testpmd: add new command to display RX/TX queue information

 app/test-pmd/cmdline.c                 | 48 +++++++++++++++++++
 app/test-pmd/config.c                  | 67 ++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                 |  2 +
 drivers/net/e1000/e1000_ethdev.h       | 12 +++++
 drivers/net/e1000/em_ethdev.c          |  2 +
 drivers/net/e1000/em_rxtx.c            | 38 +++++++++++++++
 drivers/net/e1000/igb_ethdev.c         |  4 ++
 drivers/net/e1000/igb_rxtx.c           | 36 ++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         |  2 +
 drivers/net/i40e/i40e_ethdev.h         |  5 ++
 drivers/net/i40e/i40e_rxtx.c           | 42 ++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++
 drivers/net/ixgbe/ixgbe_ethdev.h       |  6 +++
 drivers/net/ixgbe/ixgbe_rxtx.c         | 42 ++++++++++++++++
 lib/librte_ether/rte_ethdev.c          | 54 +++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 87 +++++++++++++++++++++++++++++++---
 lib/librte_ether/rte_ether_version.map |  2 +
 17 files changed, 447 insertions(+), 6 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-20 12:19 [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
@ 2015-07-20 12:19 ` Konstantin Ananyev
  2015-07-22 16:50   ` Zhang, Helin
                     ` (6 more replies)
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
                   ` (3 subsequent siblings)
  4 siblings, 7 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-20 12:19 UTC (permalink / raw)
  To: dev

Add the ability for the upper layer to query RX/TX queue information.

Add new structures:
struct rte_eth_rxq_info
struct rte_eth_txq_info

new functions:
rte_eth_rx_queue_info_get
rte_eth_tx_queue_info_get

into rte_etdev API.

Left extra free space in the queue info structures,
so extra fields could be added later without ABI breakage.

v2 changes:
- Add formal check for the qinfo input parameter.
- As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'

v3 changes:
- Updated rte_ether_version.map 
- Merged with latest changes

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ether/rte_ethdev.c          | 54 +++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 87 +++++++++++++++++++++++++++++++---
 lib/librte_ether/rte_ether_version.map |  2 +
 3 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 94104ce..a94c119 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
 }
 
 int
+rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct rte_eth_dev *dev;
+
+	if (qinfo == NULL)
+		return -EINVAL;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (queue_id >= dev->data->nb_rx_queues) {
+		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		return -EINVAL;
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+
+	memset(qinfo, 0, sizeof(*qinfo));
+	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
+	return 0;
+}
+
+int
+rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct rte_eth_dev *dev;
+
+	if (qinfo == NULL)
+		return -EINVAL;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (queue_id >= dev->data->nb_tx_queues) {
+		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		return -EINVAL;
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+
+	memset(qinfo, 0, sizeof(*qinfo));
+	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
+	return 0;
+}
+
+int
 rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 			     struct ether_addr *mc_addr_set,
 			     uint32_t nb_mc_addr)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index c901a2c..0c6705e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -960,6 +960,30 @@ struct rte_eth_xstats {
 	uint64_t value;
 };
 
+/**
+ * Ethernet device RX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_rxq_info {
+	struct rte_mempool *mp;     /**< mempool used by that queue. */
+	struct rte_eth_rxconf conf; /**< queue config parameters. */
+	uint8_t scattered_rx;       /**< scattered packets RX supported. */
+	uint16_t nb_desc;           /**< configured number of RXDs. */
+	uint16_t max_desc;          /**< max allowed number of RXDs. */
+	uint16_t min_desc;          /**< min allowed number of RXDs. */
+} __rte_cache_aligned;
+
+/**
+ * Ethernet device TX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_txq_info {
+	struct rte_eth_txconf conf; /**< queue config parameters. */
+	uint16_t nb_desc;           /**< configured number of TXDs. */
+	uint16_t max_desc;          /**< max allowed number of TXDs. */
+	uint16_t min_desc;          /**< min allowed number of TXDs. */
+} __rte_cache_aligned;
+
 struct rte_eth_dev;
 
 struct rte_eth_dev_callback;
@@ -1063,6 +1087,12 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
 /**< @internal Check DD bit of specific RX descriptor */
 
+typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
+	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
+
+typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
+	uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
+
 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
 /**< @internal Set MTU. */
 
@@ -1451,9 +1481,13 @@ struct eth_dev_ops {
 	rss_hash_update_t rss_hash_update;
 	/** Get current RSS hash configuration. */
 	rss_hash_conf_get_t rss_hash_conf_get;
-	eth_filter_ctrl_t              filter_ctrl;          /**< common filter control*/
+	eth_filter_ctrl_t              filter_ctrl;
+	/**< common filter control. */
 	eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs */
-
+	eth_rxq_info_get_t rxq_info_get;
+	/**< retrieve RX queue information. */
+	eth_txq_info_get_t txq_info_get;
+	/**< retrieve TX queue information. */
 	/** Turn IEEE1588/802.1AS timestamping on. */
 	eth_timesync_enable_t timesync_enable;
 	/** Turn IEEE1588/802.1AS timestamping off. */
@@ -3721,6 +3755,46 @@ int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
 		struct rte_eth_rxtx_callback *user_cb);
 
 /**
+ * Retrieve information about given port's RX queue.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param queue_id
+ *   The RX queue on the Ethernet device for which information
+ *   will be retrieved.
+ * @param qinfo
+ *   A pointer to a structure of type *rte_eth_rxq_info_info* to be filled with
+ *   the information of the Ethernet device.
+ *
+ * @return
+ *   - 0: Success
+ *   - -ENOTSUP: routine is not supported by the device PMD.
+ *   - -EINVAL:  The port_id or the queue_id is out of range.
+ */
+int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+/**
+ * Retrieve information about given port's TX queue.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param queue_id
+ *   The TX queue on the Ethernet device for which information
+ *   will be retrieved.
+ * @param qinfo
+ *   A pointer to a structure of type *rte_eth_txq_info_info* to be filled with
+ *   the information of the Ethernet device.
+ *
+ * @return
+ *   - 0: Success
+ *   - -ENOTSUP: routine is not supported by the device PMD.
+ *   - -EINVAL:  The port_id or the queue_id is out of range.
+ */
+int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
+/*
  * Retrieve number of available registers for access
  *
  * @param port_id
@@ -3793,10 +3867,6 @@ int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
  */
 int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
 
-#ifdef __cplusplus
-}
-#endif
-
 /**
  * Set the list of multicast addresses to filter on an Ethernet device.
  *
@@ -3882,4 +3952,9 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
  */
 extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
 					      struct timespec *timestamp);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_ETHDEV_H_ */
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 23cfee9..8de0928 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -92,6 +92,7 @@ DPDK_2.0 {
 	rte_eth_rx_burst;
 	rte_eth_rx_descriptor_done;
 	rte_eth_rx_queue_count;
+	rte_eth_rx_queue_info_get;
 	rte_eth_rx_queue_setup;
 	rte_eth_set_queue_rate_limit;
 	rte_eth_set_vf_rate_limit;
@@ -99,6 +100,7 @@ DPDK_2.0 {
 	rte_eth_stats_get;
 	rte_eth_stats_reset;
 	rte_eth_tx_burst;
+	rte_eth_tx_queue_info_get;
 	rte_eth_tx_queue_setup;
 	rte_eth_xstats_get;
 	rte_eth_xstats_reset;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
@ 2015-07-20 12:19 ` Konstantin Ananyev
  2015-07-22 17:02   ` Zhang, Helin
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 3/5] ixgbe: " Konstantin Ananyev
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-20 12:19 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c |  2 ++
 drivers/net/i40e/i40e_ethdev.h |  5 +++++
 drivers/net/i40e/i40e_rxtx.c   | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..6815b6c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -283,6 +283,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.udp_tunnel_add               = i40e_dev_udp_tunnel_add,
 	.udp_tunnel_del               = i40e_dev_udp_tunnel_del,
 	.filter_ctrl                  = i40e_dev_filter_ctrl,
+	.rxq_info_get                 = i40e_rxq_info_get,
+	.txq_info_get                 = i40e_txq_info_get,
 	.mirror_rule_set              = i40e_mirror_rule_set,
 	.mirror_rule_reset            = i40e_mirror_rule_reset,
 	.timesync_enable              = i40e_timesync_enable,
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 6185657..4748392 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -502,6 +502,11 @@ int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
 			  enum rte_filter_op filter_op,
 			  void *arg);
 
+void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+void i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
 	(&((struct i40e_adapter *)adapter)->pf)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 891a221..fadf3e8 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3352,3 +3352,45 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf)
 
 	return I40E_SUCCESS;
 }
+
+void
+i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct i40e_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mp;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = I40E_MAX_RING_DESC;
+	qinfo->min_desc = I40E_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct i40e_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = I40E_MAX_RING_DESC;
+	qinfo->min_desc = I40E_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+	qinfo->conf.txq_flags = txq->txq_flags;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv3 3/5] ixgbe: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
@ 2015-07-20 12:19 ` Konstantin Ananyev
  2015-07-22 17:03   ` Zhang, Helin
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 4/5] e1000: " Konstantin Ananyev
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
  4 siblings, 1 reply; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-20 12:19 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  4 ++++
 drivers/net/ixgbe/ixgbe_ethdev.h |  6 ++++++
 drivers/net/ixgbe/ixgbe_rxtx.c   | 42 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3a8cff0..053279e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -431,6 +431,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.rss_hash_conf_get    = ixgbe_dev_rss_hash_conf_get,
 	.filter_ctrl          = ixgbe_dev_filter_ctrl,
 	.set_mc_addr_list     = ixgbe_dev_set_mc_addr_list,
+	.rxq_info_get         = ixgbe_rxq_info_get,
+	.txq_info_get         = ixgbe_txq_info_get,
 	.timesync_enable      = ixgbe_timesync_enable,
 	.timesync_disable     = ixgbe_timesync_disable,
 	.timesync_read_rx_timestamp = ixgbe_timesync_read_rx_timestamp,
@@ -466,6 +468,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
 	.mac_addr_add         = ixgbevf_add_mac_addr,
 	.mac_addr_remove      = ixgbevf_remove_mac_addr,
 	.set_mc_addr_list     = ixgbe_dev_set_mc_addr_list,
+	.rxq_info_get         = ixgbe_rxq_info_get,
+	.txq_info_get         = ixgbe_txq_info_get,
 	.mac_addr_set         = ixgbevf_set_default_mac_addr,
 	.get_reg_length       = ixgbevf_get_reg_length,
 	.get_reg              = ixgbevf_get_regs,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c16c11d..190c34a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -347,6 +347,12 @@ int ixgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 int ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 int ixgbevf_dev_rx_init(struct rte_eth_dev *dev);
 
 void ixgbevf_dev_tx_init(struct rte_eth_dev *dev);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 9b2d637..f910fb8 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -4689,6 +4689,48 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	return 0;
 }
 
+void
+ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct ixgbe_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = IXGBE_MAX_RING_DESC;
+	qinfo->min_desc = IXGBE_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct ixgbe_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = IXGBE_MAX_RING_DESC;
+	qinfo->min_desc = IXGBE_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+	qinfo->conf.txq_flags = txq->txq_flags;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
+
 /*
  * [VF] Initializes Receive Unit.
  */
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv3 4/5] e1000: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
                   ` (2 preceding siblings ...)
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 3/5] ixgbe: " Konstantin Ananyev
@ 2015-07-20 12:19 ` Konstantin Ananyev
  2015-07-22 17:04   ` Zhang, Helin
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
  4 siblings, 1 reply; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-20 12:19 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/e1000/e1000_ethdev.h | 12 ++++++++++++
 drivers/net/e1000/em_ethdev.c    |  2 ++
 drivers/net/e1000/em_rxtx.c      | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/net/e1000/igb_ethdev.c   |  4 ++++
 drivers/net/e1000/igb_rxtx.c     | 36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 92 insertions(+)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 4e69e44..7ee013a 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -307,6 +307,12 @@ void igb_pf_mbx_process(struct rte_eth_dev *eth_dev);
 
 int igb_pf_host_configure(struct rte_eth_dev *eth_dev);
 
+void igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void igb_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 /*
  * RX/TX EM function prototypes
  */
@@ -343,6 +349,12 @@ uint16_t eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 uint16_t eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
+void em_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void em_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 void igb_pf_host_uninit(struct rte_eth_dev *dev);
 
 #endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index d8c04e7..7cb8b0e 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -166,6 +166,8 @@ static const struct eth_dev_ops eth_em_ops = {
 	.mac_addr_add         = eth_em_rar_set,
 	.mac_addr_remove      = eth_em_rar_clear,
 	.set_mc_addr_list     = eth_em_set_mc_addr_list,
+	.rxq_info_get         = em_rxq_info_get,
+	.txq_info_get         = em_txq_info_get,
 };
 
 /**
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 3b8776d..5778723 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1881,3 +1881,41 @@ eth_em_tx_init(struct rte_eth_dev *dev)
 	/* This write will effectively turn on the transmit unit. */
 	E1000_WRITE_REG(hw, E1000_TCTL, tctl);
 }
+
+void
+em_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct em_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = EM_MAX_RING_DESC;
+	qinfo->min_desc = EM_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+}
+
+void
+em_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct em_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = EM_MAX_RING_DESC;
+	qinfo->min_desc = EM_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index ddc7186..436405c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -307,6 +307,8 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.rss_hash_conf_get    = eth_igb_rss_hash_conf_get,
 	.filter_ctrl          = eth_igb_filter_ctrl,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
+	.rxq_info_get         = igb_rxq_info_get,
+	.txq_info_get         = igb_txq_info_get,
 	.timesync_enable      = igb_timesync_enable,
 	.timesync_disable     = igb_timesync_disable,
 	.timesync_read_rx_timestamp = igb_timesync_read_rx_timestamp,
@@ -337,6 +339,8 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.tx_queue_setup       = eth_igb_tx_queue_setup,
 	.tx_queue_release     = eth_igb_tx_queue_release,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
+	.rxq_info_get         = igb_rxq_info_get,
+	.txq_info_get         = igb_txq_info_get,
 	.mac_addr_set         = igbvf_default_mac_addr_set,
 	.get_reg_length       = igbvf_get_reg_length,
 	.get_reg              = igbvf_get_regs,
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 3a31b21..5f047ca 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -2516,3 +2516,39 @@ eth_igbvf_tx_init(struct rte_eth_dev *dev)
 	}
 
 }
+
+void
+igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct igb_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = IGB_MAX_RING_DESC;
+	qinfo->min_desc = IGB_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+}
+
+void
+igb_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct igb_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = IGB_MAX_RING_DESC;
+	qinfo->min_desc = IGB_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+}
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information
  2015-07-20 12:19 [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
                   ` (3 preceding siblings ...)
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 4/5] e1000: " Konstantin Ananyev
@ 2015-07-20 12:19 ` Konstantin Ananyev
  2015-07-22 17:16   ` Zhang, Helin
  4 siblings, 1 reply; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-20 12:19 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 app/test-pmd/cmdline.c | 48 ++++++++++++++++++++++++++++++++++++
 app/test-pmd/config.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 117 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 8ab4687..29180de 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5304,6 +5304,53 @@ cmdline_parse_inst_t cmd_showport = {
 	},
 };
 
+/* *** SHOW QUEUE INFO *** */
+struct cmd_showqueue_result {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t type;
+	cmdline_fixed_string_t what;
+	uint8_t portnum;
+	uint16_t queuenum;
+};
+
+static void
+cmd_showqueue_parsed(void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_showqueue_result *res = parsed_result;
+
+	if (!strcmp(res->type, "rxq"))
+		rx_queue_infos_display(res->portnum, res->queuenum);
+	else if (!strcmp(res->type, "txq"))
+		tx_queue_infos_display(res->portnum, res->queuenum);
+}
+
+cmdline_parse_token_string_t cmd_showqueue_show =
+	TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, show, "show");
+cmdline_parse_token_string_t cmd_showqueue_type =
+	TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, type, "rxq#txq");
+cmdline_parse_token_string_t cmd_showqueue_what =
+	TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, what, "info");
+cmdline_parse_token_num_t cmd_showqueue_portnum =
+	TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, portnum, UINT8);
+cmdline_parse_token_num_t cmd_showqueue_queuenum =
+	TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, queuenum, UINT16);
+
+cmdline_parse_inst_t cmd_showqueue = {
+	.f = cmd_showqueue_parsed,
+	.data = NULL,
+	.help_str = "show rxq|txq info <port number> <queue_number>",
+	.tokens = {
+		(void *)&cmd_showqueue_show,
+		(void *)&cmd_showqueue_type,
+		(void *)&cmd_showqueue_what,
+		(void *)&cmd_showqueue_portnum,
+		(void *)&cmd_showqueue_queuenum,
+		NULL,
+	},
+};
+
 /* *** READ PORT REGISTER *** */
 struct cmd_read_reg_result {
 	cmdline_fixed_string_t read;
@@ -8913,6 +8960,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_help_long,
 	(cmdline_parse_inst_t *)&cmd_quit,
 	(cmdline_parse_inst_t *)&cmd_showport,
+	(cmdline_parse_inst_t *)&cmd_showqueue,
 	(cmdline_parse_inst_t *)&cmd_showportall,
 	(cmdline_parse_inst_t *)&cmd_showcfg,
 	(cmdline_parse_inst_t *)&cmd_start,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1d29146..f1fd6b1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -293,6 +293,73 @@ nic_stats_mapping_display(portid_t port_id)
 }
 
 void
+rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
+{
+	struct rte_eth_rxq_info qinfo;
+	int32_t rc;
+	static const char *info_border = "*********************";
+
+	rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
+	if (rc != 0) {
+		printf("Failed to retrieve inforamtion for port: %hhu, "
+			"RX queue: %hu\nerror desc: %s(%d)\n",
+			port_id, queue_id, strerror(-rc), rc);
+		return;
+	}
+
+	printf("\n%s Infos for port %-2u, RX queue %-2u %s",
+	       info_border, port_id, queue_id, info_border);
+
+	printf("\nMempool: %s", (qinfo.mp == NULL) ? "NULL" : qinfo.mp->name);
+	printf("\nRX prefetch threshold: %hhu", qinfo.conf.rx_thresh.pthresh);
+	printf("\nRX host threshold: %hhu", qinfo.conf.rx_thresh.hthresh);
+	printf("\nRX writeback threshold: %hhu", qinfo.conf.rx_thresh.wthresh);
+	printf("\nRX free threshold: %hu", qinfo.conf.rx_free_thresh);
+	printf("\nRX drop packets: %s",
+		(qinfo.conf.rx_drop_en != 0) ? "on" : "off");
+	printf("\nRX deferred start: %s",
+		(qinfo.conf.rx_deferred_start != 0) ? "on" : "off");
+	printf("\nRX scattered packets: %s",
+		(qinfo.scattered_rx != 0) ? "on" : "off");
+	printf("\nNumber of RXDs: %hu", qinfo.nb_desc);
+	printf("\nMax possible number of RXDs: %hu", qinfo.max_desc);
+	printf("\nMin possible number of RXDs: %hu", qinfo.min_desc);
+	printf("\n");
+}
+
+void
+tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
+{
+	struct rte_eth_txq_info qinfo;
+	int32_t rc;
+	static const char *info_border = "*********************";
+
+	rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo);
+	if (rc != 0) {
+		printf("Failed to retrieve inforamtion for port: %hhu, "
+			"TX queue: %hu\nerror desc: %s(%d)\n",
+			port_id, queue_id, strerror(-rc), rc);
+		return;
+	}
+
+	printf("\n%s Infos for port %-2u, TX queue %-2u %s",
+	       info_border, port_id, queue_id, info_border);
+
+	printf("\nTX prefetch threshold: %hhu", qinfo.conf.tx_thresh.pthresh);
+	printf("\nTX host threshold: %hhu", qinfo.conf.tx_thresh.hthresh);
+	printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh);
+	printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh);
+	printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh);
+	printf("\nTX flags: %#x", qinfo.conf.txq_flags);
+	printf("\nTX deferred start: %s",
+		(qinfo.conf.tx_deferred_start != 0) ? "on" : "off");
+	printf("\nNumber of TXDs: %hu", qinfo.nb_desc);
+	printf("\nMax possible number of TXDs: %hu", qinfo.max_desc);
+	printf("\nMin possible number of TXDs: %hu", qinfo.min_desc);
+	printf("\n");
+}
+
+void
 port_infos_display(portid_t port_id)
 {
 	struct rte_port *port;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e91e077..a41f51a 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -479,6 +479,8 @@ void nic_xstats_display(portid_t port_id);
 void nic_xstats_clear(portid_t port_id);
 void nic_stats_mapping_display(portid_t port_id);
 void port_infos_display(portid_t port_id);
+void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
+void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
 void fwd_lcores_config_display(void);
 void fwd_config_display(void);
 void rxtx_config_display(void);
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
@ 2015-07-22 16:50   ` Zhang, Helin
  2015-07-22 17:00     ` Ananyev, Konstantin
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 0/5] " Konstantin Ananyev
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 29+ messages in thread
From: Zhang, Helin @ 2015-07-22 16:50 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Monday, July 20, 2015 5:19 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue
> information
> 
> Add the ability for the upper layer to query RX/TX queue information.
> 
> Add new structures:
> struct rte_eth_rxq_info
> struct rte_eth_txq_info
> 
> new functions:
> rte_eth_rx_queue_info_get
> rte_eth_tx_queue_info_get
> 
> into rte_etdev API.
> 
> Left extra free space in the queue info structures, so extra fields could be added
> later without ABI breakage.
> 
> v2 changes:
> - Add formal check for the qinfo input parameter.
> - As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'
> 
> v3 changes:
> - Updated rte_ether_version.map
> - Merged with latest changes
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> ---
>  lib/librte_ether/rte_ethdev.c          | 54 +++++++++++++++++++++
>  lib/librte_ether/rte_ethdev.h          | 87
> +++++++++++++++++++++++++++++++---
>  lib/librte_ether/rte_ether_version.map |  2 +
>  3 files changed, 137 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index
> 94104ce..a94c119 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t
> queue_id,  }
> 
>  int
> +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> +	struct rte_eth_rxq_info *qinfo)
> +{
> +	struct rte_eth_dev *dev;
> +
> +	if (qinfo == NULL)
> +		return -EINVAL;
> +
> +	if (!rte_eth_dev_is_valid_port(port_id)) {
> +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> +		return -EINVAL;
> +	}
> +
> +	dev = &rte_eth_devices[port_id];
> +	if (queue_id >= dev->data->nb_rx_queues) {
> +		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
> +		return -EINVAL;
> +	}
> +
> +	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
> +
> +	memset(qinfo, 0, sizeof(*qinfo));
> +	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> +	return 0;
> +}
> +
> +int
> +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> +	struct rte_eth_txq_info *qinfo)
> +{
> +	struct rte_eth_dev *dev;
> +
> +	if (qinfo == NULL)
> +		return -EINVAL;
> +
> +	if (!rte_eth_dev_is_valid_port(port_id)) {
> +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> +		return -EINVAL;
> +	}
> +
> +	dev = &rte_eth_devices[port_id];
> +	if (queue_id >= dev->data->nb_tx_queues) {
> +		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
> +		return -EINVAL;
> +	}
> +
> +	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
> +
> +	memset(qinfo, 0, sizeof(*qinfo));
> +	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> +	return 0;
> +}
> +
> +int
>  rte_eth_dev_set_mc_addr_list(uint8_t port_id,
>  			     struct ether_addr *mc_addr_set,
>  			     uint32_t nb_mc_addr)
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index
> c901a2c..0c6705e 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -960,6 +960,30 @@ struct rte_eth_xstats {
>  	uint64_t value;
>  };
> 
> +/**
> + * Ethernet device RX queue information strcuture.
> + * Used to retieve information about configured queue.
> + */
> +struct rte_eth_rxq_info {
> +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> +	uint16_t nb_desc;           /**< configured number of RXDs. */
> +	uint16_t max_desc;          /**< max allowed number of RXDs. */
> +	uint16_t min_desc;          /**< min allowed number of RXDs. */
> +} __rte_cache_aligned;
> +
> +/**
> + * Ethernet device TX queue information strcuture.
> + * Used to retieve information about configured queue.
> + */
> +struct rte_eth_txq_info {
> +	struct rte_eth_txconf conf; /**< queue config parameters. */
> +	uint16_t nb_desc;           /**< configured number of TXDs. */
> +	uint16_t max_desc;          /**< max allowed number of TXDs. */
> +	uint16_t min_desc;          /**< min allowed number of TXDs. */
> +} __rte_cache_aligned;
> +
>  struct rte_eth_dev;
> 
>  struct rte_eth_dev_callback;
> @@ -1063,6 +1087,12 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct
> rte_eth_dev *dev,  typedef int (*eth_rx_descriptor_done_t)(void *rxq,
> uint16_t offset);  /**< @internal Check DD bit of specific RX descriptor */
> 
> +typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
> +	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
> +
> +typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
> +	uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
> +
>  typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);  /**<
> @internal Set MTU. */
> 
> @@ -1451,9 +1481,13 @@ struct eth_dev_ops {
>  	rss_hash_update_t rss_hash_update;
>  	/** Get current RSS hash configuration. */
>  	rss_hash_conf_get_t rss_hash_conf_get;
> -	eth_filter_ctrl_t              filter_ctrl;          /**< common filter
> control*/
> +	eth_filter_ctrl_t              filter_ctrl;
> +	/**< common filter control. */
>  	eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs */
> -
> +	eth_rxq_info_get_t rxq_info_get;
> +	/**< retrieve RX queue information. */
> +	eth_txq_info_get_t txq_info_get;
> +	/**< retrieve TX queue information. */
>  	/** Turn IEEE1588/802.1AS timestamping on. */
>  	eth_timesync_enable_t timesync_enable;
>  	/** Turn IEEE1588/802.1AS timestamping off. */ @@ -3721,6 +3755,46 @@
> int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
>  		struct rte_eth_rxtx_callback *user_cb);
Is it targeting R2.1? If no, the new ops should be added at the end of this structure?

> 
>  /**
> + * Retrieve information about given port's RX queue.
> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param queue_id
> + *   The RX queue on the Ethernet device for which information
> + *   will be retrieved.
> + * @param qinfo
> + *   A pointer to a structure of type *rte_eth_rxq_info_info* to be filled with
> + *   the information of the Ethernet device.
> + *
> + * @return
> + *   - 0: Success
> + *   - -ENOTSUP: routine is not supported by the device PMD.
> + *   - -EINVAL:  The port_id or the queue_id is out of range.
> + */
> +int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> +	struct rte_eth_rxq_info *qinfo);
> +
> +/**
> + * Retrieve information about given port's TX queue.
> + *
> + * @param port_id
> + *   The port identifier of the Ethernet device.
> + * @param queue_id
> + *   The TX queue on the Ethernet device for which information
> + *   will be retrieved.
> + * @param qinfo
> + *   A pointer to a structure of type *rte_eth_txq_info_info* to be filled with
> + *   the information of the Ethernet device.
> + *
> + * @return
> + *   - 0: Success
> + *   - -ENOTSUP: routine is not supported by the device PMD.
> + *   - -EINVAL:  The port_id or the queue_id is out of range.
> + */
> +int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> +	struct rte_eth_txq_info *qinfo);
> +
> +/*
>   * Retrieve number of available registers for access
>   *
>   * @param port_id
> @@ -3793,10 +3867,6 @@ int rte_eth_dev_get_eeprom(uint8_t port_id, struct
> rte_dev_eeprom_info *info);
>   */
>  int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info
> *info);
> 
> -#ifdef __cplusplus
> -}
> -#endif


> -
>  /**
>   * Set the list of multicast addresses to filter on an Ethernet device.
>   *
> @@ -3882,4 +3952,9 @@ extern int
> rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
>   */
>  extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
>  					      struct timespec *timestamp);
> +
> +#ifdef __cplusplus
> +}
> +#endif
This is fix for the issue introduced by new ieee1588. It must be added in R2.1 no matter
these patches can be applied or not.

> +
>  #endif /* _RTE_ETHDEV_H_ */
> diff --git a/lib/librte_ether/rte_ether_version.map
> b/lib/librte_ether/rte_ether_version.map
> index 23cfee9..8de0928 100644
> --- a/lib/librte_ether/rte_ether_version.map
> +++ b/lib/librte_ether/rte_ether_version.map
> @@ -92,6 +92,7 @@ DPDK_2.0 {
>  	rte_eth_rx_burst;
>  	rte_eth_rx_descriptor_done;
>  	rte_eth_rx_queue_count;
> +	rte_eth_rx_queue_info_get;
>  	rte_eth_rx_queue_setup;
>  	rte_eth_set_queue_rate_limit;
>  	rte_eth_set_vf_rate_limit;
> @@ -99,6 +100,7 @@ DPDK_2.0 {
>  	rte_eth_stats_get;
>  	rte_eth_stats_reset;
>  	rte_eth_tx_burst;
> +	rte_eth_tx_queue_info_get;
>  	rte_eth_tx_queue_setup;
>  	rte_eth_xstats_get;
>  	rte_eth_xstats_reset;
I am not quite sure about the version map. But I have a question: does it need to create new {} for DPDK_2.1?
And should your changes be in DPDK_2.1?

Regards,
Helin

> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-22 16:50   ` Zhang, Helin
@ 2015-07-22 17:00     ` Ananyev, Konstantin
  2015-07-22 20:45       ` Thomas Monjalon
  0 siblings, 1 reply; 29+ messages in thread
From: Ananyev, Konstantin @ 2015-07-22 17:00 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: dev



> -----Original Message-----
> From: Zhang, Helin
> Sent: Wednesday, July 22, 2015 5:51 PM
> To: Ananyev, Konstantin
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> > Sent: Monday, July 20, 2015 5:19 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue
> > information
> >
> > Add the ability for the upper layer to query RX/TX queue information.
> >
> > Add new structures:
> > struct rte_eth_rxq_info
> > struct rte_eth_txq_info
> >
> > new functions:
> > rte_eth_rx_queue_info_get
> > rte_eth_tx_queue_info_get
> >
> > into rte_etdev API.
> >
> > Left extra free space in the queue info structures, so extra fields could be added
> > later without ABI breakage.
> >
> > v2 changes:
> > - Add formal check for the qinfo input parameter.
> > - As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'
> >
> > v3 changes:
> > - Updated rte_ether_version.map
> > - Merged with latest changes
> >
> > Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > ---
> >  lib/librte_ether/rte_ethdev.c          | 54 +++++++++++++++++++++
> >  lib/librte_ether/rte_ethdev.h          | 87
> > +++++++++++++++++++++++++++++++---
> >  lib/librte_ether/rte_ether_version.map |  2 +
> >  3 files changed, 137 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index
> > 94104ce..a94c119 100644
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t
> > queue_id,  }
> >
> >  int
> > +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +	struct rte_eth_rxq_info *qinfo)
> > +{
> > +	struct rte_eth_dev *dev;
> > +
> > +	if (qinfo == NULL)
> > +		return -EINVAL;
> > +
> > +	if (!rte_eth_dev_is_valid_port(port_id)) {
> > +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> > +		return -EINVAL;
> > +	}
> > +
> > +	dev = &rte_eth_devices[port_id];
> > +	if (queue_id >= dev->data->nb_rx_queues) {
> > +		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
> > +		return -EINVAL;
> > +	}
> > +
> > +	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
> > +
> > +	memset(qinfo, 0, sizeof(*qinfo));
> > +	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
> > +	return 0;
> > +}
> > +
> > +int
> > +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +	struct rte_eth_txq_info *qinfo)
> > +{
> > +	struct rte_eth_dev *dev;
> > +
> > +	if (qinfo == NULL)
> > +		return -EINVAL;
> > +
> > +	if (!rte_eth_dev_is_valid_port(port_id)) {
> > +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> > +		return -EINVAL;
> > +	}
> > +
> > +	dev = &rte_eth_devices[port_id];
> > +	if (queue_id >= dev->data->nb_tx_queues) {
> > +		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
> > +		return -EINVAL;
> > +	}
> > +
> > +	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
> > +
> > +	memset(qinfo, 0, sizeof(*qinfo));
> > +	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
> > +	return 0;
> > +}
> > +
> > +int
> >  rte_eth_dev_set_mc_addr_list(uint8_t port_id,
> >  			     struct ether_addr *mc_addr_set,
> >  			     uint32_t nb_mc_addr)
> > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index
> > c901a2c..0c6705e 100644
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -960,6 +960,30 @@ struct rte_eth_xstats {
> >  	uint64_t value;
> >  };
> >
> > +/**
> > + * Ethernet device RX queue information strcuture.
> > + * Used to retieve information about configured queue.
> > + */
> > +struct rte_eth_rxq_info {
> > +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> > +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> > +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> > +	uint16_t nb_desc;           /**< configured number of RXDs. */
> > +	uint16_t max_desc;          /**< max allowed number of RXDs. */
> > +	uint16_t min_desc;          /**< min allowed number of RXDs. */
> > +} __rte_cache_aligned;
> > +
> > +/**
> > + * Ethernet device TX queue information strcuture.
> > + * Used to retieve information about configured queue.
> > + */
> > +struct rte_eth_txq_info {
> > +	struct rte_eth_txconf conf; /**< queue config parameters. */
> > +	uint16_t nb_desc;           /**< configured number of TXDs. */
> > +	uint16_t max_desc;          /**< max allowed number of TXDs. */
> > +	uint16_t min_desc;          /**< min allowed number of TXDs. */
> > +} __rte_cache_aligned;
> > +
> >  struct rte_eth_dev;
> >
> >  struct rte_eth_dev_callback;
> > @@ -1063,6 +1087,12 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct
> > rte_eth_dev *dev,  typedef int (*eth_rx_descriptor_done_t)(void *rxq,
> > uint16_t offset);  /**< @internal Check DD bit of specific RX descriptor */
> >
> > +typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
> > +	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
> > +
> > +typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
> > +	uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
> > +
> >  typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);  /**<
> > @internal Set MTU. */
> >
> > @@ -1451,9 +1481,13 @@ struct eth_dev_ops {
> >  	rss_hash_update_t rss_hash_update;
> >  	/** Get current RSS hash configuration. */
> >  	rss_hash_conf_get_t rss_hash_conf_get;
> > -	eth_filter_ctrl_t              filter_ctrl;          /**< common filter
> > control*/
> > +	eth_filter_ctrl_t              filter_ctrl;
> > +	/**< common filter control. */
> >  	eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs */
> > -
> > +	eth_rxq_info_get_t rxq_info_get;
> > +	/**< retrieve RX queue information. */
> > +	eth_txq_info_get_t txq_info_get;
> > +	/**< retrieve TX queue information. */
> >  	/** Turn IEEE1588/802.1AS timestamping on. */
> >  	eth_timesync_enable_t timesync_enable;
> >  	/** Turn IEEE1588/802.1AS timestamping off. */ @@ -3721,6 +3755,46 @@
> > int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
> >  		struct rte_eth_rxtx_callback *user_cb);
> Is it targeting R2.1? If no, the new ops should be added at the end of this structure?
> 
> >
> >  /**
> > + * Retrieve information about given port's RX queue.
> > + *
> > + * @param port_id
> > + *   The port identifier of the Ethernet device.
> > + * @param queue_id
> > + *   The RX queue on the Ethernet device for which information
> > + *   will be retrieved.
> > + * @param qinfo
> > + *   A pointer to a structure of type *rte_eth_rxq_info_info* to be filled with
> > + *   the information of the Ethernet device.
> > + *
> > + * @return
> > + *   - 0: Success
> > + *   - -ENOTSUP: routine is not supported by the device PMD.
> > + *   - -EINVAL:  The port_id or the queue_id is out of range.
> > + */
> > +int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +	struct rte_eth_rxq_info *qinfo);
> > +
> > +/**
> > + * Retrieve information about given port's TX queue.
> > + *
> > + * @param port_id
> > + *   The port identifier of the Ethernet device.
> > + * @param queue_id
> > + *   The TX queue on the Ethernet device for which information
> > + *   will be retrieved.
> > + * @param qinfo
> > + *   A pointer to a structure of type *rte_eth_txq_info_info* to be filled with
> > + *   the information of the Ethernet device.
> > + *
> > + * @return
> > + *   - 0: Success
> > + *   - -ENOTSUP: routine is not supported by the device PMD.
> > + *   - -EINVAL:  The port_id or the queue_id is out of range.
> > + */
> > +int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +	struct rte_eth_txq_info *qinfo);
> > +
> > +/*
> >   * Retrieve number of available registers for access
> >   *
> >   * @param port_id
> > @@ -3793,10 +3867,6 @@ int rte_eth_dev_get_eeprom(uint8_t port_id, struct
> > rte_dev_eeprom_info *info);
> >   */
> >  int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info
> > *info);
> >
> > -#ifdef __cplusplus
> > -}
> > -#endif
> 
> 
> > -
> >  /**
> >   * Set the list of multicast addresses to filter on an Ethernet device.
> >   *
> > @@ -3882,4 +3952,9 @@ extern int
> > rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
> >   */
> >  extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
> >  					      struct timespec *timestamp);
> > +
> > +#ifdef __cplusplus
> > +}
> > +#endif
> This is fix for the issue introduced by new ieee1588. It must be added in R2.1 no matter
> these patches can be applied or not.
> 
> > +
> >  #endif /* _RTE_ETHDEV_H_ */
> > diff --git a/lib/librte_ether/rte_ether_version.map
> > b/lib/librte_ether/rte_ether_version.map
> > index 23cfee9..8de0928 100644
> > --- a/lib/librte_ether/rte_ether_version.map
> > +++ b/lib/librte_ether/rte_ether_version.map
> > @@ -92,6 +92,7 @@ DPDK_2.0 {
> >  	rte_eth_rx_burst;
> >  	rte_eth_rx_descriptor_done;
> >  	rte_eth_rx_queue_count;
> > +	rte_eth_rx_queue_info_get;
> >  	rte_eth_rx_queue_setup;
> >  	rte_eth_set_queue_rate_limit;
> >  	rte_eth_set_vf_rate_limit;
> > @@ -99,6 +100,7 @@ DPDK_2.0 {
> >  	rte_eth_stats_get;
> >  	rte_eth_stats_reset;
> >  	rte_eth_tx_burst;
> > +	rte_eth_tx_queue_info_get;
> >  	rte_eth_tx_queue_setup;
> >  	rte_eth_xstats_get;
> >  	rte_eth_xstats_reset;
> I am not quite sure about the version map. But I have a question: does it need to create new {} for DPDK_2.1?
> And should your changes be in DPDK_2.1?

Ah yes, I think you right - it should be in 2.1, not 2.0.
Will re-spin.
Konstantin

> 
> Regards,
> Helin
> 
> > --
> > 1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
@ 2015-07-22 17:02   ` Zhang, Helin
  0 siblings, 0 replies; 29+ messages in thread
From: Zhang, Helin @ 2015-07-22 17:02 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Monday, July 20, 2015 5:19 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 3/5] ixgbe: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 3/5] ixgbe: " Konstantin Ananyev
@ 2015-07-22 17:03   ` Zhang, Helin
  0 siblings, 0 replies; 29+ messages in thread
From: Zhang, Helin @ 2015-07-22 17:03 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Monday, July 20, 2015 5:19 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv3 3/5] ixgbe: add support for
> eth_(rxq|txq)_info_get
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 4/5] e1000: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 4/5] e1000: " Konstantin Ananyev
@ 2015-07-22 17:04   ` Zhang, Helin
  0 siblings, 0 replies; 29+ messages in thread
From: Zhang, Helin @ 2015-07-22 17:04 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Monday, July 20, 2015 5:19 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv3 4/5] e1000: add support for
> eth_(rxq|txq)_info_get
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
@ 2015-07-22 17:16   ` Zhang, Helin
  0 siblings, 0 replies; 29+ messages in thread
From: Zhang, Helin @ 2015-07-22 17:16 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Monday, July 20, 2015 5:19 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX
> queue information
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

Was the commit log missed?

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv4 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
  2015-07-22 16:50   ` Zhang, Helin
@ 2015-07-22 18:28   ` Konstantin Ananyev
  2015-07-23 12:48     ` Thomas Monjalon
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 1/5] " Konstantin Ananyev
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-22 18:28 UTC (permalink / raw)
  To: dev

Add the ability for the upper layer to query RX/TX queue information.
Right now supported for:
ixgbe, i40e, e1000 PMDs.

Konstantin Ananyev (5):
  ethdev: add new API to retrieve RX/TX queue information
  i40e: add support for eth_(rxq|txq)_info_get
  ixgbe: add support for eth_(rxq|txq)_info_get
  e1000: add support for eth_(rxq|txq)_info_get
  testpmd: add new command to display RX/TX queue information

 app/test-pmd/cmdline.c                 | 48 +++++++++++++++++++
 app/test-pmd/config.c                  | 67 ++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                 |  2 +
 drivers/net/e1000/e1000_ethdev.h       | 12 +++++
 drivers/net/e1000/em_ethdev.c          |  2 +
 drivers/net/e1000/em_rxtx.c            | 38 +++++++++++++++
 drivers/net/e1000/igb_ethdev.c         |  4 ++
 drivers/net/e1000/igb_rxtx.c           | 36 ++++++++++++++
 drivers/net/i40e/i40e_ethdev.c         |  2 +
 drivers/net/i40e/i40e_ethdev.h         |  5 ++
 drivers/net/i40e/i40e_rxtx.c           | 42 ++++++++++++++++
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++
 drivers/net/ixgbe/ixgbe_ethdev.h       |  6 +++
 drivers/net/ixgbe/ixgbe_rxtx.c         | 42 ++++++++++++++++
 lib/librte_ether/rte_ethdev.c          | 54 +++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 87 +++++++++++++++++++++++++++++++---
 lib/librte_ether/rte_ether_version.map |  2 +
 17 files changed, 447 insertions(+), 6 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
  2015-07-22 16:50   ` Zhang, Helin
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 0/5] " Konstantin Ananyev
@ 2015-07-22 18:28   ` Konstantin Ananyev
  2015-07-22 19:48     ` Stephen Hemminger
  2015-07-23 16:26     ` Thomas Monjalon
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
                     ` (3 subsequent siblings)
  6 siblings, 2 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-22 18:28 UTC (permalink / raw)
  To: dev

Add the ability for the upper layer to query RX/TX queue information.

Add new structures:
struct rte_eth_rxq_info
struct rte_eth_txq_info

new functions:
rte_eth_rx_queue_info_get
rte_eth_tx_queue_info_get

into rte_etdev API.

Left extra free space in the queue info structures,
so extra fields could be added later without ABI breakage.

v2 changes:
- Add formal check for the qinfo input parameter.
- As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'

v3 changes:
- Updated rte_ether_version.map
- Merged with latest changes

v4 changes:
- rte_ether_version.map: move new functions into DPDK_2.1 sub-space.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ether/rte_ethdev.c          | 54 +++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h          | 87 +++++++++++++++++++++++++++++++---
 lib/librte_ether/rte_ether_version.map |  2 +
 3 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 94104ce..a94c119 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3341,6 +3341,60 @@ rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
 }
 
 int
+rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct rte_eth_dev *dev;
+
+	if (qinfo == NULL)
+		return -EINVAL;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (queue_id >= dev->data->nb_rx_queues) {
+		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		return -EINVAL;
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+
+	memset(qinfo, 0, sizeof(*qinfo));
+	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
+	return 0;
+}
+
+int
+rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct rte_eth_dev *dev;
+
+	if (qinfo == NULL)
+		return -EINVAL;
+
+	if (!rte_eth_dev_is_valid_port(port_id)) {
+		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	if (queue_id >= dev->data->nb_tx_queues) {
+		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		return -EINVAL;
+	}
+
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+
+	memset(qinfo, 0, sizeof(*qinfo));
+	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
+	return 0;
+}
+
+int
 rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 			     struct ether_addr *mc_addr_set,
 			     uint32_t nb_mc_addr)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index c901a2c..0c6705e 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -960,6 +960,30 @@ struct rte_eth_xstats {
 	uint64_t value;
 };
 
+/**
+ * Ethernet device RX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_rxq_info {
+	struct rte_mempool *mp;     /**< mempool used by that queue. */
+	struct rte_eth_rxconf conf; /**< queue config parameters. */
+	uint8_t scattered_rx;       /**< scattered packets RX supported. */
+	uint16_t nb_desc;           /**< configured number of RXDs. */
+	uint16_t max_desc;          /**< max allowed number of RXDs. */
+	uint16_t min_desc;          /**< min allowed number of RXDs. */
+} __rte_cache_aligned;
+
+/**
+ * Ethernet device TX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_txq_info {
+	struct rte_eth_txconf conf; /**< queue config parameters. */
+	uint16_t nb_desc;           /**< configured number of TXDs. */
+	uint16_t max_desc;          /**< max allowed number of TXDs. */
+	uint16_t min_desc;          /**< min allowed number of TXDs. */
+} __rte_cache_aligned;
+
 struct rte_eth_dev;
 
 struct rte_eth_dev_callback;
@@ -1063,6 +1087,12 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
 /**< @internal Check DD bit of specific RX descriptor */
 
+typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
+	uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
+
+typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
+	uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
+
 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
 /**< @internal Set MTU. */
 
@@ -1451,9 +1481,13 @@ struct eth_dev_ops {
 	rss_hash_update_t rss_hash_update;
 	/** Get current RSS hash configuration. */
 	rss_hash_conf_get_t rss_hash_conf_get;
-	eth_filter_ctrl_t              filter_ctrl;          /**< common filter control*/
+	eth_filter_ctrl_t              filter_ctrl;
+	/**< common filter control. */
 	eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs */
-
+	eth_rxq_info_get_t rxq_info_get;
+	/**< retrieve RX queue information. */
+	eth_txq_info_get_t txq_info_get;
+	/**< retrieve TX queue information. */
 	/** Turn IEEE1588/802.1AS timestamping on. */
 	eth_timesync_enable_t timesync_enable;
 	/** Turn IEEE1588/802.1AS timestamping off. */
@@ -3721,6 +3755,46 @@ int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
 		struct rte_eth_rxtx_callback *user_cb);
 
 /**
+ * Retrieve information about given port's RX queue.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param queue_id
+ *   The RX queue on the Ethernet device for which information
+ *   will be retrieved.
+ * @param qinfo
+ *   A pointer to a structure of type *rte_eth_rxq_info_info* to be filled with
+ *   the information of the Ethernet device.
+ *
+ * @return
+ *   - 0: Success
+ *   - -ENOTSUP: routine is not supported by the device PMD.
+ *   - -EINVAL:  The port_id or the queue_id is out of range.
+ */
+int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+/**
+ * Retrieve information about given port's TX queue.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param queue_id
+ *   The TX queue on the Ethernet device for which information
+ *   will be retrieved.
+ * @param qinfo
+ *   A pointer to a structure of type *rte_eth_txq_info_info* to be filled with
+ *   the information of the Ethernet device.
+ *
+ * @return
+ *   - 0: Success
+ *   - -ENOTSUP: routine is not supported by the device PMD.
+ *   - -EINVAL:  The port_id or the queue_id is out of range.
+ */
+int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
+/*
  * Retrieve number of available registers for access
  *
  * @param port_id
@@ -3793,10 +3867,6 @@ int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
  */
 int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
 
-#ifdef __cplusplus
-}
-#endif
-
 /**
  * Set the list of multicast addresses to filter on an Ethernet device.
  *
@@ -3882,4 +3952,9 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
  */
 extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
 					      struct timespec *timestamp);
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTE_ETHDEV_H_ */
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 23cfee9..2bae2cf 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -117,9 +117,11 @@ DPDK_2.1 {
 	rte_eth_dev_is_valid_port;
 	rte_eth_dev_set_eeprom;
 	rte_eth_dev_set_mc_addr_list;
+	rte_eth_rx_queue_info_get;
 	rte_eth_timesync_disable;
 	rte_eth_timesync_enable;
 	rte_eth_timesync_read_rx_timestamp;
 	rte_eth_timesync_read_tx_timestamp;
+	rte_eth_tx_queue_info_get;
 
 } DPDK_2.0;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv4 2/5] i40e: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
                     ` (2 preceding siblings ...)
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 1/5] " Konstantin Ananyev
@ 2015-07-22 18:28   ` Konstantin Ananyev
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 3/5] ixgbe: " Konstantin Ananyev
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-22 18:28 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c |  2 ++
 drivers/net/i40e/i40e_ethdev.h |  5 +++++
 drivers/net/i40e/i40e_rxtx.c   | 42 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..6815b6c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -283,6 +283,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.udp_tunnel_add               = i40e_dev_udp_tunnel_add,
 	.udp_tunnel_del               = i40e_dev_udp_tunnel_del,
 	.filter_ctrl                  = i40e_dev_filter_ctrl,
+	.rxq_info_get                 = i40e_rxq_info_get,
+	.txq_info_get                 = i40e_txq_info_get,
 	.mirror_rule_set              = i40e_mirror_rule_set,
 	.mirror_rule_reset            = i40e_mirror_rule_reset,
 	.timesync_enable              = i40e_timesync_enable,
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 6185657..4748392 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -502,6 +502,11 @@ int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
 			  enum rte_filter_op filter_op,
 			  void *arg);
 
+void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+void i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
 	(&((struct i40e_adapter *)adapter)->pf)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 891a221..fadf3e8 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3352,3 +3352,45 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf)
 
 	return I40E_SUCCESS;
 }
+
+void
+i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct i40e_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mp;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = I40E_MAX_RING_DESC;
+	qinfo->min_desc = I40E_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct i40e_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = I40E_MAX_RING_DESC;
+	qinfo->min_desc = I40E_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+	qinfo->conf.txq_flags = txq->txq_flags;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv4 3/5] ixgbe: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
                     ` (3 preceding siblings ...)
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
@ 2015-07-22 18:28   ` Konstantin Ananyev
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 4/5] e1000: " Konstantin Ananyev
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
  6 siblings, 0 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-22 18:28 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c |  4 ++++
 drivers/net/ixgbe/ixgbe_ethdev.h |  6 ++++++
 drivers/net/ixgbe/ixgbe_rxtx.c   | 42 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 3a8cff0..053279e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -431,6 +431,8 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
 	.rss_hash_conf_get    = ixgbe_dev_rss_hash_conf_get,
 	.filter_ctrl          = ixgbe_dev_filter_ctrl,
 	.set_mc_addr_list     = ixgbe_dev_set_mc_addr_list,
+	.rxq_info_get         = ixgbe_rxq_info_get,
+	.txq_info_get         = ixgbe_txq_info_get,
 	.timesync_enable      = ixgbe_timesync_enable,
 	.timesync_disable     = ixgbe_timesync_disable,
 	.timesync_read_rx_timestamp = ixgbe_timesync_read_rx_timestamp,
@@ -466,6 +468,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops = {
 	.mac_addr_add         = ixgbevf_add_mac_addr,
 	.mac_addr_remove      = ixgbevf_remove_mac_addr,
 	.set_mc_addr_list     = ixgbe_dev_set_mc_addr_list,
+	.rxq_info_get         = ixgbe_rxq_info_get,
+	.txq_info_get         = ixgbe_txq_info_get,
 	.mac_addr_set         = ixgbevf_set_default_mac_addr,
 	.get_reg_length       = ixgbevf_get_reg_length,
 	.get_reg              = ixgbevf_get_regs,
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c16c11d..190c34a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -347,6 +347,12 @@ int ixgbe_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 int ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 int ixgbevf_dev_rx_init(struct rte_eth_dev *dev);
 
 void ixgbevf_dev_tx_init(struct rte_eth_dev *dev);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 9b2d637..f910fb8 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -4689,6 +4689,48 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	return 0;
 }
 
+void
+ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct ixgbe_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = IXGBE_MAX_RING_DESC;
+	qinfo->min_desc = IXGBE_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct ixgbe_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = IXGBE_MAX_RING_DESC;
+	qinfo->min_desc = IXGBE_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+	qinfo->conf.txq_flags = txq->txq_flags;
+	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
+
 /*
  * [VF] Initializes Receive Unit.
  */
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv4 4/5] e1000: add support for eth_(rxq|txq)_info_get
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
                     ` (4 preceding siblings ...)
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 3/5] ixgbe: " Konstantin Ananyev
@ 2015-07-22 18:28   ` Konstantin Ananyev
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
  6 siblings, 0 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-22 18:28 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 drivers/net/e1000/e1000_ethdev.h | 12 ++++++++++++
 drivers/net/e1000/em_ethdev.c    |  2 ++
 drivers/net/e1000/em_rxtx.c      | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/net/e1000/igb_ethdev.c   |  4 ++++
 drivers/net/e1000/igb_rxtx.c     | 36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 92 insertions(+)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 4e69e44..7ee013a 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -307,6 +307,12 @@ void igb_pf_mbx_process(struct rte_eth_dev *eth_dev);
 
 int igb_pf_host_configure(struct rte_eth_dev *eth_dev);
 
+void igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void igb_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 /*
  * RX/TX EM function prototypes
  */
@@ -343,6 +349,12 @@ uint16_t eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 uint16_t eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
+void em_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void em_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 void igb_pf_host_uninit(struct rte_eth_dev *dev);
 
 #endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index d8c04e7..7cb8b0e 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -166,6 +166,8 @@ static const struct eth_dev_ops eth_em_ops = {
 	.mac_addr_add         = eth_em_rar_set,
 	.mac_addr_remove      = eth_em_rar_clear,
 	.set_mc_addr_list     = eth_em_set_mc_addr_list,
+	.rxq_info_get         = em_rxq_info_get,
+	.txq_info_get         = em_txq_info_get,
 };
 
 /**
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 3b8776d..5778723 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1881,3 +1881,41 @@ eth_em_tx_init(struct rte_eth_dev *dev)
 	/* This write will effectively turn on the transmit unit. */
 	E1000_WRITE_REG(hw, E1000_TCTL, tctl);
 }
+
+void
+em_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct em_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = EM_MAX_RING_DESC;
+	qinfo->min_desc = EM_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+}
+
+void
+em_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct em_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = EM_MAX_RING_DESC;
+	qinfo->min_desc = EM_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+	qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+	qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+}
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index ddc7186..436405c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -307,6 +307,8 @@ static const struct eth_dev_ops eth_igb_ops = {
 	.rss_hash_conf_get    = eth_igb_rss_hash_conf_get,
 	.filter_ctrl          = eth_igb_filter_ctrl,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
+	.rxq_info_get         = igb_rxq_info_get,
+	.txq_info_get         = igb_txq_info_get,
 	.timesync_enable      = igb_timesync_enable,
 	.timesync_disable     = igb_timesync_disable,
 	.timesync_read_rx_timestamp = igb_timesync_read_rx_timestamp,
@@ -337,6 +339,8 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {
 	.tx_queue_setup       = eth_igb_tx_queue_setup,
 	.tx_queue_release     = eth_igb_tx_queue_release,
 	.set_mc_addr_list     = eth_igb_set_mc_addr_list,
+	.rxq_info_get         = igb_rxq_info_get,
+	.txq_info_get         = igb_txq_info_get,
 	.mac_addr_set         = igbvf_default_mac_addr_set,
 	.get_reg_length       = igbvf_get_reg_length,
 	.get_reg              = igbvf_get_regs,
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 3a31b21..5f047ca 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -2516,3 +2516,39 @@ eth_igbvf_tx_init(struct rte_eth_dev *dev)
 	}
 
 }
+
+void
+igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo)
+{
+	struct igb_rx_queue *rxq;
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	qinfo->mp = rxq->mb_pool;
+	qinfo->scattered_rx = dev->data->scattered_rx;
+
+	qinfo->nb_desc = rxq->nb_rx_desc;
+	qinfo->max_desc = IGB_MAX_RING_DESC;
+	qinfo->min_desc = IGB_MIN_RING_DESC;
+
+	qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+	qinfo->conf.rx_drop_en = rxq->drop_en;
+}
+
+void
+igb_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo)
+{
+	struct igb_tx_queue *txq;
+
+	txq = dev->data->tx_queues[queue_id];
+
+	qinfo->nb_desc = txq->nb_tx_desc;
+	qinfo->max_desc = IGB_MAX_RING_DESC;
+	qinfo->min_desc = IGB_MIN_RING_DESC;
+
+	qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+	qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+	qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+}
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [dpdk-dev] [PATCHv4 5/5] testpmd: add new command to display RX/TX queue information
  2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
                     ` (5 preceding siblings ...)
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 4/5] e1000: " Konstantin Ananyev
@ 2015-07-22 18:28   ` Konstantin Ananyev
  6 siblings, 0 replies; 29+ messages in thread
From: Konstantin Ananyev @ 2015-07-22 18:28 UTC (permalink / raw)
  To: dev

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 app/test-pmd/cmdline.c | 48 ++++++++++++++++++++++++++++++++++++
 app/test-pmd/config.c  | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/testpmd.h |  2 ++
 3 files changed, 117 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 8ab4687..29180de 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5304,6 +5304,53 @@ cmdline_parse_inst_t cmd_showport = {
 	},
 };
 
+/* *** SHOW QUEUE INFO *** */
+struct cmd_showqueue_result {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t type;
+	cmdline_fixed_string_t what;
+	uint8_t portnum;
+	uint16_t queuenum;
+};
+
+static void
+cmd_showqueue_parsed(void *parsed_result,
+	__attribute__((unused)) struct cmdline *cl,
+	__attribute__((unused)) void *data)
+{
+	struct cmd_showqueue_result *res = parsed_result;
+
+	if (!strcmp(res->type, "rxq"))
+		rx_queue_infos_display(res->portnum, res->queuenum);
+	else if (!strcmp(res->type, "txq"))
+		tx_queue_infos_display(res->portnum, res->queuenum);
+}
+
+cmdline_parse_token_string_t cmd_showqueue_show =
+	TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, show, "show");
+cmdline_parse_token_string_t cmd_showqueue_type =
+	TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, type, "rxq#txq");
+cmdline_parse_token_string_t cmd_showqueue_what =
+	TOKEN_STRING_INITIALIZER(struct cmd_showqueue_result, what, "info");
+cmdline_parse_token_num_t cmd_showqueue_portnum =
+	TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, portnum, UINT8);
+cmdline_parse_token_num_t cmd_showqueue_queuenum =
+	TOKEN_NUM_INITIALIZER(struct cmd_showqueue_result, queuenum, UINT16);
+
+cmdline_parse_inst_t cmd_showqueue = {
+	.f = cmd_showqueue_parsed,
+	.data = NULL,
+	.help_str = "show rxq|txq info <port number> <queue_number>",
+	.tokens = {
+		(void *)&cmd_showqueue_show,
+		(void *)&cmd_showqueue_type,
+		(void *)&cmd_showqueue_what,
+		(void *)&cmd_showqueue_portnum,
+		(void *)&cmd_showqueue_queuenum,
+		NULL,
+	},
+};
+
 /* *** READ PORT REGISTER *** */
 struct cmd_read_reg_result {
 	cmdline_fixed_string_t read;
@@ -8913,6 +8960,7 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_help_long,
 	(cmdline_parse_inst_t *)&cmd_quit,
 	(cmdline_parse_inst_t *)&cmd_showport,
+	(cmdline_parse_inst_t *)&cmd_showqueue,
 	(cmdline_parse_inst_t *)&cmd_showportall,
 	(cmdline_parse_inst_t *)&cmd_showcfg,
 	(cmdline_parse_inst_t *)&cmd_start,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1d29146..f1fd6b1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -293,6 +293,73 @@ nic_stats_mapping_display(portid_t port_id)
 }
 
 void
+rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
+{
+	struct rte_eth_rxq_info qinfo;
+	int32_t rc;
+	static const char *info_border = "*********************";
+
+	rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
+	if (rc != 0) {
+		printf("Failed to retrieve inforamtion for port: %hhu, "
+			"RX queue: %hu\nerror desc: %s(%d)\n",
+			port_id, queue_id, strerror(-rc), rc);
+		return;
+	}
+
+	printf("\n%s Infos for port %-2u, RX queue %-2u %s",
+	       info_border, port_id, queue_id, info_border);
+
+	printf("\nMempool: %s", (qinfo.mp == NULL) ? "NULL" : qinfo.mp->name);
+	printf("\nRX prefetch threshold: %hhu", qinfo.conf.rx_thresh.pthresh);
+	printf("\nRX host threshold: %hhu", qinfo.conf.rx_thresh.hthresh);
+	printf("\nRX writeback threshold: %hhu", qinfo.conf.rx_thresh.wthresh);
+	printf("\nRX free threshold: %hu", qinfo.conf.rx_free_thresh);
+	printf("\nRX drop packets: %s",
+		(qinfo.conf.rx_drop_en != 0) ? "on" : "off");
+	printf("\nRX deferred start: %s",
+		(qinfo.conf.rx_deferred_start != 0) ? "on" : "off");
+	printf("\nRX scattered packets: %s",
+		(qinfo.scattered_rx != 0) ? "on" : "off");
+	printf("\nNumber of RXDs: %hu", qinfo.nb_desc);
+	printf("\nMax possible number of RXDs: %hu", qinfo.max_desc);
+	printf("\nMin possible number of RXDs: %hu", qinfo.min_desc);
+	printf("\n");
+}
+
+void
+tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
+{
+	struct rte_eth_txq_info qinfo;
+	int32_t rc;
+	static const char *info_border = "*********************";
+
+	rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo);
+	if (rc != 0) {
+		printf("Failed to retrieve inforamtion for port: %hhu, "
+			"TX queue: %hu\nerror desc: %s(%d)\n",
+			port_id, queue_id, strerror(-rc), rc);
+		return;
+	}
+
+	printf("\n%s Infos for port %-2u, TX queue %-2u %s",
+	       info_border, port_id, queue_id, info_border);
+
+	printf("\nTX prefetch threshold: %hhu", qinfo.conf.tx_thresh.pthresh);
+	printf("\nTX host threshold: %hhu", qinfo.conf.tx_thresh.hthresh);
+	printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh);
+	printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh);
+	printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh);
+	printf("\nTX flags: %#x", qinfo.conf.txq_flags);
+	printf("\nTX deferred start: %s",
+		(qinfo.conf.tx_deferred_start != 0) ? "on" : "off");
+	printf("\nNumber of TXDs: %hu", qinfo.nb_desc);
+	printf("\nMax possible number of TXDs: %hu", qinfo.max_desc);
+	printf("\nMin possible number of TXDs: %hu", qinfo.min_desc);
+	printf("\n");
+}
+
+void
 port_infos_display(portid_t port_id)
 {
 	struct rte_port *port;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e91e077..a41f51a 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -479,6 +479,8 @@ void nic_xstats_display(portid_t port_id);
 void nic_xstats_clear(portid_t port_id);
 void nic_stats_mapping_display(portid_t port_id);
 void port_infos_display(portid_t port_id);
+void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
+void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
 void fwd_lcores_config_display(void);
 void fwd_config_display(void);
 void rxtx_config_display(void);
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 1/5] " Konstantin Ananyev
@ 2015-07-22 19:48     ` Stephen Hemminger
  2015-07-23 10:52       ` Ananyev, Konstantin
  2015-07-23 16:26     ` Thomas Monjalon
  1 sibling, 1 reply; 29+ messages in thread
From: Stephen Hemminger @ 2015-07-22 19:48 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

On Wed, 22 Jul 2015 19:28:51 +0100
Konstantin Ananyev <konstantin.ananyev@intel.com> wrote:

> Add the ability for the upper layer to query RX/TX queue information.
> 
> Add new structures:
> struct rte_eth_rxq_info
> struct rte_eth_txq_info
> 
> new functions:
> rte_eth_rx_queue_info_get
> rte_eth_tx_queue_info_get
> 
> into rte_etdev API.
> 
> Left extra free space in the queue info structures,
> so extra fields could be added later without ABI breakage.
> 
> v2 changes:
> - Add formal check for the qinfo input parameter.
> - As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'
> 
> v3 changes:
> - Updated rte_ether_version.map
> - Merged with latest changes
> 
> v4 changes:
> - rte_ether_version.map: move new functions into DPDK_2.1 sub-space.
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Since all this data should be rxconf already, Is it possible
to do a generic version of this and not have to change every driver.

You only handled the Intel hardware drivers. But there also
all the virtual drivers, other vendors etc.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv3 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-22 17:00     ` Ananyev, Konstantin
@ 2015-07-22 20:45       ` Thomas Monjalon
  0 siblings, 0 replies; 29+ messages in thread
From: Thomas Monjalon @ 2015-07-22 20:45 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev

2015-07-22 17:00, Ananyev, Konstantin:
> From: Zhang, Helin
> > > -#ifdef __cplusplus
> > > -}
> > > -#endif
> > > -
> > >  /**
> > >   * Set the list of multicast addresses to filter on an Ethernet device.
> > >   *
> > > @@ -3882,4 +3952,9 @@ extern int
> > > rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
> > >   */
> > >  extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
> > >  					      struct timespec *timestamp);
> > > +
> > > +#ifdef __cplusplus
> > > +}
> > > +#endif
> > This is fix for the issue introduced by new ieee1588. It must be added in R2.1 no matter
> > these patches can be applied or not.

Yes you're totally right Helin.
It's a fix and should be in a separate patch.
This feature is not planned in 2.1.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-22 19:48     ` Stephen Hemminger
@ 2015-07-23 10:52       ` Ananyev, Konstantin
  2015-07-23 16:17         ` Thomas Monjalon
  0 siblings, 1 reply; 29+ messages in thread
From: Ananyev, Konstantin @ 2015-07-23 10:52 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Wednesday, July 22, 2015 8:48 PM
> To: Ananyev, Konstantin
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
> 
> On Wed, 22 Jul 2015 19:28:51 +0100
> Konstantin Ananyev <konstantin.ananyev@intel.com> wrote:
> 
> > Add the ability for the upper layer to query RX/TX queue information.
> >
> > Add new structures:
> > struct rte_eth_rxq_info
> > struct rte_eth_txq_info
> >
> > new functions:
> > rte_eth_rx_queue_info_get
> > rte_eth_tx_queue_info_get
> >
> > into rte_etdev API.
> >
> > Left extra free space in the queue info structures,
> > so extra fields could be added later without ABI breakage.
> >
> > v2 changes:
> > - Add formal check for the qinfo input parameter.
> > - As suggested rename 'rx_qinfo/tx_qinfo' to 'rxq_info/txq_info'
> >
> > v3 changes:
> > - Updated rte_ether_version.map
> > - Merged with latest changes
> >
> > v4 changes:
> > - rte_ether_version.map: move new functions into DPDK_2.1 sub-space.
> >
> > Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> Since all this data should be rxconf already, Is it possible
> to do a generic version of this and not have to change every driver.

I don't think it is possible to implement these two functions at rte_etdev level only.
At least not with current ethdev/PMD implementation:
-  Inside struct rte_eth_dev_info we have only: 'struct rte_eth_rxconf default_rxconf;'.
We don't have rxconf here for each configured rx queue.
That information is maintained by PMD and inside PMD, different devices have different format for queue structure.
- rte_eth_rxq_info contains not only rxconf but some extra information: mempool in use by that queue,
 min/max possible number of descriptors.
 Also my intention was that in future that structure would be extended to provide some RT info about queue:
 (number of free/used descriptors from SW point of view, etc).  

Konstantin

> 
> You only handled the Intel hardware drivers. But there also
> all the virtual drivers, other vendors etc.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 0/5] " Konstantin Ananyev
@ 2015-07-23 12:48     ` Thomas Monjalon
  0 siblings, 0 replies; 29+ messages in thread
From: Thomas Monjalon @ 2015-07-23 12:48 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

2015-07-22 19:28, Konstantin Ananyev:
> Add the ability for the upper layer to query RX/TX queue information.
> Right now supported for:
> ixgbe, i40e, e1000 PMDs.

Thank you for working on it.
The feature is now in the roadmap for version 2.2.
Please postpone any new version to the 2.2 release cycle.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-23 10:52       ` Ananyev, Konstantin
@ 2015-07-23 16:17         ` Thomas Monjalon
  2015-07-24  9:05           ` Ananyev, Konstantin
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas Monjalon @ 2015-07-23 16:17 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev

2015-07-23 10:52, Ananyev, Konstantin:
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Konstantin Ananyev <konstantin.ananyev@intel.com> wrote:
> > > Add the ability for the upper layer to query RX/TX queue information.
[...]
> > Since all this data should be rxconf already, Is it possible
> > to do a generic version of this and not have to change every driver.
> 
> I don't think it is possible to implement these two functions at rte_etdev level only.
> At least not with current ethdev/PMD implementation:
> -  Inside struct rte_eth_dev_info we have only: 'struct rte_eth_rxconf default_rxconf;'.
> We don't have rxconf here for each configured rx queue.
> That information is maintained by PMD and inside PMD, different devices have different format for queue structure.
> - rte_eth_rxq_info contains not only rxconf but some extra information: mempool in use by that queue,
>  min/max possible number of descriptors.
>  Also my intention was that in future that structure would be extended to provide some RT info about queue:
>  (number of free/used descriptors from SW point of view, etc).  

Isn't it what rte_eth_rx_queue_count() provides?
Maybe we should deprecate it in favor of rte_eth_rx_queue_info_get().

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 1/5] " Konstantin Ananyev
  2015-07-22 19:48     ` Stephen Hemminger
@ 2015-07-23 16:26     ` Thomas Monjalon
  2015-07-24  9:15       ` Ananyev, Konstantin
  1 sibling, 1 reply; 29+ messages in thread
From: Thomas Monjalon @ 2015-07-23 16:26 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

2015-07-22 19:28, Konstantin Ananyev:
> +	if (!rte_eth_dev_is_valid_port(port_id)) {
> +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> +		return -EINVAL;
> +	}

Please use VALID_PORTID_OR_ERR_RET.

> + * Ethernet device RX queue information strcuture.

Typo here (and same for TX).

> +struct rte_eth_rxq_info {
> +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> +	uint16_t nb_desc;           /**< configured number of RXDs. */

Shouldn't we move nb_desc in rte_eth_rxconf?
So rte_eth_rx_queue_setup() would have less parameters.

> -#ifdef __cplusplus
> -}
> -#endif
> -
>  /**
>   * Set the list of multicast addresses to filter on an Ethernet device.
>   *
> @@ -3882,4 +3952,9 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
>   */
>  extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
>  					      struct timespec *timestamp);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
>  #endif /* _RTE_ETHDEV_H_ */

Please send this change in a separate patch alone.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-23 16:17         ` Thomas Monjalon
@ 2015-07-24  9:05           ` Ananyev, Konstantin
  0 siblings, 0 replies; 29+ messages in thread
From: Ananyev, Konstantin @ 2015-07-24  9:05 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, July 23, 2015 5:17 PM
> To: Ananyev, Konstantin
> Cc: dev@dpdk.org; Stephen Hemminger
> Subject: Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
> 
> 2015-07-23 10:52, Ananyev, Konstantin:
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > > Konstantin Ananyev <konstantin.ananyev@intel.com> wrote:
> > > > Add the ability for the upper layer to query RX/TX queue information.
> [...]
> > > Since all this data should be rxconf already, Is it possible
> > > to do a generic version of this and not have to change every driver.
> >
> > I don't think it is possible to implement these two functions at rte_etdev level only.
> > At least not with current ethdev/PMD implementation:
> > -  Inside struct rte_eth_dev_info we have only: 'struct rte_eth_rxconf default_rxconf;'.
> > We don't have rxconf here for each configured rx queue.
> > That information is maintained by PMD and inside PMD, different devices have different format for queue structure.
> > - rte_eth_rxq_info contains not only rxconf but some extra information: mempool in use by that queue,
> >  min/max possible number of descriptors.
> >  Also my intention was that in future that structure would be extended to provide some RT info about queue:
> >  (number of free/used descriptors from SW point of view, etc).
> 
> Isn't it what rte_eth_rx_queue_count() provides?

Not exactly.
rte_eth_rx_queue_count() actually scans HW descriptors to check their status.
I was thinking about returning just a snapshot of SW state: how many free/used RXDs are from PMD perspective
(just by collecting info from *_rx_queue structure, without reading actual HW registers/descriptors).
Anyway, right now it is not implemented - it is just a thought for future expansion.
Konstantin


> Maybe we should deprecate it in favor of rte_eth_rx_queue_info_get().

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-23 16:26     ` Thomas Monjalon
@ 2015-07-24  9:15       ` Ananyev, Konstantin
  2015-07-24  9:24         ` Thomas Monjalon
  0 siblings, 1 reply; 29+ messages in thread
From: Ananyev, Konstantin @ 2015-07-24  9:15 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, July 23, 2015 5:26 PM
> To: Ananyev, Konstantin
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
> 
> 2015-07-22 19:28, Konstantin Ananyev:
> > +	if (!rte_eth_dev_is_valid_port(port_id)) {
> > +		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> > +		return -EINVAL;
> > +	}
> 
> Please use VALID_PORTID_OR_ERR_RET.
> 
> > + * Ethernet device RX queue information strcuture.
> 
> Typo here (and same for TX).
> 
> > +struct rte_eth_rxq_info {
> > +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> > +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> > +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> > +	uint16_t nb_desc;           /**< configured number of RXDs. */
> 
> Shouldn't we move nb_desc in rte_eth_rxconf?
> So rte_eth_rx_queue_setup() would have less parameters.

I thought about that too, but it seems more drawbacks then pluses with that idea:
1. Right now it is possible to call rte_eth_rx_queue_setup(..., rx_conf=NULL, ...);
In that case rte_eth_rx_queue_setup()will use default for that device rx_conf.
If we'll move mempool into rxconf, will break that ability.
2.  A bit unclear what mempool should be returned as default_rxconf by rte_eth_dev_info_get().
Should it be just NULL.
3. ABI breakage and we (and all customers) will need  to modify each and every RX setup/configure code.

For me it just seems like too much hassle, without any clear advanatage.

> 
> > -#ifdef __cplusplus
> > -}
> > -#endif
> > -
> >  /**
> >   * Set the list of multicast addresses to filter on an Ethernet device.
> >   *
> > @@ -3882,4 +3952,9 @@ extern int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
> >   */
> >  extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
> >  					      struct timespec *timestamp);
> > +
> > +#ifdef __cplusplus
> > +}
> > +#endif
> > +
> >  #endif /* _RTE_ETHDEV_H_ */
> 
> Please send this change in a separate patch alone.

Ok, will do.

Konstantin

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-24  9:15       ` Ananyev, Konstantin
@ 2015-07-24  9:24         ` Thomas Monjalon
  2015-07-24 10:50           ` Ananyev, Konstantin
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas Monjalon @ 2015-07-24  9:24 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev

2015-07-24 09:15, Ananyev, Konstantin:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > 2015-07-22 19:28, Konstantin Ananyev:
> > > +struct rte_eth_rxq_info {
> > > +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> > > +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> > > +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> > > +	uint16_t nb_desc;           /**< configured number of RXDs. */
> > 
> > Shouldn't we move nb_desc in rte_eth_rxconf?
> > So rte_eth_rx_queue_setup() would have less parameters.
> 
> I thought about that too, but it seems more drawbacks then pluses with that idea:
> 1. Right now it is possible to call rte_eth_rx_queue_setup(..., rx_conf=NULL, ...);
> In that case rte_eth_rx_queue_setup()will use default for that device rx_conf.
> If we'll move mempool into rxconf, will break that ability.
> 2.  A bit unclear what mempool should be returned as default_rxconf by rte_eth_dev_info_get().
> Should it be just NULL.

I was only suggesting to move nb_desc, not mempool.
In case rx_conf==NULL, the nb_desc should be the max allowed by the driver.
By the way, we should allow nb_desc==0 as it is done in virtio.
Users shouldn't have to care about queue parameters (including nb_desc) for
a basic usage.

> 3. ABI breakage and we (and all customers) will need  to modify each and every RX setup/configure code.
> 
> For me it just seems like too much hassle, without any clear advanatage.

The advantage is to have a cleaner API. Seems important to me.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-24  9:24         ` Thomas Monjalon
@ 2015-07-24 10:50           ` Ananyev, Konstantin
  2015-07-24 12:40             ` Thomas Monjalon
  0 siblings, 1 reply; 29+ messages in thread
From: Ananyev, Konstantin @ 2015-07-24 10:50 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, July 24, 2015 10:24 AM
> To: Ananyev, Konstantin
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
> 
> 2015-07-24 09:15, Ananyev, Konstantin:
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > 2015-07-22 19:28, Konstantin Ananyev:
> > > > +struct rte_eth_rxq_info {
> > > > +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> > > > +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> > > > +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> > > > +	uint16_t nb_desc;           /**< configured number of RXDs. */
> > >
> > > Shouldn't we move nb_desc in rte_eth_rxconf?
> > > So rte_eth_rx_queue_setup() would have less parameters.
> >
> > I thought about that too, but it seems more drawbacks then pluses with that idea:
> > 1. Right now it is possible to call rte_eth_rx_queue_setup(..., rx_conf=NULL, ...);
> > In that case rte_eth_rx_queue_setup()will use default for that device rx_conf.
> > If we'll move mempool into rxconf, will break that ability.
> > 2.  A bit unclear what mempool should be returned as default_rxconf by rte_eth_dev_info_get().
> > Should it be just NULL.
> 
> I was only suggesting to move nb_desc, not mempool.

Ah, sorry didn't read it properly first time.
Yes, I think it makes sense to move nb_desc into rxconf, though that means ABI breakage,
and that patch would definitely not make into 2.1. 

> In case rx_conf==NULL, the nb_desc should be the max allowed by the driver.

In my opinion it should be 'preferable by default' PMD value.
Plus, rte_eth_dev_info should contain  min_rx_desc and max_rx_desc,
so user can select nb_rx_desc from the allowed interval, if he needs to.

Konstantin

> By the way, we should allow nb_desc==0 as it is done in virtio.
> Users shouldn't have to care about queue parameters (including nb_desc) for
> a basic usage.
> 
> > 3. ABI breakage and we (and all customers) will need  to modify each and every RX setup/configure code.
> >
> > For me it just seems like too much hassle, without any clear advanatage.
> 
> The advantage is to have a cleaner API. Seems important to me.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [dpdk-dev] [PATCHv4 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-07-24 10:50           ` Ananyev, Konstantin
@ 2015-07-24 12:40             ` Thomas Monjalon
  0 siblings, 0 replies; 29+ messages in thread
From: Thomas Monjalon @ 2015-07-24 12:40 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev

2015-07-24 10:50, Ananyev, Konstantin:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > 2015-07-24 09:15, Ananyev, Konstantin:
> > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > > 2015-07-22 19:28, Konstantin Ananyev:
> > > > > +struct rte_eth_rxq_info {
> > > > > +	struct rte_mempool *mp;     /**< mempool used by that queue. */
> > > > > +	struct rte_eth_rxconf conf; /**< queue config parameters. */
> > > > > +	uint8_t scattered_rx;       /**< scattered packets RX supported. */
> > > > > +	uint16_t nb_desc;           /**< configured number of RXDs. */
> > > >
> > > > Shouldn't we move nb_desc in rte_eth_rxconf?
> > > > So rte_eth_rx_queue_setup() would have less parameters.
> > >
> > > I thought about that too, but it seems more drawbacks then pluses with that idea:
> > > 1. Right now it is possible to call rte_eth_rx_queue_setup(..., rx_conf=NULL, ...);
> > > In that case rte_eth_rx_queue_setup()will use default for that device rx_conf.
> > > If we'll move mempool into rxconf, will break that ability.
> > > 2.  A bit unclear what mempool should be returned as default_rxconf by rte_eth_dev_info_get().
> > > Should it be just NULL.
> > 
> > I was only suggesting to move nb_desc, not mempool.
> 
> Ah, sorry didn't read it properly first time.
> Yes, I think it makes sense to move nb_desc into rxconf, though that means ABI breakage,
> and that patch would definitely not make into 2.1.

You can avoid ABI breakage by using the compat macros and/or NEXT_ABI.
But it shouldn't go into 2.1 as the API shouldn't be changed after RC1.

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2015-07-24 12:41 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 12:19 [dpdk-dev] [PATCHv3 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 1/5] " Konstantin Ananyev
2015-07-22 16:50   ` Zhang, Helin
2015-07-22 17:00     ` Ananyev, Konstantin
2015-07-22 20:45       ` Thomas Monjalon
2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 0/5] " Konstantin Ananyev
2015-07-23 12:48     ` Thomas Monjalon
2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 1/5] " Konstantin Ananyev
2015-07-22 19:48     ` Stephen Hemminger
2015-07-23 10:52       ` Ananyev, Konstantin
2015-07-23 16:17         ` Thomas Monjalon
2015-07-24  9:05           ` Ananyev, Konstantin
2015-07-23 16:26     ` Thomas Monjalon
2015-07-24  9:15       ` Ananyev, Konstantin
2015-07-24  9:24         ` Thomas Monjalon
2015-07-24 10:50           ` Ananyev, Konstantin
2015-07-24 12:40             ` Thomas Monjalon
2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 3/5] ixgbe: " Konstantin Ananyev
2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 4/5] e1000: " Konstantin Ananyev
2015-07-22 18:28   ` [dpdk-dev] [PATCHv4 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
2015-07-22 17:02   ` Zhang, Helin
2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 3/5] ixgbe: " Konstantin Ananyev
2015-07-22 17:03   ` Zhang, Helin
2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 4/5] e1000: " Konstantin Ananyev
2015-07-22 17:04   ` Zhang, Helin
2015-07-20 12:19 ` [dpdk-dev] [PATCHv3 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
2015-07-22 17:16   ` Zhang, Helin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).