From: Jason Wang <jasowang@redhat.com>
To: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bin.meng@windriver.com>,
Christina Wang <christina.wang@windriver.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Markus Carlstedt <markus.carlstedt@windriver.com>
Subject: Re: [PATCH 2/3] hw/net: e1000e: Correct the initial value of VET register
Date: Fri, 2 Jul 2021 13:46:58 +0800 [thread overview]
Message-ID: <7c799472-9e18-9f82-87db-ea43dae58f86@redhat.com> (raw)
In-Reply-To: <CAEUhbmWcQRP4mH6DQcjx_Wv=d=EcdJzdhWYgQJYXY9MV6YGUJQ@mail.gmail.com>
在 2021/7/2 下午12:43, Bin Meng 写道:
> On Fri, Jul 2, 2021 at 11:29 AM Jason Wang <jasowang@redhat.com> wrote:
>>
>> 在 2021/7/1 下午5:46, Bin Meng 写道:
>>> From: Christina Wang <christina.wang@windriver.com>
>>>
>>> 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: Bin Meng <bmeng.cn@gmail.com>
>>> ---
>>>
>>> hw/net/e1000e_core.h | 2 --
>>> hw/net/e1000e.c | 6 ++----
>>> hw/net/e1000e_core.c | 11 ++++++-----
>>> 3 files changed, 8 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/hw/net/e1000e_core.h b/hw/net/e1000e_core.h
>>> index 4ddb4d2c39..07d722bc68 100644
>>> --- a/hw/net/e1000e_core.h
>>> +++ b/hw/net/e1000e_core.h
>>> @@ -105,8 +105,6 @@ struct E1000Core {
>>> uint32_t itr_guest_value;
>>> uint32_t eitr_guest_value[E1000E_MSIX_VEC_NUM];
>>>
>>> - uint16_t vet;
>>> -
>>> uint8_t permanent_mac[ETH_ALEN];
>>>
>>> NICState *owner_nic;
>>> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
>>> index a8a77eca95..1797e4a7cb 100644
>>> --- a/hw/net/e1000e.c
>>> +++ b/hw/net/e1000e.c
>>> @@ -602,8 +602,8 @@ static const VMStateDescription e1000e_vmstate_intr_timer = {
>>>
>>> static const VMStateDescription e1000e_vmstate = {
>>> .name = "e1000e",
>>> - .version_id = 1,
>>> - .minimum_version_id = 1,
>>> + .version_id = 2,
>>> + .minimum_version_id = 2,
>>> .pre_save = e1000e_pre_save,
>>> .post_load = e1000e_post_load,
>>> .fields = (VMStateField[]) {
>>> @@ -645,8 +645,6 @@ static const VMStateDescription e1000e_vmstate = {
>>> VMSTATE_UINT32_ARRAY(core.eitr_guest_value, E1000EState,
>>> E1000E_MSIX_VEC_NUM),
>>>
>>> - VMSTATE_UINT16(core.vet, E1000EState),
>>
>> This is not the suggested way. We'd better not bump version in this case.
>>
>> How about update vet during post_load?
> But core.vet is removed in this patch. Not sure how to handle this?
Keep using core.vet, sync core.vet with mac[VET] during post_load.
Thanks
>
> Regards,
> Bin
>
next prev parent reply other threads:[~2021-07-02 5:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 9:46 [PATCH 1/3] hw/net: e1000: Correct the initial value of VET register Bin Meng
2021-07-01 9:46 ` [PATCH 2/3] hw/net: e1000e: " Bin Meng
2021-07-02 3:29 ` Jason Wang
2021-07-02 4:43 ` Bin Meng
2021-07-02 5:46 ` Jason Wang [this message]
2021-07-02 6:12 ` Bin Meng
2021-07-02 7:01 ` Jason Wang
2021-07-01 9:46 ` [PATCH 3/3] hw/net: e1000e: Don't zero out the VLAN tag in the legacy RX descriptor Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c799472-9e18-9f82-87db-ea43dae58f86@redhat.com \
--to=jasowang@redhat.com \
--cc=bin.meng@windriver.com \
--cc=bmeng.cn@gmail.com \
--cc=christina.wang@windriver.com \
--cc=markus.carlstedt@windriver.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).