common.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef _ETHTOOL_COMMON_H
  3. #define _ETHTOOL_COMMON_H
  4. #include <linux/netdevice.h>
  5. #include <linux/ethtool.h>
  6. #define ETHTOOL_DEV_FEATURE_WORDS DIV_ROUND_UP(NETDEV_FEATURE_COUNT, 32)
  7. /* compose link mode index from speed, type and duplex */
  8. #define ETHTOOL_LINK_MODE(speed, type, duplex) \
  9. ETHTOOL_LINK_MODE_ ## speed ## base ## type ## _ ## duplex ## _BIT
  10. #define __SOF_TIMESTAMPING_CNT (const_ilog2(SOF_TIMESTAMPING_LAST) + 1)
  11. #define __HWTSTAMP_FLAG_CNT (const_ilog2(HWTSTAMP_FLAG_LAST) + 1)
  12. struct genl_info;
  13. struct hwtstamp_provider_desc;
  14. extern const char
  15. netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN];
  16. extern const char
  17. rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN];
  18. extern const char
  19. tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN];
  20. extern const char
  21. phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN];
  22. extern const char link_mode_names[][ETH_GSTRING_LEN];
  23. extern const char netif_msg_class_names[][ETH_GSTRING_LEN];
  24. extern const char wol_mode_names[][ETH_GSTRING_LEN];
  25. extern const char sof_timestamping_names[][ETH_GSTRING_LEN];
  26. extern const char ts_tx_type_names[][ETH_GSTRING_LEN];
  27. extern const char ts_rx_filter_names[][ETH_GSTRING_LEN];
  28. extern const char ts_flags_names[][ETH_GSTRING_LEN];
  29. extern const char udp_tunnel_type_names[][ETH_GSTRING_LEN];
  30. int __ethtool_get_link(struct net_device *dev);
  31. bool convert_legacy_settings_to_link_ksettings(
  32. struct ethtool_link_ksettings *link_ksettings,
  33. const struct ethtool_cmd *legacy_settings);
  34. int ethtool_check_max_channel(struct net_device *dev,
  35. struct ethtool_channels channels,
  36. struct genl_info *info);
  37. struct ethtool_rxfh_context *
  38. ethtool_rxfh_ctx_alloc(const struct ethtool_ops *ops,
  39. u32 indir_size, u32 key_size);
  40. int ethtool_check_rss_ctx_busy(struct net_device *dev, u32 rss_context);
  41. int ethtool_rxfh_config_is_sym(u64 rxfh);
  42. void ethtool_ringparam_get_cfg(struct net_device *dev,
  43. struct ethtool_ringparam *param,
  44. struct kernel_ethtool_ringparam *kparam,
  45. struct netlink_ext_ack *extack);
  46. int ethtool_get_rx_ring_count(struct net_device *dev);
  47. int __ethtool_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *info);
  48. int ethtool_get_ts_info_by_phc(struct net_device *dev,
  49. struct kernel_ethtool_ts_info *info,
  50. struct hwtstamp_provider_desc *hwprov_desc);
  51. int ethtool_net_get_ts_info_by_phc(struct net_device *dev,
  52. struct kernel_ethtool_ts_info *info,
  53. struct hwtstamp_provider_desc *hwprov_desc);
  54. struct phy_device *
  55. ethtool_phy_get_ts_info_by_phc(struct net_device *dev,
  56. struct kernel_ethtool_ts_info *info,
  57. struct hwtstamp_provider_desc *hwprov_desc);
  58. bool net_support_hwtstamp_qualifier(struct net_device *dev,
  59. enum hwtstamp_provider_qualifier qualifier);
  60. extern const struct ethtool_phy_ops *ethtool_phy_ops;
  61. extern const struct ethtool_pse_ops *ethtool_pse_ops;
  62. int ethtool_get_module_info_call(struct net_device *dev,
  63. struct ethtool_modinfo *modinfo);
  64. int ethtool_get_module_eeprom_call(struct net_device *dev,
  65. struct ethtool_eeprom *ee, u8 *data);
  66. bool __ethtool_dev_mm_supported(struct net_device *dev);
  67. #if IS_ENABLED(CONFIG_ETHTOOL_NETLINK)
  68. void ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context);
  69. #else
  70. static inline void
  71. ethtool_rss_notify(struct net_device *dev, u32 type, u32 rss_context)
  72. {
  73. }
  74. #endif
  75. #endif /* _ETHTOOL_COMMON_H */