mbox series

[v2,net-next,00/11] Replace DSA dp->priv with tagger-owned storage

Message ID 20211209233447.336331-1-vladimir.oltean@nxp.com (mailing list archive)
Headers show
Series Replace DSA dp->priv with tagger-owned storage | expand

Message

Vladimir Oltean Dec. 9, 2021, 11:34 p.m. UTC
Ansuel's recent work on qca8k register access over Ethernet:
https://patchwork.kernel.org/project/netdevbpf/cover/20211207145942.7444-1-ansuelsmth@gmail.com/
has triggered me to do something which I should've done for a longer
time:
https://patchwork.kernel.org/project/netdevbpf/patch/20211109095013.27829-7-martin.kaistra@linutronix.de/#24585521
which is to replace dp->priv with something that has less caveats.

The dp->priv was introduced when sja1105 needed to hold stateful
information in the tagging protocol driver. In that design, dp->priv
held memory allocated by the switch driver, because the tagging protocol
driver design was 100% stateless.

Some years have passed and others have started to feel the need for
stateful information kept by the tagger, as well as passing data back
and forth between the tagging protocol driver and the switch driver.
This isn't possible cleanly in DSA due to a circular dependency which
leads to broken module autoloading:
https://lore.kernel.org/netdev/20210908220834.d7gmtnwrorhharna@skbuf/

This patchset introduces a framework that resembles something normal,
which allows data to be passed from the tagging protocol driver (things
like switch management packets, which aren't intended for the network
stack) to the switch driver, while the tagging protocol still remains
more or less stateless. The overall design of the framework was
discussed with Ansuel too and it appears to be flexible enough to cover
the "register access over Ethernet" use case. Additionally, the existing
uses of dp->priv, which have mainly to do with PTP timestamping, have
also been migrated.

Changes in v2:
Fix transient build breakage in patch 5/11 due to a missing parenthesis,
https://patchwork.hopto.org/static/nipa/592567/12665213/build_clang/
and another transient build warning in patch 4/11 that for some reason
doesn't appear in my W=1 C=1 build.
https://patchwork.hopto.org/static/nipa/592567/12665209/build_clang/stderr

Vladimir Oltean (11):
  net: dsa: introduce tagger-owned storage for private and shared data
  net: dsa: tag_ocelot: convert to tagger-owned data
  net: dsa: sja1105: let deferred packets time out when sent to ports
    going down
  net: dsa: sja1105: bring deferred xmit implementation in line with
    ocelot-8021q
  net: dsa: sja1105: remove hwts_tx_en from tagger data
  net: dsa: sja1105: make dp->priv point directly to sja1105_tagger_data
  net: dsa: sja1105: move ts_id from sja1105_tagger_data
  net: dsa: tag_sja1105: convert to tagger-owned data
  Revert "net: dsa: move sja1110_process_meta_tstamp inside the tagging
    protocol driver"
  net: dsa: tag_sja1105: split sja1105_tagger_data into private and
    public sections
  net: dsa: remove dp->priv

 drivers/net/dsa/ocelot/felix.c         |  64 ++-----
 drivers/net/dsa/sja1105/sja1105.h      |   6 +-
 drivers/net/dsa/sja1105/sja1105_main.c | 121 ++++---------
 drivers/net/dsa/sja1105/sja1105_ptp.c  |  86 ++++++----
 drivers/net/dsa/sja1105/sja1105_ptp.h  |  24 +++
 include/linux/dsa/ocelot.h             |  12 +-
 include/linux/dsa/sja1105.h            |  61 +++----
 include/net/dsa.h                      |  18 +-
 net/dsa/dsa2.c                         |  73 +++++++-
 net/dsa/dsa_priv.h                     |   1 +
 net/dsa/switch.c                       |  14 ++
 net/dsa/tag_ocelot_8021q.c             |  73 +++++++-
 net/dsa/tag_sja1105.c                  | 224 +++++++++++++++++--------
 13 files changed, 483 insertions(+), 294 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 12, 2021, 4 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 10 Dec 2021 01:34:36 +0200 you wrote:
> Ansuel's recent work on qca8k register access over Ethernet:
> https://patchwork.kernel.org/project/netdevbpf/cover/20211207145942.7444-1-ansuelsmth@gmail.com/
> has triggered me to do something which I should've done for a longer
> time:
> https://patchwork.kernel.org/project/netdevbpf/patch/20211109095013.27829-7-martin.kaistra@linutronix.de/#24585521
> which is to replace dp->priv with something that has less caveats.
> 
> [...]

Here is the summary with links:
  - [v2,net-next,01/11] net: dsa: introduce tagger-owned storage for private and shared data
    https://git.kernel.org/netdev/net-next/c/dc452a471dba
  - [v2,net-next,02/11] net: dsa: tag_ocelot: convert to tagger-owned data
    https://git.kernel.org/netdev/net-next/c/35d976802124
  - [v2,net-next,03/11] net: dsa: sja1105: let deferred packets time out when sent to ports going down
    https://git.kernel.org/netdev/net-next/c/a3d74295d790
  - [v2,net-next,04/11] net: dsa: sja1105: bring deferred xmit implementation in line with ocelot-8021q
    https://git.kernel.org/netdev/net-next/c/d38049bbe760
  - [v2,net-next,05/11] net: dsa: sja1105: remove hwts_tx_en from tagger data
    https://git.kernel.org/netdev/net-next/c/6f6770ab1ce2
  - [v2,net-next,06/11] net: dsa: sja1105: make dp->priv point directly to sja1105_tagger_data
    https://git.kernel.org/netdev/net-next/c/bfcf14252220
  - [v2,net-next,07/11] net: dsa: sja1105: move ts_id from sja1105_tagger_data
    https://git.kernel.org/netdev/net-next/c/22ee9f8e4011
  - [v2,net-next,08/11] net: dsa: tag_sja1105: convert to tagger-owned data
    https://git.kernel.org/netdev/net-next/c/c79e84866d2a
  - [v2,net-next,09/11] Revert "net: dsa: move sja1110_process_meta_tstamp inside the tagging protocol driver"
    https://git.kernel.org/netdev/net-next/c/fcbf979a5b4b
  - [v2,net-next,10/11] net: dsa: tag_sja1105: split sja1105_tagger_data into private and public sections
    https://git.kernel.org/netdev/net-next/c/950a419d9de1
  - [v2,net-next,11/11] net: dsa: remove dp->priv
    https://git.kernel.org/netdev/net-next/c/4f3cb34364e2

You are awesome, thank you!