From: Helin Zhang Date: Thu, 5 Jun 2014 05:08:57 +0000 (+0800) Subject: app/testpmd: support displaying 32-byte Rx descriptors X-Git-Tag: spdx-start~10669 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ac2ece3fb1f5511b96b595d6cd6861d25520b99b;p=dpdk.git app/testpmd: support displaying 32-byte Rx descriptors i40e supports both 16 and 32 bytes RX descriptors, while ixgbe and igb support 16 bytes size only. Code changes have been made in test-pmd to support both 16 and 32 bytes RX descriptors according to the configuration in config files. Signed-off-by: Helin Zhang Signed-off-by: Jing Chen Acked-by: Cunming Liang Acked-by: Jijiang Liu Acked-by: Jingjing Wu Acked-by: Heqing Zhu Tested-by: Waterman Cao --- diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 66fcd745bd..b654eb8647 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -568,13 +568,43 @@ union igb_ring_dword { } words; }; +#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC +struct igb_ring_desc_32B { + 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 { union igb_ring_dword lo_dword; union igb_ring_dword hi_dword; }; static void -ring_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id) +ring_rx_descriptor_display(const struct rte_memzone *ring_mz, uint16_t desc_id) +{ +#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC + struct igb_ring_desc *ring; + struct igb_ring_desc rd; + + ring = (struct igb_ring_desc *) ring_mz->addr; +#else + struct igb_ring_desc_32B *ring; + struct igb_ring_desc_32B rd; + + ring = (struct igb_ring_desc_32B *) ring_mz->addr; +#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); +} + +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; @@ -601,7 +631,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_descriptor_display(rx_mz, rxd_id); + ring_rx_descriptor_display(rx_mz, rxd_id); } void @@ -618,7 +648,7 @@ tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id) tx_mz = ring_dma_zone_lookup("tx_ring", port_id, txq_id); if (tx_mz == NULL) return; - ring_descriptor_display(tx_mz, txd_id); + ring_tx_descriptor_display(tx_mz, txd_id); } void