#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/ethtool.h>
#include <linux/sfp.h>
#include <linux/mutex.h>
#include "core.h"
#include "core_env.h"
#include "item.h"
#include "reg.h"
struct mlxsw_env_module_info { … };
struct mlxsw_env_line_card { … };
struct mlxsw_env { … };
static bool __mlxsw_env_linecard_is_active(struct mlxsw_env *mlxsw_env,
u8 slot_index)
{ … }
static bool mlxsw_env_linecard_is_active(struct mlxsw_env *mlxsw_env,
u8 slot_index)
{ … }
static struct
mlxsw_env_module_info *mlxsw_env_module_info_get(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module)
{ … }
static int __mlxsw_env_validate_module_type(struct mlxsw_core *core,
u8 slot_index, u8 module)
{ … }
static int mlxsw_env_validate_module_type(struct mlxsw_core *core,
u8 slot_index, u8 module)
{ … }
static int
mlxsw_env_validate_cable_ident(struct mlxsw_core *core, u8 slot_index, int id,
bool *qsfp, bool *cmis)
{ … }
static int
mlxsw_env_query_module_eeprom(struct mlxsw_core *mlxsw_core, u8 slot_index,
int module, u16 offset, u16 size, void *data,
bool qsfp, unsigned int *p_read_size)
{ … }
int
mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, u8 slot_index,
int module, int off, int *temp)
{ … }
int mlxsw_env_get_module_info(struct net_device *netdev,
struct mlxsw_core *mlxsw_core, u8 slot_index,
int module, struct ethtool_modinfo *modinfo)
{ … }
EXPORT_SYMBOL(…);
int mlxsw_env_get_module_eeprom(struct net_device *netdev,
struct mlxsw_core *mlxsw_core, u8 slot_index,
int module, struct ethtool_eeprom *ee,
u8 *data)
{ … }
EXPORT_SYMBOL(…);
static int mlxsw_env_mcia_status_process(const char *mcia_pl,
struct netlink_ext_ack *extack)
{ … }
int
mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{ … }
EXPORT_SYMBOL(…);
int
mlxsw_env_set_module_eeprom_by_page(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{ … }
EXPORT_SYMBOL(…);
static int mlxsw_env_module_reset(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module)
{ … }
int mlxsw_env_reset_module(struct net_device *netdev,
struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module, u32 *flags)
{ … }
EXPORT_SYMBOL(…);
int
mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module,
struct ethtool_module_power_mode_params *params,
struct netlink_ext_ack *extack)
{ … }
EXPORT_SYMBOL(…);
static int mlxsw_env_module_enable_set(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module, bool enable)
{ … }
static int mlxsw_env_module_low_power_set(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
bool low_power)
{ … }
static int __mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
bool low_power,
struct netlink_ext_ack *extack)
{ … }
static int
mlxsw_env_set_module_power_mode_apply(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
enum ethtool_module_power_mode_policy policy,
struct netlink_ext_ack *extack)
{ … }
int
mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module,
enum ethtool_module_power_mode_policy policy,
struct netlink_ext_ack *extack)
{ … }
EXPORT_SYMBOL(…);
static int mlxsw_env_module_has_temp_sensor(struct mlxsw_core *mlxsw_core,
u8 slot_index, u8 module,
bool *p_has_temp_sensor)
{ … }
static int
mlxsw_env_temp_event_set(struct mlxsw_core *mlxsw_core, u8 slot_index,
u16 sensor_index, bool enable)
{ … }
static int mlxsw_env_module_temp_event_enable(struct mlxsw_core *mlxsw_core,
u8 slot_index)
{ … }
struct mlxsw_env_module_temp_warn_event { … };
static void mlxsw_env_mtwe_event_work(struct work_struct *work)
{ … }
static void
mlxsw_env_mtwe_listener_func(const struct mlxsw_reg_info *reg, char *mtwe_pl,
void *priv)
{ … }
static const struct mlxsw_listener mlxsw_env_temp_warn_listener = …;
static int mlxsw_env_temp_warn_event_register(struct mlxsw_core *mlxsw_core)
{ … }
static void mlxsw_env_temp_warn_event_unregister(struct mlxsw_env *mlxsw_env)
{ … }
struct mlxsw_env_module_plug_unplug_event { … };
static void mlxsw_env_pmpe_event_work(struct work_struct *work)
{ … }
static void
mlxsw_env_pmpe_listener_func(const struct mlxsw_reg_info *reg, char *pmpe_pl,
void *priv)
{ … }
static const struct mlxsw_listener mlxsw_env_module_plug_listener = …;
static int
mlxsw_env_module_plug_event_register(struct mlxsw_core *mlxsw_core)
{ … }
static void
mlxsw_env_module_plug_event_unregister(struct mlxsw_env *mlxsw_env)
{ … }
static int
mlxsw_env_module_oper_state_event_enable(struct mlxsw_core *mlxsw_core,
u8 slot_index)
{ … }
int
mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module, u64 *p_counter)
{ … }
EXPORT_SYMBOL(…);
void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module)
{ … }
EXPORT_SYMBOL(…);
void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module)
{ … }
EXPORT_SYMBOL(…);
int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module)
{ … }
EXPORT_SYMBOL(…);
void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 slot_index,
u8 module)
{ … }
EXPORT_SYMBOL(…);
static int mlxsw_env_line_cards_alloc(struct mlxsw_env *env)
{ … }
static void mlxsw_env_line_cards_free(struct mlxsw_env *env)
{ … }
static int
mlxsw_env_module_event_enable(struct mlxsw_env *mlxsw_env, u8 slot_index)
{ … }
static void
mlxsw_env_module_event_disable(struct mlxsw_env *mlxsw_env, u8 slot_index)
{ … }
static int
mlxsw_env_module_type_set(struct mlxsw_core *mlxsw_core, u8 slot_index)
{ … }
static void
mlxsw_env_linecard_modules_power_mode_apply(struct mlxsw_core *mlxsw_core,
struct mlxsw_env *env,
u8 slot_index)
{ … }
static void
mlxsw_env_got_active(struct mlxsw_core *mlxsw_core, u8 slot_index, void *priv)
{ … }
static void
mlxsw_env_got_inactive(struct mlxsw_core *mlxsw_core, u8 slot_index,
void *priv)
{ … }
static struct mlxsw_linecards_event_ops mlxsw_env_event_ops = …;
static void mlxsw_env_max_module_eeprom_len_query(struct mlxsw_env *mlxsw_env)
{ … }
int mlxsw_env_init(struct mlxsw_core *mlxsw_core,
const struct mlxsw_bus_info *bus_info,
struct mlxsw_env **p_env)
{ … }
void mlxsw_env_fini(struct mlxsw_env *env)
{ … }