Bug 1256626

Summary: windows guest(win7/win10) CTRL_VLAN=on/off does not support for virtio-net-pci
Product: Red Hat Enterprise Linux 7 Reporter: weliao <weliao>
Component: virtio-winAssignee: Yvugenfi <yvugenfi>
virtio-win sub component: virtio-win-prewhql QA Contact: Virtualization Bugs <virt-bugs>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: juzhang, lijin, lmiksik, michen, phou, sjubran, weliao, xfu, yvugenfi
Version: 7.2   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 12:53:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
VLAN Configuration
none
Loading netkvm driver with build 130
none
Set VlanID and query-rx-filter
none
Disable netkvm and Enable it
none
debugviewer.log
none
debug-viewer settings none

Description weliao 2015-08-25 07:03:41 UTC
Description of problem:
Boot windows7/windows10 guest,disable/enable CTRL_VLAN feature in qemu cmdline,check vlan table in rx-filter infomation, the vlan-table all filled from 0~4095 

Version-Release number of selected component (if applicable):
3.10.0-305.el7.x86_64
qemu-kvm-1.5.3-101.el7.x86_64
virtio-win-prewhql-0.1-109

How reproducible:
100%

Steps to Reproduce:
1.Boot windows7/windows10 guest enable CTRL_VLAN feature in qemu cmdline
-netdev tap,id=hostnet0,vhost=on,vhostforce=off \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:83:66:77:88:66,bus=pci.0,addr=0x3,status=on,ctrl_vlan=on 
2.Check vlan table in rx-filter information when guest starts.
{ "execute": "query-rx-filter", "arguments": { "name": "net0" } }

Actual results:
the vlan-table is filled from 0~4095.

Expected results:
the vlan-table is empty


Additional info:
Qemu-kvm cmdline as below:
/usr/libexec/qemu-kvm -name win10qcow2 -M pc-i440fx-rhel7.0.0 -cpu SandyBridge -m 4096 -realtime mlock=off -smp 4,sockets=1,cores=4 \
-device virtio-scsi-pci,id=scsi2,indirect_desc=off,event_idx=off,bus=pci.0 \
-drive file=/mnt/win10.qcow2.1,snapshot=on,if=none,id=drive-scsi-disk0,format=qcow2 \
-device scsi-hd,bus=scsi2.0,drive=drive-scsi-disk0,id=scsi-disk0 \
-boot menu=on -netdev tap,id=hostnet0,vhost=on,vhostforce=off \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:83:66:77:88:66,bus=pci.0,addr=0x3,status=on,ctrl_vlan=on \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x5 \
-spice port=6800,disable-ticketing, -monitor stdio -qmp tcp:0:4444,server,nowait

Comment 2 Yvugenfi@redhat.com 2015-09-22 11:47:27 UTC
Can please provide full exchange of qmp commands before issuing "query-rx-filter"?

Thanks.

Comment 3 Yvugenfi@redhat.com 2015-09-22 11:53:56 UTC
Please ignore comment #2

Comment 4 Yvugenfi@redhat.com 2015-09-22 12:30:51 UTC
1. I think the bug description describes normal behaviour - Windows will fill all possible VLAN values for filtering (allowing to pass) when no specific plan ID is specified.

2. We have a bug in the driver that we ignore ctrl_vlan=off and will still use control queue to set vlan filtering. This should be fixed.

Comment 6 Peixiu Hou 2015-12-09 09:52:21 UTC
Hello,

Reproduced this issue on virtio-win-prewhql-0.1-109 version.

Verified this issue on virtio-win-prewhql-0.1-111 verion.

Steps:
1.Boot windows10 guest enable CTRL_VLAN feature in qemu cmdline.
-netdev tap,id=hostnet0,vhost=on,vhostforce=off \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:83:66:77:88:66,bus=pci.0,addr=0x3,status=on,ctrl_vlan=on 
2.Check vlan table in rx-filter information when guest starts.
{ "execute": "query-rx-filter", "arguments": { "name": "net0" } }

Actual Results:
The vlan-table is filled from 0~4095.


On virtio-win-prewhql-0.1-109 verion , issue can be reproduced.
On virtio-win-prewhql-0.1-111 verion , issue also can be reproduced.
Based on above ,this issue has not been fixed yet.

Comment 7 Peixiu Hou 2016-01-07 02:26:58 UTC
Hello Yan,

Reproduced this issue on virtio-win-prewhql-0.1-109 version.

Verified this issue on virtio-win-prewhql-0.1-112 verion, the issue can be reproduced.

Steps same as comment#0

Actual Results:
The vlan-table is filled from 0~4095.


Best Regard!
Peixiu Hou

Comment 8 lijin 2016-01-07 02:32:13 UTC
re-assign this bug according to comment#7

Comment 9 Yvugenfi@redhat.com 2016-01-07 07:04:22 UTC
(In reply to lijin from comment #8)
> re-assign this bug according to comment#7

Please check comment 4. What are the values of the vlan-table? 

If vlan is on, the table should be filled.

Comment 10 Peixiu Hou 2016-01-07 08:20:59 UTC
Hi Yan,


I retest this case on a linux guest,the actual results as follows:

set ctrl_vlan=on, the vlan table shown empty; 
set ctrl_vlan=off, the vlan table is filled from 0~4095.

And I verified this issue on a windows guest with 112 build, no matter ctrl_vlan is on or off, the vlan table both filled from 0~4095.


Best Regards!
Peixiu Hou

Comment 11 Yvugenfi@redhat.com 2016-01-07 08:26:05 UTC
(In reply to Peixiu Hou from comment #10)
> Hi Yan,
> 
> 
> I retest this case on a linux guest,the actual results as follows:
> 
> set ctrl_vlan=on, the vlan table shown empty; 
> set ctrl_vlan=off, the vlan table is filled from 0~4095.
> 
> And I verified this issue on a windows guest with 112 build, no matter
> ctrl_vlan is on or off, the vlan table both filled from 0~4095.
> 
> 
> Best Regards!
> Peixiu Hou

When vlan is on and we don't have specific plan setting, Windows driver will fill the table from 0 to 4095 (no filtering).

Best regards,
Yan.

Comment 12 Peixiu Hou 2016-01-11 02:32:52 UTC
Hello Yan,

According to your comment#11, we verified this issue with specific vlan setting, but for windows guest, we cannot research a good way for vlan setting. About netkvm driver, we can find "priority or vlan" setting on advance option, but not find "vlan id" setting~~

Could you help us provide detail steps of "specific vlan setting" ?

Thanks very much~~


Best Regards!
Peixiu Hou

Comment 13 Yvugenfi@redhat.com 2017-01-10 13:54:29 UTC
Created attachment 1239114 [details]
VLAN Configuration

I am attaching the reg file that can add vlanid entry for the device in device manager "advanced" type. You will have to use regedit to find the entry for actual device in your system and change "0013" id that you see below to ID from your system


[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0013\Ndi\params\VlanID]

"ParamDesc"="VlanID"

"default"="0"

"type"="int"

"min"="0"

Comment 14 Yvugenfi@redhat.com 2017-01-10 13:55:26 UTC
Please test with using settings from comment #13

Comment 15 Peixiu Hou 2017-01-11 14:39:18 UTC
Hi Yan,

Thanks for your support firstly~
I tried this issue after setting the VlanID, the result as following:

1. Keep the ctrl_vlan=on, set the VlanID to 1, query-rx-filter return info including "vlan-table": [1].
2. Keep the ctrl_vlan=on, set the VlanID to 10, query-rx-filter return info including "vlan-table": [10].
3. Keep the ctrl_vlan=on, set the VlanID to 4095, query-rx-filter return info including "vlan-table": [4095].
4. Keep the ctrl_vlan=on, set the VlanID to 4096, query-rx-filter return info including "vlan-table": [4095,4094,......5,4,3,2,1,0].
5. Keep the ctrl_vlan=on, set the VlanID to 0, query-rx-filter return info including "vlan-table": [4095,4094,......5,4,3,2,1,0].

According to upper results, the number 4096 is a invalid value of VlanID, query-rx-filter will return 0~4095, but 0 is a valid value of VlanID, why query-rx-filter also return 0~4095, shouldn't return like "vlan-table": [0] ? Thanks a lot~


Best Regards~
Peixiu Hou

Comment 16 Yvugenfi@redhat.com 2017-01-19 12:12:08 UTC
(In reply to Peixiu Hou from comment #15)
> Hi Yan,
> 
> Thanks for your support firstly~
> I tried this issue after setting the VlanID, the result as following:
> 
> 1. Keep the ctrl_vlan=on, set the VlanID to 1, query-rx-filter return info
> including "vlan-table": [1].
> 2. Keep the ctrl_vlan=on, set the VlanID to 10, query-rx-filter return info
> including "vlan-table": [10].
> 3. Keep the ctrl_vlan=on, set the VlanID to 4095, query-rx-filter return
> info including "vlan-table": [4095].
> 4. Keep the ctrl_vlan=on, set the VlanID to 4096, query-rx-filter return
> info including "vlan-table": [4095,4094,......5,4,3,2,1,0].
> 5. Keep the ctrl_vlan=on, set the VlanID to 0, query-rx-filter return info
> including "vlan-table": [4095,4094,......5,4,3,2,1,0].
> 
> According to upper results, the number 4096 is a invalid value of VlanID,
> query-rx-filter will return 0~4095, but 0 is a valid value of VlanID, why
> query-rx-filter also return 0~4095, shouldn't return like "vlan-table": [0]
> ? Thanks a lot~
> 
> 
> Best Regards~
> Peixiu Hou

We have the following code in the driver: 

pContext->VlanId = pConfiguration->VlanId.ulValue & 0xfff;

Where the pConfiguration->VlanId.ulValue is the value we read from registry.

We can possibly do two things here:

1. Printout debug message

2. Fail loading the driver (could be an overkill).

Comment 17 Peixiu Hou 2017-01-22 08:52:14 UTC
Created attachment 1243295 [details]
Loading netkvm driver with build 130

Comment 18 Peixiu Hou 2017-01-22 08:53:15 UTC
Created attachment 1243296 [details]
Set VlanID and query-rx-filter

Comment 19 Peixiu Hou 2017-01-22 09:00:59 UTC
Created attachment 1243297 [details]
Disable netkvm and Enable it

Hi Yan,

For "Printout debug message", pls refer to upper 2 attached log files.
For "Fail loading the driver", I tried to collect the log through disable netkvm then enable it, you can refer to this netkvm_disale&enable.LOG. I'm not sure if it's correct, if I'm wrong, pls correct me, thanks~

Best Regards~
Peixiu

Comment 20 Yvugenfi@redhat.com 2017-01-22 11:25:03 UTC
(In reply to Peixiu Hou from comment #19)
> Created attachment 1243297 [details]
> Disable netkvm and Enable it
> 
> Hi Yan,
> 
> For "Printout debug message", pls refer to upper 2 attached log files.
> For "Fail loading the driver", I tried to collect the log through disable
> netkvm then enable it, you can refer to this netkvm_disale&enable.LOG. I'm
> not sure if it's correct, if I'm wrong, pls correct me, thanks~
> 

Thanks! What I meant we could add those feature. Currently they are not in the driver. I think adding warning in debug log is enough. Will add for next versions.

> Best Regards~
> Peixiu

Comment 21 Yvugenfi@redhat.com 2017-02-09 13:22:25 UTC
Adding debugging message in case VLAN ID is larger than possible.

Comment 22 Peixiu Hou 2017-03-06 16:06:21 UTC
Reproduced this issue with virtio-win-prewhql-0.1-133.

Tried to add vlanid entry for the device in device manager "advanced" type,
change the Vlan ID value to 0, 1, 4095, 4096, 4100 and open the debugviewer, the { "execute": "query-rx-filter", "arguments": { "name": "net0" } } result also as upper comment#15. And when setting the Vlan ID larger than 4095, none any warning message show in debugviewer output.

The debugviewer log as attachment debugviewer.LOG, and I'm not sure if the check point is correct, if I'm wrong, pls correct me, thanks~


Best Regards~
Peixiu

Comment 23 Peixiu Hou 2017-03-06 16:07:12 UTC
Created attachment 1260450 [details]
debugviewer.log

Comment 24 lijin 2017-03-29 03:25:45 UTC
Reassign this bug according to comment22.

Yan,could you have a check?

Thanks

Comment 25 Yvugenfi@redhat.com 2017-03-30 11:48:38 UTC
(In reply to lijin from comment #24)
> Reassign this bug according to comment22.
> 
> Yan,could you have a check?
> 
> Thanks

My mistake. We already have mechanism that checks the range for the parameters and fixes the value. Changed the debug level so the printouts will be seen:

[GetConfigurationEntry] value read for *LsoV2IPv4 - current value = 0x1, input value = 0x1
[GetConfigurationEntry] value read for *LsoV2IPv6 - current value = 0x1, input value = 0x1
[GetConfigurationEntry] value read for *PriorityVLANTag - current value = 0x3, input value = 0x3
>>>> Below is the error for VLAN ID
[GetConfigurationEntry] out of range read for VlanId - current value = 0x0, input value = 0x1000
>>>>>
[GetConfigurationEntry] nothing read for PublishIndices - current value = 0x1

Comment 26 Peixiu Hou 2017-05-11 08:46:39 UTC
Hi Yan,

I tried this bug with virtio-win-prewhql-137, keep the vlan-id=0, run "{ "execute": "query-rx-filter", "arguments": { "name": "net0" } } " on qmp monitor, it also print "vlan-table": [4095,4094,......5,4,3,2,1,0] , did not show error like "[GetConfigurationEntry] out of range read for VlanId - current value = 0x0, input value = 0x1000". 
And I also checked on debug-viewer, after disable & enable netkvm device, didn't find any error about VlanId. the log file like the debugviewer.log. The debugviewer setup as attachment picture.

So could you help to confirm if my test steps are correct? or tell us how can see this error "out of range read for VlanId - current value = 0x0, input value = 0x1000"? Thanks a lot~

Best Regards~
Peixiu

Comment 27 Peixiu Hou 2017-05-11 08:47:30 UTC
Created attachment 1277790 [details]
debug-viewer settings

Comment 28 Yvugenfi@redhat.com 2017-05-11 09:07:02 UTC
Sameeh, please help Peixiu.

Comment 29 Sameeh Jubran 2017-05-11 09:22:31 UTC
(In reply to Peixiu Hou from comment #26)
> Hi Yan,
> 
> I tried this bug with virtio-win-prewhql-137, keep the vlan-id=0, run "{
> "execute": "query-rx-filter", "arguments": { "name": "net0" } } " on qmp
> monitor, it also print "vlan-table": [4095,4094,......5,4,3,2,1,0] , did not
> show error like "[GetConfigurationEntry] out of range read for VlanId -
> current value = 0x0, input value = 0x1000". 
> And I also checked on debug-viewer, after disable & enable netkvm device,
> didn't find any error about VlanId. the log file like the debugviewer.log.
> The debugviewer setup as attachment picture.
> 
> So could you help to confirm if my test steps are correct? or tell us how
> can see this error "out of range read for VlanId - current value = 0x0,
> input value = 0x1000"? Thanks a lot~
Where are you trying to insert this value? If it is in the driver's advanced tab Windows prevents you from inserting any out of range value for the vlan id as it is configured to be [0, 4095] and thus the error message "out of range read for VlanId - current value = 0x0, input value = 0x1000" shouldn't appear in the current behaviour of the driver.
> 
> Best Regards~
> Peixiu

Comment 30 Peixiu Hou 2017-05-11 10:00:14 UTC
(In reply to Sameeh from comment #29)
> (In reply to Peixiu Hou from comment #26)
> > Hi Yan,
> > 
> > I tried this bug with virtio-win-prewhql-137, keep the vlan-id=0, run "{
> > "execute": "query-rx-filter", "arguments": { "name": "net0" } } " on qmp
> > monitor, it also print "vlan-table": [4095,4094,......5,4,3,2,1,0] , did not
> > show error like "[GetConfigurationEntry] out of range read for VlanId -
> > current value = 0x0, input value = 0x1000". 
> > And I also checked on debug-viewer, after disable & enable netkvm device,
> > didn't find any error about VlanId. the log file like the debugviewer.log.
> > The debugviewer setup as attachment picture.
> > 
> > So could you help to confirm if my test steps are correct? or tell us how
> > can see this error "out of range read for VlanId - current value = 0x0,
> > input value = 0x1000"? Thanks a lot~
> Where are you trying to insert this value? If it is in the driver's advanced
> tab Windows prevents you from inserting any out of range value for the vlan
> id as it is configured to be [0, 4095] and thus the error message "out of
> range read for VlanId - current value = 0x0, input value = 0x1000" shouldn't
> appear in the current behaviour of the driver.

Thanks and yes, I set the vlan id in the driver's advanced tab. and tried to set it as "-1", seen the error message on the guest.

But this bug is for qmp command test, it need to run "{"execute": "query-rx-filter", "arguments": { "name": "net0" } }" on qmp monitor, I misunderstood the value "0" is out of range, sorry for that. According to your said,the value "0" is in the design range, so if the "ctrl_vlan=on" and set the vlan-id=0, the query-rx-filter should show "vlan-table": [0]".

> > 
> > Best Regards~
> > Peixiu

Comment 31 Sameeh Jubran 2017-05-11 13:31:09 UTC
(In reply to Peixiu Hou from comment #30)
> (In reply to Sameeh from comment #29)
> > (In reply to Peixiu Hou from comment #26)
> > > Hi Yan,
> > > 
> > > I tried this bug with virtio-win-prewhql-137, keep the vlan-id=0, run "{
> > > "execute": "query-rx-filter", "arguments": { "name": "net0" } } " on qmp
> > > monitor, it also print "vlan-table": [4095,4094,......5,4,3,2,1,0] , did not
> > > show error like "[GetConfigurationEntry] out of range read for VlanId -
> > > current value = 0x0, input value = 0x1000". 
> > > And I also checked on debug-viewer, after disable & enable netkvm device,
> > > didn't find any error about VlanId. the log file like the debugviewer.log.
> > > The debugviewer setup as attachment picture.
> > > 
> > > So could you help to confirm if my test steps are correct? or tell us how
> > > can see this error "out of range read for VlanId - current value = 0x0,
> > > input value = 0x1000"? Thanks a lot~
> > Where are you trying to insert this value? If it is in the driver's advanced
> > tab Windows prevents you from inserting any out of range value for the vlan
> > id as it is configured to be [0, 4095] and thus the error message "out of
> > range read for VlanId - current value = 0x0, input value = 0x1000" shouldn't
> > appear in the current behaviour of the driver.
> 
> Thanks and yes, I set the vlan id in the driver's advanced tab. and tried to
> set it as "-1", seen the error message on the guest.
> 
> But this bug is for qmp command test, it need to run "{"execute":
> "query-rx-filter", "arguments": { "name": "net0" } }" on qmp monitor, I
> misunderstood the value "0" is out of range, sorry for that. According to
> your said,the value "0" is in the design range, so if the "ctrl_vlan=on" and
> set the vlan-id=0, the query-rx-filter should show "vlan-table": [0]".
When the vlan id is set to 0 it means that the card can receive any packet with any vlan tag [0-4095], and that's why the driver returns [0 , 1, 2 ... 4095] when the vlan id is set 0 as all of these values are in the active list of the vlan-table.

Please take a look at the vlan-table field documentation in qemu's QMP Reference: 
https://elmarco.fedorapeople.org/qemu-qmp-ref.pdf
> 
> > > 
> > > Best Regards~
> > > Peixiu

Comment 32 lijin 2017-05-12 07:12:16 UTC
change status to verified according to comment#15 and comment#31

Comment 35 errata-xmlrpc 2017-08-01 12:53:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2341