net: devlink: select NET_DEVLINK from drivers

Some drivers are becoming more dependent on NET_DEVLINK being selected
in configuration. With upcoming compat functions, the behavior would be
wrong in case devlink was not compiled in. So make the drivers select
NET_DEVLINK and rely on the functions being there, not just stubs.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2019-03-24 11:14:38 +01:00 committed by David S. Miller
parent b8f975545c
commit f6b19b354d
10 changed files with 13 additions and 497 deletions

View File

@ -505,6 +505,7 @@ source "drivers/net/hyperv/Kconfig"
config NETDEVSIM
tristate "Simulated networking device"
depends on DEBUG_FS
select NET_DEVLINK
help
This driver is a developer testing tool and software model that can
be used to test various control path networking APIs, especially

View File

@ -196,6 +196,7 @@ config BNXT
depends on PCI
select FW_LOADER
select LIBCRC32C
select NET_DEVLINK
---help---
This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit
Ethernet cards. To compile this driver as a module, choose M here:

View File

@ -68,6 +68,7 @@ config LIQUIDIO
imply PTP_1588_CLOCK
select FW_LOADER
select LIBCRC32C
select NET_DEVLINK
---help---
This driver supports Cavium LiquidIO Intelligent Server Adapters
based on CN66XX, CN68XX and CN23XX chips.

View File

@ -26,6 +26,7 @@ config MLX4_EN_DCB
config MLX4_CORE
tristate
depends on PCI
select NET_DEVLINK
default n
config MLX4_DEBUG

View File

@ -5,6 +5,7 @@
config MLX5_CORE
tristate "Mellanox 5th generation network adapters (ConnectX series) core driver"
depends on PCI
select NET_DEVLINK
imply PTP_1588_CLOCK
imply VXLAN
default n

View File

@ -4,6 +4,7 @@
config MLXSW_CORE
tristate "Mellanox Technologies Switch ASICs support"
select NET_DEVLINK
---help---
This driver supports Mellanox Technologies Switch ASICs family.

View File

@ -19,6 +19,7 @@ config NFP
tristate "Netronome(R) NFP4000/NFP6000 NIC driver"
depends on PCI && PCI_MSI
depends on VXLAN || VXLAN=n
select NET_DEVLINK
---help---
This driver supports the Netronome(R) NFP4000/NFP6000 based
cards working as a advanced Ethernet NIC. It works with both

View File

@ -549,17 +549,13 @@ static inline struct devlink *priv_to_devlink(void *priv)
static inline struct devlink *netdev_to_devlink(struct net_device *dev)
{
#if IS_ENABLED(CONFIG_NET_DEVLINK)
if (dev->netdev_ops->ndo_get_devlink)
return dev->netdev_ops->ndo_get_devlink(dev);
#endif
return NULL;
}
struct ib_device;
#if IS_ENABLED(CONFIG_NET_DEVLINK)
struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
int devlink_register(struct devlink *devlink, struct device *dev);
void devlink_unregister(struct devlink *devlink);
@ -728,500 +724,14 @@ void
devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
enum devlink_health_reporter_state state);
#if IS_ENABLED(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 struct devlink *devlink_alloc(const struct devlink_ops *ops,
size_t priv_size)
{
return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
}
static inline int devlink_register(struct devlink *devlink, struct device *dev)
{
return 0;
}
static inline void devlink_unregister(struct devlink *devlink)
{
}
static inline void devlink_params_publish(struct devlink *devlink)
{
}
static inline void devlink_params_unpublish(struct devlink *devlink)
{
}
static inline void devlink_free(struct devlink *devlink)
{
kfree(devlink);
}
static inline int devlink_port_register(struct devlink *devlink,
struct devlink_port *devlink_port,
unsigned int port_index)
{
return 0;
}
static inline void devlink_port_unregister(struct devlink_port *devlink_port)
{
}
static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
struct net_device *netdev)
{
}
static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
struct ib_device *ibdev)
{
}
static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
{
}
static inline void devlink_port_attrs_set(struct devlink_port *devlink_port,
enum devlink_port_flavour flavour,
u32 port_number, bool split,
u32 split_subport_number)
{
}
static inline int
devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
char *name, size_t len)
{
return -EOPNOTSUPP;
}
static inline int devlink_sb_register(struct devlink *devlink,
unsigned int sb_index, u32 size,
u16 ingress_pools_count,
u16 egress_pools_count,
u16 ingress_tc_count,
u16 egress_tc_count)
{
return 0;
}
static inline void devlink_sb_unregister(struct devlink *devlink,
unsigned int sb_index)
{
}
static inline int
devlink_dpipe_table_register(struct devlink *devlink,
const char *table_name,
struct devlink_dpipe_table_ops *table_ops,
void *priv, bool counter_control_extern)
{
return 0;
}
static inline void devlink_dpipe_table_unregister(struct devlink *devlink,
const char *table_name)
{
}
static inline int devlink_dpipe_headers_register(struct devlink *devlink,
struct devlink_dpipe_headers *
dpipe_headers)
{
return 0;
}
static inline void devlink_dpipe_headers_unregister(struct devlink *devlink)
{
}
static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
const char *table_name)
{
return false;
}
static inline int
devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
{
return 0;
}
static inline int
devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
struct devlink_dpipe_entry *entry)
{
return 0;
}
static inline int
devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
{
return 0;
}
static inline void
devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
{
}
static inline int
devlink_dpipe_action_put(struct sk_buff *skb,
struct devlink_dpipe_action *action)
{
return 0;
}
static inline int
devlink_dpipe_match_put(struct sk_buff *skb,
struct devlink_dpipe_match *match)
{
return 0;
}
static inline int
devlink_resource_register(struct devlink *devlink,
const char *resource_name,
u64 resource_size,
u64 resource_id,
u64 parent_resource_id,
const struct devlink_resource_size_params *size_params)
{
return 0;
}
static inline void
devlink_resources_unregister(struct devlink *devlink,
struct devlink_resource *resource)
{
}
static inline int
devlink_resource_size_get(struct devlink *devlink, u64 resource_id,
u64 *p_resource_size)
{
return -EOPNOTSUPP;
}
static inline int
devlink_dpipe_table_resource_set(struct devlink *devlink,
const char *table_name, u64 resource_id,
u64 resource_units)
{
return -EOPNOTSUPP;
}
static inline void
devlink_resource_occ_get_register(struct devlink *devlink,
u64 resource_id,
devlink_resource_occ_get_t *occ_get,
void *occ_get_priv)
{
}
static inline void
devlink_resource_occ_get_unregister(struct devlink *devlink,
u64 resource_id)
{
}
static inline int
devlink_params_register(struct devlink *devlink,
const struct devlink_param *params,
size_t params_count)
{
return 0;
}
static inline void
devlink_params_unregister(struct devlink *devlink,
const struct devlink_param *params,
size_t params_count)
{
}
static inline int
devlink_port_params_register(struct devlink_port *devlink_port,
const struct devlink_param *params,
size_t params_count)
{
return 0;
}
static inline void
devlink_port_params_unregister(struct devlink_port *devlink_port,
const struct devlink_param *params,
size_t params_count)
{
}
static inline int
devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
union devlink_param_value *init_val)
{
return -EOPNOTSUPP;
}
static inline int
devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
union devlink_param_value init_val)
{
return -EOPNOTSUPP;
}
static inline int
devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
u32 param_id,
union devlink_param_value *init_val)
{
return -EOPNOTSUPP;
}
static inline int
devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port,
u32 param_id,
union devlink_param_value init_val)
{
return -EOPNOTSUPP;
}
static inline void
devlink_param_value_changed(struct devlink *devlink, u32 param_id)
{
}
static inline void
devlink_port_param_value_changed(struct devlink_port *devlink_port,
u32 param_id)
{
}
static inline void
devlink_param_value_str_fill(union devlink_param_value *dst_val,
const char *src)
{
}
static inline struct devlink_region *
devlink_region_create(struct devlink *devlink,
const char *region_name,
u32 region_max_snapshots,
u64 region_size)
{
return NULL;
}
static inline void
devlink_region_destroy(struct devlink_region *region)
{
}
static inline u32
devlink_region_shapshot_id_get(struct devlink *devlink)
{
return 0;
}
static inline int
devlink_region_snapshot_create(struct devlink_region *region, u64 data_len,
u8 *data, u32 snapshot_id,
devlink_snapshot_data_dest_t *data_destructor)
{
return 0;
}
static inline int
devlink_info_driver_name_put(struct devlink_info_req *req, const char *name)
{
return 0;
}
static inline int
devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn)
{
return 0;
}
static inline int
devlink_info_version_fixed_put(struct devlink_info_req *req,
const char *version_name,
const char *version_value)
{
return 0;
}
static inline int
devlink_info_version_stored_put(struct devlink_info_req *req,
const char *version_name,
const char *version_value)
{
return 0;
}
static inline int
devlink_info_version_running_put(struct devlink_info_req *req,
const char *version_name,
const char *version_value)
{
return 0;
}
static inline int
devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg)
{
return 0;
}
static inline int
devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg)
{
return 0;
}
static inline int
devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name)
{
return 0;
}
static inline int
devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg)
{
return 0;
}
static inline int
devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg,
const char *name)
{
return 0;
}
static inline int
devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg)
{
return 0;
}
static inline int
devlink_fmsg_bool_put(struct devlink_fmsg *fmsg, bool value)
{
return 0;
}
static inline int
devlink_fmsg_u8_put(struct devlink_fmsg *fmsg, u8 value)
{
return 0;
}
static inline int
devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value)
{
return 0;
}
static inline int
devlink_fmsg_u64_put(struct devlink_fmsg *fmsg, u64 value)
{
return 0;
}
static inline int
devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value)
{
return 0;
}
static inline int
devlink_fmsg_binary_put(struct devlink_fmsg *fmsg, const void *value,
u16 value_len)
{
return 0;
}
static inline int
devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name,
bool value)
{
return 0;
}
static inline int
devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name,
u8 value)
{
return 0;
}
static inline int
devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name,
u32 value)
{
return 0;
}
static inline int
devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name,
u64 value)
{
return 0;
}
static inline int
devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name,
const char *value)
{
return 0;
}
static inline int
devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name,
const void *value, u16 value_len)
{
return 0;
}
static inline struct devlink_health_reporter *
devlink_health_reporter_create(struct devlink *devlink,
const struct devlink_health_reporter_ops *ops,
u64 graceful_period, bool auto_recover,
void *priv)
{
return NULL;
}
static inline void
devlink_health_reporter_destroy(struct devlink_health_reporter *reporter)
{
}
static inline void *
devlink_health_reporter_priv(struct devlink_health_reporter *reporter)
{
return NULL;
}
static inline int
devlink_health_report(struct devlink_health_reporter *reporter,
const char *msg, void *priv_ctx)
{
return 0;
}
static inline void
devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
enum devlink_health_reporter_state state)
{
}
static inline void
devlink_compat_running_version(struct net_device *dev, char *buf, size_t len)
{
@ -1232,6 +742,7 @@ devlink_compat_flash_update(struct net_device *dev, const char *file_name)
{
return -EOPNOTSUPP;
}
#endif
#endif /* _NET_DEVLINK_H_ */

View File

@ -429,11 +429,8 @@ config NET_SOCK_MSG
with the help of BPF programs.
config NET_DEVLINK
bool "Network physical/parent device Netlink interface"
help
Network physical/parent device Netlink interface provides
infrastructure to support access to physical chip-wide config and
monitoring.
bool
default n
config PAGE_POOL
bool

View File

@ -10,6 +10,7 @@ config NET_DSA
depends on BRIDGE || BRIDGE=n
select NET_SWITCHDEV
select PHYLINK
select NET_DEVLINK
---help---
Say Y if you want to enable support for the hardware switches supported
by the Distributed Switch Architecture.