1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ 2 /* Copyright (c) 2018 Mellanox Technologies. All rights reserved */ 3 4 #ifndef _MLXSW_CORE_ENV_H 5 #define _MLXSW_CORE_ENV_H 6 7 #include <linux/ethtool.h> 8 9 struct ethtool_modinfo; 10 struct ethtool_eeprom; 11 12 int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module, 13 int off, int *temp); 14 15 int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module, 16 struct ethtool_modinfo *modinfo); 17 18 int mlxsw_env_get_module_eeprom(struct net_device *netdev, 19 struct mlxsw_core *mlxsw_core, int module, 20 struct ethtool_eeprom *ee, u8 *data); 21 22 int 23 mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module, 24 const struct ethtool_module_eeprom *page, 25 struct netlink_ext_ack *extack); 26 27 int mlxsw_env_reset_module(struct net_device *netdev, 28 struct mlxsw_core *mlxsw_core, u8 module, 29 u32 *flags); 30 31 int 32 mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module, 33 struct ethtool_module_power_mode_params *params, 34 struct netlink_ext_ack *extack); 35 36 int 37 mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module, 38 enum ethtool_module_power_mode_policy policy, 39 struct netlink_ext_ack *extack); 40 41 int 42 mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 module, 43 u64 *p_counter); 44 45 void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 module); 46 47 void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 module); 48 49 int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 module); 50 51 void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 module); 52 53 int mlxsw_env_init(struct mlxsw_core *core, struct mlxsw_env **p_env); 54 void mlxsw_env_fini(struct mlxsw_env *env); 55 56 #endif 57