DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information
@ 2019-10-14 15:35 Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting " Haiyue Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Haiyue Wang @ 2019-10-14 15:35 UTC (permalink / raw)
  To: dev, ferruh.yigit, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun, Haiyue Wang

v2 -> v3:
	1) Add 'Burst mode info' feature matrix.

v1 -> v2:
 	1). Change the return type of dev_ops callback from 'void' to
 	    'int'.
 	2). Update the ice/i40 PMD patches with clear git commit log.
 
RFCv3 -> v1:
 	https://patchwork.dpdk.org/patch/59103/
 	https://patchwork.dpdk.org/patch/59104/
 	https://patchwork.dpdk.org/patch/59105/
 	https://patchwork.dpdk.org/patch/59106/
 	1). Use the function 'rte_bsf64' to iterate the options for
 	    getting the name.

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

 app/test-pmd/config.c                    | 29 +++++++++
 doc/guides/nics/features.rst             | 11 ++++
 doc/guides/nics/features/default.ini     |  1 +
 doc/guides/nics/features/i40e.ini        |  1 +
 doc/guides/nics/features/ice.ini         |  1 +
 doc/guides/rel_notes/release_19_11.rst   |  9 +++
 drivers/net/i40e/i40e_ethdev.c           |  2 +
 drivers/net/i40e/i40e_ethdev.h           |  4 ++
 drivers/net/i40e/i40e_rxtx.c             | 76 ++++++++++++++++++++++
 drivers/net/ice/ice_ethdev.c             |  2 +
 drivers/net/ice/ice_rxtx.c               | 58 +++++++++++++++++
 drivers/net/ice/ice_rxtx.h               |  4 ++
 lib/librte_ethdev/rte_ethdev.c           | 71 ++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h           | 82 ++++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev_core.h      |  5 ++
 lib/librte_ethdev/rte_ethdev_version.map |  5 ++
 16 files changed, 361 insertions(+)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
  2019-10-14 15:35 [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
@ 2019-10-14 15:35 ` Haiyue Wang
  2019-10-14 16:39   ` Ferruh Yigit
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 2/4] net/i40e: add Rx/Tx burst mode get callbacks Haiyue Wang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Haiyue Wang @ 2019-10-14 15:35 UTC (permalink / raw)
  To: dev, ferruh.yigit, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun, 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>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 doc/guides/nics/features.rst             | 11 ++++
 doc/guides/nics/features/default.ini     |  1 +
 doc/guides/rel_notes/release_19_11.rst   |  9 +++
 lib/librte_ethdev/rte_ethdev.c           | 71 ++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h           | 82 ++++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev_core.h      |  5 ++
 lib/librte_ethdev/rte_ethdev_version.map |  5 ++
 7 files changed, 184 insertions(+)

diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index c4e128d2f..d96696801 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -871,6 +871,17 @@ Supports Tx queue setup after device started.
 * **[provides] rte_eth_dev_info**: ``dev_capa:RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP``.
 * **[related]  API**: ``rte_eth_dev_info_get()``.
 
+.. _nic_features_burst_mode_info:
+
+Burst mode info
+---------------
+
+Supports to get Rx/Tx packet burst mode information.
+
+* **[implements] eth_dev_ops**: ``rx_burst_mode_get``, ``tx_burst_mode_get``.
+* **[related] API**: ``rte_eth_rx_burst_mode_get()``, ``rte_eth_tx_burst_mode_get()``,
+  ``rte_eth_burst_mode_option_name()``.
+
 .. _nic_features_other:
 
 Other dev ops not represented by a Feature
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index dfbdf084e..91ec61901 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -19,6 +19,7 @@ Free Tx mbuf on demand =
 Queue start/stop     =
 Runtime Rx queue setup =
 Runtime Tx queue setup =
+Burst mode info      =
 MTU update           =
 Jumbo frame          =
 Scattered Rx         =
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index a63c8af15..8634a7b81 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -83,6 +83,15 @@ New Features
 
   Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.
 
+* **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.
+
 * **Updated the Intel ice driver.**
 
   Updated the Intel ice driver with new features and improvements, including:
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 7caaa0be3..921af3a9b 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -4210,6 +4210,77 @@ 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));
+	return eth_err(port_id,
+		       dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode));
+}
+
+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));
+	return eth_err(port_id,
+		       dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode));
+}
+
+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 c26abe23a..83b08ee4d 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1214,6 +1214,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
 
@@ -3602,6 +3628,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 dcb5ae651..392aea8e6 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -294,6 +294,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 int (*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. */
 
@@ -542,6 +545,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] 9+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] net/i40e: add Rx/Tx burst mode get callbacks
  2019-10-14 15:35 [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting " Haiyue Wang
@ 2019-10-14 15:35 ` Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 3/4] net/ice: " Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
  3 siblings, 0 replies; 9+ messages in thread
From: Haiyue Wang @ 2019-10-14 15:35 UTC (permalink / raw)
  To: dev, ferruh.yigit, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun, Haiyue Wang

Retrieve burst mode options according to the selected Rx/Tx burst
function name.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 doc/guides/nics/features/i40e.ini |  1 +
 drivers/net/i40e/i40e_ethdev.c    |  2 +
 drivers/net/i40e/i40e_ethdev.h    |  4 ++
 drivers/net/i40e/i40e_rxtx.c      | 76 +++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+)

diff --git a/doc/guides/nics/features/i40e.ini b/doc/guides/nics/features/i40e.ini
index 980bcc5b2..e5ae6ded0 100644
--- a/doc/guides/nics/features/i40e.ini
+++ b/doc/guides/nics/features/i40e.ini
@@ -11,6 +11,7 @@ Rx interrupt         = Y
 Queue start/stop     = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
 TSO                  = Y
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2ca14da3b..77a46832c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -502,6 +502,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 261954b9a..2ddaffbeb 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -1209,6 +1209,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);
+int i40e_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+int 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 bfe161f2c..09c01f67c 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3022,6 +3022,51 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
 	}
 }
 
+int
+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;
+
+	return options != 0 ? 0 : -EINVAL;
+}
+
 void __attribute__((cold))
 i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq)
 {
@@ -3115,6 +3160,37 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
 	}
 }
 
+int
+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;
+
+	return options != 0 ? 0 : -EINVAL;
+}
+
 void __attribute__((cold))
 i40e_set_default_ptype_table(struct rte_eth_dev *dev)
 {
-- 
2.17.1


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

* [dpdk-dev] [PATCH v3 3/4] net/ice: add Rx/Tx burst mode get callbacks
  2019-10-14 15:35 [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting " Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 2/4] net/i40e: add Rx/Tx burst mode get callbacks Haiyue Wang
@ 2019-10-14 15:35 ` Haiyue Wang
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
  3 siblings, 0 replies; 9+ messages in thread
From: Haiyue Wang @ 2019-10-14 15:35 UTC (permalink / raw)
  To: dev, ferruh.yigit, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun, Haiyue Wang

Retrieve burst mode options according to the selected Rx/Tx burst
function name.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 doc/guides/nics/features/ice.ini |  1 +
 drivers/net/ice/ice_ethdev.c     |  2 ++
 drivers/net/ice/ice_rxtx.c       | 58 ++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_rxtx.h       |  4 +++
 4 files changed, 65 insertions(+)

diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini
index 5e6cb4b7e..65923f0bc 100644
--- a/doc/guides/nics/features/ice.ini
+++ b/doc/guides/nics/features/ice.ini
@@ -10,6 +10,7 @@ Link status event    = Y
 Rx interrupt         = Y
 Fast mbuf free       = Y
 Queue start/stop     = Y
+Burst mode info      = Y
 MTU update           = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 022b58c01..d848440a1 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -167,6 +167,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 8785cf8a3..c07aa4b81 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2435,6 +2435,39 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 	}
 }
 
+int
+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;
+
+	return options != 0 ? 0 : -EINVAL;
+}
+
 void __attribute__((cold))
 ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq)
 {
@@ -2558,6 +2591,31 @@ ice_set_tx_function(struct rte_eth_dev *dev)
 	}
 }
 
+int
+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;
+
+	return options != 0 ? 0 : -EINVAL;
+}
+
 /* 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 25b3822df..31c53d535 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -168,6 +168,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);
+int ice_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			  struct rte_eth_burst_mode *mode);
+int 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] 9+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] app/testpmd: show the Rx/Tx burst mode description
  2019-10-14 15:35 [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
                   ` (2 preceding siblings ...)
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 3/4] net/ice: " Haiyue Wang
@ 2019-10-14 15:35 ` Haiyue Wang
  3 siblings, 0 replies; 9+ messages in thread
From: Haiyue Wang @ 2019-10-14 15:35 UTC (permalink / raw)
  To: dev, ferruh.yigit, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun, 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>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 app/test-pmd/config.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 2356afee9..1844e4875 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -346,9 +346,25 @@ 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)
+{
+	int offset;
+
+	while (options != 0) {
+		offset = rte_bsf64(options);
+
+		printf(" %s",
+		       rte_eth_burst_mode_option_name(1ULL << offset));
+
+		options &= ~(1ULL << offset);
+	}
+}
+
 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 = "*********************";
@@ -376,12 +392,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 = "*********************";
@@ -405,6 +428,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] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
  2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting " Haiyue Wang
@ 2019-10-14 16:39   ` Ferruh Yigit
  2019-10-15  1:02     ` Wang, Haiyue
  2019-10-15  1:39     ` Wang, Haiyue
  0 siblings, 2 replies; 9+ messages in thread
From: Ferruh Yigit @ 2019-10-14 16:39 UTC (permalink / raw)
  To: Haiyue Wang, dev, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun

On 10/14/2019 4:35 PM, Haiyue Wang wrote:
> 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>
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of
the patchset, can you please confirm this offline?

> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

<...>

> +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 "";
> +}

Hi Haiyue,

The string representation of a vector mode is a data, and I think better to keep
it separately as an array instead of keeping this information in the function
and make the function use that data.
So that when new type are added it won't require to update the function itself.

'rte_rx_offload_names' and 'rte_eth_dev_rx_offload_name()' is the good sample of
what I mentioned above.

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
  2019-10-14 16:39   ` Ferruh Yigit
@ 2019-10-15  1:02     ` Wang, Haiyue
  2019-10-15  1:39     ` Wang, Haiyue
  1 sibling, 0 replies; 9+ messages in thread
From: Wang, Haiyue @ 2019-10-15  1:02 UTC (permalink / raw)
  To: Yigit, Ferruh, dev, Ye, Xiaolong
  Cc: Kinsella, Ray, Iremonger, Bernard, Sun, Chenmin

Hi,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, October 15, 2019 00:39
> To: Wang, Haiyue <haiyue.wang@intel.com>; dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
> Cc: Kinsella, Ray <ray.kinsella@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>; Sun,
> Chenmin <chenmin.sun@intel.com>
> Subject: Re: [PATCH v3 1/4] ethdev: add the API for getting burst mode information
> 
> On 10/14/2019 4:35 PM, Haiyue Wang wrote:
> > 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>
> > Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
> 
> As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of
> the patchset, can you please confirm this offline?
> 

I checked it, yes, will remove other three ACKs, sorry for not so strict.

> > Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 
> <...>
> 
> > +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 "";
> > +}
> 
> Hi Haiyue,
> 
> The string representation of a vector mode is a data, and I think better to keep
> it separately as an array instead of keeping this information in the function
> and make the function use that data.
> So that when new type are added it won't require to update the function itself.
> 
> 'rte_rx_offload_names' and 'rte_eth_dev_rx_offload_name()' is the good sample of
> what I mentioned above.
> 

+1, will update it.

> Thanks,
> ferruh

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

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
  2019-10-14 16:39   ` Ferruh Yigit
  2019-10-15  1:02     ` Wang, Haiyue
@ 2019-10-15  1:39     ` Wang, Haiyue
  2019-10-15  7:58       ` Ferruh Yigit
  1 sibling, 1 reply; 9+ messages in thread
From: Wang, Haiyue @ 2019-10-15  1:39 UTC (permalink / raw)
  To: Yigit, Ferruh, dev, Ye, Xiaolong
  Cc: Kinsella, Ray, Iremonger, Bernard, Sun, Chenmin

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, October 15, 2019 00:39
> To: Wang, Haiyue <haiyue.wang@intel.com>; dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
> Cc: Kinsella, Ray <ray.kinsella@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>; Sun,
> Chenmin <chenmin.sun@intel.com>
> Subject: Re: [PATCH v3 1/4] ethdev: add the API for getting burst mode information
> 
> On 10/14/2019 4:35 PM, Haiyue Wang wrote:
> > 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>
> > Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
> 
> As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of
> the patchset, can you please confirm this offline?
> 
> > Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 
> <...>
> 
> > +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 "";
> > +}
> 
> Hi Haiyue,
> 
> The string representation of a vector mode is a data, and I think better to keep
> it separately as an array instead of keeping this information in the function
> and make the function use that data.
> So that when new type are added it won't require to update the function itself.
> 

Hi Ferruh,

Even the vector mode is a data, it still is a bit field option, if we treated them
differently, that will make 'rte_eth_burst_mode_option_name' ugly like:

	switch (option) {
	case RTE_ETH_BURST_SCALAR: return "Scalar";
	case RTE_ETH_BURST_VECTOR: return "Vector";

	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";
	}


static const struct {
	uint64_t vector;
	const char *name;
} rte_burst_vector_names[] = {
	{ RTE_ETH_BURST_ALTIVEC, "AltiVec" },
	{ RTE_ETH_BURST_NEON, "Neon" },
	{ RTE_ETH_BURST_SSE, "SSE" },
	{ RTE_ETH_BURST_AVX2, "AVX2" },
	{ RTE_ETH_BURST_AVX512, "AVX512" },
};

	for (i = 0; i < RTE_DIM(rte_burst_vector_names); ++i) {
		if (option == rte_burst_ vector _names[i].option)
			return rte_burst_option_names[i].name; 
	}

Why just put them together ?

static const struct {
	uint64_t option;
	const char *name;
} rte_burst_option_names[] = {
	{ RTE_ETH_BURST_SCALAR, "Scalar" },
	{ RTE_ETH_BURST_VECTOR, "Vector" },

	{ RTE_ETH_BURST_ALTIVEC, "AltiVec" },
	{ RTE_ETH_BURST_NEON, "Neon" },
	{ RTE_ETH_BURST_SSE, "SSE" },
	{ RTE_ETH_BURST_AVX2, "AVX2" },
	{ RTE_ETH_BURST_AVX512, "AVX512" },

	{ RTE_ETH_BURST_SCATTERED, "Scattered" },
	{ RTE_ETH_BURST_BULK_ALLOC, "Bulk Alloc" },
	{ RTE_ETH_BURST_SIMPLE, "Simple" },
	{ RTE_ETH_BURST_PER_QUEUE, "Per Queue" },
};

const char *
rte_eth_burst_mode_option_name(uint64_t option)
{
	const char *name = "";
	unsigned int i;

	for (i = 0; i < RTE_DIM(rte_burst_option_names); ++i) {
		if (option == rte_burst_option_names[i].option) {
			name = rte_burst_option_names[i].name;
			break;
		}
	}

	return name;
}

> 'rte_rx_offload_names' and 'rte_eth_dev_rx_offload_name()' is the good sample of
> what I mentioned above.
> 
> Thanks,
> ferruh

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

* Re: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information
  2019-10-15  1:39     ` Wang, Haiyue
@ 2019-10-15  7:58       ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2019-10-15  7:58 UTC (permalink / raw)
  To: Wang, Haiyue, dev, Ye, Xiaolong
  Cc: Kinsella, Ray, Iremonger, Bernard, Sun, Chenmin

On 10/15/2019 2:39 AM, Wang, Haiyue wrote:
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Tuesday, October 15, 2019 00:39
>> To: Wang, Haiyue <haiyue.wang@intel.com>; dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>
>> Cc: Kinsella, Ray <ray.kinsella@intel.com>; Iremonger, Bernard <bernard.iremonger@intel.com>; Sun,
>> Chenmin <chenmin.sun@intel.com>
>> Subject: Re: [PATCH v3 1/4] ethdev: add the API for getting burst mode information
>>
>> On 10/14/2019 4:35 PM, Haiyue Wang wrote:
>>> 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>
>>> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
>>
>> As far as I can see Bernard has ack only on testpmd patch, 4/4, not for reset of
>> the patchset, can you please confirm this offline?
>>
>>> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
>>
>> <...>
>>
>>> +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 "";
>>> +}
>>
>> Hi Haiyue,
>>
>> The string representation of a vector mode is a data, and I think better to keep
>> it separately as an array instead of keeping this information in the function
>> and make the function use that data.
>> So that when new type are added it won't require to update the function itself.
>>

<...>

> Why just put them together ?
> 
> static const struct {
> 	uint64_t option;
> 	const char *name;
> } rte_burst_option_names[] = {
> 	{ RTE_ETH_BURST_SCALAR, "Scalar" },
> 	{ RTE_ETH_BURST_VECTOR, "Vector" },
> 
> 	{ RTE_ETH_BURST_ALTIVEC, "AltiVec" },
> 	{ RTE_ETH_BURST_NEON, "Neon" },
> 	{ RTE_ETH_BURST_SSE, "SSE" },
> 	{ RTE_ETH_BURST_AVX2, "AVX2" },
> 	{ RTE_ETH_BURST_AVX512, "AVX512" },
> 
> 	{ RTE_ETH_BURST_SCATTERED, "Scattered" },
> 	{ RTE_ETH_BURST_BULK_ALLOC, "Bulk Alloc" },
> 	{ RTE_ETH_BURST_SIMPLE, "Simple" },
> 	{ RTE_ETH_BURST_PER_QUEUE, "Per Queue" },
> };
> 
> const char *
> rte_eth_burst_mode_option_name(uint64_t option)
> {
> 	const char *name = "";
> 	unsigned int i;
> 
> 	for (i = 0; i < RTE_DIM(rte_burst_option_names); ++i) {
> 		if (option == rte_burst_option_names[i].option) {
> 			name = rte_burst_option_names[i].name;
> 			break;
> 		}
> 	}
> 
> 	return name;
> }

+1, this my intention, thanks.

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

end of thread, other threads:[~2019-10-15  7:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 15:35 [dpdk-dev] [PATCH v3 0/4] get Rx/Tx packet burst mode information Haiyue Wang
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting " Haiyue Wang
2019-10-14 16:39   ` Ferruh Yigit
2019-10-15  1:02     ` Wang, Haiyue
2019-10-15  1:39     ` Wang, Haiyue
2019-10-15  7:58       ` Ferruh Yigit
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 2/4] net/i40e: add Rx/Tx burst mode get callbacks Haiyue Wang
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 3/4] net/ice: " Haiyue Wang
2019-10-14 15:35 ` [dpdk-dev] [PATCH v3 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang

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