linux/drivers/net/ethernet/sfc
Arnd Bergmann e5f3155267 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: 06c16d89d2 ("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: Shannon Nelson <snelson@pensando.io>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210812183509.1362782-1-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-08-13 17:49:05 -07:00
..
falcon dev_ioctl: split out ndo_eth_ioctl 2021-07-27 20:11:45 +01:00
bitfield.h sfc: extend bitfield macros to 19 fields 2020-11-13 15:33:03 -08:00
ef10_regs.h
ef10_sriov.c sfc: avoid duplicated code in ef10_sriov 2021-06-22 09:51:13 -07:00
ef10_sriov.h
ef10.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-06-29 15:45:27 -07:00
ef100_ethtool.c sfc: add ethtool ops and miscellaneous ndos to EF100 2020-09-07 14:46:13 -07:00
ef100_ethtool.h sfc: skeleton EF100 PF driver 2020-07-27 12:26:55 -07:00
ef100_netdev.c sfc: add ethtool ops and miscellaneous ndos to EF100 2020-09-07 14:46:13 -07:00
ef100_netdev.h sfc: skeleton EF100 PF driver 2020-07-27 12:26:55 -07:00
ef100_nic.c sfc: support GRE TSO on EF100 2020-11-13 15:33:30 -08:00
ef100_nic.h sfc_ef100: add nic-type for VFs, and bind to them 2020-08-03 18:22:55 -07:00
ef100_regs.h sfc_ef100: add EF100 register definitions 2020-07-27 12:26:55 -07:00
ef100_rx.c sfc: fix boolreturn.cocci warning and rename function 2020-08-24 18:14:23 -07:00
ef100_rx.h sfc: check hash is valid before using it 2020-08-14 14:07:16 -07:00
ef100_tx.c sfc: support GRE TSO on EF100 2020-11-13 15:33:30 -08:00
ef100_tx.h sfc: make ef100 xmit_more handling look more like ef10's 2020-09-05 12:21:39 -07:00
ef100.c sfc: Fix error code in probe 2020-09-21 13:55:13 -07:00
ef100.h sfc: skeleton EF100 PF driver 2020-07-27 12:26:55 -07:00
efx_channels.c sfc: add logs explaining XDP_TX/REDIRECT is not available 2021-07-13 10:02:41 -07:00
efx_channels.h sfc: cleanups around efx_alloc_channel 2020-09-11 14:55:14 -07:00
efx_common.c sfc: use DEVICE_ATTR_*() macro 2021-05-23 17:18:42 -07:00
efx_common.h sfc: advertise encapsulated offloads on EF10 2020-09-11 17:15:22 -07:00
efx.c dev_ioctl: split out ndo_eth_ioctl 2021-07-27 20:11:45 +01:00
efx.h sfc: check hash is valid before using it 2020-08-14 14:07:16 -07:00
enum.h sfc: Remove duplicate argument 2021-04-14 13:55:07 -07:00
ethtool_common.c sfc: decouple TXQ type from label 2020-09-11 17:15:22 -07:00
ethtool_common.h sfc: skeleton EF100 PF driver 2020-07-27 12:26:55 -07:00
ethtool.c sfc: ef10: implement ethtool::get_fec_stats 2021-04-15 17:08:29 -07:00
farch_regs.h
farch.c sfc: farch: fix compile warning in efx_farch_dimension_resources() 2021-05-21 13:52:26 -07:00
filter.h
io.h sfc_ef100: register accesses on EF100 2020-07-27 12:26:55 -07:00
Kconfig ethernet: fix PTP_1588_CLOCK dependencies 2021-08-13 17:49:05 -07:00
Makefile sfc: skeleton EF100 PF driver 2020-07-27 12:26:55 -07:00
mcdi_filters.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
mcdi_filters.h sfc_ef100: helper function to set default RSS table of given size 2020-07-02 14:47:40 -07:00
mcdi_functions.c sfc: de-indirect TSO handling 2020-09-11 17:15:22 -07:00
mcdi_functions.h sfc: de-indirect TSO handling 2020-09-11 17:15:22 -07:00
mcdi_mon.c
mcdi_pcol.h sfc: update MCDI protocol headers 2020-06-29 17:37:48 -07:00
mcdi_port_common.c sfc: coding style cleanups in mcdi_port_common.c 2020-09-08 20:14:33 -07:00
mcdi_port_common.h sfc: coding style cleanups in mcdi_port_common.c 2020-09-08 20:14:33 -07:00
mcdi_port.c sfc: remove phy_op indirection 2020-09-07 14:46:13 -07:00
mcdi_port.h sfc: move NIC-specific mcdi_port declarations out of common header 2020-06-30 13:09:09 -07:00
mcdi.c sfc: return errors from efx_mcdi_set_id_led, and de-indirect 2020-08-31 12:28:50 -07:00
mcdi.h sfc: fix kdoc warning 2020-09-25 16:29:00 -07:00
mtd.c
net_driver.h sfc: ef10: implement ethtool::get_fec_stats 2021-04-15 17:08:29 -07:00
nic_common.h net: sfc: Replace in_interrupt() usage 2020-09-29 14:02:54 -07:00
nic.c net:sfc: fix non-freed irq in legacy irq mode 2021-05-21 14:51:10 -07:00
nic.h sfc: de-indirect TSO handling 2020-09-11 17:15:22 -07:00
ptp.c drivers/net/ethernet: clean up mis-targeted comments 2020-09-25 16:29:00 -07:00
ptp.h sfc: split up nic.h 2020-06-29 17:37:48 -07:00
rx_common.c xsk: Propagate napi_id to XDP socket Rx path 2020-12-01 00:09:25 +01:00
rx_common.h sfc: commonise efx_sync_rx_buffer() 2020-06-30 13:09:09 -07:00
rx.c sfc: Remove rcu_read_lock() around XDP program invocation 2021-06-24 19:46:01 +02:00
selftest.c sfc: define inner/outer csum offload TXQ types 2020-09-11 17:15:22 -07:00
selftest.h sfc: decouple TXQ type from label 2020-09-11 17:15:22 -07:00
siena_sriov.c
siena_sriov.h
siena.c sfc: return errors from efx_mcdi_set_id_led, and de-indirect 2020-08-31 12:28:50 -07:00
sriov.c
sriov.h
tx_common.c sfc: de-indirect TSO handling 2020-09-11 17:15:22 -07:00
tx_common.h sfc: skeleton EF100 PF driver 2020-07-27 12:26:55 -07:00
tx_tso.c
tx.c bpf, devmap: Move drop error path to devmap for XDP_REDIRECT 2021-03-18 16:38:51 +01:00
tx.h sfc: select inner-csum-offload TX queues for skbs that need it 2020-09-11 17:15:22 -07:00
vfdi.h
workarounds.h