mbox series

[net-next,v2,0/7] mv88e6xxx: Add per port devlink regions

Message ID 20200926210632.3888886-1-andrew@lunn.ch
Headers show
Series mv88e6xxx: Add per port devlink regions | expand

Message

Andrew Lunn Sept. 26, 2020, 9:06 p.m. UTC
This patchset extends devlink regions to support per port regions, and
them makes use of them to support the ports of the mv88e6xxx switches.

root@rap:~# devlink region show
mdio_bus/gpio-0:00/global1: size 64 snapshot []
mdio_bus/gpio-0:00/global2: size 64 snapshot []
mdio_bus/gpio-0:00/atu: size 49152 snapshot []
mdio_bus/gpio-0:00/0/port: size 64 snapshot []
mdio_bus/gpio-0:00/1/port: size 64 snapshot []
mdio_bus/gpio-0:00/2/port: size 64 snapshot []
mdio_bus/gpio-0:00/3/port: size 64 snapshot []
mdio_bus/gpio-0:00/4/port: size 64 snapshot []
mdio_bus/gpio-0:00/5/port: size 64 snapshot []
mdio_bus/gpio-0:00/6/port: size 64 snapshot []
mdio_bus/gpio-0:00/7/port: size 64 snapshot []
mdio_bus/gpio-0:00/8/port: size 64 snapshot []
mdio_bus/gpio-0:00/9/port: size 64 snapshot []
mdio_bus/gpio-0:00/10/port: size 64 snapshot []

root@rap:~# devlink region new mdio_bus/gpio-0:00/1/port snapshot 42
root@rap:~# devlink region dump mdio_bus/gpio-0:00/1/port snapshot 42
0000000000000000 4f 1e 3e 20 00 01 01 39 3f 05 00 00 fd 07 00 00
0000000000000010 80 00 01 00 00 00 00 00 00 00 00 00 00 00 00 91
0000000000000020 00 00 00 00 00 00 00 00 00 00 00 00 22 00 00 00
0000000000000030 07 3e 00 00 00 00 00 80 00 00 00 00 00 00 5b 00

In order to support all ports of the switch, a new devlink flavour has
been added for unused ports:

# devlink port show
mdio_bus/gpio-0:00/0: type notset flavour unused splittable false
mdio_bus/gpio-0:00/1: type notset flavour cpu port 1 splittable false
mdio_bus/gpio-0:00/2: type eth netdev red flavour physical port 2 splittable fae
mdio_bus/gpio-0:00/3: type eth netdev blue flavour physical port 3 splittable fe
mdio_bus/gpio-0:00/4: type eth netdev green flavour physical port 4 splittable e
mdio_bus/gpio-0:00/5: type notset flavour unused splittable false
mdio_bus/gpio-0:00/6: type notset flavour unused splittable false
mdio_bus/gpio-0:00/7: type notset flavour unused splittable false
mdio_bus/gpio-0:00/8: type eth netdev waic0 flavour physical port 8 splittable e
mdio_bus/gpio-0:00/9: type notset flavour unused splittable false
mdio_bus/gpio-0:00/10: type notset flavour unused splittable false

The DSA core now creates the devlink port instances earlier, so that
the driver setup function can make use of them.

Andrew Lunn (7):
  net: devlink: Add unused port flavour
  net: dsa: Make use of devlink port flavour unused
  net: dsa: Register devlink ports before calling DSA driver setup()
  net: devlink: Add support for port regions
  net: dsa: Add devlink port regions support to DSA
  net: dsa: Add helper for converting devlink port to ds and port
  net: dsa: mv88e6xxx: Add per port devlink regions

 drivers/net/dsa/mv88e6xxx/devlink.c | 109 +++++++++++-
 include/net/devlink.h               |  27 +++
 include/net/dsa.h                   |  20 +++
 include/uapi/linux/devlink.h        |   3 +
 net/core/devlink.c                  | 254 +++++++++++++++++++++++++---
 net/dsa/dsa.c                       |  14 ++
 net/dsa/dsa2.c                      | 123 +++++++++-----
 7 files changed, 478 insertions(+), 72 deletions(-)

Comments

Marek Behun Sept. 26, 2020, 10:02 p.m. UTC | #1
Andrew, can this be used to write the registers from userspace, or only
to read it?

Marek
Vladimir Oltean Sept. 26, 2020, 10:11 p.m. UTC | #2
Hi Marek,

On Sun, Sep 27, 2020 at 12:02:19AM +0200, Marek Behun wrote:
> Andrew, can this be used to write the registers from userspace, or only
> to read it?

It is intended for reading only.
https://www.kernel.org/doc/html/latest/networking/devlink/devlink-region.html

Thanks,
-Vladimir