DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 7/7] app/testpmd: rework for displaying different size of RX descriptors
Date: Tue, 24 Jun 2014 10:02:39 +0800
Message-ID: <1403575359-10422-8-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1403575359-10422-1-git-send-email-helin.zhang@intel.com>

i40e supports 16 and 32 bytes RX descriptors which can be configured.
It needs to check the driver type and the configuration to determine
if 16 or 32 bytes RX descriptors is being used, for reading and
displaying the different sizes of RX descriptors.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
---
 app/test-pmd/config.c | 75 ++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 25 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 0023ab2..255f82d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -581,53 +581,78 @@ union igb_ring_dword {
 	} words;
 };
 
-#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
-struct igb_ring_desc_32B {
+struct igb_ring_desc_32_bytes {
 	union igb_ring_dword lo_dword;
 	union igb_ring_dword hi_dword;
 	union igb_ring_dword resv1;
 	union igb_ring_dword resv2;
 };
-#endif
 
-struct igb_ring_desc {
+struct igb_ring_desc_16_bytes {
 	union igb_ring_dword lo_dword;
 	union igb_ring_dword hi_dword;
 };
 
 static void
-ring_rx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
+ring_rxd_display_dword(union igb_ring_dword dword)
 {
-#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC
-	struct igb_ring_desc *ring;
-	struct igb_ring_desc rd;
+	printf("    0x%08X - 0x%08X\n", (unsigned)dword.words.lo,
+					(unsigned)dword.words.hi);
+}
 
-	ring = (struct igb_ring_desc *) ring_mz->addr;
+static void
+ring_rx_descriptor_display(const struct rte_memzone *ring_mz,
+#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+			   uint8_t port_id,
 #else
-	struct igb_ring_desc_32B *ring;
-	struct igb_ring_desc_32B rd;
+			   __rte_unused uint8_t port_id,
+#endif
+			   uint16_t desc_id)
+{
+	struct igb_ring_desc_16_bytes *ring =
+		(struct igb_ring_desc_16_bytes *)ring_mz->addr;
+#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
+	struct rte_eth_dev_info dev_info;
+
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(port_id, &dev_info);
+	if (strstr(dev_info.driver_name, "i40e") != NULL) {
+		/* 32 bytes RX descriptor, i40e only */
+		struct igb_ring_desc_32_bytes *ring =
+			(struct igb_ring_desc_32_bytes *)ring_mz->addr;
 
-	ring = (struct igb_ring_desc_32B *) ring_mz->addr;
+		ring_rxd_display_dword(rte_le_to_cpu_64(
+				ring[desc_id].lo_dword));
+		ring_rxd_display_dword(rte_le_to_cpu_64(
+				ring[desc_id].hi_dword));
+		ring_rxd_display_dword(rte_le_to_cpu_64(
+				ring[desc_id].resv1));
+		ring_rxd_display_dword(rte_le_to_cpu_64(
+				ring[desc_id].resv2));
+		return;
+	}
 #endif
-	rd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
-	rd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
-	printf("    0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
-		(unsigned)rd.lo_dword.words.lo, (unsigned)rd.lo_dword.words.hi,
-		(unsigned)rd.hi_dword.words.lo, (unsigned)rd.hi_dword.words.hi);
+	/* 16 bytes RX descriptor */
+	ring_rxd_display_dword(rte_le_to_cpu_64(
+			ring[desc_id].lo_dword));
+	ring_rxd_display_dword(rte_le_to_cpu_64(
+			ring[desc_id].hi_dword));
 }
 
 static void
 ring_tx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id)
 {
-	struct igb_ring_desc *ring;
-	struct igb_ring_desc rd;
+	struct igb_ring_desc_16_bytes *ring;
+	struct igb_ring_desc_16_bytes txd;
 
-	ring = (struct igb_ring_desc *) ring_mz->addr;
-	rd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
-	rd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
+	ring = (struct igb_ring_desc_16_bytes *)ring_mz->addr;
+	txd.lo_dword = rte_le_to_cpu_64(ring[desc_id].lo_dword);
+	txd.hi_dword = rte_le_to_cpu_64(ring[desc_id].hi_dword);
 	printf("    0x%08X - 0x%08X / 0x%08X - 0x%08X\n",
-		(unsigned)rd.lo_dword.words.lo, (unsigned)rd.lo_dword.words.hi,
-		(unsigned)rd.hi_dword.words.lo, (unsigned)rd.hi_dword.words.hi);
+			(unsigned)txd.lo_dword.words.lo,
+			(unsigned)txd.lo_dword.words.hi,
+			(unsigned)txd.hi_dword.words.lo,
+			(unsigned)txd.hi_dword.words.hi);
 }
 
 void
@@ -644,7 +669,7 @@ rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id)
 	rx_mz = ring_dma_zone_lookup("rx_ring", port_id, rxq_id);
 	if (rx_mz == NULL)
 		return;
-	ring_rx_descriptor_display(rx_mz, rxd_id);
+	ring_rx_descriptor_display(rx_mz, port_id, rxd_id);
 }
 
 void
-- 
1.8.1.4

  parent reply	other threads:[~2014-06-24  2:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  2:02 [dpdk-dev] [PATCH v3 0/7] enhancements for i40e Helin Zhang
2014-06-24  2:02 ` [dpdk-dev] [PATCH v3 1/7] i40e: fix for getting correct RSS hash result Helin Zhang
2014-06-24  2:02 ` [dpdk-dev] [PATCH v3 2/7] i40evf: remove an interface which is not used Helin Zhang
2014-06-24  2:02 ` [dpdk-dev] [PATCH v3 3/7] i40evf: fix for copying wrong size of link info Helin Zhang
2014-06-24  2:02 ` [dpdk-dev] [PATCH v3 4/7] i40e: fix for updating the hash lookup table of PF RSS Helin Zhang
2014-06-24  2:02 ` [dpdk-dev] [PATCH v3 5/7] i40e: double vlan should be specifically disabled by default Helin Zhang
2014-06-24  2:02 ` [dpdk-dev] [PATCH v3 6/7] i40e: ignore the failure of updating default macvlan filter Helin Zhang
2014-06-24  2:02 ` Helin Zhang [this message]
2014-06-24 11:13 ` [dpdk-dev] [PATCH v3 0/7] enhancements for i40e Thomas Monjalon

Reply instructions:

You may reply publicly 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=1403575359-10422-8-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@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 patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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