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

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/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 ++
 12 files changed, 347 insertions(+)

-- 
2.17.1


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

* [dpdk-dev] [PATCH v2 1/4] ethdev: add the API for getting burst mode information
  2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
@ 2019-09-26 14:54 ` Haiyue Wang
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: add Rx/Tx burst mode get callbacks Haiyue Wang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Haiyue Wang @ 2019-09-26 14:54 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>
---
 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 ++
 5 files changed, 172 insertions(+)

diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 1b8bd6f35..e77ace531 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -56,6 +56,15 @@ 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.
+
 * **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 af823607c..401be9e04 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 d937fb429..64bb84627 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
 
@@ -3600,6 +3626,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] 8+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] net/i40e: add Rx/Tx burst mode get callbacks
  2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add the API for getting " Haiyue Wang
@ 2019-09-26 14:54 ` Haiyue Wang
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 3/4] net/ice: " Haiyue Wang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Haiyue Wang @ 2019-09-26 14:54 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>
---
 drivers/net/i40e/i40e_ethdev.c |  2 +
 drivers/net/i40e/i40e_ethdev.h |  4 ++
 drivers/net/i40e/i40e_rxtx.c   | 76 ++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 76cd9f510..e212a7adb 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -493,6 +493,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 692c3bab4..9b5060643 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3028,6 +3028,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)
 {
@@ -3121,6 +3166,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] 8+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] net/ice: add Rx/Tx burst mode get callbacks
  2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add the API for getting " Haiyue Wang
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: add Rx/Tx burst mode get callbacks Haiyue Wang
@ 2019-09-26 14:54 ` Haiyue Wang
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Haiyue Wang @ 2019-09-26 14:54 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>
---
 drivers/net/ice/ice_ethdev.c |  2 ++
 drivers/net/ice/ice_rxtx.c   | 58 ++++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_rxtx.h   |  4 +++
 3 files changed, 64 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index c126d962c..38b141eea 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -158,6 +158,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 af96c0f41..4cc54138a 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2441,6 +2441,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)
 {
@@ -2564,6 +2597,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] 8+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] app/testpmd: show the Rx/Tx burst mode description
  2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
                   ` (2 preceding siblings ...)
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 3/4] net/ice: " Haiyue Wang
@ 2019-09-26 14:54 ` Haiyue Wang
  2019-09-27  8:14 ` [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Ye Xiaolong
  2019-10-14 12:11 ` Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Haiyue Wang @ 2019-09-26 14:54 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>
---
 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 a3b6cbd08..6676e8651 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -330,9 +330,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 = "*********************";
@@ -360,12 +376,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 = "*********************";
@@ -389,6 +412,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] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information
  2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
                   ` (3 preceding siblings ...)
  2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
@ 2019-09-27  8:14 ` Ye Xiaolong
  2019-10-14 12:11 ` Ferruh Yigit
  5 siblings, 0 replies; 8+ messages in thread
From: Ye Xiaolong @ 2019-09-27  8:14 UTC (permalink / raw)
  To: Haiyue Wang
  Cc: dev, ferruh.yigit, ray.kinsella, bernard.iremonger, chenmin.sun

On 09/26, Haiyue Wang wrote:
>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/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 ++
> 12 files changed, 347 insertions(+)
>
>-- 
>2.17.1
>

For series:

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

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

* Re: [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information
  2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
                   ` (4 preceding siblings ...)
  2019-09-27  8:14 ` [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Ye Xiaolong
@ 2019-10-14 12:11 ` Ferruh Yigit
  2019-10-14 13:50   ` Wang, Haiyue
  5 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2019-10-14 12:11 UTC (permalink / raw)
  To: Haiyue Wang, dev, xiaolong.ye
  Cc: ray.kinsella, bernard.iremonger, chenmin.sun

On 9/26/2019 3:54 PM, Haiyue Wang wrote:
> 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

Hi Haiyue,

Overall lgtm, but what do you think adding a new feature to default.ini for
this, something like 'Burst mode info"?

And i40e and ixgbe patches can add this feature to the PMD .ini files.

Also please remind 'doc/guides/nics/features.rst' also needs to be updated with
default.ini update.

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information
  2019-10-14 12:11 ` Ferruh Yigit
@ 2019-10-14 13:50   ` Wang, Haiyue
  0 siblings, 0 replies; 8+ messages in thread
From: Wang, Haiyue @ 2019-10-14 13:50 UTC (permalink / raw)
  To: Yigit, Ferruh, dev, Ye, Xiaolong
  Cc: Kinsella, Ray, Iremonger, Bernard, Sun, Chenmin

Hi, Ferruh

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, October 14, 2019 20:12
> 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 v2 0/4] get Rx/Tx packet burst mode information
> 
> On 9/26/2019 3:54 PM, Haiyue Wang wrote:
> > 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
> 
> Hi Haiyue,
> 
> Overall lgtm, but what do you think adding a new feature to default.ini for
> this, something like 'Burst mode info"?
> 
> And i40e and ixgbe patches can add this feature to the PMD .ini files.
> 
> Also please remind 'doc/guides/nics/features.rst' also needs to be updated with
> default.ini update.
> 

No problem, I will update it in v3.

> Thanks,
> ferruh

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

end of thread, other threads:[~2019-10-14 13:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 14:54 [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Haiyue Wang
2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add the API for getting " Haiyue Wang
2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 2/4] net/i40e: add Rx/Tx burst mode get callbacks Haiyue Wang
2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 3/4] net/ice: " Haiyue Wang
2019-09-26 14:54 ` [dpdk-dev] [PATCH v2 4/4] app/testpmd: show the Rx/Tx burst mode description Haiyue Wang
2019-09-27  8:14 ` [dpdk-dev] [PATCH v2 0/4] get Rx/Tx packet burst mode information Ye Xiaolong
2019-10-14 12:11 ` Ferruh Yigit
2019-10-14 13:50   ` 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).