[dpdk-dev] [PATCH] pmdinfogen: Fix pmdinfogen to select proper endianess on cross-compile

Bruce Richardson bruce.richardson at intel.com
Mon Nov 21 11:11:33 CET 2016


On Fri, Nov 18, 2016 at 01:47:52PM -0500, Neil Horman wrote:
> pmdinfogen has a bug in which, during build, it pulls in rte_byteorder.h to
> obtain the rte macros for byteswapping between the cpu byte order and big or
> little endian.  Unfortunately, pmdinfogen is a tool that is only meant to be run
> during the build of dpdk components, and so, it runs on the host.  In cross
> compile environments however, the rte_byteorder.h is configured using a target
> cpu, who's endianess may differ from that of the host, leading to improper
> swapping.
> 
> The fix is to use host system defined byte swapping routines rather than the
> dpdk provided routines.  Note that we are using non posix compliant routines, as
> the posix compliant api only addresses 16 and 32 bit swaps, and we also need 64
> bit swaps.  Those macros exist (via endian.h), but BSD and Linux put that header
> in different locations so some ifdeffery is required.
> 
> Tested successfully by myself on Linux and BSD systems.
> 
> Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
> CC: Hemant Agrawal <hemant.agrawal at nxp.com>
> CC: Jerin Jacob <Jerin.Jacob at cavium.com>
> CC: Bruce Richardson <bruce.richardson at intel.com>
> CC: Thomas Monjalon <thomas.monjalon at 6wind.com>
> ---
>  buildtools/pmdinfogen/pmdinfogen.h | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Compiles fine on FreeBSD with clang.

Tested-by: Bruce Richardson <bruce.richardson at intel.com>



More information about the dev mailing list