From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 04075B0BE for ; Fri, 20 Jun 2014 08:14:56 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 19 Jun 2014 23:15:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,512,1400050800"; d="scan'208";a="558354317" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 19 Jun 2014 23:15:12 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s5K6FBLW018851; Fri, 20 Jun 2014 14:15:11 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s5K6F7HT025565; Fri, 20 Jun 2014 14:15:09 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s5K6F7gT025521; Fri, 20 Jun 2014 14:15:07 +0800 From: Helin Zhang To: dev@dpdk.org Date: Fri, 20 Jun 2014 14:14:49 +0800 Message-Id: <1403244889-21358-8-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1403244889-21358-1-git-send-email-helin.zhang@intel.com> References: <1403244889-21358-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH 7/7] app/testpmd: rework for displaying different size of RX descriptors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 06:14:57 -0000 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 Acked-by: Cunming Liang Acked-by: Jing Chen --- app/test-pmd/config.c | 77 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 0023ab2..506058b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -581,53 +581,80 @@ 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) +{ + printf(" 0x%08X - 0x%08X\n", (unsigned)dword.words.lo, + (unsigned)dword.words.hi); +} + +static void +ring_rx_descriptor_display(const struct rte_memzone *ring_mz, + uint8_t port_id, + uint16_t desc_id) { -#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC - struct igb_ring_desc *ring; - struct igb_ring_desc rd; + struct rte_eth_dev_info dev_info; - ring = (struct igb_ring_desc *) ring_mz->addr; + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(port_id, &dev_info); + + if (strstr(dev_info.driver_name, "i40e") != NULL) { /* i40e */ +#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC + struct igb_ring_desc_32_bytes *ring = + (struct igb_ring_desc_32_bytes *)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)); #else - struct igb_ring_desc_32B *ring; - struct igb_ring_desc_32B rd; + struct igb_ring_desc_16_bytes *ring = + (struct igb_ring_desc_16_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)); #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); + } else { /* not i40e */ + struct igb_ring_desc_16_bytes *ring = + (struct igb_ring_desc_16_bytes *)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)); + } } 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 +671,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