All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information
@ 2015-06-17 16:54 Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 1/5] " Konstantin Ananyev
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-17 16:54 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_(rx|tx)_qinfo_get
  ixgbe: add support for eth_(rx|tx)_qinfo_get
  e1000: add support for eth_(rx|tx)_qinfo_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    | 48 +++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h    | 77 +++++++++++++++++++++++++++++++++++++++-
 16 files changed, 434 insertions(+), 1 deletion(-)

-- 
1.8.5.3

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

* [PATCH 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-17 16:54 [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
@ 2015-06-17 16:54 ` Konstantin Ananyev
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 2/5] i40e: add support for eth_(rx|tx)_qinfo_get Konstantin Ananyev
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-17 16:54 UTC (permalink / raw)
  To: dev

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

Add new structures:
struct rte_eth_rx_qinfo
struct rte_eth_tx_qinfo

new functions:
rte_eth_rx_queue_info_get
rte_eth_tx_queue_info_get

into rte_etdev API.

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

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 48 +++++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h | 77 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e13fde5..6b9a7ef 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3629,6 +3629,54 @@ 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_rx_qinfo *qinfo)
+{
+	struct rte_eth_dev *dev;
+
+	memset(qinfo, 0, sizeof(*qinfo));
+
+	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->rx_qinfo_get, -ENOTSUP);
+	dev->dev_ops->rx_qinfo_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_tx_qinfo *qinfo)
+{
+	struct rte_eth_dev *dev;
+
+	memset(qinfo, 0, sizeof(*qinfo));
+
+	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->tx_qinfo_get, -ENOTSUP);
+	dev->dev_ops->tx_qinfo_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 04c192d..45afdd3 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -942,6 +942,30 @@ struct rte_eth_xstats {
 	uint64_t value;
 };
 
+/**
+ * Ethernet device RX queue information strcuture.
+ * Used to retieve information about configured queue.
+ */
+struct rte_eth_rx_qinfo {
+	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_tx_qinfo {
+	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;
@@ -1045,6 +1069,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);
 /**< @Check DD bit of specific RX descriptor */
 
+typedef void (*eth_rx_qinfo_get_t)(struct rte_eth_dev *dev,
+	uint16_t rx_queue_id, struct rte_eth_rx_qinfo *qinfo);
+
+typedef void (*eth_tx_qinfo_get_t)(struct rte_eth_dev *dev,
+	uint16_t tx_queue_id, struct rte_eth_tx_qinfo *qinfo);
+
 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
 /**< @internal Set MTU. */
 
@@ -1389,8 +1419,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_rx_qinfo_get_t rx_qinfo_get;
+	/**< retrieve RX queue information. */
+	eth_tx_qinfo_get_t tx_qinfo_get;
+	/**< retrieve TX queue information. */
 };
 
 /**
@@ -3616,6 +3651,46 @@ int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
 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_rx_qinfo_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_rx_qinfo *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_tx_qinfo_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_tx_qinfo *qinfo);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.5.3

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

* [PATCH 2/5] i40e: add support for eth_(rx|tx)_qinfo_get
  2015-06-17 16:54 [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 1/5] " Konstantin Ananyev
@ 2015-06-17 16:54 ` Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 3/5] ixgbe: " Konstantin Ananyev
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-17 16:54 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 2ada502..38a05d7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -262,6 +262,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,
+	.rx_qinfo_get                 = i40e_rx_qinfo_get,
+	.tx_qinfo_get                 = i40e_tx_qinfo_get,
 };
 
 static struct eth_driver rte_i40e_pmd = {
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 587ee71..88576b7 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -479,6 +479,11 @@ int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
 			  enum rte_filter_op filter_op,
 			  void *arg);
 
+void i40e_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *qinfo);
+void i40e_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *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 2de0ac4..c471db4 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2706,3 +2706,45 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf)
 
 	return I40E_SUCCESS;
 }
+
+void
+i40e_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *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_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *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.5.3

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

* [PATCH 3/5] ixgbe: add support for eth_(rx|tx)_qinfo_get
  2015-06-17 16:54 [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 1/5] " Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 2/5] i40e: add support for eth_(rx|tx)_qinfo_get Konstantin Ananyev
@ 2015-06-17 16:54 ` Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 4/5] e1000: " Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
  4 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-17 16:54 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 7414a2e..bed33b0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -386,6 +386,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,
+	.rx_qinfo_get         = ixgbe_rx_qinfo_get,
+	.tx_qinfo_get         = ixgbe_tx_qinfo_get,
 };
 
 /*
@@ -412,6 +414,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,
+	.rx_qinfo_get         = ixgbe_rx_qinfo_get,
+	.tx_qinfo_get         = ixgbe_tx_qinfo_get,
 };
 
 /**
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 19237b8..03ac00d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -343,6 +343,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_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *qinfo);
+
+void ixgbe_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *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 4f9ab22..23d7053 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -4501,6 +4501,48 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	return 0;
 }
 
+void
+ixgbe_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *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_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *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.5.3

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

* [PATCH 4/5] e1000: add support for eth_(rx|tx)_qinfo_get
  2015-06-17 16:54 [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
                   ` (2 preceding siblings ...)
  2015-06-17 16:54 ` [PATCH 3/5] ixgbe: " Konstantin Ananyev
@ 2015-06-17 16:54 ` Konstantin Ananyev
  2015-06-17 16:54 ` [PATCH 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
  4 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-17 16:54 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 c451faa..6001066 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -302,6 +302,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_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *qinfo);
+
+void igb_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *qinfo);
+
 /*
  * RX/TX EM function prototypes
  */
@@ -337,4 +343,10 @@ 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_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *qinfo);
+
+void em_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *qinfo);
+
 #endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index a306c55..d9188a4 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,
+	.rx_qinfo_get         = em_rx_qinfo_get,
+	.tx_qinfo_get         = em_tx_qinfo_get,
 };
 
 /**
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index fdc825f..39d6b25 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1862,3 +1862,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_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *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_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *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 24c7510..1e11918 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -274,6 +274,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,
+	.rx_qinfo_get         = igb_rx_qinfo_get,
+	.tx_qinfo_get         = igb_tx_qinfo_get,
 };
 
 /*
@@ -295,6 +297,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,
+	.rx_qinfo_get         = igb_rx_qinfo_get,
+	.tx_qinfo_get         = igb_tx_qinfo_get,
 };
 
 /**
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 43d6703..48d58f6 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -2394,3 +2394,39 @@ eth_igbvf_tx_init(struct rte_eth_dev *dev)
 	}
 
 }
+
+void
+igb_rx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rx_qinfo *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_tx_qinfo_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_tx_qinfo *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.5.3

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

* [PATCH 5/5] testpmd: add new command to display RX/TX queue information
  2015-06-17 16:54 [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
                   ` (3 preceding siblings ...)
  2015-06-17 16:54 ` [PATCH 4/5] e1000: " Konstantin Ananyev
@ 2015-06-17 16:54 ` Konstantin Ananyev
  4 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-17 16:54 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 8142910..a178801 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5235,6 +5235,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;
@@ -8793,6 +8840,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 52917c7..8bfacdb 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_rx_qinfo 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_tx_qinfo 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 f2c84d9..bcbb632 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -476,6 +476,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.5.3

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

* [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-17 16:54 ` [PATCH 1/5] " Konstantin Ananyev
@ 2015-06-18 13:18   ` Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 1/5] " Konstantin Ananyev
                       ` (8 more replies)
  0 siblings, 9 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-18 13:18 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    | 77 +++++++++++++++++++++++++++++++++++++++-
 16 files changed, 440 insertions(+), 1 deletion(-)

-- 
1.8.5.3

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

* [PATCHv2 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
@ 2015-06-18 13:18     ` Konstantin Ananyev
  2015-07-20  0:12       ` Thomas Monjalon
  2015-06-18 13:18     ` [PATCHv2 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
                       ` (7 subsequent siblings)
  8 siblings, 1 reply; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-18 13:18 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'

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 54 ++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.h | 77 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 130 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index e13fde5..7dfe72a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3629,6 +3629,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 04c192d..5dd4c01 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -942,6 +942,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;
@@ -1045,6 +1069,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);
 /**< @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. */
 
@@ -1389,8 +1419,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. */
 };
 
 /**
@@ -3616,6 +3651,46 @@ int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
 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);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.8.5.3

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

* [PATCHv2 2/5] i40e: add support for eth_(rxq|txq)_info_get
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 1/5] " Konstantin Ananyev
@ 2015-06-18 13:18     ` Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 3/5] ixgbe: " Konstantin Ananyev
                       ` (6 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-18 13:18 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 2ada502..c691fd6 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -262,6 +262,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,
 };
 
 static struct eth_driver rte_i40e_pmd = {
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 587ee71..c012cda 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -479,6 +479,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 2de0ac4..e31b99d 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2706,3 +2706,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.5.3

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

* [PATCHv2 3/5] ixgbe: add support for eth_(rxq|txq)_info_get
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 1/5] " Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
@ 2015-06-18 13:18     ` Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 4/5] e1000: " Konstantin Ananyev
                       ` (5 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-18 13:18 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 7414a2e..99eaf26 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -386,6 +386,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,
 };
 
 /*
@@ -412,6 +414,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,
 };
 
 /**
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 19237b8..25d76d2 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -343,6 +343,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 4f9ab22..68ebc52 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -4501,6 +4501,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.5.3

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

* [PATCHv2 4/5] e1000: add support for eth_(rxq|txq)_info_get
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
                       ` (2 preceding siblings ...)
  2015-06-18 13:18     ` [PATCHv2 3/5] ixgbe: " Konstantin Ananyev
@ 2015-06-18 13:18     ` Konstantin Ananyev
  2015-06-18 13:18     ` [PATCHv2 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
                       ` (4 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-18 13:18 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 c451faa..57a4017 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -302,6 +302,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
  */
@@ -337,4 +343,10 @@ 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);
+
 #endif /* _E1000_ETHDEV_H_ */
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index a306c55..1b6d2d0 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 fdc825f..fc1c5f2 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1862,3 +1862,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 24c7510..92ef01e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -274,6 +274,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,
 };
 
 /*
@@ -295,6 +297,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,
 };
 
 /**
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 43d6703..704d414 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -2394,3 +2394,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.5.3

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

* [PATCHv2 5/5] testpmd: add new command to display RX/TX queue information
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
                       ` (3 preceding siblings ...)
  2015-06-18 13:18     ` [PATCHv2 4/5] e1000: " Konstantin Ananyev
@ 2015-06-18 13:18     ` Konstantin Ananyev
  2015-06-18 13:30     ` [PATCHv2 0/5] ethdev: add new API to retrieve " Walukiewicz, Miroslaw
                       ` (3 subsequent siblings)
  8 siblings, 0 replies; 23+ messages in thread
From: Konstantin Ananyev @ 2015-06-18 13:18 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 8142910..a178801 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -5235,6 +5235,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;
@@ -8793,6 +8840,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 52917c7..5f76740 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 f2c84d9..bcbb632 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -476,6 +476,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.5.3

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
                       ` (4 preceding siblings ...)
  2015-06-18 13:18     ` [PATCHv2 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
@ 2015-06-18 13:30     ` Walukiewicz, Miroslaw
  2015-06-18 13:39       ` Bruce Richardson
  2015-06-18 14:17       ` Ananyev, Konstantin
  2015-06-18 13:58     ` Bruce Richardson
                       ` (2 subsequent siblings)
  8 siblings, 2 replies; 23+ messages in thread
From: Walukiewicz, Miroslaw @ 2015-06-18 13:30 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev@dpdk.org

Konstantin, 

Is there a possibility to read information about available space in NIC queue for TX.

It is quite easy to compute (or even available directly)  and very useful especially for application sending multi-descriptor packets like TCP TSO. 

Now there is no access to such information and the transmit packet function must be called to 
be sure that there is available space.

Mirek

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Thursday, June 18, 2015 3:19 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> queue information
> 
> 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    | 77
> +++++++++++++++++++++++++++++++++++++++-
>  16 files changed, 440 insertions(+), 1 deletion(-)
> 
> --
> 1.8.5.3

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:30     ` [PATCHv2 0/5] ethdev: add new API to retrieve " Walukiewicz, Miroslaw
@ 2015-06-18 13:39       ` Bruce Richardson
  2015-06-18 13:56         ` Walukiewicz, Miroslaw
  2015-06-18 14:17       ` Ananyev, Konstantin
  1 sibling, 1 reply; 23+ messages in thread
From: Bruce Richardson @ 2015-06-18 13:39 UTC (permalink / raw)
  To: Walukiewicz, Miroslaw; +Cc: dev@dpdk.org

On Thu, Jun 18, 2015 at 01:30:33PM +0000, Walukiewicz, Miroslaw wrote:
> Konstantin, 
> 
> Is there a possibility to read information about available space in NIC queue for TX.
> 
> It is quite easy to compute (or even available directly)  and very useful especially for application sending multi-descriptor packets like TCP TSO. 
> 
> Now there is no access to such information and the transmit packet function must be called to 
> be sure that there is available space.
> 
> Mirek
> 

Hi Mirek,

I'm not sure this function is the right place for such a query. It seems that
a function like you require needs to be used on the datapath, while this API
is not planned to be high-performance. I think that it might be better to
add an equivalent function to the existing RX descriptor querying function.

/Bruce

> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> > Sent: Thursday, June 18, 2015 3:19 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> > queue information
> > 
> > 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    | 77
> > +++++++++++++++++++++++++++++++++++++++-
> >  16 files changed, 440 insertions(+), 1 deletion(-)
> > 
> > --
> > 1.8.5.3
> 

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:39       ` Bruce Richardson
@ 2015-06-18 13:56         ` Walukiewicz, Miroslaw
  2015-06-18 14:13           ` Bruce Richardson
  0 siblings, 1 reply; 23+ messages in thread
From: Walukiewicz, Miroslaw @ 2015-06-18 13:56 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev@dpdk.org

Yes, really I need a high performance function - it is especially useful on TX path.

Which queue query function are you talking here to be enhanced?

Mirek

> -----Original Message-----
> From: Richardson, Bruce
> Sent: Thursday, June 18, 2015 3:39 PM
> To: Walukiewicz, Miroslaw
> Cc: Ananyev, Konstantin; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> queue information
> 
> On Thu, Jun 18, 2015 at 01:30:33PM +0000, Walukiewicz, Miroslaw wrote:
> > Konstantin,
> >
> > Is there a possibility to read information about available space in NIC queue
> for TX.
> >
> > It is quite easy to compute (or even available directly)  and very useful
> especially for application sending multi-descriptor packets like TCP TSO.
> >
> > Now there is no access to such information and the transmit packet function
> must be called to
> > be sure that there is available space.
> >
> > Mirek
> >
> 
> Hi Mirek,
> 
> I'm not sure this function is the right place for such a query. It seems that
> a function like you require needs to be used on the datapath, while this API
> is not planned to be high-performance. I think that it might be better to
> add an equivalent function to the existing RX descriptor querying function.
> 
> /Bruce
> 
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin
> Ananyev
> > > Sent: Thursday, June 18, 2015 3:19 PM
> > > To: dev@dpdk.org
> > > Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> > > queue information
> > >
> > > 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    | 77
> > > +++++++++++++++++++++++++++++++++++++++-
> > >  16 files changed, 440 insertions(+), 1 deletion(-)
> > >
> > > --
> > > 1.8.5.3
> >

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
                       ` (5 preceding siblings ...)
  2015-06-18 13:30     ` [PATCHv2 0/5] ethdev: add new API to retrieve " Walukiewicz, Miroslaw
@ 2015-06-18 13:58     ` Bruce Richardson
  2015-06-19  3:18     ` Zhang, Helin
  2015-06-23 12:35     ` David Harton (dharton)
  8 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2015-06-18 13:58 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

On Thu, Jun 18, 2015 at 02:18:43PM +0100, Konstantin Ananyev wrote:
> 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    | 77 +++++++++++++++++++++++++++++++++++++++-
>  16 files changed, 440 insertions(+), 1 deletion(-)
> 
> -- 
> 1.8.5.3
> 
Series Acked-by: Bruce Richardson <bruce.richardson@intel.com>

BTW: I'm sure there are plenty of possible suggestions for extensions to these 
functions, but rather than constantly doing new versions to keep adding things
in, can we get the base functionality applied and add in the new info later -
as separate patches? There is space in the structs for more info without 
affecting the ABI.

Regards,
/Bruce

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:56         ` Walukiewicz, Miroslaw
@ 2015-06-18 14:13           ` Bruce Richardson
  0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2015-06-18 14:13 UTC (permalink / raw)
  To: Walukiewicz, Miroslaw; +Cc: dev@dpdk.org

On Thu, Jun 18, 2015 at 02:56:52PM +0100, Walukiewicz, Miroslaw wrote:
> Yes, really I need a high performance function - it is especially useful on TX path.
> 
> Which queue query function are you talking here to be enhanced?
> 

There are already functions for querying the RX queue - so as to enable power
management/frequency scaling.

rte_eth_rx_queue_count()
rte_eth_rX_descriptor_done()

You could write equivalents for the TX side that only do the minimum needed.
Descriptor-done is probably the simplest and most useful for you, as in you can
query if you have enough space for a single operation, rather than having the
code scan arbitrarily far ahead.

/Bruce

> Mirek
> 
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Thursday, June 18, 2015 3:39 PM
> > To: Walukiewicz, Miroslaw
> > Cc: Ananyev, Konstantin; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> > queue information
> > 
> > On Thu, Jun 18, 2015 at 01:30:33PM +0000, Walukiewicz, Miroslaw wrote:
> > > Konstantin,
> > >
> > > Is there a possibility to read information about available space in NIC queue
> > for TX.
> > >
> > > It is quite easy to compute (or even available directly)  and very useful
> > especially for application sending multi-descriptor packets like TCP TSO.
> > >
> > > Now there is no access to such information and the transmit packet function
> > must be called to
> > > be sure that there is available space.
> > >
> > > Mirek
> > >
> > 
> > Hi Mirek,
> > 
> > I'm not sure this function is the right place for such a query. It seems that
> > a function like you require needs to be used on the datapath, while this API
> > is not planned to be high-performance. I think that it might be better to
> > add an equivalent function to the existing RX descriptor querying function.
> > 
> > /Bruce
> > 
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin
> > Ananyev
> > > > Sent: Thursday, June 18, 2015 3:19 PM
> > > > To: dev@dpdk.org
> > > > Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> > > > queue information
> > > >
> > > > 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    | 77
> > > > +++++++++++++++++++++++++++++++++++++++-
> > > >  16 files changed, 440 insertions(+), 1 deletion(-)
> > > >
> > > > --
> > > > 1.8.5.3
> > >

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:30     ` [PATCHv2 0/5] ethdev: add new API to retrieve " Walukiewicz, Miroslaw
  2015-06-18 13:39       ` Bruce Richardson
@ 2015-06-18 14:17       ` Ananyev, Konstantin
  2015-06-18 14:37         ` Walukiewicz, Miroslaw
  1 sibling, 1 reply; 23+ messages in thread
From: Ananyev, Konstantin @ 2015-06-18 14:17 UTC (permalink / raw)
  To: Walukiewicz, Miroslaw, dev@dpdk.org

Hi Mirek,

> -----Original Message-----
> From: Walukiewicz, Miroslaw
> Sent: Thursday, June 18, 2015 2:31 PM
> To: Ananyev, Konstantin; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
> 
> Konstantin,
> 
> Is there a possibility to read information about available space in NIC queue for TX.

I suppose it is possible as some future addition.
As I said in the commit message, I left some reserved space, so extra fields could be added to the structure without ABI breakage.
For now, I just added some static/config information for the queue, but I think it is possible and plausible to have some runtime information too.

> 
> It is quite easy to compute (or even available directly)  and very useful especially for application sending multi-descriptor packets like
> TCP TSO.
> 
> Now there is no access to such information and the transmit packet function must be called to
> be sure that there is available space.

Hmm, as I said I was thinking about adding some RT information in future:
number of free descriptors (from SW point of view), index of next descriptor to process by SW, etc.
But my thought it would be use by some watchdog thread to collect statistics/detect stall, etc.
I didn't intend it to be used by IO thread. 

I am not sure why do you need to call such function at RT?
PMD wouldn't TX a packet, if there is not enough free TXDs for the whole packet.
>From other side upper layer, can't always calculate correctly how many TXD it would really need
(context descriptors might be needed, etc).
 Plus, even if nb_tx_free==X, in reality it could be there much more free TXDs, and SW just need
to process them (and would do that at next  tx_burst() call.
So, why just not:
...
n = tx_burst(..., nb_tx);
if (n < nb_tx) {requeue unsent of packets;}
?

Konstantin

> 
> Mirek
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> > Sent: Thursday, June 18, 2015 3:19 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> > queue information
> >
> > 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    | 77
> > +++++++++++++++++++++++++++++++++++++++-
> >  16 files changed, 440 insertions(+), 1 deletion(-)
> >
> > --
> > 1.8.5.3

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 14:17       ` Ananyev, Konstantin
@ 2015-06-18 14:37         ` Walukiewicz, Miroslaw
  0 siblings, 0 replies; 23+ messages in thread
From: Walukiewicz, Miroslaw @ 2015-06-18 14:37 UTC (permalink / raw)
  To: Ananyev, Konstantin, dev@dpdk.org



> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Thursday, June 18, 2015 4:17 PM
> To: Walukiewicz, Miroslaw; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> queue information
> 
> Hi Mirek,
> 
> > -----Original Message-----
> > From: Walukiewicz, Miroslaw
> > Sent: Thursday, June 18, 2015 2:31 PM
> > To: Ananyev, Konstantin; dev@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve
> RX/TX queue information
> >
> > Konstantin,
> >
> > Is there a possibility to read information about available space in NIC queue
> for TX.
> 
> I suppose it is possible as some future addition.
> As I said in the commit message, I left some reserved space, so extra fields
> could be added to the structure without ABI breakage.
> For now, I just added some static/config information for the queue, but I think
> it is possible and plausible to have some runtime information too.
> 
> >
> > It is quite easy to compute (or even available directly)  and very useful
> especially for application sending multi-descriptor packets like
> > TCP TSO.
> >
> > Now there is no access to such information and the transmit packet function
> must be called to
> > be sure that there is available space.
> 
> Hmm, as I said I was thinking about adding some RT information in future:
> number of free descriptors (from SW point of view), index of next descriptor
> to process by SW, etc.
> But my thought it would be use by some watchdog thread to collect
> statistics/detect stall, etc.
> I didn't intend it to be used by IO thread.
> 
> I am not sure why do you need to call such function at RT?
> PMD wouldn't TX a packet, if there is not enough free TXDs for the whole
> packet.
> From other side upper layer, can't always calculate correctly how many TXD it
> would really need
> (context descriptors might be needed, etc).
>  Plus, even if nb_tx_free==X, in reality it could be there much more free
> TXDs, and SW just need
> to process them (and would do that at next  tx_burst() call.
> So, why just not:
> ...
> n = tx_burst(..., nb_tx);
> if (n < nb_tx) {requeue unsent of packets;}
> ?
> 
The case is TCP TSO operation as I said.

I really use the that method proposed by you but it very expensive way.

The TX path in TCP is very complex and expensive. 
It is desirable to create the TCP TSO segments that fits the space in queue to avoid re-queue  of packets 
making the TX path much more complex. 
For ixgbe the TSO segments are up to 40 descriptors (max 64K of data) and making the TX queue full is just simple.

Having the possibility for reading number of descriptors available to send can improve TCP TX process in the way 
that when there is no space in TX queue we can just not enter the complex TX path and spent time making more 
useful job than re-queue.
Also It is easy to fit the TSO segment to available space in TX queue instead of sending always a large 64K TCP segments 
and count on the result of tx_burst and re-queue in case of lack of space.

Mirek

> Konstantin
> 
> >
> > Mirek
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin
> Ananyev
> > > Sent: Thursday, June 18, 2015 3:19 PM
> > > To: dev@dpdk.org
> > > Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> > > queue information
> > >
> > > 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    | 77
> > > +++++++++++++++++++++++++++++++++++++++-
> > >  16 files changed, 440 insertions(+), 1 deletion(-)
> > >
> > > --
> > > 1.8.5.3

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
                       ` (6 preceding siblings ...)
  2015-06-18 13:58     ` Bruce Richardson
@ 2015-06-19  3:18     ` Zhang, Helin
  2015-06-23 12:35     ` David Harton (dharton)
  8 siblings, 0 replies; 23+ messages in thread
From: Zhang, Helin @ 2015-06-19  3:18 UTC (permalink / raw)
  To: Ananyev, Konstantin; +Cc: dev@dpdk.org

Acked-by: Helin Zhang <helin.zhang@intel.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Thursday, June 18, 2015 9:19 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue
> information
> 
> 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    | 77
> +++++++++++++++++++++++++++++++++++++++-
>  16 files changed, 440 insertions(+), 1 deletion(-)
> 
> --
> 1.8.5.3

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

* Re: [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
                       ` (7 preceding siblings ...)
  2015-06-19  3:18     ` Zhang, Helin
@ 2015-06-23 12:35     ` David Harton (dharton)
  8 siblings, 0 replies; 23+ messages in thread
From: David Harton (dharton) @ 2015-06-23 12:35 UTC (permalink / raw)
  To: Konstantin Ananyev, dev@dpdk.org

Acked-by: David Harton <dharton@cisco.com>


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Thursday, June 18, 2015 9:19 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCHv2 0/5] ethdev: add new API to retrieve RX/TX
> queue information
> 
> 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    | 77
> +++++++++++++++++++++++++++++++++++++++-
>  16 files changed, 440 insertions(+), 1 deletion(-)
> 
> --
> 1.8.5.3

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

* Re: [PATCHv2 1/5] ethdev: add new API to retrieve RX/TX queue information
  2015-06-18 13:18     ` [PATCHv2 1/5] " Konstantin Ananyev
@ 2015-07-20  0:12       ` Thomas Monjalon
  2015-07-20  9:52         ` Ananyev, Konstantin
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2015-07-20  0:12 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

2015-06-18 14:18, Konstantin Ananyev:
> new functions:
> rte_eth_rx_queue_info_get
> rte_eth_tx_queue_info_get
> 
> into rte_etdev API.
[...]
>  lib/librte_ether/rte_ethdev.c | 54 ++++++++++++++++++++++++++++++
>  lib/librte_ether/rte_ethdev.h | 77 ++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 130 insertions(+), 1 deletion(-)
[...]
>  int
> +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> +	struct rte_eth_rxq_info *qinfo)
> +{
[...]
> +int
> +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> +	struct rte_eth_txq_info *qinfo)
> +{

These new functions are not declared in the .map file.

config.o: In function `rx_queue_infos_display':
config.c:(.text+0x11e): undefined reference to `rte_eth_rx_queue_info_get'
config.o: In function `tx_queue_infos_display':
config.c:(.text+0x2be): undefined reference to `rte_eth_tx_queue_info_get'

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

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



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, July 20, 2015 1:13 AM
> To: Ananyev, Konstantin
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCHv2 1/5] ethdev: add new API to retrieve RX/TX queue information
> 
> 2015-06-18 14:18, Konstantin Ananyev:
> > new functions:
> > rte_eth_rx_queue_info_get
> > rte_eth_tx_queue_info_get
> >
> > into rte_etdev API.
> [...]
> >  lib/librte_ether/rte_ethdev.c | 54 ++++++++++++++++++++++++++++++
> >  lib/librte_ether/rte_ethdev.h | 77 ++++++++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 130 insertions(+), 1 deletion(-)
> [...]
> >  int
> > +rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +	struct rte_eth_rxq_info *qinfo)
> > +{
> [...]
> > +int
> > +rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
> > +	struct rte_eth_txq_info *qinfo)
> > +{
> 
> These new functions are not declared in the .map file.
> 
> config.o: In function `rx_queue_infos_display':
> config.c:(.text+0x11e): undefined reference to `rte_eth_rx_queue_info_get'
> config.o: In function `tx_queue_infos_display':
> config.c:(.text+0x2be): undefined reference to `rte_eth_tx_queue_info_get'


Ah yes, lost it somewhere between re-versioning.
Will re-send v3.
Thanks
Konstantin

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

end of thread, other threads:[~2015-07-20  9:52 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 16:54 [PATCH 0/5] ethdev: add new API to retrieve RX/TX queue information Konstantin Ananyev
2015-06-17 16:54 ` [PATCH 1/5] " Konstantin Ananyev
2015-06-18 13:18   ` [PATCHv2 0/5] " Konstantin Ananyev
2015-06-18 13:18     ` [PATCHv2 1/5] " Konstantin Ananyev
2015-07-20  0:12       ` Thomas Monjalon
2015-07-20  9:52         ` Ananyev, Konstantin
2015-06-18 13:18     ` [PATCHv2 2/5] i40e: add support for eth_(rxq|txq)_info_get Konstantin Ananyev
2015-06-18 13:18     ` [PATCHv2 3/5] ixgbe: " Konstantin Ananyev
2015-06-18 13:18     ` [PATCHv2 4/5] e1000: " Konstantin Ananyev
2015-06-18 13:18     ` [PATCHv2 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev
2015-06-18 13:30     ` [PATCHv2 0/5] ethdev: add new API to retrieve " Walukiewicz, Miroslaw
2015-06-18 13:39       ` Bruce Richardson
2015-06-18 13:56         ` Walukiewicz, Miroslaw
2015-06-18 14:13           ` Bruce Richardson
2015-06-18 14:17       ` Ananyev, Konstantin
2015-06-18 14:37         ` Walukiewicz, Miroslaw
2015-06-18 13:58     ` Bruce Richardson
2015-06-19  3:18     ` Zhang, Helin
2015-06-23 12:35     ` David Harton (dharton)
2015-06-17 16:54 ` [PATCH 2/5] i40e: add support for eth_(rx|tx)_qinfo_get Konstantin Ananyev
2015-06-17 16:54 ` [PATCH 3/5] ixgbe: " Konstantin Ananyev
2015-06-17 16:54 ` [PATCH 4/5] e1000: " Konstantin Ananyev
2015-06-17 16:54 ` [PATCH 5/5] testpmd: add new command to display RX/TX queue information Konstantin Ananyev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.