#ifndef _NET_DEVLINK_H_
#define _NET_DEVLINK_H_
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/gfp.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/refcount.h>
#include <net/net_namespace.h>
#include <net/flow_offload.h>
#include <uapi/linux/devlink.h>
#include <linux/xarray.h>
#include <linux/firmware.h>
struct devlink;
struct devlink_linecard;
struct devlink_port_phys_attrs { … };
struct devlink_port_pci_pf_attrs { … };
struct devlink_port_pci_vf_attrs { … };
struct devlink_port_pci_sf_attrs { … };
struct devlink_port_attrs { … };
struct devlink_rate { … };
struct devlink_port { … };
struct devlink_port_new_attrs { … };
struct devlink_linecard_ops { … };
struct devlink_sb_pool_info { … };
struct devlink_dpipe_field { … };
struct devlink_dpipe_header { … };
struct devlink_dpipe_match { … };
struct devlink_dpipe_action { … };
struct devlink_dpipe_value { … };
struct devlink_dpipe_entry { … };
struct devlink_dpipe_dump_ctx { … };
struct devlink_dpipe_table_ops;
struct devlink_dpipe_table { … };
struct devlink_dpipe_table_ops { … };
struct devlink_dpipe_headers { … };
struct devlink_resource_size_params { … };
static inline void
devlink_resource_size_params_init(struct devlink_resource_size_params *size_params,
u64 size_min, u64 size_max,
u64 size_granularity,
enum devlink_resource_unit unit)
{ … }
devlink_resource_occ_get_t;
#define DEVLINK_RESOURCE_ID_PARENT_TOP …
#define DEVLINK_RESOURCE_GENERIC_NAME_PORTS …
#define __DEVLINK_PARAM_MAX_STRING_VALUE …
enum devlink_param_type { … };
devlink_param_value;
struct devlink_param_gset_ctx { … };
struct devlink_flash_notify { … };
struct devlink_param { … };
struct devlink_param_item { … };
enum devlink_param_generic_id { … };
#define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_NAME …
#define DEVLINK_PARAM_GENERIC_INT_ERR_RESET_TYPE …
#define DEVLINK_PARAM_GENERIC_MAX_MACS_NAME …
#define DEVLINK_PARAM_GENERIC_MAX_MACS_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_SRIOV_TYPE …
#define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_NAME …
#define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_TYPE …
#define DEVLINK_PARAM_GENERIC_IGNORE_ARI_NAME …
#define DEVLINK_PARAM_GENERIC_IGNORE_ARI_TYPE …
#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_NAME …
#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_TYPE …
#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_NAME …
#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_TYPE …
#define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME …
#define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE …
#define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_NAME …
#define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_ETH_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_ETH_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_RDMA_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_RDMA_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_VNET_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_VNET_TYPE …
#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_NAME …
#define DEVLINK_PARAM_GENERIC_ENABLE_IWARP_TYPE …
#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_NAME …
#define DEVLINK_PARAM_GENERIC_IO_EQ_SIZE_TYPE …
#define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME …
#define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE …
#define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) …
#define DEVLINK_PARAM_DRIVER(_id, _name, _type, _cmodes, _get, _set, _validate) …
#define DEVLINK_INFO_VERSION_GENERIC_BOARD_ID …
#define DEVLINK_INFO_VERSION_GENERIC_BOARD_REV …
#define DEVLINK_INFO_VERSION_GENERIC_BOARD_MANUFACTURE …
#define DEVLINK_INFO_VERSION_GENERIC_BOARD_PART_NUMBER …
#define DEVLINK_INFO_VERSION_GENERIC_ASIC_ID …
#define DEVLINK_INFO_VERSION_GENERIC_ASIC_REV …
#define DEVLINK_INFO_VERSION_GENERIC_FW …
#define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT …
#define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API …
#define DEVLINK_INFO_VERSION_GENERIC_FW_APP …
#define DEVLINK_INFO_VERSION_GENERIC_FW_UNDI …
#define DEVLINK_INFO_VERSION_GENERIC_FW_NCSI …
#define DEVLINK_INFO_VERSION_GENERIC_FW_PSID …
#define DEVLINK_INFO_VERSION_GENERIC_FW_ROCE …
#define DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID …
#define DEVLINK_INFO_VERSION_GENERIC_FW_BOOTLOADER …
struct devlink_flash_update_params { … };
#define DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK …
struct devlink_region;
struct devlink_info_req;
struct devlink_region_ops { … };
struct devlink_port_region_ops { … };
struct devlink_fmsg;
struct devlink_health_reporter;
enum devlink_health_reporter_state { … };
struct devlink_health_reporter_ops { … };
struct devlink_trap_metadata { … };
struct devlink_trap_policer { … };
struct devlink_trap_group { … };
#define DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT …
#define DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE …
struct devlink_trap { … };
enum devlink_trap_generic_id { … };
enum devlink_trap_group_generic_id { … };
#define DEVLINK_TRAP_GENERIC_NAME_SMAC_MC …
#define DEVLINK_TRAP_GENERIC_NAME_VLAN_TAG_MISMATCH …
#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_VLAN_FILTER …
#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_STP_FILTER …
#define DEVLINK_TRAP_GENERIC_NAME_EMPTY_TX_LIST …
#define DEVLINK_TRAP_GENERIC_NAME_PORT_LOOPBACK_FILTER …
#define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_ROUTE …
#define DEVLINK_TRAP_GENERIC_NAME_TTL_ERROR …
#define DEVLINK_TRAP_GENERIC_NAME_TAIL_DROP …
#define DEVLINK_TRAP_GENERIC_NAME_NON_IP_PACKET …
#define DEVLINK_TRAP_GENERIC_NAME_UC_DIP_MC_DMAC …
#define DEVLINK_TRAP_GENERIC_NAME_DIP_LB …
#define DEVLINK_TRAP_GENERIC_NAME_SIP_MC …
#define DEVLINK_TRAP_GENERIC_NAME_SIP_LB …
#define DEVLINK_TRAP_GENERIC_NAME_CORRUPTED_IP_HDR …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_SIP_BC …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_RESERVED_SCOPE …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE …
#define DEVLINK_TRAP_GENERIC_NAME_MTU_ERROR …
#define DEVLINK_TRAP_GENERIC_NAME_UNRESOLVED_NEIGH …
#define DEVLINK_TRAP_GENERIC_NAME_RPF …
#define DEVLINK_TRAP_GENERIC_NAME_REJECT_ROUTE …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_LPM_UNICAST_MISS …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_LPM_UNICAST_MISS …
#define DEVLINK_TRAP_GENERIC_NAME_NON_ROUTABLE …
#define DEVLINK_TRAP_GENERIC_NAME_DECAP_ERROR …
#define DEVLINK_TRAP_GENERIC_NAME_OVERLAY_SMAC_MC …
#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_FLOW_ACTION_DROP …
#define DEVLINK_TRAP_GENERIC_NAME_EGRESS_FLOW_ACTION_DROP …
#define DEVLINK_TRAP_GENERIC_NAME_STP …
#define DEVLINK_TRAP_GENERIC_NAME_LACP …
#define DEVLINK_TRAP_GENERIC_NAME_LLDP …
#define DEVLINK_TRAP_GENERIC_NAME_IGMP_QUERY …
#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V1_REPORT …
#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V2_REPORT …
#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V3_REPORT …
#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V2_LEAVE …
#define DEVLINK_TRAP_GENERIC_NAME_MLD_QUERY …
#define DEVLINK_TRAP_GENERIC_NAME_MLD_V1_REPORT …
#define DEVLINK_TRAP_GENERIC_NAME_MLD_V2_REPORT …
#define DEVLINK_TRAP_GENERIC_NAME_MLD_V1_DONE …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_DHCP …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_DHCP …
#define DEVLINK_TRAP_GENERIC_NAME_ARP_REQUEST …
#define DEVLINK_TRAP_GENERIC_NAME_ARP_RESPONSE …
#define DEVLINK_TRAP_GENERIC_NAME_ARP_OVERLAY …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_NEIGH_SOLICIT …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_NEIGH_ADVERT …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_BFD …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_BFD …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_OSPF …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_OSPF …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_BGP …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_BGP …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_VRRP …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_VRRP …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_PIM …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_PIM …
#define DEVLINK_TRAP_GENERIC_NAME_UC_LB …
#define DEVLINK_TRAP_GENERIC_NAME_LOCAL_ROUTE …
#define DEVLINK_TRAP_GENERIC_NAME_EXTERNAL_ROUTE …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_UC_DIP_LINK_LOCAL_SCOPE …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_DIP_ALL_NODES …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_DIP_ALL_ROUTERS …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_SOLICIT …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_ADVERT …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_REDIRECT …
#define DEVLINK_TRAP_GENERIC_NAME_IPV4_ROUTER_ALERT …
#define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_ALERT …
#define DEVLINK_TRAP_GENERIC_NAME_PTP_EVENT …
#define DEVLINK_TRAP_GENERIC_NAME_PTP_GENERAL …
#define DEVLINK_TRAP_GENERIC_NAME_FLOW_ACTION_SAMPLE …
#define DEVLINK_TRAP_GENERIC_NAME_FLOW_ACTION_TRAP …
#define DEVLINK_TRAP_GENERIC_NAME_EARLY_DROP …
#define DEVLINK_TRAP_GENERIC_NAME_VXLAN_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_LLC_SNAP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_VLAN_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_PPPOE_PPP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_MPLS_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_ARP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_IP_1_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_IP_N_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_GRE_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_UDP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_TCP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_IPSEC_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_SCTP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_DCCP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_GTP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_ESP_PARSING …
#define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_NEXTHOP …
#define DEVLINK_TRAP_GENERIC_NAME_DMAC_FILTER …
#define DEVLINK_TRAP_GENERIC_NAME_EAPOL …
#define DEVLINK_TRAP_GENERIC_NAME_LOCKED_PORT …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_DROPS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_EXCEPTIONS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BUFFER_DROPS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_TUNNEL_DROPS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_DROPS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_STP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LACP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LLDP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_MC_SNOOPING …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_DHCP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_NEIGH_DISCOVERY …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BFD …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_OSPF …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BGP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_VRRP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PIM …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_UC_LB …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LOCAL_DELIVERY …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_EXTERNAL_DELIVERY …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_IPV6 …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_EVENT …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_GENERAL …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_SAMPLE …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_TRAP …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PARSER_ERROR_DROPS …
#define DEVLINK_TRAP_GROUP_GENERIC_NAME_EAPOL …
#define DEVLINK_TRAP_GENERIC(_type, _init_action, _id, _group_id, \
_metadata_cap) …
#define DEVLINK_TRAP_DRIVER(_type, _init_action, _id, _name, _group_id, \
_metadata_cap) …
#define DEVLINK_TRAP_GROUP_GENERIC(_id, _policer_id) …
#define DEVLINK_TRAP_POLICER(_id, _rate, _burst, _max_rate, _min_rate, \
_max_burst, _min_burst) …
enum { … };
struct devlink_ops { … };
void *devlink_priv(struct devlink *devlink);
struct devlink *priv_to_devlink(void *priv);
struct device *devlink_to_dev(const struct devlink *devlink);
void devl_lock(struct devlink *devlink);
int devl_trylock(struct devlink *devlink);
void devl_unlock(struct devlink *devlink);
void devl_assert_locked(struct devlink *devlink);
bool devl_lock_is_held(struct devlink *devlink);
struct ib_device;
struct net *devlink_net(const struct devlink *devlink);
struct devlink *devlink_alloc_ns(const struct devlink_ops *ops,
size_t priv_size, struct net *net,
struct device *dev);
static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
size_t priv_size,
struct device *dev)
{ … }
int devl_register(struct devlink *devlink);
void devl_unregister(struct devlink *devlink);
void devlink_register(struct devlink *devlink);
void devlink_unregister(struct devlink *devlink);
void devlink_free(struct devlink *devlink);
struct devlink_port_ops { … };
void devlink_port_init(struct devlink *devlink,
struct devlink_port *devlink_port);
void devlink_port_fini(struct devlink_port *devlink_port);
int devl_port_register_with_ops(struct devlink *devlink,
struct devlink_port *devlink_port,
unsigned int port_index,
const struct devlink_port_ops *ops);
static inline int devl_port_register(struct devlink *devlink,
struct devlink_port *devlink_port,
unsigned int port_index)
{ … }
int devlink_port_register_with_ops(struct devlink *devlink,
struct devlink_port *devlink_port,
unsigned int port_index,
const struct devlink_port_ops *ops);
static inline int devlink_port_register(struct devlink *devlink,
struct devlink_port *devlink_port,
unsigned int port_index)
{ … }
void devl_port_unregister(struct devlink_port *devlink_port);
void devlink_port_unregister(struct devlink_port *devlink_port);
void devlink_port_type_eth_set(struct devlink_port *devlink_port);
void devlink_port_type_ib_set(struct devlink_port *devlink_port,
struct ib_device *ibdev);
void devlink_port_type_clear(struct devlink_port *devlink_port);
void devlink_port_attrs_set(struct devlink_port *devlink_port,
struct devlink_port_attrs *devlink_port_attrs);
void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u32 controller,
u16 pf, bool external);
void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, u32 controller,
u16 pf, u16 vf, bool external);
void devlink_port_attrs_pci_sf_set(struct devlink_port *devlink_port,
u32 controller, u16 pf, u32 sf,
bool external);
int devl_port_fn_devlink_set(struct devlink_port *devlink_port,
struct devlink *fn_devlink);
struct devlink_rate *
devl_rate_node_create(struct devlink *devlink, void *priv, char *node_name,
struct devlink_rate *parent);
int
devl_rate_leaf_create(struct devlink_port *devlink_port, void *priv,
struct devlink_rate *parent);
void devl_rate_leaf_destroy(struct devlink_port *devlink_port);
void devl_rate_nodes_destroy(struct devlink *devlink);
void devlink_port_linecard_set(struct devlink_port *devlink_port,
struct devlink_linecard *linecard);
struct devlink_linecard *
devl_linecard_create(struct devlink *devlink, unsigned int linecard_index,
const struct devlink_linecard_ops *ops, void *priv);
void devl_linecard_destroy(struct devlink_linecard *linecard);
void devlink_linecard_provision_set(struct devlink_linecard *linecard,
const char *type);
void devlink_linecard_provision_clear(struct devlink_linecard *linecard);
void devlink_linecard_provision_fail(struct devlink_linecard *linecard);
void devlink_linecard_activate(struct devlink_linecard *linecard);
void devlink_linecard_deactivate(struct devlink_linecard *linecard);
int devlink_linecard_nested_dl_set(struct devlink_linecard *linecard,
struct devlink *nested_devlink);
int devl_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);
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);
void devl_sb_unregister(struct devlink *devlink, unsigned int sb_index);
void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
int devl_dpipe_table_register(struct devlink *devlink,
const char *table_name,
const struct devlink_dpipe_table_ops *table_ops,
void *priv, bool counter_control_extern);
void devl_dpipe_table_unregister(struct devlink *devlink,
const char *table_name);
void devl_dpipe_headers_register(struct devlink *devlink,
struct devlink_dpipe_headers *dpipe_headers);
void devl_dpipe_headers_unregister(struct devlink *devlink);
bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
const char *table_name);
int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx);
int devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
struct devlink_dpipe_entry *entry);
int devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx);
void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry);
int devlink_dpipe_action_put(struct sk_buff *skb,
struct devlink_dpipe_action *action);
int devlink_dpipe_match_put(struct sk_buff *skb,
struct devlink_dpipe_match *match);
extern struct devlink_dpipe_header devlink_dpipe_header_ethernet;
extern struct devlink_dpipe_header devlink_dpipe_header_ipv4;
extern struct devlink_dpipe_header devlink_dpipe_header_ipv6;
int devl_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);
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);
void devl_resources_unregister(struct devlink *devlink);
void devlink_resources_unregister(struct devlink *devlink);
int devl_resource_size_get(struct devlink *devlink,
u64 resource_id,
u64 *p_resource_size);
int devl_dpipe_table_resource_set(struct devlink *devlink,
const char *table_name, u64 resource_id,
u64 resource_units);
void devl_resource_occ_get_register(struct devlink *devlink,
u64 resource_id,
devlink_resource_occ_get_t *occ_get,
void *occ_get_priv);
void devlink_resource_occ_get_register(struct devlink *devlink,
u64 resource_id,
devlink_resource_occ_get_t *occ_get,
void *occ_get_priv);
void devl_resource_occ_get_unregister(struct devlink *devlink,
u64 resource_id);
void devlink_resource_occ_get_unregister(struct devlink *devlink,
u64 resource_id);
int devl_params_register(struct devlink *devlink,
const struct devlink_param *params,
size_t params_count);
int devlink_params_register(struct devlink *devlink,
const struct devlink_param *params,
size_t params_count);
void devl_params_unregister(struct devlink *devlink,
const struct devlink_param *params,
size_t params_count);
void devlink_params_unregister(struct devlink *devlink,
const struct devlink_param *params,
size_t params_count);
int devl_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
union devlink_param_value *val);
void devl_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
union devlink_param_value init_val);
void devl_param_value_changed(struct devlink *devlink, u32 param_id);
struct devlink_region *devl_region_create(struct devlink *devlink,
const struct devlink_region_ops *ops,
u32 region_max_snapshots,
u64 region_size);
struct devlink_region *
devlink_region_create(struct devlink *devlink,
const struct devlink_region_ops *ops,
u32 region_max_snapshots, u64 region_size);
struct devlink_region *
devlink_port_region_create(struct devlink_port *port,
const struct devlink_port_region_ops *ops,
u32 region_max_snapshots, u64 region_size);
void devl_region_destroy(struct devlink_region *region);
void devlink_region_destroy(struct devlink_region *region);
int devlink_region_snapshot_id_get(struct devlink *devlink, u32 *id);
void devlink_region_snapshot_id_put(struct devlink *devlink, u32 id);
int devlink_region_snapshot_create(struct devlink_region *region,
u8 *data, u32 snapshot_id);
int devlink_info_serial_number_put(struct devlink_info_req *req,
const char *sn);
int devlink_info_board_serial_number_put(struct devlink_info_req *req,
const char *bsn);
enum devlink_info_version_type { … };
int devlink_info_version_fixed_put(struct devlink_info_req *req,
const char *version_name,
const char *version_value);
int devlink_info_version_stored_put(struct devlink_info_req *req,
const char *version_name,
const char *version_value);
int devlink_info_version_stored_put_ext(struct devlink_info_req *req,
const char *version_name,
const char *version_value,
enum devlink_info_version_type version_type);
int devlink_info_version_running_put(struct devlink_info_req *req,
const char *version_name,
const char *version_value);
int devlink_info_version_running_put_ext(struct devlink_info_req *req,
const char *version_name,
const char *version_value,
enum devlink_info_version_type version_type);
void devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg);
void devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg);
void devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name);
void devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg);
void devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg,
const char *name);
void devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg);
void devlink_fmsg_binary_pair_nest_start(struct devlink_fmsg *fmsg,
const char *name);
void devlink_fmsg_binary_pair_nest_end(struct devlink_fmsg *fmsg);
void devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value);
void devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value);
void devlink_fmsg_binary_put(struct devlink_fmsg *fmsg, const void *value,
u16 value_len);
void devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name,
bool value);
void devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name,
u8 value);
void devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name,
u32 value);
void devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name,
u64 value);
void devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name,
const char *value);
void devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name,
const void *value, u32 value_len);
struct devlink_health_reporter *
devl_port_health_reporter_create(struct devlink_port *port,
const struct devlink_health_reporter_ops *ops,
u64 graceful_period, void *priv);
struct devlink_health_reporter *
devlink_port_health_reporter_create(struct devlink_port *port,
const struct devlink_health_reporter_ops *ops,
u64 graceful_period, void *priv);
struct devlink_health_reporter *
devl_health_reporter_create(struct devlink *devlink,
const struct devlink_health_reporter_ops *ops,
u64 graceful_period, void *priv);
struct devlink_health_reporter *
devlink_health_reporter_create(struct devlink *devlink,
const struct devlink_health_reporter_ops *ops,
u64 graceful_period, void *priv);
void
devl_health_reporter_destroy(struct devlink_health_reporter *reporter);
void
devlink_health_reporter_destroy(struct devlink_health_reporter *reporter);
void *
devlink_health_reporter_priv(struct devlink_health_reporter *reporter);
int devlink_health_report(struct devlink_health_reporter *reporter,
const char *msg, void *priv_ctx);
void
devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
enum devlink_health_reporter_state state);
void
devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
int devl_nested_devlink_set(struct devlink *devlink,
struct devlink *nested_devlink);
bool devlink_is_reload_failed(const struct devlink *devlink);
void devlink_remote_reload_actions_performed(struct devlink *devlink,
enum devlink_reload_limit limit,
u32 actions_performed);
void devlink_flash_update_status_notify(struct devlink *devlink,
const char *status_msg,
const char *component,
unsigned long done,
unsigned long total);
void devlink_flash_update_timeout_notify(struct devlink *devlink,
const char *status_msg,
const char *component,
unsigned long timeout);
int devl_traps_register(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count, void *priv);
int devlink_traps_register(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count, void *priv);
void devl_traps_unregister(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count);
void devlink_traps_unregister(struct devlink *devlink,
const struct devlink_trap *traps,
size_t traps_count);
void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
void *trap_ctx, struct devlink_port *in_devlink_port,
const struct flow_action_cookie *fa_cookie);
void *devlink_trap_ctx_priv(void *trap_ctx);
int devl_trap_groups_register(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
int devlink_trap_groups_register(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
void devl_trap_groups_unregister(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
void devlink_trap_groups_unregister(struct devlink *devlink,
const struct devlink_trap_group *groups,
size_t groups_count);
int
devl_trap_policers_register(struct devlink *devlink,
const struct devlink_trap_policer *policers,
size_t policers_count);
void
devl_trap_policers_unregister(struct devlink *devlink,
const struct devlink_trap_policer *policers,
size_t policers_count);
#if IS_ENABLED(CONFIG_NET_DEVLINK)
struct devlink *__must_check devlink_try_get(struct devlink *devlink);
void devlink_put(struct devlink *devlink);
void devlink_compat_running_version(struct devlink *devlink,
char *buf, size_t len);
int devlink_compat_flash_update(struct devlink *devlink, const char *file_name);
int devlink_compat_phys_port_name_get(struct net_device *dev,
char *name, size_t len);
int devlink_compat_switch_id_get(struct net_device *dev,
struct netdev_phys_item_id *ppid);
int devlink_nl_port_handle_fill(struct sk_buff *msg, struct devlink_port *devlink_port);
size_t devlink_nl_port_handle_size(struct devlink_port *devlink_port);
#else
static inline struct devlink *devlink_try_get(struct devlink *devlink)
{
return NULL;
}
static inline void devlink_put(struct devlink *devlink)
{
}
static inline void
devlink_compat_running_version(struct devlink *devlink, char *buf, size_t len)
{
}
static inline int
devlink_compat_flash_update(struct devlink *devlink, const char *file_name)
{
return -EOPNOTSUPP;
}
static inline int
devlink_compat_phys_port_name_get(struct net_device *dev,
char *name, size_t len)
{
return -EOPNOTSUPP;
}
static inline int
devlink_compat_switch_id_get(struct net_device *dev,
struct netdev_phys_item_id *ppid)
{
return -EOPNOTSUPP;
}
static inline int
devlink_nl_port_handle_fill(struct sk_buff *msg, struct devlink_port *devlink_port)
{
return 0;
}
static inline size_t devlink_nl_port_handle_size(struct devlink_port *devlink_port)
{
return 0;
}
#endif
#endif