-----Original Message----- From: Thomas Monjalon [mailto:thomas.monja...@6wind.com] Sent: Friday, June 20, 2014 10:35 PM To: Zhang, Helin Cc: dev at dpdk.org Subject: Re: [dpdk-dev] [PATCH 7/7] app/testpmd: rework for displaying different size of RX descriptors
2014-06-20 14:14, Helin Zhang: > 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. [...] > + if (strstr(dev_info.driver_name, "i40e") != NULL) { /* i40e */ > +#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC Do we need to handle i40e case if RTE_LIBRTE_I40E_16BYTE_RX_DESC is defined? [simplified diff follows] > #else > + 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)); > #endif > + } 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)); > + } You could factorize these 2 cases. -- Thomas ---------------------------------------------------------------------------------------------------------------- Hi Thomas As RX descriptor size can vary in i40e only, and for other PMD, RTE_LIBRTE_I40E_16BYTE_RX_DESC will never be defined, we need to handle all possibilities. Yes, I can rework the changes and let it be more graceful. Thanks! Regards, Helin