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 net_device *netdev,
16 			      struct mlxsw_core *mlxsw_core, int module,
17 			      struct ethtool_modinfo *modinfo);
18 
19 int mlxsw_env_get_module_eeprom(struct net_device *netdev,
20 				struct mlxsw_core *mlxsw_core, int module,
21 				struct ethtool_eeprom *ee, u8 *data);
22 
23 int
24 mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module,
25 				    const struct ethtool_module_eeprom *page,
26 				    struct netlink_ext_ack *extack);
27 
28 int mlxsw_env_reset_module(struct net_device *netdev,
29 			   struct mlxsw_core *mlxsw_core, u8 module,
30 			   u32 *flags);
31 
32 int
33 mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module,
34 				struct ethtool_module_power_mode_params *params,
35 				struct netlink_ext_ack *extack);
36 
37 int
38 mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module,
39 				enum ethtool_module_power_mode_policy policy,
40 				struct netlink_ext_ack *extack);
41 
42 int
43 mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 module,
44 				      u64 *p_counter);
45 
46 void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 module);
47 
48 void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 module);
49 
50 int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 module);
51 
52 void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 module);
53 
54 int mlxsw_env_init(struct mlxsw_core *core, struct mlxsw_env **p_env);
55 void mlxsw_env_fini(struct mlxsw_env *env);
56 
57 #endif
58