Skip to contentSkip to conversation

switchdev: add Kconfig dependencies for bridge

PATCH In review Arnd Bergmann 3 participants 9 messages Aug 2, 2021

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

PATCH 1/1 switchdev: add Kconfig dependencies for bridge

From: Arnd Bergmann <[email protected]>

Multiple switchdev drivers depend on CONFIG_NET_SWITCHDEV in Kconfig, but have also gained a dependency on the bridge driver as they now call switchdev_bridge_port_offload():

drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.o: In function `sparx5_netdevice_event':
sparx5_switchdev.c:(.text+0x3cc): undefined reference to switchdev_bridge_port_offload' drivers/net/ethernet/ti/cpsw_new.o: In function cpsw_netdevice_event':
cpsw_new.c:(.text+0x1098): undefined reference to `switchdev_bridge_port_offload'

Some of these drivers already have a 'BRIDGE || !BRIDGE' dependency that avoids the link failure, but the 'rocker' driver was missing this

For MLXSW/MLX5, SPARX5_SWITCH, and TI_K3_AM65_CPSW_NUSS, the driver can conditionally use switchdev support, which is then guarded by another Kconfig symbol. For these, add a dependency on a new Kconfig symbol NET_MAY_USE_SWITCHDEV that is defined to correctly model the
dependency: if switchdev support is enabled, these drivers cannot be built-in when bridge support is in a module, but if either bridge or switchdev is disabled, or both are built-in, there is no such restriction.

Fixes 2f5dc00f7a3e ("net: bridge: switchdev: let drivers inform which bridge ports are offloaded")
Fixes b0e81817629a ("net: build all switchdev drivers as modules when the bridge is a module")

---
This version seems to pass my randconfig builds for the moment, but that doesn't mean it's correct either. Please have a closer look before this gets applied.

---
 drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 +
 drivers/net/ethernet/mellanox/mlxsw/Kconfig     | 1 +
 drivers/net/ethernet/netronome/Kconfig          | 1 +
 drivers/net/ethernet/ti/Kconfig                 | 1 +
 net/switchdev/Kconfig                           | 5 +++++
 5 files changed, 9 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -0
index e1a5a79e27c7..3a752e57c1e5 100644
@@ -12,6 +12,7 @@ config MLX5_CORE
 	depends on MLXFW || !MLXFW
 	depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
 	depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE
+	depends on NET_MAY_USE_SWITCHDEV
 	help
 	  Core driver for low level functionality of the ConnectX-4 and
 	  Connect-IB cards by Mellanox Technologies.
drivers/net/ethernet/mellanox/mlxsw/Kconfig +1 -0
index 12871c8dc7c1..dee3925bdaea 100644
@@ -5,6 +5,7 @@
 
 config MLXSW_CORE
 	tristate "Mellanox Technologies Switch ASICs support"
+	depends on NET_MAY_USE_SWITCHDEV
 	select NET_DEVLINK
 	select MLXFW
 	help
drivers/net/ethernet/netronome/Kconfig +1 -0
index b82758d5beed..a298d19e8383 100644
@@ -21,6 +21,7 @@ config NFP
 	depends on PCI && PCI_MSI
 	depends on VXLAN || VXLAN=n
 	depends on TLS && TLS_DEVICE || TLS_DEVICE=n
+	depends on NET_MAY_USE_SWITCHDEV
 	select NET_DEVLINK
 	select CRC32
 	help
drivers/net/ethernet/ti/Kconfig +1 -0
index 07192613256e..a73c6c236b25 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
 	tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
 	depends on OF && TI_K3_UDMA_GLUE_LAYER
+	depends on NET_MAY_USE_SWITCHDEV
 	select NET_DEVLINK
 	select TI_DAVINCI_MDIO
 	imply PHY_TI_GMII_SEL
net/switchdev/Kconfig +5 -0
index 18a2d980e11d..3b0e627a4519 100644
@@ -12,3 +12,8 @@ config NET_SWITCHDEV
 	  meaning of the word "switch". This include devices supporting L2/L3 but
 	  also various flow offloading chips, including switches embedded into
 	  SR-IOV NICs.
+
+config NET_MAY_USE_SWITCHDEV
+	def_tristate y
+	depends on NET_SWITCHDEV || NET_SWITCHDEV=n
+	depends on BRIDGE || NET_SWITCHDEV=n
Signature · 1 line
2.29.2
#1 lore raw
Quoted 42 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Multiple switchdev drivers depend on CONFIG_NET_SWITCHDEV in Kconfig, but have also gained a dependency on the bridge driver as they now call switchdev_bridge_port_offload():

drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.o: In function `sparx5_netdevice_event':
sparx5_switchdev.c:(.text+0x3cc): undefined reference to switchdev_bridge_port_offload' drivers/net/ethernet/ti/cpsw_new.o: In function cpsw_netdevice_event':
cpsw_new.c:(.text+0x1098): undefined reference to `switchdev_bridge_port_offload'

Some of these drivers already have a 'BRIDGE || !BRIDGE' dependency that avoids the link failure, but the 'rocker' driver was missing this

For MLXSW/MLX5, SPARX5_SWITCH, and TI_K3_AM65_CPSW_NUSS, the driver can conditionally use switchdev support, which is then guarded by another Kconfig symbol. For these, add a dependency on a new Kconfig symbol NET_MAY_USE_SWITCHDEV that is defined to correctly model the
dependency: if switchdev support is enabled, these drivers cannot be built-in when bridge support is in a module, but if either bridge or switchdev is disabled, or both are built-in, there is no such restriction.

Fixes 2f5dc00f7a3e ("net: bridge: switchdev: let drivers inform which bridge ports are offloaded")
Fixes b0e81817629a ("net: build all switchdev drivers as modules when the bridge is a module")

---
This version seems to pass my randconfig builds for the moment, but that doesn't mean it's correct either. Please have a closer look before this gets applied.

---
 drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 +
 drivers/net/ethernet/mellanox/mlxsw/Kconfig     | 1 +
 drivers/net/ethernet/netronome/Kconfig          | 1 +
 drivers/net/ethernet/ti/Kconfig                 | 1 +
 net/switchdev/Kconfig                           | 5 +++++
 5 files changed, 9 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +0 -0
index e1a5a79e27c7..3a752e57c1e5 100644

drivers/net/ethernet/mellanox/mlx5/core/Kconfig config MLX5_CORE · line 18

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -0
@@ -12,6 +12,7 @@ config MLX5_CORE
 	depends on MLXFW || !MLXFW
 	depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
 	depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE
+	depends on NET_MAY_USE_SWITCHDEV
 	help
 	  Core driver for low level functionality of the ConnectX-4 and
 	  Connect-IB cards by Mellanox Technologies.

MLX5_CORE does not appear to cover code that calls switchdev_bridge_port_offload.

drivers/net/ethernet/mellanox/mlxsw/Kconfig line 11

Quoted 12 lines
drivers/net/ethernet/mellanox/mlxsw/Kconfig +1 -0
index 12871c8dc7c1..dee3925bdaea 100644
@@ -5,6 +5,7 @@
 
 config MLXSW_CORE
 	tristate "Mellanox Technologies Switch ASICs support"
+	depends on NET_MAY_USE_SWITCHDEV
 	select NET_DEVLINK
 	select MLXFW
 	help

I think it is MLXSW_SPECTRUM rather than MLXSW_CORE that controls compilation of spectrum_switchdev.c which calls switchdev_bridge_port_offload.

But MLXSW_SPECTRUM seems to already depend on BRIDGE || BRIDGE=n

drivers/net/ethernet/netronome/Kconfig config NFP · line 27

Quoted 12 lines
drivers/net/ethernet/netronome/Kconfig +1 -0
index b82758d5beed..a298d19e8383 100644
@@ -21,6 +21,7 @@ config NFP
 	depends on PCI && PCI_MSI
 	depends on VXLAN || VXLAN=n
 	depends on TLS && TLS_DEVICE || TLS_DEVICE=n
+	depends on NET_MAY_USE_SWITCHDEV
 	select NET_DEVLINK
 	select CRC32
 	help

This seems wrong, the NFP driver doesn't call
switchdev_bridge_port_offload()

drivers/net/ethernet/ti/Kconfig config TI_CPTS · line 99

Quoted 12 lines
drivers/net/ethernet/ti/Kconfig +1 -0
index 07192613256e..a73c6c236b25 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
 	tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
 	depends on OF && TI_K3_UDMA_GLUE_LAYER
+	depends on NET_MAY_USE_SWITCHDEV
 	select NET_DEVLINK
 	select TI_DAVINCI_MDIO
 	imply PHY_TI_GMII_SEL

I believe this has already been addressed by the following patch in net

b0e81817629a ("net: build all switchdev drivers as modules when the bridge is a module")

Quoted 16 lines
net/switchdev/Kconfig +5 -0
index 18a2d980e11d..3b0e627a4519 100644
@@ -12,3 +12,8 @@ config NET_SWITCHDEV
 	  meaning of the word "switch". This include devices supporting L2/L3 but
 	  also various flow offloading chips, including switches embedded into
 	  SR-IOV NICs.
+
+config NET_MAY_USE_SWITCHDEV
+	def_tristate y
+	depends on NET_SWITCHDEV || NET_SWITCHDEV=n
+	depends on BRIDGE || NET_SWITCHDEV=n
Signature · 1 line
2.29.2
#2 lore raw
Quoted 5 lines · Simon Horman
Quoted 4 lines · Arnd Bergmann

---
This version seems to pass my randconfig builds for the moment, but that doesn't mean it's correct either. Please have a closer look before this gets applied.

Thank you for taking a look, it seems I have done a particularly bad job rebasing
the patch on top of the previous fix, leaving only the wrong bits ;-)

Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +0 -0
index e1a5a79e27c7..3a752e57c1e5 100644
@@ -12,6 +12,7 @@ config MLX5_CORE
      depends on MLXFW || !MLXFW
      depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
Quoted 8 lines

drivers/net/ethernet/mellanox/mlx5/core/Kconfig config MLX5_CORE · line 18

Quoted 5 lines
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -0
      depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE
+     depends on NET_MAY_USE_SWITCHDEV
      help
        Core driver for low level functionality of the ConnectX-4 and
        Connect-IB cards by Mellanox Technologies.

MLX5_CORE does not appear to cover code that calls switchdev_bridge_port_offload.

Ah right, I did get a link failure with my test build, but it was an unrelated one:

ld: drivers/net/ethernet/mellanox/mlx5/core/esw/sample.o: in function `mlx5_esw_sample_skb':
sample.c:(.text+0x5b4): undefined reference to `psample_sample_packet'

I think that one needs

drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -0
@@ -90,6 +90,7 @@ config MLX5_BRIDGE
 config MLX5_CLS_ACT
        bool "MLX5 TC classifier action support"
        depends on MLX5_ESWITCH && NET_CLS_ACT
+       depends on PSAMPLE=y || PSAMPLE=MLX5_CORE
        default y
        help
          mlx5 ConnectX offloads support for TC classifier action (NET_CLS_ACT),

but this is unrelated and I have not tested that.

Quoted 17 lines

drivers/net/ethernet/mellanox/mlxsw/Kconfig line 11

Quoted 12 lines
drivers/net/ethernet/mellanox/mlxsw/Kconfig +1 -0
index 12871c8dc7c1..dee3925bdaea 100644
@@ -5,6 +5,7 @@
 
 config MLXSW_CORE
      tristate "Mellanox Technologies Switch ASICs support"
+     depends on NET_MAY_USE_SWITCHDEV
      select NET_DEVLINK
      select MLXFW
      help

I think it is MLXSW_SPECTRUM rather than MLXSW_CORE that controls compilation of spectrum_switchdev.c which calls switchdev_bridge_port_offload.

Quoted 1 line

But MLXSW_SPECTRUM seems to already depend on BRIDGE || BRIDGE=n

Ok.

Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/netronome/Kconfig +0 -0
index b82758d5beed..a298d19e8383 100644
@@ -21,6 +21,7 @@ config NFP
      depends on PCI && PCI_MSI
      depends on VXLAN || VXLAN=n
Quoted 8 lines

drivers/net/ethernet/netronome/Kconfig config NFP · line 27

Quoted 5 lines
drivers/net/ethernet/netronome/Kconfig +1 -0
      depends on TLS && TLS_DEVICE || TLS_DEVICE=n
+     depends on NET_MAY_USE_SWITCHDEV
      select NET_DEVLINK
      select CRC32
      help

This seems wrong, the NFP driver doesn't call
switchdev_bridge_port_offload()

Ah right, I actually noticed that earlier and then forgot to remove that hunk.

Also: is this actually intended or should the driver call switchdev_bridge_port_offload() like the other switchdev drivers do?

Quoted 15 lines

drivers/net/ethernet/ti/Kconfig config TI_CPTS · line 99

Quoted 12 lines
drivers/net/ethernet/ti/Kconfig +1 -0
index 07192613256e..a73c6c236b25 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
      tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
      depends on OF && TI_K3_UDMA_GLUE_LAYER
+     depends on NET_MAY_USE_SWITCHDEV
      select NET_DEVLINK
      select TI_DAVINCI_MDIO
      imply PHY_TI_GMII_SEL

I believe this has already been addressed by the following patch in net

Quoted 1 line

b0e81817629a ("net: build all switchdev drivers as modules when the bridge is a module")

I think the fix was wrong here, and that hunk should be reverted. The dependency was added to a bool option, where it does not have the intended effect.

I think this is the only remaining thing needed from my patch, so the NET_MAY_USE_SWITCHDEV option is not needed either, and it could be written as:

drivers/net/ethernet/ti/Kconfig +1 -1
index 07192613256e..e49006a96d49 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
        tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
        depends on OF && TI_K3_UDMA_GLUE_LAYER
+       depends on (BRIDGE && NET_SWITCHDEV) || BRIDGE=n || NET_SWITCHDEV=n
        select NET_DEVLINK
        select TI_DAVINCI_MDIO
        imply PHY_TI_GMII_SEL
@@ -110,7 +111,6 @@ config TI_K3_AM65_CPSW_NUSS
 config TI_K3_AM65_CPSW_SWITCHDEV
        bool "TI K3 AM654x/J721E CPSW Switch mode support"
        depends on TI_K3_AM65_CPSW_NUSS
-       depends on BRIDGE || BRIDGE=n
        depends on NET_SWITCHDEV
        help
         This enables switchdev support for TI K3 CPSWxG Ethernet

If this looks correct to you, I can submit it as a standalone patch.

Arnd

#3 lore raw
Quoted 10 lines · Arnd Bergmann
Quoted 5 lines · Simon Horman
Quoted 4 lines · Arnd Bergmann

---
This version seems to pass my randconfig builds for the moment, but that doesn't mean it's correct either. Please have a closer look before this gets applied.

Thank you for taking a look, it seems I have done a particularly bad job rebasing
the patch on top of the previous fix, leaving only the wrong bits ;-)

:)

...

Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/netronome/Kconfig +0 -0
index b82758d5beed..a298d19e8383 100644
@@ -21,6 +21,7 @@ config NFP
      depends on PCI && PCI_MSI
      depends on VXLAN || VXLAN=n
Quoted 8 lines

drivers/net/ethernet/netronome/Kconfig config NFP · line 27

Quoted 5 lines
drivers/net/ethernet/netronome/Kconfig +1 -0
      depends on TLS && TLS_DEVICE || TLS_DEVICE=n
+     depends on NET_MAY_USE_SWITCHDEV
      select NET_DEVLINK
      select CRC32
      help

This seems wrong, the NFP driver doesn't call
switchdev_bridge_port_offload()

Quoted 4 lines

Ah right, I actually noticed that earlier and then forgot to remove that hunk.

Also: is this actually intended or should the driver call switchdev_bridge_port_offload() like the other switchdev drivers do?

The NFP driver doesn't implement /use this part of the switchdev API. It is intentional given the current scope of features implemented.

Quoted 46 lines
Quoted 15 lines

drivers/net/ethernet/ti/Kconfig config TI_CPTS · line 99

Quoted 12 lines
drivers/net/ethernet/ti/Kconfig +1 -0
index 07192613256e..a73c6c236b25 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
      tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
      depends on OF && TI_K3_UDMA_GLUE_LAYER
+     depends on NET_MAY_USE_SWITCHDEV
      select NET_DEVLINK
      select TI_DAVINCI_MDIO
      imply PHY_TI_GMII_SEL

I believe this has already been addressed by the following patch in net

Quoted 1 line

b0e81817629a ("net: build all switchdev drivers as modules when the bridge is a module")

I think the fix was wrong here, and that hunk should be reverted. The dependency was added to a bool option, where it does not have the intended effect.

I think this is the only remaining thing needed from my patch, so the NET_MAY_USE_SWITCHDEV option is not needed either, and it could be written as:

drivers/net/ethernet/ti/Kconfig +1 -1
index 07192613256e..e49006a96d49 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
        tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
        depends on OF && TI_K3_UDMA_GLUE_LAYER
+       depends on (BRIDGE && NET_SWITCHDEV) || BRIDGE=n || NET_SWITCHDEV=n
        select NET_DEVLINK
        select TI_DAVINCI_MDIO
        imply PHY_TI_GMII_SEL
@@ -110,7 +111,6 @@ config TI_K3_AM65_CPSW_NUSS
 config TI_K3_AM65_CPSW_SWITCHDEV
        bool "TI K3 AM654x/J721E CPSW Switch mode support"
        depends on TI_K3_AM65_CPSW_NUSS
-       depends on BRIDGE || BRIDGE=n
        depends on NET_SWITCHDEV
        help
         This enables switchdev support for TI K3 CPSWxG Ethernet
Quoted 1 line

If this looks correct to you, I can submit it as a standalone patch.

Is there a conflict between your proposed change and the presence of "depends on NET_SWITCHDEV" ?

BTW, I'm not sure I know how to compile TI_K3_AM65_CPSW_NUSS. So I'm perhaps not the best arbiter of correctness here.

#4 lore raw
In reply to Arnd Bergmann
Quoted 1 line · Arnd Bergmann

If this looks correct to you, I can submit it as a standalone patch.

I think it's easiest I just ask you to provide a .config that triggers actual build failures and we can go from there.

#5 lore raw
Quoted 6 lines · Vladimir Oltean
Quoted 1 line · Arnd Bergmann

If this looks correct to you, I can submit it as a standalone patch.

I think it's easiest I just ask you to provide a .config that triggers actual build failures and we can go from there.

This one is with an arm64 allmodconfig, plus

CONFIG_PTP_1588_CLOCK=y
CONFIG_TI_K3_AM65_CPTS=y
CONFIG_TI_K3_AM65_CPSW_NUSS=y

Arnd

#6 lore raw
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Vladimir Oltean
Quoted 1 line · Arnd Bergmann

If this looks correct to you, I can submit it as a standalone patch.

Quoted 8 lines
Quoted 2 lines

I think it's easiest I just ask you to provide a .config that triggers actual build failures and we can go from there.

This one is with an arm64 allmodconfig, plus

CONFIG_PTP_1588_CLOCK=y
CONFIG_TI_K3_AM65_CPTS=y
CONFIG_TI_K3_AM65_CPSW_NUSS=y

Yeah, ok, I remember now, I saw that TI_CPSW_SWITCHDEV is tristate, and incorrectly thought that TI_K3_AM65_CPSW_SWITCHDEV (which is mostly a copy-paste job of the main cpsw anyway, makes you cringe that they wrote a separate driver for it) is tristate too.

The options are either to make TI_K3_AM65_CPSW_SWITCHDEV tristate like TI_CPSW_SWITCHDEV is, and to edit the Makefile accordingly to make am65-cpsw-switchdev.o part of obj-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV), or to extend the BRIDGE || BRIDGE=n dependency to TI_K3_AM65_CPSW_NUSS which is the direct tristate dependency of CONFIG_TI_K3_AM65_CPSW_SWITCHDEV, and to make CONFIG_TI_K3_AM65_CPSW_SWITCHDEV simply depend on BRIDGE.

#7 lore raw
Quoted 12 lines · Vladimir Oltean
Quoted 10 lines · Arnd Bergmann
Quoted 6 lines · Vladimir Oltean
Quoted 1 line · Arnd Bergmann

If this looks correct to you, I can submit it as a standalone patch.

I think it's easiest I just ask you to provide a .config that triggers actual build failures and we can go from there.

This one is with an arm64 allmodconfig, plus

Quoted 8 lines
Quoted 3 lines

CONFIG_PTP_1588_CLOCK=y
CONFIG_TI_K3_AM65_CPTS=y
CONFIG_TI_K3_AM65_CPSW_NUSS=y

Yeah, ok, I remember now, I saw that TI_CPSW_SWITCHDEV is tristate, and incorrectly thought that TI_K3_AM65_CPSW_SWITCHDEV (which is mostly a copy-paste job of the main cpsw anyway, makes you cringe that they wrote a separate driver for it) is tristate too.

Right.

Quoted 3 lines

The options are either to make TI_K3_AM65_CPSW_SWITCHDEV tristate like TI_CPSW_SWITCHDEV is, and to edit the Makefile accordingly to make am65-cpsw-switchdev.o part of obj-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV),

This probably won't work as this is currently part of the ti-am65-cpsw-nuss.ko module, so I would assume that it's not easy to separate from the main module.

Quoted 2 lines

or to extend the BRIDGE || BRIDGE=n dependency to TI_K3_AM65_CPSW_NUSS which is the direct tristate dependency of CONFIG_TI_K3_AM65_CPSW_SWITCHDEV,

That would work, but it's slightly more heavy-handed than my proposal, as this prevents TI_K3_AM65_CPSW_NUSS from being built-in when BRIDGE is a module, even when switchdev support is completely disabled.

Quoted 1 line

and to make CONFIG_TI_K3_AM65_CPSW_SWITCHDEV simply depend on BRIDGE.

This would not be needed then I think.

Arnd

Reviewed-by Tested-by
#8 lore raw
Quoted 10 lines · Arnd Bergmann
Quoted 2 lines

or to extend the BRIDGE || BRIDGE=n dependency to TI_K3_AM65_CPSW_NUSS which is the direct tristate dependency of CONFIG_TI_K3_AM65_CPSW_SWITCHDEV,

That would work, but it's slightly more heavy-handed than my proposal, as this prevents TI_K3_AM65_CPSW_NUSS from being built-in when BRIDGE is a module, even when switchdev support is completely disabled.

Quoted 1 line

and to make CONFIG_TI_K3_AM65_CPSW_SWITCHDEV simply depend on BRIDGE.

This would not be needed then I think.

I've tested this change according to your suggestion:

drivers/net/ethernet/ti/Kconfig +1 -0
index 7ac8e5ecbe97..a9980cfc504b 100644
@@ -93,6 +93,7 @@ config TI_CPTS
 config TI_K3_AM65_CPSW_NUSS
 	tristate "TI K3 AM654x/J721E CPSW Ethernet driver"
 	depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER
+	depends on (BRIDGE && NET_SWITCHDEV) || BRIDGE=n || NET_SWITCHDEV=n
 	select NET_DEVLINK
 	select TI_DAVINCI_MDIO
 	imply PHY_TI_GMII_SEL

(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? y
@@ -110,7 +111,6 @@ config TI_K3_AM65_CPSW_NUSS
config TI_K3_AM65_CPSW_SWITCHDEV
bool "TI K3 AM654x/J721E CPSW Switch mode support" depends on TI_K3_AM65_CPSW_NUSS
- depends on BRIDGE || BRIDGE=n
depends on NET_SWITCHDEV
help
This enables switchdev support for TI K3 CPSWxG Ethernet

and it does appear to work, so when you resubmit please feel free to add:

Thanks and sorry for breaking the dependency chain yet again! It takes time to learn this stuff.