Patchwork [2/2,vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped

login
register
mail settings
Submitter Dmitry Fleytman
Date March 28, 2013, 8:53 a.m.
Message ID <1364460810-24876-3-git-send-email-dmitry@daynix.com>
Download mbox | patch
Permalink /patch/231939/
State New
Headers show

Comments

Dmitry Fleytman - March 28, 2013, 8:53 a.m.
Byte swap is redundant because shared memory reading functions
already swap bytes when required

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
---
 hw/vmxnet3.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
Alexander Graf - April 2, 2013, 6:14 a.m.
On 28.03.2013, at 09:53, Dmitry Fleytman wrote:

> Byte swap is redundant because shared memory reading functions
> already swap bytes when required
> 
> Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>

Acked-by: Alexander Graf <agraf@suse.de>

It might be worth to run an x86 guest with vmxnet3 on a big endian host machine to find potential additional breakage. I don't think it's worth caring about big endian guests with vmxnet3 at this point. Chances are quite low the guest driver would be correct :).


Alex

> ---
> hw/vmxnet3.h | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/vmxnet3.h b/hw/vmxnet3.h
> index 7db0c8f..4eae7c7 100644
> --- a/hw/vmxnet3.h
> +++ b/hw/vmxnet3.h
> @@ -37,10 +37,8 @@
> #define __packed QEMU_PACKED
> 
> #if defined(HOST_WORDS_BIGENDIAN)
> -#define const_cpu_to_le64(x) bswap_64(x)
> #define __BIG_ENDIAN_BITFIELD
> #else
> -#define const_cpu_to_le64(x) (x)
> #endif
> 
> /*
> @@ -137,10 +135,10 @@ struct UPT1_RSSConf {
> 
> /* features */
> enum {
> -    UPT1_F_RXCSUM        = const_cpu_to_le64(0x0001), /* rx csum verification */
> -    UPT1_F_RSS        = const_cpu_to_le64(0x0002),
> -    UPT1_F_RXVLAN        = const_cpu_to_le64(0x0004), /* VLAN tag stripping */
> -    UPT1_F_LRO        = const_cpu_to_le64(0x0008),
> +    UPT1_F_RXCSUM        = 0x0001, /* rx csum verification */
> +    UPT1_F_RSS           = 0x0002,
> +    UPT1_F_RXVLAN        = 0x0004, /* VLAN tag stripping */
> +    UPT1_F_LRO           = 0x0008,
> };
> 
> /* all registers are 32 bit wide */
> @@ -752,7 +750,6 @@ struct Vmxnet3_DriverShared {
> #undef __le32
> #undef __le64
> #undef __packed
> -#undef const_cpu_to_le64
> #if defined(HOST_WORDS_BIGENDIAN)
> #undef __BIG_ENDIAN_BITFIELD
> #endif
> -- 
> 1.8.1.4
> 
>

Patch

diff --git a/hw/vmxnet3.h b/hw/vmxnet3.h
index 7db0c8f..4eae7c7 100644
--- a/hw/vmxnet3.h
+++ b/hw/vmxnet3.h
@@ -37,10 +37,8 @@ 
 #define __packed QEMU_PACKED
 
 #if defined(HOST_WORDS_BIGENDIAN)
-#define const_cpu_to_le64(x) bswap_64(x)
 #define __BIG_ENDIAN_BITFIELD
 #else
-#define const_cpu_to_le64(x) (x)
 #endif
 
 /*
@@ -137,10 +135,10 @@  struct UPT1_RSSConf {
 
 /* features */
 enum {
-    UPT1_F_RXCSUM        = const_cpu_to_le64(0x0001), /* rx csum verification */
-    UPT1_F_RSS        = const_cpu_to_le64(0x0002),
-    UPT1_F_RXVLAN        = const_cpu_to_le64(0x0004), /* VLAN tag stripping */
-    UPT1_F_LRO        = const_cpu_to_le64(0x0008),
+    UPT1_F_RXCSUM        = 0x0001, /* rx csum verification */
+    UPT1_F_RSS           = 0x0002,
+    UPT1_F_RXVLAN        = 0x0004, /* VLAN tag stripping */
+    UPT1_F_LRO           = 0x0008,
 };
 
 /* all registers are 32 bit wide */
@@ -752,7 +750,6 @@  struct Vmxnet3_DriverShared {
 #undef __le32
 #undef __le64
 #undef __packed
-#undef const_cpu_to_le64
 #if defined(HOST_WORDS_BIGENDIAN)
 #undef __BIG_ENDIAN_BITFIELD
 #endif