Skip to contentSkip to conversation

Revert "arm64: dts: ls1028a: sl28: use ocelot-8021q tagging by default"

PATCH In review Michael Walle 2 participants 11 messages Oct 27, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "arm64: dts: ls1028a: sl28: use ocelot-8021q tagging by default"

This reverts commit be0b178c50c37a666d54f435da71cf9f008362a0.

This commit will break networking on the sl28 boards if the tagger is not compiled into the kernel. If a non-default tagger is used, the kernel doesn't do a request_module(). Fixing that is also not that trivial because the tagger modules are loaded by ids, not by name. Thus for now, just revert to the default tagger until that is fixed.

Fixes be0b178c50c3 ("arm64: dts: ls1028a: sl28: use ocelot-8021q tagging by default")

---
Vladimir, I'm not sure how to fix that one. Adding aliases to the tagger modules? Something like "MODULE_ALIAS("dsa_tag-ocelot-8021q");" and then do a request_module() in dsa_find_tagger_by_name(), too?

 .../arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts +0 -8
index 72429b37a8b4..771c50c7f50a 100644
@@ -324,14 +324,6 @@ &lpuart1 {
 	status = "okay";
 };
 
-&mscc_felix_port4 {
-	dsa-tag-protocol = "ocelot-8021q";
-};
-
-&mscc_felix_port5 {
-	dsa-tag-protocol = "ocelot-8021q";
-};
-
 &usb0 {
 	status = "okay";
 };
Signature · 1 line
2.30.2
#1 lore raw
Quoted 41 lines · Michael Walle

This reverts commit be0b178c50c37a666d54f435da71cf9f008362a0.

This commit will break networking on the sl28 boards if the tagger is not compiled into the kernel. If a non-default tagger is used, the kernel doesn't do a request_module(). Fixing that is also not that trivial because the tagger modules are loaded by ids, not by name. Thus for now, just revert to the default tagger until that is fixed.

Fixes be0b178c50c3 ("arm64: dts: ls1028a: sl28: use ocelot-8021q tagging by default")

---
Vladimir, I'm not sure how to fix that one. Adding aliases to the tagger modules? Something like "MODULE_ALIAS("dsa_tag-ocelot-8021q");" and then do a request_module() in dsa_find_tagger_by_name(), too?

 .../arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts +0 -8
index 72429b37a8b4..771c50c7f50a 100644
@@ -324,14 +324,6 @@ &lpuart1 {
 	status = "okay";
 };
 
-&mscc_felix_port4 {
-	dsa-tag-protocol = "ocelot-8021q";
-};
-
-&mscc_felix_port5 {
-	dsa-tag-protocol = "ocelot-8021q";
-};
-
 &usb0 {
 	status = "okay";
 };
Signature · 1 line
2.30.2

Pretty nasty. Of all the switch drivers that support tagging protocol change, Ocelot/Felix is the only one with this bug, because in all other cases, the default and the alternative tagging protocol are part of the same .ko. Only here we have tag_ocelot.ko and tag_ocelot_8021q.ko.

The problem preventing us from calling request_module() is that currently, the string identifying the tagging protocol (to which we match device tree information) is part of the tag_*.ko. I think we'd need the translation table between string and enum dsa_tag_protocol to be part of dsa_core.ko.

#2 lore raw
Quoted 48 lines · Vladimir Oltean
Quoted 41 lines · Michael Walle

This reverts commit be0b178c50c37a666d54f435da71cf9f008362a0.

This commit will break networking on the sl28 boards if the tagger is not compiled into the kernel. If a non-default tagger is used, the kernel doesn't do a request_module(). Fixing that is also not that trivial because the tagger modules are loaded by ids, not by name. Thus for now, just revert to the default tagger until that is fixed.

Fixes be0b178c50c3 ("arm64: dts: ls1028a: sl28: use ocelot-8021q tagging by default")

---
Vladimir, I'm not sure how to fix that one. Adding aliases to the tagger modules? Something like "MODULE_ALIAS("dsa_tag-ocelot-8021q");" and then do a request_module() in dsa_find_tagger_by_name(), too?

 .../arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28.dts +0 -8
index 72429b37a8b4..771c50c7f50a 100644
@@ -324,14 +324,6 @@ &lpuart1 {
 	status = "okay";
 };
 
-&mscc_felix_port4 {
-	dsa-tag-protocol = "ocelot-8021q";
-};
-
-&mscc_felix_port5 {
-	dsa-tag-protocol = "ocelot-8021q";
-};
-
 &usb0 {
 	status = "okay";
 };
Signature · 1 line
2.30.2

Pretty nasty. Of all the switch drivers that support tagging protocol change, Ocelot/Felix is the only one with this bug, because in all other cases, the default and the alternative tagging protocol are part of the same .ko. Only here we have tag_ocelot.ko and tag_ocelot_8021q.ko.

Quoted 5 lines

The problem preventing us from calling request_module() is that currently, the string identifying the tagging protocol (to which we match device tree information) is part of the tag_*.ko. I think we'd need the translation table between string and enum dsa_tag_protocol to be part of dsa_core.ko.

I think we should treat what we committed to in terms of dt-bindings with utmost respect, so I would consider your proposed revert as the absolute last option. Reverting a device tree change doesn't mean that the device trees without the revert will disappear from circulation.

So far we have 3 options for fixing this within the kernel

- make tag_ocelot.o and tag_ocelot_8021q.o link into the same tag_ocelot.ko

- change the MODULE_ALIAS() of all tagging protocol driver modules from "dsa_tag-<number" to something containing their string name - what you proposed. I don't know why the current MODULE_ALIAS() is formatted the way it is. Maybe Andrew can comment on whether this is feasible. I think there isn't any backwards compatibility concern, since only modules compiled for a certain kernel version are expected to be loaded.

- put a translation table between string and MODULE_ALIAS() inside dsa_core.ko, which potentially duplicates code. Maybe if we auto-generate it somehow?
_______________________________________________
linux-arm-kernel mailing list [email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw
Quoted 18 lines · Vladimir Oltean

I think we should treat what we committed to in terms of dt-bindings with utmost respect, so I would consider your proposed revert as the absolute last option. Reverting a device tree change doesn't mean that the device trees without the revert will disappear from circulation.

So far we have 3 options for fixing this within the kernel

- make tag_ocelot.o and tag_ocelot_8021q.o link into the same tag_ocelot.ko

- change the MODULE_ALIAS() of all tagging protocol driver modules from "dsa_tag-<number" to something containing their string name - what you proposed. I don't know why the current MODULE_ALIAS() is formatted the way it is. Maybe Andrew can comment on whether this is feasible. I think there isn't any backwards compatibility concern, since only modules compiled for a certain kernel version are expected to be loaded.

Quoted 3 lines

- put a translation table between string and MODULE_ALIAS() inside dsa_core.ko, which potentially duplicates code. Maybe if we auto-generate it somehow?

Sorry for sending so many emails. I think the problem we should fix first and foremost is that, if there's a user protocol specified in the device tree but the kernel fails to load it, it should simply stick with the default tagging protocol, instead of failing to probe. Everything else can be dealt with as a future refinement.

#4 lore raw

Am 2022-10-27 14:40, schrieb Vladimir Oltean:

Quoted 5 lines

Sorry for sending so many emails. I think the problem we should fix first and foremost is that, if there's a user protocol specified in the device tree but the kernel fails to load it, it should simply stick with the default tagging protocol, instead of failing to probe. Everything else can be dealt with as a future refinement.

Sounds good to me. Should I come up with a patch or will you do it?

-michael

#5 lore raw
Quoted 9 lines · Michael Walle

Am 2022-10-27 14:40, schrieb Vladimir Oltean:

Quoted 5 lines

Sorry for sending so many emails. I think the problem we should fix first and foremost is that, if there's a user protocol specified in the device tree but the kernel fails to load it, it should simply stick with the default tagging protocol, instead of failing to probe. Everything else can be dealt with as a future refinement.

Sounds good to me. Should I come up with a patch or will you do it?

I'll try to prepare a patch and copy you and Heiko. I hope to do that soon, but I've been running with hardirqs disabled for the past week or so, and as you can imagine, things are a bit crazy right now and there's a lot of pending work to do

#6 lore raw
In reply to Vladimir Oltean

Am 2022-10-27 14:27, schrieb Vladimir Oltean:

Quoted 21 lines
Quoted 10 lines

Pretty nasty. Of all the switch drivers that support tagging protocol change, Ocelot/Felix is the only one with this bug, because in all other cases, the default and the alternative tagging protocol are part of the same .ko. Only here we have tag_ocelot.ko and tag_ocelot_8021q.ko.

The problem preventing us from calling request_module() is that currently, the string identifying the tagging protocol (to which we match device tree information) is part of the tag_*.ko. I think we'd need the translation table between string and enum dsa_tag_protocol to be part of dsa_core.ko.

I think we should treat what we committed to in terms of dt-bindings with utmost respect, so I would consider your proposed revert as the absolute last option. Reverting a device tree change doesn't mean that the device trees without the revert will disappear from circulation.

So far we have 3 options for fixing this within the kernel

- make tag_ocelot.o and tag_ocelot_8021q.o link into the same tag_ocelot.ko

Quoted 9 lines

- change the MODULE_ALIAS() of all tagging protocol driver modules from "dsa_tag-<number" to something containing their string name - what
you
proposed. I don't know why the current MODULE_ALIAS() is formatted
the
way it is. Maybe Andrew can comment on whether this is feasible. I think there isn't any backwards compatibility concern, since only modules compiled for a certain kernel version are expected to be loaded.

FWIW, you can have multiple aliases if we somehow need to keep the IDs, too.

Quoted 3 lines

- put a translation table between string and MODULE_ALIAS() inside dsa_core.ko, which potentially duplicates code. Maybe if we auto-generate it somehow?

Yeah, I also thought of a table with of name to module alias mapping. But then you'd have two places to keep in sync (of not autogenerated).

-michael

#10 lore raw
In reply to Michael Walle

Am 2022-10-27 13:32, schrieb Michael Walle:

Quoted 8 lines

This reverts commit be0b178c50c37a666d54f435da71cf9f008362a0.

This commit will break networking on the sl28 boards if the tagger is not compiled into the kernel. If a non-default tagger is used, the kernel doesn't do a request_module(). Fixing that is also not that trivial because the tagger modules are loaded by ids, not by name. Thus for now, just revert to the default tagger until that is fixed.

Quoted 4 lines
Fixes be0b178c50c3 ("arm64: dts: ls1028a: sl28: use ocelot-8021q

tagging by default")

Please disregard this patch. The proper fix is here:
https://lore.kernel.org/netdev/[email protected]/

-michael

#7 lore raw
In reply to Michael Walle
Quoted 10 lines · Michael Walle
Quoted 7 lines

- change the MODULE_ALIAS() of all tagging protocol driver modules from "dsa_tag-<number" to something containing their string name - what you proposed. I don't know why the current MODULE_ALIAS() is formatted the way it is. Maybe Andrew can comment on whether this is feasible. I think there isn't any backwards compatibility concern, since only modules compiled for a certain kernel version are expected to be loaded.

FWIW, you can have multiple aliases if we somehow need to keep the IDs, too.

Yeah, that's worth exploring, but it means that we have 2 code paths for request_module() with different string formats. To me this is slightly undesirable, we should try to consolidate the mechanisms in the core.

Quoted 6 lines
Quoted 3 lines

- put a translation table between string and MODULE_ALIAS() inside dsa_core.ko, which potentially duplicates code. Maybe if we auto-generate it somehow?

Yeah, I also thought of a table with of name to module alias mapping. But then you'd have two places to keep in sync (of not autogenerated).

Well, to be fair, this is not exactly true. As far as I could find (grep for "ops->name" in net/dsa), there are only 3 instances of reading the "name" field of struct dsa_device_ops, and none of them are from a fast path.

I can imagine a table along the lines of:

static const char * const dsa_tag_proto_names[] = {
	[DSA_TAG_PROTO_NONE] = "none",
	[DSA_TAG_PROTO_BRCM] = "brcm",
	....
};

which is then used to directly replace ops->name
(becomes dsa_tag_proto_names[ops->proto]).

Then, we could add a new function "dsa_tag_protocol_name_to_id()" or something along those lines, and construct the modalias string based on that.

No duplication necessary, since we would remove dsa_device_ops :: name.

#8 lore raw

Am 2022-10-27 20:04, schrieb Vladimir Oltean:

Quoted 36 lines · Michael Walle
Quoted 10 lines
Quoted 7 lines

- change the MODULE_ALIAS() of all tagging protocol driver modules from "dsa_tag-<number" to something containing their string name - what you proposed. I don't know why the current MODULE_ALIAS() is formatted the way it is. Maybe Andrew can comment on whether this is feasible. I think there isn't any backwards compatibility concern, since only modules compiled for a certain kernel version are expected to be loaded.

FWIW, you can have multiple aliases if we somehow need to keep the IDs, too.

Yeah, that's worth exploring, but it means that we have 2 code paths for request_module() with different string formats. To me this is slightly undesirable, we should try to consolidate the mechanisms in the core.

Quoted 6 lines
Quoted 3 lines

- put a translation table between string and MODULE_ALIAS() inside dsa_core.ko, which potentially duplicates code. Maybe if we auto-generate it somehow?

Yeah, I also thought of a table with of name to module alias mapping. But then you'd have two places to keep in sync (of not autogenerated).

Well, to be fair, this is not exactly true. As far as I could find (grep for "ops->name" in net/dsa), there are only 3 instances of reading the "name" field of struct dsa_device_ops, and none of them are from a fast path.

I can imagine a table along the lines of:

static const char * const dsa_tag_proto_names[] = {
	[DSA_TAG_PROTO_NONE] = "none",
	[DSA_TAG_PROTO_BRCM] = "brcm",
	....
};
Quoted 8 lines

which is then used to directly replace ops->name
(becomes dsa_tag_proto_names[ops->proto]).

Then, we could add a new function "dsa_tag_protocol_name_to_id()" or something along those lines, and construct the modalias string based on that.

No duplication necessary, since we would remove dsa_device_ops :: name.

If one would a new tagger you'd need to add it to dsa_tag_proto_names[] as well as adding the tagger source file. Thus, two places to keep in sync. And you don't have all the information in one place, e.g. the tagger module. The name of the tagger as used in sysfs or device tree is then in the core. Just wanted to point that out. After all it's up to you as the maintainer to decide ;)

-michael

#9 lore raw
Quoted 6 lines · Michael Walle

If one would a new tagger you'd need to add it to dsa_tag_proto_names[] as well as adding the tagger source file. Thus, two places to keep in sync. And you don't have all the information in one place, e.g. the tagger module. The name of the tagger as used in sysfs or device tree is then in the core. Just wanted to point that out. After all it's up to you as the maintainer to decide ;)

True, there are already 2 places you need to keep in sync, you already need to add the tagger id to include/net/dsa.h (twice). The header is shared between taggers, the DSA core and device drivers. A third place would indeed be a bit too much.

Actually I came to like your idea with 2 modaliases. I prepared a patch set and I'm in the process of testing it (need to rebuild everything with modules, which I usually skip). If it works, I'll post it as an RFC soon.