* [Qemu-devel] [1/2] [vmxnet3] iPXE compatibility fixes
2013-03-28 8:53 [Qemu-devel] [0/2] [vmxnet3] iPXE support and byte swapping fix Dmitry Fleytman
@ 2013-03-28 8:53 ` Dmitry Fleytman
2013-03-28 8:53 ` [Qemu-devel] [2/2] [vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped Dmitry Fleytman
2013-04-08 12:03 ` [Qemu-devel] [0/2] [vmxnet3] iPXE support and byte swapping fix Stefan Hajnoczi
2 siblings, 0 replies; 5+ messages in thread
From: Dmitry Fleytman @ 2013-03-28 8:53 UTC (permalink / raw)
To: qemu-devel
Cc: Dmitry Fleytman, Yan Vugenfirer, Stefan Hajnoczi, Anthony Liguori,
Paolo Bonzini
iPXE vmxnet3 driver makes a few assumptions regarding device operation
that were missed during testing with Linux and Windows drivers.
This patch adds following logic:
1. Additional GET commands processing added
2. Max number of RX chunks should be set to 1 when driver passes 0
via corresponding shared memory field
3. Enforecement for max chunks number added
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
---
hw/vmxnet3.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/vmxnet3.c b/hw/vmxnet3.c
index 925be80..cb36f72 100644
--- a/hw/vmxnet3.c
+++ b/hw/vmxnet3.c
@@ -1033,6 +1033,7 @@ vmxnet3_indicate_packet(VMXNET3State *s)
is_head = false;
ready_rxcd_pa = new_rxcd_pa;
new_rxcd_pa = 0;
+ num_frags++;
}
if (0 != ready_rxcd_pa) {
@@ -1324,6 +1325,10 @@ static void vmxnet3_activate_device(VMXNET3State *s)
s->max_rx_frags =
VMXNET3_READ_DRV_SHARED16(s->drv_shmem, devRead.misc.maxNumRxSG);
+ if (s->max_rx_frags == 0) {
+ s->max_rx_frags = 1;
+ }
+
VMW_CFPRN("Max RX fragments is %u", s->max_rx_frags);
s->event_int_idx =
@@ -1524,6 +1529,12 @@ static uint64_t vmxnet3_get_command_status(VMXNET3State *s)
VMW_CFPRN("Device active: %" PRIx64, ret);
break;
+ case VMXNET3_CMD_RESET_DEV:
+ case VMXNET3_CMD_QUIESCE_DEV:
+ case VMXNET3_CMD_GET_QUEUE_STATUS:
+ ret = 0;
+ break;
+
case VMXNET3_CMD_GET_LINK:
ret = s->link_status_and_speed;
VMW_CFPRN("Link and speed: %" PRIx64, ret);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [2/2] [vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped
2013-03-28 8:53 [Qemu-devel] [0/2] [vmxnet3] iPXE support and byte swapping fix Dmitry Fleytman
2013-03-28 8:53 ` [Qemu-devel] [1/2] [vmxnet3] iPXE compatibility fixes Dmitry Fleytman
@ 2013-03-28 8:53 ` Dmitry Fleytman
2013-04-02 6:14 ` Alexander Graf
2013-04-08 12:03 ` [Qemu-devel] [0/2] [vmxnet3] iPXE support and byte swapping fix Stefan Hajnoczi
2 siblings, 1 reply; 5+ messages in thread
From: Dmitry Fleytman @ 2013-03-28 8:53 UTC (permalink / raw)
To: qemu-devel
Cc: Dmitry Fleytman, Yan Vugenfirer, Stefan Hajnoczi, Anthony Liguori,
Paolo Bonzini
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(-)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [2/2] [vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped
2013-03-28 8:53 ` [Qemu-devel] [2/2] [vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped Dmitry Fleytman
@ 2013-04-02 6:14 ` Alexander Graf
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2013-04-02 6:14 UTC (permalink / raw)
To: Dmitry Fleytman
Cc: Yan Vugenfirer, Stefan Hajnoczi, qemu-devel, Anthony Liguori,
Paolo Bonzini
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
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [0/2] [vmxnet3] iPXE support and byte swapping fix
2013-03-28 8:53 [Qemu-devel] [0/2] [vmxnet3] iPXE support and byte swapping fix Dmitry Fleytman
2013-03-28 8:53 ` [Qemu-devel] [1/2] [vmxnet3] iPXE compatibility fixes Dmitry Fleytman
2013-03-28 8:53 ` [Qemu-devel] [2/2] [vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped Dmitry Fleytman
@ 2013-04-08 12:03 ` Stefan Hajnoczi
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-04-08 12:03 UTC (permalink / raw)
To: Dmitry Fleytman
Cc: Yan Vugenfirer, Paolo Bonzini, qemu-devel, Anthony Liguori
On Thu, Mar 28, 2013 at 10:53:28AM +0200, Dmitry Fleytman wrote:
> These patch set introduces 2 fixes:
> 1. Compatibility with iPXE vmxnet3 driver
> Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
> 2. Duplicate byte swapping while parsing device features
> on big endian platforms
> Reported-by: Alexander Graf <agraf@suse.de>
>
> Dmitry Fleytman (2):
> [vmxnet3] iPXE compatibility fixes
> [vmxnet3] const_cpu_to_le64 wrapping for feature bits dropped
>
> hw/vmxnet3.c | 11 +++++++++++
> hw/vmxnet3.h | 11 ++++-------
> 2 files changed, 15 insertions(+), 7 deletions(-)
>
> --
> 1.8.1.4
>
Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread