mbox series

[net-next,v2,0/8] devlink: Add SF add/delete devlink ops

Message ID 20200917172020.26484-1-parav@nvidia.com
Headers show
Series devlink: Add SF add/delete devlink ops | expand

Message

Parav Pandit Sept. 17, 2020, 5:20 p.m. UTC
Hi Dave, Jakub,

Similar to PCI VF, PCI SF represents portion of the device.
PCI SF is represented using a new devlink port flavour.

This short series implements small part of the RFC described in detail at [1] and [2].

It extends
(a) devlink core to expose new devlink port flavour 'pcisf'.
(b) Expose new user interface to add/delete devlink port.
(c) Extends netdevsim driver to simulate PCI PF and SF ports
(d) Add port function state attribute

Patch summary:
Patch-1 Extends devlink to expose new PCI SF port flavour
Patch-2 Extends devlink to let user add, delete devlink Port
Patch-3 Prepare code to handle multiple port attributes
Patch-4 Extends devlink to let user get, set function state
Patch-5 Extends netdevsim driver to simulate PCI PF ports
Patch-6 Extends netdevsim driver to simulate hw_addr get/set
Patch-7 Extends netdevsim driver to simulate function state get/set
Patch-8 Extends netdevsim driver to simulate PCI SF ports

[1] https://lore.kernel.org/netdev/20200519092258.GF4655@nanopsycho/
[2] https://marc.info/?l=linux-netdev&m=158555928517777&w=2

---
Changelog:
v1->v2:
 - Fixed extra semicolon at end of switch case reportec by coccinelle

Parav Pandit (8):
  devlink: Introduce PCI SF port flavour and port attribute
  devlink: Support add and delete devlink port
  devlink: Prepare code to fill multiple port function attributes
  devlink: Support get and set state of port function
  netdevsim: Add support for add and delete of a PCI PF port
  netdevsim: Simulate get/set hardware address of a PCI port
  netdevsim: Simulate port function state for a PCI port
  netdevsim: Add support for add and delete PCI SF port

 drivers/net/netdevsim/Makefile        |   3 +-
 drivers/net/netdevsim/dev.c           |  14 +
 drivers/net/netdevsim/netdevsim.h     |  32 ++
 drivers/net/netdevsim/port_function.c | 498 ++++++++++++++++++++++++++
 include/net/devlink.h                 |  75 ++++
 include/uapi/linux/devlink.h          |  13 +
 net/core/devlink.c                    | 230 ++++++++++--
 7 files changed, 840 insertions(+), 25 deletions(-)
 create mode 100644 drivers/net/netdevsim/port_function.c

Comments

Jakub Kicinski Sept. 18, 2020, 4:52 p.m. UTC | #1
On Thu, 17 Sep 2020 20:20:12 +0300 Parav Pandit wrote:
> Hi Dave, Jakub,
> 
> Similar to PCI VF, PCI SF represents portion of the device.
> PCI SF is represented using a new devlink port flavour.
> 
> This short series implements small part of the RFC described in detail at [1] and [2].
> 
> It extends
> (a) devlink core to expose new devlink port flavour 'pcisf'.
> (b) Expose new user interface to add/delete devlink port.
> (c) Extends netdevsim driver to simulate PCI PF and SF ports
> (d) Add port function state attribute

Is this an RFC? It doesn't add any in-tree users.
Parav Pandit Sept. 18, 2020, 5:08 p.m. UTC | #2
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Friday, September 18, 2020 10:22 PM
> 
> On Thu, 17 Sep 2020 20:20:12 +0300 Parav Pandit wrote:
> > Hi Dave, Jakub,
> >
> > Similar to PCI VF, PCI SF represents portion of the device.
> > PCI SF is represented using a new devlink port flavour.
> >
> > This short series implements small part of the RFC described in detail at [1]
> and [2].
> >
> > It extends
> > (a) devlink core to expose new devlink port flavour 'pcisf'.
> > (b) Expose new user interface to add/delete devlink port.
> > (c) Extends netdevsim driver to simulate PCI PF and SF ports
> > (d) Add port function state attribute
> 
> Is this an RFC? It doesn't add any in-tree users.
It is not an RFC.
devlink + mlx5 + netdevsim is crossing 25+ patches on eswitch side.
So splitting it to logical piece as devlink + netdevsim.
After which mlx5 eswitch side come close to 15 + 4 patches which can run as two separate patchset.

What do you suggest?
Jakub Kicinski Sept. 18, 2020, 5:37 p.m. UTC | #3
On Fri, 18 Sep 2020 17:08:15 +0000 Parav Pandit wrote:
> > From: Jakub Kicinski <kuba@kernel.org>
> > Sent: Friday, September 18, 2020 10:22 PM
> > 
> > On Thu, 17 Sep 2020 20:20:12 +0300 Parav Pandit wrote:  
> > > Hi Dave, Jakub,
> > >
> > > Similar to PCI VF, PCI SF represents portion of the device.
> > > PCI SF is represented using a new devlink port flavour.
> > >
> > > This short series implements small part of the RFC described in detail at [1]  
> > and [2].  
> > >
> > > It extends
> > > (a) devlink core to expose new devlink port flavour 'pcisf'.
> > > (b) Expose new user interface to add/delete devlink port.
> > > (c) Extends netdevsim driver to simulate PCI PF and SF ports
> > > (d) Add port function state attribute  
> > 
> > Is this an RFC? It doesn't add any in-tree users.  
> It is not an RFC.
> devlink + mlx5 + netdevsim is crossing 25+ patches on eswitch side.
> So splitting it to logical piece as devlink + netdevsim.
> After which mlx5 eswitch side come close to 15 + 4 patches which can
> run as two separate patchset.
> 
> What do you suggest?

Start with real patches, not netdevsim.
Parav Pandit Sept. 18, 2020, 5:47 p.m. UTC | #4
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Friday, September 18, 2020 11:07 PM
> 
> On Fri, 18 Sep 2020 17:08:15 +0000 Parav Pandit wrote:
> > > From: Jakub Kicinski <kuba@kernel.org>
> > > Sent: Friday, September 18, 2020 10:22 PM
> > >
> > > On Thu, 17 Sep 2020 20:20:12 +0300 Parav Pandit wrote:
> > > > Hi Dave, Jakub,
> > > >
> > > > Similar to PCI VF, PCI SF represents portion of the device.
> > > > PCI SF is represented using a new devlink port flavour.
> > > >
> > > > This short series implements small part of the RFC described in
> > > > detail at [1]
> > > and [2].
> > > >
> > > > It extends
> > > > (a) devlink core to expose new devlink port flavour 'pcisf'.
> > > > (b) Expose new user interface to add/delete devlink port.
> > > > (c) Extends netdevsim driver to simulate PCI PF and SF ports
> > > > (d) Add port function state attribute
> > >
> > > Is this an RFC? It doesn't add any in-tree users.
> > It is not an RFC.
> > devlink + mlx5 + netdevsim is crossing 25+ patches on eswitch side.
> > So splitting it to logical piece as devlink + netdevsim.
> > After which mlx5 eswitch side come close to 15 + 4 patches which can
> > run as two separate patchset.
> >
> > What do you suggest?
> 
> Start with real patches, not netdevsim.

Hmm. Shall I split the series below, would that be ok?

First patchset,
(a) devlink piece to add/delete port
(b) mlx5 counter part

Second patchset,
(a) devlink piece to set the state
(b) mlx5 counter part

Follow on patchset to create/delete sf's netdev on virtbus in mlx5 + devlink plumbing.
Netdevsim after that.
Jakub Kicinski Sept. 18, 2020, 6:28 p.m. UTC | #5
On Fri, 18 Sep 2020 17:47:24 +0000 Parav Pandit wrote:
> > > What do you suggest?  
> > 
> > Start with real patches, not netdevsim.  
> 
> Hmm. Shall I split the series below, would that be ok?
> 
> First patchset,
> (a) devlink piece to add/delete port
> (b) mlx5 counter part
> 
> Second patchset,
> (a) devlink piece to set the state
> (b) mlx5 counter part
> 
> Follow on patchset to create/delete sf's netdev on virtbus in mlx5 + devlink plumbing.
> Netdevsim after that.
 
I'd start from the virtbus part so we can see what's being created.
Parav Pandit Sept. 18, 2020, 8:09 p.m. UTC | #6
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Friday, September 18, 2020 11:58 PM
> 
> On Fri, 18 Sep 2020 17:47:24 +0000 Parav Pandit wrote:
> > > > What do you suggest?
> > >
> > > Start with real patches, not netdevsim.
> >
> > Hmm. Shall I split the series below, would that be ok?
> >
> > First patchset,
> > (a) devlink piece to add/delete port
> > (b) mlx5 counter part
> >
> > Second patchset,
> > (a) devlink piece to set the state
> > (b) mlx5 counter part
> >
> > Follow on patchset to create/delete sf's netdev on virtbus in mlx5 + devlink
> plumbing.
> > Netdevsim after that.
> 
> I'd start from the virtbus part so we can see what's being created.

How do you reach there without a user interface?
Jakub Kicinski Sept. 21, 2020, 10:02 p.m. UTC | #7
On Fri, 18 Sep 2020 20:09:24 +0000 Parav Pandit wrote:
> > From: Jakub Kicinski <kuba@kernel.org>
> > Sent: Friday, September 18, 2020 11:58 PM
> > 
> > On Fri, 18 Sep 2020 17:47:24 +0000 Parav Pandit wrote:  
> > > > > What do you suggest?  
> > > >
> > > > Start with real patches, not netdevsim.  
> > >
> > > Hmm. Shall I split the series below, would that be ok?
> > >
> > > First patchset,
> > > (a) devlink piece to add/delete port
> > > (b) mlx5 counter part
> > >
> > > Second patchset,
> > > (a) devlink piece to set the state
> > > (b) mlx5 counter part
> > >
> > > Follow on patchset to create/delete sf's netdev on virtbus in mlx5 + devlink  
> > plumbing.  
> > > Netdevsim after that.  
> > 
> > I'd start from the virtbus part so we can see what's being created.  
> 
> How do you reach there without a user interface?

Well.. why do you have a user interface which doesn't cause anything to
happen (devices won't get created)? You're splitting the submission,
it's obvious the implementation won't be complete after the first one.

My expectation is that your implementation of the devlink commands will
just hand them off to FW, so there won't be anything interesting there
to review. 

Start with the hard / risky parts - I consider the virtbus to be that,
since the conversation there includes multiple vendors, use cases and
subsystems.
Parav Pandit Sept. 22, 2020, 4:37 a.m. UTC | #8
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Tuesday, September 22, 2020 3:32 AM
> 
> On Fri, 18 Sep 2020 20:09:24 +0000 Parav Pandit wrote:
> > > From: Jakub Kicinski <kuba@kernel.org>
> > > Sent: Friday, September 18, 2020 11:58 PM
> > >
> > > On Fri, 18 Sep 2020 17:47:24 +0000 Parav Pandit wrote:
> > > > > > What do you suggest?
> > > > >
> > > > > Start with real patches, not netdevsim.
> > > >
> > > > Hmm. Shall I split the series below, would that be ok?
> > > >
> > > > First patchset,
> > > > (a) devlink piece to add/delete port
> > > > (b) mlx5 counter part
> > > >
> > > > Second patchset,
> > > > (a) devlink piece to set the state
> > > > (b) mlx5 counter part
> > > >
> > > > Follow on patchset to create/delete sf's netdev on virtbus in mlx5
> > > > + devlink
> > > plumbing.
> > > > Netdevsim after that.
> > >
> > > I'd start from the virtbus part so we can see what's being created.
> >
> > How do you reach there without a user interface?
> 
> Well.. why do you have a user interface which doesn't cause anything to happen
> (devices won't get created)? You're splitting the submission, it's obvious the
> implementation won't be complete after the first one.
> 
> My expectation is that your implementation of the devlink commands will just
> hand them off to FW, so there won't be anything interesting there to review.
Correct. Since handing off to firmware and processing event from firmware is creating fairly more patches,
In first series I will just go inline where devlink command would create/remove virtbus device on state active/inactive.

This way it should be possible to have minimal working series under 20 patches.
This way in one patchset, I prefer to cover
(a) devlink plumbing for port add/del, port state
(b) mlx5 eswitch refactor and devlink callback handling
(c) devlink plumbing around
(d) virtbus device and their netdev creation

This also gives complete view from user interface to netdev device creation.
Post this series, will improve the internals of mlx5 via events etc which doesn't need multi-vendor, virtbus and devlink involvement.
Will differ netdevsim to later date.

> 
> Start with the hard / risky parts - I consider the virtbus to be that, since the
> conversation there includes multiple vendors, use cases and subsystems.