brintos

brintos / linux-shallow public Read only

0
0
Text · 1.9 KiB · 961f75d Raw
69 lines · c
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */2/* Copyright (c) 2019, Mellanox Technologies */3 4#ifndef __MLX5_DEVLINK_H__5#define __MLX5_DEVLINK_H__6 7#include <net/devlink.h>8 9enum mlx5_devlink_resource_id {10	MLX5_DL_RES_MAX_LOCAL_SFS = 1,11	MLX5_DL_RES_MAX_EXTERNAL_SFS,12 13	__MLX5_ID_RES_MAX,14	MLX5_ID_RES_MAX = __MLX5_ID_RES_MAX - 1,15};16 17enum mlx5_devlink_param_id {18	MLX5_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,19	MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE,20	MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM,21	MLX5_DEVLINK_PARAM_ID_ESW_PORT_METADATA,22	MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT,23	MLX5_DEVLINK_PARAM_ID_HAIRPIN_NUM_QUEUES,24	MLX5_DEVLINK_PARAM_ID_HAIRPIN_QUEUE_SIZE,25};26 27struct mlx5_trap_ctx {28	int id;29	int action;30};31 32struct mlx5_devlink_trap {33	struct mlx5_trap_ctx trap;34	void *item;35	struct list_head list;36};37 38struct mlx5_devlink_trap_event_ctx {39	struct mlx5_trap_ctx *trap;40	int err;41};42 43struct mlx5_core_dev;44void mlx5_devlink_trap_report(struct mlx5_core_dev *dev, int trap_id, struct sk_buff *skb,45			      struct devlink_port *dl_port);46int mlx5_devlink_trap_get_num_active(struct mlx5_core_dev *dev);47int mlx5_devlink_traps_get_action(struct mlx5_core_dev *dev, int trap_id,48				  enum devlink_trap_action *action);49int mlx5_devlink_traps_register(struct devlink *devlink);50void mlx5_devlink_traps_unregister(struct devlink *devlink);51 52struct devlink *mlx5_devlink_alloc(struct device *dev);53void mlx5_devlink_free(struct devlink *devlink);54int mlx5_devlink_params_register(struct devlink *devlink);55void mlx5_devlink_params_unregister(struct devlink *devlink);56 57static inline bool mlx5_core_is_eth_enabled(struct mlx5_core_dev *dev)58{59	union devlink_param_value val;60	int err;61 62	err = devl_param_driverinit_value_get(priv_to_devlink(dev),63					      DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH,64					      &val);65	return err ? false : val.vbool;66}67 68#endif /* __MLX5_DEVLINK_H__ */69