aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ethtool.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r--include/linux/ethtool.h102
1 files changed, 93 insertions, 9 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 653dc9c4ebac..e2b7bf27c03e 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -12,6 +12,7 @@
12#ifndef _LINUX_ETHTOOL_H 12#ifndef _LINUX_ETHTOOL_H
13#define _LINUX_ETHTOOL_H 13#define _LINUX_ETHTOOL_H
14 14
15#include <linux/bitmap.h>
15#include <linux/compat.h> 16#include <linux/compat.h>
16#include <uapi/linux/ethtool.h> 17#include <uapi/linux/ethtool.h>
17 18
@@ -40,9 +41,6 @@ struct compat_ethtool_rxnfc {
40 41
41#include <linux/rculist.h> 42#include <linux/rculist.h>
42 43
43extern int __ethtool_get_settings(struct net_device *dev,
44 struct ethtool_cmd *cmd);
45
46/** 44/**
47 * enum ethtool_phys_id_state - indicator state for physical identification 45 * enum ethtool_phys_id_state - indicator state for physical identification
48 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated 46 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
@@ -97,13 +95,70 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
97 return index % n_rx_rings; 95 return index % n_rx_rings;
98} 96}
99 97
98/* number of link mode bits/ulongs handled internally by kernel */
99#define __ETHTOOL_LINK_MODE_MASK_NBITS \
100 (__ETHTOOL_LINK_MODE_LAST + 1)
101
102/* declare a link mode bitmap */
103#define __ETHTOOL_DECLARE_LINK_MODE_MASK(name) \
104 DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS)
105
106/* drivers must ignore base.cmd and base.link_mode_masks_nwords
107 * fields, but they are allowed to overwrite them (will be ignored).
108 */
109struct ethtool_link_ksettings {
110 struct ethtool_link_settings base;
111 struct {
112 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
113 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
114 __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
115 } link_modes;
116};
117
118/**
119 * ethtool_link_ksettings_zero_link_mode - clear link_ksettings link mode mask
120 * @ptr : pointer to struct ethtool_link_ksettings
121 * @name : one of supported/advertising/lp_advertising
122 */
123#define ethtool_link_ksettings_zero_link_mode(ptr, name) \
124 bitmap_zero((ptr)->link_modes.name, __ETHTOOL_LINK_MODE_MASK_NBITS)
125
126/**
127 * ethtool_link_ksettings_add_link_mode - set bit in link_ksettings
128 * link mode mask
129 * @ptr : pointer to struct ethtool_link_ksettings
130 * @name : one of supported/advertising/lp_advertising
131 * @mode : one of the ETHTOOL_LINK_MODE_*_BIT
132 * (not atomic, no bound checking)
133 */
134#define ethtool_link_ksettings_add_link_mode(ptr, name, mode) \
135 __set_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
136
137/**
138 * ethtool_link_ksettings_test_link_mode - test bit in ksettings link mode mask
139 * @ptr : pointer to struct ethtool_link_ksettings
140 * @name : one of supported/advertising/lp_advertising
141 * @mode : one of the ETHTOOL_LINK_MODE_*_BIT
142 * (not atomic, no bound checking)
143 *
144 * Returns true/false.
145 */
146#define ethtool_link_ksettings_test_link_mode(ptr, name, mode) \
147 test_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
148
149extern int
150__ethtool_get_link_ksettings(struct net_device *dev,
151 struct ethtool_link_ksettings *link_ksettings);
152
100/** 153/**
101 * struct ethtool_ops - optional netdev operations 154 * struct ethtool_ops - optional netdev operations
102 * @get_settings: Get various device settings including Ethernet link 155 * @get_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings
156 * API. Get various device settings including Ethernet link
103 * settings. The @cmd parameter is expected to have been cleared 157 * settings. The @cmd parameter is expected to have been cleared
104 * before get_settings is called. Returns a negative error code or 158 * before get_settings is called. Returns a negative error code
105 * zero. 159 * or zero.
106 * @set_settings: Set various device settings including Ethernet link 160 * @set_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings
161 * API. Set various device settings including Ethernet link
107 * settings. Returns a negative error code or zero. 162 * settings. Returns a negative error code or zero.
108 * @get_drvinfo: Report driver/device information. Should only set the 163 * @get_drvinfo: Report driver/device information. Should only set the
109 * @driver, @version, @fw_version and @bus_info fields. If not 164 * @driver, @version, @fw_version and @bus_info fields. If not
@@ -201,6 +256,29 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
201 * @get_module_eeprom: Get the eeprom information from the plug-in module 256 * @get_module_eeprom: Get the eeprom information from the plug-in module
202 * @get_eee: Get Energy-Efficient (EEE) supported and status. 257 * @get_eee: Get Energy-Efficient (EEE) supported and status.
203 * @set_eee: Set EEE status (enable/disable) as well as LPI timers. 258 * @set_eee: Set EEE status (enable/disable) as well as LPI timers.
259 * @get_per_queue_coalesce: Get interrupt coalescing parameters per queue.
260 * It must check that the given queue number is valid. If neither a RX nor
261 * a TX queue has this number, return -EINVAL. If only a RX queue or a TX
262 * queue has this number, set the inapplicable fields to ~0 and return 0.
263 * Returns a negative error code or zero.
264 * @set_per_queue_coalesce: Set interrupt coalescing parameters per queue.
265 * It must check that the given queue number is valid. If neither a RX nor
266 * a TX queue has this number, return -EINVAL. If only a RX queue or a TX
267 * queue has this number, ignore the inapplicable fields.
268 * Returns a negative error code or zero.
269 * @get_link_ksettings: When defined, takes precedence over the
270 * %get_settings method. Get various device settings
271 * including Ethernet link settings. The %cmd and
272 * %link_mode_masks_nwords fields should be ignored (use
273 * %__ETHTOOL_LINK_MODE_MASK_NBITS instead of the latter), any
274 * change to them will be overwritten by kernel. Returns a
275 * negative error code or zero.
276 * @set_link_ksettings: When defined, takes precedence over the
277 * %set_settings method. Set various device settings including
278 * Ethernet link settings. The %cmd and %link_mode_masks_nwords
279 * fields should be ignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS
280 * instead of the latter), any change to them will be overwritten
281 * by kernel. Returns a negative error code or zero.
204 * 282 *
205 * All operations are optional (i.e. the function pointer may be set 283 * All operations are optional (i.e. the function pointer may be set
206 * to %NULL) and callers must take this into account. Callers must 284 * to %NULL) and callers must take this into account. Callers must
@@ -279,7 +357,13 @@ struct ethtool_ops {
279 const struct ethtool_tunable *, void *); 357 const struct ethtool_tunable *, void *);
280 int (*set_tunable)(struct net_device *, 358 int (*set_tunable)(struct net_device *,
281 const struct ethtool_tunable *, const void *); 359 const struct ethtool_tunable *, const void *);
282 360 int (*get_per_queue_coalesce)(struct net_device *, u32,
283 361 struct ethtool_coalesce *);
362 int (*set_per_queue_coalesce)(struct net_device *, u32,
363 struct ethtool_coalesce *);
364 int (*get_link_ksettings)(struct net_device *,
365 struct ethtool_link_ksettings *);
366 int (*set_link_ksettings)(struct net_device *,
367 const struct ethtool_link_ksettings *);
284}; 368};
285#endif /* _LINUX_ETHTOOL_H */ 369#endif /* _LINUX_ETHTOOL_H */