From patchwork Mon Aug 2 14:59:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 490360 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp2003435jas; Mon, 2 Aug 2021 07:59:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1vkLJ3iU03nKPs5XFgss2AkEjjVKM3V+ddeXgOQ8zrsrB5qCPfWPtsSqKvDsQwa5/KhqA X-Received: by 2002:a17:906:2441:: with SMTP id a1mr14907269ejb.550.1627916391707; Mon, 02 Aug 2021 07:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627916391; cv=none; d=google.com; s=arc-20160816; b=nm0QP/naCa14sSW2J0LkxOdjqygeboIkEUcum2LS9YL4D7+m9wO+hxoPoRmaK04PtQ 7P2ceN+e26Ua1vQ/xeRkb/x3cOPblDmHn7B4G2qvnBL/W8Q/YhmsYUwj8XyVMbU0+yss y/uyK0n6OZIaSGm4HmJaEmi4MDNvmf2vFwm6K5CddlUI83ePswaMNW2MZuNvG+1yADMF E61LT2TWa0PRXuZizs7WS4mkt2rloTFupCVbhZnzjUprpH552QyDt75W+POm36ZCLGLM ZymYvYs/kQrOAstTwQDw0tV7S5ISZlspgV9d3GjW+yM//EkW9XqTAyh4Qy9lEC4YKZXD 7q8Q== 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=iCLvQjLK3VfwVGWwRC/4+OWDIAroBqgLUcj6FbsxApI=; b=E2th68U5l17gwGf86r0NVpS9RGW/lpchEEWp5YX9UNj6NAq70hbxtQomafzOrChiBP A48vUa8ET5Rd6eFrx/GzYPiKixgNyPIsDC/FffXxGiWj3LQ0H6GWCnJmewC5bRu9YJyS fUd23h5jAMPYc+zB3f8i58TD8QLBWKTPnH3aYaZU0rZuVw9r1rF4OVXr2hCTHergMRdJ iX5VgYr8sF555bARNhfneIyOAiBRmYjt3oRKNWX3AZP/mKSuJ8zFM2I5Y14ByiDUemkY 1DuwKBkWMqZ1Uvnc26MSo90QRBX0XWiaFPOfr/HbyAb90cAFq4jFOejAl1uOnzygmTmE DhOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WM8AKZ3s; 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 q19si11176568edb.4.2021.08.02.07.59.51; Mon, 02 Aug 2021 07:59:51 -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=WM8AKZ3s; 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 S234492AbhHBO7y (ORCPT + 8 others); Mon, 2 Aug 2021 10:59:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:55660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234417AbhHBO7w (ORCPT ); Mon, 2 Aug 2021 10:59:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4EA5E61029; Mon, 2 Aug 2021 14:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627916383; bh=Lkr1dFSreFjPtodwG8AQp2lM5ZAmh2e2VFsf/AFrxW8=; h=From:To:Cc:Subject:Date:From; b=WM8AKZ3sCcnZpGgyWaTVASIh1HVD5JyolR9jrAa5D8LupWFtMc//PCEFdjUBFE7xI B6zVNaR00ZrLHXYRU89FnHConbJ86lcg3Lmb5sJHS+Dn/PwvKq4/7BKUmWivqrIy2s 39NLuJADFxhb0RlM4SbteogfWRxvYxIdqHXDEdxijpuSpzUVH66IlB9AcTKufPWWdK S9Rc5s3abKSJh7Rim/0fne49/S0d9gdzK8Iho1+QLg6LB+9NRySJ1HqHnl+urQXhN7 zz0uRstrvI/og+JLpenVIB3juE5cdz+EoaAjP68hnDR7TPXuf7EpqQG5eu/LhL4/cZ a4sJ5hPVOtN3A== From: Arnd Bergmann To: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Jakub Kicinski , Jacob Keller Cc: Arnd Bergmann , Richard Cochran , Kurt Kanzenbach , Shiraz Saleem , Dave Ertman , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2] ethernet/intel: fix PTP_1588_CLOCK dependencies Date: Mon, 2 Aug 2021 16:59:33 +0200 Message-Id: <20210802145937.1155571-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 The 'imply' keyword does not do what most people think it does, it only politely asks Kconfig to turn on another symbol, but does not prevent it from being disabled manually or built as a loadable module when the user is built-in. In the ICE driver, the latter now causes a link failure: aarch64-linux-ld: drivers/net/ethernet/intel/ice/ice_main.o: in function `ice_eth_ioctl': ice_main.c:(.text+0x13b0): undefined reference to `ice_ptp_get_ts_config' ice_main.c:(.text+0x13b0): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `ice_ptp_get_ts_config' aarch64-linux-ld: ice_main.c:(.text+0x13bc): undefined reference to `ice_ptp_set_ts_config' ice_main.c:(.text+0x13bc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `ice_ptp_set_ts_config' aarch64-linux-ld: drivers/net/ethernet/intel/ice/ice_main.o: in function `ice_prepare_for_reset': ice_main.c:(.text+0x31fc): undefined reference to `ice_ptp_release' ice_main.c:(.text+0x31fc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `ice_ptp_release' aarch64-linux-ld: drivers/net/ethernet/intel/ice/ice_main.o: in function `ice_rebuild': For the other Intel network drivers, there is no link error when the drivers are built-in and PTP is a loadable module, because linux/ptp_clock_kernel.h contains an IS_REACHABLE() check, but this just changes the compile-time failure to a runtime failure, which is arguably worse. Change all the Intel drivers to use the 'depends on PTP_1588_CLOCK || !PTP_1588_CLOCK' trick to prevent the broken configuration, as we already do for several other drivers. To avoid circular dependencies, this also requires changing the IGB driver back to using the normal 'depends on I2C' instead of 'select I2C'. This is a recurring problem in many drivers, and we have discussed it several times befores, without reaching a consensus. I'm providing a link to the previous email thread for reference, which discusses some related problems, though I can't find what reasons there were against the approach with the extra Kconfig dependency. Fixes: 06c16d89d2cb ("ice: register 1588 PTP clock device object for E810 devices") Link: https://lore.kernel.org/netdev/CAK8P3a3=eOxE-K25754+fB_-i_0BZzf9a9RfPTX3ppSwu9WZXw@mail.gmail.com/ Link: https://lore.kernel.org/netdev/20210726084540.3282344-1-arnd@kernel.org/ Cc: Richard Cochran Signed-off-by: Arnd Bergmann --- Changes in v2: - include a missing patch hunk - link to a previous discussion with Richard Cochran --- drivers/net/ethernet/intel/Kconfig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.29.2 diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 2aa84bd97287..3ddadc147d45 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig @@ -58,8 +58,8 @@ config E1000 config E1000E tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support" depends on PCI && (!SPARC32 || BROKEN) + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK select CRC32 - imply PTP_1588_CLOCK help This driver supports the PCI-Express Intel(R) PRO/1000 gigabit ethernet family of adapters. For PCI or PCI-X e1000 adapters, @@ -87,8 +87,8 @@ config E1000E_HWTS config IGB tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support" depends on PCI - imply PTP_1588_CLOCK - select I2C + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK + depends on I2C select I2C_ALGOBIT help This driver supports Intel(R) 82575/82576 gigabit ethernet family of @@ -159,9 +159,9 @@ config IXGB config IXGBE tristate "Intel(R) 10GbE PCI Express adapters support" depends on PCI + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK select MDIO select PHYLIB - imply PTP_1588_CLOCK help This driver supports Intel(R) 10GbE PCI Express family of adapters. For more information on how to identify your adapter, go @@ -239,7 +239,7 @@ config IXGBEVF_IPSEC config I40E tristate "Intel(R) Ethernet Controller XL710 Family support" - imply PTP_1588_CLOCK + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK depends on PCI select AUXILIARY_BUS help @@ -295,11 +295,11 @@ config ICE tristate "Intel(R) Ethernet Connection E800 Series Support" default n depends on PCI_MSI + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK select AUXILIARY_BUS select DIMLIB select NET_DEVLINK select PLDMFW - imply PTP_1588_CLOCK help This driver supports Intel(R) Ethernet Connection E800 Series of devices. For more information on how to identify your adapter, go @@ -317,7 +317,7 @@ config FM10K tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support" default n depends on PCI_MSI - imply PTP_1588_CLOCK + depends on PTP_1588_CLOCK || !PTP_1588_CLOCK help This driver supports Intel(R) FM10000 Ethernet Switch Host Interface. For more information on how to identify your adapter,