项目场景:
网卡驱动
问题描述
遇到的问题:/home/Desktop/tq_ethtool.c:96:3: error: 'const struct ethtool_ops' has no member named 'get_settings'; did you mean 'get_strings'? | 96 | .get_settings = tqeth_get_settings, | | ^~~~~~~~~~~~ | | get_strings
内核版本差异
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)
static const struct ethtool_ops rtl8168_ethtool_ops = {
.get_drvinfo = rtl8168_get_drvinfo,
.get_regs_len = rtl8168_get_regs_len,
.get_link = ethtool_op_get_link,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
.get_settings = rtl8168_get_settings,
.set_settings = rtl8168_set_settings,
#else
.get_link_ksettings = rtl8168_get_settings,
.set_link_ksettings = rtl8168_set_settings,
#endif
.get_msglevel = rtl8168_get_msglevel,
.set_msglevel = rtl8168_set_msglevel,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
.get_rx_csum = rtl8168_get_rx_csum,
.set_rx_csum = rtl8168_set_rx_csum,
.get_tx_csum = rtl8168_get_tx_csum,
.set_tx_csum = rtl8168_set_tx_csum,
.get_sg = ethtool_op_get_sg,
.set_sg = ethtool_op_set_sg,
#ifdef NETIF_F_TSO
.get_tso = ethtool_op_get_tso,
.set_tso = ethtool_op_set_tso,
#endif
#endif
.get_regs = rtl8168_get_regs,
.get_wol = rtl8168_get_wol,
.set_wol = rtl8168_set_wol,
.get_strings = rtl8168_get_strings,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
.get_stats_count = rtl8168_get_stats_count,
#else
.get_sset_count = rtl8168_get_sset_count,
#endif
.get_ethtool_stats = rtl8168_get_ethtool_stats,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
#ifdef ETHTOOL_GPERMADDR
.get_perm_addr = ethtool_op_get_perm_addr,
#endif
#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
.get_eeprom = rtl_get_eeprom,
.get_eeprom_len = rtl_get_eeprom_len,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
.get_ts_info = ethtool_op_get_ts_info,
#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
.get_eee = rtl_ethtool_get_eee,
.set_eee = rtl_ethtool_set_eee,
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) */
.nway_reset = rtl_nway_reset,
};
#endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22)