aboutsummaryrefslogtreecommitdiff
path: root/hw/net/e1000e.c
diff options
context:
space:
mode:
authorChristina Wang <christina.wang@windriver.com>2021-07-23 15:55:11 +0800
committerJason Wang <jasowang@redhat.com>2021-08-02 12:19:18 +0800
commitd897056960fb379302cc9b656b899829f571eb6e (patch)
treef7ab7067739a9741b0484b15fa2bc19e31a66c97 /hw/net/e1000e.c
parenta1d7e475beb5c9e7a8e1213f29b0d20a208a9ade (diff)
downloadqemu-d897056960fb379302cc9b656b899829f571eb6e.zip
qemu-d897056960fb379302cc9b656b899829f571eb6e.tar.gz
qemu-d897056960fb379302cc9b656b899829f571eb6e.tar.bz2
hw/net: e1000e: Correct the initial value of VET register
The initial value of VLAN Ether Type (VET) register is 0x8100, as per the manual and real hardware. While Linux e1000e driver always writes VET register to 0x8100, it is not always the case for everyone. Drivers relying on the reset value of VET won't be able to transmit and receive VLAN frames in QEMU. Unlike e1000 in QEMU, e1000e uses a field 'vet' in "struct E1000Core" to cache the value of VET register, but the cache only gets updated when VET register is written. To always get a consistent VET value no matter VET is written or remains its reset value, drop the 'vet' field and use 'core->mac[VET]' directly. Reported-by: Markus Carlstedt <markus.carlstedt@windriver.com> Signed-off-by: Christina Wang <christina.wang@windriver.com> Signed-off-by: Bin Meng <bin.meng@windriver.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/e1000e.c')
-rw-r--r--hw/net/e1000e.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index a8a77ec..ac96f76 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -35,6 +35,7 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
+#include "net/eth.h"
#include "net/net.h"
#include "net/tap.h"
#include "qemu/module.h"
@@ -79,7 +80,7 @@ struct E1000EState {
bool disable_vnet;
E1000ECore core;
-
+ bool init_vet;
};
#define E1000E_MMIO_IDX 0
@@ -527,6 +528,10 @@ static void e1000e_qdev_reset(DeviceState *dev)
trace_e1000e_cb_qdev_reset();
e1000e_core_reset(&s->core);
+
+ if (s->init_vet) {
+ s->core.mac[VET] = ETH_P_VLAN;
+ }
}
static int e1000e_pre_save(void *opaque)
@@ -666,6 +671,7 @@ static Property e1000e_properties[] = {
e1000e_prop_subsys_ven, uint16_t),
DEFINE_PROP_SIGNED("subsys", E1000EState, subsys, 0,
e1000e_prop_subsys, uint16_t),
+ DEFINE_PROP_BOOL("init-vet", E1000EState, init_vet, true),
DEFINE_PROP_END_OF_LIST(),
};