DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Haiyue Wang <haiyue.wang@intel.com>
To: dev@dpdk.org
Cc: Haiyue Wang <haiyue.wang@intel.com>
Subject: [dpdk-dev] [RFC v2 3/3] net/ice: support the Rx/Tx burst description trace
Date: Tue, 13 Aug 2019 11:06:12 +0800
Message-ID: <1565665572-65495-4-git-send-email-haiyue.wang@intel.com> (raw)
In-Reply-To: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com>

According to the Rx/Tx burst function that's selected currently, format
the distinct burst description information for apps to query.

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

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 44a14cb..bad5c23 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -99,6 +99,8 @@ static int ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
 			struct rte_eth_udp_tunnel *udp_tunnel);
 static int ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 			struct rte_eth_udp_tunnel *udp_tunnel);
+static int ice_trace_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			      enum rte_eth_trace type, char *buf, int sz);
 
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) },
@@ -147,6 +149,7 @@ 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,
+	.trace_info_get               = ice_trace_info_get,
 	.get_eeprom_length            = ice_get_eeprom_length,
 	.get_eeprom                   = ice_get_eeprom,
 	.rx_queue_count               = ice_rx_queue_count,
@@ -3765,6 +3768,29 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 }
 
 static int
+ice_trace_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+		   enum rte_eth_trace type, char *buf, int sz)
+{
+	int ret;
+
+	switch (type) {
+	case ETH_TRACE_RX_BURST:
+		ret = ice_rx_burst_info_get(dev, queue_id, buf, sz);
+		break;
+
+	case ETH_TRACE_TX_BURST:
+		ret = ice_tx_burst_info_get(dev, queue_id, buf, sz);
+		break;
+
+	default:
+		ret = -ENOTSUP;
+		break;
+	}
+
+	return ret;
+}
+
+static int
 ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	      struct rte_pci_device *pci_dev)
 {
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 0282b53..43d52c2 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -2385,6 +2385,35 @@ ice_set_rx_function(struct rte_eth_dev *dev)
 	}
 }
 
+int
+ice_rx_burst_info_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+		      char *buf, int sz)
+{
+	int len = 0;
+
+	if (dev->rx_pkt_burst == ice_recv_scattered_pkts)
+		len = snprintf(buf, sz, "Scattered Rx");
+	else if (dev->rx_pkt_burst == ice_recv_pkts_bulk_alloc)
+		len = snprintf(buf, sz, "Bulk Rx");
+	else if (dev->rx_pkt_burst == ice_recv_pkts)
+		len = snprintf(buf, sz, "Normal Rx");
+#ifdef RTE_ARCH_X86
+	else if (dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2)
+		len = snprintf(buf, sz, "AVX2 Vector Scattered Rx");
+	else if (dev->rx_pkt_burst == ice_recv_scattered_pkts_vec)
+		len = snprintf(buf, sz, "Vector Scattered Rx");
+	else if (dev->rx_pkt_burst == ice_recv_pkts_vec_avx2)
+		len = snprintf(buf, sz, "AVX2 Vector Rx");
+	else if (dev->rx_pkt_burst == ice_recv_pkts_vec)
+		len = snprintf(buf, sz, "Vector Rx");
+#endif
+
+	if (len >= sz)
+		len = -ENOSPC; /* The output was truncated */
+
+	return len;
+}
+
 void __attribute__((cold))
 ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq)
 {
@@ -2454,6 +2483,29 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 	return i;
 }
 
+int
+ice_tx_burst_info_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
+		      char *buf, int sz)
+{
+	int len = 0;
+
+	if (dev->tx_pkt_burst == ice_xmit_pkts_simple)
+		len = snprintf(buf, sz, "Simple Tx");
+	else if (dev->tx_pkt_burst == ice_xmit_pkts)
+		len = snprintf(buf, sz, "Normal Tx");
+#ifdef RTE_ARCH_X86
+	else if (dev->tx_pkt_burst == ice_xmit_pkts_vec_avx2)
+		len = snprintf(buf, sz, "AVX2 Vector Tx");
+	else if (dev->tx_pkt_burst == ice_xmit_pkts_vec)
+		len = snprintf(buf, sz, "Vector Tx");
+#endif
+
+	if (len >= sz)
+		len = -ENOSPC; /* The output was truncated */
+
+	return len;
+}
+
 void __attribute__((cold))
 ice_set_tx_function(struct rte_eth_dev *dev)
 {
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index e921411..f951088 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -188,4 +188,8 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue,
 					  uint16_t nb_pkts);
 uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts);
+int ice_rx_burst_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			  char *buf, int sz);
+int ice_tx_burst_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			  char *buf, int sz);
 #endif /* _ICE_RXTX_H_ */
-- 
2.7.4


      parent reply index

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  3:06 [dpdk-dev] [RFC v2 0/3] show the Rx/Tx burst description field Haiyue Wang
2019-08-13  3:06 ` [dpdk-dev] [RFC v2 1/3] ethdev: add the API for getting trace information Haiyue Wang
2019-08-13  3:24   ` Stephen Hemminger
2019-08-13  4:37     ` Wang, Haiyue
2019-08-13  9:57     ` David Marchand
2019-08-13 11:21       ` Wang, Haiyue
2019-08-13 12:51     ` Ray Kinsella
2019-09-06 14:21       ` Ferruh Yigit
2019-09-07  2:42         ` Wang, Haiyue
2019-09-09 11:23           ` Ferruh Yigit
2019-09-09 12:40             ` Bruce Richardson
2019-09-09 12:50               ` Ferruh Yigit
2019-09-09 13:17                 ` Ferruh Yigit
2019-09-10  4:36                   ` Wang, Haiyue
2019-09-10  8:06                     ` Ferruh Yigit
2019-09-10  8:37                       ` Wang, Haiyue
2019-09-10  9:14                         ` Ferruh Yigit
2019-09-10 11:41                           ` Wang, Haiyue
2019-09-10 15:00                             ` Ferruh Yigit
2019-09-10 15:17                               ` Wang, Haiyue
2019-09-10 15:33                                 ` Ferruh Yigit
2019-09-10 15:35                                   ` Wang, Haiyue
2019-09-10 14:19                           ` Wang, Haiyue
2019-09-10 15:03                             ` Ferruh Yigit
2019-09-10 15:18                               ` Wang, Haiyue
2019-09-10 15:36                                 ` Ferruh Yigit
2019-09-10 15:38                                   ` Wang, Haiyue
2019-09-10 15:06                     ` Ferruh Yigit
2019-09-10 15:21                       ` Wang, Haiyue
2019-09-10 15:35                         ` Ferruh Yigit
2019-09-10 15:37                           ` Wang, Haiyue
2019-08-15  9:07     ` Ray Kinsella
2019-08-13  3:06 ` [dpdk-dev] [RFC v2 2/3] testpmd: show the Rx/Tx burst description Haiyue Wang
2019-08-13  3:06 ` Haiyue Wang [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1565665572-65495-4-git-send-email-haiyue.wang@intel.com \
    --to=haiyue.wang@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox