Merge tag 'nfsd-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
[linux-2.6-block.git] / include / linux / ethtool_netlink.h
CommitLineData
2b4a8990
MK
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>
6b08d6c1
MK
8#include <linux/netdevice.h>
9
f625aa9b
MK
10#define __ETHTOOL_LINK_MODE_MASK_NWORDS \
11 DIV_ROUND_UP(__ETHTOOL_LINK_MODE_MASK_NBITS, 32)
12
1aabe578
JK
13#define ETHTOOL_PAUSE_STAT_CNT (__ETHTOOL_A_PAUSE_STAT_CNT - \
14 ETHTOOL_A_PAUSE_STAT_TX_FRAMES)
15
6b08d6c1
MK
16enum ethtool_multicast_groups {
17 ETHNL_MCGRP_MONITOR,
18};
2b4a8990 19
1dd3f212
AL
20struct phy_device;
21
22#if IS_ENABLED(CONFIG_ETHTOOL_NETLINK)
1a644de2 23int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd);
1dd3f212
AL
24void ethnl_cable_test_free(struct phy_device *phydev);
25void ethnl_cable_test_finished(struct phy_device *phydev);
4715d87e
OR
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);
6b4a0fc1
AL
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);
9179f5fe
VO
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);
d54151aa 44bool ethtool_dev_mm_supported(struct net_device *dev);
9179f5fe 45
1dd3f212 46#else
1a644de2 47static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd)
1dd3f212 48{
1e2dc145 49 return -EOPNOTSUPP;
1dd3f212
AL
50}
51
52static inline void ethnl_cable_test_free(struct phy_device *phydev)
53{
54}
55
56static inline void ethnl_cable_test_finished(struct phy_device *phydev)
57{
58}
4715d87e
OR
59static inline int ethnl_cable_test_result_with_src(struct phy_device *phydev,
60 u8 pair, u8 result, u32 src)
1e2dc145
AL
61{
62 return -EOPNOTSUPP;
63}
64
4715d87e
OR
65static inline int ethnl_cable_test_fault_length_with_src(struct phy_device *phydev,
66 u8 pair, u32 cm, u32 src)
1e2dc145
AL
67{
68 return -EOPNOTSUPP;
69}
6b4a0fc1
AL
70
71static inline int ethnl_cable_test_amplitude(struct phy_device *phydev,
72 u8 pair, s16 mV)
73{
74 return -EOPNOTSUPP;
75}
76
77static inline int ethnl_cable_test_pulse(struct phy_device *phydev, u16 mV)
78{
79 return -EOPNOTSUPP;
80}
81
82static inline int ethnl_cable_test_step(struct phy_device *phydev, u32 first,
83 u32 last, u32 step)
84{
85 return -EOPNOTSUPP;
86}
9179f5fe
VO
87
88static inline void
89ethtool_aggregate_mac_stats(struct net_device *dev,
90 struct ethtool_eth_mac_stats *mac_stats)
91{
92}
93
94static inline void
95ethtool_aggregate_phy_stats(struct net_device *dev,
96 struct ethtool_eth_phy_stats *phy_stats)
97{
98}
99
100static inline void
101ethtool_aggregate_ctrl_stats(struct net_device *dev,
102 struct ethtool_eth_ctrl_stats *ctrl_stats)
103{
104}
105
106static inline void
107ethtool_aggregate_pause_stats(struct net_device *dev,
108 struct ethtool_pause_stats *pause_stats)
109{
110}
111
112static inline void
113ethtool_aggregate_rmon_stats(struct net_device *dev,
114 struct ethtool_rmon_stats *rmon_stats)
115{
116}
117
d54151aa
VO
118static inline bool ethtool_dev_mm_supported(struct net_device *dev)
119{
120 return false;
121}
122
90c56b38 123#endif /* IS_ENABLED(CONFIG_ETHTOOL_NETLINK) */
4715d87e
OR
124
125static inline int ethnl_cable_test_result(struct phy_device *phydev, u8 pair,
126 u8 result)
127{
128 return ethnl_cable_test_result_with_src(phydev, pair, result,
129 ETHTOOL_A_CABLE_INF_SRC_TDR);
130}
131
132static inline int ethnl_cable_test_fault_length(struct phy_device *phydev,
133 u8 pair, u32 cm)
134{
135 return ethnl_cable_test_fault_length_with_src(phydev, pair, cm,
136 ETHTOOL_A_CABLE_INF_SRC_TDR);
137}
138
2b4a8990 139#endif /* _LINUX_ETHTOOL_NETLINK_H_ */