#include <linux/etherdevice.h>
#include <linux/string.h>
#include <linux/phy.h>
#include <linux/sfp.h>
#include "hns3_enet.h"
#include "hns3_ethtool.h"
#define HNS3_TQP_STAT(_string, _member) …
static const struct hns3_stats hns3_txq_stats[] = …;
#define HNS3_TXQ_STATS_COUNT …
static const struct hns3_stats hns3_rxq_stats[] = …;
#define HNS3_PRIV_FLAGS_LEN …
#define HNS3_RXQ_STATS_COUNT …
#define HNS3_TQP_STATS_COUNT …
#define HNS3_NIC_LB_TEST_PKT_NUM …
#define HNS3_NIC_LB_TEST_RING_ID …
#define HNS3_NIC_LB_TEST_PACKET_SIZE …
#define HNS3_NIC_LB_SETUP_USEC …
#define HNS3_NIC_LB_TEST_NO_MEM_ERR …
#define HNS3_NIC_LB_TEST_TX_CNT_ERR …
#define HNS3_NIC_LB_TEST_RX_CNT_ERR …
#define HNS3_NIC_LB_TEST_UNEXECUTED …
static int hns3_get_sset_count(struct net_device *netdev, int stringset);
static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en)
{ … }
static int hns3_lp_up(struct net_device *ndev, enum hnae3_loop loop_mode)
{ … }
static int hns3_lp_down(struct net_device *ndev, enum hnae3_loop loop_mode)
{ … }
static void hns3_lp_setup_skb(struct sk_buff *skb)
{ … }
static void hns3_lb_check_skb_data(struct hns3_enet_ring *ring,
struct sk_buff *skb)
{ … }
static u32 hns3_lb_check_rx_ring(struct hns3_nic_priv *priv, u32 budget)
{ … }
static void hns3_lb_clear_tx_ring(struct hns3_nic_priv *priv, u32 start_ringid,
u32 end_ringid)
{ … }
static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode)
{ … }
static void hns3_set_selftest_param(struct hnae3_handle *h, int (*st_param)[2])
{ … }
static void hns3_selftest_prepare(struct net_device *ndev, bool if_running)
{ … }
static void hns3_selftest_restore(struct net_device *ndev, bool if_running)
{ … }
static void hns3_do_selftest(struct net_device *ndev, int (*st_param)[2],
struct ethtool_test *eth_test, u64 *data)
{ … }
static void hns3_do_external_lb(struct net_device *ndev,
struct ethtool_test *eth_test, u64 *data)
{ … }
static void hns3_self_test(struct net_device *ndev,
struct ethtool_test *eth_test, u64 *data)
{ … }
static void hns3_update_limit_promisc_mode(struct net_device *netdev,
bool enable)
{ … }
static const struct hns3_pflag_desc hns3_priv_flags[HNAE3_PFLAG_MAX] = …;
static int hns3_get_sset_count(struct net_device *netdev, int stringset)
{ … }
static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
u32 stat_count, u32 num_tqps, const char *prefix)
{ … }
static u8 *hns3_get_strings_tqps(struct hnae3_handle *handle, u8 *data)
{ … }
static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
{ … }
static u64 *hns3_get_stats_tqps(struct hnae3_handle *handle, u64 *data)
{ … }
static void hns3_get_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{ … }
static void hns3_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{ … }
static u32 hns3_get_link(struct net_device *netdev)
{ … }
static void hns3_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *param,
struct kernel_ethtool_ringparam *kernel_param,
struct netlink_ext_ack *extack)
{ … }
static void hns3_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *param)
{ … }
static int hns3_set_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *param)
{ … }
static void hns3_get_ksettings(struct hnae3_handle *h,
struct ethtool_link_ksettings *cmd)
{ … }
static int hns3_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{ … }
static int hns3_check_ksettings_param(const struct net_device *netdev,
const struct ethtool_link_ksettings *cmd)
{ … }
static int hns3_set_link_ksettings(struct net_device *netdev,
const struct ethtool_link_ksettings *cmd)
{ … }
static u32 hns3_get_rss_key_size(struct net_device *netdev)
{ … }
static u32 hns3_get_rss_indir_size(struct net_device *netdev)
{ … }
static int hns3_get_rss(struct net_device *netdev,
struct ethtool_rxfh_param *rxfh)
{ … }
static int hns3_set_rss(struct net_device *netdev,
struct ethtool_rxfh_param *rxfh,
struct netlink_ext_ack *extack)
{ … }
static int hns3_get_rxnfc(struct net_device *netdev,
struct ethtool_rxnfc *cmd,
u32 *rule_locs)
{ … }
static const struct hns3_reset_type_map hns3_reset_type[] = …;
static const struct hns3_reset_type_map hns3vf_reset_type[] = …;
static int hns3_set_reset(struct net_device *netdev, u32 *flags)
{ … }
static void hns3_change_all_ring_bd_num(struct hns3_nic_priv *priv,
u32 tx_desc_num, u32 rx_desc_num)
{ … }
static struct hns3_enet_ring *hns3_backup_ringparam(struct hns3_nic_priv *priv)
{ … }
static int hns3_check_ringparam(struct net_device *ndev,
struct ethtool_ringparam *param,
struct kernel_ethtool_ringparam *kernel_param)
{ … }
static bool
hns3_is_ringparam_changed(struct net_device *ndev,
struct ethtool_ringparam *param,
struct kernel_ethtool_ringparam *kernel_param,
struct hns3_ring_param *old_ringparam,
struct hns3_ring_param *new_ringparam)
{ … }
static int hns3_change_rx_buf_len(struct net_device *ndev, u32 rx_buf_len)
{ … }
static int hns3_set_tx_push(struct net_device *netdev, u32 tx_push)
{ … }
static int hns3_set_ringparam(struct net_device *ndev,
struct ethtool_ringparam *param,
struct kernel_ethtool_ringparam *kernel_param,
struct netlink_ext_ack *extack)
{ … }
static int hns3_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
{ … }
static int hns3_nway_reset(struct net_device *netdev)
{ … }
static void hns3_get_channels(struct net_device *netdev,
struct ethtool_channels *ch)
{ … }
static int hns3_get_coalesce(struct net_device *netdev,
struct ethtool_coalesce *cmd,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static int hns3_check_gl_coalesce_para(struct net_device *netdev,
struct ethtool_coalesce *cmd)
{ … }
static int hns3_check_rl_coalesce_para(struct net_device *netdev,
struct ethtool_coalesce *cmd)
{ … }
static int hns3_check_ql_coalesce_param(struct net_device *netdev,
struct ethtool_coalesce *cmd)
{ … }
static int
hns3_check_cqe_coalesce_param(struct net_device *netdev,
struct kernel_ethtool_coalesce *kernel_coal)
{ … }
static int
hns3_check_coalesce_para(struct net_device *netdev,
struct ethtool_coalesce *cmd,
struct kernel_ethtool_coalesce *kernel_coal)
{ … }
static void hns3_set_coalesce_per_queue(struct net_device *netdev,
struct ethtool_coalesce *cmd,
u32 queue)
{ … }
static int hns3_set_coalesce(struct net_device *netdev,
struct ethtool_coalesce *cmd,
struct kernel_ethtool_coalesce *kernel_coal,
struct netlink_ext_ack *extack)
{ … }
static int hns3_get_regs_len(struct net_device *netdev)
{ … }
static void hns3_get_regs(struct net_device *netdev,
struct ethtool_regs *cmd, void *data)
{ … }
static int hns3_set_phys_id(struct net_device *netdev,
enum ethtool_phys_id_state state)
{ … }
static u32 hns3_get_msglevel(struct net_device *netdev)
{ … }
static void hns3_set_msglevel(struct net_device *netdev, u32 msg_level)
{ … }
static void hns3_get_fec_stats(struct net_device *netdev,
struct ethtool_fec_stats *fec_stats)
{ … }
static unsigned int loc_to_eth_fec(u8 loc_fec)
{ … }
static unsigned int eth_to_loc_fec(unsigned int eth_fec)
{ … }
static int hns3_get_fecparam(struct net_device *netdev,
struct ethtool_fecparam *fec)
{ … }
static int hns3_set_fecparam(struct net_device *netdev,
struct ethtool_fecparam *fec)
{ … }
static int hns3_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{ … }
static int hns3_get_module_eeprom(struct net_device *netdev,
struct ethtool_eeprom *ee, u8 *data)
{ … }
static u32 hns3_get_priv_flags(struct net_device *netdev)
{ … }
static int hns3_check_priv_flags(struct hnae3_handle *h, u32 changed)
{ … }
static int hns3_set_priv_flags(struct net_device *netdev, u32 pflags)
{ … }
static int hns3_get_tunable(struct net_device *netdev,
const struct ethtool_tunable *tuna,
void *data)
{ … }
static int hns3_set_tx_spare_buf_size(struct net_device *netdev,
u32 data)
{ … }
static int hns3_set_tunable(struct net_device *netdev,
const struct ethtool_tunable *tuna,
const void *data)
{ … }
#define HNS3_ETHTOOL_COALESCE …
#define HNS3_ETHTOOL_RING …
static int hns3_get_ts_info(struct net_device *netdev,
struct kernel_ethtool_ts_info *info)
{ … }
static const struct hns3_ethtool_link_ext_state_mapping
hns3_link_ext_state_map[] = …;
static int hns3_get_link_ext_state(struct net_device *netdev,
struct ethtool_link_ext_state_info *info)
{ … }
static void hns3_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
{ … }
static int hns3_set_wol(struct net_device *netdev,
struct ethtool_wolinfo *wol)
{ … }
static const struct ethtool_ops hns3vf_ethtool_ops = …;
static const struct ethtool_ops hns3_ethtool_ops = …;
void hns3_ethtool_set_ops(struct net_device *netdev)
{ … }