xref: /linux/include/uapi/linux/ethtool.h (revision 85a624403c77c3f074931aefdfced59f61b668cb)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells  * ethtool.h: Defines for Linux ethtool.
3607ca46eSDavid Howells  *
4607ca46eSDavid Howells  * Copyright (C) 1998 David S. Miller (davem@redhat.com)
5607ca46eSDavid Howells  * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
6607ca46eSDavid Howells  * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
7607ca46eSDavid Howells  * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
8607ca46eSDavid Howells  *                                christopher.leech@intel.com,
9607ca46eSDavid Howells  *                                scott.feldman@intel.com)
10607ca46eSDavid Howells  * Portions Copyright (C) Sun Microsystems 2008
11607ca46eSDavid Howells  */
12607ca46eSDavid Howells 
13607ca46eSDavid Howells #ifndef _UAPI_LINUX_ETHTOOL_H
14607ca46eSDavid Howells #define _UAPI_LINUX_ETHTOOL_H
15607ca46eSDavid Howells 
16b5d3755aSNicolas Dichtel #include <linux/kernel.h>
17607ca46eSDavid Howells #include <linux/types.h>
18607ca46eSDavid Howells #include <linux/if_ether.h>
19607ca46eSDavid Howells 
2014e20379SNicolas Dichtel #ifndef __KERNEL__
2114e20379SNicolas Dichtel #include <limits.h> /* for INT_MAX */
2214e20379SNicolas Dichtel #endif
2314e20379SNicolas Dichtel 
24bf8fc60aSBen Hutchings /* All structures exposed to userland should be defined such that they
25bf8fc60aSBen Hutchings  * have the same layout for 32-bit and 64-bit userland.
26bf8fc60aSBen Hutchings  */
27bf8fc60aSBen Hutchings 
28bf8fc60aSBen Hutchings /**
293f1ac7a7SDavid Decotigny  * struct ethtool_cmd - DEPRECATED, link control and status
303f1ac7a7SDavid Decotigny  * This structure is DEPRECATED, please use struct ethtool_link_settings.
31bf8fc60aSBen Hutchings  * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
32bf8fc60aSBen Hutchings  * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
33bf8fc60aSBen Hutchings  *	physical connectors and other link features for which the
34bf8fc60aSBen Hutchings  *	interface supports autonegotiation or auto-detection.
35bf8fc60aSBen Hutchings  *	Read-only.
36bf8fc60aSBen Hutchings  * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
37bf8fc60aSBen Hutchings  *	physical connectors and other link features that are
38bf8fc60aSBen Hutchings  *	advertised through autonegotiation or enabled for
39bf8fc60aSBen Hutchings  *	auto-detection.
404456ed04SMichael S. Tsirkin  * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
41bf8fc60aSBen Hutchings  * @duplex: Duplex mode; one of %DUPLEX_*
42bf8fc60aSBen Hutchings  * @port: Physical connector type; one of %PORT_*
43bf8fc60aSBen Hutchings  * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
44bf8fc60aSBen Hutchings  *	applicable.  For clause 45 PHYs this is the PRTAD.
45bf8fc60aSBen Hutchings  * @transceiver: Historically used to distinguish different possible
46bf8fc60aSBen Hutchings  *	PHY types, but not in a consistent way.  Deprecated.
47bf8fc60aSBen Hutchings  * @autoneg: Enable/disable autonegotiation and auto-detection;
48bf8fc60aSBen Hutchings  *	either %AUTONEG_DISABLE or %AUTONEG_ENABLE
49bf8fc60aSBen Hutchings  * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
50bf8fc60aSBen Hutchings  *	protocols supported by the interface; 0 if unknown.
51bf8fc60aSBen Hutchings  *	Read-only.
52bf8fc60aSBen Hutchings  * @maxtxpkt: Historically used to report TX IRQ coalescing; now
53bf8fc60aSBen Hutchings  *	obsoleted by &struct ethtool_coalesce.  Read-only; deprecated.
54bf8fc60aSBen Hutchings  * @maxrxpkt: Historically used to report RX IRQ coalescing; now
55bf8fc60aSBen Hutchings  *	obsoleted by &struct ethtool_coalesce.  Read-only; deprecated.
564456ed04SMichael S. Tsirkin  * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
57bf8fc60aSBen Hutchings  * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
58bf8fc60aSBen Hutchings  *	%ETH_TP_MDI_*.  If the status is unknown or not applicable, the
59bf8fc60aSBen Hutchings  *	value will be %ETH_TP_MDI_INVALID.  Read-only.
60bf8fc60aSBen Hutchings  * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
61bf8fc60aSBen Hutchings  *	%ETH_TP_MDI_*.  If MDI(-X) control is not implemented, reads
62bf8fc60aSBen Hutchings  *	yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
63bf8fc60aSBen Hutchings  *	When written successfully, the link should be renegotiated if
64bf8fc60aSBen Hutchings  *	necessary.
65bf8fc60aSBen Hutchings  * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
66bf8fc60aSBen Hutchings  *	and other link features that the link partner advertised
67bf8fc60aSBen Hutchings  *	through autonegotiation; 0 if unknown or not applicable.
68bf8fc60aSBen Hutchings  *	Read-only.
69bf8fc60aSBen Hutchings  *
70bf8fc60aSBen Hutchings  * The link speed in Mbps is split between @speed and @speed_hi.  Use
71bf8fc60aSBen Hutchings  * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
72bf8fc60aSBen Hutchings  * access it.
73bf8fc60aSBen Hutchings  *
74bf8fc60aSBen Hutchings  * If autonegotiation is disabled, the speed and @duplex represent the
75bf8fc60aSBen Hutchings  * fixed link mode and are writable if the driver supports multiple
76bf8fc60aSBen Hutchings  * link modes.  If it is enabled then they are read-only; if the link
77bf8fc60aSBen Hutchings  * is up they represent the negotiated link mode; if the link is down,
78bf8fc60aSBen Hutchings  * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
79bf8fc60aSBen Hutchings  * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
80bf8fc60aSBen Hutchings  *
81bf8fc60aSBen Hutchings  * Some hardware interfaces may have multiple PHYs and/or physical
82bf8fc60aSBen Hutchings  * connectors fitted or do not allow the driver to detect which are
83bf8fc60aSBen Hutchings  * fitted.  For these interfaces @port and/or @phy_address may be
84bf8fc60aSBen Hutchings  * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
85bf8fc60aSBen Hutchings  * Otherwise, attempts to write different values may be ignored or
86bf8fc60aSBen Hutchings  * rejected.
87bf8fc60aSBen Hutchings  *
88bf8fc60aSBen Hutchings  * Users should assume that all fields not marked read-only are
89bf8fc60aSBen Hutchings  * writable and subject to validation by the driver.  They should use
90bf8fc60aSBen Hutchings  * %ETHTOOL_GSET to get the current values before making specific
91bf8fc60aSBen Hutchings  * changes and then applying them with %ETHTOOL_SSET.
92bf8fc60aSBen Hutchings  *
93bf8fc60aSBen Hutchings  * Drivers that implement set_settings() should validate all fields
94bf8fc60aSBen Hutchings  * other than @cmd that are not described as read-only or deprecated,
95bf8fc60aSBen Hutchings  * and must ignore all fields described as read-only.
96bf8fc60aSBen Hutchings  *
97bf8fc60aSBen Hutchings  * Deprecated fields should be ignored by both users and drivers.
98bf8fc60aSBen Hutchings  */
99607ca46eSDavid Howells struct ethtool_cmd {
100607ca46eSDavid Howells 	__u32	cmd;
101bf8fc60aSBen Hutchings 	__u32	supported;
102bf8fc60aSBen Hutchings 	__u32	advertising;
103bf8fc60aSBen Hutchings 	__u16	speed;
104bf8fc60aSBen Hutchings 	__u8	duplex;
105bf8fc60aSBen Hutchings 	__u8	port;
106bf8fc60aSBen Hutchings 	__u8	phy_address;
107bf8fc60aSBen Hutchings 	__u8	transceiver;
108bf8fc60aSBen Hutchings 	__u8	autoneg;
109bf8fc60aSBen Hutchings 	__u8	mdio_support;
110bf8fc60aSBen Hutchings 	__u32	maxtxpkt;
111bf8fc60aSBen Hutchings 	__u32	maxrxpkt;
112bf8fc60aSBen Hutchings 	__u16	speed_hi;
113bf8fc60aSBen Hutchings 	__u8	eth_tp_mdix;
114bf8fc60aSBen Hutchings 	__u8	eth_tp_mdix_ctrl;
115bf8fc60aSBen Hutchings 	__u32	lp_advertising;
116607ca46eSDavid Howells 	__u32	reserved[2];
117607ca46eSDavid Howells };
118607ca46eSDavid Howells 
119607ca46eSDavid Howells static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
120607ca46eSDavid Howells 					 __u32 speed)
121607ca46eSDavid Howells {
122*85a62440SJesse Brandeburg 	ep->speed = (__u16)(speed & 0xFFFF);
123607ca46eSDavid Howells 	ep->speed_hi = (__u16)(speed >> 16);
124607ca46eSDavid Howells }
125607ca46eSDavid Howells 
126607ca46eSDavid Howells static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
127607ca46eSDavid Howells {
128607ca46eSDavid Howells 	return (ep->speed_hi << 16) | ep->speed;
129607ca46eSDavid Howells }
130607ca46eSDavid Howells 
131607ca46eSDavid Howells /* Device supports clause 22 register access to PHY or peripherals
132607ca46eSDavid Howells  * using the interface defined in <linux/mii.h>.  This should not be
133607ca46eSDavid Howells  * set if there are known to be no such peripherals present or if
134607ca46eSDavid Howells  * the driver only emulates clause 22 registers for compatibility.
135607ca46eSDavid Howells  */
136607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C22	1
137607ca46eSDavid Howells 
138607ca46eSDavid Howells /* Device supports clause 45 register access to PHY or peripherals
139607ca46eSDavid Howells  * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
140607ca46eSDavid Howells  * This should not be set if there are known to be no such peripherals
141607ca46eSDavid Howells  * present.
142607ca46eSDavid Howells  */
143607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C45	2
144607ca46eSDavid Howells 
145607ca46eSDavid Howells #define ETHTOOL_FWVERS_LEN	32
146607ca46eSDavid Howells #define ETHTOOL_BUSINFO_LEN	32
147a4505152SHariprasad Shenai #define ETHTOOL_EROMVERS_LEN	32
148daba1b6bSBen Hutchings 
149daba1b6bSBen Hutchings /**
150daba1b6bSBen Hutchings  * struct ethtool_drvinfo - general driver and device information
151daba1b6bSBen Hutchings  * @cmd: Command number = %ETHTOOL_GDRVINFO
152daba1b6bSBen Hutchings  * @driver: Driver short name.  This should normally match the name
153daba1b6bSBen Hutchings  *	in its bus driver structure (e.g. pci_driver::name).  Must
154daba1b6bSBen Hutchings  *	not be an empty string.
155daba1b6bSBen Hutchings  * @version: Driver version string; may be an empty string
156daba1b6bSBen Hutchings  * @fw_version: Firmware version string; may be an empty string
157a4505152SHariprasad Shenai  * @erom_version: Expansion ROM version string; may be an empty string
158daba1b6bSBen Hutchings  * @bus_info: Device bus address.  This should match the dev_name()
159daba1b6bSBen Hutchings  *	string for the underlying bus device, if there is one.  May be
160daba1b6bSBen Hutchings  *	an empty string.
161daba1b6bSBen Hutchings  * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
162daba1b6bSBen Hutchings  *	%ETHTOOL_SPFLAGS commands; also the number of strings in the
163daba1b6bSBen Hutchings  *	%ETH_SS_PRIV_FLAGS set
164daba1b6bSBen Hutchings  * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
165daba1b6bSBen Hutchings  *	command; also the number of strings in the %ETH_SS_STATS set
166daba1b6bSBen Hutchings  * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
167daba1b6bSBen Hutchings  *	command; also the number of strings in the %ETH_SS_TEST set
168daba1b6bSBen Hutchings  * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
169daba1b6bSBen Hutchings  *	and %ETHTOOL_SEEPROM commands, in bytes
170daba1b6bSBen Hutchings  * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
171daba1b6bSBen Hutchings  *	command, in bytes
172daba1b6bSBen Hutchings  *
173daba1b6bSBen Hutchings  * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
174daba1b6bSBen Hutchings  * strings in any string set (from Linux 2.6.34).
175daba1b6bSBen Hutchings  *
176daba1b6bSBen Hutchings  * Drivers should set at most @driver, @version, @fw_version and
177daba1b6bSBen Hutchings  * @bus_info in their get_drvinfo() implementation.  The ethtool
178daba1b6bSBen Hutchings  * core fills in the other fields using other driver operations.
179daba1b6bSBen Hutchings  */
180607ca46eSDavid Howells struct ethtool_drvinfo {
181607ca46eSDavid Howells 	__u32	cmd;
182daba1b6bSBen Hutchings 	char	driver[32];
183daba1b6bSBen Hutchings 	char	version[32];
184daba1b6bSBen Hutchings 	char	fw_version[ETHTOOL_FWVERS_LEN];
185daba1b6bSBen Hutchings 	char	bus_info[ETHTOOL_BUSINFO_LEN];
186a4505152SHariprasad Shenai 	char	erom_version[ETHTOOL_EROMVERS_LEN];
187607ca46eSDavid Howells 	char	reserved2[12];
188daba1b6bSBen Hutchings 	__u32	n_priv_flags;
189daba1b6bSBen Hutchings 	__u32	n_stats;
190607ca46eSDavid Howells 	__u32	testinfo_len;
191daba1b6bSBen Hutchings 	__u32	eedump_len;
192daba1b6bSBen Hutchings 	__u32	regdump_len;
193607ca46eSDavid Howells };
194607ca46eSDavid Howells 
195607ca46eSDavid Howells #define SOPASS_MAX	6
19602d59f3fSBen Hutchings 
19702d59f3fSBen Hutchings /**
19802d59f3fSBen Hutchings  * struct ethtool_wolinfo - Wake-On-Lan configuration
19902d59f3fSBen Hutchings  * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
20002d59f3fSBen Hutchings  * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
20102d59f3fSBen Hutchings  *	Read-only.
20202d59f3fSBen Hutchings  * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
20302d59f3fSBen Hutchings  * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
20402d59f3fSBen Hutchings  *	is set in @wolopts.
20502d59f3fSBen Hutchings  */
206607ca46eSDavid Howells struct ethtool_wolinfo {
207607ca46eSDavid Howells 	__u32	cmd;
208607ca46eSDavid Howells 	__u32	supported;
209607ca46eSDavid Howells 	__u32	wolopts;
21002d59f3fSBen Hutchings 	__u8	sopass[SOPASS_MAX];
211607ca46eSDavid Howells };
212607ca46eSDavid Howells 
213607ca46eSDavid Howells /* for passing single values */
214607ca46eSDavid Howells struct ethtool_value {
215607ca46eSDavid Howells 	__u32	cmd;
216607ca46eSDavid Howells 	__u32	data;
217607ca46eSDavid Howells };
218607ca46eSDavid Howells 
219f0db9b07SGovindarajulu Varadarajan enum tunable_id {
220f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_ID_UNSPEC,
221f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_RX_COPYBREAK,
2221255a505SEric Dumazet 	ETHTOOL_TX_COPYBREAK,
223a4244b0cSHadar Hen Zion 	/*
224a4244b0cSHadar Hen Zion 	 * Add your fresh new tubale attribute above and remember to update
225a4244b0cSHadar Hen Zion 	 * tunable_strings[] in net/core/ethtool.c
226a4244b0cSHadar Hen Zion 	 */
227a4244b0cSHadar Hen Zion 	__ETHTOOL_TUNABLE_COUNT,
228f0db9b07SGovindarajulu Varadarajan };
229f0db9b07SGovindarajulu Varadarajan 
230f0db9b07SGovindarajulu Varadarajan enum tunable_type_id {
231f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_UNSPEC,
232f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_U8,
233f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_U16,
234f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_U32,
235f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_U64,
236f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_STRING,
237f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_S8,
238f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_S16,
239f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_S32,
240f0db9b07SGovindarajulu Varadarajan 	ETHTOOL_TUNABLE_S64,
241f0db9b07SGovindarajulu Varadarajan };
242f0db9b07SGovindarajulu Varadarajan 
243f0db9b07SGovindarajulu Varadarajan struct ethtool_tunable {
244f0db9b07SGovindarajulu Varadarajan 	__u32	cmd;
245f0db9b07SGovindarajulu Varadarajan 	__u32	id;
246f0db9b07SGovindarajulu Varadarajan 	__u32	type_id;
247f0db9b07SGovindarajulu Varadarajan 	__u32	len;
248f0db9b07SGovindarajulu Varadarajan 	void	*data[0];
249f0db9b07SGovindarajulu Varadarajan };
250f0db9b07SGovindarajulu Varadarajan 
25109fb8bb0SBen Hutchings /**
25209fb8bb0SBen Hutchings  * struct ethtool_regs - hardware register dump
25309fb8bb0SBen Hutchings  * @cmd: Command number = %ETHTOOL_GREGS
25409fb8bb0SBen Hutchings  * @version: Dump format version.  This is driver-specific and may
25509fb8bb0SBen Hutchings  *	distinguish different chips/revisions.  Drivers must use new
25609fb8bb0SBen Hutchings  *	version numbers whenever the dump format changes in an
25709fb8bb0SBen Hutchings  *	incompatible way.
25809fb8bb0SBen Hutchings  * @len: On entry, the real length of @data.  On return, the number of
25909fb8bb0SBen Hutchings  *	bytes used.
26009fb8bb0SBen Hutchings  * @data: Buffer for the register dump
26109fb8bb0SBen Hutchings  *
26209fb8bb0SBen Hutchings  * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
26309fb8bb0SBen Hutchings  * a register dump for the interface.  They must allocate the buffer
26409fb8bb0SBen Hutchings  * immediately following this structure.
26509fb8bb0SBen Hutchings  */
266607ca46eSDavid Howells struct ethtool_regs {
267607ca46eSDavid Howells 	__u32	cmd;
26809fb8bb0SBen Hutchings 	__u32	version;
26909fb8bb0SBen Hutchings 	__u32	len;
270607ca46eSDavid Howells 	__u8	data[0];
271607ca46eSDavid Howells };
272607ca46eSDavid Howells 
273c8364a63SBen Hutchings /**
274c8364a63SBen Hutchings  * struct ethtool_eeprom - EEPROM dump
275c8364a63SBen Hutchings  * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
276c8364a63SBen Hutchings  *	%ETHTOOL_SEEPROM
277c8364a63SBen Hutchings  * @magic: A 'magic cookie' value to guard against accidental changes.
278c8364a63SBen Hutchings  *	The value passed in to %ETHTOOL_SEEPROM must match the value
279c8364a63SBen Hutchings  *	returned by %ETHTOOL_GEEPROM for the same device.  This is
280c8364a63SBen Hutchings  *	unused when @cmd is %ETHTOOL_GMODULEEEPROM.
281c8364a63SBen Hutchings  * @offset: Offset within the EEPROM to begin reading/writing, in bytes
282c8364a63SBen Hutchings  * @len: On entry, number of bytes to read/write.  On successful
283c8364a63SBen Hutchings  *	return, number of bytes actually read/written.  In case of
284c8364a63SBen Hutchings  *	error, this may indicate at what point the error occurred.
285c8364a63SBen Hutchings  * @data: Buffer to read/write from
286c8364a63SBen Hutchings  *
287c8364a63SBen Hutchings  * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
288c8364a63SBen Hutchings  * the length of an on-board or module EEPROM, respectively.  They
289c8364a63SBen Hutchings  * must allocate the buffer immediately following this structure.
290c8364a63SBen Hutchings  */
291607ca46eSDavid Howells struct ethtool_eeprom {
292607ca46eSDavid Howells 	__u32	cmd;
293607ca46eSDavid Howells 	__u32	magic;
294c8364a63SBen Hutchings 	__u32	offset;
295c8364a63SBen Hutchings 	__u32	len;
296607ca46eSDavid Howells 	__u8	data[0];
297607ca46eSDavid Howells };
298607ca46eSDavid Howells 
299607ca46eSDavid Howells /**
300607ca46eSDavid Howells  * struct ethtool_eee - Energy Efficient Ethernet information
301607ca46eSDavid Howells  * @cmd: ETHTOOL_{G,S}EEE
302607ca46eSDavid Howells  * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
303607ca46eSDavid Howells  *	for which there is EEE support.
304607ca46eSDavid Howells  * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
305607ca46eSDavid Howells  *	advertised as eee capable.
306607ca46eSDavid Howells  * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
307607ca46eSDavid Howells  *	combinations advertised by the link partner as eee capable.
308607ca46eSDavid Howells  * @eee_active: Result of the eee auto negotiation.
309607ca46eSDavid Howells  * @eee_enabled: EEE configured mode (enabled/disabled).
310607ca46eSDavid Howells  * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
311607ca46eSDavid Howells  *	that eee was negotiated.
312607ca46eSDavid Howells  * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
313607ca46eSDavid Howells  *	its tx lpi (after reaching 'idle' state). Effective only when eee
314607ca46eSDavid Howells  *	was negotiated and tx_lpi_enabled was set.
315607ca46eSDavid Howells  */
316607ca46eSDavid Howells struct ethtool_eee {
317607ca46eSDavid Howells 	__u32	cmd;
318607ca46eSDavid Howells 	__u32	supported;
319607ca46eSDavid Howells 	__u32	advertised;
320607ca46eSDavid Howells 	__u32	lp_advertised;
321607ca46eSDavid Howells 	__u32	eee_active;
322607ca46eSDavid Howells 	__u32	eee_enabled;
323607ca46eSDavid Howells 	__u32	tx_lpi_enabled;
324607ca46eSDavid Howells 	__u32	tx_lpi_timer;
325607ca46eSDavid Howells 	__u32	reserved[2];
326607ca46eSDavid Howells };
327607ca46eSDavid Howells 
328607ca46eSDavid Howells /**
329607ca46eSDavid Howells  * struct ethtool_modinfo - plugin module eeprom information
330607ca46eSDavid Howells  * @cmd: %ETHTOOL_GMODULEINFO
331607ca46eSDavid Howells  * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
332607ca46eSDavid Howells  * @eeprom_len: Length of the eeprom
333607ca46eSDavid Howells  *
334607ca46eSDavid Howells  * This structure is used to return the information to
335607ca46eSDavid Howells  * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
336607ca46eSDavid Howells  * The type code indicates the eeprom data format
337607ca46eSDavid Howells  */
338607ca46eSDavid Howells struct ethtool_modinfo {
339607ca46eSDavid Howells 	__u32   cmd;
340607ca46eSDavid Howells 	__u32   type;
341607ca46eSDavid Howells 	__u32   eeprom_len;
342607ca46eSDavid Howells 	__u32   reserved[8];
343607ca46eSDavid Howells };
344607ca46eSDavid Howells 
345607ca46eSDavid Howells /**
346607ca46eSDavid Howells  * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
347607ca46eSDavid Howells  * @cmd: ETHTOOL_{G,S}COALESCE
348607ca46eSDavid Howells  * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
349607ca46eSDavid Howells  *	a packet arrives.
350607ca46eSDavid Howells  * @rx_max_coalesced_frames: Maximum number of packets to receive
351607ca46eSDavid Howells  *	before an RX interrupt.
352607ca46eSDavid Howells  * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
353607ca46eSDavid Howells  *	this value applies while an IRQ is being serviced by the host.
354607ca46eSDavid Howells  * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
355607ca46eSDavid Howells  *	except that this value applies while an IRQ is being serviced
356607ca46eSDavid Howells  *	by the host.
357607ca46eSDavid Howells  * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
358607ca46eSDavid Howells  *	a packet is sent.
359607ca46eSDavid Howells  * @tx_max_coalesced_frames: Maximum number of packets to be sent
360607ca46eSDavid Howells  *	before a TX interrupt.
361607ca46eSDavid Howells  * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
362607ca46eSDavid Howells  *	this value applies while an IRQ is being serviced by the host.
363607ca46eSDavid Howells  * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
364607ca46eSDavid Howells  *	except that this value applies while an IRQ is being serviced
365607ca46eSDavid Howells  *	by the host.
366607ca46eSDavid Howells  * @stats_block_coalesce_usecs: How many usecs to delay in-memory
367607ca46eSDavid Howells  *	statistics block updates.  Some drivers do not have an
368607ca46eSDavid Howells  *	in-memory statistic block, and in such cases this value is
369607ca46eSDavid Howells  *	ignored.  This value must not be zero.
370607ca46eSDavid Howells  * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
371607ca46eSDavid Howells  * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
372607ca46eSDavid Howells  * @pkt_rate_low: Threshold for low packet rate (packets per second).
373607ca46eSDavid Howells  * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
374607ca46eSDavid Howells  *	a packet arrives, when the packet rate is below @pkt_rate_low.
375607ca46eSDavid Howells  * @rx_max_coalesced_frames_low: Maximum number of packets to be received
376607ca46eSDavid Howells  *	before an RX interrupt, when the packet rate is below @pkt_rate_low.
377607ca46eSDavid Howells  * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
378607ca46eSDavid Howells  *	a packet is sent, when the packet rate is below @pkt_rate_low.
379607ca46eSDavid Howells  * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
380607ca46eSDavid Howells  *	a TX interrupt, when the packet rate is below @pkt_rate_low.
381607ca46eSDavid Howells  * @pkt_rate_high: Threshold for high packet rate (packets per second).
382607ca46eSDavid Howells  * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
383607ca46eSDavid Howells  *	a packet arrives, when the packet rate is above @pkt_rate_high.
384607ca46eSDavid Howells  * @rx_max_coalesced_frames_high: Maximum number of packets to be received
385607ca46eSDavid Howells  *	before an RX interrupt, when the packet rate is above @pkt_rate_high.
386607ca46eSDavid Howells  * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
387607ca46eSDavid Howells  *	a packet is sent, when the packet rate is above @pkt_rate_high.
388607ca46eSDavid Howells  * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
389607ca46eSDavid Howells  *	a TX interrupt, when the packet rate is above @pkt_rate_high.
390607ca46eSDavid Howells  * @rate_sample_interval: How often to do adaptive coalescing packet rate
391607ca46eSDavid Howells  *	sampling, measured in seconds.  Must not be zero.
392607ca46eSDavid Howells  *
393073e3cf2SBen Hutchings  * Each pair of (usecs, max_frames) fields specifies that interrupts
394073e3cf2SBen Hutchings  * should be coalesced until
395607ca46eSDavid Howells  *	(usecs > 0 && time_since_first_completion >= usecs) ||
396607ca46eSDavid Howells  *	(max_frames > 0 && completed_frames >= max_frames)
397073e3cf2SBen Hutchings  *
398607ca46eSDavid Howells  * It is illegal to set both usecs and max_frames to zero as this
399607ca46eSDavid Howells  * would cause interrupts to never be generated.  To disable
400607ca46eSDavid Howells  * coalescing, set usecs = 0 and max_frames = 1.
401607ca46eSDavid Howells  *
402607ca46eSDavid Howells  * Some implementations ignore the value of max_frames and use the
403073e3cf2SBen Hutchings  * condition time_since_first_completion >= usecs
404073e3cf2SBen Hutchings  *
405607ca46eSDavid Howells  * This is deprecated.  Drivers for hardware that does not support
406607ca46eSDavid Howells  * counting completions should validate that max_frames == !rx_usecs.
407607ca46eSDavid Howells  *
408607ca46eSDavid Howells  * Adaptive RX/TX coalescing is an algorithm implemented by some
409607ca46eSDavid Howells  * drivers to improve latency under low packet rates and improve
410607ca46eSDavid Howells  * throughput under high packet rates.  Some drivers only implement
411607ca46eSDavid Howells  * one of RX or TX adaptive coalescing.  Anything not implemented by
412607ca46eSDavid Howells  * the driver causes these values to be silently ignored.
413607ca46eSDavid Howells  *
414607ca46eSDavid Howells  * When the packet rate is below @pkt_rate_high but above
415607ca46eSDavid Howells  * @pkt_rate_low (both measured in packets per second) the
416607ca46eSDavid Howells  * normal {rx,tx}_* coalescing parameters are used.
417607ca46eSDavid Howells  */
418607ca46eSDavid Howells struct ethtool_coalesce {
419607ca46eSDavid Howells 	__u32	cmd;
420607ca46eSDavid Howells 	__u32	rx_coalesce_usecs;
421607ca46eSDavid Howells 	__u32	rx_max_coalesced_frames;
422607ca46eSDavid Howells 	__u32	rx_coalesce_usecs_irq;
423607ca46eSDavid Howells 	__u32	rx_max_coalesced_frames_irq;
424607ca46eSDavid Howells 	__u32	tx_coalesce_usecs;
425607ca46eSDavid Howells 	__u32	tx_max_coalesced_frames;
426607ca46eSDavid Howells 	__u32	tx_coalesce_usecs_irq;
427607ca46eSDavid Howells 	__u32	tx_max_coalesced_frames_irq;
428607ca46eSDavid Howells 	__u32	stats_block_coalesce_usecs;
429607ca46eSDavid Howells 	__u32	use_adaptive_rx_coalesce;
430607ca46eSDavid Howells 	__u32	use_adaptive_tx_coalesce;
431607ca46eSDavid Howells 	__u32	pkt_rate_low;
432607ca46eSDavid Howells 	__u32	rx_coalesce_usecs_low;
433607ca46eSDavid Howells 	__u32	rx_max_coalesced_frames_low;
434607ca46eSDavid Howells 	__u32	tx_coalesce_usecs_low;
435607ca46eSDavid Howells 	__u32	tx_max_coalesced_frames_low;
436607ca46eSDavid Howells 	__u32	pkt_rate_high;
437607ca46eSDavid Howells 	__u32	rx_coalesce_usecs_high;
438607ca46eSDavid Howells 	__u32	rx_max_coalesced_frames_high;
439607ca46eSDavid Howells 	__u32	tx_coalesce_usecs_high;
440607ca46eSDavid Howells 	__u32	tx_max_coalesced_frames_high;
441607ca46eSDavid Howells 	__u32	rate_sample_interval;
442607ca46eSDavid Howells };
443607ca46eSDavid Howells 
444af440a8aSBen Hutchings /**
445af440a8aSBen Hutchings  * struct ethtool_ringparam - RX/TX ring parameters
446af440a8aSBen Hutchings  * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
447af440a8aSBen Hutchings  * @rx_max_pending: Maximum supported number of pending entries per
448af440a8aSBen Hutchings  *	RX ring.  Read-only.
449af440a8aSBen Hutchings  * @rx_mini_max_pending: Maximum supported number of pending entries
450af440a8aSBen Hutchings  *	per RX mini ring.  Read-only.
451af440a8aSBen Hutchings  * @rx_jumbo_max_pending: Maximum supported number of pending entries
452af440a8aSBen Hutchings  *	per RX jumbo ring.  Read-only.
453af440a8aSBen Hutchings  * @tx_max_pending: Maximum supported number of pending entries per
454af440a8aSBen Hutchings  *	TX ring.  Read-only.
455af440a8aSBen Hutchings  * @rx_pending: Current maximum number of pending entries per RX ring
456af440a8aSBen Hutchings  * @rx_mini_pending: Current maximum number of pending entries per RX
457af440a8aSBen Hutchings  *	mini ring
458af440a8aSBen Hutchings  * @rx_jumbo_pending: Current maximum number of pending entries per RX
459af440a8aSBen Hutchings  *	jumbo ring
460af440a8aSBen Hutchings  * @tx_pending: Current maximum supported number of pending entries
461af440a8aSBen Hutchings  *	per TX ring
462af440a8aSBen Hutchings  *
463af440a8aSBen Hutchings  * If the interface does not have separate RX mini and/or jumbo rings,
464af440a8aSBen Hutchings  * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
465af440a8aSBen Hutchings  *
466af440a8aSBen Hutchings  * There may also be driver-dependent minimum values for the number
467af440a8aSBen Hutchings  * of entries per ring.
468607ca46eSDavid Howells  */
469af440a8aSBen Hutchings struct ethtool_ringparam {
470af440a8aSBen Hutchings 	__u32	cmd;
471607ca46eSDavid Howells 	__u32	rx_max_pending;
472607ca46eSDavid Howells 	__u32	rx_mini_max_pending;
473607ca46eSDavid Howells 	__u32	rx_jumbo_max_pending;
474607ca46eSDavid Howells 	__u32	tx_max_pending;
475607ca46eSDavid Howells 	__u32	rx_pending;
476607ca46eSDavid Howells 	__u32	rx_mini_pending;
477607ca46eSDavid Howells 	__u32	rx_jumbo_pending;
478607ca46eSDavid Howells 	__u32	tx_pending;
479607ca46eSDavid Howells };
480607ca46eSDavid Howells 
481607ca46eSDavid Howells /**
482607ca46eSDavid Howells  * struct ethtool_channels - configuring number of network channel
483607ca46eSDavid Howells  * @cmd: ETHTOOL_{G,S}CHANNELS
484607ca46eSDavid Howells  * @max_rx: Read only. Maximum number of receive channel the driver support.
485607ca46eSDavid Howells  * @max_tx: Read only. Maximum number of transmit channel the driver support.
486607ca46eSDavid Howells  * @max_other: Read only. Maximum number of other channel the driver support.
487607ca46eSDavid Howells  * @max_combined: Read only. Maximum number of combined channel the driver
488607ca46eSDavid Howells  *	support. Set of queues RX, TX or other.
489607ca46eSDavid Howells  * @rx_count: Valid values are in the range 1 to the max_rx.
490607ca46eSDavid Howells  * @tx_count: Valid values are in the range 1 to the max_tx.
491607ca46eSDavid Howells  * @other_count: Valid values are in the range 1 to the max_other.
492607ca46eSDavid Howells  * @combined_count: Valid values are in the range 1 to the max_combined.
493607ca46eSDavid Howells  *
494607ca46eSDavid Howells  * This can be used to configure RX, TX and other channels.
495607ca46eSDavid Howells  */
496607ca46eSDavid Howells 
497607ca46eSDavid Howells struct ethtool_channels {
498607ca46eSDavid Howells 	__u32	cmd;
499607ca46eSDavid Howells 	__u32	max_rx;
500607ca46eSDavid Howells 	__u32	max_tx;
501607ca46eSDavid Howells 	__u32	max_other;
502607ca46eSDavid Howells 	__u32	max_combined;
503607ca46eSDavid Howells 	__u32	rx_count;
504607ca46eSDavid Howells 	__u32	tx_count;
505607ca46eSDavid Howells 	__u32	other_count;
506607ca46eSDavid Howells 	__u32	combined_count;
507607ca46eSDavid Howells };
508607ca46eSDavid Howells 
5096a7a1081SBen Hutchings /**
5106a7a1081SBen Hutchings  * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
5116a7a1081SBen Hutchings  * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
5126a7a1081SBen Hutchings  * @autoneg: Flag to enable autonegotiation of pause frame use
5136a7a1081SBen Hutchings  * @rx_pause: Flag to enable reception of pause frames
5146a7a1081SBen Hutchings  * @tx_pause: Flag to enable transmission of pause frames
515607ca46eSDavid Howells  *
5166a7a1081SBen Hutchings  * Drivers should reject a non-zero setting of @autoneg when
5176a7a1081SBen Hutchings  * autoneogotiation is disabled (or not supported) for the link.
5186a7a1081SBen Hutchings  *
5196a7a1081SBen Hutchings  * If the link is autonegotiated, drivers should use
5206a7a1081SBen Hutchings  * mii_advertise_flowctrl() or similar code to set the advertised
5216a7a1081SBen Hutchings  * pause frame capabilities based on the @rx_pause and @tx_pause flags,
5226a7a1081SBen Hutchings  * even if @autoneg is zero.  They should also allow the advertised
5236a7a1081SBen Hutchings  * pause frame capabilities to be controlled directly through the
5246a7a1081SBen Hutchings  * advertising field of &struct ethtool_cmd.
5256a7a1081SBen Hutchings  *
5266a7a1081SBen Hutchings  * If @autoneg is non-zero, the MAC is configured to send and/or
5276a7a1081SBen Hutchings  * receive pause frames according to the result of autonegotiation.
5286a7a1081SBen Hutchings  * Otherwise, it is configured directly based on the @rx_pause and
5296a7a1081SBen Hutchings  * @tx_pause flags.
530607ca46eSDavid Howells  */
5316a7a1081SBen Hutchings struct ethtool_pauseparam {
5326a7a1081SBen Hutchings 	__u32	cmd;
533607ca46eSDavid Howells 	__u32	autoneg;
534607ca46eSDavid Howells 	__u32	rx_pause;
535607ca46eSDavid Howells 	__u32	tx_pause;
536607ca46eSDavid Howells };
537607ca46eSDavid Howells 
538607ca46eSDavid Howells #define ETH_GSTRING_LEN		32
539fe5df1b9SBen Hutchings 
540fe5df1b9SBen Hutchings /**
541fe5df1b9SBen Hutchings  * enum ethtool_stringset - string set ID
542fe5df1b9SBen Hutchings  * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
543fe5df1b9SBen Hutchings  * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
544fe5df1b9SBen Hutchings  * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
545fe5df1b9SBen Hutchings  *	%ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
546fe5df1b9SBen Hutchings  * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
547fe5df1b9SBen Hutchings  *	now deprecated
548fe5df1b9SBen Hutchings  * @ETH_SS_FEATURES: Device feature names
549892311f6SEyal Perry  * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
550f3a40945SAndrew Lunn  * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
551fe5df1b9SBen Hutchings  */
552607ca46eSDavid Howells enum ethtool_stringset {
553607ca46eSDavid Howells 	ETH_SS_TEST		= 0,
554607ca46eSDavid Howells 	ETH_SS_STATS,
555607ca46eSDavid Howells 	ETH_SS_PRIV_FLAGS,
556fe5df1b9SBen Hutchings 	ETH_SS_NTUPLE_FILTERS,
557607ca46eSDavid Howells 	ETH_SS_FEATURES,
558892311f6SEyal Perry 	ETH_SS_RSS_HASH_FUNCS,
559a4244b0cSHadar Hen Zion 	ETH_SS_TUNABLES,
560f3a40945SAndrew Lunn 	ETH_SS_PHY_STATS,
561607ca46eSDavid Howells };
562607ca46eSDavid Howells 
563fe5df1b9SBen Hutchings /**
564fe5df1b9SBen Hutchings  * struct ethtool_gstrings - string set for data tagging
565fe5df1b9SBen Hutchings  * @cmd: Command number = %ETHTOOL_GSTRINGS
566fe5df1b9SBen Hutchings  * @string_set: String set ID; one of &enum ethtool_stringset
567fe5df1b9SBen Hutchings  * @len: On return, the number of strings in the string set
568fe5df1b9SBen Hutchings  * @data: Buffer for strings.  Each string is null-padded to a size of
569fe5df1b9SBen Hutchings  *	%ETH_GSTRING_LEN.
570fe5df1b9SBen Hutchings  *
571fe5df1b9SBen Hutchings  * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
572fe5df1b9SBen Hutchings  * the string set.  They must allocate a buffer of the appropriate
573fe5df1b9SBen Hutchings  * size immediately following this structure.
574fe5df1b9SBen Hutchings  */
575607ca46eSDavid Howells struct ethtool_gstrings {
576fe5df1b9SBen Hutchings 	__u32	cmd;
577fe5df1b9SBen Hutchings 	__u32	string_set;
578fe5df1b9SBen Hutchings 	__u32	len;
579607ca46eSDavid Howells 	__u8	data[0];
580607ca46eSDavid Howells };
581607ca46eSDavid Howells 
582fe5df1b9SBen Hutchings /**
583fe5df1b9SBen Hutchings  * struct ethtool_sset_info - string set information
584fe5df1b9SBen Hutchings  * @cmd: Command number = %ETHTOOL_GSSET_INFO
585fe5df1b9SBen Hutchings  * @sset_mask: On entry, a bitmask of string sets to query, with bits
586fe5df1b9SBen Hutchings  *	numbered according to &enum ethtool_stringset.  On return, a
587fe5df1b9SBen Hutchings  *	bitmask of those string sets queried that are supported.
588fe5df1b9SBen Hutchings  * @data: Buffer for string set sizes.  On return, this contains the
589fe5df1b9SBen Hutchings  *	size of each string set that was queried and supported, in
590fe5df1b9SBen Hutchings  *	order of ID.
591fe5df1b9SBen Hutchings  *
592fe5df1b9SBen Hutchings  * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
593fe5df1b9SBen Hutchings  * return @sset_mask == 0x6 (sets 1, 2).  Then @data[0] contains the
594fe5df1b9SBen Hutchings  * size of set 1 and @data[1] contains the size of set 2.
595fe5df1b9SBen Hutchings  *
596fe5df1b9SBen Hutchings  * Users must allocate a buffer of the appropriate size (4 * number of
597fe5df1b9SBen Hutchings  * sets queried) immediately following this structure.
598fe5df1b9SBen Hutchings  */
599607ca46eSDavid Howells struct ethtool_sset_info {
600fe5df1b9SBen Hutchings 	__u32	cmd;
601607ca46eSDavid Howells 	__u32	reserved;
602fe5df1b9SBen Hutchings 	__u64	sset_mask;
603fe5df1b9SBen Hutchings 	__u32	data[0];
604607ca46eSDavid Howells };
605607ca46eSDavid Howells 
606607ca46eSDavid Howells /**
607607ca46eSDavid Howells  * enum ethtool_test_flags - flags definition of ethtool_test
608607ca46eSDavid Howells  * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
609607ca46eSDavid Howells  *	only online tests.
610607ca46eSDavid Howells  * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
611607ca46eSDavid Howells  * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
612607ca46eSDavid Howells  *	test.
613607ca46eSDavid Howells  * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
614607ca46eSDavid Howells  */
615607ca46eSDavid Howells 
616607ca46eSDavid Howells enum ethtool_test_flags {
617607ca46eSDavid Howells 	ETH_TEST_FL_OFFLINE	= (1 << 0),
618607ca46eSDavid Howells 	ETH_TEST_FL_FAILED	= (1 << 1),
619607ca46eSDavid Howells 	ETH_TEST_FL_EXTERNAL_LB	= (1 << 2),
620607ca46eSDavid Howells 	ETH_TEST_FL_EXTERNAL_LB_DONE	= (1 << 3),
621607ca46eSDavid Howells };
622607ca46eSDavid Howells 
6234e5a62dbSBen Hutchings /**
6244e5a62dbSBen Hutchings  * struct ethtool_test - device self-test invocation
6254e5a62dbSBen Hutchings  * @cmd: Command number = %ETHTOOL_TEST
6264e5a62dbSBen Hutchings  * @flags: A bitmask of flags from &enum ethtool_test_flags.  Some
6274e5a62dbSBen Hutchings  *	flags may be set by the user on entry; others may be set by
6284e5a62dbSBen Hutchings  *	the driver on return.
6294e5a62dbSBen Hutchings  * @len: On return, the number of test results
6304e5a62dbSBen Hutchings  * @data: Array of test results
6314e5a62dbSBen Hutchings  *
6324e5a62dbSBen Hutchings  * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
6334e5a62dbSBen Hutchings  * number of test results that will be returned.  They must allocate a
6344e5a62dbSBen Hutchings  * buffer of the appropriate size (8 * number of results) immediately
6354e5a62dbSBen Hutchings  * following this structure.
6364e5a62dbSBen Hutchings  */
637607ca46eSDavid Howells struct ethtool_test {
6384e5a62dbSBen Hutchings 	__u32	cmd;
6394e5a62dbSBen Hutchings 	__u32	flags;
640607ca46eSDavid Howells 	__u32	reserved;
6414e5a62dbSBen Hutchings 	__u32	len;
642607ca46eSDavid Howells 	__u64	data[0];
643607ca46eSDavid Howells };
644607ca46eSDavid Howells 
64559091229SBen Hutchings /**
64659091229SBen Hutchings  * struct ethtool_stats - device-specific statistics
64759091229SBen Hutchings  * @cmd: Command number = %ETHTOOL_GSTATS
64859091229SBen Hutchings  * @n_stats: On return, the number of statistics
64959091229SBen Hutchings  * @data: Array of statistics
65059091229SBen Hutchings  *
65159091229SBen Hutchings  * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
65259091229SBen Hutchings  * number of statistics that will be returned.  They must allocate a
65359091229SBen Hutchings  * buffer of the appropriate size (8 * number of statistics)
65459091229SBen Hutchings  * immediately following this structure.
65559091229SBen Hutchings  */
656607ca46eSDavid Howells struct ethtool_stats {
65759091229SBen Hutchings 	__u32	cmd;
65859091229SBen Hutchings 	__u32	n_stats;
659607ca46eSDavid Howells 	__u64	data[0];
660607ca46eSDavid Howells };
661607ca46eSDavid Howells 
662f432c095SBen Hutchings /**
663f432c095SBen Hutchings  * struct ethtool_perm_addr - permanent hardware address
664f432c095SBen Hutchings  * @cmd: Command number = %ETHTOOL_GPERMADDR
665f432c095SBen Hutchings  * @size: On entry, the size of the buffer.  On return, the size of the
666f432c095SBen Hutchings  *	address.  The command fails if the buffer is too small.
667f432c095SBen Hutchings  * @data: Buffer for the address
668f432c095SBen Hutchings  *
669f432c095SBen Hutchings  * Users must allocate the buffer immediately following this structure.
670f432c095SBen Hutchings  * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
671f432c095SBen Hutchings  * type.
672f432c095SBen Hutchings  */
673607ca46eSDavid Howells struct ethtool_perm_addr {
674f432c095SBen Hutchings 	__u32	cmd;
675607ca46eSDavid Howells 	__u32	size;
676607ca46eSDavid Howells 	__u8	data[0];
677607ca46eSDavid Howells };
678607ca46eSDavid Howells 
679607ca46eSDavid Howells /* boolean flags controlling per-interface behavior characteristics.
680607ca46eSDavid Howells  * When reading, the flag indicates whether or not a certain behavior
681607ca46eSDavid Howells  * is enabled/present.  When writing, the flag indicates whether
682607ca46eSDavid Howells  * or not the driver should turn on (set) or off (clear) a behavior.
683607ca46eSDavid Howells  *
684607ca46eSDavid Howells  * Some behaviors may read-only (unconditionally absent or present).
685607ca46eSDavid Howells  * If such is the case, return EINVAL in the set-flags operation if the
686607ca46eSDavid Howells  * flag differs from the read-only value.
687607ca46eSDavid Howells  */
688607ca46eSDavid Howells enum ethtool_flags {
689607ca46eSDavid Howells 	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */
690607ca46eSDavid Howells 	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */
691607ca46eSDavid Howells 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
692607ca46eSDavid Howells 	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
693607ca46eSDavid Howells 	ETH_FLAG_RXHASH		= (1 << 28),
694607ca46eSDavid Howells };
695607ca46eSDavid Howells 
696607ca46eSDavid Howells /* The following structures are for supporting RX network flow
697607ca46eSDavid Howells  * classification and RX n-tuple configuration. Note, all multibyte
698607ca46eSDavid Howells  * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
699607ca46eSDavid Howells  * be in network byte order.
700607ca46eSDavid Howells  */
701607ca46eSDavid Howells 
702607ca46eSDavid Howells /**
703607ca46eSDavid Howells  * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
704607ca46eSDavid Howells  * @ip4src: Source host
705607ca46eSDavid Howells  * @ip4dst: Destination host
706607ca46eSDavid Howells  * @psrc: Source port
707607ca46eSDavid Howells  * @pdst: Destination port
708607ca46eSDavid Howells  * @tos: Type-of-service
709607ca46eSDavid Howells  *
710607ca46eSDavid Howells  * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
711607ca46eSDavid Howells  */
712607ca46eSDavid Howells struct ethtool_tcpip4_spec {
713607ca46eSDavid Howells 	__be32	ip4src;
714607ca46eSDavid Howells 	__be32	ip4dst;
715607ca46eSDavid Howells 	__be16	psrc;
716607ca46eSDavid Howells 	__be16	pdst;
717607ca46eSDavid Howells 	__u8    tos;
718607ca46eSDavid Howells };
719607ca46eSDavid Howells 
720607ca46eSDavid Howells /**
721607ca46eSDavid Howells  * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
722607ca46eSDavid Howells  * @ip4src: Source host
723607ca46eSDavid Howells  * @ip4dst: Destination host
724607ca46eSDavid Howells  * @spi: Security parameters index
725607ca46eSDavid Howells  * @tos: Type-of-service
726607ca46eSDavid Howells  *
727607ca46eSDavid Howells  * This can be used to specify an IPsec transport or tunnel over IPv4.
728607ca46eSDavid Howells  */
729607ca46eSDavid Howells struct ethtool_ah_espip4_spec {
730607ca46eSDavid Howells 	__be32	ip4src;
731607ca46eSDavid Howells 	__be32	ip4dst;
732607ca46eSDavid Howells 	__be32	spi;
733607ca46eSDavid Howells 	__u8    tos;
734607ca46eSDavid Howells };
735607ca46eSDavid Howells 
736607ca46eSDavid Howells #define	ETH_RX_NFC_IP4	1
737607ca46eSDavid Howells 
738607ca46eSDavid Howells /**
739607ca46eSDavid Howells  * struct ethtool_usrip4_spec - general flow specification for IPv4
740607ca46eSDavid Howells  * @ip4src: Source host
741607ca46eSDavid Howells  * @ip4dst: Destination host
742607ca46eSDavid Howells  * @l4_4_bytes: First 4 bytes of transport (layer 4) header
743607ca46eSDavid Howells  * @tos: Type-of-service
744607ca46eSDavid Howells  * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
745607ca46eSDavid Howells  * @proto: Transport protocol number; mask must be 0
746607ca46eSDavid Howells  */
747607ca46eSDavid Howells struct ethtool_usrip4_spec {
748607ca46eSDavid Howells 	__be32	ip4src;
749607ca46eSDavid Howells 	__be32	ip4dst;
750607ca46eSDavid Howells 	__be32	l4_4_bytes;
751607ca46eSDavid Howells 	__u8    tos;
752607ca46eSDavid Howells 	__u8    ip_ver;
753607ca46eSDavid Howells 	__u8    proto;
754607ca46eSDavid Howells };
755607ca46eSDavid Howells 
75672bb6872SEdward Cree /**
75772bb6872SEdward Cree  * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
75872bb6872SEdward Cree  * @ip6src: Source host
75972bb6872SEdward Cree  * @ip6dst: Destination host
76072bb6872SEdward Cree  * @psrc: Source port
76172bb6872SEdward Cree  * @pdst: Destination port
76272bb6872SEdward Cree  * @tclass: Traffic Class
76372bb6872SEdward Cree  *
76472bb6872SEdward Cree  * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow.
76572bb6872SEdward Cree  */
76672bb6872SEdward Cree struct ethtool_tcpip6_spec {
76772bb6872SEdward Cree 	__be32	ip6src[4];
76872bb6872SEdward Cree 	__be32	ip6dst[4];
76972bb6872SEdward Cree 	__be16	psrc;
77072bb6872SEdward Cree 	__be16	pdst;
77172bb6872SEdward Cree 	__u8    tclass;
77272bb6872SEdward Cree };
77372bb6872SEdward Cree 
77472bb6872SEdward Cree /**
77572bb6872SEdward Cree  * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6
77672bb6872SEdward Cree  * @ip6src: Source host
77772bb6872SEdward Cree  * @ip6dst: Destination host
77872bb6872SEdward Cree  * @spi: Security parameters index
77972bb6872SEdward Cree  * @tclass: Traffic Class
78072bb6872SEdward Cree  *
78172bb6872SEdward Cree  * This can be used to specify an IPsec transport or tunnel over IPv6.
78272bb6872SEdward Cree  */
78372bb6872SEdward Cree struct ethtool_ah_espip6_spec {
78472bb6872SEdward Cree 	__be32	ip6src[4];
78572bb6872SEdward Cree 	__be32	ip6dst[4];
78672bb6872SEdward Cree 	__be32	spi;
78772bb6872SEdward Cree 	__u8    tclass;
78872bb6872SEdward Cree };
78972bb6872SEdward Cree 
79072bb6872SEdward Cree /**
79172bb6872SEdward Cree  * struct ethtool_usrip6_spec - general flow specification for IPv6
79272bb6872SEdward Cree  * @ip6src: Source host
79372bb6872SEdward Cree  * @ip6dst: Destination host
79472bb6872SEdward Cree  * @l4_4_bytes: First 4 bytes of transport (layer 4) header
79572bb6872SEdward Cree  * @tclass: Traffic Class
79672bb6872SEdward Cree  * @l4_proto: Transport protocol number (nexthdr after any Extension Headers)
79772bb6872SEdward Cree  */
79872bb6872SEdward Cree struct ethtool_usrip6_spec {
79972bb6872SEdward Cree 	__be32	ip6src[4];
80072bb6872SEdward Cree 	__be32	ip6dst[4];
80172bb6872SEdward Cree 	__be32	l4_4_bytes;
80272bb6872SEdward Cree 	__u8    tclass;
80372bb6872SEdward Cree 	__u8    l4_proto;
80472bb6872SEdward Cree };
80572bb6872SEdward Cree 
806607ca46eSDavid Howells union ethtool_flow_union {
807607ca46eSDavid Howells 	struct ethtool_tcpip4_spec		tcp_ip4_spec;
808607ca46eSDavid Howells 	struct ethtool_tcpip4_spec		udp_ip4_spec;
809607ca46eSDavid Howells 	struct ethtool_tcpip4_spec		sctp_ip4_spec;
810607ca46eSDavid Howells 	struct ethtool_ah_espip4_spec		ah_ip4_spec;
811607ca46eSDavid Howells 	struct ethtool_ah_espip4_spec		esp_ip4_spec;
812607ca46eSDavid Howells 	struct ethtool_usrip4_spec		usr_ip4_spec;
81372bb6872SEdward Cree 	struct ethtool_tcpip6_spec		tcp_ip6_spec;
81472bb6872SEdward Cree 	struct ethtool_tcpip6_spec		udp_ip6_spec;
81572bb6872SEdward Cree 	struct ethtool_tcpip6_spec		sctp_ip6_spec;
81672bb6872SEdward Cree 	struct ethtool_ah_espip6_spec		ah_ip6_spec;
81772bb6872SEdward Cree 	struct ethtool_ah_espip6_spec		esp_ip6_spec;
81872bb6872SEdward Cree 	struct ethtool_usrip6_spec		usr_ip6_spec;
819607ca46eSDavid Howells 	struct ethhdr				ether_spec;
820d4676eacSYan Burman 	__u8					hdata[52];
821607ca46eSDavid Howells };
822607ca46eSDavid Howells 
823dc2e5734SYan Burman /**
824dc2e5734SYan Burman  * struct ethtool_flow_ext - additional RX flow fields
825dc2e5734SYan Burman  * @h_dest: destination MAC address
826dc2e5734SYan Burman  * @vlan_etype: VLAN EtherType
827dc2e5734SYan Burman  * @vlan_tci: VLAN tag control information
828dc2e5734SYan Burman  * @data: user defined data
829dc2e5734SYan Burman  *
830dc2e5734SYan Burman  * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
831dc2e5734SYan Burman  * is set in &struct ethtool_rx_flow_spec @flow_type.
832dc2e5734SYan Burman  * @h_dest is valid if %FLOW_MAC_EXT is set.
833dc2e5734SYan Burman  */
834607ca46eSDavid Howells struct ethtool_flow_ext {
835d4676eacSYan Burman 	__u8		padding[2];
836dc2e5734SYan Burman 	unsigned char	h_dest[ETH_ALEN];
837607ca46eSDavid Howells 	__be16		vlan_etype;
838607ca46eSDavid Howells 	__be16		vlan_tci;
839607ca46eSDavid Howells 	__be32		data[2];
840607ca46eSDavid Howells };
841607ca46eSDavid Howells 
842607ca46eSDavid Howells /**
843607ca46eSDavid Howells  * struct ethtool_rx_flow_spec - classification rule for RX flows
844607ca46eSDavid Howells  * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
845607ca46eSDavid Howells  * @h_u: Flow fields to match (dependent on @flow_type)
846607ca46eSDavid Howells  * @h_ext: Additional fields to match
847607ca46eSDavid Howells  * @m_u: Masks for flow field bits to be matched
848607ca46eSDavid Howells  * @m_ext: Masks for additional field bits to be matched
849607ca46eSDavid Howells  *	Note, all additional fields must be ignored unless @flow_type
850dc2e5734SYan Burman  *	includes the %FLOW_EXT or %FLOW_MAC_EXT flag
851dc2e5734SYan Burman  *	(see &struct ethtool_flow_ext description).
852607ca46eSDavid Howells  * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
853607ca46eSDavid Howells  *	if packets should be discarded
854607ca46eSDavid Howells  * @location: Location of rule in the table.  Locations must be
855607ca46eSDavid Howells  *	numbered such that a flow matching multiple rules will be
856607ca46eSDavid Howells  *	classified according to the first (lowest numbered) rule.
857607ca46eSDavid Howells  */
858607ca46eSDavid Howells struct ethtool_rx_flow_spec {
859607ca46eSDavid Howells 	__u32		flow_type;
860607ca46eSDavid Howells 	union ethtool_flow_union h_u;
861607ca46eSDavid Howells 	struct ethtool_flow_ext h_ext;
862607ca46eSDavid Howells 	union ethtool_flow_union m_u;
863607ca46eSDavid Howells 	struct ethtool_flow_ext m_ext;
864607ca46eSDavid Howells 	__u64		ring_cookie;
865607ca46eSDavid Howells 	__u32		location;
866607ca46eSDavid Howells };
867607ca46eSDavid Howells 
8688cf6f497SJohn Fastabend /* How rings are layed out when accessing virtual functions or
8698cf6f497SJohn Fastabend  * offloaded queues is device specific. To allow users to do flow
8708cf6f497SJohn Fastabend  * steering and specify these queues the ring cookie is partitioned
8718cf6f497SJohn Fastabend  * into a 32bit queue index with an 8 bit virtual function id.
8728cf6f497SJohn Fastabend  * This also leaves the 3bytes for further specifiers. It is possible
8738cf6f497SJohn Fastabend  * future devices may support more than 256 virtual functions if
8748cf6f497SJohn Fastabend  * devices start supporting PCIe w/ARI. However at the moment I
8758cf6f497SJohn Fastabend  * do not know of any devices that support this so I do not reserve
8768cf6f497SJohn Fastabend  * space for this at this time. If a future patch consumes the next
8778cf6f497SJohn Fastabend  * byte it should be aware of this possiblity.
8788cf6f497SJohn Fastabend  */
8798cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING	0x00000000FFFFFFFFLL
8808cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF	0x000000FF00000000LL
8818cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
8828cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
8838cf6f497SJohn Fastabend {
8848cf6f497SJohn Fastabend 	return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
8858cf6f497SJohn Fastabend };
8868cf6f497SJohn Fastabend 
8878cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
8888cf6f497SJohn Fastabend {
8898cf6f497SJohn Fastabend 	return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
8908cf6f497SJohn Fastabend 				ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
8918cf6f497SJohn Fastabend };
8928cf6f497SJohn Fastabend 
893607ca46eSDavid Howells /**
894607ca46eSDavid Howells  * struct ethtool_rxnfc - command to get or set RX flow classification rules
895607ca46eSDavid Howells  * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
896607ca46eSDavid Howells  *	%ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
897607ca46eSDavid Howells  *	%ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
898607ca46eSDavid Howells  * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
899607ca46eSDavid Howells  * @data: Command-dependent value
900607ca46eSDavid Howells  * @fs: Flow classification rule
901607ca46eSDavid Howells  * @rule_cnt: Number of rules to be affected
902607ca46eSDavid Howells  * @rule_locs: Array of used rule locations
903607ca46eSDavid Howells  *
904607ca46eSDavid Howells  * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
905607ca46eSDavid Howells  * the fields included in the flow hash, e.g. %RXH_IP_SRC.  The following
906607ca46eSDavid Howells  * structure fields must not be used.
907607ca46eSDavid Howells  *
908607ca46eSDavid Howells  * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
909607ca46eSDavid Howells  * on return.
910607ca46eSDavid Howells  *
911607ca46eSDavid Howells  * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
912607ca46eSDavid Howells  * rules on return.  If @data is non-zero on return then it is the
913607ca46eSDavid Howells  * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
914607ca46eSDavid Howells  * driver supports any special location values.  If that flag is not
915607ca46eSDavid Howells  * set in @data then special location values should not be used.
916607ca46eSDavid Howells  *
917607ca46eSDavid Howells  * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
918607ca46eSDavid Howells  * existing rule on entry and @fs contains the rule on return.
919607ca46eSDavid Howells  *
920607ca46eSDavid Howells  * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
921607ca46eSDavid Howells  * user buffer for @rule_locs on entry.  On return, @data is the size
922607ca46eSDavid Howells  * of the rule table, @rule_cnt is the number of defined rules, and
923607ca46eSDavid Howells  * @rule_locs contains the locations of the defined rules.  Drivers
924607ca46eSDavid Howells  * must use the second parameter to get_rxnfc() instead of @rule_locs.
925607ca46eSDavid Howells  *
926607ca46eSDavid Howells  * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
927607ca46eSDavid Howells  * @fs.@location either specifies the location to use or is a special
928607ca46eSDavid Howells  * location value with %RX_CLS_LOC_SPECIAL flag set.  On return,
929607ca46eSDavid Howells  * @fs.@location is the actual rule location.
930607ca46eSDavid Howells  *
931607ca46eSDavid Howells  * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
932607ca46eSDavid Howells  * existing rule on entry.
933607ca46eSDavid Howells  *
934607ca46eSDavid Howells  * A driver supporting the special location values for
935607ca46eSDavid Howells  * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
936607ca46eSDavid Howells  * location, and may remove a rule at a later location (lower
937607ca46eSDavid Howells  * priority) that matches exactly the same set of flows.  The special
938073e3cf2SBen Hutchings  * values are %RX_CLS_LOC_ANY, selecting any location;
939607ca46eSDavid Howells  * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
940607ca46eSDavid Howells  * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
941607ca46eSDavid Howells  * location (minimum priority).  Additional special values may be
942607ca46eSDavid Howells  * defined in future and drivers must return -%EINVAL for any
943607ca46eSDavid Howells  * unrecognised value.
944607ca46eSDavid Howells  */
945607ca46eSDavid Howells struct ethtool_rxnfc {
946607ca46eSDavid Howells 	__u32				cmd;
947607ca46eSDavid Howells 	__u32				flow_type;
948607ca46eSDavid Howells 	__u64				data;
949607ca46eSDavid Howells 	struct ethtool_rx_flow_spec	fs;
950607ca46eSDavid Howells 	__u32				rule_cnt;
951607ca46eSDavid Howells 	__u32				rule_locs[0];
952607ca46eSDavid Howells };
953607ca46eSDavid Howells 
954607ca46eSDavid Howells 
955607ca46eSDavid Howells /**
956607ca46eSDavid Howells  * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
957607ca46eSDavid Howells  * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
958607ca46eSDavid Howells  * @size: On entry, the array size of the user buffer, which may be zero.
959607ca46eSDavid Howells  *	On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
960607ca46eSDavid Howells  *	indirection table.
961607ca46eSDavid Howells  * @ring_index: RX ring/queue index for each hash value
962607ca46eSDavid Howells  *
963607ca46eSDavid Howells  * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
964607ca46eSDavid Howells  * should be returned.  For %ETHTOOL_SRXFHINDIR, a @size of zero means
965607ca46eSDavid Howells  * the table should be reset to default values.  This last feature
966607ca46eSDavid Howells  * is not supported by the original implementations.
967607ca46eSDavid Howells  */
968607ca46eSDavid Howells struct ethtool_rxfh_indir {
969607ca46eSDavid Howells 	__u32	cmd;
970607ca46eSDavid Howells 	__u32	size;
971607ca46eSDavid Howells 	__u32	ring_index[0];
972607ca46eSDavid Howells };
973607ca46eSDavid Howells 
974607ca46eSDavid Howells /**
9753de0b592SVenkata Duvvuru  * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
9763de0b592SVenkata Duvvuru  * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
9773de0b592SVenkata Duvvuru  * @rss_context: RSS context identifier.
97838c891a4SBen Hutchings  * @indir_size: On entry, the array size of the user buffer for the
97938c891a4SBen Hutchings  *	indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
98038c891a4SBen Hutchings  *	%ETH_RXFH_INDIR_NO_CHANGE.  On return from %ETHTOOL_GRSSH,
98138c891a4SBen Hutchings  *	the array size of the hardware indirection table.
98238c891a4SBen Hutchings  * @key_size: On entry, the array size of the user buffer for the hash key,
98338c891a4SBen Hutchings  *	which may be zero.  On return from %ETHTOOL_GRSSH, the size of the
98438c891a4SBen Hutchings  *	hardware hash key.
985892311f6SEyal Perry  * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
986892311f6SEyal Perry  *	Valid values are one of the %ETH_RSS_HASH_*.
9873de0b592SVenkata Duvvuru  * @rsvd:	Reserved for future extensions.
9883de0b592SVenkata Duvvuru  * @rss_config: RX ring/queue index for each hash value i.e., indirection table
98938c891a4SBen Hutchings  *	of @indir_size __u32 elements, followed by hash key of @key_size
99038c891a4SBen Hutchings  *	bytes.
9913de0b592SVenkata Duvvuru  *
9923de0b592SVenkata Duvvuru  * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
9937455fa24SBen Hutchings  * size should be returned.  For %ETHTOOL_SRSSH, an @indir_size of
9947455fa24SBen Hutchings  * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
9957455fa24SBen Hutchings  * and a @indir_size of zero means the indir table should be reset to default
996892311f6SEyal Perry  * values. An hfunc of zero means that hash function setting is not requested.
9973de0b592SVenkata Duvvuru  */
9983de0b592SVenkata Duvvuru struct ethtool_rxfh {
9993de0b592SVenkata Duvvuru 	__u32   cmd;
10003de0b592SVenkata Duvvuru 	__u32	rss_context;
10013de0b592SVenkata Duvvuru 	__u32   indir_size;
10023de0b592SVenkata Duvvuru 	__u32   key_size;
1003892311f6SEyal Perry 	__u8	hfunc;
1004892311f6SEyal Perry 	__u8	rsvd8[3];
1005892311f6SEyal Perry 	__u32	rsvd32;
10063de0b592SVenkata Duvvuru 	__u32   rss_config[0];
10073de0b592SVenkata Duvvuru };
10087455fa24SBen Hutchings #define ETH_RXFH_INDIR_NO_CHANGE	0xffffffff
10093de0b592SVenkata Duvvuru 
10103de0b592SVenkata Duvvuru /**
1011607ca46eSDavid Howells  * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
1012607ca46eSDavid Howells  * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
1013607ca46eSDavid Howells  * @h_u: Flow field values to match (dependent on @flow_type)
1014607ca46eSDavid Howells  * @m_u: Masks for flow field value bits to be ignored
1015607ca46eSDavid Howells  * @vlan_tag: VLAN tag to match
1016607ca46eSDavid Howells  * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
1017607ca46eSDavid Howells  * @data: Driver-dependent data to match
1018607ca46eSDavid Howells  * @data_mask: Mask for driver-dependent data bits to be ignored
1019607ca46eSDavid Howells  * @action: RX ring/queue index to deliver to (non-negative) or other action
1020607ca46eSDavid Howells  *	(negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
1021607ca46eSDavid Howells  *
1022607ca46eSDavid Howells  * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
1023607ca46eSDavid Howells  * a field value and mask are both zero this is treated as if all mask
1024607ca46eSDavid Howells  * bits are set i.e. the field is ignored.
1025607ca46eSDavid Howells  */
1026607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec {
1027607ca46eSDavid Howells 	__u32		 flow_type;
1028607ca46eSDavid Howells 	union {
1029607ca46eSDavid Howells 		struct ethtool_tcpip4_spec		tcp_ip4_spec;
1030607ca46eSDavid Howells 		struct ethtool_tcpip4_spec		udp_ip4_spec;
1031607ca46eSDavid Howells 		struct ethtool_tcpip4_spec		sctp_ip4_spec;
1032607ca46eSDavid Howells 		struct ethtool_ah_espip4_spec		ah_ip4_spec;
1033607ca46eSDavid Howells 		struct ethtool_ah_espip4_spec		esp_ip4_spec;
1034607ca46eSDavid Howells 		struct ethtool_usrip4_spec		usr_ip4_spec;
1035607ca46eSDavid Howells 		struct ethhdr				ether_spec;
1036607ca46eSDavid Howells 		__u8					hdata[72];
1037607ca46eSDavid Howells 	} h_u, m_u;
1038607ca46eSDavid Howells 
1039607ca46eSDavid Howells 	__u16	        vlan_tag;
1040607ca46eSDavid Howells 	__u16	        vlan_tag_mask;
1041607ca46eSDavid Howells 	__u64		data;
1042607ca46eSDavid Howells 	__u64		data_mask;
1043607ca46eSDavid Howells 
1044607ca46eSDavid Howells 	__s32		action;
1045607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_DROP	(-1)	/* drop packet */
1046607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_CLEAR	(-2)	/* clear filter */
1047607ca46eSDavid Howells };
1048607ca46eSDavid Howells 
1049607ca46eSDavid Howells /**
1050607ca46eSDavid Howells  * struct ethtool_rx_ntuple - command to set or clear RX flow filter
1051607ca46eSDavid Howells  * @cmd: Command number - %ETHTOOL_SRXNTUPLE
1052607ca46eSDavid Howells  * @fs: Flow filter specification
1053607ca46eSDavid Howells  */
1054607ca46eSDavid Howells struct ethtool_rx_ntuple {
1055607ca46eSDavid Howells 	__u32					cmd;
1056607ca46eSDavid Howells 	struct ethtool_rx_ntuple_flow_spec	fs;
1057607ca46eSDavid Howells };
1058607ca46eSDavid Howells 
1059607ca46eSDavid Howells #define ETHTOOL_FLASH_MAX_FILENAME	128
1060607ca46eSDavid Howells enum ethtool_flash_op_type {
1061607ca46eSDavid Howells 	ETHTOOL_FLASH_ALL_REGIONS	= 0,
1062607ca46eSDavid Howells };
1063607ca46eSDavid Howells 
1064607ca46eSDavid Howells /* for passing firmware flashing related parameters */
1065607ca46eSDavid Howells struct ethtool_flash {
1066607ca46eSDavid Howells 	__u32	cmd;
1067607ca46eSDavid Howells 	__u32	region;
1068607ca46eSDavid Howells 	char	data[ETHTOOL_FLASH_MAX_FILENAME];
1069607ca46eSDavid Howells };
1070607ca46eSDavid Howells 
1071607ca46eSDavid Howells /**
1072607ca46eSDavid Howells  * struct ethtool_dump - used for retrieving, setting device dump
1073607ca46eSDavid Howells  * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
1074607ca46eSDavid Howells  * 	%ETHTOOL_SET_DUMP
1075607ca46eSDavid Howells  * @version: FW version of the dump, filled in by driver
1076607ca46eSDavid Howells  * @flag: driver dependent flag for dump setting, filled in by driver during
1077607ca46eSDavid Howells  *        get and filled in by ethtool for set operation.
1078607ca46eSDavid Howells  *        flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
1079607ca46eSDavid Howells  *        firmware dump is disabled.
1080607ca46eSDavid Howells  * @len: length of dump data, used as the length of the user buffer on entry to
1081607ca46eSDavid Howells  * 	 %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
1082607ca46eSDavid Howells  * 	 for %ETHTOOL_GET_DUMP_FLAG command
1083607ca46eSDavid Howells  * @data: data collected for get dump data operation
1084607ca46eSDavid Howells  */
1085607ca46eSDavid Howells struct ethtool_dump {
1086607ca46eSDavid Howells 	__u32	cmd;
1087607ca46eSDavid Howells 	__u32	version;
1088607ca46eSDavid Howells 	__u32	flag;
1089607ca46eSDavid Howells 	__u32	len;
1090607ca46eSDavid Howells 	__u8	data[0];
1091607ca46eSDavid Howells };
1092607ca46eSDavid Howells 
1093ba569dc3SBen Hutchings #define ETH_FW_DUMP_DISABLE 0
1094ba569dc3SBen Hutchings 
1095607ca46eSDavid Howells /* for returning and changing feature sets */
1096607ca46eSDavid Howells 
1097607ca46eSDavid Howells /**
1098607ca46eSDavid Howells  * struct ethtool_get_features_block - block with state of 32 features
1099607ca46eSDavid Howells  * @available: mask of changeable features
1100607ca46eSDavid Howells  * @requested: mask of features requested to be enabled if possible
1101607ca46eSDavid Howells  * @active: mask of currently enabled features
1102607ca46eSDavid Howells  * @never_changed: mask of features not changeable for any device
1103607ca46eSDavid Howells  */
1104607ca46eSDavid Howells struct ethtool_get_features_block {
1105607ca46eSDavid Howells 	__u32	available;
1106607ca46eSDavid Howells 	__u32	requested;
1107607ca46eSDavid Howells 	__u32	active;
1108607ca46eSDavid Howells 	__u32	never_changed;
1109607ca46eSDavid Howells };
1110607ca46eSDavid Howells 
1111607ca46eSDavid Howells /**
1112607ca46eSDavid Howells  * struct ethtool_gfeatures - command to get state of device's features
1113607ca46eSDavid Howells  * @cmd: command number = %ETHTOOL_GFEATURES
1114073e3cf2SBen Hutchings  * @size: On entry, the number of elements in the features[] array;
1115073e3cf2SBen Hutchings  *	on return, the number of elements in features[] needed to hold
1116073e3cf2SBen Hutchings  *	all features
1117607ca46eSDavid Howells  * @features: state of features
1118607ca46eSDavid Howells  */
1119607ca46eSDavid Howells struct ethtool_gfeatures {
1120607ca46eSDavid Howells 	__u32	cmd;
1121607ca46eSDavid Howells 	__u32	size;
1122607ca46eSDavid Howells 	struct ethtool_get_features_block features[0];
1123607ca46eSDavid Howells };
1124607ca46eSDavid Howells 
1125607ca46eSDavid Howells /**
1126607ca46eSDavid Howells  * struct ethtool_set_features_block - block with request for 32 features
1127607ca46eSDavid Howells  * @valid: mask of features to be changed
1128607ca46eSDavid Howells  * @requested: values of features to be changed
1129607ca46eSDavid Howells  */
1130607ca46eSDavid Howells struct ethtool_set_features_block {
1131607ca46eSDavid Howells 	__u32	valid;
1132607ca46eSDavid Howells 	__u32	requested;
1133607ca46eSDavid Howells };
1134607ca46eSDavid Howells 
1135607ca46eSDavid Howells /**
1136607ca46eSDavid Howells  * struct ethtool_sfeatures - command to request change in device's features
1137607ca46eSDavid Howells  * @cmd: command number = %ETHTOOL_SFEATURES
1138607ca46eSDavid Howells  * @size: array size of the features[] array
1139607ca46eSDavid Howells  * @features: feature change masks
1140607ca46eSDavid Howells  */
1141607ca46eSDavid Howells struct ethtool_sfeatures {
1142607ca46eSDavid Howells 	__u32	cmd;
1143607ca46eSDavid Howells 	__u32	size;
1144607ca46eSDavid Howells 	struct ethtool_set_features_block features[0];
1145607ca46eSDavid Howells };
1146607ca46eSDavid Howells 
1147607ca46eSDavid Howells /**
1148607ca46eSDavid Howells  * struct ethtool_ts_info - holds a device's timestamping and PHC association
1149607ca46eSDavid Howells  * @cmd: command number = %ETHTOOL_GET_TS_INFO
1150607ca46eSDavid Howells  * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
1151607ca46eSDavid Howells  * @phc_index: device index of the associated PHC, or -1 if there is none
1152607ca46eSDavid Howells  * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
1153607ca46eSDavid Howells  * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
1154607ca46eSDavid Howells  *
1155607ca46eSDavid Howells  * The bits in the 'tx_types' and 'rx_filters' fields correspond to
1156607ca46eSDavid Howells  * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
1157607ca46eSDavid Howells  * respectively.  For example, if the device supports HWTSTAMP_TX_ON,
1158607ca46eSDavid Howells  * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
1159eff3cddcSJacob Keller  *
1160eff3cddcSJacob Keller  * Drivers should only report the filters they actually support without
1161eff3cddcSJacob Keller  * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for
1162eff3cddcSJacob Keller  * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the
1163eff3cddcSJacob Keller  * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op.
1164607ca46eSDavid Howells  */
1165607ca46eSDavid Howells struct ethtool_ts_info {
1166607ca46eSDavid Howells 	__u32	cmd;
1167607ca46eSDavid Howells 	__u32	so_timestamping;
1168607ca46eSDavid Howells 	__s32	phc_index;
1169607ca46eSDavid Howells 	__u32	tx_types;
1170607ca46eSDavid Howells 	__u32	tx_reserved[3];
1171607ca46eSDavid Howells 	__u32	rx_filters;
1172607ca46eSDavid Howells 	__u32	rx_reserved[3];
1173607ca46eSDavid Howells };
1174607ca46eSDavid Howells 
1175607ca46eSDavid Howells /*
1176607ca46eSDavid Howells  * %ETHTOOL_SFEATURES changes features present in features[].valid to the
1177607ca46eSDavid Howells  * values of corresponding bits in features[].requested. Bits in .requested
1178607ca46eSDavid Howells  * not set in .valid or not changeable are ignored.
1179607ca46eSDavid Howells  *
1180607ca46eSDavid Howells  * Returns %EINVAL when .valid contains undefined or never-changeable bits
1181607ca46eSDavid Howells  * or size is not equal to required number of features words (32-bit blocks).
1182607ca46eSDavid Howells  * Returns >= 0 if request was completed; bits set in the value mean:
1183607ca46eSDavid Howells  *   %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
1184607ca46eSDavid Howells  *	changeable (not present in %ETHTOOL_GFEATURES' features[].available)
1185607ca46eSDavid Howells  *	those bits were ignored.
1186607ca46eSDavid Howells  *   %ETHTOOL_F_WISH - some or all changes requested were recorded but the
1187607ca46eSDavid Howells  *      resulting state of bits masked by .valid is not equal to .requested.
1188607ca46eSDavid Howells  *      Probably there are other device-specific constraints on some features
1189607ca46eSDavid Howells  *      in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
1190607ca46eSDavid Howells  *      here as though ignored bits were cleared.
1191607ca46eSDavid Howells  *   %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
1192607ca46eSDavid Howells  *      compatibility functions. Requested offload state cannot be properly
1193607ca46eSDavid Howells  *      managed by kernel.
1194607ca46eSDavid Howells  *
1195607ca46eSDavid Howells  * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
1196607ca46eSDavid Howells  * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
1197607ca46eSDavid Howells  * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
1198607ca46eSDavid Howells  * significant bit in features[0] fields. Empty strings mark undefined features.
1199607ca46eSDavid Howells  */
1200607ca46eSDavid Howells enum ethtool_sfeatures_retval_bits {
1201607ca46eSDavid Howells 	ETHTOOL_F_UNSUPPORTED__BIT,
1202607ca46eSDavid Howells 	ETHTOOL_F_WISH__BIT,
1203607ca46eSDavid Howells 	ETHTOOL_F_COMPAT__BIT,
1204607ca46eSDavid Howells };
1205607ca46eSDavid Howells 
1206607ca46eSDavid Howells #define ETHTOOL_F_UNSUPPORTED   (1 << ETHTOOL_F_UNSUPPORTED__BIT)
1207607ca46eSDavid Howells #define ETHTOOL_F_WISH          (1 << ETHTOOL_F_WISH__BIT)
1208607ca46eSDavid Howells #define ETHTOOL_F_COMPAT        (1 << ETHTOOL_F_COMPAT__BIT)
1209607ca46eSDavid Howells 
1210ac2c7ad0SKan Liang #define MAX_NUM_QUEUE		4096
1211ac2c7ad0SKan Liang 
1212ac2c7ad0SKan Liang /**
1213ac2c7ad0SKan Liang  * struct ethtool_per_queue_op - apply sub command to the queues in mask.
1214ac2c7ad0SKan Liang  * @cmd: ETHTOOL_PERQUEUE
1215ac2c7ad0SKan Liang  * @sub_command: the sub command which apply to each queues
1216ac2c7ad0SKan Liang  * @queue_mask: Bitmap of the queues which sub command apply to
1217ac2c7ad0SKan Liang  * @data: A complete command structure following for each of the queues addressed
1218ac2c7ad0SKan Liang  */
1219ac2c7ad0SKan Liang struct ethtool_per_queue_op {
1220ac2c7ad0SKan Liang 	__u32	cmd;
1221ac2c7ad0SKan Liang 	__u32	sub_command;
1222b5d3755aSNicolas Dichtel 	__u32	queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
1223ac2c7ad0SKan Liang 	char	data[];
1224ac2c7ad0SKan Liang };
1225607ca46eSDavid Howells 
1226607ca46eSDavid Howells /* CMDs currently supported */
12273f1ac7a7SDavid Decotigny #define ETHTOOL_GSET		0x00000001 /* DEPRECATED, Get settings.
12283f1ac7a7SDavid Decotigny 					    * Please use ETHTOOL_GLINKSETTINGS
12293f1ac7a7SDavid Decotigny 					    */
12303f1ac7a7SDavid Decotigny #define ETHTOOL_SSET		0x00000002 /* DEPRECATED, Set settings.
12313f1ac7a7SDavid Decotigny 					    * Please use ETHTOOL_SLINKSETTINGS
12323f1ac7a7SDavid Decotigny 					    */
1233607ca46eSDavid Howells #define ETHTOOL_GDRVINFO	0x00000003 /* Get driver info. */
1234607ca46eSDavid Howells #define ETHTOOL_GREGS		0x00000004 /* Get NIC registers. */
1235607ca46eSDavid Howells #define ETHTOOL_GWOL		0x00000005 /* Get wake-on-lan options. */
1236607ca46eSDavid Howells #define ETHTOOL_SWOL		0x00000006 /* Set wake-on-lan options. */
1237607ca46eSDavid Howells #define ETHTOOL_GMSGLVL		0x00000007 /* Get driver message level */
1238607ca46eSDavid Howells #define ETHTOOL_SMSGLVL		0x00000008 /* Set driver msg level. */
1239607ca46eSDavid Howells #define ETHTOOL_NWAY_RST	0x00000009 /* Restart autonegotiation. */
1240607ca46eSDavid Howells /* Get link status for host, i.e. whether the interface *and* the
1241607ca46eSDavid Howells  * physical port (if there is one) are up (ethtool_value). */
1242607ca46eSDavid Howells #define ETHTOOL_GLINK		0x0000000a
1243607ca46eSDavid Howells #define ETHTOOL_GEEPROM		0x0000000b /* Get EEPROM data */
1244607ca46eSDavid Howells #define ETHTOOL_SEEPROM		0x0000000c /* Set EEPROM data. */
1245607ca46eSDavid Howells #define ETHTOOL_GCOALESCE	0x0000000e /* Get coalesce config */
1246607ca46eSDavid Howells #define ETHTOOL_SCOALESCE	0x0000000f /* Set coalesce config. */
1247607ca46eSDavid Howells #define ETHTOOL_GRINGPARAM	0x00000010 /* Get ring parameters */
1248607ca46eSDavid Howells #define ETHTOOL_SRINGPARAM	0x00000011 /* Set ring parameters. */
1249607ca46eSDavid Howells #define ETHTOOL_GPAUSEPARAM	0x00000012 /* Get pause parameters */
1250607ca46eSDavid Howells #define ETHTOOL_SPAUSEPARAM	0x00000013 /* Set pause parameters. */
1251607ca46eSDavid Howells #define ETHTOOL_GRXCSUM		0x00000014 /* Get RX hw csum enable (ethtool_value) */
1252607ca46eSDavid Howells #define ETHTOOL_SRXCSUM		0x00000015 /* Set RX hw csum enable (ethtool_value) */
1253607ca46eSDavid Howells #define ETHTOOL_GTXCSUM		0x00000016 /* Get TX hw csum enable (ethtool_value) */
1254607ca46eSDavid Howells #define ETHTOOL_STXCSUM		0x00000017 /* Set TX hw csum enable (ethtool_value) */
1255607ca46eSDavid Howells #define ETHTOOL_GSG		0x00000018 /* Get scatter-gather enable
1256607ca46eSDavid Howells 					    * (ethtool_value) */
1257607ca46eSDavid Howells #define ETHTOOL_SSG		0x00000019 /* Set scatter-gather enable
1258607ca46eSDavid Howells 					    * (ethtool_value). */
1259607ca46eSDavid Howells #define ETHTOOL_TEST		0x0000001a /* execute NIC self-test. */
1260607ca46eSDavid Howells #define ETHTOOL_GSTRINGS	0x0000001b /* get specified string set */
1261607ca46eSDavid Howells #define ETHTOOL_PHYS_ID		0x0000001c /* identify the NIC */
1262607ca46eSDavid Howells #define ETHTOOL_GSTATS		0x0000001d /* get NIC-specific statistics */
1263607ca46eSDavid Howells #define ETHTOOL_GTSO		0x0000001e /* Get TSO enable (ethtool_value) */
1264607ca46eSDavid Howells #define ETHTOOL_STSO		0x0000001f /* Set TSO enable (ethtool_value) */
1265607ca46eSDavid Howells #define ETHTOOL_GPERMADDR	0x00000020 /* Get permanent hardware address */
1266607ca46eSDavid Howells #define ETHTOOL_GUFO		0x00000021 /* Get UFO enable (ethtool_value) */
1267607ca46eSDavid Howells #define ETHTOOL_SUFO		0x00000022 /* Set UFO enable (ethtool_value) */
1268607ca46eSDavid Howells #define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
1269607ca46eSDavid Howells #define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
1270607ca46eSDavid Howells #define ETHTOOL_GFLAGS		0x00000025 /* Get flags bitmap(ethtool_value) */
1271607ca46eSDavid Howells #define ETHTOOL_SFLAGS		0x00000026 /* Set flags bitmap(ethtool_value) */
1272607ca46eSDavid Howells #define ETHTOOL_GPFLAGS		0x00000027 /* Get driver-private flags bitmap */
1273607ca46eSDavid Howells #define ETHTOOL_SPFLAGS		0x00000028 /* Set driver-private flags bitmap */
1274607ca46eSDavid Howells 
1275607ca46eSDavid Howells #define ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */
1276607ca46eSDavid Howells #define ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */
1277607ca46eSDavid Howells #define ETHTOOL_GGRO		0x0000002b /* Get GRO enable (ethtool_value) */
1278607ca46eSDavid Howells #define ETHTOOL_SGRO		0x0000002c /* Set GRO enable (ethtool_value) */
1279607ca46eSDavid Howells #define ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */
1280607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */
1281607ca46eSDavid Howells #define ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */
1282607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */
1283607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */
1284607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
1285607ca46eSDavid Howells #define ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
1286607ca46eSDavid Howells #define ETHTOOL_RESET		0x00000034 /* Reset hardware */
1287607ca46eSDavid Howells #define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
1288607ca46eSDavid Howells #define ETHTOOL_GRXNTUPLE	0x00000036 /* deprecated */
1289607ca46eSDavid Howells #define ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */
1290607ca46eSDavid Howells #define ETHTOOL_GRXFHINDIR	0x00000038 /* Get RX flow hash indir'n table */
1291607ca46eSDavid Howells #define ETHTOOL_SRXFHINDIR	0x00000039 /* Set RX flow hash indir'n table */
1292607ca46eSDavid Howells 
1293607ca46eSDavid Howells #define ETHTOOL_GFEATURES	0x0000003a /* Get device offload settings */
1294607ca46eSDavid Howells #define ETHTOOL_SFEATURES	0x0000003b /* Change device offload settings */
1295607ca46eSDavid Howells #define ETHTOOL_GCHANNELS	0x0000003c /* Get no of channels */
1296607ca46eSDavid Howells #define ETHTOOL_SCHANNELS	0x0000003d /* Set no of channels */
1297607ca46eSDavid Howells #define ETHTOOL_SET_DUMP	0x0000003e /* Set dump settings */
1298607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_FLAG	0x0000003f /* Get dump settings */
1299607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_DATA	0x00000040 /* Get dump data */
1300607ca46eSDavid Howells #define ETHTOOL_GET_TS_INFO	0x00000041 /* Get time stamping and PHC info */
1301607ca46eSDavid Howells #define ETHTOOL_GMODULEINFO	0x00000042 /* Get plug-in module information */
1302607ca46eSDavid Howells #define ETHTOOL_GMODULEEEPROM	0x00000043 /* Get plug-in module eeprom */
1303607ca46eSDavid Howells #define ETHTOOL_GEEE		0x00000044 /* Get EEE settings */
1304607ca46eSDavid Howells #define ETHTOOL_SEEE		0x00000045 /* Set EEE settings */
1305607ca46eSDavid Howells 
13063de0b592SVenkata Duvvuru #define ETHTOOL_GRSSH		0x00000046 /* Get RX flow hash configuration */
13073de0b592SVenkata Duvvuru #define ETHTOOL_SRSSH		0x00000047 /* Set RX flow hash configuration */
1308f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_GTUNABLE	0x00000048 /* Get tunable configuration */
1309f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_STUNABLE	0x00000049 /* Set tunable configuration */
1310f3a40945SAndrew Lunn #define ETHTOOL_GPHYSTATS	0x0000004a /* get PHY-specific statistics */
13113de0b592SVenkata Duvvuru 
1312ac2c7ad0SKan Liang #define ETHTOOL_PERQUEUE	0x0000004b /* Set per queue options */
1313ac2c7ad0SKan Liang 
13143f1ac7a7SDavid Decotigny #define ETHTOOL_GLINKSETTINGS	0x0000004c /* Get ethtool_link_settings */
13153f1ac7a7SDavid Decotigny #define ETHTOOL_SLINKSETTINGS	0x0000004d /* Set ethtool_link_settings */
13163f1ac7a7SDavid Decotigny 
13173f1ac7a7SDavid Decotigny 
1318607ca46eSDavid Howells /* compatibility with older code */
1319607ca46eSDavid Howells #define SPARC_ETH_GSET		ETHTOOL_GSET
1320607ca46eSDavid Howells #define SPARC_ETH_SSET		ETHTOOL_SSET
1321607ca46eSDavid Howells 
13223f1ac7a7SDavid Decotigny /* Link mode bit indices */
13233f1ac7a7SDavid Decotigny enum ethtool_link_mode_bit_indices {
13243f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_10baseT_Half_BIT	= 0,
13253f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_10baseT_Full_BIT	= 1,
13263f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_100baseT_Half_BIT	= 2,
13273f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_100baseT_Full_BIT	= 3,
13283f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_1000baseT_Half_BIT	= 4,
13293f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_1000baseT_Full_BIT	= 5,
13303f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_Autoneg_BIT		= 6,
13313f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_TP_BIT		= 7,
13323f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_AUI_BIT		= 8,
13333f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_MII_BIT		= 9,
13343f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_FIBRE_BIT		= 10,
13353f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_BNC_BIT		= 11,
13363f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_10000baseT_Full_BIT	= 12,
13373f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_Pause_BIT		= 13,
13383f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_Asym_Pause_BIT	= 14,
13393f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_2500baseX_Full_BIT	= 15,
13403f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_Backplane_BIT		= 16,
13413f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_1000baseKX_Full_BIT	= 17,
13423f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT	= 18,
13433f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_10000baseKR_Full_BIT	= 19,
13443f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_10000baseR_FEC_BIT	= 20,
13453f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
13463f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT	= 22,
13473f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT	= 23,
13483f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT	= 24,
13493f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT	= 25,
13503f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT	= 26,
13513f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT	= 27,
13523f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT	= 28,
13533f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT	= 29,
13543f1ac7a7SDavid Decotigny 	ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT	= 30,
13553851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_25000baseCR_Full_BIT	= 31,
13563851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_25000baseKR_Full_BIT	= 32,
13573851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_25000baseSR_Full_BIT	= 33,
13583851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT	= 34,
13593851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT	= 35,
13603851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT	= 36,
13613851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT	= 37,
13623851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT	= 38,
13633851112eSVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT	= 39,
136489da45b8SGal Pressman 	ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT		= 40,
13655711a982SVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_1000baseX_Full_BIT	= 41,
13665711a982SVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_10000baseCR_Full_BIT	= 42,
13675711a982SVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_10000baseSR_Full_BIT	= 43,
13685711a982SVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_10000baseLR_Full_BIT	= 44,
13695711a982SVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT	= 45,
13705711a982SVidya Sagar Ravipati 	ETHTOOL_LINK_MODE_10000baseER_Full_BIT	= 46,
13715711a982SVidya Sagar Ravipati 
1372607ca46eSDavid Howells 
13733f1ac7a7SDavid Decotigny 	/* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
13743f1ac7a7SDavid Decotigny 	 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
13753f1ac7a7SDavid Decotigny 	 * macro for bits > 31. The only way to use indices > 31 is to
13763f1ac7a7SDavid Decotigny 	 * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
13773f1ac7a7SDavid Decotigny 	 */
13783f1ac7a7SDavid Decotigny 
13793f1ac7a7SDavid Decotigny 	__ETHTOOL_LINK_MODE_LAST
13805711a982SVidya Sagar Ravipati 	  = ETHTOOL_LINK_MODE_10000baseER_Full_BIT,
13813f1ac7a7SDavid Decotigny };
13823f1ac7a7SDavid Decotigny 
13833f1ac7a7SDavid Decotigny #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name)	\
13843f1ac7a7SDavid Decotigny 	(1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
13853f1ac7a7SDavid Decotigny 
13863f1ac7a7SDavid Decotigny /* DEPRECATED macros. Please migrate to
13873f1ac7a7SDavid Decotigny  * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
13883f1ac7a7SDavid Decotigny  * define any new SUPPORTED_* macro for bits > 31.
13893f1ac7a7SDavid Decotigny  */
13903f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Half		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
13913f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Full		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
13923f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Half		__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
13933f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Full		__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
13943f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Half	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
13953f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
13963f1ac7a7SDavid Decotigny #define SUPPORTED_Autoneg		__ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
13973f1ac7a7SDavid Decotigny #define SUPPORTED_TP			__ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
13983f1ac7a7SDavid Decotigny #define SUPPORTED_AUI			__ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
13993f1ac7a7SDavid Decotigny #define SUPPORTED_MII			__ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
14003f1ac7a7SDavid Decotigny #define SUPPORTED_FIBRE			__ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
14013f1ac7a7SDavid Decotigny #define SUPPORTED_BNC			__ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
14023f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
14033f1ac7a7SDavid Decotigny #define SUPPORTED_Pause			__ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
14043f1ac7a7SDavid Decotigny #define SUPPORTED_Asym_Pause		__ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
14053f1ac7a7SDavid Decotigny #define SUPPORTED_2500baseX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
14063f1ac7a7SDavid Decotigny #define SUPPORTED_Backplane		__ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
14073f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseKX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
14083f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKX4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
14093f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKR_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
14103f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseR_FEC	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
14113f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseMLD2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
14123f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseKR2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
14133f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
14143f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
14153f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
14163f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
14173f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
14183f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
14193f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
14203f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
14213f1ac7a7SDavid Decotigny /* Please do not define any new SUPPORTED_* macro for bits > 31, see
14223f1ac7a7SDavid Decotigny  * notice above.
14233f1ac7a7SDavid Decotigny  */
14243f1ac7a7SDavid Decotigny 
14253f1ac7a7SDavid Decotigny /*
14263f1ac7a7SDavid Decotigny  * DEPRECATED macros. Please migrate to
14273f1ac7a7SDavid Decotigny  * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
14283f1ac7a7SDavid Decotigny  * define any new ADERTISE_* macro for bits > 31.
14293f1ac7a7SDavid Decotigny  */
14303f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Half		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
14313f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Full		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
14323f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Half	__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
14333f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
14343f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Half	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
14353f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
14363f1ac7a7SDavid Decotigny #define ADVERTISED_Autoneg		__ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
14373f1ac7a7SDavid Decotigny #define ADVERTISED_TP			__ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
14383f1ac7a7SDavid Decotigny #define ADVERTISED_AUI			__ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
14393f1ac7a7SDavid Decotigny #define ADVERTISED_MII			__ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
14403f1ac7a7SDavid Decotigny #define ADVERTISED_FIBRE		__ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
14413f1ac7a7SDavid Decotigny #define ADVERTISED_BNC			__ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
14423f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
14433f1ac7a7SDavid Decotigny #define ADVERTISED_Pause		__ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
14443f1ac7a7SDavid Decotigny #define ADVERTISED_Asym_Pause		__ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
14453f1ac7a7SDavid Decotigny #define ADVERTISED_2500baseX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
14463f1ac7a7SDavid Decotigny #define ADVERTISED_Backplane		__ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
14473f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseKX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
14483f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKX4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
14493f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKR_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
14503f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseR_FEC	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
14513f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseMLD2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
14523f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseKR2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
14533f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
14543f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
14553f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
14563f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
14573f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
14583f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
14593f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
14603f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
14613f1ac7a7SDavid Decotigny /* Please do not define any new ADVERTISED_* macro for bits > 31, see
14623f1ac7a7SDavid Decotigny  * notice above.
14633f1ac7a7SDavid Decotigny  */
1464607ca46eSDavid Howells 
1465607ca46eSDavid Howells /* The following are all involved in forcing a particular link
1466607ca46eSDavid Howells  * mode for the device for setting things.  When getting the
1467607ca46eSDavid Howells  * devices settings, these indicate the current mode and whether
1468607ca46eSDavid Howells  * it was forced up into this mode or autonegotiated.
1469607ca46eSDavid Howells  */
1470607ca46eSDavid Howells 
14714456ed04SMichael S. Tsirkin /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
1472607ca46eSDavid Howells #define SPEED_10		10
1473607ca46eSDavid Howells #define SPEED_100		100
1474607ca46eSDavid Howells #define SPEED_1000		1000
1475607ca46eSDavid Howells #define SPEED_2500		2500
1476c9a70d43SParav Pandit #define SPEED_5000		5000
1477607ca46eSDavid Howells #define SPEED_10000		10000
1478dcf972a3SSaeed Mahameed #define SPEED_20000		20000
1479c9a70d43SParav Pandit #define SPEED_25000		25000
1480dcf972a3SSaeed Mahameed #define SPEED_40000		40000
1481c9a70d43SParav Pandit #define SPEED_50000		50000
1482dcf972a3SSaeed Mahameed #define SPEED_56000		56000
1483c9a70d43SParav Pandit #define SPEED_100000		100000
1484dcf972a3SSaeed Mahameed 
1485607ca46eSDavid Howells #define SPEED_UNKNOWN		-1
1486607ca46eSDavid Howells 
1487103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_speed(__u32 speed)
1488103a8ad1SNikolay Aleksandrov {
1489e02564eeSNikolay Aleksandrov 	return speed <= INT_MAX || speed == SPEED_UNKNOWN;
1490103a8ad1SNikolay Aleksandrov }
1491103a8ad1SNikolay Aleksandrov 
1492607ca46eSDavid Howells /* Duplex, half or full. */
1493607ca46eSDavid Howells #define DUPLEX_HALF		0x00
1494607ca46eSDavid Howells #define DUPLEX_FULL		0x01
1495607ca46eSDavid Howells #define DUPLEX_UNKNOWN		0xff
1496607ca46eSDavid Howells 
1497103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_duplex(__u8 duplex)
1498103a8ad1SNikolay Aleksandrov {
1499103a8ad1SNikolay Aleksandrov 	switch (duplex) {
1500103a8ad1SNikolay Aleksandrov 	case DUPLEX_HALF:
1501103a8ad1SNikolay Aleksandrov 	case DUPLEX_FULL:
1502103a8ad1SNikolay Aleksandrov 	case DUPLEX_UNKNOWN:
1503103a8ad1SNikolay Aleksandrov 		return 1;
1504103a8ad1SNikolay Aleksandrov 	}
1505103a8ad1SNikolay Aleksandrov 
1506103a8ad1SNikolay Aleksandrov 	return 0;
1507103a8ad1SNikolay Aleksandrov }
1508103a8ad1SNikolay Aleksandrov 
1509607ca46eSDavid Howells /* Which connector port. */
1510607ca46eSDavid Howells #define PORT_TP			0x00
1511607ca46eSDavid Howells #define PORT_AUI		0x01
1512607ca46eSDavid Howells #define PORT_MII		0x02
1513607ca46eSDavid Howells #define PORT_FIBRE		0x03
1514607ca46eSDavid Howells #define PORT_BNC		0x04
1515607ca46eSDavid Howells #define PORT_DA			0x05
1516607ca46eSDavid Howells #define PORT_NONE		0xef
1517607ca46eSDavid Howells #define PORT_OTHER		0xff
1518607ca46eSDavid Howells 
1519607ca46eSDavid Howells /* Which transceiver to use. */
15207ec87211SFlorian Fainelli #define XCVR_INTERNAL		0x00 /* PHY and MAC are in the same package */
15217ec87211SFlorian Fainelli #define XCVR_EXTERNAL		0x01 /* PHY and MAC are in different packages */
1522607ca46eSDavid Howells #define XCVR_DUMMY1		0x02
1523607ca46eSDavid Howells #define XCVR_DUMMY2		0x03
1524607ca46eSDavid Howells #define XCVR_DUMMY3		0x04
1525607ca46eSDavid Howells 
1526bf8fc60aSBen Hutchings /* Enable or disable autonegotiation. */
1527607ca46eSDavid Howells #define AUTONEG_DISABLE		0x00
1528607ca46eSDavid Howells #define AUTONEG_ENABLE		0x01
1529607ca46eSDavid Howells 
1530607ca46eSDavid Howells /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
1531607ca46eSDavid Howells  * the driver is required to renegotiate link
1532607ca46eSDavid Howells  */
1533607ca46eSDavid Howells #define ETH_TP_MDI_INVALID	0x00 /* status: unknown; control: unsupported */
1534607ca46eSDavid Howells #define ETH_TP_MDI		0x01 /* status: MDI;     control: force MDI */
1535607ca46eSDavid Howells #define ETH_TP_MDI_X		0x02 /* status: MDI-X;   control: force MDI-X */
1536607ca46eSDavid Howells #define ETH_TP_MDI_AUTO		0x03 /*                  control: auto-select */
1537607ca46eSDavid Howells 
1538607ca46eSDavid Howells /* Wake-On-Lan options. */
1539607ca46eSDavid Howells #define WAKE_PHY		(1 << 0)
1540607ca46eSDavid Howells #define WAKE_UCAST		(1 << 1)
1541607ca46eSDavid Howells #define WAKE_MCAST		(1 << 2)
1542607ca46eSDavid Howells #define WAKE_BCAST		(1 << 3)
1543607ca46eSDavid Howells #define WAKE_ARP		(1 << 4)
1544607ca46eSDavid Howells #define WAKE_MAGIC		(1 << 5)
1545607ca46eSDavid Howells #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
1546607ca46eSDavid Howells 
1547607ca46eSDavid Howells /* L2-L4 network traffic flow types */
1548607ca46eSDavid Howells #define	TCP_V4_FLOW	0x01	/* hash or spec (tcp_ip4_spec) */
1549607ca46eSDavid Howells #define	UDP_V4_FLOW	0x02	/* hash or spec (udp_ip4_spec) */
1550607ca46eSDavid Howells #define	SCTP_V4_FLOW	0x03	/* hash or spec (sctp_ip4_spec) */
1551607ca46eSDavid Howells #define	AH_ESP_V4_FLOW	0x04	/* hash only */
155272bb6872SEdward Cree #define	TCP_V6_FLOW	0x05	/* hash or spec (tcp_ip6_spec; nfc only) */
155372bb6872SEdward Cree #define	UDP_V6_FLOW	0x06	/* hash or spec (udp_ip6_spec; nfc only) */
155472bb6872SEdward Cree #define	SCTP_V6_FLOW	0x07	/* hash or spec (sctp_ip6_spec; nfc only) */
1555607ca46eSDavid Howells #define	AH_ESP_V6_FLOW	0x08	/* hash only */
1556607ca46eSDavid Howells #define	AH_V4_FLOW	0x09	/* hash or spec (ah_ip4_spec) */
1557607ca46eSDavid Howells #define	ESP_V4_FLOW	0x0a	/* hash or spec (esp_ip4_spec) */
155872bb6872SEdward Cree #define	AH_V6_FLOW	0x0b	/* hash or spec (ah_ip6_spec; nfc only) */
155972bb6872SEdward Cree #define	ESP_V6_FLOW	0x0c	/* hash or spec (esp_ip6_spec; nfc only) */
156072bb6872SEdward Cree #define	IPV4_USER_FLOW	0x0d	/* spec only (usr_ip4_spec) */
156172bb6872SEdward Cree #define	IP_USER_FLOW	IPV4_USER_FLOW
156272bb6872SEdward Cree #define	IPV6_USER_FLOW	0x0e	/* spec only (usr_ip6_spec; nfc only) */
1563607ca46eSDavid Howells #define	IPV4_FLOW	0x10	/* hash only */
1564607ca46eSDavid Howells #define	IPV6_FLOW	0x11	/* hash only */
1565607ca46eSDavid Howells #define	ETHER_FLOW	0x12	/* spec only (ether_spec) */
1566607ca46eSDavid Howells /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1567607ca46eSDavid Howells #define	FLOW_EXT	0x80000000
1568d4676eacSYan Burman #define	FLOW_MAC_EXT	0x40000000
1569607ca46eSDavid Howells 
1570607ca46eSDavid Howells /* L3-L4 network traffic flow hash options */
1571607ca46eSDavid Howells #define	RXH_L2DA	(1 << 1)
1572607ca46eSDavid Howells #define	RXH_VLAN	(1 << 2)
1573607ca46eSDavid Howells #define	RXH_L3_PROTO	(1 << 3)
1574607ca46eSDavid Howells #define	RXH_IP_SRC	(1 << 4)
1575607ca46eSDavid Howells #define	RXH_IP_DST	(1 << 5)
1576607ca46eSDavid Howells #define	RXH_L4_B_0_1	(1 << 6) /* src port in case of TCP/UDP/SCTP */
1577607ca46eSDavid Howells #define	RXH_L4_B_2_3	(1 << 7) /* dst port in case of TCP/UDP/SCTP */
1578607ca46eSDavid Howells #define	RXH_DISCARD	(1 << 31)
1579607ca46eSDavid Howells 
1580607ca46eSDavid Howells #define	RX_CLS_FLOW_DISC	0xffffffffffffffffULL
1581607ca46eSDavid Howells 
1582607ca46eSDavid Howells /* Special RX classification rule insert location values */
1583607ca46eSDavid Howells #define RX_CLS_LOC_SPECIAL	0x80000000	/* flag */
1584607ca46eSDavid Howells #define RX_CLS_LOC_ANY		0xffffffff
1585607ca46eSDavid Howells #define RX_CLS_LOC_FIRST	0xfffffffe
1586607ca46eSDavid Howells #define RX_CLS_LOC_LAST		0xfffffffd
1587607ca46eSDavid Howells 
1588607ca46eSDavid Howells /* EEPROM Standards for plug in modules */
1589607ca46eSDavid Howells #define ETH_MODULE_SFF_8079		0x1
1590607ca46eSDavid Howells #define ETH_MODULE_SFF_8079_LEN		256
1591607ca46eSDavid Howells #define ETH_MODULE_SFF_8472		0x2
1592607ca46eSDavid Howells #define ETH_MODULE_SFF_8472_LEN		512
15937202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636		0x3
15947202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636_LEN		256
15957202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436		0x4
15967202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436_LEN		256
1597607ca46eSDavid Howells 
1598607ca46eSDavid Howells /* Reset flags */
1599607ca46eSDavid Howells /* The reset() operation must clear the flags for the components which
1600607ca46eSDavid Howells  * were actually reset.  On successful return, the flags indicate the
1601607ca46eSDavid Howells  * components which were not reset, either because they do not exist
1602607ca46eSDavid Howells  * in the hardware or because they cannot be reset independently.  The
1603607ca46eSDavid Howells  * driver must never reset any components that were not requested.
1604607ca46eSDavid Howells  */
1605607ca46eSDavid Howells enum ethtool_reset_flags {
1606607ca46eSDavid Howells 	/* These flags represent components dedicated to the interface
1607607ca46eSDavid Howells 	 * the command is addressed to.  Shift any flag left by
1608607ca46eSDavid Howells 	 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
1609607ca46eSDavid Howells 	 * same type.
1610607ca46eSDavid Howells 	 */
1611607ca46eSDavid Howells 	ETH_RESET_MGMT		= 1 << 0,	/* Management processor */
1612607ca46eSDavid Howells 	ETH_RESET_IRQ		= 1 << 1,	/* Interrupt requester */
1613607ca46eSDavid Howells 	ETH_RESET_DMA		= 1 << 2,	/* DMA engine */
1614607ca46eSDavid Howells 	ETH_RESET_FILTER	= 1 << 3,	/* Filtering/flow direction */
1615607ca46eSDavid Howells 	ETH_RESET_OFFLOAD	= 1 << 4,	/* Protocol offload */
1616607ca46eSDavid Howells 	ETH_RESET_MAC		= 1 << 5,	/* Media access controller */
1617607ca46eSDavid Howells 	ETH_RESET_PHY		= 1 << 6,	/* Transceiver/PHY */
1618607ca46eSDavid Howells 	ETH_RESET_RAM		= 1 << 7,	/* RAM shared between
1619607ca46eSDavid Howells 						 * multiple components */
1620607ca46eSDavid Howells 
1621607ca46eSDavid Howells 	ETH_RESET_DEDICATED	= 0x0000ffff,	/* All components dedicated to
1622607ca46eSDavid Howells 						 * this interface */
1623607ca46eSDavid Howells 	ETH_RESET_ALL		= 0xffffffff,	/* All components used by this
1624607ca46eSDavid Howells 						 * interface, even if shared */
1625607ca46eSDavid Howells };
1626607ca46eSDavid Howells #define ETH_RESET_SHARED_SHIFT	16
1627607ca46eSDavid Howells 
16283f1ac7a7SDavid Decotigny 
16293f1ac7a7SDavid Decotigny /**
16303f1ac7a7SDavid Decotigny  * struct ethtool_link_settings - link control and status
16313f1ac7a7SDavid Decotigny  *
16323f1ac7a7SDavid Decotigny  * IMPORTANT, Backward compatibility notice: When implementing new
16333f1ac7a7SDavid Decotigny  *	user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
16343f1ac7a7SDavid Decotigny  *	if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
16353f1ac7a7SDavid Decotigny  *	settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
16363f1ac7a7SDavid Decotigny  *	succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
16373f1ac7a7SDavid Decotigny  *	that case.  Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
16383f1ac7a7SDavid Decotigny  *	%ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
16393f1ac7a7SDavid Decotigny  *	settings; do not use %ETHTOOL_SLINKSETTINGS if
16403f1ac7a7SDavid Decotigny  *	%ETHTOOL_GLINKSETTINGS failed: stick to
16413f1ac7a7SDavid Decotigny  *	%ETHTOOL_GSET/%ETHTOOL_SSET in that case.
16423f1ac7a7SDavid Decotigny  *
16433f1ac7a7SDavid Decotigny  * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
16443f1ac7a7SDavid Decotigny  * @speed: Link speed (Mbps)
16453f1ac7a7SDavid Decotigny  * @duplex: Duplex mode; one of %DUPLEX_*
16463f1ac7a7SDavid Decotigny  * @port: Physical connector type; one of %PORT_*
16473f1ac7a7SDavid Decotigny  * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
16483f1ac7a7SDavid Decotigny  *	applicable.  For clause 45 PHYs this is the PRTAD.
16493f1ac7a7SDavid Decotigny  * @autoneg: Enable/disable autonegotiation and auto-detection;
16503f1ac7a7SDavid Decotigny  *	either %AUTONEG_DISABLE or %AUTONEG_ENABLE
16513f1ac7a7SDavid Decotigny  * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
16523f1ac7a7SDavid Decotigny  *	protocols supported by the interface; 0 if unknown.
16533f1ac7a7SDavid Decotigny  *	Read-only.
16543f1ac7a7SDavid Decotigny  * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
16553f1ac7a7SDavid Decotigny  *	%ETH_TP_MDI_*.  If the status is unknown or not applicable, the
16563f1ac7a7SDavid Decotigny  *	value will be %ETH_TP_MDI_INVALID.  Read-only.
16573f1ac7a7SDavid Decotigny  * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
16583f1ac7a7SDavid Decotigny  *	%ETH_TP_MDI_*.  If MDI(-X) control is not implemented, reads
16593f1ac7a7SDavid Decotigny  *	yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
16603f1ac7a7SDavid Decotigny  *	When written successfully, the link should be renegotiated if
16613f1ac7a7SDavid Decotigny  *	necessary.
16623f1ac7a7SDavid Decotigny  * @link_mode_masks_nwords: Number of 32-bit words for each of the
16633f1ac7a7SDavid Decotigny  *	supported, advertising, lp_advertising link mode bitmaps. For
16643f1ac7a7SDavid Decotigny  *	%ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
16653f1ac7a7SDavid Decotigny  *	(>= 0); on return, if handshake in progress, negative if
16663f1ac7a7SDavid Decotigny  *	request size unsupported by kernel: absolute value indicates
16675f2d4724SDavid Decotigny  *	kernel expected size and all the other fields but cmd
16685f2d4724SDavid Decotigny  *	are 0; otherwise (handshake completed), strictly positive
16695f2d4724SDavid Decotigny  *	to indicate size used by kernel and cmd field stays
16703f1ac7a7SDavid Decotigny  *	%ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
16713f1ac7a7SDavid Decotigny  *	%ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
16723f1ac7a7SDavid Decotigny  *	value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
16733f1ac7a7SDavid Decotigny  *	refused. For drivers: ignore this field (use kernel's
16743f1ac7a7SDavid Decotigny  *	__ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
16753f1ac7a7SDavid Decotigny  *	be overwritten by kernel.
16763f1ac7a7SDavid Decotigny  * @supported: Bitmap with each bit meaning given by
16773f1ac7a7SDavid Decotigny  *	%ethtool_link_mode_bit_indices for the link modes, physical
16783f1ac7a7SDavid Decotigny  *	connectors and other link features for which the interface
16793f1ac7a7SDavid Decotigny  *	supports autonegotiation or auto-detection.  Read-only.
16803f1ac7a7SDavid Decotigny  * @advertising: Bitmap with each bit meaning given by
16813f1ac7a7SDavid Decotigny  *	%ethtool_link_mode_bit_indices for the link modes, physical
16823f1ac7a7SDavid Decotigny  *	connectors and other link features that are advertised through
16833f1ac7a7SDavid Decotigny  *	autonegotiation or enabled for auto-detection.
16843f1ac7a7SDavid Decotigny  * @lp_advertising: Bitmap with each bit meaning given by
16853f1ac7a7SDavid Decotigny  *	%ethtool_link_mode_bit_indices for the link modes, and other
16863f1ac7a7SDavid Decotigny  *	link features that the link partner advertised through
16873f1ac7a7SDavid Decotigny  *	autonegotiation; 0 if unknown or not applicable.  Read-only.
16883f1ac7a7SDavid Decotigny  *
16893f1ac7a7SDavid Decotigny  * If autonegotiation is disabled, the speed and @duplex represent the
16903f1ac7a7SDavid Decotigny  * fixed link mode and are writable if the driver supports multiple
16913f1ac7a7SDavid Decotigny  * link modes.  If it is enabled then they are read-only; if the link
16923f1ac7a7SDavid Decotigny  * is up they represent the negotiated link mode; if the link is down,
16933f1ac7a7SDavid Decotigny  * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
16943f1ac7a7SDavid Decotigny  * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
16953f1ac7a7SDavid Decotigny  *
16963f1ac7a7SDavid Decotigny  * Some hardware interfaces may have multiple PHYs and/or physical
16973f1ac7a7SDavid Decotigny  * connectors fitted or do not allow the driver to detect which are
16983f1ac7a7SDavid Decotigny  * fitted.  For these interfaces @port and/or @phy_address may be
16993f1ac7a7SDavid Decotigny  * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
17003f1ac7a7SDavid Decotigny  * Otherwise, attempts to write different values may be ignored or
17013f1ac7a7SDavid Decotigny  * rejected.
17023f1ac7a7SDavid Decotigny  *
17033f1ac7a7SDavid Decotigny  * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
17043f1ac7a7SDavid Decotigny  * are not available in %ethtool_link_settings. Until all drivers are
17053f1ac7a7SDavid Decotigny  * converted to ignore them or to the new %ethtool_link_settings API,
17063f1ac7a7SDavid Decotigny  * for both queries and changes, users should always try
17073f1ac7a7SDavid Decotigny  * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
17083f1ac7a7SDavid Decotigny  * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
17093f1ac7a7SDavid Decotigny  * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
17103f1ac7a7SDavid Decotigny  * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
17113f1ac7a7SDavid Decotigny  * either %ethtool_cmd or %ethtool_link_settings).
17123f1ac7a7SDavid Decotigny  *
17133f1ac7a7SDavid Decotigny  * Users should assume that all fields not marked read-only are
17143f1ac7a7SDavid Decotigny  * writable and subject to validation by the driver.  They should use
17153f1ac7a7SDavid Decotigny  * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
17163f1ac7a7SDavid Decotigny  * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
17173f1ac7a7SDavid Decotigny  *
17183f1ac7a7SDavid Decotigny  * Drivers that implement %get_link_ksettings and/or
17193f1ac7a7SDavid Decotigny  * %set_link_ksettings should ignore the @cmd
17203f1ac7a7SDavid Decotigny  * and @link_mode_masks_nwords fields (any change to them overwritten
17213f1ac7a7SDavid Decotigny  * by kernel), and rely only on kernel's internal
17223f1ac7a7SDavid Decotigny  * %__ETHTOOL_LINK_MODE_MASK_NBITS and
17233f1ac7a7SDavid Decotigny  * %ethtool_link_mode_mask_t. Drivers that implement
17243f1ac7a7SDavid Decotigny  * %set_link_ksettings() should validate all fields other than @cmd
17253f1ac7a7SDavid Decotigny  * and @link_mode_masks_nwords that are not described as read-only or
17263f1ac7a7SDavid Decotigny  * deprecated, and must ignore all fields described as read-only.
17273f1ac7a7SDavid Decotigny  */
17283f1ac7a7SDavid Decotigny struct ethtool_link_settings {
17293f1ac7a7SDavid Decotigny 	__u32	cmd;
17303f1ac7a7SDavid Decotigny 	__u32	speed;
17313f1ac7a7SDavid Decotigny 	__u8	duplex;
17323f1ac7a7SDavid Decotigny 	__u8	port;
17333f1ac7a7SDavid Decotigny 	__u8	phy_address;
17343f1ac7a7SDavid Decotigny 	__u8	autoneg;
17353f1ac7a7SDavid Decotigny 	__u8	mdio_support;
17363f1ac7a7SDavid Decotigny 	__u8	eth_tp_mdix;
17373f1ac7a7SDavid Decotigny 	__u8	eth_tp_mdix_ctrl;
17383f1ac7a7SDavid Decotigny 	__s8	link_mode_masks_nwords;
17393f1ac7a7SDavid Decotigny 	__u32	reserved[8];
17403f1ac7a7SDavid Decotigny 	__u32	link_mode_masks[0];
17413f1ac7a7SDavid Decotigny 	/* layout of link_mode_masks fields:
17423f1ac7a7SDavid Decotigny 	 * __u32 map_supported[link_mode_masks_nwords];
17433f1ac7a7SDavid Decotigny 	 * __u32 map_advertising[link_mode_masks_nwords];
17443f1ac7a7SDavid Decotigny 	 * __u32 map_lp_advertising[link_mode_masks_nwords];
17453f1ac7a7SDavid Decotigny 	 */
17463f1ac7a7SDavid Decotigny };
1747607ca46eSDavid Howells #endif /* _UAPI_LINUX_ETHTOOL_H */
1748