Commit e5f31552 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jakub Kicinski

ethernet: fix PTP_1588_CLOCK dependencies

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

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.

To solve the dependency issue better than the 'imply' keyword, introduce a
separate Kconfig symbol "CONFIG_PTP_1588_CLOCK_OPTIONAL" that any driver
can depend on if it is able to use PTP support when available, but works
fine without it. Whenever CONFIG_PTP_1588_CLOCK=m, those drivers are
then prevented from being built-in, the same way as with a 'depends on
PTP_1588_CLOCK || !PTP_1588_CLOCK' dependency that does the same trick,
but that can be rather confusing when you first see it.

Since this should cover the dependencies correctly, the IS_REACHABLE()
hack in the header is no longer needed now, and can be turned back
into a normal IS_ENABLED() check. Any driver that gets the dependency
wrong will now cause a link time failure rather than being unable to use
PTP support when that is in a loadable module.

However, the two recently added ptp_get_vclocks_index() and
ptp_convert_timestamp() interfaces are only called from builtin code with
ethtool and socket timestamps, so keep the current behavior by stubbing
those out completely when PTP is in a loadable module. This should be
addressed properly in a follow-up.

As Richard suggested, we may want to actually turn PTP support into a
'bool' option later on, preventing it from being a loadable module
altogether, which would be one way to solve the problem with the ethtool
interface.

Fixes: 06c16d89 ("ice: register 1588 PTP clock device object for E810 devices")
Link: https://lore.kernel.org/netdev/20210804121318.337276-1-arnd@kernel.org/
Link: https://lore.kernel.org/netdev/CAK8P3a06enZOf=XyZ+zcAwBczv41UuCTz+=0FMf2gBz1_cOnZQ@mail.gmail.com/
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/Acked-by: default avatarShannon Nelson <snelson@pensando.io>
Acked-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210812183509.1362782-1-arnd@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b697d9d3
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
config NET_DSA_MV88E6XXX config NET_DSA_MV88E6XXX
tristate "Marvell 88E6xxx Ethernet switch fabric support" tristate "Marvell 88E6xxx Ethernet switch fabric support"
depends on NET_DSA depends on NET_DSA
depends on PTP_1588_CLOCK_OPTIONAL
select IRQ_DOMAIN select IRQ_DOMAIN
select NET_DSA_TAG_EDSA select NET_DSA_TAG_EDSA
select NET_DSA_TAG_DSA select NET_DSA_TAG_DSA
......
...@@ -5,6 +5,7 @@ config NET_DSA_MSCC_FELIX ...@@ -5,6 +5,7 @@ config NET_DSA_MSCC_FELIX
depends on NET_VENDOR_MICROSEMI depends on NET_VENDOR_MICROSEMI
depends on NET_VENDOR_FREESCALE depends on NET_VENDOR_FREESCALE
depends on HAS_IOMEM depends on HAS_IOMEM
depends on PTP_1588_CLOCK_OPTIONAL
select MSCC_OCELOT_SWITCH_LIB select MSCC_OCELOT_SWITCH_LIB
select NET_DSA_TAG_OCELOT_8021Q select NET_DSA_TAG_OCELOT_8021Q
select NET_DSA_TAG_OCELOT select NET_DSA_TAG_OCELOT
...@@ -19,6 +20,7 @@ config NET_DSA_MSCC_SEVILLE ...@@ -19,6 +20,7 @@ config NET_DSA_MSCC_SEVILLE
depends on NET_DSA depends on NET_DSA
depends on NET_VENDOR_MICROSEMI depends on NET_VENDOR_MICROSEMI
depends on HAS_IOMEM depends on HAS_IOMEM
depends on PTP_1588_CLOCK_OPTIONAL
select MSCC_OCELOT_SWITCH_LIB select MSCC_OCELOT_SWITCH_LIB
select NET_DSA_TAG_OCELOT_8021Q select NET_DSA_TAG_OCELOT_8021Q
select NET_DSA_TAG_OCELOT select NET_DSA_TAG_OCELOT
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
config NET_DSA_SJA1105 config NET_DSA_SJA1105
tristate "NXP SJA1105 Ethernet switch family support" tristate "NXP SJA1105 Ethernet switch family support"
depends on NET_DSA && SPI depends on NET_DSA && SPI
depends on PTP_1588_CLOCK_OPTIONAL
select NET_DSA_TAG_SJA1105 select NET_DSA_TAG_SJA1105
select PCS_XPCS select PCS_XPCS
select PACKING select PACKING
......
...@@ -170,11 +170,11 @@ config AMD_XGBE ...@@ -170,11 +170,11 @@ config AMD_XGBE
tristate "AMD 10GbE Ethernet driver" tristate "AMD 10GbE Ethernet driver"
depends on ((OF_NET && OF_ADDRESS) || ACPI || PCI) && HAS_IOMEM depends on ((OF_NET && OF_ADDRESS) || ACPI || PCI) && HAS_IOMEM
depends on X86 || ARM64 || COMPILE_TEST depends on X86 || ARM64 || COMPILE_TEST
depends on PTP_1588_CLOCK_OPTIONAL
select BITREVERSE select BITREVERSE
select CRC32 select CRC32
select PHYLIB select PHYLIB
select AMD_XGBE_HAVE_ECC if X86 select AMD_XGBE_HAVE_ECC if X86
imply PTP_1588_CLOCK
help help
This driver supports the AMD 10GbE Ethernet device found on an This driver supports the AMD 10GbE Ethernet device found on an
AMD SoC. AMD SoC.
......
...@@ -122,8 +122,8 @@ config SB1250_MAC ...@@ -122,8 +122,8 @@ config SB1250_MAC
config TIGON3 config TIGON3
tristate "Broadcom Tigon3 support" tristate "Broadcom Tigon3 support"
depends on PCI depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select PHYLIB select PHYLIB
imply PTP_1588_CLOCK
help help
This driver supports Broadcom Tigon3 based gigabit Ethernet cards. This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
...@@ -140,7 +140,7 @@ config TIGON3_HWMON ...@@ -140,7 +140,7 @@ config TIGON3_HWMON
config BNX2X config BNX2X
tristate "Broadcom NetXtremeII 10Gb support" tristate "Broadcom NetXtremeII 10Gb support"
depends on PCI depends on PCI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
select FW_LOADER select FW_LOADER
select ZLIB_INFLATE select ZLIB_INFLATE
select LIBCRC32C select LIBCRC32C
...@@ -206,7 +206,7 @@ config SYSTEMPORT ...@@ -206,7 +206,7 @@ config SYSTEMPORT
config BNXT config BNXT
tristate "Broadcom NetXtreme-C/E support" tristate "Broadcom NetXtreme-C/E support"
depends on PCI depends on PCI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
select FW_LOADER select FW_LOADER
select LIBCRC32C select LIBCRC32C
select NET_DEVLINK select NET_DEVLINK
......
...@@ -22,6 +22,7 @@ if NET_VENDOR_CADENCE ...@@ -22,6 +22,7 @@ if NET_VENDOR_CADENCE
config MACB config MACB
tristate "Cadence MACB/GEM support" tristate "Cadence MACB/GEM support"
depends on HAS_DMA && COMMON_CLK depends on HAS_DMA && COMMON_CLK
depends on PTP_1588_CLOCK_OPTIONAL
select PHYLINK select PHYLINK
select CRC32 select CRC32
help help
......
...@@ -66,7 +66,7 @@ config LIQUIDIO ...@@ -66,7 +66,7 @@ config LIQUIDIO
tristate "Cavium LiquidIO support" tristate "Cavium LiquidIO support"
depends on 64BIT && PCI depends on 64BIT && PCI
depends on PCI depends on PCI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
select FW_LOADER select FW_LOADER
select LIBCRC32C select LIBCRC32C
select NET_DEVLINK select NET_DEVLINK
...@@ -91,7 +91,7 @@ config OCTEON_MGMT_ETHERNET ...@@ -91,7 +91,7 @@ config OCTEON_MGMT_ETHERNET
config LIQUIDIO_VF config LIQUIDIO_VF
tristate "Cavium LiquidIO VF support" tristate "Cavium LiquidIO VF support"
depends on 64BIT && PCI_MSI depends on 64BIT && PCI_MSI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
help help
This driver supports Cavium LiquidIO Intelligent Server Adapter This driver supports Cavium LiquidIO Intelligent Server Adapter
based on CN23XX chips. based on CN23XX chips.
......
...@@ -69,6 +69,7 @@ config CHELSIO_T3 ...@@ -69,6 +69,7 @@ config CHELSIO_T3
config CHELSIO_T4 config CHELSIO_T4
tristate "Chelsio Communications T4/T5/T6 Ethernet support" tristate "Chelsio Communications T4/T5/T6 Ethernet support"
depends on PCI && (IPV6 || IPV6=n) && (TLS || TLS=n) depends on PCI && (IPV6 || IPV6=n) && (TLS || TLS=n)
depends on PTP_1588_CLOCK_OPTIONAL
select FW_LOADER select FW_LOADER
select MDIO select MDIO
select ZLIB_DEFLATE select ZLIB_DEFLATE
......
...@@ -25,10 +25,10 @@ config FEC ...@@ -25,10 +25,10 @@ config FEC
depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \
ARCH_MXC || SOC_IMX28 || COMPILE_TEST) ARCH_MXC || SOC_IMX28 || COMPILE_TEST)
default ARCH_MXC || SOC_IMX28 if ARM default ARCH_MXC || SOC_IMX28 if ARM
depends on PTP_1588_CLOCK_OPTIONAL
select CRC32 select CRC32
select PHYLIB select PHYLIB
imply NET_SELFTESTS imply NET_SELFTESTS
imply PTP_1588_CLOCK
help help
Say Y here if you want to use the built-in 10/100 Fast ethernet Say Y here if you want to use the built-in 10/100 Fast ethernet
controller on some Motorola ColdFire and Freescale i.MX processors. controller on some Motorola ColdFire and Freescale i.MX processors.
......
...@@ -104,7 +104,7 @@ config HNS3_HCLGE ...@@ -104,7 +104,7 @@ config HNS3_HCLGE
tristate "Hisilicon HNS3 HCLGE Acceleration Engine & Compatibility Layer Support" tristate "Hisilicon HNS3 HCLGE Acceleration Engine & Compatibility Layer Support"
default m default m
depends on PCI_MSI depends on PCI_MSI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
help help
This selects the HNS3_HCLGE network acceleration engine & its hardware This selects the HNS3_HCLGE network acceleration engine & its hardware
compatibility layer. The engine would be used in Hisilicon hip08 family of compatibility layer. The engine would be used in Hisilicon hip08 family of
......
...@@ -58,8 +58,8 @@ config E1000 ...@@ -58,8 +58,8 @@ config E1000
config E1000E config E1000E
tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support" tristate "Intel(R) PRO/1000 PCI-Express Gigabit Ethernet support"
depends on PCI && (!SPARC32 || BROKEN) depends on PCI && (!SPARC32 || BROKEN)
depends on PTP_1588_CLOCK_OPTIONAL
select CRC32 select CRC32
imply PTP_1588_CLOCK
help help
This driver supports the PCI-Express Intel(R) PRO/1000 gigabit This driver supports the PCI-Express Intel(R) PRO/1000 gigabit
ethernet family of adapters. For PCI or PCI-X e1000 adapters, ethernet family of adapters. For PCI or PCI-X e1000 adapters,
...@@ -87,7 +87,7 @@ config E1000E_HWTS ...@@ -87,7 +87,7 @@ config E1000E_HWTS
config IGB config IGB
tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support" tristate "Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support"
depends on PCI depends on PCI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
select I2C select I2C
select I2C_ALGOBIT select I2C_ALGOBIT
help help
...@@ -159,9 +159,9 @@ config IXGB ...@@ -159,9 +159,9 @@ config IXGB
config IXGBE config IXGBE
tristate "Intel(R) 10GbE PCI Express adapters support" tristate "Intel(R) 10GbE PCI Express adapters support"
depends on PCI depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select MDIO select MDIO
select PHYLIB select PHYLIB
imply PTP_1588_CLOCK
help help
This driver supports Intel(R) 10GbE PCI Express family of This driver supports Intel(R) 10GbE PCI Express family of
adapters. For more information on how to identify your adapter, go adapters. For more information on how to identify your adapter, go
...@@ -239,7 +239,7 @@ config IXGBEVF_IPSEC ...@@ -239,7 +239,7 @@ config IXGBEVF_IPSEC
config I40E config I40E
tristate "Intel(R) Ethernet Controller XL710 Family support" tristate "Intel(R) Ethernet Controller XL710 Family support"
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
depends on PCI depends on PCI
select AUXILIARY_BUS select AUXILIARY_BUS
help help
...@@ -295,11 +295,11 @@ config ICE ...@@ -295,11 +295,11 @@ config ICE
tristate "Intel(R) Ethernet Connection E800 Series Support" tristate "Intel(R) Ethernet Connection E800 Series Support"
default n default n
depends on PCI_MSI depends on PCI_MSI
depends on PTP_1588_CLOCK_OPTIONAL
select AUXILIARY_BUS select AUXILIARY_BUS
select DIMLIB select DIMLIB
select NET_DEVLINK select NET_DEVLINK
select PLDMFW select PLDMFW
imply PTP_1588_CLOCK
help help
This driver supports Intel(R) Ethernet Connection E800 Series of This driver supports Intel(R) Ethernet Connection E800 Series of
devices. For more information on how to identify your adapter, go devices. For more information on how to identify your adapter, go
...@@ -317,7 +317,7 @@ config FM10K ...@@ -317,7 +317,7 @@ config FM10K
tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support" tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support"
default n default n
depends on PCI_MSI depends on PCI_MSI
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
help help
This driver supports Intel(R) FM10000 Ethernet Switch Host This driver supports Intel(R) FM10000 Ethernet Switch Host
Interface. For more information on how to identify your adapter, Interface. For more information on how to identify your adapter,
......
...@@ -12,6 +12,7 @@ config OCTEONTX2_AF ...@@ -12,6 +12,7 @@ config OCTEONTX2_AF
select NET_DEVLINK select NET_DEVLINK
depends on (64BIT && COMPILE_TEST) || ARM64 depends on (64BIT && COMPILE_TEST) || ARM64
depends on PCI depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
help help
This driver supports Marvell's OcteonTX2 Resource Virtualization This driver supports Marvell's OcteonTX2 Resource Virtualization
Unit's admin function manager which manages all RVU HW resources Unit's admin function manager which manages all RVU HW resources
...@@ -32,6 +33,7 @@ config OCTEONTX2_PF ...@@ -32,6 +33,7 @@ config OCTEONTX2_PF
select OCTEONTX2_MBOX select OCTEONTX2_MBOX
depends on (64BIT && COMPILE_TEST) || ARM64 depends on (64BIT && COMPILE_TEST) || ARM64
depends on PCI depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
help help
This driver supports Marvell's OcteonTX2 NIC physical function. This driver supports Marvell's OcteonTX2 NIC physical function.
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
config MLX4_EN config MLX4_EN
tristate "Mellanox Technologies 1/10/40Gbit Ethernet support" tristate "Mellanox Technologies 1/10/40Gbit Ethernet support"
depends on PCI && NETDEVICES && ETHERNET && INET depends on PCI && NETDEVICES && ETHERNET && INET
depends on PTP_1588_CLOCK_OPTIONAL
select MLX4_CORE select MLX4_CORE
imply PTP_1588_CLOCK
help help
This driver supports Mellanox Technologies ConnectX Ethernet This driver supports Mellanox Technologies ConnectX Ethernet
devices. devices.
......
...@@ -10,7 +10,7 @@ config MLX5_CORE ...@@ -10,7 +10,7 @@ config MLX5_CORE
select NET_DEVLINK select NET_DEVLINK
depends on VXLAN || !VXLAN depends on VXLAN || !VXLAN
depends on MLXFW || !MLXFW depends on MLXFW || !MLXFW
depends on PTP_1588_CLOCK || !PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE depends on PCI_HYPERV_INTERFACE || !PCI_HYPERV_INTERFACE
help help
Core driver for low level functionality of the ConnectX-4 and Core driver for low level functionality of the ConnectX-4 and
......
...@@ -58,10 +58,10 @@ config MLXSW_SPECTRUM ...@@ -58,10 +58,10 @@ config MLXSW_SPECTRUM
depends on NET_IPGRE || NET_IPGRE=n depends on NET_IPGRE || NET_IPGRE=n
depends on IPV6_GRE || IPV6_GRE=n depends on IPV6_GRE || IPV6_GRE=n
depends on VXLAN || VXLAN=n depends on VXLAN || VXLAN=n
depends on PTP_1588_CLOCK_OPTIONAL
select GENERIC_ALLOCATOR select GENERIC_ALLOCATOR
select PARMAN select PARMAN
select OBJAGG select OBJAGG
imply PTP_1588_CLOCK
select NET_PTP_CLASSIFY if PTP_1588_CLOCK select NET_PTP_CLASSIFY if PTP_1588_CLOCK
default m default m
help help
......
...@@ -45,6 +45,7 @@ config ENCX24J600 ...@@ -45,6 +45,7 @@ config ENCX24J600
config LAN743X config LAN743X
tristate "LAN743x support" tristate "LAN743x support"
depends on PCI depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select PHYLIB select PHYLIB
select CRC16 select CRC16
select CRC32 select CRC32
......
...@@ -24,6 +24,7 @@ config MSCC_OCELOT_SWITCH_LIB ...@@ -24,6 +24,7 @@ config MSCC_OCELOT_SWITCH_LIB
config MSCC_OCELOT_SWITCH config MSCC_OCELOT_SWITCH
tristate "Ocelot switch driver" tristate "Ocelot switch driver"
depends on PTP_1588_CLOCK_OPTIONAL
depends on BRIDGE || BRIDGE=n depends on BRIDGE || BRIDGE=n
depends on NET_SWITCHDEV depends on NET_SWITCHDEV
depends on HAS_IOMEM depends on HAS_IOMEM
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
config PCH_GBE config PCH_GBE
tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE"
depends on PCI && (X86_32 || COMPILE_TEST) depends on PCI && (X86_32 || COMPILE_TEST)
depends on PTP_1588_CLOCK
select MII select MII
select PTP_1588_CLOCK_PCH select PTP_1588_CLOCK_PCH
select NET_PTP_CLASSIFY select NET_PTP_CLASSIFY
......
...@@ -20,7 +20,7 @@ if NET_VENDOR_PENSANDO ...@@ -20,7 +20,7 @@ if NET_VENDOR_PENSANDO
config IONIC config IONIC
tristate "Pensando Ethernet IONIC Support" tristate "Pensando Ethernet IONIC Support"
depends on 64BIT && PCI depends on 64BIT && PCI
depends on PTP_1588_CLOCK || !PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
select NET_DEVLINK select NET_DEVLINK
select DIMLIB select DIMLIB
help help
......
...@@ -99,7 +99,7 @@ config QED_SRIOV ...@@ -99,7 +99,7 @@ config QED_SRIOV
config QEDE config QEDE
tristate "QLogic QED 25/40/100Gb Ethernet NIC" tristate "QLogic QED 25/40/100Gb Ethernet NIC"
depends on QED depends on QED
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK_OPTIONAL
help help
This enables the support for Marvell FastLinQ adapters family, This enables the support for Marvell FastLinQ adapters family,
ethernet driver. ethernet driver.
......
...@@ -32,11 +32,11 @@ config SH_ETH ...@@ -32,11 +32,11 @@ config SH_ETH
config RAVB config RAVB
tristate "Renesas Ethernet AVB support" tristate "Renesas Ethernet AVB support"
depends on ARCH_RENESAS || COMPILE_TEST depends on ARCH_RENESAS || COMPILE_TEST
depends on PTP_1588_CLOCK_OPTIONAL
select CRC32 select CRC32
select MII select MII
select MDIO_BITBANG select MDIO_BITBANG
select PHYLIB select PHYLIB
imply PTP_1588_CLOCK
help help
Renesas Ethernet AVB device driver. Renesas Ethernet AVB device driver.
This driver supports the following SoCs: This driver supports the following SoCs:
......
...@@ -20,9 +20,9 @@ if NET_VENDOR_SAMSUNG ...@@ -20,9 +20,9 @@ if NET_VENDOR_SAMSUNG
config SXGBE_ETH config SXGBE_ETH
tristate "Samsung 10G/2.5G/1G SXGBE Ethernet driver" tristate "Samsung 10G/2.5G/1G SXGBE Ethernet driver"
depends on HAS_IOMEM && HAS_DMA depends on HAS_IOMEM && HAS_DMA
depends on PTP_1588_CLOCK_OPTIONAL
select PHYLIB select PHYLIB
select CRC32 select CRC32
imply PTP_1588_CLOCK
help help
This is the driver for the SXGBE 10G Ethernet IP block found on This is the driver for the SXGBE 10G Ethernet IP block found on
Samsung platforms. Samsung platforms.
......
...@@ -19,9 +19,9 @@ if NET_VENDOR_SOLARFLARE ...@@ -19,9 +19,9 @@ if NET_VENDOR_SOLARFLARE
config SFC config SFC
tristate "Solarflare SFC9000/SFC9100/EF100-family support" tristate "Solarflare SFC9000/SFC9100/EF100-family support"
depends on PCI depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select MDIO select MDIO
select CRC32 select CRC32
imply PTP_1588_CLOCK
help help
This driver supports 10/40-gigabit Ethernet cards based on This driver supports 10/40-gigabit Ethernet cards based on
the Solarflare SFC9000-family and SFC9100-family controllers. the Solarflare SFC9000-family and SFC9100-family controllers.
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
config STMMAC_ETH config STMMAC_ETH
tristate "STMicroelectronics Multi-Gigabit Ethernet driver" tristate "STMicroelectronics Multi-Gigabit Ethernet driver"
depends on HAS_IOMEM && HAS_DMA depends on HAS_IOMEM && HAS_DMA
depends on PTP_1588_CLOCK_OPTIONAL
select MII select MII
select PCS_XPCS select PCS_XPCS
select PAGE_POOL select PAGE_POOL
select PHYLINK select PHYLINK
select CRC32 select CRC32
imply PTP_1588_CLOCK
select RESET_CONTROLLER select RESET_CONTROLLER
help help
This is the driver for the Ethernet IPs built around a This is the driver for the Ethernet IPs built around a
......
...@@ -236,6 +236,7 @@ config MICROCHIP_T1_PHY ...@@ -236,6 +236,7 @@ config MICROCHIP_T1_PHY
config MICROSEMI_PHY config MICROSEMI_PHY
tristate "Microsemi PHYs" tristate "Microsemi PHYs"
depends on MACSEC || MACSEC=n depends on MACSEC || MACSEC=n
depends on PTP_1588_CLOCK_OPTIONAL || !NETWORK_PHY_TIMESTAMPING
select CRYPTO_LIB_AES if MACSEC select CRYPTO_LIB_AES if MACSEC
help help
Currently supports VSC8514, VSC8530, VSC8531, VSC8540 and VSC8541 PHYs Currently supports VSC8514, VSC8530, VSC8531, VSC8540 and VSC8541 PHYs
...@@ -253,6 +254,7 @@ config NATIONAL_PHY ...@@ -253,6 +254,7 @@ config NATIONAL_PHY
config NXP_C45_TJA11XX_PHY config NXP_C45_TJA11XX_PHY
tristate "NXP C45 TJA11XX PHYs" tristate "NXP C45 TJA11XX PHYs"
depends on PTP_1588_CLOCK_OPTIONAL
help help
Enable support for NXP C45 TJA11XX PHYs. Enable support for NXP C45 TJA11XX PHYs.
Currently supports only the TJA1103 PHY. Currently supports only the TJA1103 PHY.
......
...@@ -8,6 +8,7 @@ menu "PTP clock support" ...@@ -8,6 +8,7 @@ menu "PTP clock support"
config PTP_1588_CLOCK config PTP_1588_CLOCK
tristate "PTP clock support" tristate "PTP clock support"
depends on NET && POSIX_TIMERS depends on NET && POSIX_TIMERS
default ETHERNET
select PPS select PPS
select NET_PTP_CLASSIFY select NET_PTP_CLASSIFY
help help
...@@ -26,6 +27,18 @@ config PTP_1588_CLOCK ...@@ -26,6 +27,18 @@ config PTP_1588_CLOCK
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called ptp. will be called ptp.
config PTP_1588_CLOCK_OPTIONAL
tristate
default y if PTP_1588_CLOCK=n
default PTP_1588_CLOCK
help
Drivers that can optionally use the PTP_1588_CLOCK framework
should depend on this symbol to prevent them from being built
into vmlinux while the PTP support itself is in a loadable
module.
If PTP support is disabled, this dependency will still be
met, and drivers refer to dummy helpers.
config PTP_1588_CLOCK_DTE config PTP_1588_CLOCK_DTE
tristate "Broadcom DTE as PTP clock" tristate "Broadcom DTE as PTP clock"
depends on PTP_1588_CLOCK depends on PTP_1588_CLOCK
...@@ -91,7 +104,7 @@ config PTP_1588_CLOCK_PCH ...@@ -91,7 +104,7 @@ config PTP_1588_CLOCK_PCH
tristate "Intel PCH EG20T as PTP clock" tristate "Intel PCH EG20T as PTP clock"
depends on X86_32 || COMPILE_TEST depends on X86_32 || COMPILE_TEST
depends on HAS_IOMEM && NET depends on HAS_IOMEM && NET
imply PTP_1588_CLOCK depends on PTP_1588_CLOCK
help help
This driver adds support for using the PCH EG20T as a PTP This driver adds support for using the PCH EG20T as a PTP
clock. The hardware supports time stamping of PTP packets clock. The hardware supports time stamping of PTP packets
......
...@@ -149,6 +149,7 @@ void ptp_vclock_unregister(struct ptp_vclock *vclock) ...@@ -149,6 +149,7 @@ void ptp_vclock_unregister(struct ptp_vclock *vclock)
kfree(vclock); kfree(vclock);
} }
#if IS_BUILTIN(CONFIG_PTP_1588_CLOCK)
int ptp_get_vclocks_index(int pclock_index, int **vclock_index) int ptp_get_vclocks_index(int pclock_index, int **vclock_index)
{ {
char name[PTP_CLOCK_NAME_LEN] = ""; char name[PTP_CLOCK_NAME_LEN] = "";
...@@ -217,3 +218,4 @@ void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps, ...@@ -217,3 +218,4 @@ void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps,
hwtstamps->hwtstamp = ns_to_ktime(ns); hwtstamps->hwtstamp = ns_to_ktime(ns);
} }
EXPORT_SYMBOL(ptp_convert_timestamp); EXPORT_SYMBOL(ptp_convert_timestamp);
#endif
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
config SCSI_CXGB4_ISCSI config SCSI_CXGB4_ISCSI
tristate "Chelsio T4 iSCSI support" tristate "Chelsio T4 iSCSI support"
depends on PCI && INET && (IPV6 || IPV6=n) depends on PCI && INET && (IPV6 || IPV6=n)
depends on PTP_1588_CLOCK_OPTIONAL
depends on THERMAL || !THERMAL depends on THERMAL || !THERMAL
depends on ETHERNET depends on ETHERNET
depends on TLS || TLS=n depends on TLS || TLS=n
......
...@@ -215,7 +215,7 @@ static inline long scaled_ppm_to_ppb(long ppm) ...@@ -215,7 +215,7 @@ static inline long scaled_ppm_to_ppb(long ppm)
return (long)ppb; return (long)ppb;
} }
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK) #if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
/** /**
* ptp_clock_register() - register a PTP hardware clock driver * ptp_clock_register() - register a PTP hardware clock driver
...@@ -307,6 +307,33 @@ int ptp_schedule_worker(struct ptp_clock *ptp, unsigned long delay); ...@@ -307,6 +307,33 @@ int ptp_schedule_worker(struct ptp_clock *ptp, unsigned long delay);
*/ */
void ptp_cancel_worker_sync(struct ptp_clock *ptp); void ptp_cancel_worker_sync(struct ptp_clock *ptp);
#else
static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
{ return NULL; }
static inline int ptp_clock_unregister(struct ptp_clock *ptp)
{ return 0; }
static inline void ptp_clock_event(struct ptp_clock *ptp,
struct ptp_clock_event *event)
{ }
static inline int ptp_clock_index(struct ptp_clock *ptp)
{ return -1; }
static inline int ptp_find_pin(struct ptp_clock *ptp,
enum ptp_pin_function func, unsigned int chan)
{ return -1; }
static inline int ptp_schedule_worker(struct ptp_clock *ptp,
unsigned long delay)
{ return -EOPNOTSUPP; }
static inline void ptp_cancel_worker_sync(struct ptp_clock *ptp)
{ }
#endif
#if IS_BUILTIN(CONFIG_PTP_1588_CLOCK)
/*
* These are called by the network core, and don't work if PTP is in
* a loadable module.
*/
/** /**
* ptp_get_vclocks_index() - get all vclocks index on pclock, and * ptp_get_vclocks_index() - get all vclocks index on pclock, and
* caller is responsible to free memory * caller is responsible to free memory
...@@ -327,26 +354,7 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index); ...@@ -327,26 +354,7 @@ int ptp_get_vclocks_index(int pclock_index, int **vclock_index);
*/ */
void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps, void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps,
int vclock_index); int vclock_index);
#else #else
static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
struct device *parent)
{ return NULL; }
static inline int ptp_clock_unregister(struct ptp_clock *ptp)
{ return 0; }
static inline void ptp_clock_event(struct ptp_clock *ptp,
struct ptp_clock_event *event)
{ }
static inline int ptp_clock_index(struct ptp_clock *ptp)
{ return -1; }
static inline int ptp_find_pin(struct ptp_clock *ptp,
enum ptp_pin_function func, unsigned int chan)
{ return -1; }
static inline int ptp_schedule_worker(struct ptp_clock *ptp,
unsigned long delay)
{ return -EOPNOTSUPP; }
static inline void ptp_cancel_worker_sync(struct ptp_clock *ptp)
{ }
static inline int ptp_get_vclocks_index(int pclock_index, int **vclock_index) static inline int ptp_get_vclocks_index(int pclock_index, int **vclock_index)
{ return 0; } { return 0; }
static inline void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps, static inline void ptp_convert_timestamp(struct skb_shared_hwtstamps *hwtstamps,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment