public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/9] net: dsa: microchip: Remove one indirection layer
@ 2026-05-05 14:25 Bastien Curutchet (Schneider Electric)
  2026-05-05 14:25 ` [PATCH net-next 1/9] net: dsa: microchip: Remove unused ksz8_all_queues_split() Bastien Curutchet (Schneider Electric)
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Bastien Curutchet (Schneider Electric) @ 2026-05-05 14:25 UTC (permalink / raw)
  To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Chevallier, Russell King
  Cc: Pascal Eberhard, Miquèl Raynal, Thomas Petazzoni,
	Tristram Ha, netdev, linux-kernel,
	Bastien Curutchet (Schneider Electric), Vladimir Oltean

Hi all,

This series follows the discussions we had on a previous series that
aimed to add PTP support for the KSZ8463 (cf [1]).

The KSZ driver got way too convoluted over time because it uses a common
framework to handle more than 20 switches split in 5 families (see below
table)

+----------+---------+---------+---------+---------+---------+
| Family   | KSZ8463 | KSZ87xx | KSZ88xx | KSZ9477 | LAN937X |
+----------+---------+---------+---------+---------+---------+
| Switches | KSZ8463 | KSZ8795 | KSZ88X3 | KSZ8563 | LAN9370 |
|          |         | KSZ8794 | KSZ8864 | KSZ9477 | LAN9371 |
|          |         | KSZ8765 | KSZ8895 | KSZ9896 | LAN9372 |
|          |         |         |         | KSZ9897 | LAN9373 |
|          |         |         |         | KSZ9893 | LAN9374 |
|          |         |         |         | KSZ9563 |         |
|          |         |         |         | KSZ8567 |         |
|          |         |         |         | KSZ9567 |         |
|          |         |         |         | LAN9646 |         |
+----------+---------+---------+---------+---------+---------+

A unique struct dsa_switch_ops is used by all the switches. Next to it,
each switch family has its own struct ksz_dev_ops with family-specific
callbacks. So the dsa_switch_ops operations handle the specificities of
each family through these ksz_dev_ops callbacks and/or conditional
branches based on the chip ID.

Vladimir initiated a rework of the driver ([2]) which I carried on. On
top of the rework I added PTP and periodic output support for the
KSZ8463 (which was my first goal). There are more than 60 patches for
all this so this series will be followed by several others and if you
want to see the full picture we can check my github ([3]).

This first series aims to split the unique struct dsa_switch_ops into
5 so each switch family will be able to implement its own set of DSA
operations.

I haven't finished yet to group all the patches into meaningful series
but here is more or less what I plan to do next:

- A series will remove from the struct ksz_dev_ops the callbacks
  that have an equivalent in dsa_switch_ops to remove one level of
  indirection.
- A series will split again some operations to get rid of the
  if (is_kszXYZ) branches.
- Maybe a fourth one will be needed to completely move out of
  ksz_common.c everything that isn't truly common to all the switches
- A series will add PTP support for the KSZ8463
- A final series will add periodic output support for the KSZ8463

[1]: https://lore.kernel.org/r/20260304-ksz8463-ptp-v6-0-3f4c47954c71@bootlin.com)
[2]: https://github.com/vladimiroltean/linux/tree/ksz_separate_dsa_switch_ops
[3]: https://github.com/bastien-curutchet/linux/tree/ksz_rework

Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
---
Bastien Curutchet (Schneider Electric) (3):
      net: dsa: microchip: Remove unused ksz8_all_queues_split()
      net: dsa: microchip: remove unused port_cleanup() callback
      net: dsa: microchip: split ksz_connect_tag_protocol()

Vladimir Oltean (6):
      net: dsa: microchip: move KSZ8 ksz_dev_ops to ksz8.c
      net: dsa: microchip: move KSZ9477 and LAN937 ksz_dev_ops to individual drivers
      net: dsa: microchip: move phylink_mac_ops to individual drivers
      net: dsa: microchip: ensure each ksz_dev_ops has its own dsa_switch_ops
      net: dsa: microchip: hook up ksz_switch_alloc() to chip-specific dsa_switch_ops
      net: dsa: microchip: split ksz_get_tag_protocol()

 drivers/net/dsa/microchip/ksz8.c         | 506 ++++++++++++++++++++---
 drivers/net/dsa/microchip/ksz8.h         |  62 +--
 drivers/net/dsa/microchip/ksz8863_smi.c  |   8 +-
 drivers/net/dsa/microchip/ksz9477.c      | 283 ++++++++++++-
 drivers/net/dsa/microchip/ksz9477.h      |  24 +-
 drivers/net/dsa/microchip/ksz9477_i2c.c  |   8 +-
 drivers/net/dsa/microchip/ksz_common.c   | 672 ++++++-------------------------
 drivers/net/dsa/microchip/ksz_common.h   | 106 ++++-
 drivers/net/dsa/microchip/ksz_spi.c      |   8 +-
 drivers/net/dsa/microchip/lan937x.h      |  21 +-
 drivers/net/dsa/microchip/lan937x_main.c | 164 +++++++-
 11 files changed, 1108 insertions(+), 754 deletions(-)
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260326-clean-ksz-driver-7d40ec585951

Best regards,
-- 
Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-05-05 14:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 14:25 [PATCH net-next 0/9] net: dsa: microchip: Remove one indirection layer Bastien Curutchet (Schneider Electric)
2026-05-05 14:25 ` [PATCH net-next 1/9] net: dsa: microchip: Remove unused ksz8_all_queues_split() Bastien Curutchet (Schneider Electric)
2026-05-05 14:25 ` [PATCH net-next 2/9] net: dsa: microchip: remove unused port_cleanup() callback Bastien Curutchet (Schneider Electric)
2026-05-05 14:25 ` [PATCH net-next 3/9] net: dsa: microchip: move KSZ8 ksz_dev_ops to ksz8.c Bastien Curutchet
2026-05-05 14:25 ` [PATCH net-next 4/9] net: dsa: microchip: move KSZ9477 and LAN937 ksz_dev_ops to individual drivers Bastien Curutchet
2026-05-05 14:25 ` [PATCH net-next 5/9] net: dsa: microchip: move phylink_mac_ops " Bastien Curutchet
2026-05-05 14:25 ` [PATCH net-next 6/9] net: dsa: microchip: ensure each ksz_dev_ops has its own dsa_switch_ops Bastien Curutchet
2026-05-05 14:25 ` [PATCH net-next 7/9] net: dsa: microchip: hook up ksz_switch_alloc() to chip-specific dsa_switch_ops Bastien Curutchet
2026-05-05 14:25 ` [PATCH net-next 8/9] net: dsa: microchip: split ksz_get_tag_protocol() Bastien Curutchet
2026-05-05 14:25 ` [PATCH net-next 9/9] net: dsa: microchip: split ksz_connect_tag_protocol() Bastien Curutchet (Schneider Electric)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox