#include "reg.h"
#include "core.h"
#include "spectrum.h"
#include "core_env.h"
static const char mlxsw_sp_driver_version[] = …;
static void mlxsw_sp_port_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo)
{ … }
struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping { … };
static const struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping
mlxsw_sp_link_ext_state_opcode_map[] = …;
static void
mlxsw_sp_port_set_link_ext_state(struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping
link_ext_state_mapping,
struct ethtool_link_ext_state_info *link_ext_state_info)
{ … }
static int
mlxsw_sp_port_get_link_ext_state(struct net_device *dev,
struct ethtool_link_ext_state_info *link_ext_state_info)
{ … }
static void mlxsw_sp_port_get_pauseparam(struct net_device *dev,
struct ethtool_pauseparam *pause)
{ … }
static int mlxsw_sp_port_pause_set(struct mlxsw_sp_port *mlxsw_sp_port,
struct ethtool_pauseparam *pause)
{ … }
#define MLXSW_SP_PAUSE_DELAY_BYTES …
static int mlxsw_sp_port_set_pauseparam(struct net_device *dev,
struct ethtool_pauseparam *pause)
{ … }
struct mlxsw_sp_port_hw_stats { … };
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_stats[] = …;
#define MLXSW_SP_PORT_HW_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_rfc_2863_stats[] = …;
#define MLXSW_SP_PORT_HW_RFC_2863_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_rfc_2819_stats[] = …;
#define MLXSW_SP_PORT_HW_RFC_2819_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_rfc_3635_stats[] = …;
#define MLXSW_SP_PORT_HW_RFC_3635_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_ext_stats[] = …;
#define MLXSW_SP_PORT_HW_EXT_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_discard_stats[] = …;
#define MLXSW_SP_PORT_HW_DISCARD_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_prio_stats[] = …;
#define MLXSW_SP_PORT_HW_PRIO_STATS_LEN …
static struct mlxsw_sp_port_hw_stats mlxsw_sp_port_hw_tc_stats[] = …;
#define MLXSW_SP_PORT_HW_TC_STATS_LEN …
struct mlxsw_sp_port_stats { … };
static u64
mlxsw_sp_port_get_transceiver_overheat_stats(struct mlxsw_sp_port *mlxsw_sp_port)
{ … }
static struct mlxsw_sp_port_stats mlxsw_sp_port_transceiver_stats[] = …;
#define MLXSW_SP_PORT_HW_TRANSCEIVER_STATS_LEN …
#define MLXSW_SP_PORT_ETHTOOL_STATS_LEN …
static void mlxsw_sp_port_get_prio_strings(u8 **p, int prio)
{ … }
static void mlxsw_sp_port_get_tc_strings(u8 **p, int tc)
{ … }
static void mlxsw_sp_port_get_strings(struct net_device *dev,
u32 stringset, u8 *data)
{ … }
static int mlxsw_sp_port_set_phys_id(struct net_device *dev,
enum ethtool_phys_id_state state)
{ … }
static int
mlxsw_sp_get_hw_stats_by_group(struct mlxsw_sp_port_hw_stats **p_hw_stats,
int *p_len, enum mlxsw_reg_ppcnt_grp grp)
{ … }
static void __mlxsw_sp_port_get_stats(struct net_device *dev,
enum mlxsw_reg_ppcnt_grp grp, int prio,
u64 *data, int data_index)
{ … }
static void __mlxsw_sp_port_get_env_stats(struct net_device *dev, u64 *data, int data_index,
struct mlxsw_sp_port_stats *port_stats,
int len)
{ … }
static void mlxsw_sp_port_get_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{ … }
static int mlxsw_sp_port_get_sset_count(struct net_device *dev, int sset)
{ … }
static void
mlxsw_sp_port_get_link_supported(struct mlxsw_sp *mlxsw_sp, u32 eth_proto_cap,
struct ethtool_link_ksettings *cmd)
{ … }
static void
mlxsw_sp_port_get_link_advertise(struct mlxsw_sp *mlxsw_sp,
u32 eth_proto_admin, bool autoneg,
struct ethtool_link_ksettings *cmd)
{ … }
static u8
mlxsw_sp_port_connector_port(enum mlxsw_reg_ptys_connector_type connector_type)
{ … }
static int mlxsw_sp_port_ptys_query(struct mlxsw_sp_port *mlxsw_sp_port,
u32 *p_eth_proto_cap, u32 *p_eth_proto_admin,
u32 *p_eth_proto_oper, u8 *p_connector_type)
{ … }
static int mlxsw_sp_port_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ … }
static int
mlxsw_sp_port_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ … }
static int mlxsw_sp_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{ … }
static int mlxsw_sp_get_module_eeprom(struct net_device *netdev,
struct ethtool_eeprom *ee, u8 *data)
{ … }
static int
mlxsw_sp_get_module_eeprom_by_page(struct net_device *dev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{ … }
static int
mlxsw_sp_set_module_eeprom_by_page(struct net_device *dev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{ … }
static int
mlxsw_sp_get_ts_info(struct net_device *netdev, struct kernel_ethtool_ts_info *info)
{ … }
static void
mlxsw_sp_get_eth_phy_stats(struct net_device *dev,
struct ethtool_eth_phy_stats *phy_stats)
{ … }
static void
mlxsw_sp_get_eth_mac_stats(struct net_device *dev,
struct ethtool_eth_mac_stats *mac_stats)
{ … }
static void
mlxsw_sp_get_eth_ctrl_stats(struct net_device *dev,
struct ethtool_eth_ctrl_stats *ctrl_stats)
{ … }
static const struct ethtool_rmon_hist_range mlxsw_rmon_ranges[] = …;
static void
mlxsw_sp_get_rmon_stats(struct net_device *dev,
struct ethtool_rmon_stats *rmon,
const struct ethtool_rmon_hist_range **ranges)
{ … }
static int mlxsw_sp_reset(struct net_device *dev, u32 *flags)
{ … }
static int
mlxsw_sp_get_module_power_mode(struct net_device *dev,
struct ethtool_module_power_mode_params *params,
struct netlink_ext_ack *extack)
{ … }
static int
mlxsw_sp_set_module_power_mode(struct net_device *dev,
const struct ethtool_module_power_mode_params *params,
struct netlink_ext_ack *extack)
{ … }
const struct ethtool_ops mlxsw_sp_port_ethtool_ops = …;
struct mlxsw_sp1_port_link_mode { … };
static const struct mlxsw_sp1_port_link_mode mlxsw_sp1_port_link_mode[] = …;
#define MLXSW_SP1_PORT_LINK_MODE_LEN …
static void
mlxsw_sp1_from_ptys_supported_port(struct mlxsw_sp *mlxsw_sp,
u32 ptys_eth_proto,
struct ethtool_link_ksettings *cmd)
{ … }
static void
mlxsw_sp1_from_ptys_link(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto,
unsigned long *mode)
{ … }
static u32
mlxsw_sp1_from_ptys_speed(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto)
{ … }
static void
mlxsw_sp1_from_ptys_link_mode(struct mlxsw_sp *mlxsw_sp, bool carrier_ok,
u32 ptys_eth_proto,
struct ethtool_link_ksettings *cmd)
{ … }
static int mlxsw_sp1_ptys_max_speed(struct mlxsw_sp_port *mlxsw_sp_port, u32 *p_max_speed)
{ … }
static u32
mlxsw_sp1_to_ptys_advert_link(struct mlxsw_sp *mlxsw_sp,
const struct ethtool_link_ksettings *cmd)
{ … }
static u32 mlxsw_sp1_to_ptys_speed_lanes(struct mlxsw_sp *mlxsw_sp, u8 width,
const struct ethtool_link_ksettings *cmd)
{ … }
static void
mlxsw_sp1_reg_ptys_eth_pack(struct mlxsw_sp *mlxsw_sp, char *payload,
u16 local_port, u32 proto_admin, bool autoneg)
{ … }
static void
mlxsw_sp1_reg_ptys_eth_unpack(struct mlxsw_sp *mlxsw_sp, char *payload,
u32 *p_eth_proto_cap, u32 *p_eth_proto_admin,
u32 *p_eth_proto_oper)
{ … }
static u32 mlxsw_sp1_ptys_proto_cap_masked_get(u32 eth_proto_cap)
{ … }
const struct mlxsw_sp_port_type_speed_ops mlxsw_sp1_port_type_speed_ops = …;
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_sgmii_100m[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_SGMII_100M_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_1000base_x_sgmii[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_1000BASE_X_SGMII_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_5gbase_r[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_5GBASE_R_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_xfi_xaui_1_10g[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_XFI_XAUI_1_10G_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_xlaui_4_xlppi_4_40g[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_XLAUI_4_XLPPI_4_40G_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_25gaui_1_25gbase_cr_kr[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_25GAUI_1_25GBASE_CR_KR_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_50gaui_2_laui_2_50gbase_cr2_kr2[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_50GAUI_2_LAUI_2_50GBASE_CR2_KR2_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_50gaui_1_laui_1_50gbase_cr_kr[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_50GAUI_1_LAUI_1_50GBASE_CR_KR_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_caui_4_100gbase_cr4_kr4[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_CAUI_4_100GBASE_CR4_KR4_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_100gaui_2_100gbase_cr2_kr2[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_100GAUI_2_100GBASE_CR2_KR2_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_100gaui_1_100gbase_cr_kr[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_100GAUI_1_100GBASE_CR_KR_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_200gaui_4_200gbase_cr4_kr4[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_200GAUI_4_200GBASE_CR4_KR4_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_200gaui_2_200gbase_cr2_kr2[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_200GAUI_2_200GBASE_CR2_KR2_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_400gaui_8[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_400GAUI_8_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_400gaui_4_400gbase_cr4_kr4[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_400GAUI_4_400GBASE_CR4_KR4_LEN …
static const enum ethtool_link_mode_bit_indices
mlxsw_sp2_mask_ethtool_800gaui_8[] = …;
#define MLXSW_SP2_MASK_ETHTOOL_800GAUI_8_LEN …
#define MLXSW_SP_PORT_MASK_WIDTH_1X …
#define MLXSW_SP_PORT_MASK_WIDTH_2X …
#define MLXSW_SP_PORT_MASK_WIDTH_4X …
#define MLXSW_SP_PORT_MASK_WIDTH_8X …
static u8 mlxsw_sp_port_mask_width_get(u8 width)
{ … }
struct mlxsw_sp2_port_link_mode { … };
static const struct mlxsw_sp2_port_link_mode mlxsw_sp2_port_link_mode[] = …;
#define MLXSW_SP2_PORT_LINK_MODE_LEN …
static void
mlxsw_sp2_from_ptys_supported_port(struct mlxsw_sp *mlxsw_sp,
u32 ptys_eth_proto,
struct ethtool_link_ksettings *cmd)
{ … }
static void
mlxsw_sp2_set_bit_ethtool(const struct mlxsw_sp2_port_link_mode *link_mode,
unsigned long *mode)
{ … }
static void
mlxsw_sp2_from_ptys_link(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto,
unsigned long *mode)
{ … }
static u32
mlxsw_sp2_from_ptys_speed(struct mlxsw_sp *mlxsw_sp, u32 ptys_eth_proto)
{ … }
static void
mlxsw_sp2_from_ptys_link_mode(struct mlxsw_sp *mlxsw_sp, bool carrier_ok,
u32 ptys_eth_proto,
struct ethtool_link_ksettings *cmd)
{ … }
static int mlxsw_sp2_ptys_max_speed(struct mlxsw_sp_port *mlxsw_sp_port, u32 *p_max_speed)
{ … }
static bool
mlxsw_sp2_test_bit_ethtool(const struct mlxsw_sp2_port_link_mode *link_mode,
const unsigned long *mode)
{ … }
static u32
mlxsw_sp2_to_ptys_advert_link(struct mlxsw_sp *mlxsw_sp,
const struct ethtool_link_ksettings *cmd)
{ … }
static u32 mlxsw_sp2_to_ptys_speed_lanes(struct mlxsw_sp *mlxsw_sp, u8 width,
const struct ethtool_link_ksettings *cmd)
{ … }
static void
mlxsw_sp2_reg_ptys_eth_pack(struct mlxsw_sp *mlxsw_sp, char *payload,
u16 local_port, u32 proto_admin,
bool autoneg)
{ … }
static void
mlxsw_sp2_reg_ptys_eth_unpack(struct mlxsw_sp *mlxsw_sp, char *payload,
u32 *p_eth_proto_cap, u32 *p_eth_proto_admin,
u32 *p_eth_proto_oper)
{ … }
static u32 mlxsw_sp2_ptys_proto_cap_masked_get(u32 eth_proto_cap)
{ … }
const struct mlxsw_sp_port_type_speed_ops mlxsw_sp2_port_type_speed_ops = …;