qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 for-2.11] hw/net/vmxnet3: Fix code


From: Jason Wang
Subject: Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 for-2.11] hw/net/vmxnet3: Fix code to work on big endian hosts, too
Date: Fri, 17 Nov 2017 17:50:21 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0



On 2017年11月14日 19:20, Thomas Huth wrote:
Since commit ab06ec43577177a442e8 we test the vmxnet3 device in the
pxe-tester, too (when running "make check SPEED=slow"). This now
revealed that the code is not working there if the host is a big
endian machine (for example ppc64 or s390x) - "make check SPEED=slow"
is now failing on such hosts.

The vmxnet3 code lacks endianess conversions in a couple of places.
Interestingly, the bitfields in the structs in vmxnet3.h already tried to
take care of the*bit*  endianess of the C compilers - but the code missed
to change the*byte*  endianess when reading or writing the corresponding
structs. So the bitfields are now wrapped into unions which allow to change
the byte endianess during runtime with the non-bitfield member of the union.
With these changes, "make check SPEED=slow" now properly works on big endian
hosts, too.

Reported-by: David Gibson<address@hidden>
Signed-off-by: Thomas Huth<address@hidden>
---
  v2:
  - Introduced vmxnet3_ring_read_curr_txdesc() & vmxnet3_pci_dma_write_rxcd()
    helper functions to wrap the byte-swapping code that is required in
    multiple places (as suggested by Philippe)

Applied with typo fixed.

Thanks



reply via email to

[Prev in Thread] Current Thread [Next in Thread]