[libvirt] [PATCH v2 0/7] properly deal with multiple netdevs on a single PF (i.e. Mellanox dual port NICS)

Laine Stump posted 7 patches 6 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170811014222.29548-1-laine@laine.org
src/libvirt_private.syms    |   1 +
src/util/virhostdev.c       | 137 ++++++++++++++++++++++++++------------
src/util/virnetdev.c        | 159 ++++++++++++++++++++++++++++++++++----------
src/util/virnetdev.h        |   5 ++
src/util/virnetdevmacvlan.c |   5 +-
src/util/virpci.c           |  97 +++++++++++++++++++++++----
src/util/virpci.h           |   9 ++-
7 files changed, 316 insertions(+), 97 deletions(-)
[libvirt] [PATCH v2 0/7] properly deal with multiple netdevs on a single PF (i.e. Mellanox dual port NICS)
Posted by Laine Stump 6 years, 8 months ago
I had already sent 3 patches to properly support macvtap passthrough
of both ports of a dual port VF, and those patches were ACKed by
Michal:

  https://www.redhat.com/archives/libvir-list/2017-August/msg00170.html

When Michal sent the ACK, I was already working on a V2 that updated
Patch 2 (now Patch 3), and added on some more patches in order to
properly support VFIO device assignment of VFs on these cards (but
only if they've been setup in single port mode). A scorecard:

   Patch 1 - same as V1, already ACKed
   Patch 2 - NEW trivial patch to make an arg of a function const
   Patch 3 - update virPCIGetNetName() - improved from V1
   Patch 4 - match phys_port_id, slightly modified from V1 due to change
             in virPCIGetNetName in new Patch 3.
   Patch 5 - NEW save/set/restore using correct PF netdev during vfio
   Patch 6 - NEW eliminate bogus error logs when trying to read saved net config
   Patch 7 - NEW fix checking of PF online status for dual port cards

Here's the original cover letter blurb:

The commit log of Patch 1 explains the majority of the reason for
these patches. In short, they disambiguate the multiple netdevs per
PCI device on the SRIOV PF and VFs of a Mellanox dual port NIC *when
converting from a VF netdev to a PF netdev and vice versa*. This
permits us to set the vlan tag and MAC address for the correct VF
netdev (and detect the online status of the correct PF netdev for that
VF) when using a VF in macvtap passthrough mode. (in other words, with
these patches in place, it is possible to use *all* the VF netdevs on
both ports of a dual port mellanox NIC for macvtap passthrough.)

These patches *do not* solve the problem of saving/setting the mac
address/vlan tag for *both* ports when using a dual port VF for PCI
device assignment with VFIO (see my RFC email from last week). Since I
learned from responses to the RFC that these "dual netdevs on a single
PCI PF/VF" cards are legacy, and all new Mellanox products have only
one netdev per PF/VF (like all the other SRIOV NICs on the market),
I've decided that it's not worth cluttering up libvirt's XML with
config for a dying breed. Since it's possible to support VFIO device
assignment on those cards when the VFs are in single port mode, I
think it is worthwhile to make that work, so that owners of the older
cards can get maximum value from their investment.




Laine Stump (7):
  util: new function virNetDevGetPhysPortID()
  util: Fix const'ness of 1st arg to virPCIGetNetName()
  util: make virPCIGetNetName() more versatile
  util: match phys_port_id when converting PF-netdev to/from VF-netdev
  util: save the correct VF's info when using a dual port SRIOV NIC in
    single port mode
  util: restructure virNetDevReadNetConfig() to eliminate false error
    logs
  util: check for PF online status earlier in guest startup

 src/libvirt_private.syms    |   1 +
 src/util/virhostdev.c       | 137 ++++++++++++++++++++++++++------------
 src/util/virnetdev.c        | 159 ++++++++++++++++++++++++++++++++++----------
 src/util/virnetdev.h        |   5 ++
 src/util/virnetdevmacvlan.c |   5 +-
 src/util/virpci.c           |  97 +++++++++++++++++++++++----
 src/util/virpci.h           |   9 ++-
 7 files changed, 316 insertions(+), 97 deletions(-)

-- 
2.13.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 0/7] properly deal with multiple netdevs on a single PF (i.e. Mellanox dual port NICS)
Posted by Michal Privoznik 6 years, 8 months ago
On 08/11/2017 03:42 AM, Laine Stump wrote:
> I had already sent 3 patches to properly support macvtap passthrough
> of both ports of a dual port VF, and those patches were ACKed by
> Michal:
> 
>   https://www.redhat.com/archives/libvir-list/2017-August/msg00170.html
> 
> When Michal sent the ACK, I was already working on a V2 that updated
> Patch 2 (now Patch 3), and added on some more patches in order to
> properly support VFIO device assignment of VFs on these cards (but
> only if they've been setup in single port mode). A scorecard:
> 
>    Patch 1 - same as V1, already ACKed
>    Patch 2 - NEW trivial patch to make an arg of a function const
>    Patch 3 - update virPCIGetNetName() - improved from V1
>    Patch 4 - match phys_port_id, slightly modified from V1 due to change
>              in virPCIGetNetName in new Patch 3.
>    Patch 5 - NEW save/set/restore using correct PF netdev during vfio
>    Patch 6 - NEW eliminate bogus error logs when trying to read saved net config
>    Patch 7 - NEW fix checking of PF online status for dual port cards
> 
> Here's the original cover letter blurb:
> 
> The commit log of Patch 1 explains the majority of the reason for
> these patches. In short, they disambiguate the multiple netdevs per
> PCI device on the SRIOV PF and VFs of a Mellanox dual port NIC *when
> converting from a VF netdev to a PF netdev and vice versa*. This
> permits us to set the vlan tag and MAC address for the correct VF
> netdev (and detect the online status of the correct PF netdev for that
> VF) when using a VF in macvtap passthrough mode. (in other words, with
> these patches in place, it is possible to use *all* the VF netdevs on
> both ports of a dual port mellanox NIC for macvtap passthrough.)
> 
> These patches *do not* solve the problem of saving/setting the mac
> address/vlan tag for *both* ports when using a dual port VF for PCI
> device assignment with VFIO (see my RFC email from last week). Since I
> learned from responses to the RFC that these "dual netdevs on a single
> PCI PF/VF" cards are legacy, and all new Mellanox products have only
> one netdev per PF/VF (like all the other SRIOV NICs on the market),
> I've decided that it's not worth cluttering up libvirt's XML with
> config for a dying breed. Since it's possible to support VFIO device
> assignment on those cards when the VFs are in single port mode, I
> think it is worthwhile to make that work, so that owners of the older
> cards can get maximum value from their investment.
> 
> 
> 
> 
> Laine Stump (7):
>   util: new function virNetDevGetPhysPortID()
>   util: Fix const'ness of 1st arg to virPCIGetNetName()
>   util: make virPCIGetNetName() more versatile
>   util: match phys_port_id when converting PF-netdev to/from VF-netdev
>   util: save the correct VF's info when using a dual port SRIOV NIC in
>     single port mode
>   util: restructure virNetDevReadNetConfig() to eliminate false error
>     logs
>   util: check for PF online status earlier in guest startup
> 
>  src/libvirt_private.syms    |   1 +
>  src/util/virhostdev.c       | 137 ++++++++++++++++++++++++++------------
>  src/util/virnetdev.c        | 159 ++++++++++++++++++++++++++++++++++----------
>  src/util/virnetdev.h        |   5 ++
>  src/util/virnetdevmacvlan.c |   5 +-
>  src/util/virpci.c           |  97 +++++++++++++++++++++++----
>  src/util/virpci.h           |   9 ++-
>  7 files changed, 316 insertions(+), 97 deletions(-)
> 

Unfortunately, I don't have a machine to test this, but the code looks
good. Therefore you have my ACK.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list