| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | 
|---|
| 2 |  | 
|---|
| 3 | #ifndef _LINUX_ETHTOOL_NETLINK_H_ | 
|---|
| 4 | #define _LINUX_ETHTOOL_NETLINK_H_ | 
|---|
| 5 |  | 
|---|
| 6 | #include <uapi/linux/ethtool_netlink.h> | 
|---|
| 7 | #include <linux/ethtool.h> | 
|---|
| 8 | #include <linux/netdevice.h> | 
|---|
| 9 |  | 
|---|
| 10 | #define __ETHTOOL_LINK_MODE_MASK_NWORDS \ | 
|---|
| 11 | DIV_ROUND_UP(__ETHTOOL_LINK_MODE_MASK_NBITS, 32) | 
|---|
| 12 |  | 
|---|
| 13 | #define ETHTOOL_PAUSE_STAT_CNT	(__ETHTOOL_A_PAUSE_STAT_CNT -		\ | 
|---|
| 14 | ETHTOOL_A_PAUSE_STAT_TX_FRAMES) | 
|---|
| 15 |  | 
|---|
| 16 | enum ethtool_multicast_groups { | 
|---|
| 17 | ETHNL_MCGRP_MONITOR, | 
|---|
| 18 | }; | 
|---|
| 19 |  | 
|---|
| 20 | struct phy_device; | 
|---|
| 21 |  | 
|---|
| 22 | #if IS_ENABLED(CONFIG_ETHTOOL_NETLINK) | 
|---|
| 23 | int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd); | 
|---|
| 24 | void ethnl_cable_test_free(struct phy_device *phydev); | 
|---|
| 25 | void ethnl_cable_test_finished(struct phy_device *phydev); | 
|---|
| 26 | int ethnl_cable_test_result_with_src(struct phy_device *phydev, u8 pair, | 
|---|
| 27 | u8 result, u32 src); | 
|---|
| 28 | int ethnl_cable_test_fault_length_with_src(struct phy_device *phydev, u8 pair, | 
|---|
| 29 | u32 cm, u32 src); | 
|---|
| 30 | int ethnl_cable_test_amplitude(struct phy_device *phydev, u8 pair, s16 mV); | 
|---|
| 31 | int ethnl_cable_test_pulse(struct phy_device *phydev, u16 mV); | 
|---|
| 32 | int ethnl_cable_test_step(struct phy_device *phydev, u32 first, u32 last, | 
|---|
| 33 | u32 step); | 
|---|
| 34 | void ethtool_aggregate_mac_stats(struct net_device *dev, | 
|---|
| 35 | struct ethtool_eth_mac_stats *mac_stats); | 
|---|
| 36 | void ethtool_aggregate_phy_stats(struct net_device *dev, | 
|---|
| 37 | struct ethtool_eth_phy_stats *phy_stats); | 
|---|
| 38 | void ethtool_aggregate_ctrl_stats(struct net_device *dev, | 
|---|
| 39 | struct ethtool_eth_ctrl_stats *ctrl_stats); | 
|---|
| 40 | void ethtool_aggregate_pause_stats(struct net_device *dev, | 
|---|
| 41 | struct ethtool_pause_stats *pause_stats); | 
|---|
| 42 | void ethtool_aggregate_rmon_stats(struct net_device *dev, | 
|---|
| 43 | struct ethtool_rmon_stats *rmon_stats); | 
|---|
| 44 | bool ethtool_dev_mm_supported(struct net_device *dev); | 
|---|
| 45 |  | 
|---|
| 46 | void ethnl_pse_send_ntf(struct net_device *netdev, unsigned long notif); | 
|---|
| 47 |  | 
|---|
| 48 | #else | 
|---|
| 49 | static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd) | 
|---|
| 50 | { | 
|---|
| 51 | return -EOPNOTSUPP; | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | static inline void ethnl_cable_test_free(struct phy_device *phydev) | 
|---|
| 55 | { | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | static inline void ethnl_cable_test_finished(struct phy_device *phydev) | 
|---|
| 59 | { | 
|---|
| 60 | } | 
|---|
| 61 | static inline int ethnl_cable_test_result_with_src(struct phy_device *phydev, | 
|---|
| 62 | u8 pair, u8 result, u32 src) | 
|---|
| 63 | { | 
|---|
| 64 | return -EOPNOTSUPP; | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | static inline int ethnl_cable_test_fault_length_with_src(struct phy_device *phydev, | 
|---|
| 68 | u8 pair, u32 cm, u32 src) | 
|---|
| 69 | { | 
|---|
| 70 | return -EOPNOTSUPP; | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 | static inline int ethnl_cable_test_amplitude(struct phy_device *phydev, | 
|---|
| 74 | u8 pair, s16 mV) | 
|---|
| 75 | { | 
|---|
| 76 | return -EOPNOTSUPP; | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | static inline int ethnl_cable_test_pulse(struct phy_device *phydev, u16 mV) | 
|---|
| 80 | { | 
|---|
| 81 | return -EOPNOTSUPP; | 
|---|
| 82 | } | 
|---|
| 83 |  | 
|---|
| 84 | static inline int ethnl_cable_test_step(struct phy_device *phydev, u32 first, | 
|---|
| 85 | u32 last, u32 step) | 
|---|
| 86 | { | 
|---|
| 87 | return -EOPNOTSUPP; | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | static inline void | 
|---|
| 91 | ethtool_aggregate_mac_stats(struct net_device *dev, | 
|---|
| 92 | struct ethtool_eth_mac_stats *mac_stats) | 
|---|
| 93 | { | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 | static inline void | 
|---|
| 97 | ethtool_aggregate_phy_stats(struct net_device *dev, | 
|---|
| 98 | struct ethtool_eth_phy_stats *phy_stats) | 
|---|
| 99 | { | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | static inline void | 
|---|
| 103 | ethtool_aggregate_ctrl_stats(struct net_device *dev, | 
|---|
| 104 | struct ethtool_eth_ctrl_stats *ctrl_stats) | 
|---|
| 105 | { | 
|---|
| 106 | } | 
|---|
| 107 |  | 
|---|
| 108 | static inline void | 
|---|
| 109 | ethtool_aggregate_pause_stats(struct net_device *dev, | 
|---|
| 110 | struct ethtool_pause_stats *pause_stats) | 
|---|
| 111 | { | 
|---|
| 112 | } | 
|---|
| 113 |  | 
|---|
| 114 | static inline void | 
|---|
| 115 | ethtool_aggregate_rmon_stats(struct net_device *dev, | 
|---|
| 116 | struct ethtool_rmon_stats *rmon_stats) | 
|---|
| 117 | { | 
|---|
| 118 | } | 
|---|
| 119 |  | 
|---|
| 120 | static inline bool ethtool_dev_mm_supported(struct net_device *dev) | 
|---|
| 121 | { | 
|---|
| 122 | return false; | 
|---|
| 123 | } | 
|---|
| 124 |  | 
|---|
| 125 | static inline void ethnl_pse_send_ntf(struct net_device *netdev, | 
|---|
| 126 | unsigned long notif) | 
|---|
| 127 | { | 
|---|
| 128 | } | 
|---|
| 129 |  | 
|---|
| 130 | #endif /* IS_ENABLED(CONFIG_ETHTOOL_NETLINK) */ | 
|---|
| 131 |  | 
|---|
| 132 | static inline int ethnl_cable_test_result(struct phy_device *phydev, u8 pair, | 
|---|
| 133 | u8 result) | 
|---|
| 134 | { | 
|---|
| 135 | return ethnl_cable_test_result_with_src(phydev, pair, result, | 
|---|
| 136 | src: ETHTOOL_A_CABLE_INF_SRC_TDR); | 
|---|
| 137 | } | 
|---|
| 138 |  | 
|---|
| 139 | static inline int ethnl_cable_test_fault_length(struct phy_device *phydev, | 
|---|
| 140 | u8 pair, u32 cm) | 
|---|
| 141 | { | 
|---|
| 142 | return ethnl_cable_test_fault_length_with_src(phydev, pair, cm, | 
|---|
| 143 | src: ETHTOOL_A_CABLE_INF_SRC_TDR); | 
|---|
| 144 | } | 
|---|
| 145 |  | 
|---|
| 146 | #endif /* _LINUX_ETHTOOL_NETLINK_H_ */ | 
|---|
| 147 |  | 
|---|