Commit f4b6bcc7 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net: devlink: turn devlink into a built-in

Being able to build devlink as a module causes growing pains.
First all drivers had to add a meta dependency to make sure
they are not built in when devlink is built as a module.  Now
we are struggling to invoke ethtool compat code reliably.

Make devlink code built-in, users can still not build it at
all but the dynamically loadable module option is removed.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d8cf757f
config INFINIBAND_BNXT_RE config INFINIBAND_BNXT_RE
tristate "Broadcom Netxtreme HCA support" tristate "Broadcom Netxtreme HCA support"
depends on ETHERNET && NETDEVICES && PCI && INET && DCB depends on ETHERNET && NETDEVICES && PCI && INET && DCB
depends on MAY_USE_DEVLINK
select NET_VENDOR_BROADCOM select NET_VENDOR_BROADCOM
select BNXT select BNXT
---help--- ---help---
......
...@@ -2,7 +2,6 @@ config MLX4_INFINIBAND ...@@ -2,7 +2,6 @@ config MLX4_INFINIBAND
tristate "Mellanox ConnectX HCA support" tristate "Mellanox ConnectX HCA support"
depends on NETDEVICES && ETHERNET && PCI && INET depends on NETDEVICES && ETHERNET && PCI && INET
depends on INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS depends on INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS
depends on MAY_USE_DEVLINK
select NET_VENDOR_MELLANOX select NET_VENDOR_MELLANOX
select MLX4_CORE select MLX4_CORE
---help--- ---help---
......
...@@ -505,7 +505,6 @@ source "drivers/net/hyperv/Kconfig" ...@@ -505,7 +505,6 @@ source "drivers/net/hyperv/Kconfig"
config NETDEVSIM config NETDEVSIM
tristate "Simulated networking device" tristate "Simulated networking device"
depends on DEBUG_FS depends on DEBUG_FS
depends on MAY_USE_DEVLINK
help help
This driver is a developer testing tool and software model that can This driver is a developer testing tool and software model that can
be used to test various control path networking APIs, especially be used to test various control path networking APIs, especially
......
...@@ -194,7 +194,6 @@ config SYSTEMPORT ...@@ -194,7 +194,6 @@ config SYSTEMPORT
config BNXT config BNXT
tristate "Broadcom NetXtreme-C/E support" tristate "Broadcom NetXtreme-C/E support"
depends on PCI depends on PCI
depends on MAY_USE_DEVLINK
select FW_LOADER select FW_LOADER
select LIBCRC32C select LIBCRC32C
---help--- ---help---
......
...@@ -64,7 +64,6 @@ config CAVIUM_PTP ...@@ -64,7 +64,6 @@ config CAVIUM_PTP
config LIQUIDIO config LIQUIDIO
tristate "Cavium LiquidIO support" tristate "Cavium LiquidIO support"
depends on 64BIT && PCI depends on 64BIT && PCI
depends on MAY_USE_DEVLINK
depends on PCI depends on PCI
imply PTP_1588_CLOCK imply PTP_1588_CLOCK
select FW_LOADER select FW_LOADER
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
config MLX4_EN config MLX4_EN
tristate "Mellanox Technologies 1/10/40Gbit Ethernet support" tristate "Mellanox Technologies 1/10/40Gbit Ethernet support"
depends on MAY_USE_DEVLINK
depends on PCI && NETDEVICES && ETHERNET && INET depends on PCI && NETDEVICES && ETHERNET && INET
select MLX4_CORE select MLX4_CORE
imply PTP_1588_CLOCK imply PTP_1588_CLOCK
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
config MLX5_CORE config MLX5_CORE
tristate "Mellanox 5th generation network adapters (ConnectX series) core driver" tristate "Mellanox 5th generation network adapters (ConnectX series) core driver"
depends on MAY_USE_DEVLINK
depends on PCI depends on PCI
imply PTP_1588_CLOCK imply PTP_1588_CLOCK
imply VXLAN imply VXLAN
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
config MLXSW_CORE config MLXSW_CORE
tristate "Mellanox Technologies Switch ASICs support" tristate "Mellanox Technologies Switch ASICs support"
depends on MAY_USE_DEVLINK
---help--- ---help---
This driver supports Mellanox Technologies Switch ASICs family. This driver supports Mellanox Technologies Switch ASICs family.
......
...@@ -19,7 +19,6 @@ config NFP ...@@ -19,7 +19,6 @@ config NFP
tristate "Netronome(R) NFP4000/NFP6000 NIC driver" tristate "Netronome(R) NFP4000/NFP6000 NIC driver"
depends on PCI && PCI_MSI depends on PCI && PCI_MSI
depends on VXLAN || VXLAN=n depends on VXLAN || VXLAN=n
depends on MAY_USE_DEVLINK
---help--- ---help---
This driver supports the Netronome(R) NFP4000/NFP6000 based This driver supports the Netronome(R) NFP4000/NFP6000 based
cards working as a advanced Ethernet NIC. It works with both cards working as a advanced Ethernet NIC. It works with both
......
...@@ -707,6 +707,10 @@ devlink_health_reporter_priv(struct devlink_health_reporter *reporter); ...@@ -707,6 +707,10 @@ devlink_health_reporter_priv(struct devlink_health_reporter *reporter);
int devlink_health_report(struct devlink_health_reporter *reporter, int devlink_health_report(struct devlink_health_reporter *reporter,
const char *msg, void *priv_ctx); const char *msg, void *priv_ctx);
void devlink_compat_running_version(struct net_device *dev,
char *buf, size_t len);
int devlink_compat_flash_update(struct net_device *dev, const char *file_name);
#else #else
static inline struct devlink *devlink_alloc(const struct devlink_ops *ops, static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
...@@ -1190,13 +1194,7 @@ devlink_health_report(struct devlink_health_reporter *reporter, ...@@ -1190,13 +1194,7 @@ devlink_health_report(struct devlink_health_reporter *reporter,
{ {
return 0; return 0;
} }
#endif
#if IS_REACHABLE(CONFIG_NET_DEVLINK)
void devlink_compat_running_version(struct net_device *dev,
char *buf, size_t len);
int devlink_compat_flash_update(struct net_device *dev, const char *file_name);
#else
static inline void static inline void
devlink_compat_running_version(struct net_device *dev, char *buf, size_t len) devlink_compat_running_version(struct net_device *dev, char *buf, size_t len)
{ {
......
...@@ -429,21 +429,12 @@ config NET_SOCK_MSG ...@@ -429,21 +429,12 @@ config NET_SOCK_MSG
with the help of BPF programs. with the help of BPF programs.
config NET_DEVLINK config NET_DEVLINK
tristate "Network physical/parent device Netlink interface" bool "Network physical/parent device Netlink interface"
help help
Network physical/parent device Netlink interface provides Network physical/parent device Netlink interface provides
infrastructure to support access to physical chip-wide config and infrastructure to support access to physical chip-wide config and
monitoring. monitoring.
config MAY_USE_DEVLINK
tristate
default m if NET_DEVLINK=m
default y if NET_DEVLINK=y || NET_DEVLINK=n
help
Drivers using the devlink infrastructure should have a dependency
on MAY_USE_DEVLINK to ensure they do not cause link errors when
devlink is a loadable module and the driver using it is built-in.
config PAGE_POOL config PAGE_POOL
bool bool
......
...@@ -6482,20 +6482,9 @@ int devlink_compat_flash_update(struct net_device *dev, const char *file_name) ...@@ -6482,20 +6482,9 @@ int devlink_compat_flash_update(struct net_device *dev, const char *file_name)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int __init devlink_module_init(void) static int __init devlink_init(void)
{ {
return genl_register_family(&devlink_nl_family); return genl_register_family(&devlink_nl_family);
} }
static void __exit devlink_module_exit(void) subsys_initcall(devlink_init);
{
genl_unregister_family(&devlink_nl_family);
}
module_init(devlink_module_init);
module_exit(devlink_module_exit);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>");
MODULE_DESCRIPTION("Network physical device Netlink interface");
MODULE_ALIAS_GENL_FAMILY(DEVLINK_GENL_NAME);
...@@ -6,7 +6,7 @@ config HAVE_NET_DSA ...@@ -6,7 +6,7 @@ config HAVE_NET_DSA
config NET_DSA config NET_DSA
tristate "Distributed Switch Architecture" tristate "Distributed Switch Architecture"
depends on HAVE_NET_DSA && MAY_USE_DEVLINK depends on HAVE_NET_DSA
depends on BRIDGE || BRIDGE=n depends on BRIDGE || BRIDGE=n
select NET_SWITCHDEV select NET_SWITCHDEV
select PHYLINK select PHYLINK
......
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