#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/if_vlan.h>
#include <linux/ethtool.h>
#include <linux/vmalloc.h>
#include <linux/sfp.h>
#include "hinic_hw_qp.h"
#include "hinic_hw_dev.h"
#include "hinic_port.h"
#include "hinic_tx.h"
#include "hinic_rx.h"
#include "hinic_dev.h"
#define SET_LINK_STR_MAX_LEN …
#define GET_SUPPORTED_MODE …
#define GET_ADVERTISED_MODE …
#define ETHTOOL_ADD_SUPPORTED_SPEED_LINK_MODE(ecmd, mode) …
#define ETHTOOL_ADD_ADVERTISED_SPEED_LINK_MODE(ecmd, mode) …
#define ETHTOOL_ADD_SUPPORTED_LINK_MODE(ecmd, mode) …
#define ETHTOOL_ADD_ADVERTISED_LINK_MODE(ecmd, mode) …
#define COALESCE_PENDING_LIMIT_UNIT …
#define COALESCE_TIMER_CFG_UNIT …
#define COALESCE_ALL_QUEUE …
#define COALESCE_MAX_PENDING_LIMIT …
#define COALESCE_MAX_TIMER_CFG …
struct hw2ethtool_link_mode { … };
struct cmd_link_settings { … };
static u32 hw_to_ethtool_speed[LINK_SPEED_LEVELS] = …;
static struct hw2ethtool_link_mode
hw_to_ethtool_link_mode_table[HINIC_LINK_MODE_NUMBERS] = …;
#define LP_DEFAULT_TIME …
#define LP_PKT_LEN …
#define PORT_DOWN_ERR_IDX …
enum diag_test_index { … };
static void set_link_speed(struct ethtool_link_ksettings *link_ksettings,
enum hinic_speed speed)
{ … }
static int hinic_get_link_mode_index(enum hinic_link_mode link_mode)
{ … }
static void hinic_add_ethtool_link_mode(struct cmd_link_settings *link_settings,
enum hinic_link_mode hw_link_mode,
u32 name)
{ … }
static void hinic_link_port_type(struct cmd_link_settings *link_settings,
enum hinic_port_type port_type)
{ … }
static int hinic_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings
*link_ksettings)
{ … }
static int hinic_ethtool_to_hw_speed_level(u32 speed)
{ … }
static bool hinic_is_support_speed(enum hinic_link_mode supported_link,
u32 speed)
{ … }
static bool hinic_is_speed_legal(struct hinic_dev *nic_dev, u32 speed)
{ … }
static int get_link_settings_type(struct hinic_dev *nic_dev,
u8 autoneg, u32 speed, u32 *set_settings)
{ … }
static int set_link_settings_separate_cmd(struct hinic_dev *nic_dev,
u32 set_settings, u8 autoneg,
u32 speed)
{ … }
static int hinic_set_settings_to_hw(struct hinic_dev *nic_dev,
u32 set_settings, u8 autoneg, u32 speed)
{ … }
static int set_link_settings(struct net_device *netdev, u8 autoneg, u32 speed)
{ … }
static int hinic_set_link_ksettings(struct net_device *netdev, const struct
ethtool_link_ksettings *link_settings)
{ … }
static void hinic_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
{ … }
static void hinic_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{ … }
static int check_ringparam_valid(struct hinic_dev *nic_dev,
struct ethtool_ringparam *ring)
{ … }
static int hinic_set_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{ … }
static int __hinic_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coal, u16 queue)
{ … }
static int is_coalesce_exceed_limit(const struct ethtool_coalesce *coal)
{ … }
static int set_queue_coalesce(struct hinic_dev *nic_dev, u16 q_id,
struct hinic_intr_coal_info *coal,
bool set_rx_coal)
{ … }
static int __set_hw_coal_param(struct hinic_dev *nic_dev,
struct hinic_intr_coal_info *intr_coal,
u16 queue, bool set_rx_coal)
{ … }
static int __hinic_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coal, u16 queue)
{ … }
static int hinic_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coal,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static int hinic_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *coal,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static int hinic_get_per_queue_coalesce(struct net_device *netdev, u32 queue,
struct ethtool_coalesce *coal)
{ … }
static int hinic_set_per_queue_coalesce(struct net_device *netdev, u32 queue,
struct ethtool_coalesce *coal)
{ … }
static void hinic_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
{ … }
static int hinic_set_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
{ … }
static void hinic_get_channels(struct net_device *netdev,
struct ethtool_channels *channels)
{ … }
static int hinic_set_channels(struct net_device *netdev,
struct ethtool_channels *channels)
{ … }
static int hinic_get_rss_hash_opts(struct hinic_dev *nic_dev,
struct ethtool_rxnfc *cmd)
{ … }
static int set_l4_rss_hash_ops(struct ethtool_rxnfc *cmd,
struct hinic_rss_type *rss_type)
{ … }
static int hinic_set_rss_hash_opts(struct hinic_dev *nic_dev,
struct ethtool_rxnfc *cmd)
{ … }
static int __set_rss_rxfh(struct net_device *netdev,
const u32 *indir, const u8 *key)
{ … }
static int hinic_get_rxnfc(struct net_device *netdev,
struct ethtool_rxnfc *cmd, u32 *rule_locs)
{ … }
static int hinic_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
{ … }
static int hinic_get_rxfh(struct net_device *netdev,
struct ethtool_rxfh_param *rxfh)
{ … }
static int hinic_set_rxfh(struct net_device *netdev,
struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ … }
static u32 hinic_get_rxfh_key_size(struct net_device *netdev)
{ … }
static u32 hinic_get_rxfh_indir_size(struct net_device *netdev)
{ … }
#define HINIC_FUNC_STAT(_stat_item) …
static struct hinic_stats hinic_function_stats[] = …;
static char hinic_test_strings[][ETH_GSTRING_LEN] = …;
#define HINIC_PORT_STAT(_stat_item) …
static struct hinic_stats hinic_port_stats[] = …;
#define HINIC_TXQ_STAT(_stat_item) …
static struct hinic_stats hinic_tx_queue_stats[] = …;
#define HINIC_RXQ_STAT(_stat_item) …
static struct hinic_stats hinic_rx_queue_stats[] = …;
static void get_drv_queue_stats(struct hinic_dev *nic_dev, u64 *data)
{ … }
static void hinic_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{ … }
static int hinic_get_sset_count(struct net_device *netdev, int sset)
{ … }
static void hinic_get_strings(struct net_device *netdev,
u32 stringset, u8 *data)
{ … }
static int hinic_run_lp_test(struct hinic_dev *nic_dev, u32 test_time)
{ … }
static int do_lp_test(struct hinic_dev *nic_dev, u32 flags, u32 test_time,
enum diag_test_index *test_index)
{ … }
static void hinic_diag_test(struct net_device *netdev,
struct ethtool_test *eth_test, u64 *data)
{ … }
static int hinic_set_phys_id(struct net_device *netdev,
enum ethtool_phys_id_state state)
{ … }
static int hinic_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{ … }
static int hinic_get_module_eeprom(struct net_device *netdev,
struct ethtool_eeprom *ee, u8 *data)
{ … }
static int
hinic_get_link_ext_state(struct net_device *netdev,
struct ethtool_link_ext_state_info *link_ext_state_info)
{ … }
static const struct ethtool_ops hinic_ethtool_ops = …;
static const struct ethtool_ops hinicvf_ethtool_ops = …;
void hinic_set_ethtool_ops(struct net_device *netdev)
{ … }