All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Or Gerlitz <gerlitz.or@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Simon Horman <simon.horman@netronome.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	"mchan@broadcom.com" <mchan@broadcom.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Frederick Botha <frederick.botha@netronome.com>,
	nick viljoen <nick.viljoen@netronome.com>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: phys_port_id in switchdev mode?
Date: Tue, 4 Sep 2018 12:20:57 +0200	[thread overview]
Message-ID: <20180904122057.46fce83a@cakuba> (raw)
In-Reply-To: <CAJ3xEMiARmW1TYG4OB2doMoH3tBnDRgY2uVsw-upG0wgZsn6RA@mail.gmail.com>

On Mon, 3 Sep 2018 12:40:22 +0300, Or Gerlitz wrote:
> On Tue, Aug 28, 2018 at 9:05 PM, Jakub Kicinski wrote:
> > Hi!  
> 
> Hi Jakub and sorry for the late reply, this crazigly hot summer refuses to die,
> 
> Note I replied couple of minutes ago but it didn't get to the list, so
> lets take it from this one:
>
> > I wonder if we can use phys_port_id in switchdev to group together
> > interfaces of a single PCI PF?  Here is the problem:
> >
> > With a mix of PF and VF interfaces it gets increasingly difficult to
> > figure out which one corresponds to which PF.  We can identify which
> > *representor* is which, by means of phys_port_name and devlink
> > flavours.  But if the actual VF/PF interfaces are also present on the
> > same host, it gets confusing when one tries to identify the PF they
> > came from.  Generally one has to resort of matching between PCI DBDF of
> > the PF and VFs or read relevant info out of ethtool -i.
> >
> > In multi host scenario this is particularly painful, as there seems to
> > be no immediately obvious way to match PCI interface ID of a card (0,
> > 1, 2, 3, 4...) to the DBDF we have connected.
> >
> > Another angle to this is legacy SR-IOV NDOs.  User space picks a netdev
> > from /sys/bus/pci/$VF_DBDF/physfn/net/ to run the NDOs on in somehow
> > random manner, which means we have to provide those for all devices with
> > link to the PF (all reprs).  And we have to link them (a) because it's
> > right (tm) and (b) to get correct naming.  
> 
> wait, as you commented in later, not only the mellanox vf reprs but rather also
> the nfp vf reprs are not linked to the PF, because ip link output
> grows quadratically.

Right, correct.  If we set phys_port_id libvirt will reliably pick the
correct netdev to run NDOs on (PF/PF repr) so we can remove them from
the other netdevs and therefore limit the size of ip link show output.

> > The only reliable way to make
> > user space (libvirt) choose the repr it should run the NDOs on (which is
> > IMHO the corresponding PF repr) is to set phys_port_id on actual VFs,
> > VF reprs, PFs and PF reprs to a value corresponding to the *PCI PF*,
> > not the external/Ethernet port when in switchdev mode.  User space
> > should understand phys_port_id in this context, given it was originally
> > introduced for matching VFs to ports.  
> 
> Using phy_port_id to match/group VFs to PFs makes sense to me.
> 
> So what would be the libvirt use case you envision that needs
> the VF and PF reprs to support that as well? or maybe you were
> not referring to libvirt but to some other provisioning element? I need
> to refresh my memory on that area.

Ugh, you're right!  Libvirt is our primary target here.  IIUC we need
phys_port_id on the actual VF and then *a* netdev linked to physfn in
sysfs which will have the legacy NDOs.

We can't set the phys_port_id on the VF reprs because then we're back
to the problem of ip link output growing.  Perhaps we shouldn't set it
on PF repr either?

Let's make a table (assuming bare metal cloud scenario where Host0 is
controlling the network, while Host1 is the actual server):

[act - actual; rpr - representor; SN -serial number]

Today:

  dev     | host | sysfs | phys_-  | switch- | phys_-    | NDOs
          |      | link  | port_id | dev_id  | port_name | 
---------------------------------------------------------------
uplink    |   0  |   PF0 |   -     | ASIC SN | p0        | PF0
act PF0   |   0  |   PF0 |   -     |   -     |  -        |  -
act VF0/0 |   0  | VF0/0 |   -     |   -     |  -        |  -
rpr PF0   |   0  |    -  |   -     | ASIC SN | pf0       |  -
rpr VF0/0 |   0  |    -  |   -     | ASIC SN | pf0vf0    |  -
act PF1   |   1  |   PF1 |   -     |   -     |  -        | PF1
act VF1/0 |   1  | VF1/0 |   -     |   -     |  -        |  -
rpr PF1   |   0  |    -  |   -     | ASIC SN | pf1       |  -
rpr VF1/0 |   0  |    -  |   -     | ASIC SN | pf1vf0    |  -

Proposed:

  dev     | host | sysfs | phys_-  | switch- | phys_-    | NDOs
          |      | link  | port_id | dev_id  | port_name |
---------------------------------------------------------------
uplink    |   0  |   PF0 |   -     | ASIC SN | p0        |  -
act PF0   |   0  |   PF0 | PF0 SN  |   -     |  -        | PF0
act VF0/0 |   0  | VF0/0 | PF0 SN  |   -     |  -        |  -
rpr PF0   |   0  |   PF0 |   -     | ASIC SN | pf0       |  -
rpr VF0/0 |   0  |   PF0 |   -     | ASIC SN | pf0vf0    |  -
act PF1   |   1  |   PF1 | PF1 SN  |   -     |  -        | PF1
act VF1/0 |   1  | VF1/0 | PF1 SN  |   -     |  -        |  -
rpr PF1   |   0  |   PF0 |   -     | ASIC SN | pf1       |  -
rpr VF1/0 |   0  |   PF0 |   -     | ASIC SN | pf1vf0    |  -

With this libvirt on Host0 should easily find the actual PF0 netdev to
run the NDO on, if it wants to use VFs:
 - libvrit finds act VF0/0 to plug into the VF;
 - reads its phys_port_id -> "PF0 SN";
 - finds netdev with "PF0 SN" linked to physfn -> "act PF0";
 - runs NDOs on "act PF0" for PF0's VF correctly.


The other problem remains unsolved - Host0 can't be sure without
vendor-specific knowledge whether it's connected to PF0 or PF1.
That's why I was thinking maybe we should provide phys_port_id
on PF representors as well.  That means we'd have to provide the 
legacy NDOs on PF reprs too because libvirt may now find PF repr...
Would it be cleaner to add a new attribute?  

Should Host0 in bare metal cloud have access to SR-IOV NDOs of Host1?

  reply	other threads:[~2018-09-04 14:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180828200539.1c0fe607@cakuba.netronome.com>
2018-08-28 18:43 ` phys_port_id in switchdev mode? Jakub Kicinski
2018-08-31 20:13   ` Marcelo Ricardo Leitner
2018-09-01 11:34     ` Jakub Kicinski
2018-09-03 13:55       ` Marcelo Ricardo Leitner
2018-09-03  9:43     ` Or Gerlitz
2018-09-03  9:40 ` Or Gerlitz
2018-09-04 10:20   ` Jakub Kicinski [this message]
2018-09-04 20:37     ` Or Gerlitz
2018-09-05 16:43       ` Jakub Kicinski
2018-09-05 16:20     ` Samudrala, Sridhar
2018-09-05 16:47       ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180904122057.46fce83a@cakuba \
    --to=jakub.kicinski@netronome.com \
    --cc=alexander.duyck@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=f.fainelli@gmail.com \
    --cc=frederick.botha@netronome.com \
    --cc=gerlitz.or@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=nick.viljoen@netronome.com \
    --cc=simon.horman@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.