lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210802162250.GA12345@corigine.com>
Date:   Mon, 2 Aug 2021 18:22:53 +0200
From:   Simon Horman <simon.horman@...igine.com>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Vladimir Oltean <vladimir.oltean@....com>,
        Arnd Bergmann <arnd@...db.de>,
        Saeed Mahameed <saeedm@...dia.com>,
        Leon Romanovsky <leon@...nel.org>,
        Jiri Pirko <jiri@...dia.com>, Ido Schimmel <idosch@...dia.com>,
        Ivan Vecera <ivecera@...hat.com>,
        Parav Pandit <parav@...dia.com>, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
        oss-drivers@...igine.com
Subject: Re: [PATCH] switchdev: add Kconfig dependencies for bridge

On Mon, Aug 02, 2021 at 04:47:28PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> 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(+)
> 
> 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.

> 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
>  	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

> 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
>  	help

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

> 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_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")

> diff --git a/net/switchdev/Kconfig b/net/switchdev/Kconfig
> index 18a2d980e11d..3b0e627a4519 100644
> --- a/net/switchdev/Kconfig
> +++ b/net/switchdev/Kconfig
> @@ -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
> -- 
> 2.29.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ