Skip to content

RFC Add new switchdev device class

[email protected] netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2switchdev: create new switchdev device classinclude/net/switchdev.h net/switchdev/switchdev.c+92 -00 replies
2/2rocker: register each switch as a switchdevdrivers/net/ethernet/rocker/rocker.c+23 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH net-next 0/2] Add new switchdev device class

From: Scott Feldman <[email protected]>

In the switchdev model, we use netdevs to represent switchdev ports, but we have no representation for the switch itself. So, introduce a new switchdev device class so we can define semantics and programming interfaces for the switch itself. Switchdev device class isn't tied to any particular bus.

This patch set is just the skeleton to get us started. It adds the sysfs object registration for the new class and defines a class-level attr "foo". With the new class, we could hook PM functions, for example, to handle power transitions at the switch level. I registered rocker and get:

   $ ls /sys/class/switchdev/5254001235010000/
   foo  power  subsystem  uevent

So what next? I'd rather not build APIs around sysfs, so we need a netlink API we can build on top of this. It's not really rtnl. Maybe genl would work? What ever it is, we'd need to teach iproute2 about a new 'switch' command.

Netlink API would allow us to represent switch-wide objects such as registers, tables, stats, firmware, and maybe even control. I think with with netlink TLVs, we can create a framework for these objects but still allow the switch driver provide switch-specific info. For example, a table object:

[TABLES]

	[TABLE]
		[FIELDS]
			[FIELD]
				[ID, TYPE]
		[DATA]
			[ID, VALUE]

Maybe iproute2 has pretty-printers for specific switches like ethtool has for reg dumps.

I don't know about how this overlaps with DSA platform_class. Florian?

Comments?

Scott Feldman (2):
switchdev: create new switchdev device class
rocker: register each switch as a switchdev

 drivers/net/ethernet/rocker/rocker.c |   23 ++++++++++
 include/net/switchdev.h              |   16 +++++++
 net/switchdev/switchdev.c            |   76 ++++++++++++++++++++++++++++++++++
 3 files changed, 115 insertions(+)
Signature · 1 line
1.7.10.4