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 32 mlxsw_env_set_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, 33 u8 slot_index, u8 module, 34 const struct ethtool_module_eeprom *page, 35 struct netlink_ext_ack *extack); 36 37 int mlxsw_env_reset_module(struct net_device *netdev, 38 struct mlxsw_core *mlxsw_core, u8 slot_index, 39 u8 module, u32 *flags); 40 41 int 42 mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index, 43 u8 module, 44 struct ethtool_module_power_mode_params *params, 45 struct netlink_ext_ack *extack); 46 47 int 48 mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index, 49 u8 module, 50 enum ethtool_module_power_mode_policy policy, 51 struct netlink_ext_ack *extack); 52 53 int 54 mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 slot_index, 55 u8 module, u64 *p_counter); 56 57 void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 slot_index, 58 u8 module); 59 60 void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 slot_index, 61 u8 module); 62 63 int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 slot_index, 64 u8 module); 65 66 void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 slot_index, 67 u8 module); 68 69 int mlxsw_env_init(struct mlxsw_core *core, 70 const struct mlxsw_bus_info *bus_info, 71 struct mlxsw_env **p_env); 72 void mlxsw_env_fini(struct mlxsw_env *env); 73 74 #endif 75