<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 12/13/2015 10:51 AM, Moshe Levi
      wrote:<br>
    </div>
    <blockquote
cite="mid:AM4PR05MB1523774FF44AFE73CAC2A6ECD0EC0@AM4PR05MB1523.eurprd05.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hi, <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I have a setup with libvirt 1.3.0 and
          OpenStack trunk. <o:p>
          </o:p></p>
        <p class="MsoNormal">Before launched the VM ip link command show
          the following VF mac/vlan configuration [1]<o:p></o:p></p>
        <p class="MsoNormal">When I launch a VM with <interface
          type='hostdev'> via openstack api (OpenStack direct port)
          <o:p></o:p></p>
        <p class="MsoNormal">I can see that the VF get the mac/vlan
          according to libvrit xml [2] and ip link command  [3], but
          when I delete the VM the mac/vlan config are still shown as in
          [3] and not restored to [1]<o:p></o:p></p>
        <p class="MsoNormal">Shouldn’t  libvirt restore the mac/vlan to
          [1].<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">The same problem exists when using
          <interface type='direct'> (OpenStack macvtap port)  but
          just for the MAC configuration of the VF.
        </p>
      </div>
    </blockquote>
    <br>
    What libvirt does is to restore the MAC address to whatever it was
    before we set it up for use with a guest. Although there are some
    sriov net drivers that (for some unfathomable reason) think it's
    cool to assign a random MAC address to each VF at boot time, the
    "normal" thing is for the VFs to have a MAC address of all 0's to
    start with. So libvirt should be saving 00:00:00:00:00:00 (it will
    be in the file /var/run/libvirt/hostdevmgr/$ifname_vf$vfnum) then
    setting the MAC to use; when done, libvirt will read the
    00:00:00:00:00:00 and use netlink to set the MAC address, but this
    is apparently failing.<br>
    <br>
    I checked on my Fedora 22 system with the igb driver, and found that
    if the MAC address was originally set to something other than 0's,
    it was restored properly by libvirt, but if it was set to all 0's
    originally, the attempt to set it back to 0 would fail.<br>
    <br>
    I then tried doing the same thing with the "ip" utility:<br>
    <br>
        # ip link set dev p4p2 vf 0 mac 00:00:00:00:00:00<br>
    <br>
    and I get the following response:<br>
    <br>
        RTNETLINK answers: Invalid argument<br>
    <br>
    So it appears that either the kernel or the NIC driver is refusing
    to set the MAC address to all 0's. I'm reasonably certain this is a
    regression in the kernel, although I can't say how long it's been
    there, as I don't normally pay attention to this (and as I said,
    many SRIOV NIC drivers don't default their VFs to 0 MAC addresses)<br>
    <br>
    What distro and kernel are you using for your tests?<br>
    <br>
    <br>
    <blockquote
cite="mid:AM4PR05MB1523774FF44AFE73CAC2A6ECD0EC0@AM4PR05MB1523.eurprd05.prod.outlook.com"
      type="cite">
      <div class="WordSection1">
        <p class="MsoNormal"><o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">[1]  - 24: enp3s0f0:
          <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq
          master ovs-system state UP mode DEFAULT group default qlen
          1000<o:p></o:p></p>
        <p class="MsoNormal">    link/ether e4:1d:2d:a5:f1:22 brd
          ff:ff:ff:ff:ff:ff<o:p></o:p></p>
        <p class="MsoNormal">    vf 0 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal">    vf 1 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal">    vf 2 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal">    vf 3 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">[2] - <interface type='hostdev'
managed='yes'>                                                         <o:p></o:p></p>
        <p class="MsoNormal">  <mac address=' fa:16:3e:11:af:fe
          '/>                          
                                             <o:p></o:p></p>
        <p class="MsoNormal">  <driver
name='kvm'/>                                                                           <o:p></o:p></p>
        <p class="MsoNormal">  <source>                                                                                       
          <o:p></o:p></p>
        <p class="MsoNormal">    <address type='pci' domain='0x0000'
          bus='0x02' slot='0x00' function='0x7'/>                  
          <o:p></o:p></p>
        <p class="MsoNormal">  </source>                                                                                      
          <o:p></o:p></p>
        <p class="MsoNormal">  <vlan>                                                                       
                            <o:p></o:p></p>
        <p class="MsoNormal">    <tag
id='190'/>                                                                              <o:p></o:p></p>
        <p class="MsoNormal">  </vlan><o:p></o:p></p>
        <p class="MsoNormal">  <alias name='hostdev0'/><o:p></o:p></p>
        <p class="MsoNormal">  <address type='pci' domain='0x0000'
          bus='0x00' slot='0x04' function='0x0'/><o:p></o:p></p>
        <p class="MsoNormal"></interface><o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">[3] 24: enp3s0f0:
          <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq
          master ovs-system state UP mode DEFAULT group default qlen
          1000<o:p></o:p></p>
        <p class="MsoNormal">    link/ether e4:1d:2d:a5:f1:22 brd
          ff:ff:ff:ff:ff:ff<o:p></o:p></p>
        <p class="MsoNormal">    vf 0 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal">    vf 1 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal">    vf 2 MAC 00:00:00:00:00:00, spoof
          checking off, link-state auto<o:p></o:p></p>
        <p class="MsoNormal">    vf 3 MAC fa:16:3e:11:af:fe, vlan 190,
          spoof checking off, link-state enable<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">--
libvir-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a></pre>
    </blockquote>
    <tt>F15</tt><br>
  </body>
</html>