1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2018 Mellanox Technologies. All rights reserved */
4 #ifndef _MLXSW_CORE_ENV_H
5 #define _MLXSW_CORE_ENV_H
7 #include <linux/ethtool.h>
9 struct ethtool_modinfo;
10 struct ethtool_eeprom;
12 int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core,
13 u8 slot_index, int module, int off,
16 int mlxsw_env_get_module_info(struct net_device *netdev,
17 struct mlxsw_core *mlxsw_core, u8 slot_index,
18 int module, struct ethtool_modinfo *modinfo);
20 int mlxsw_env_get_module_eeprom(struct net_device *netdev,
21 struct mlxsw_core *mlxsw_core, u8 slot_index,
22 int module, struct ethtool_eeprom *ee,
26 mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
27 u8 slot_index, u8 module,
28 const struct ethtool_module_eeprom *page,
29 struct netlink_ext_ack *extack);
31 int mlxsw_env_reset_module(struct net_device *netdev,
32 struct mlxsw_core *mlxsw_core, u8 slot_index,
33 u8 module, u32 *flags);
36 mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index,
38 struct ethtool_module_power_mode_params *params,
39 struct netlink_ext_ack *extack);
42 mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index,
44 enum ethtool_module_power_mode_policy policy,
45 struct netlink_ext_ack *extack);
48 mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 slot_index,
49 u8 module, u64 *p_counter);
51 void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 slot_index,
54 void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 slot_index,
57 int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 slot_index,
60 void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 slot_index,
63 int mlxsw_env_init(struct mlxsw_core *core,
64 const struct mlxsw_bus_info *bus_info,
65 struct mlxsw_env **p_env);
66 void mlxsw_env_fini(struct mlxsw_env *env);