linux/net/dsa
Vladimir Oltean 94793a56b3 net: dsa: provide a second modalias to tag proto drivers based on their name
Currently, tagging protocol drivers have a modalias of
"dsa_tag:id-<number>", where the number is one of DSA_TAG_PROTO_*_VALUE.

This modalias makes it possible for the request_module() call in
dsa_tag_driver_get() to work, given the input it has - an integer
returned by ds->ops->get_tag_protocol().

It is also possible to change tagging protocols at (pseudo-)runtime, via
sysfs or via device tree, and this works via the name string of the
tagging protocol rather than via its id (DSA_TAG_PROTO_*_VALUE).

In the latter case, there is no request_module() call, because there is
no association that the DSA core has between the string name and the ID,
to construct the modalias. The module is simply assumed to have been
inserted. This is actually slightly problematic when the tagging
protocol change should take place at probe time, since it's expected
that the dependency module should get autoloaded.

For this purpose, let's introduce a second modalias, so that the DSA
core can call request_module() by name. There is no reason to make the
modalias by name optional, so just modify the MODULE_ALIAS_DSA_TAG_DRIVER()
macro to take both the ID and the name as arguments, and generate two
modaliases behind the scenes.

Suggested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Michael Walle <michael@walle.cc> # on kontron-sl28 w/ ocelot_8021q
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-17 21:16:41 -08:00
..
dsa_priv.h net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
dsa.c net: dsa: rename tagging protocol driver modalias 2022-11-17 21:16:41 -08:00
dsa2.c net: dsa: refactor name assignment for user ports 2022-11-17 19:40:07 -08:00
Kconfig net: dsa: tag_ksz: add tag handling for Microchip LAN937x 2022-07-02 16:34:05 +01:00
Makefile net: dsa: allow the DSA master to be seen and changed through rtnetlink 2022-09-20 10:32:35 +02:00
master.c net: dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims 2022-11-14 11:30:49 +00:00
netlink.c net: dsa: make user ports return to init_net on netns deletion 2022-09-26 11:28:57 -07:00
port.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
slave.c net: dsa: set name_assign_type to NET_NAME_ENUM for enumerated user ports 2022-11-17 19:40:08 -08:00
switch.c net: dsa: allow masters to join a LAG 2022-09-20 10:32:36 +02:00
tag_8021q.c net: dsa: introduce dsa_port_get_master() 2022-09-20 10:32:35 +02:00
tag_ar9331.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_brcm.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_dsa.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_gswip.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_hellcreek.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_ksz.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_lan9303.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_mtk.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_ocelot_8021q.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_ocelot.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_qca.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_rtl4_a.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_rtl8_4.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_rzn1_a5psw.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_sja1105.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_trailer.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00
tag_xrs700x.c net: dsa: provide a second modalias to tag proto drivers based on their name 2022-11-17 21:16:41 -08:00