summaryrefslogtreecommitdiffstats
path: root/net/dsa/master.c
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2022-11-15 02:18:47 +0100
committerJakub Kicinski <kuba@kernel.org>2022-11-18 06:16:42 +0100
commit0184c07a11a243569cb90104980237c8e101f363 (patch)
tree859642e01942d214acf930cedfaabbbc36a6f176 /net/dsa/master.c
parentnet: dsa: rename dsa_tag_driver_get() to dsa_tag_driver_get_by_id() (diff)
downloadlinux-0184c07a11a243569cb90104980237c8e101f363.tar.xz
linux-0184c07a11a243569cb90104980237c8e101f363.zip
net: dsa: autoload tag driver module on tagging protocol change
Issue a request_module() call when an attempt to change the tagging protocol is made, either by sysfs or by device tree. In the case of ocelot (the only driver for which the default and the alternative tagging protocol are compiled as different modules), the user is now no longer required to insert tag_ocelot_8021q.ko manually. In the particular case of ocelot, this solves a problem where tag_ocelot_8021q.ko is built as module, and this is present in the device tree: &mscc_felix_port4 { dsa-tag-protocol = "ocelot-8021q"; }; &mscc_felix_port5 { dsa-tag-protocol = "ocelot-8021q"; }; Because no one attempts to load the module into the kernel at boot time, the switch driver will fail to probe (actually forever defer) until someone manually inserts tag_ocelot_8021q.ko. This is now no longer necessary and happens automatically. Rename dsa_find_tagger_by_name() to denote the change in functionality: there is now feature parity with dsa_tag_driver_get_by_id(), i.o.w. we also load the module if it's missing. Link: https://lore.kernel.org/lkml/20221027113248.420216-1-michael@walle.cc/ 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>
Diffstat (limited to 'net/dsa/master.c')
-rw-r--r--net/dsa/master.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dsa/master.c b/net/dsa/master.c
index f443bf4a3c8c..e24f02743c21 100644
--- a/net/dsa/master.c
+++ b/net/dsa/master.c
@@ -314,9 +314,9 @@ static ssize_t tagging_store(struct device *d, struct device_attribute *attr,
return -ENOMEM;
old_tag_ops = cpu_dp->tag_ops;
- new_tag_ops = dsa_find_tagger_by_name(name);
+ new_tag_ops = dsa_tag_driver_get_by_name(name);
kfree(name);
- /* Bad tagger name, or module is not loaded? */
+ /* Bad tagger name? */
if (IS_ERR(new_tag_ops))
return PTR_ERR(new_tag_ops);