DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC v3 0/4] get Rx/Tx packet burst mode information
@ 2019-09-10 16:33 Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 1/4] ethdev: add the API for getting " Haiyue Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Haiyue Wang @ 2019-09-10 16:33 UTC (permalink / raw)
  To: dev, ferruh.yigit, mdr, chenmin.sun; +Cc: Haiyue Wang

v1 -> v2: 
Avoid ABI breaking, add a simple trace API to export string type
information.

v2 -> v3:
Use bit fields to present the burst mode setting, and rename the
APIs.

Haiyue Wang (4):
  ethdev: add the API for getting burst mode information
  net/i40e: support to get the Rx/Tx burst mode
  net/ice: support to get the Rx/Tx burst mode
  app/testpmd: show the Rx/Tx burst mode description

 app/test-pmd/config.c                    | 25 ++++++++
 doc/guides/rel_notes/release_19_11.rst   |  8 +++
 drivers/net/i40e/i40e_ethdev.c           |  2 +
 drivers/net/i40e/i40e_ethdev.h           |  4 ++
 drivers/net/i40e/i40e_rxtx.c             | 72 +++++++++++++++++++++
 drivers/net/ice/ice_ethdev.c             |  2 +
 drivers/net/ice/ice_rxtx.c               | 54 ++++++++++++++++
 drivers/net/ice/ice_rxtx.h               |  4 ++
 lib/librte_ethdev/rte_ethdev.c           | 75 ++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h           | 82 ++++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev_core.h      |  5 ++
 lib/librte_ethdev/rte_ethdev_version.map |  5 ++
 12 files changed, 338 insertions(+)

-- 
2.17.1


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

* [dpdk-dev] [RFC v3 1/4] ethdev: add the API for getting burst mode information
  2019-09-10 16:33 [dpdk-dev] [RFC v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
@ 2019-09-10 16:33 ` Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 2/4] net/i40e: support to get the Rx/Tx burst mode Haiyue Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Haiyue Wang @ 2019-09-10 16:33 UTC (permalink / raw)
  To: dev, ferruh.yigit, mdr, chenmin.sun; +Cc: Haiyue Wang

Some PMDs have more than one RX/TX burst paths, add the ethdev API
that allows an application to retrieve the mode information about
Rx/Tx packet burst such as Scalar or Vector, and Vector technology
like AVX2.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 doc/guides/rel_notes/release_19_11.rst   |  8 +++
 lib/librte_ethdev/rte_ethdev.c           | 75 ++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h           | 82 ++++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev_core.h      |  5 ++
 lib/librte_ethdev/rte_ethdev_version.map |  5 ++
 5 files changed, 175 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 27cfbd9e3..1d80e50fb 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -56,6 +56,14 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added RX/TX packet burst mode get API.**
+
+  Added two new functions ``rte_eth_rx_burst_mode_get`` and
+  ``rte_eth_tx_burst_mode_get`` that allow an application
+  to retrieve the mode information about RX/TX packet burst
+  such as Scalar or Vector, and Vector technology like AVX2.
+  Another new function ``rte_eth_burst_mode_option_name`` is
+  provided for burst mode options stringification.
 
 Removed Items
 -------------
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 17d183e1f..aac0a81e9 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -4082,6 +4082,81 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 	return 0;
 }
 
+int
+rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
+			  struct rte_eth_burst_mode *mode)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	if (mode == NULL)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port_id];
+
+	if (queue_id >= dev->data->nb_rx_queues) {
+		RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id);
+		return -EINVAL;
+	}
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
+
+	memset(mode, 0, sizeof(*mode));
+	dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode);
+
+	return 0;
+}
+
+int
+rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
+			  struct rte_eth_burst_mode *mode)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	if (mode == NULL)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port_id];
+
+	if (queue_id >= dev->data->nb_tx_queues) {
+		RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id);
+		return -EINVAL;
+	}
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
+
+	memset(mode, 0, sizeof(*mode));
+	dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode);
+
+	return 0;
+}
+
+const char *
+rte_eth_burst_mode_option_name(uint64_t option)
+{
+	switch (option) {
+	case RTE_ETH_BURST_SCALAR: return "Scalar";
+	case RTE_ETH_BURST_VECTOR: return "Vector";
+
+	case RTE_ETH_BURST_ALTIVEC: return "AltiVec";
+	case RTE_ETH_BURST_NEON: return "Neon";
+	case RTE_ETH_BURST_SSE: return "SSE";
+	case RTE_ETH_BURST_AVX2: return "AVX2";
+	case RTE_ETH_BURST_AVX512: return "AVX512";
+
+	case RTE_ETH_BURST_SCATTERED: return "Scattered";
+	case RTE_ETH_BURST_BULK_ALLOC: return "Bulk Alloc";
+	case RTE_ETH_BURST_SIMPLE: return "Simple";
+
+	case RTE_ETH_BURST_PER_QUEUE: return "Per Queue";
+	}
+
+	return "";
+}
+
 int
 rte_eth_dev_set_mc_addr_list(uint16_t port_id,
 			     struct rte_ether_addr *mc_addr_set,
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index d9871782e..1c5c23160 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1212,6 +1212,32 @@ struct rte_eth_txq_info {
 	uint16_t nb_desc;           /**< configured number of TXDs. */
 } __rte_cache_min_aligned;
 
+enum rte_eth_burst_mode_option {
+	RTE_ETH_BURST_SCALAR = (1 << 0),
+	RTE_ETH_BURST_VECTOR = (1 << 1),
+
+	/**< bits[15:2] are reserved for each vector type */
+	RTE_ETH_BURST_ALTIVEC = (1 << 2),
+	RTE_ETH_BURST_NEON = (1 << 3),
+	RTE_ETH_BURST_SSE = (1 << 4),
+	RTE_ETH_BURST_AVX2 = (1 << 5),
+	RTE_ETH_BURST_AVX512 = (1 << 6),
+
+	RTE_ETH_BURST_SCATTERED = (1 << 16), /**< Support scattered packets */
+	RTE_ETH_BURST_BULK_ALLOC = (1 << 17), /**< Support mbuf bulk alloc */
+	RTE_ETH_BURST_SIMPLE = (1 << 18),
+
+	RTE_ETH_BURST_PER_QUEUE = (1 << 19), /**< Support per queue burst */
+};
+
+/**
+ * Ethernet device RX/TX queue packet burst mode information structure.
+ * Used to retrieve information about packet burst mode setting.
+ */
+struct rte_eth_burst_mode {
+	uint64_t options;
+};
+
 /** Maximum name length for extended statistics counters */
 #define RTE_ETH_XSTATS_NAME_SIZE 64
 
@@ -3556,6 +3582,62 @@ int rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo);
 
+/**
+ * Retrieve information about the Rx packet burst mode.
+ *
+ * @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 mode
+ *   A pointer to a structure of type *rte_eth_burst_mode* to be filled
+ *   with the information of the packet burst mode.
+ *
+ * @return
+ *   - 0: Success
+ *   - -ENOTSUP: routine is not supported by the device PMD.
+ *   - -EINVAL:  The port_id or the queue_id is out of range.
+ */
+__rte_experimental
+int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
+	struct rte_eth_burst_mode *mode);
+
+/**
+ * Retrieve information about the Tx packet burst mode.
+ *
+ * @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 mode
+ *   A pointer to a structure of type *rte_eth_burst_mode* to be filled
+ *   with the information of the packet burst mode.
+ *
+ * @return
+ *   - 0: Success
+ *   - -ENOTSUP: routine is not supported by the device PMD.
+ *   - -EINVAL:  The port_id or the queue_id is out of range.
+ */
+__rte_experimental
+int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
+	struct rte_eth_burst_mode *mode);
+
+/**
+ * Retrieve name about burst mode option.
+ *
+ * @param mode
+ *   The burst mode option of type *rte_eth_burst_mode_option*.
+ *
+ * @return
+ *   - "": Not found
+ *   - "xxx": name of the mode option.
+ */
+__rte_experimental
+const char *
+rte_eth_burst_mode_option_name(uint64_t option);
+
 /**
  * Retrieve device registers and register attributes (number of registers and
  * register size)
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 2922d5b7c..f28c3da8e 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -170,6 +170,9 @@ typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
 	uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
 
+typedef void (*eth_burst_mode_get_t)(struct rte_eth_dev *dev,
+	uint16_t queue_id, struct rte_eth_burst_mode *mode);
+
 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
 /**< @internal Set MTU. */
 
@@ -418,6 +421,8 @@ struct eth_dev_ops {
 	eth_dev_infos_get_t        dev_infos_get; /**< Get device info. */
 	eth_rxq_info_get_t         rxq_info_get; /**< retrieve RX queue information. */
 	eth_txq_info_get_t         txq_info_get; /**< retrieve TX queue information. */
+	eth_burst_mode_get_t       rx_burst_mode_get; /**< Get RX burst mode */
+	eth_burst_mode_get_t       tx_burst_mode_get; /**< Get TX burst mode */
 	eth_fw_version_get_t       fw_version_get; /**< Get firmware version. */
 	eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
 	/**< Get packet types supported and identified by device. */
diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map
index 6df42a47b..e59d51648 100644
--- a/lib/librte_ethdev/rte_ethdev_version.map
+++ b/lib/librte_ethdev/rte_ethdev_version.map
@@ -283,4 +283,9 @@ EXPERIMENTAL {
 
 	# added in 19.08
 	rte_eth_read_clock;
+
+	# added in 19.11
+	rte_eth_rx_burst_mode_get;
+	rte_eth_tx_burst_mode_get;
+	rte_eth_burst_mode_option_name;
 };
-- 
2.17.1


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

* [dpdk-dev] [RFC v3 2/4] net/i40e: support to get the Rx/Tx burst mode
  2019-09-10 16:33 [dpdk-dev] [RFC v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 1/4] ethdev: add the API for getting " Haiyue Wang
@ 2019-09-10 16:33 ` Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 3/4] net/ice: " Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Haiyue Wang @ 2019-09-10 16:33 UTC (permalink / raw)
  To: dev, ferruh.yigit, mdr, chenmin.sun; +Cc: Haiyue Wang

According to the selected Rx/Tx burst function name, retrieve the
related burst mode options.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c |  2 +
 drivers/net/i40e/i40e_ethdev.h |  4 ++
 drivers/net/i40e/i40e_rxtx.c   | 72 ++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4e40b7ab5..41296da01 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -491,6 +491,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.filter_ctrl                  = i40e_dev_filter_ctrl,
 	.rxq_info_get                 = i40e_rxq_info_get,
 	.txq_info_get                 = i40e_txq_info_get,
+	.rx_burst_mode_get            = i40e_rx_burst_mode_get,
+	.tx_burst_mode_get            = i40e_tx_burst_mode_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 38ac3ead6..3eb1b3780 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1177,6 +1177,10 @@ 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);
+void i40e_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			    struct rte_eth_burst_mode *mode);
+void i40e_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			    struct rte_eth_burst_mode *mode);
 struct i40e_ethertype_filter *
 i40e_sw_ethertype_filter_lookup(struct i40e_ethertype_rule *ethertype_rule,
 			const struct i40e_ethertype_filter_input *input);
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 692c3bab4..d27a0bc87 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3028,6 +3028,49 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
 	}
 }
 
+void
+i40e_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+	eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
+	uint64_t options;
+
+	if (pkt_burst == i40e_recv_scattered_pkts)
+		options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == i40e_recv_pkts_bulk_alloc)
+		options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_BULK_ALLOC;
+	else if (pkt_burst == i40e_recv_pkts)
+		options = RTE_ETH_BURST_SCALAR;
+#ifdef RTE_ARCH_X86
+	else if (pkt_burst == i40e_recv_scattered_pkts_vec_avx2)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2 |
+			  RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == i40e_recv_pkts_vec_avx2)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2;
+	else if (pkt_burst == i40e_recv_scattered_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE |
+			  RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == i40e_recv_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE;
+#elif defined(RTE_ARCH_ARM64)
+	else if (pkt_burst == i40e_recv_scattered_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON |
+			  RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == i40e_recv_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON;
+#elif defined(RTE_ARCH_PPC_64)
+	else if (pkt_burst == i40e_recv_scattered_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC |
+			  RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == i40e_recv_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC;
+#endif
+	else
+		options = 0;
+
+	mode->options = options;
+}
+
 void __attribute__((cold))
 i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq)
 {
@@ -3121,6 +3164,35 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
 	}
 }
 
+void
+i40e_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+	eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
+	uint64_t options;
+
+	if (pkt_burst == i40e_xmit_pkts_simple)
+		options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SIMPLE;
+	else if (pkt_burst == i40e_xmit_pkts)
+		options = RTE_ETH_BURST_SCALAR;
+#ifdef RTE_ARCH_X86
+	else if (pkt_burst == i40e_xmit_pkts_vec_avx2)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2;
+	else if (pkt_burst == i40e_xmit_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE;
+#elif defined(RTE_ARCH_ARM64)
+	else if (pkt_burst == i40e_xmit_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON;
+#elif defined(RTE_ARCH_PPC_64)
+	else if (pkt_burst == i40e_xmit_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC;
+#endif
+	else
+		options = 0;
+
+	mode->options = options;
+}
+
 void __attribute__((cold))
 i40e_set_default_ptype_table(struct rte_eth_dev *dev)
 {
-- 
2.17.1


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

* [dpdk-dev] [RFC v3 3/4] net/ice: support to get the Rx/Tx burst mode
  2019-09-10 16:33 [dpdk-dev] [RFC v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 1/4] ethdev: add the API for getting " Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 2/4] net/i40e: support to get the Rx/Tx burst mode Haiyue Wang
@ 2019-09-10 16:33 ` Haiyue Wang
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Haiyue Wang @ 2019-09-10 16:33 UTC (permalink / raw)
  To: dev, ferruh.yigit, mdr, chenmin.sun; +Cc: Haiyue Wang

According to the selected Rx/Tx burst function name, retrieve the
related burst mode options.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 drivers/net/ice/ice_ethdev.c |  2 ++
 drivers/net/ice/ice_rxtx.c   | 54 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_rxtx.h   |  4 +++
 3 files changed, 60 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 63997fdfb..784e07744 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -147,6 +147,8 @@ static const struct eth_dev_ops ice_eth_dev_ops = {
 	.vlan_pvid_set                = ice_vlan_pvid_set,
 	.rxq_info_get                 = ice_rxq_info_get,
 	.txq_info_get                 = ice_txq_info_get,
+	.rx_burst_mode_get            = ice_rx_burst_mode_get,
+	.tx_burst_mode_get            = ice_tx_burst_mode_get,
 	.get_eeprom_length            = ice_get_eeprom_length,
 	.get_eeprom                   = ice_get_eeprom,
 	.rx_queue_count               = ice_rx_queue_count,
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 81af81441..9e4c08d0a 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2396,6 +2396,37 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 	}
 }
 
+void
+ice_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+		      struct rte_eth_burst_mode *mode)
+{
+	eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
+	uint64_t options;
+
+	if (pkt_burst == ice_recv_scattered_pkts)
+		options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == ice_recv_pkts_bulk_alloc)
+		options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_BULK_ALLOC;
+	else if (pkt_burst == ice_recv_pkts)
+		options = RTE_ETH_BURST_SCALAR;
+#ifdef RTE_ARCH_X86
+	else if (pkt_burst == ice_recv_scattered_pkts_vec_avx2)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2 |
+			  RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == ice_recv_pkts_vec_avx2)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2;
+	else if (pkt_burst == ice_recv_scattered_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE |
+			  RTE_ETH_BURST_SCATTERED;
+	else if (pkt_burst == ice_recv_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE;
+#endif
+	else
+		options = 0;
+
+	mode->options = options;
+}
+
 void __attribute__((cold))
 ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq)
 {
@@ -2519,6 +2550,29 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 	}
 }
 
+void
+ice_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+		      struct rte_eth_burst_mode *mode)
+{
+	eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
+	uint64_t options;
+
+	if (pkt_burst == ice_xmit_pkts_simple)
+		options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SIMPLE;
+	else if (pkt_burst == ice_xmit_pkts)
+		options = RTE_ETH_BURST_SCALAR;
+#ifdef RTE_ARCH_X86
+	else if (pkt_burst == ice_xmit_pkts_vec_avx2)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2;
+	else if (pkt_burst == ice_xmit_pkts_vec)
+		options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE;
+#endif
+	else
+		options = 0;
+
+	mode->options = options;
+}
+
 /* For each value it means, datasheet of hardware can tell more details
  *
  * @note: fix ice_dev_supported_ptypes_get() if any change here.
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index e9214110c..8bdd4369c 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -166,6 +166,10 @@ void ice_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 		      struct rte_eth_rxq_info *qinfo);
 void ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 		      struct rte_eth_txq_info *qinfo);
+void ice_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+void ice_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
 int ice_rx_descriptor_status(void *rx_queue, uint16_t offset);
 int ice_tx_descriptor_status(void *tx_queue, uint16_t offset);
 void ice_set_default_ptype_table(struct rte_eth_dev *dev);
-- 
2.17.1


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

* [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description
  2019-09-10 16:33 [dpdk-dev] [RFC v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
                   ` (2 preceding siblings ...)
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 3/4] net/ice: " Haiyue Wang
@ 2019-09-10 16:33 ` Haiyue Wang
  2019-09-12 16:07   ` Iremonger, Bernard
  3 siblings, 1 reply; 7+ messages in thread
From: Haiyue Wang @ 2019-09-10 16:33 UTC (permalink / raw)
  To: dev, ferruh.yigit, mdr, chenmin.sun; +Cc: Haiyue Wang

Add the 'Burst mode' section into command 'show rxq|txq info <port_id>
<queue_id>' to show the Rx/Tx burst mode description like:
  "Burst mode: Vector AVX2 Scattered"

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 app/test-pmd/config.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1a5a5c13c..d10ad6cfa 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -324,9 +324,21 @@ nic_stats_mapping_display(portid_t port_id)
 	       nic_stats_mapping_border, nic_stats_mapping_border);
 }
 
+static void
+burst_mode_options_display(uint64_t options)
+{
+	uint64_t opt;
+
+	for (opt = 1; options != 0; opt <<= 1, options >>= 1) {
+		if (options & 1)
+			printf(" %s", rte_eth_burst_mode_option_name(opt));
+	}
+}
+
 void
 rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
 {
+	struct rte_eth_burst_mode mode;
 	struct rte_eth_rxq_info qinfo;
 	int32_t rc;
 	static const char *info_border = "*********************";
@@ -354,12 +366,19 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
 	printf("\nRX scattered packets: %s",
 		(qinfo.scattered_rx != 0) ? "on" : "off");
 	printf("\nNumber of RXDs: %hu", qinfo.nb_desc);
+
+	if (rte_eth_rx_burst_mode_get(port_id, queue_id, &mode) == 0) {
+		printf("\nBurst mode:");
+		burst_mode_options_display(mode.options);
+	}
+
 	printf("\n");
 }
 
 void
 tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
 {
+	struct rte_eth_burst_mode mode;
 	struct rte_eth_txq_info qinfo;
 	int32_t rc;
 	static const char *info_border = "*********************";
@@ -383,6 +402,12 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
 	printf("\nTX deferred start: %s",
 		(qinfo.conf.tx_deferred_start != 0) ? "on" : "off");
 	printf("\nNumber of TXDs: %hu", qinfo.nb_desc);
+
+	if (rte_eth_tx_burst_mode_get(port_id, queue_id, &mode) == 0) {
+		printf("\nBurst mode:");
+		burst_mode_options_display(mode.options);
+	}
+
 	printf("\n");
 }
 
-- 
2.17.1


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

* Re: [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description
  2019-09-10 16:33 ` [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
@ 2019-09-12 16:07   ` Iremonger, Bernard
  2019-09-25 16:33     ` Wang, Haiyue
  0 siblings, 1 reply; 7+ messages in thread
From: Iremonger, Bernard @ 2019-09-12 16:07 UTC (permalink / raw)
  To: Wang, Haiyue, dev, Yigit, Ferruh, mdr, Sun, Chenmin; +Cc: Wang, Haiyue

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Haiyue Wang
> Sent: Tuesday, September 10, 2019 5:34 PM
> To: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; mdr@ashroe.eu; Sun,
> Chenmin <chenmin.sun@intel.com>
> Cc: Wang, Haiyue <haiyue.wang@intel.com>
> Subject: [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode
> description
> 
> Add the 'Burst mode' section into command 'show rxq|txq info <port_id>
> <queue_id>' to show the Rx/Tx burst mode description like:
>   "Burst mode: Vector AVX2 Scattered"
> 
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>


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

* Re: [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description
  2019-09-12 16:07   ` Iremonger, Bernard
@ 2019-09-25 16:33     ` Wang, Haiyue
  0 siblings, 0 replies; 7+ messages in thread
From: Wang, Haiyue @ 2019-09-25 16:33 UTC (permalink / raw)
  To: Iremonger, Bernard, Yigit, Ferruh; +Cc: mdr, Sun, Chenmin, dev, Zhang, Helin

Thanks, Bernard.

Hi Ferruh,

Can this series patches be for 20.02 upstream ?

BR,
Haiyue

> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Friday, September 13, 2019 00:08
> To: Wang, Haiyue <haiyue.wang@intel.com>; dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>;
> mdr@ashroe.eu; Sun, Chenmin <chenmin.sun@intel.com>
> Cc: Wang, Haiyue <haiyue.wang@intel.com>
> Subject: RE: [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Haiyue Wang
> > Sent: Tuesday, September 10, 2019 5:34 PM
> > To: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; mdr@ashroe.eu; Sun,
> > Chenmin <chenmin.sun@intel.com>
> > Cc: Wang, Haiyue <haiyue.wang@intel.com>
> > Subject: [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode
> > description
> >
> > Add the 'Burst mode' section into command 'show rxq|txq info <port_id>
> > <queue_id>' to show the Rx/Tx burst mode description like:
> >   "Burst mode: Vector AVX2 Scattered"
> >
> > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> 
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>


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

end of thread, other threads:[~2019-09-25 16:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 16:33 [dpdk-dev] [RFC v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
2019-09-10 16:33 ` [dpdk-dev] [RFC v3 1/4] ethdev: add the API for getting " Haiyue Wang
2019-09-10 16:33 ` [dpdk-dev] [RFC v3 2/4] net/i40e: support to get the Rx/Tx burst mode Haiyue Wang
2019-09-10 16:33 ` [dpdk-dev] [RFC v3 3/4] net/ice: " Haiyue Wang
2019-09-10 16:33 ` [dpdk-dev] [RFC v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
2019-09-12 16:07   ` Iremonger, Bernard
2019-09-25 16:33     ` Wang, Haiyue

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).