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, 13 u8 slot_index, int module, int off, 14 int *temp); 15 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); 19 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, 23 u8 *data); 24 25 int 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); 30 31 int mlxsw_env_reset_module(struct net_device *netdev, 32 struct mlxsw_core *mlxsw_core, u8 slot_index, 33 u8 module, u32 *flags); 34 35 int 36 mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index, 37 u8 module, 38 struct ethtool_module_power_mode_params *params, 39 struct netlink_ext_ack *extack); 40 41 int 42 mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index, 43 u8 module, 44 enum ethtool_module_power_mode_policy policy, 45 struct netlink_ext_ack *extack); 46 47 int 48 mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 slot_index, 49 u8 module, u64 *p_counter); 50 51 void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 slot_index, 52 u8 module); 53 54 void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 slot_index, 55 u8 module); 56 57 int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 slot_index, 58 u8 module); 59 60 void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 slot_index, 61 u8 module); 62 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); 67 68 #endif 69