Re: [PATCH] switchdev: add Kconfig dependencies for bridge
From: Arnd Bergmann <arnd@kernel.org>
Date: 2021-08-02 18:29:45
Also in:
lkml, netdev
Subsystem:
networking drivers, the rest · Maintainers:
Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
On Mon, Aug 2, 2021 at 6:23 PM Simon Horman [off-list ref] wrote:
On Mon, Aug 02, 2021 at 04:47:28PM +0200, Arnd Bergmann wrote:quoted
--- 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
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index e1a5a79e27c7..3a752e57c1e5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig@@ -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.
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
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig@@ -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
diff --git a/drivers/net/ethernet/mellanox/mlxsw/Kconfig b/drivers/net/ethernet/mellanox/mlxsw/Kconfig index 12871c8dc7c1..dee3925bdaea 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/Kconfig +++ b/drivers/net/ethernet/mellanox/mlxsw/Kconfig@@ -5,6 +5,7 @@ config MLXSW_CORE tristate "Mellanox Technologies Switch ASICs support" + depends on NET_MAY_USE_SWITCHDEV select NET_DEVLINK select MLXFW helpI 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
Ok.
quoted
diff --git a/drivers/net/ethernet/netronome/Kconfig b/drivers/net/ethernet/netronome/Kconfig index b82758d5beed..a298d19e8383 100644 --- a/drivers/net/ethernet/netronome/Kconfig +++ b/drivers/net/ethernet/netronome/Kconfig@@ -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 helpThis 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
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig index 07192613256e..a73c6c236b25 100644 --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig@@ -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_SELI 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")
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:
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 07192613256e..e49006a96d49 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig@@ -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