[libvirt] nodedev-dumpxml doesn't refresh supported offload NIC capabilities

Hi, I was playing with the nodedev-dumpxml to see the supported offload NIC capabilities, and It seem that if I disable one of offloading capabilities using ethtool command nodedev-dumpxml it still return the feature as enabled. To get the correct offloading capabilities I have to restart libvirtd. I was wandering if that is an expected behavior in lbivirt . Please see example below with the rx capabilities disabled. virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81 <device> <name>net_enp4s0_f4_52_14_11_73_81</name> <path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path> <parent>pci_0000_04_00_0</parent> <capability type='net'> <interface>enp4s0</interface> <address>f4:52:14:11:73:81</address> <link speed='40000' state='up'/> <feature name='rx'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <capability type='80203'/> </capability> </device> ethtool -K enp4s0 rx off virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81 <device> <name>net_enp4s0_f4_52_14_11_73_81</name> <path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path> <parent>pci_0000_04_00_0</parent> <capability type='net'> <interface>enp4s0</interface> <address>f4:52:14:11:73:81</address> <link speed='40000' state='up'/> <feature name='rx'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <capability type='80203'/> </capability> </device> virsh # [root@r-ae-host05 bin]# ps -ef | grep libvirt root 16743 23086 0 16:43 pts/2 00:00:00 ../sbin/libvirtd root 17440 23086 0 16:47 pts/2 00:00:00 grep --color=auto libvirt [root@r-ae-host05 bin]# kill 16743 [root@r-ae-host05 bin]# ../sbin/libvirtd & [2] 17489 [1] Done ../sbin/libvirtd [root@r-ae-host05 bin]# [root@r-ae-host05 bin]# [root@r-ae-host05 bin]# ./virsh virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81 <device> <name>net_enp4s0_f4_52_14_11_73_81</name> <path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path> <parent>pci_0000_04_00_0</parent> <capability type='net'> <interface>enp4s0</interface> <address>f4:52:14:11:73:81</address> <link speed='40000' state='up'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <feature name='rdma'/> <capability type='80203'/> </capability> </device> Thanks, Moshe Levi.

On 06/16/2015 10:12 AM, Moshe Levi wrote:
Hi,
I was playing with the nodedev-dumpxml to see the supported offload NIC capabilities, and
It seem that if I disable one of offloading capabilities using ethtool command nodedev-dumpxml it still return
the feature as enabled. To get the correct offloading capabilities I have to restart libvirtd.
I was wandering if that is an expected behavior in lbivirt .
the nodedevice driver caches all the information it gets from udev, and tries to rely on udev generating events when something changes. In general this is a bad idea, and has led to at least 2 bug reports I can think of. The function update_caps() in the nodedev driver is intended to be filled in with code to update those attributes of a device that don't get properly updated via udev event responses. It looks like all that would be required in your situation would be to add a call to virNetDevGetFeatures() to the VIR_NODE_DEV_CAP_NET case of the switch in that function. It's complicated a bit by the fact that virNetDevGetFeatures() leaks any existing bitmap of features when it's called. I'm sending a short patch that should fix your problem, which should show up on the list in a few minutes.
Please see example below with the rx capabilities disabled.
virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81
<device>
<name>net_enp4s0_f4_52_14_11_73_81</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path>
<parent>pci_0000_04_00_0</parent>
<capability type='net'>
<interface>enp4s0</interface>
<address>f4:52:14:11:73:81</address>
<link speed='40000' state='up'/>
<feature name='rx'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<capability type='80203'/>
</capability>
</device>
ethtool -K enp4s0 rx off
virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81
<device>
<name>net_enp4s0_f4_52_14_11_73_81</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path>
<parent>pci_0000_04_00_0</parent>
<capability type='net'>
<interface>enp4s0</interface>
<address>f4:52:14:11:73:81</address>
<link speed='40000' state='up'/>
<feature name='rx'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<capability type='80203'/>
</capability>
</device>
virsh #
[root@r-ae-host05 bin]# ps -ef | grep libvirt
root 16743 23086 0 16:43 pts/2 00:00:00 ../sbin/libvirtd
root 17440 23086 0 16:47 pts/2 00:00:00 grep --color=auto libvirt
[root@r-ae-host05 bin]# kill 16743
[root@r-ae-host05 bin]# ../sbin/libvirtd &
[2] 17489
[1] Done ../sbin/libvirtd
[root@r-ae-host05 bin]#
[root@r-ae-host05 bin]#
[root@r-ae-host05 bin]# ./virsh
virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81
<device>
<name>net_enp4s0_f4_52_14_11_73_81</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path>
<parent>pci_0000_04_00_0</parent>
<capability type='net'>
<interface>enp4s0</interface>
<address>f4:52:14:11:73:81</address>
<link speed='40000' state='up'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<feature name='rdma'/>
<capability type='80203'/>
</capability>
</device>
Thanks,
Moshe Levi.
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Hi Laine, I verified your fix and it working. Do I need to fill bug for this? From: sendmail [mailto:justsendmailnothingelse@gmail.com] On Behalf Of Laine Stump Sent: Tuesday, June 16, 2015 6:50 PM To: libvir-list@redhat.com Cc: Moshe Levi Subject: Re: [libvirt] nodedev-dumpxml doesn't refresh supported offload NIC capabilities On 06/16/2015 10:12 AM, Moshe Levi wrote: Hi, I was playing with the nodedev-dumpxml to see the supported offload NIC capabilities, and It seem that if I disable one of offloading capabilities using ethtool command nodedev-dumpxml it still return the feature as enabled. To get the correct offloading capabilities I have to restart libvirtd. I was wandering if that is an expected behavior in lbivirt . the nodedevice driver caches all the information it gets from udev, and tries to rely on udev generating events when something changes. In general this is a bad idea, and has led to at least 2 bug reports I can think of. The function update_caps() in the nodedev driver is intended to be filled in with code to update those attributes of a device that don't get properly updated via udev event responses. It looks like all that would be required in your situation would be to add a call to virNetDevGetFeatures() to the VIR_NODE_DEV_CAP_NET case of the switch in that function. It's complicated a bit by the fact that virNetDevGetFeatures() leaks any existing bitmap of features when it's called. I'm sending a short patch that should fix your problem, which should show up on the list in a few minutes. Please see example below with the rx capabilities disabled. virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81 <device> <name>net_enp4s0_f4_52_14_11_73_81</name> <path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path> <parent>pci_0000_04_00_0</parent> <capability type='net'> <interface>enp4s0</interface> <address>f4:52:14:11:73:81</address> <link speed='40000' state='up'/> <feature name='rx'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <capability type='80203'/> </capability> </device> ethtool -K enp4s0 rx off virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81 <device> <name>net_enp4s0_f4_52_14_11_73_81</name> <path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path> <parent>pci_0000_04_00_0</parent> <capability type='net'> <interface>enp4s0</interface> <address>f4:52:14:11:73:81</address> <link speed='40000' state='up'/> <feature name='rx'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <capability type='80203'/> </capability> </device> virsh # [root@r-ae-host05 bin]# ps -ef | grep libvirt root 16743 23086 0 16:43 pts/2 00:00:00 ../sbin/libvirtd root 17440 23086 0 16:47 pts/2 00:00:00 grep --color=auto libvirt [root@r-ae-host05 bin]# kill 16743 [root@r-ae-host05 bin]# ../sbin/libvirtd & [2] 17489 [1] Done ../sbin/libvirtd [root@r-ae-host05 bin]# [root@r-ae-host05 bin]# [root@r-ae-host05 bin]# ./virsh virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81 <device> <name>net_enp4s0_f4_52_14_11_73_81</name> <path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path> <parent>pci_0000_04_00_0</parent> <capability type='net'> <interface>enp4s0</interface> <address>f4:52:14:11:73:81</address> <link speed='40000' state='up'/> <feature name='tx'/> <feature name='sg'/> <feature name='tso'/> <feature name='gso'/> <feature name='gro'/> <feature name='rxvlan'/> <feature name='txvlan'/> <feature name='rxhash'/> <feature name='rdma'/> <capability type='80203'/> </capability> </device> Thanks, Moshe Levi. -- libvir-list mailing list libvir-list@redhat.com<mailto:libvir-list@redhat.com> https://www.redhat.com/mailman/listinfo/libvir-list

On 06/17/2015 03:18 AM, Moshe Levi wrote:
Hi Laine,
I verified your fix and it working.
Do I need to fill bug for this?
It depends on where you need it. If you need it in the distro build of an already-released version of some distro, then you should file a bug in their tracking system. I did file a bug against RHEL7 so that the bug ID could be listed in the commit log (I just pushed it upstream): https://bugzilla.redhat.com/show_bug.cgi?id=1232880 Feel free to clone that bug if you want it fixed in Fedora 22, 21, or RHEL6.x. Thanks for the report, btw.
*From:*sendmail [mailto:justsendmailnothingelse@gmail.com] *On Behalf Of *Laine Stump *Sent:* Tuesday, June 16, 2015 6:50 PM *To:* libvir-list@redhat.com *Cc:* Moshe Levi *Subject:* Re: [libvirt] nodedev-dumpxml doesn't refresh supported offload NIC capabilities
On 06/16/2015 10:12 AM, Moshe Levi wrote:
Hi,
I was playing with the nodedev-dumpxml to see the supported offload NIC capabilities, and
It seem that if I disable one of offloading capabilities using ethtool command nodedev-dumpxml it still return
the feature as enabled. To get the correct offloading capabilities I have to restart libvirtd.
I was wandering if that is an expected behavior in lbivirt .
the nodedevice driver caches all the information it gets from udev, and tries to rely on udev generating events when something changes. In general this is a bad idea, and has led to at least 2 bug reports I can think of. The function update_caps() in the nodedev driver is intended to be filled in with code to update those attributes of a device that don't get properly updated via udev event responses. It looks like all that would be required in your situation would be to add a call to virNetDevGetFeatures() to the VIR_NODE_DEV_CAP_NET case of the switch in that function. It's complicated a bit by the fact that virNetDevGetFeatures() leaks any existing bitmap of features when it's called. I'm sending a short patch that should fix your problem, which should show up on the list in a few minutes.
Please see example below with the rx capabilities disabled.
virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81
<device>
<name>net_enp4s0_f4_52_14_11_73_81</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path>
<parent>pci_0000_04_00_0</parent>
<capability type='net'>
<interface>enp4s0</interface>
<address>f4:52:14:11:73:81</address>
<link speed='40000' state='up'/>
<feature name='rx'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<capability type='80203'/>
</capability>
</device>
ethtool -K enp4s0 rx off
virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81
<device>
<name>net_enp4s0_f4_52_14_11_73_81</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path>
<parent>pci_0000_04_00_0</parent>
<capability type='net'>
<interface>enp4s0</interface>
<address>f4:52:14:11:73:81</address>
<link speed='40000' state='up'/>
<feature name='rx'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<capability type='80203'/>
</capability>
</device>
virsh #
[root@r-ae-host05 bin]# ps -ef | grep libvirt
root 16743 23086 0 16:43 pts/2 00:00:00 ../sbin/libvirtd
root 17440 23086 0 16:47 pts/2 00:00:00 grep --color=auto libvirt
[root@r-ae-host05 bin]# kill 16743
[root@r-ae-host05 bin]# ../sbin/libvirtd &
[2] 17489
[1] Done ../sbin/libvirtd
[root@r-ae-host05 bin]#
[root@r-ae-host05 bin]#
[root@r-ae-host05 bin]# ./virsh
virsh # nodedev-dumpxml net_enp4s0_f4_52_14_11_73_81
<device>
<name>net_enp4s0_f4_52_14_11_73_81</name>
<path>/sys/devices/pci0000:00/0000:00:02.0/0000:04:00.0/net/enp4s0</path>
<parent>pci_0000_04_00_0</parent>
<capability type='net'>
<interface>enp4s0</interface>
<address>f4:52:14:11:73:81</address>
<link speed='40000' state='up'/>
<feature name='tx'/>
<feature name='sg'/>
<feature name='tso'/>
<feature name='gso'/>
<feature name='gro'/>
<feature name='rxvlan'/>
<feature name='txvlan'/>
<feature name='rxhash'/>
<feature name='rdma'/>
<capability type='80203'/>
</capability>
</device>
Thanks,
Moshe Levi.
--
libvir-list mailing list
libvir-list@redhat.com <mailto:libvir-list@redhat.com>
participants (2)
-
Laine Stump
-
Moshe Levi