Subject: Re: [PATCH net-next v2 4/7] devlink: allow subports on devlink PCI ports

From: Jiri Pirko <[email-masked]>
Date: Wed, 13 Mar 2019 08:37:02 +0100

Wed, Mar 13, 2019 at 07:17:04AM CET, [email-masked] wrote:
>
>On 3/12/2019 7:02 AM, Jiri Pirko wrote:
>
>> 
>> > 
>> > > I originally planned to implement sriov orchestration api in devlink too.
>> > 
>> > Interesting, would you mind elaborating?
>> 
>> I have to think about it. But something like this:
>> 
>> After bootup, you see only physical port, PF switch port and PF host leg.
>
>Is this after changing the eswitch mode to 'switchdev'

I believe so. For new drivers, this should be default and only option.

>
>> $ devlink port show
>> pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical switch_id 00154d130d2
>
>Is this the uplink port representor?

Yes

>
>> pci/0000:05:00.0/1: type eth netdev ??? flavour pci_pf_host
>>                      peer pci/0000:05:00.0/10000
>
>I guess this is PF netdev

Yes, port

>
>> pci/0000:05:00.0/10000: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 0
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/1
>
>and this one is PF port representor netdev

Yes, port

>
>> 
>> To create new PF subport under PF 0:
>> $ devlink dev port add pci/0000:05:00.0 flavour pci_pf pf 0
>
>Can we consider l2-fwd offload macvlan device also as a subport of PF?

What does this have to with with macvlan? Macvlan is a separate soft
driver.

>
>> $ devlink port show
>> pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical switch_id 00154d130d2
>> pci/0000:05:00.0/1: type eth netdev ??? flavour pci_pf_host
>>                      peer pci/0000:05:00.0/10000
>> pci/0000:05:00.0/10000: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 0
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/1
>> pci/0000:05:00.0/2: type eth netdev ??? flavour pci_pf_host                            <<<<<<<<<<<<<<<<<<
>>                      peer pci/0000:05:00.0/10001                                        <<<<<<<<<<<<<<<<<<
>> pci/0000:05:00.0/10001: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 1  <<<<<<<<<<<<<<<<<<
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/2                     <<<<<<<<<<<<<<<<<<
>> 
>> To create a new VF under PF 0:
>> $ devlink dev port add pci/0000:05:00.0 flavour pci_vf pf 0
>
>Does this mean that this interface allows creating VFs dynamically one at a
>time?

Yes

>
>> $ devlink port show
>> pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical switch_id 00154d130d2
>> pci/0000:05:00.0/1: type eth netdev ??? flavour pci_pf_host
>>                      peer pci/0000:05:00.0/10000
>> pci/0000:05:00.0/10000: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 0
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/1
>> pci/0000:05:00.0/2: type eth netdev ??? flavour pci_pf_host
>>                      peer pci/0000:05:00.0/10001
>> pci/0000:05:00.0/10001: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 1
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/2
>> pci/0000:05:10.1/0: type eth netdev ??? flavour pci_vf_host                            <<<<<<<<<<<<<<<<<<
>>                      peer pci/0000:05:00.0/10002                                        <<<<<<<<<<<<<<<<<<
>> pci/0000:05:00.0/10002: type eth netdev enp5s0npf0pf0s0 flavour pci_vf pf 0 vf 0       <<<<<<<<<<<<<<<<<<
>>                      switch_id 00154d130d2f peer pci/0000:05:10.1/0                     <<<<<<<<<<<<<<<<<<
>> 
>> So new VF is created.
>> 
>> 
>> To delete, use would need to use the port which is in eswitch:
>> $ devlink port del pci/0000:05:00.0/2
>> devlink answers: Operation not permitted
>> $ devlink port del pci/0000:05:00.0/10001     <<<<<<<<<< this
>> 
>> $ devlink port del pci/0000:05:10.1/0
>> devlink answers: Operation not permitted
>> $ devlink port del pci/0000:05:00.0/10002     <<<<<<<<<< this
>> 
>> This actually removes VF.
>> 
>> 
>> For VF subports this would work too, we just have to have "subport"
>> attribute not only for PFs but also for VFs:
>> 
>> To create a new VF subport under PF 0 and VF 0:
>> $ devlink dev port add pci/0000:05:00.0 flavour pci_vf pf 0 vf 0
>> $ devlink port show
>> pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical switch_id 00154d130d2
>> pci/0000:05:00.0/1: type eth netdev ??? flavour pci_pf_host
>>                      peer pci/0000:05:00.0/10000
>> pci/0000:05:00.0/10000: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 0
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/1
>> pci/0000:05:00.0/2: type eth netdev ??? flavour pci_pf_host
>>                      peer pci/0000:05:00.0/10001
>> pci/0000:05:00.0/10001: type eth netdev enp5s0npf0pf0s0 flavour pci_pf pf 0 subport 1
>>                      switch_id 00154d130d2f peer pci/0000:05:00.0/2
>> pci/0000:05:10.1/0: type eth netdev ??? flavour pci_vf_host
>>                      peer pci/0000:05:00.0/10002
>> pci/0000:05:00.0/10002: type eth netdev enp5s0npf0pf0s0 flavour pci_vf pf 0 vf 0 subport 0
>>                      switch_id 00154d130d2f peer pci/0000:05:10.1/0
>> pci/0000:05:10.1/1: type eth netdev ??? flavour pci_vf_host                                  <<<<<<<<<<<<<<<<<<
>>                      peer pci/0000:05:00.0/10003                                              <<<<<<<<<<<<<<<<<<
>> pci/0000:05:00.0/10003: type eth netdev enp5s0npf0pf0s0 flavour pci_vf pf 0 vf 0 subport 1   <<<<<<<<<<<<<<<<<<
>>                      switch_id 00154d130d2f peer pci/0000:05:10.1/1                           <<<<<<<<<<<<<<<<<<
>> 
>>