Thread (9 messages) flat view 9 messages, 3 authors, 2022-11-18
STALE1396d LANDED

Revision v2 of 2 in this series; landed in mainline as 4ab45e973c3f on 2022-11-18.

Revisions (2)
  1. rfc [diff vs current]
  2. v2 current

[PATCH v2 net-next 0/6] Autoload DSA tagging driver when dynamically changing protocol

From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: 2022-11-15 01:19:03

v1->v2:
- fix module auto-loading when changing tag protocol via sysfs
  (don't pass sysfs-formatted string with '\n' to request_module())
- change modalias format from "dsa_tag-21" to "dsa_tag:id-21".
- move some private DSA helpers to net/dsa/dsa_priv.h.

v1 at:
https://patchwork.kernel.org/project/netdevbpf/list/?series=689585

This patch set solves the issue reported by Michael and Heiko here:
https://lore.kernel.org/lkml/20221027113248.420216-1-michael@walle.cc/ (local)
making full use of Michael's suggestion of having two modaliases: one
gets used for loading the tagging protocol when it's the default one
reported by the switch driver, the other gets loaded at user's request,
by name.

  # modinfo tag_ocelot
  filename:       /lib/modules/6.1.0-rc4+/kernel/net/dsa/tag_ocelot.ko
  license:        GPL v2
  alias:          dsa_tag:seville
  alias:          dsa_tag:id-21
  alias:          dsa_tag:ocelot
  alias:          dsa_tag:id-15
  depends:        dsa_core
  intree:         Y
  name:           tag_ocelot
  vermagic:       6.1.0-rc4+ SMP preempt mod_unload modversions aarch64

Tested on NXP LS1028A-RDB with the following device tree addition:

&mscc_felix_port4 {
	dsa-tag-protocol = "ocelot-8021q";
};

&mscc_felix_port5 {
	dsa-tag-protocol = "ocelot-8021q";
};

CONFIG_NET_DSA and everything that depends on it is built as module.
Everything auto-loads, and "cat /sys/class/net/eno2/dsa/tagging" shows
"ocelot-8021q". Traffic works as well. Furthermore, "echo ocelot-8021q"
into the aforementioned sysfs file now auto-loads the driver for it.

Vladimir Oltean (6):
  net: dsa: stop exposing tag proto module helpers to the world
  net: dsa: rename tagging protocol driver modalias
  net: dsa: provide a second modalias to tag proto drivers based on
    their name
  net: dsa: strip sysfs "tagging" string of trailing newline
  net: dsa: rename dsa_tag_driver_get() to dsa_tag_driver_get_by_id()
  net: dsa: autoload tag driver module on tagging protocol change

 include/net/dsa.h          | 70 ---------------------------------
 net/dsa/dsa.c              | 10 +++--
 net/dsa/dsa2.c             |  4 +-
 net/dsa/dsa_priv.h         | 79 +++++++++++++++++++++++++++++++++++++-
 net/dsa/master.c           | 15 +++++++-
 net/dsa/tag_ar9331.c       |  6 ++-
 net/dsa/tag_brcm.c         | 16 +++++---
 net/dsa/tag_dsa.c          | 11 ++++--
 net/dsa/tag_gswip.c        |  6 ++-
 net/dsa/tag_hellcreek.c    |  6 ++-
 net/dsa/tag_ksz.c          | 21 ++++++----
 net/dsa/tag_lan9303.c      |  6 ++-
 net/dsa/tag_mtk.c          |  6 ++-
 net/dsa/tag_ocelot.c       | 11 ++++--
 net/dsa/tag_ocelot_8021q.c |  6 ++-
 net/dsa/tag_qca.c          |  6 ++-
 net/dsa/tag_rtl4_a.c       |  6 ++-
 net/dsa/tag_rtl8_4.c       |  7 +++-
 net/dsa/tag_rzn1_a5psw.c   |  6 ++-
 net/dsa/tag_sja1105.c      | 11 ++++--
 net/dsa/tag_trailer.c      |  6 ++-
 net/dsa/tag_xrs700x.c      |  6 ++-
 22 files changed, 191 insertions(+), 130 deletions(-)

-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help