From patchwork Mon Aug 2 14:47:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 490357 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp1993302jas; Mon, 2 Aug 2021 07:48:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBZenrLP+Lit8MiIIrhAaPYm2WIIcH2dQ/xhIE5l4RyKyLlfLvK7/AaO4TOV2HfqgRAmey X-Received: by 2002:aa7:d8c1:: with SMTP id k1mr19606083eds.28.1627915704621; Mon, 02 Aug 2021 07:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627915704; cv=none; d=google.com; s=arc-20160816; b=Q1V4fY0HGFyYKWv6nL7nV/mfExrI4FsWOiMopUTMe6hv+Q25Tdr1mLu6+SlLqIxE0E ASblMwjXOe92Thl5l2iK8xuoSr8B/ELA4PD+Af9fsI1OVq7G7yNlG+ecCvzcBsQwSJaO xbFVcA9GzXtYSyWRcJXSU1m9KhILcsAVEFBeNqDA1RowfclUYSbymuCmkT1hpgsLWefl 95Z4fx3PAv1RySlHHdn4XlHfTsL+06eCGm6FFFjpxfCIc67OA7rVRhuR5/sP4W+1/+0u 6LX8V5o6Z/O6vncmXgJ6yNuk7zaewvjI9vcIu6+q4mi1/U2Kje5x7irvTcSgeeog7PWA yZdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TC0SjsYDBc7guKFpd5pTnstMDoq5X/1XHG3JY/aAPSg=; b=QEbNe/oo/+6WpI1XlBKeKxBQfUN/11u64rH6J8f5Ba/vSDJguRBOrcr9wEs7y8davl wpPmq7llnDYoyfwYjkCBheUpawQ4ohJ90Jm53NInhb6R03eO6YJK+34/jgajZ6gSV1ib JyQ/mdppOn+WoVsovHPOEcIXvAZHL2m7RZ7M3c62Yp11VUD16JGmoM3EN4b5QaN0m+km sGAnp2dTRZuQ2ZPcHxKJ5FcB9/bZQWZOSIMHFyUUpmvVTrYj8N5VOsWtpP4yXN6NYre5 Z0HPW9TbeIg+NhyJ5YgpzliXGJd43zlfVtqieF6RrlKLS2NeLg5KBbc3Oby5GTaFXFEC zLEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JTyAaXXm; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si5643573ejr.310.2021.08.02.07.48.24; Mon, 02 Aug 2021 07:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JTyAaXXm; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234338AbhHBOsc (ORCPT + 8 others); Mon, 2 Aug 2021 10:48:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:50428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234008AbhHBOsb (ORCPT ); Mon, 2 Aug 2021 10:48:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 37D8760F51; Mon, 2 Aug 2021 14:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627915702; bh=7LZ+RJ0Hi/u0L7+8fl9svS8TaK1SE+sy+Aaxg/1q60o=; h=From:To:Cc:Subject:Date:From; b=JTyAaXXm7a2pMrK8j3CpeAm4SzIYEwKRCmUDhrghmygh0eG1ih/BJfuDqxqeWNmcx /+ZjjI0tsyMFkFM6z6AaJb+WlH20BoluD71CBUJyWRm9zDPngqrbCM6b34EC12wslx 5tLtxvV/oGNU0aaDgch616021i+yjg2PTT6QP++QPvk4nvILh7IRJfcn4y1k/tlyFW BZX2YuBWlypqld7oJJybsWrq0UiR/xbo/T/GSboQ197H/qnbNbArn3ri2L9ila23T7 UGgyQNRZuM9ZqbS7KNPTVw5w727vvinrMzGkjzccliSnrFiiOr/Iwvhnfp0Gm+9dCs IBvt7C+069tcA== From: Arnd Bergmann To: "David S. Miller" , Jakub Kicinski , Vladimir Oltean Cc: Arnd Bergmann , Saeed Mahameed , Leon Romanovsky , Jiri Pirko , Ido Schimmel , Simon Horman , Ivan Vecera , Parav Pandit , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, oss-drivers@corigine.com Subject: [PATCH] switchdev: add Kconfig dependencies for bridge Date: Mon, 2 Aug 2021 16:47:28 +0200 Message-Id: <20210802144813.1152762-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann 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 --- 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(+) -- 2.29.2 Reviewed-by: Vladimir Oltean Tested-by: Vladimir Oltean 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. 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 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 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 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