at master 4.0 kB view raw
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 16enum ethtool_multicast_groups { 17 ETHNL_MCGRP_MONITOR, 18}; 19 20struct phy_device; 21 22#if IS_ENABLED(CONFIG_ETHTOOL_NETLINK) 23int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd); 24void ethnl_cable_test_free(struct phy_device *phydev); 25void ethnl_cable_test_finished(struct phy_device *phydev); 26int ethnl_cable_test_result_with_src(struct phy_device *phydev, u8 pair, 27 u8 result, u32 src); 28int ethnl_cable_test_fault_length_with_src(struct phy_device *phydev, u8 pair, 29 u32 cm, u32 src); 30int ethnl_cable_test_amplitude(struct phy_device *phydev, u8 pair, s16 mV); 31int ethnl_cable_test_pulse(struct phy_device *phydev, u16 mV); 32int ethnl_cable_test_step(struct phy_device *phydev, u32 first, u32 last, 33 u32 step); 34void ethtool_aggregate_mac_stats(struct net_device *dev, 35 struct ethtool_eth_mac_stats *mac_stats); 36void ethtool_aggregate_phy_stats(struct net_device *dev, 37 struct ethtool_eth_phy_stats *phy_stats); 38void ethtool_aggregate_ctrl_stats(struct net_device *dev, 39 struct ethtool_eth_ctrl_stats *ctrl_stats); 40void ethtool_aggregate_pause_stats(struct net_device *dev, 41 struct ethtool_pause_stats *pause_stats); 42void ethtool_aggregate_rmon_stats(struct net_device *dev, 43 struct ethtool_rmon_stats *rmon_stats); 44bool ethtool_dev_mm_supported(struct net_device *dev); 45 46void ethnl_pse_send_ntf(struct net_device *netdev, unsigned long notif); 47 48#else 49static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd) 50{ 51 return -EOPNOTSUPP; 52} 53 54static inline void ethnl_cable_test_free(struct phy_device *phydev) 55{ 56} 57 58static inline void ethnl_cable_test_finished(struct phy_device *phydev) 59{ 60} 61static 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 67static 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 73static inline int ethnl_cable_test_amplitude(struct phy_device *phydev, 74 u8 pair, s16 mV) 75{ 76 return -EOPNOTSUPP; 77} 78 79static inline int ethnl_cable_test_pulse(struct phy_device *phydev, u16 mV) 80{ 81 return -EOPNOTSUPP; 82} 83 84static inline int ethnl_cable_test_step(struct phy_device *phydev, u32 first, 85 u32 last, u32 step) 86{ 87 return -EOPNOTSUPP; 88} 89 90static inline void 91ethtool_aggregate_mac_stats(struct net_device *dev, 92 struct ethtool_eth_mac_stats *mac_stats) 93{ 94} 95 96static inline void 97ethtool_aggregate_phy_stats(struct net_device *dev, 98 struct ethtool_eth_phy_stats *phy_stats) 99{ 100} 101 102static inline void 103ethtool_aggregate_ctrl_stats(struct net_device *dev, 104 struct ethtool_eth_ctrl_stats *ctrl_stats) 105{ 106} 107 108static inline void 109ethtool_aggregate_pause_stats(struct net_device *dev, 110 struct ethtool_pause_stats *pause_stats) 111{ 112} 113 114static inline void 115ethtool_aggregate_rmon_stats(struct net_device *dev, 116 struct ethtool_rmon_stats *rmon_stats) 117{ 118} 119 120static inline bool ethtool_dev_mm_supported(struct net_device *dev) 121{ 122 return false; 123} 124 125static 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 132static 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 ETHTOOL_A_CABLE_INF_SRC_TDR); 137} 138 139static 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 ETHTOOL_A_CABLE_INF_SRC_TDR); 144} 145 146#endif /* _LINUX_ETHTOOL_NETLINK_H_ */