1d44e1310SMichal Kubecek /* SPDX-License-Identifier: GPL-2.0-only */ 2d44e1310SMichal Kubecek 3d44e1310SMichal Kubecek #ifndef _ETHTOOL_COMMON_H 4d44e1310SMichal Kubecek #define _ETHTOOL_COMMON_H 5d44e1310SMichal Kubecek 63d2b847fSMichal Kubecek #include <linux/netdevice.h> 7d44e1310SMichal Kubecek #include <linux/ethtool.h> 8d44e1310SMichal Kubecek 90524399dSMichal Kubecek #define ETHTOOL_DEV_FEATURE_WORDS DIV_ROUND_UP(NETDEV_FEATURE_COUNT, 32) 100524399dSMichal Kubecek 11428c122fSMichal Kubecek /* compose link mode index from speed, type and duplex */ 12428c122fSMichal Kubecek #define ETHTOOL_LINK_MODE(speed, type, duplex) \ 13428c122fSMichal Kubecek ETHTOOL_LINK_MODE_ ## speed ## base ## type ## _ ## duplex ## _BIT 14428c122fSMichal Kubecek 15f76510b4SMichal Kubecek #define __SOF_TIMESTAMPING_CNT (const_ilog2(SOF_TIMESTAMPING_LAST) + 1) 166a774228SKory Maincent #define __HWTSTAMP_FLAG_CNT (const_ilog2(HWTSTAMP_FLAG_LAST) + 1) 17f76510b4SMichal Kubecek 18916b7d31SMina Almasry struct genl_info; 19b9e3f7dcSKory Maincent struct hwtstamp_provider_desc; 20916b7d31SMina Almasry 21d44e1310SMichal Kubecek extern const char 22d44e1310SMichal Kubecek netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]; 23d44e1310SMichal Kubecek extern const char 24d44e1310SMichal Kubecek rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN]; 25d44e1310SMichal Kubecek extern const char 26d44e1310SMichal Kubecek tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN]; 27d44e1310SMichal Kubecek extern const char 28d44e1310SMichal Kubecek phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN]; 29428c122fSMichal Kubecek extern const char link_mode_names[][ETH_GSTRING_LEN]; 306a94b8ccSMichal Kubecek extern const char netif_msg_class_names[][ETH_GSTRING_LEN]; 3151ea22b0SMichal Kubecek extern const char wol_mode_names[][ETH_GSTRING_LEN]; 32f76510b4SMichal Kubecek extern const char sof_timestamping_names[][ETH_GSTRING_LEN]; 33f76510b4SMichal Kubecek extern const char ts_tx_type_names[][ETH_GSTRING_LEN]; 34f76510b4SMichal Kubecek extern const char ts_rx_filter_names[][ETH_GSTRING_LEN]; 356a774228SKory Maincent extern const char ts_flags_names[][ETH_GSTRING_LEN]; 36c7d759ebSJakub Kicinski extern const char udp_tunnel_type_names[][ETH_GSTRING_LEN]; 37d44e1310SMichal Kubecek 383d2b847fSMichal Kubecek int __ethtool_get_link(struct net_device *dev); 393d2b847fSMichal Kubecek 40459e0b81SMichal Kubecek bool convert_legacy_settings_to_link_ksettings( 41459e0b81SMichal Kubecek struct ethtool_link_ksettings *link_ksettings, 42459e0b81SMichal Kubecek const struct ethtool_cmd *legacy_settings); 43916b7d31SMina Almasry int ethtool_check_max_channel(struct net_device *dev, 44916b7d31SMina Almasry struct ethtool_channels channels, 45916b7d31SMina Almasry struct genl_info *info); 4642dc431fSDaniel Zahka int ethtool_check_rss_ctx_busy(struct net_device *dev, u32 rss_context); 47*db10fde5SJakub Kicinski 48*db10fde5SJakub Kicinski void ethtool_ringparam_get_cfg(struct net_device *dev, 49*db10fde5SJakub Kicinski struct ethtool_ringparam *param, 50*db10fde5SJakub Kicinski struct kernel_ethtool_ringparam *kparam, 51*db10fde5SJakub Kicinski struct netlink_ext_ack *extack); 52*db10fde5SJakub Kicinski 532111375bSKory Maincent int __ethtool_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *info); 54b9e3f7dcSKory Maincent int ethtool_get_ts_info_by_phc(struct net_device *dev, 55b9e3f7dcSKory Maincent struct kernel_ethtool_ts_info *info, 56b9e3f7dcSKory Maincent struct hwtstamp_provider_desc *hwprov_desc); 57b9e3f7dcSKory Maincent int ethtool_net_get_ts_info_by_phc(struct net_device *dev, 58b9e3f7dcSKory Maincent struct kernel_ethtool_ts_info *info, 59b9e3f7dcSKory Maincent struct hwtstamp_provider_desc *hwprov_desc); 606e9e2eedSKory Maincent struct phy_device * 61b9e3f7dcSKory Maincent ethtool_phy_get_ts_info_by_phc(struct net_device *dev, 62b9e3f7dcSKory Maincent struct kernel_ethtool_ts_info *info, 63b9e3f7dcSKory Maincent struct hwtstamp_provider_desc *hwprov_desc); 64b9e3f7dcSKory Maincent bool net_support_hwtstamp_qualifier(struct net_device *dev, 65b9e3f7dcSKory Maincent enum hwtstamp_provider_qualifier qualifier); 66459e0b81SMichal Kubecek 674895d780SFlorian Fainelli extern const struct ethtool_phy_ops *ethtool_phy_ops; 6818ff0bcdSOleksij Rempel extern const struct ethtool_pse_ops *ethtool_pse_ops; 694895d780SFlorian Fainelli 7095dfc7efSAndrew Lunn int ethtool_get_module_info_call(struct net_device *dev, 7195dfc7efSAndrew Lunn struct ethtool_modinfo *modinfo); 7295dfc7efSAndrew Lunn int ethtool_get_module_eeprom_call(struct net_device *dev, 7395dfc7efSAndrew Lunn struct ethtool_eeprom *ee, u8 *data); 7495dfc7efSAndrew Lunn 7504692c90SVladimir Oltean bool __ethtool_dev_mm_supported(struct net_device *dev); 7604692c90SVladimir Oltean 77d44e1310SMichal Kubecek #endif /* _ETHTOOL_COMMON_H */ 78