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

Laine Stump laine at laine.org
Tue Jun 16 15:50:27 UTC 2015


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 at 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 at r-ae-host05 bin]# kill 16743
>
> [root at r-ae-host05 bin]# ../sbin/libvirtd &
>
> [2] 17489
>
> [1]   Done                    ../sbin/libvirtd
>
> [root at r-ae-host05 bin]#
>
> [root at r-ae-host05 bin]#
>
> [root at 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150616/56aaba24/attachment-0001.htm>


More information about the libvir-list mailing list