<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 02/04/2014 05:10 PM, Yoann Juet
      wrote:<br>
    </div>
    <blockquote cite="mid:52F102D7.2080000@univ-nantes.fr" type="cite">Hi
      all,
      <br>
      <br>
      I'm testing on debian/unstable SR-IOV feature with Broadcom
      BCM57810 cards and KVM hypervisor:
      <br>
      <br>
      Compiled against library: libvirt 1.2.1
      <br>
      Using library: libvirt 1.2.1
      <br>
      Using API: QEMU 1.2.1
      <br>
      Running hypervisor: QEMU 1.7.0
      <br>
      <br>
      bnx2x
      <br>
      -> firmware 7.8.17
      <br>
      -> driver from kernel 3.12.7
      <br>
      <br>
      8 VFs are created on the first PF. For each VF, a specific mac
      address is set manually using "ip link set eth0 vf x mac
      xx:xx:xx:xx:xx" command. </blockquote>
    <br>
    Instead of using <hostdev>, you should instead try using
    <interface type='hostdev'>, which will allow you to specify
    the mac address for the interface directly in the guest's XML config
    (rather than needing to do it separately). Here's a link to
    documentation on this feature:<br>
    <br>
     
<a class="moz-txt-link-freetext" href="http://wiki.libvirt.org/page/Networking#PCI_Passthrough_of_host_network_devices">http://wiki.libvirt.org/page/Networking#PCI_Passthrough_of_host_network_devices</a><br>
    <br>
    (look down to the section titled "Assignment with <interface
    type='hostdev'>")<br>
    <br>
    Or even better, use <interface type='network'> in your guest
    config (still put the <mac address='xx:xx:xx:xx:xx:xx'/>
    element in each one), and define a libvirt network which is a pool
    of SRIOV VFs - this is described further down the same page.<br>
    <br>
    This will not make a difference to the issue you describe below, but
    it should make managing your guest config and lifecycle much
    simpler.<br>
    <br>
    <br>
    <blockquote cite="mid:52F102D7.2080000@univ-nantes.fr" type="cite">I
      run several KVM guests with PCI passthrough (same kernel, bnx2x
      driver and firmware as the host), performance is close to bare
      metal.
      <br>
      <br>
      Well, that sounds good, until I start capturing the traffic inside
      each VM: host traffic is visible as well as traffic destined to
      other VM. It's like if internal card switching was inoperable. I
      made several tests with different kernels, different PCIe
      Passthrough method assignments for libvirt. All failed.
      <br>
    </blockquote>
    <br>
    Define "failed". Do you mean that the cards communicated, but the
    guests can see each others' traffic? Or do you mean that they see
    traffic from each other, but can't seem to communicate normally?<br>
    <br>
    If the problem is the latter, then make sure the PF (eth0 for you, I
    guess) has status UP and RUNNING before you start the guests.<br>
    <br>
    For the former, I'm not clear on the internal rules of switching of
    an SRIOV card. I think in most cases, the SRIOV card's internal
    switch may need to make everything from each VF visible to all other
    VFs, because the physical switch it's connected to may not mirror
    back traffic that really does need to go from one guest to the
    other. 802.1Qbh (which libvirt supports via the <virtualport
    type='802.1Qbh'> element) does this differently, requiring all
    traffic to travel out to the switch, with the switch making the
    decision about what gets mirrored back, but you need an
    802.1Qbh-capable switch for that.<br>
    <br>
    <blockquote cite="mid:52F102D7.2080000@univ-nantes.fr" type="cite">
      <br>
      Has anyone successfully experiment SR-IOV with Broadcom cards on
      linux ?
      <br>
      <br>
      -----
      <br>
      <br>
      Some details:
      <br>
      <br>
      01:00.0 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet (rev 10)
      <br>
      01:00.1 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet (rev 10)
      <br>
      <br>
      01:09.0 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.1 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.2 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.3 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.4 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.5 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.6 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      01:09.7 Ethernet controller: Broadcom Corporation NetXtreme II
      BCM57810 10 Gigabit Ethernet Virtual Function
      <br>
      <br>
      <br>
      # virsh nodedev-dumpxml pci_0000_01_09_0
      <br>
      <device>
      <br>
        <name>pci_0000_01_09_0</name>
      <br>
       
<path>/sys/devices/pci0000:00/0000:00:01.0/0000:01:09.0</path><br>
        <parent>pci_0000_00_01_0</parent>
      <br>
        <driver>
      <br>
          <name>vfio-pci</name>
      <br>
        </driver>
      <br>
        <capability type='pci'>
      <br>
          <domain>0</domain>
      <br>
          <bus>1</bus>
      <br>
          <slot>9</slot>
      <br>
          <function>0</function>
      <br>
          <product id='0x16af'>NetXtreme II BCM57810 10 Gigabit
      Ethernet Virtual Function</product>
      <br>
          <vendor id='0x14e4'>Broadcom Corporation</vendor>
      <br>
          <capability type='phys_function'>
      <br>
            <address domain='0x0000' bus='0x01' slot='0x00'
      function='0x1'/>
      <br>
          </capability>
      <br>
          <iommuGroup number='35'>
      <br>
            <address domain='0x0000' bus='0x01' slot='0x09'
      function='0x0'/>
      <br>
          </iommuGroup>
      <br>
        </capability>
      <br>
      </device>
      <br>
      <br>
      <br>
      # virsh nodedev-dumpxml pci_0000_01_09_1
      <br>
      <device>
      <br>
        <name>pci_0000_01_09_1</name>
      <br>
       
<path>/sys/devices/pci0000:00/0000:00:01.0/0000:01:09.1</path><br>
        <parent>pci_0000_00_01_0</parent>
      <br>
        <driver>
      <br>
          <name>vfio-pci</name>
      <br>
        </driver>
      <br>
        <capability type='pci'>
      <br>
          <domain>0</domain>
      <br>
          <bus>1</bus>
      <br>
          <slot>9</slot>
      <br>
          <function>1</function>
      <br>
          <product id='0x16af'>NetXtreme II BCM57810 10 Gigabit
      Ethernet Virtual Function</product>
      <br>
          <vendor id='0x14e4'>Broadcom Corporation</vendor>
      <br>
          <capability type='phys_function'>
      <br>
            <address domain='0x0000' bus='0x01' slot='0x00'
      function='0x1'/>
      <br>
          </capability>
      <br>
          <iommuGroup number='36'>
      <br>
            <address domain='0x0000' bus='0x01' slot='0x09'
      function='0x1'/>
      <br>
          </iommuGroup>
      <br>
        </capability>
      <br>
      </device>
      <br>
      <br>
      <br>
      Guest A XML:
      <br>
          ...
      <br>
          <hostdev mode='subsystem' type='pci' managed='yes'>
      <br>
            <source>
      <br>
              <address domain='0x0000' bus='0x01' slot='0x09'
      function='0x0'/>
      <br>
            </source>
      <br>
          </hostdev>
      <br>
          ...
      <br>
      <br>
      <br>
      Guest B XML:
      <br>
      <br>
          ...
      <br>
          <hostdev mode='subsystem' type='pci' managed='yes'>
      <br>
            <source>
      <br>
              <address domain='0x0000' bus='0x01' slot='0x09'
      function='0x1'/>
      <br>
            </source>
      <br>
          </hostdev>
      <br>
          ...
      <br>
      <br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
libvirt-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvirt-users@redhat.com">libvirt-users@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvirt-users">https://www.redhat.com/mailman/listinfo/libvirt-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>