16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells * ethtool.h: Defines for Linux ethtool.
4607ca46eSDavid Howells *
5607ca46eSDavid Howells * Copyright (C) 1998 David S. Miller ([email protected])
6607ca46eSDavid Howells * Copyright 2001 Jeff Garzik <[email protected]>
7607ca46eSDavid Howells * Portions Copyright 2001 Sun Microsystems ([email protected])
8607ca46eSDavid Howells * Portions Copyright 2002 Intel ([email protected],
9607ca46eSDavid Howells * [email protected],
10607ca46eSDavid Howells * [email protected])
11607ca46eSDavid Howells * Portions Copyright (C) Sun Microsystems 2008
12607ca46eSDavid Howells */
13607ca46eSDavid Howells
14607ca46eSDavid Howells #ifndef _UAPI_LINUX_ETHTOOL_H
15607ca46eSDavid Howells #define _UAPI_LINUX_ETHTOOL_H
16607ca46eSDavid Howells
17a85cbe61SPetr Vorel #include <linux/const.h>
18607ca46eSDavid Howells #include <linux/types.h>
19607ca46eSDavid Howells #include <linux/if_ether.h>
20607ca46eSDavid Howells
2114e20379SNicolas Dichtel #ifndef __KERNEL__
2214e20379SNicolas Dichtel #include <limits.h> /* for INT_MAX */
2314e20379SNicolas Dichtel #endif
2414e20379SNicolas Dichtel
25bf8fc60aSBen Hutchings /* All structures exposed to userland should be defined such that they
26bf8fc60aSBen Hutchings * have the same layout for 32-bit and 64-bit userland.
27bf8fc60aSBen Hutchings */
28bf8fc60aSBen Hutchings
2983e5feebSJakub Kicinski /* Note on reserved space.
3083e5feebSJakub Kicinski * Reserved fields must not be accessed directly by user space because
3183e5feebSJakub Kicinski * they may be replaced by a different field in the future. They must
3283e5feebSJakub Kicinski * be initialized to zero before making the request, e.g. via memset
3383e5feebSJakub Kicinski * of the entire structure or implicitly by not being set in a structure
3483e5feebSJakub Kicinski * initializer.
3583e5feebSJakub Kicinski */
3683e5feebSJakub Kicinski
37bf8fc60aSBen Hutchings /**
383f1ac7a7SDavid Decotigny * struct ethtool_cmd - DEPRECATED, link control and status
393f1ac7a7SDavid Decotigny * This structure is DEPRECATED, please use struct ethtool_link_settings.
40bf8fc60aSBen Hutchings * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
41bf8fc60aSBen Hutchings * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
42bf8fc60aSBen Hutchings * physical connectors and other link features for which the
43bf8fc60aSBen Hutchings * interface supports autonegotiation or auto-detection.
44bf8fc60aSBen Hutchings * Read-only.
45bf8fc60aSBen Hutchings * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
46bf8fc60aSBen Hutchings * physical connectors and other link features that are
47bf8fc60aSBen Hutchings * advertised through autonegotiation or enabled for
48bf8fc60aSBen Hutchings * auto-detection.
494456ed04SMichael S. Tsirkin * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
50bf8fc60aSBen Hutchings * @duplex: Duplex mode; one of %DUPLEX_*
51bf8fc60aSBen Hutchings * @port: Physical connector type; one of %PORT_*
52bf8fc60aSBen Hutchings * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
53bf8fc60aSBen Hutchings * applicable. For clause 45 PHYs this is the PRTAD.
54bf8fc60aSBen Hutchings * @transceiver: Historically used to distinguish different possible
55bf8fc60aSBen Hutchings * PHY types, but not in a consistent way. Deprecated.
56bf8fc60aSBen Hutchings * @autoneg: Enable/disable autonegotiation and auto-detection;
57bf8fc60aSBen Hutchings * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
58bf8fc60aSBen Hutchings * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
59bf8fc60aSBen Hutchings * protocols supported by the interface; 0 if unknown.
60bf8fc60aSBen Hutchings * Read-only.
61bf8fc60aSBen Hutchings * @maxtxpkt: Historically used to report TX IRQ coalescing; now
62bf8fc60aSBen Hutchings * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
63bf8fc60aSBen Hutchings * @maxrxpkt: Historically used to report RX IRQ coalescing; now
64bf8fc60aSBen Hutchings * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
654456ed04SMichael S. Tsirkin * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
66bf8fc60aSBen Hutchings * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
67bf8fc60aSBen Hutchings * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
68bf8fc60aSBen Hutchings * value will be %ETH_TP_MDI_INVALID. Read-only.
69bf8fc60aSBen Hutchings * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
70bf8fc60aSBen Hutchings * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
71bf8fc60aSBen Hutchings * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
72bf8fc60aSBen Hutchings * When written successfully, the link should be renegotiated if
73bf8fc60aSBen Hutchings * necessary.
74bf8fc60aSBen Hutchings * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
75bf8fc60aSBen Hutchings * and other link features that the link partner advertised
76bf8fc60aSBen Hutchings * through autonegotiation; 0 if unknown or not applicable.
77bf8fc60aSBen Hutchings * Read-only.
7883e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space.
79bf8fc60aSBen Hutchings *
80bf8fc60aSBen Hutchings * The link speed in Mbps is split between @speed and @speed_hi. Use
81bf8fc60aSBen Hutchings * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
82bf8fc60aSBen Hutchings * access it.
83bf8fc60aSBen Hutchings *
84bf8fc60aSBen Hutchings * If autonegotiation is disabled, the speed and @duplex represent the
85bf8fc60aSBen Hutchings * fixed link mode and are writable if the driver supports multiple
86bf8fc60aSBen Hutchings * link modes. If it is enabled then they are read-only; if the link
87bf8fc60aSBen Hutchings * is up they represent the negotiated link mode; if the link is down,
88bf8fc60aSBen Hutchings * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
89bf8fc60aSBen Hutchings * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
90bf8fc60aSBen Hutchings *
91bf8fc60aSBen Hutchings * Some hardware interfaces may have multiple PHYs and/or physical
92bf8fc60aSBen Hutchings * connectors fitted or do not allow the driver to detect which are
93bf8fc60aSBen Hutchings * fitted. For these interfaces @port and/or @phy_address may be
94bf8fc60aSBen Hutchings * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
95bf8fc60aSBen Hutchings * Otherwise, attempts to write different values may be ignored or
96bf8fc60aSBen Hutchings * rejected.
97bf8fc60aSBen Hutchings *
98bf8fc60aSBen Hutchings * Users should assume that all fields not marked read-only are
99bf8fc60aSBen Hutchings * writable and subject to validation by the driver. They should use
100bf8fc60aSBen Hutchings * %ETHTOOL_GSET to get the current values before making specific
101bf8fc60aSBen Hutchings * changes and then applying them with %ETHTOOL_SSET.
102bf8fc60aSBen Hutchings *
103bf8fc60aSBen Hutchings * Deprecated fields should be ignored by both users and drivers.
104bf8fc60aSBen Hutchings */
105607ca46eSDavid Howells struct ethtool_cmd {
106607ca46eSDavid Howells __u32 cmd;
107bf8fc60aSBen Hutchings __u32 supported;
108bf8fc60aSBen Hutchings __u32 advertising;
109bf8fc60aSBen Hutchings __u16 speed;
110bf8fc60aSBen Hutchings __u8 duplex;
111bf8fc60aSBen Hutchings __u8 port;
112bf8fc60aSBen Hutchings __u8 phy_address;
113bf8fc60aSBen Hutchings __u8 transceiver;
114bf8fc60aSBen Hutchings __u8 autoneg;
115bf8fc60aSBen Hutchings __u8 mdio_support;
116bf8fc60aSBen Hutchings __u32 maxtxpkt;
117bf8fc60aSBen Hutchings __u32 maxrxpkt;
118bf8fc60aSBen Hutchings __u16 speed_hi;
119bf8fc60aSBen Hutchings __u8 eth_tp_mdix;
120bf8fc60aSBen Hutchings __u8 eth_tp_mdix_ctrl;
121bf8fc60aSBen Hutchings __u32 lp_advertising;
122607ca46eSDavid Howells __u32 reserved[2];
123607ca46eSDavid Howells };
124607ca46eSDavid Howells
ethtool_cmd_speed_set(struct ethtool_cmd * ep,__u32 speed)125607ca46eSDavid Howells static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
126607ca46eSDavid Howells __u32 speed)
127607ca46eSDavid Howells {
12885a62440SJesse Brandeburg ep->speed = (__u16)(speed & 0xFFFF);
129607ca46eSDavid Howells ep->speed_hi = (__u16)(speed >> 16);
130607ca46eSDavid Howells }
131607ca46eSDavid Howells
ethtool_cmd_speed(const struct ethtool_cmd * ep)132607ca46eSDavid Howells static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
133607ca46eSDavid Howells {
134607ca46eSDavid Howells return (ep->speed_hi << 16) | ep->speed;
135607ca46eSDavid Howells }
136607ca46eSDavid Howells
137607ca46eSDavid Howells /* Device supports clause 22 register access to PHY or peripherals
138607ca46eSDavid Howells * using the interface defined in <linux/mii.h>. This should not be
139607ca46eSDavid Howells * set if there are known to be no such peripherals present or if
140607ca46eSDavid Howells * the driver only emulates clause 22 registers for compatibility.
141607ca46eSDavid Howells */
142607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C22 1
143607ca46eSDavid Howells
144607ca46eSDavid Howells /* Device supports clause 45 register access to PHY or peripherals
145607ca46eSDavid Howells * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
146607ca46eSDavid Howells * This should not be set if there are known to be no such peripherals
147607ca46eSDavid Howells * present.
148607ca46eSDavid Howells */
149607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C45 2
150607ca46eSDavid Howells
151607ca46eSDavid Howells #define ETHTOOL_FWVERS_LEN 32
152607ca46eSDavid Howells #define ETHTOOL_BUSINFO_LEN 32
153a4505152SHariprasad Shenai #define ETHTOOL_EROMVERS_LEN 32
154daba1b6bSBen Hutchings
155daba1b6bSBen Hutchings /**
156daba1b6bSBen Hutchings * struct ethtool_drvinfo - general driver and device information
157daba1b6bSBen Hutchings * @cmd: Command number = %ETHTOOL_GDRVINFO
158daba1b6bSBen Hutchings * @driver: Driver short name. This should normally match the name
159daba1b6bSBen Hutchings * in its bus driver structure (e.g. pci_driver::name). Must
160daba1b6bSBen Hutchings * not be an empty string.
161daba1b6bSBen Hutchings * @version: Driver version string; may be an empty string
162f20a0a05SVincent Mailhol * @fw_version: Firmware version string; driver defined; may be an
163f20a0a05SVincent Mailhol * empty string
164f20a0a05SVincent Mailhol * @erom_version: Expansion ROM version string; driver defined; may be
165f20a0a05SVincent Mailhol * an empty string
166daba1b6bSBen Hutchings * @bus_info: Device bus address. This should match the dev_name()
167daba1b6bSBen Hutchings * string for the underlying bus device, if there is one. May be
168daba1b6bSBen Hutchings * an empty string.
16983e5feebSJakub Kicinski * @reserved2: Reserved for future use; see the note on reserved space.
170daba1b6bSBen Hutchings * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
171daba1b6bSBen Hutchings * %ETHTOOL_SPFLAGS commands; also the number of strings in the
172daba1b6bSBen Hutchings * %ETH_SS_PRIV_FLAGS set
173daba1b6bSBen Hutchings * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
174daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_STATS set
175daba1b6bSBen Hutchings * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
176daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_TEST set
177daba1b6bSBen Hutchings * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
178daba1b6bSBen Hutchings * and %ETHTOOL_SEEPROM commands, in bytes
179daba1b6bSBen Hutchings * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
180daba1b6bSBen Hutchings * command, in bytes
181daba1b6bSBen Hutchings *
182daba1b6bSBen Hutchings * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
183daba1b6bSBen Hutchings * strings in any string set (from Linux 2.6.34).
184daba1b6bSBen Hutchings */
185607ca46eSDavid Howells struct ethtool_drvinfo {
186607ca46eSDavid Howells __u32 cmd;
187daba1b6bSBen Hutchings char driver[32];
188daba1b6bSBen Hutchings char version[32];
189daba1b6bSBen Hutchings char fw_version[ETHTOOL_FWVERS_LEN];
190daba1b6bSBen Hutchings char bus_info[ETHTOOL_BUSINFO_LEN];
191a4505152SHariprasad Shenai char erom_version[ETHTOOL_EROMVERS_LEN];
192607ca46eSDavid Howells char reserved2[12];
193daba1b6bSBen Hutchings __u32 n_priv_flags;
194daba1b6bSBen Hutchings __u32 n_stats;
195607ca46eSDavid Howells __u32 testinfo_len;
196daba1b6bSBen Hutchings __u32 eedump_len;
197daba1b6bSBen Hutchings __u32 regdump_len;
198607ca46eSDavid Howells };
199607ca46eSDavid Howells
200607ca46eSDavid Howells #define SOPASS_MAX 6
20102d59f3fSBen Hutchings
20202d59f3fSBen Hutchings /**
20302d59f3fSBen Hutchings * struct ethtool_wolinfo - Wake-On-Lan configuration
20402d59f3fSBen Hutchings * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
20502d59f3fSBen Hutchings * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
20602d59f3fSBen Hutchings * Read-only.
20702d59f3fSBen Hutchings * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
20802d59f3fSBen Hutchings * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
20902d59f3fSBen Hutchings * is set in @wolopts.
21002d59f3fSBen Hutchings */
211607ca46eSDavid Howells struct ethtool_wolinfo {
212607ca46eSDavid Howells __u32 cmd;
213607ca46eSDavid Howells __u32 supported;
214607ca46eSDavid Howells __u32 wolopts;
21502d59f3fSBen Hutchings __u8 sopass[SOPASS_MAX];
216607ca46eSDavid Howells };
217607ca46eSDavid Howells
218607ca46eSDavid Howells /* for passing single values */
219607ca46eSDavid Howells struct ethtool_value {
220607ca46eSDavid Howells __u32 cmd;
221607ca46eSDavid Howells __u32 data;
222607ca46eSDavid Howells };
223607ca46eSDavid Howells
224e1577c1cSInbar Karmy #define PFC_STORM_PREVENTION_AUTO 0xffff
225e1577c1cSInbar Karmy #define PFC_STORM_PREVENTION_DISABLE 0
226e1577c1cSInbar Karmy
227f0db9b07SGovindarajulu Varadarajan enum tunable_id {
228f0db9b07SGovindarajulu Varadarajan ETHTOOL_ID_UNSPEC,
229f0db9b07SGovindarajulu Varadarajan ETHTOOL_RX_COPYBREAK,
2301255a505SEric Dumazet ETHTOOL_TX_COPYBREAK,
231e1577c1cSInbar Karmy ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
232448f413aSHao Chen ETHTOOL_TX_COPYBREAK_BUF_SIZE,
233a4244b0cSHadar Hen Zion /*
234c3086637SMichael Heimpold * Add your fresh new tunable attribute above and remember to update
2352d8ea148SJian Shen * tunable_strings[] in net/ethtool/common.c
236a4244b0cSHadar Hen Zion */
237a4244b0cSHadar Hen Zion __ETHTOOL_TUNABLE_COUNT,
238f0db9b07SGovindarajulu Varadarajan };
239f0db9b07SGovindarajulu Varadarajan
240f0db9b07SGovindarajulu Varadarajan enum tunable_type_id {
241f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_UNSPEC,
242f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U8,
243f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U16,
244f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U32,
245f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U64,
246f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_STRING,
247f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S8,
248f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S16,
249f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S32,
250f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S64,
251f0db9b07SGovindarajulu Varadarajan };
252f0db9b07SGovindarajulu Varadarajan
253f0db9b07SGovindarajulu Varadarajan struct ethtool_tunable {
254f0db9b07SGovindarajulu Varadarajan __u32 cmd;
255f0db9b07SGovindarajulu Varadarajan __u32 id;
256f0db9b07SGovindarajulu Varadarajan __u32 type_id;
257f0db9b07SGovindarajulu Varadarajan __u32 len;
25894dfc73eSGustavo A. R. Silva void *data[];
259f0db9b07SGovindarajulu Varadarajan };
260f0db9b07SGovindarajulu Varadarajan
261607c7029SRaju Lakkaraju #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff
262607c7029SRaju Lakkaraju #define DOWNSHIFT_DEV_DISABLE 0
263607c7029SRaju Lakkaraju
2643aeb0803SHeiner Kallweit /* Time in msecs after which link is reported as down
2653aeb0803SHeiner Kallweit * 0 = lowest time supported by the PHY
2663aeb0803SHeiner Kallweit * 0xff = off, link down detection according to standard
2673aeb0803SHeiner Kallweit */
2683aeb0803SHeiner Kallweit #define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0
2693aeb0803SHeiner Kallweit #define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff
2703aeb0803SHeiner Kallweit
2719f2f13f4SAlexandru Ardelean /* Energy Detect Power Down (EDPD) is a feature supported by some PHYs, where
2729f2f13f4SAlexandru Ardelean * the PHY's RX & TX blocks are put into a low-power mode when there is no
2739f2f13f4SAlexandru Ardelean * link detected (typically cable is un-plugged). For RX, only a minimal
2749f2f13f4SAlexandru Ardelean * link-detection is available, and for TX the PHY wakes up to send link pulses
2759f2f13f4SAlexandru Ardelean * to avoid any lock-ups in case the peer PHY may also be running in EDPD mode.
2769f2f13f4SAlexandru Ardelean *
2779f2f13f4SAlexandru Ardelean * Some PHYs may support configuration of the wake-up interval for TX pulses,
2789f2f13f4SAlexandru Ardelean * and some PHYs may support only disabling TX pulses entirely. For the latter
2799f2f13f4SAlexandru Ardelean * a special value is required (ETHTOOL_PHY_EDPD_NO_TX) so that this can be
2809f2f13f4SAlexandru Ardelean * configured from userspace (should the user want it).
2819f2f13f4SAlexandru Ardelean *
2829f2f13f4SAlexandru Ardelean * The interval units for TX wake-up are in milliseconds, since this should
2839f2f13f4SAlexandru Ardelean * cover a reasonable range of intervals:
2849f2f13f4SAlexandru Ardelean * - from 1 millisecond, which does not sound like much of a power-saver
2859f2f13f4SAlexandru Ardelean * - to ~65 seconds which is quite a lot to wait for a link to come up when
2869f2f13f4SAlexandru Ardelean * plugging a cable
2879f2f13f4SAlexandru Ardelean */
2889f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_DFLT_TX_MSECS 0xffff
2899f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_NO_TX 0xfffe
2909f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_DISABLE 0
2919f2f13f4SAlexandru Ardelean
2920d27f4e4SRaju Lakkaraju enum phy_tunable_id {
2930d27f4e4SRaju Lakkaraju ETHTOOL_PHY_ID_UNSPEC,
294607c7029SRaju Lakkaraju ETHTOOL_PHY_DOWNSHIFT,
2953aeb0803SHeiner Kallweit ETHTOOL_PHY_FAST_LINK_DOWN,
2969f2f13f4SAlexandru Ardelean ETHTOOL_PHY_EDPD,
2970d27f4e4SRaju Lakkaraju /*
2980d27f4e4SRaju Lakkaraju * Add your fresh new phy tunable attribute above and remember to update
2992d8ea148SJian Shen * phy_tunable_strings[] in net/ethtool/common.c
3000d27f4e4SRaju Lakkaraju */
3010d27f4e4SRaju Lakkaraju __ETHTOOL_PHY_TUNABLE_COUNT,
3020d27f4e4SRaju Lakkaraju };
3030d27f4e4SRaju Lakkaraju
30409fb8bb0SBen Hutchings /**
30509fb8bb0SBen Hutchings * struct ethtool_regs - hardware register dump
30609fb8bb0SBen Hutchings * @cmd: Command number = %ETHTOOL_GREGS
30709fb8bb0SBen Hutchings * @version: Dump format version. This is driver-specific and may
30809fb8bb0SBen Hutchings * distinguish different chips/revisions. Drivers must use new
30909fb8bb0SBen Hutchings * version numbers whenever the dump format changes in an
31009fb8bb0SBen Hutchings * incompatible way.
31109fb8bb0SBen Hutchings * @len: On entry, the real length of @data. On return, the number of
31209fb8bb0SBen Hutchings * bytes used.
31309fb8bb0SBen Hutchings * @data: Buffer for the register dump
31409fb8bb0SBen Hutchings *
31509fb8bb0SBen Hutchings * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
31609fb8bb0SBen Hutchings * a register dump for the interface. They must allocate the buffer
31709fb8bb0SBen Hutchings * immediately following this structure.
31809fb8bb0SBen Hutchings */
319607ca46eSDavid Howells struct ethtool_regs {
320607ca46eSDavid Howells __u32 cmd;
32109fb8bb0SBen Hutchings __u32 version;
32209fb8bb0SBen Hutchings __u32 len;
32394dfc73eSGustavo A. R. Silva __u8 data[];
324607ca46eSDavid Howells };
325607ca46eSDavid Howells
326c8364a63SBen Hutchings /**
327c8364a63SBen Hutchings * struct ethtool_eeprom - EEPROM dump
328c8364a63SBen Hutchings * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
329c8364a63SBen Hutchings * %ETHTOOL_SEEPROM
330c8364a63SBen Hutchings * @magic: A 'magic cookie' value to guard against accidental changes.
331c8364a63SBen Hutchings * The value passed in to %ETHTOOL_SEEPROM must match the value
332c8364a63SBen Hutchings * returned by %ETHTOOL_GEEPROM for the same device. This is
333c8364a63SBen Hutchings * unused when @cmd is %ETHTOOL_GMODULEEEPROM.
334c8364a63SBen Hutchings * @offset: Offset within the EEPROM to begin reading/writing, in bytes
335c8364a63SBen Hutchings * @len: On entry, number of bytes to read/write. On successful
336c8364a63SBen Hutchings * return, number of bytes actually read/written. In case of
337c8364a63SBen Hutchings * error, this may indicate at what point the error occurred.
338c8364a63SBen Hutchings * @data: Buffer to read/write from
339c8364a63SBen Hutchings *
340c8364a63SBen Hutchings * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
341c8364a63SBen Hutchings * the length of an on-board or module EEPROM, respectively. They
342c8364a63SBen Hutchings * must allocate the buffer immediately following this structure.
343c8364a63SBen Hutchings */
344607ca46eSDavid Howells struct ethtool_eeprom {
345607ca46eSDavid Howells __u32 cmd;
346607ca46eSDavid Howells __u32 magic;
347c8364a63SBen Hutchings __u32 offset;
348c8364a63SBen Hutchings __u32 len;
34994dfc73eSGustavo A. R. Silva __u8 data[];
350607ca46eSDavid Howells };
351607ca46eSDavid Howells
352607ca46eSDavid Howells /**
353607ca46eSDavid Howells * struct ethtool_eee - Energy Efficient Ethernet information
354607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}EEE
355607ca46eSDavid Howells * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
356607ca46eSDavid Howells * for which there is EEE support.
357607ca46eSDavid Howells * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
358607ca46eSDavid Howells * advertised as eee capable.
359607ca46eSDavid Howells * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
360607ca46eSDavid Howells * combinations advertised by the link partner as eee capable.
361607ca46eSDavid Howells * @eee_active: Result of the eee auto negotiation.
362607ca46eSDavid Howells * @eee_enabled: EEE configured mode (enabled/disabled).
363607ca46eSDavid Howells * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
364607ca46eSDavid Howells * that eee was negotiated.
365607ca46eSDavid Howells * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
366607ca46eSDavid Howells * its tx lpi (after reaching 'idle' state). Effective only when eee
367607ca46eSDavid Howells * was negotiated and tx_lpi_enabled was set.
36883e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space.
369607ca46eSDavid Howells */
370607ca46eSDavid Howells struct ethtool_eee {
371607ca46eSDavid Howells __u32 cmd;
372607ca46eSDavid Howells __u32 supported;
373607ca46eSDavid Howells __u32 advertised;
374607ca46eSDavid Howells __u32 lp_advertised;
375607ca46eSDavid Howells __u32 eee_active;
376607ca46eSDavid Howells __u32 eee_enabled;
377607ca46eSDavid Howells __u32 tx_lpi_enabled;
378607ca46eSDavid Howells __u32 tx_lpi_timer;
379607ca46eSDavid Howells __u32 reserved[2];
380607ca46eSDavid Howells };
381607ca46eSDavid Howells
382607ca46eSDavid Howells /**
383607ca46eSDavid Howells * struct ethtool_modinfo - plugin module eeprom information
384607ca46eSDavid Howells * @cmd: %ETHTOOL_GMODULEINFO
385607ca46eSDavid Howells * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
386607ca46eSDavid Howells * @eeprom_len: Length of the eeprom
38783e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space.
388607ca46eSDavid Howells *
389607ca46eSDavid Howells * This structure is used to return the information to
390607ca46eSDavid Howells * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
391607ca46eSDavid Howells * The type code indicates the eeprom data format
392607ca46eSDavid Howells */
393607ca46eSDavid Howells struct ethtool_modinfo {
394607ca46eSDavid Howells __u32 cmd;
395607ca46eSDavid Howells __u32 type;
396607ca46eSDavid Howells __u32 eeprom_len;
397607ca46eSDavid Howells __u32 reserved[8];
398607ca46eSDavid Howells };
399607ca46eSDavid Howells
400607ca46eSDavid Howells /**
401607ca46eSDavid Howells * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
402607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}COALESCE
403607ca46eSDavid Howells * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
404607ca46eSDavid Howells * a packet arrives.
405607ca46eSDavid Howells * @rx_max_coalesced_frames: Maximum number of packets to receive
406607ca46eSDavid Howells * before an RX interrupt.
407607ca46eSDavid Howells * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
408607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host.
409607ca46eSDavid Howells * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
410607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced
411607ca46eSDavid Howells * by the host.
412607ca46eSDavid Howells * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
413607ca46eSDavid Howells * a packet is sent.
414607ca46eSDavid Howells * @tx_max_coalesced_frames: Maximum number of packets to be sent
415607ca46eSDavid Howells * before a TX interrupt.
416607ca46eSDavid Howells * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
417607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host.
418607ca46eSDavid Howells * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
419607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced
420607ca46eSDavid Howells * by the host.
421607ca46eSDavid Howells * @stats_block_coalesce_usecs: How many usecs to delay in-memory
422607ca46eSDavid Howells * statistics block updates. Some drivers do not have an
423607ca46eSDavid Howells * in-memory statistic block, and in such cases this value is
424607ca46eSDavid Howells * ignored. This value must not be zero.
425607ca46eSDavid Howells * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
426607ca46eSDavid Howells * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
427607ca46eSDavid Howells * @pkt_rate_low: Threshold for low packet rate (packets per second).
428607ca46eSDavid Howells * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
429607ca46eSDavid Howells * a packet arrives, when the packet rate is below @pkt_rate_low.
430607ca46eSDavid Howells * @rx_max_coalesced_frames_low: Maximum number of packets to be received
431607ca46eSDavid Howells * before an RX interrupt, when the packet rate is below @pkt_rate_low.
432607ca46eSDavid Howells * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
433607ca46eSDavid Howells * a packet is sent, when the packet rate is below @pkt_rate_low.
434607ca46eSDavid Howells * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
435607ca46eSDavid Howells * a TX interrupt, when the packet rate is below @pkt_rate_low.
436607ca46eSDavid Howells * @pkt_rate_high: Threshold for high packet rate (packets per second).
437607ca46eSDavid Howells * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
438607ca46eSDavid Howells * a packet arrives, when the packet rate is above @pkt_rate_high.
439607ca46eSDavid Howells * @rx_max_coalesced_frames_high: Maximum number of packets to be received
440607ca46eSDavid Howells * before an RX interrupt, when the packet rate is above @pkt_rate_high.
441607ca46eSDavid Howells * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
442607ca46eSDavid Howells * a packet is sent, when the packet rate is above @pkt_rate_high.
443607ca46eSDavid Howells * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
444607ca46eSDavid Howells * a TX interrupt, when the packet rate is above @pkt_rate_high.
445607ca46eSDavid Howells * @rate_sample_interval: How often to do adaptive coalescing packet rate
446607ca46eSDavid Howells * sampling, measured in seconds. Must not be zero.
447607ca46eSDavid Howells *
448073e3cf2SBen Hutchings * Each pair of (usecs, max_frames) fields specifies that interrupts
449073e3cf2SBen Hutchings * should be coalesced until
450607ca46eSDavid Howells * (usecs > 0 && time_since_first_completion >= usecs) ||
451607ca46eSDavid Howells * (max_frames > 0 && completed_frames >= max_frames)
452073e3cf2SBen Hutchings *
453607ca46eSDavid Howells * It is illegal to set both usecs and max_frames to zero as this
454607ca46eSDavid Howells * would cause interrupts to never be generated. To disable
455607ca46eSDavid Howells * coalescing, set usecs = 0 and max_frames = 1.
456607ca46eSDavid Howells *
457607ca46eSDavid Howells * Some implementations ignore the value of max_frames and use the
458073e3cf2SBen Hutchings * condition time_since_first_completion >= usecs
459073e3cf2SBen Hutchings *
460607ca46eSDavid Howells * This is deprecated. Drivers for hardware that does not support
461607ca46eSDavid Howells * counting completions should validate that max_frames == !rx_usecs.
462607ca46eSDavid Howells *
463607ca46eSDavid Howells * Adaptive RX/TX coalescing is an algorithm implemented by some
464607ca46eSDavid Howells * drivers to improve latency under low packet rates and improve
465607ca46eSDavid Howells * throughput under high packet rates. Some drivers only implement
466607ca46eSDavid Howells * one of RX or TX adaptive coalescing. Anything not implemented by
467607ca46eSDavid Howells * the driver causes these values to be silently ignored.
468607ca46eSDavid Howells *
469607ca46eSDavid Howells * When the packet rate is below @pkt_rate_high but above
470607ca46eSDavid Howells * @pkt_rate_low (both measured in packets per second) the
471607ca46eSDavid Howells * normal {rx,tx}_* coalescing parameters are used.
472607ca46eSDavid Howells */
473607ca46eSDavid Howells struct ethtool_coalesce {
474607ca46eSDavid Howells __u32 cmd;
475607ca46eSDavid Howells __u32 rx_coalesce_usecs;
476607ca46eSDavid Howells __u32 rx_max_coalesced_frames;
477607ca46eSDavid Howells __u32 rx_coalesce_usecs_irq;
478607ca46eSDavid Howells __u32 rx_max_coalesced_frames_irq;
479607ca46eSDavid Howells __u32 tx_coalesce_usecs;
480607ca46eSDavid Howells __u32 tx_max_coalesced_frames;
481607ca46eSDavid Howells __u32 tx_coalesce_usecs_irq;
482607ca46eSDavid Howells __u32 tx_max_coalesced_frames_irq;
483607ca46eSDavid Howells __u32 stats_block_coalesce_usecs;
484607ca46eSDavid Howells __u32 use_adaptive_rx_coalesce;
485607ca46eSDavid Howells __u32 use_adaptive_tx_coalesce;
486607ca46eSDavid Howells __u32 pkt_rate_low;
487607ca46eSDavid Howells __u32 rx_coalesce_usecs_low;
488607ca46eSDavid Howells __u32 rx_max_coalesced_frames_low;
489607ca46eSDavid Howells __u32 tx_coalesce_usecs_low;
490607ca46eSDavid Howells __u32 tx_max_coalesced_frames_low;
491607ca46eSDavid Howells __u32 pkt_rate_high;
492607ca46eSDavid Howells __u32 rx_coalesce_usecs_high;
493607ca46eSDavid Howells __u32 rx_max_coalesced_frames_high;
494607ca46eSDavid Howells __u32 tx_coalesce_usecs_high;
495607ca46eSDavid Howells __u32 tx_max_coalesced_frames_high;
496607ca46eSDavid Howells __u32 rate_sample_interval;
497607ca46eSDavid Howells };
498607ca46eSDavid Howells
499af440a8aSBen Hutchings /**
500af440a8aSBen Hutchings * struct ethtool_ringparam - RX/TX ring parameters
501af440a8aSBen Hutchings * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
502af440a8aSBen Hutchings * @rx_max_pending: Maximum supported number of pending entries per
503af440a8aSBen Hutchings * RX ring. Read-only.
504af440a8aSBen Hutchings * @rx_mini_max_pending: Maximum supported number of pending entries
505af440a8aSBen Hutchings * per RX mini ring. Read-only.
506af440a8aSBen Hutchings * @rx_jumbo_max_pending: Maximum supported number of pending entries
507af440a8aSBen Hutchings * per RX jumbo ring. Read-only.
508af440a8aSBen Hutchings * @tx_max_pending: Maximum supported number of pending entries per
509af440a8aSBen Hutchings * TX ring. Read-only.
510af440a8aSBen Hutchings * @rx_pending: Current maximum number of pending entries per RX ring
511af440a8aSBen Hutchings * @rx_mini_pending: Current maximum number of pending entries per RX
512af440a8aSBen Hutchings * mini ring
513af440a8aSBen Hutchings * @rx_jumbo_pending: Current maximum number of pending entries per RX
514af440a8aSBen Hutchings * jumbo ring
515af440a8aSBen Hutchings * @tx_pending: Current maximum supported number of pending entries
516af440a8aSBen Hutchings * per TX ring
517af440a8aSBen Hutchings *
518af440a8aSBen Hutchings * If the interface does not have separate RX mini and/or jumbo rings,
519af440a8aSBen Hutchings * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
520af440a8aSBen Hutchings *
521af440a8aSBen Hutchings * There may also be driver-dependent minimum values for the number
522af440a8aSBen Hutchings * of entries per ring.
523607ca46eSDavid Howells */
524af440a8aSBen Hutchings struct ethtool_ringparam {
525af440a8aSBen Hutchings __u32 cmd;
526607ca46eSDavid Howells __u32 rx_max_pending;
527607ca46eSDavid Howells __u32 rx_mini_max_pending;
528607ca46eSDavid Howells __u32 rx_jumbo_max_pending;
529607ca46eSDavid Howells __u32 tx_max_pending;
530607ca46eSDavid Howells __u32 rx_pending;
531607ca46eSDavid Howells __u32 rx_mini_pending;
532607ca46eSDavid Howells __u32 rx_jumbo_pending;
533607ca46eSDavid Howells __u32 tx_pending;
534607ca46eSDavid Howells };
535607ca46eSDavid Howells
536607ca46eSDavid Howells /**
537607ca46eSDavid Howells * struct ethtool_channels - configuring number of network channel
538607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}CHANNELS
539607ca46eSDavid Howells * @max_rx: Read only. Maximum number of receive channel the driver support.
540607ca46eSDavid Howells * @max_tx: Read only. Maximum number of transmit channel the driver support.
541607ca46eSDavid Howells * @max_other: Read only. Maximum number of other channel the driver support.
542607ca46eSDavid Howells * @max_combined: Read only. Maximum number of combined channel the driver
543607ca46eSDavid Howells * support. Set of queues RX, TX or other.
544607ca46eSDavid Howells * @rx_count: Valid values are in the range 1 to the max_rx.
545607ca46eSDavid Howells * @tx_count: Valid values are in the range 1 to the max_tx.
546607ca46eSDavid Howells * @other_count: Valid values are in the range 1 to the max_other.
547607ca46eSDavid Howells * @combined_count: Valid values are in the range 1 to the max_combined.
548607ca46eSDavid Howells *
549607ca46eSDavid Howells * This can be used to configure RX, TX and other channels.
550607ca46eSDavid Howells */
551607ca46eSDavid Howells
552607ca46eSDavid Howells struct ethtool_channels {
553607ca46eSDavid Howells __u32 cmd;
554607ca46eSDavid Howells __u32 max_rx;
555607ca46eSDavid Howells __u32 max_tx;
556607ca46eSDavid Howells __u32 max_other;
557607ca46eSDavid Howells __u32 max_combined;
558607ca46eSDavid Howells __u32 rx_count;
559607ca46eSDavid Howells __u32 tx_count;
560607ca46eSDavid Howells __u32 other_count;
561607ca46eSDavid Howells __u32 combined_count;
562607ca46eSDavid Howells };
563607ca46eSDavid Howells
5646a7a1081SBen Hutchings /**
5656a7a1081SBen Hutchings * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
5666a7a1081SBen Hutchings * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
5676a7a1081SBen Hutchings * @autoneg: Flag to enable autonegotiation of pause frame use
5686a7a1081SBen Hutchings * @rx_pause: Flag to enable reception of pause frames
5696a7a1081SBen Hutchings * @tx_pause: Flag to enable transmission of pause frames
570607ca46eSDavid Howells *
5716a7a1081SBen Hutchings * Drivers should reject a non-zero setting of @autoneg when
5726a7a1081SBen Hutchings * autoneogotiation is disabled (or not supported) for the link.
5736a7a1081SBen Hutchings *
5746a7a1081SBen Hutchings * If the link is autonegotiated, drivers should use
5756a7a1081SBen Hutchings * mii_advertise_flowctrl() or similar code to set the advertised
5766a7a1081SBen Hutchings * pause frame capabilities based on the @rx_pause and @tx_pause flags,
5776a7a1081SBen Hutchings * even if @autoneg is zero. They should also allow the advertised
5786a7a1081SBen Hutchings * pause frame capabilities to be controlled directly through the
5796a7a1081SBen Hutchings * advertising field of &struct ethtool_cmd.
5806a7a1081SBen Hutchings *
5816a7a1081SBen Hutchings * If @autoneg is non-zero, the MAC is configured to send and/or
5826a7a1081SBen Hutchings * receive pause frames according to the result of autonegotiation.
5836a7a1081SBen Hutchings * Otherwise, it is configured directly based on the @rx_pause and
5846a7a1081SBen Hutchings * @tx_pause flags.
585607ca46eSDavid Howells */
5866a7a1081SBen Hutchings struct ethtool_pauseparam {
5876a7a1081SBen Hutchings __u32 cmd;
588607ca46eSDavid Howells __u32 autoneg;
589607ca46eSDavid Howells __u32 rx_pause;
590607ca46eSDavid Howells __u32 tx_pause;
591607ca46eSDavid Howells };
592607ca46eSDavid Howells
593f0ebc2b6SJakub Kicinski /* Link extended state */
594ecc31c60SAmit Cohen enum ethtool_link_ext_state {
595ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_AUTONEG,
596ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
597ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
598ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY,
599ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_NO_CABLE,
600ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
601ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE,
602ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE,
603ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED,
604ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_OVERHEAT,
6053dfb5112SIdo Schimmel ETHTOOL_LINK_EXT_STATE_MODULE,
606ecc31c60SAmit Cohen };
607ecc31c60SAmit Cohen
608f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */
609ecc31c60SAmit Cohen enum ethtool_link_ext_substate_autoneg {
610ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1,
611ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED,
612ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED,
613ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE,
614ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE,
615ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD,
616ecc31c60SAmit Cohen };
617ecc31c60SAmit Cohen
618f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE.
619ecc31c60SAmit Cohen */
620ecc31c60SAmit Cohen enum ethtool_link_ext_substate_link_training {
621ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1,
622ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT,
623ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY,
624ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT,
625ecc31c60SAmit Cohen };
626ecc31c60SAmit Cohen
627f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH.
628ecc31c60SAmit Cohen */
629ecc31c60SAmit Cohen enum ethtool_link_ext_substate_link_logical_mismatch {
630ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1,
631ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK,
632ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS,
633ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED,
634ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED,
635ecc31c60SAmit Cohen };
636ecc31c60SAmit Cohen
637f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY.
638ecc31c60SAmit Cohen */
639ecc31c60SAmit Cohen enum ethtool_link_ext_substate_bad_signal_integrity {
640ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,
641ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,
6425b4ecc3dSGuangbin Huang ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_REFERENCE_CLOCK_LOST,
6435b4ecc3dSGuangbin Huang ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_ALOS,
644ecc31c60SAmit Cohen };
645ecc31c60SAmit Cohen
646f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */
647ecc31c60SAmit Cohen enum ethtool_link_ext_substate_cable_issue {
648ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1,
649ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE,
650ecc31c60SAmit Cohen };
651ecc31c60SAmit Cohen
6523dfb5112SIdo Schimmel /* More information in addition to ETHTOOL_LINK_EXT_STATE_MODULE. */
6533dfb5112SIdo Schimmel enum ethtool_link_ext_substate_module {
6543dfb5112SIdo Schimmel ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY = 1,
6553dfb5112SIdo Schimmel };
6563dfb5112SIdo Schimmel
657607ca46eSDavid Howells #define ETH_GSTRING_LEN 32
658fe5df1b9SBen Hutchings
659fe5df1b9SBen Hutchings /**
660fe5df1b9SBen Hutchings * enum ethtool_stringset - string set ID
661fe5df1b9SBen Hutchings * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
662fe5df1b9SBen Hutchings * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
663fe5df1b9SBen Hutchings * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
664fe5df1b9SBen Hutchings * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
665fe5df1b9SBen Hutchings * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
666fe5df1b9SBen Hutchings * now deprecated
667fe5df1b9SBen Hutchings * @ETH_SS_FEATURES: Device feature names
668892311f6SEyal Perry * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
669d9c65de0SJakub Kicinski * @ETH_SS_TUNABLES: tunable names
670f3a40945SAndrew Lunn * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
6710d27f4e4SRaju Lakkaraju * @ETH_SS_PHY_TUNABLES: PHY tunable names
672428c122fSMichal Kubecek * @ETH_SS_LINK_MODES: link mode names
6736a94b8ccSMichal Kubecek * @ETH_SS_MSG_CLASSES: debug message class names
67451ea22b0SMichal Kubecek * @ETH_SS_WOL_MODES: wake-on-lan modes
675f76510b4SMichal Kubecek * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags
676f76510b4SMichal Kubecek * @ETH_SS_TS_TX_TYPES: timestamping Tx types
677f76510b4SMichal Kubecek * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters
678c7d759ebSJakub Kicinski * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types
679f09ea6fbSJakub Kicinski * @ETH_SS_STATS_STD: standardized stats
680f09ea6fbSJakub Kicinski * @ETH_SS_STATS_ETH_PHY: names of IEEE 802.3 PHY statistics
681ca224454SJakub Kicinski * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics
682bfad2b97SJakub Kicinski * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics
683a8b06e9dSJakub Kicinski * @ETH_SS_STATS_RMON: names of RMON statistics
6846167c0b6SJakub Kicinski * @ETH_SS_STATS_PHY: names of PHY(dev) statistics
6856a774228SKory Maincent * @ETH_SS_TS_FLAGS: hardware timestamping flags
686d9c65de0SJakub Kicinski *
687d9c65de0SJakub Kicinski * @ETH_SS_COUNT: number of defined string sets
688fe5df1b9SBen Hutchings */
689607ca46eSDavid Howells enum ethtool_stringset {
690607ca46eSDavid Howells ETH_SS_TEST = 0,
691607ca46eSDavid Howells ETH_SS_STATS,
692607ca46eSDavid Howells ETH_SS_PRIV_FLAGS,
693fe5df1b9SBen Hutchings ETH_SS_NTUPLE_FILTERS,
694607ca46eSDavid Howells ETH_SS_FEATURES,
695892311f6SEyal Perry ETH_SS_RSS_HASH_FUNCS,
696a4244b0cSHadar Hen Zion ETH_SS_TUNABLES,
697f3a40945SAndrew Lunn ETH_SS_PHY_STATS,
6980d27f4e4SRaju Lakkaraju ETH_SS_PHY_TUNABLES,
699428c122fSMichal Kubecek ETH_SS_LINK_MODES,
7006a94b8ccSMichal Kubecek ETH_SS_MSG_CLASSES,
70151ea22b0SMichal Kubecek ETH_SS_WOL_MODES,
702f76510b4SMichal Kubecek ETH_SS_SOF_TIMESTAMPING,
703f76510b4SMichal Kubecek ETH_SS_TS_TX_TYPES,
704f76510b4SMichal Kubecek ETH_SS_TS_RX_FILTERS,
705c7d759ebSJakub Kicinski ETH_SS_UDP_TUNNEL_TYPES,
706f09ea6fbSJakub Kicinski ETH_SS_STATS_STD,
707f09ea6fbSJakub Kicinski ETH_SS_STATS_ETH_PHY,
708ca224454SJakub Kicinski ETH_SS_STATS_ETH_MAC,
709bfad2b97SJakub Kicinski ETH_SS_STATS_ETH_CTRL,
710a8b06e9dSJakub Kicinski ETH_SS_STATS_RMON,
7116167c0b6SJakub Kicinski ETH_SS_STATS_PHY,
7126a774228SKory Maincent ETH_SS_TS_FLAGS,
71371921690SMichal Kubecek
71471921690SMichal Kubecek /* add new constants above here */
71571921690SMichal Kubecek ETH_SS_COUNT
716607ca46eSDavid Howells };
717607ca46eSDavid Howells
718fe5df1b9SBen Hutchings /**
71904692c90SVladimir Oltean * enum ethtool_mac_stats_src - source of ethtool MAC statistics
72004692c90SVladimir Oltean * @ETHTOOL_MAC_STATS_SRC_AGGREGATE:
72104692c90SVladimir Oltean * if device supports a MAC merge layer, this retrieves the aggregate
72204692c90SVladimir Oltean * statistics of the eMAC and pMAC. Otherwise, it retrieves just the
72304692c90SVladimir Oltean * statistics of the single (express) MAC.
72404692c90SVladimir Oltean * @ETHTOOL_MAC_STATS_SRC_EMAC:
72504692c90SVladimir Oltean * if device supports a MM layer, this retrieves the eMAC statistics.
72604692c90SVladimir Oltean * Otherwise, it retrieves the statistics of the single (express) MAC.
72704692c90SVladimir Oltean * @ETHTOOL_MAC_STATS_SRC_PMAC:
72804692c90SVladimir Oltean * if device supports a MM layer, this retrieves the pMAC statistics.
72904692c90SVladimir Oltean */
73004692c90SVladimir Oltean enum ethtool_mac_stats_src {
73104692c90SVladimir Oltean ETHTOOL_MAC_STATS_SRC_AGGREGATE,
73204692c90SVladimir Oltean ETHTOOL_MAC_STATS_SRC_EMAC,
73304692c90SVladimir Oltean ETHTOOL_MAC_STATS_SRC_PMAC,
73404692c90SVladimir Oltean };
73504692c90SVladimir Oltean
73604692c90SVladimir Oltean /**
737353407d9SIdo Schimmel * enum ethtool_module_power_mode_policy - plug-in module power mode policy
738353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH: Module is always in high power mode.
739353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO: Module is transitioned by the host
740353407d9SIdo Schimmel * to high power mode when the first port using it is put administratively
741353407d9SIdo Schimmel * up and to low power mode when the last port using it is put
742353407d9SIdo Schimmel * administratively down.
743353407d9SIdo Schimmel */
744353407d9SIdo Schimmel enum ethtool_module_power_mode_policy {
745353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH = 1,
746353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO,
747353407d9SIdo Schimmel };
748353407d9SIdo Schimmel
749353407d9SIdo Schimmel /**
750353407d9SIdo Schimmel * enum ethtool_module_power_mode - plug-in module power mode
751353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_LOW: Module is in low power mode.
752353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_HIGH: Module is in high power mode.
753353407d9SIdo Schimmel */
754353407d9SIdo Schimmel enum ethtool_module_power_mode {
755353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_LOW = 1,
756353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_HIGH,
757353407d9SIdo Schimmel };
758353407d9SIdo Schimmel
759353407d9SIdo Schimmel /**
760e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_state - groups of PSE extended states
761e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
762e4629600SKory Maincent (Dent Project) *
763e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_ERROR_CONDITION: Group of error_condition states
764e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_MR_MPS_VALID: Group of mr_mps_valid states
765e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_MR_PSE_ENABLE: Group of mr_pse_enable states
766e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_OPTION_DETECT_TED: Group of option_detect_ted
767e4629600SKory Maincent (Dent Project) * states
768e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_OPTION_VPORT_LIM: Group of option_vport_lim states
769e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_OVLD_DETECTED: Group of ovld_detected states
770e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_PD_DLL_POWER_TYPE: Group of pd_dll_power_type
771e4629600SKory Maincent (Dent Project) * states
772e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_POWER_NOT_AVAILABLE: Group of power_not_available
773e4629600SKory Maincent (Dent Project) * states
774e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_STATE_SHORT_DETECTED: Group of short_detected states
775e4629600SKory Maincent (Dent Project) */
776e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_state {
777e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_ERROR_CONDITION = 1,
778e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_MR_MPS_VALID,
779e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_MR_PSE_ENABLE,
780e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_OPTION_DETECT_TED,
781e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_OPTION_VPORT_LIM,
782e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_OVLD_DETECTED,
783e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_PD_DLL_POWER_TYPE,
784e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_POWER_NOT_AVAILABLE,
785e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_STATE_SHORT_DETECTED,
786e4629600SKory Maincent (Dent Project) };
787e4629600SKory Maincent (Dent Project)
788e4629600SKory Maincent (Dent Project) /**
789e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_mr_mps_valid - mr_mps_valid states
790e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
791e4629600SKory Maincent (Dent Project) *
792e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_DETECTED_UNDERLOAD: Underload
793e4629600SKory Maincent (Dent Project) * state
794e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_CONNECTION_OPEN: Port is not
795e4629600SKory Maincent (Dent Project) * connected
796e4629600SKory Maincent (Dent Project) *
797e4629600SKory Maincent (Dent Project) * The PSE monitors either the DC or AC Maintain Power Signature
798e4629600SKory Maincent (Dent Project) * (MPS, see 33.2.9.1). This variable indicates the presence or absence of
799e4629600SKory Maincent (Dent Project) * a valid MPS.
800e4629600SKory Maincent (Dent Project) */
801e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_mr_mps_valid {
802e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_DETECTED_UNDERLOAD = 1,
803e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_CONNECTION_OPEN,
804e4629600SKory Maincent (Dent Project) };
805e4629600SKory Maincent (Dent Project)
806e4629600SKory Maincent (Dent Project) /**
807e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_error_condition - error_condition states
808e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
809e4629600SKory Maincent (Dent Project) *
810e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_NON_EXISTING_PORT: Non-existing
811e4629600SKory Maincent (Dent Project) * port number
812e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNDEFINED_PORT: Undefined port
813e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_INTERNAL_HW_FAULT: Internal
814e4629600SKory Maincent (Dent Project) * hardware fault
815e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_COMM_ERROR_AFTER_FORCE_ON:
816e4629600SKory Maincent (Dent Project) * Communication error after force on
817e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNKNOWN_PORT_STATUS: Unknown
818e4629600SKory Maincent (Dent Project) * port status
819e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_TURN_OFF: Host
820e4629600SKory Maincent (Dent Project) * crash turn off
821e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_FORCE_SHUTDOWN:
822e4629600SKory Maincent (Dent Project) * Host crash force shutdown
823e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_CONFIG_CHANGE: Configuration
824e4629600SKory Maincent (Dent Project) * change
825e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_DETECTED_OVER_TEMP: Over
826e4629600SKory Maincent (Dent Project) * temperature detected
827e4629600SKory Maincent (Dent Project) *
828e4629600SKory Maincent (Dent Project) * error_condition is a variable indicating the status of
829e4629600SKory Maincent (Dent Project) * implementation-specific fault conditions or optionally other system faults
830e4629600SKory Maincent (Dent Project) * that prevent the PSE from meeting the specifications in Table 33–11 and that
831e4629600SKory Maincent (Dent Project) * require the PSE not to source power. These error conditions are different
832e4629600SKory Maincent (Dent Project) * from those monitored by the state diagrams in Figure 33–10.
833e4629600SKory Maincent (Dent Project) */
834e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_error_condition {
835e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_NON_EXISTING_PORT = 1,
836e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNDEFINED_PORT,
837e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_INTERNAL_HW_FAULT,
838e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_COMM_ERROR_AFTER_FORCE_ON,
839e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNKNOWN_PORT_STATUS,
840e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_TURN_OFF,
841e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_FORCE_SHUTDOWN,
842e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_CONFIG_CHANGE,
843e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_DETECTED_OVER_TEMP,
844e4629600SKory Maincent (Dent Project) };
845e4629600SKory Maincent (Dent Project)
846e4629600SKory Maincent (Dent Project) /**
847e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_mr_pse_enable - mr_pse_enable states
848e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
849e4629600SKory Maincent (Dent Project) *
850e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_PSE_ENABLE_DISABLE_PIN_ACTIVE: Disable
851e4629600SKory Maincent (Dent Project) * pin active
852e4629600SKory Maincent (Dent Project) *
853e4629600SKory Maincent (Dent Project) * mr_pse_enable is control variable that selects PSE operation and test
854e4629600SKory Maincent (Dent Project) * functions.
855e4629600SKory Maincent (Dent Project) */
856e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_mr_pse_enable {
857e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_PSE_ENABLE_DISABLE_PIN_ACTIVE = 1,
858e4629600SKory Maincent (Dent Project) };
859e4629600SKory Maincent (Dent Project)
860e4629600SKory Maincent (Dent Project) /**
861e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_option_detect_ted - option_detect_ted
862e4629600SKory Maincent (Dent Project) * states functions. IEEE 802.3-2022 33.2.4.4 Variables
863e4629600SKory Maincent (Dent Project) *
864e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_DET_IN_PROCESS: Detection
865e4629600SKory Maincent (Dent Project) * in process
866e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_CONNECTION_CHECK_ERROR:
867e4629600SKory Maincent (Dent Project) * Connection check error
868e4629600SKory Maincent (Dent Project) *
869e4629600SKory Maincent (Dent Project) * option_detect_ted is a variable indicating if detection can be performed
870e4629600SKory Maincent (Dent Project) * by the PSE during the ted_timer interval.
871e4629600SKory Maincent (Dent Project) */
872e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_option_detect_ted {
873e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_DET_IN_PROCESS = 1,
874e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_CONNECTION_CHECK_ERROR,
875e4629600SKory Maincent (Dent Project) };
876e4629600SKory Maincent (Dent Project)
877e4629600SKory Maincent (Dent Project) /**
878e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_option_vport_lim - option_vport_lim states
879e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
880e4629600SKory Maincent (Dent Project) *
881e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_HIGH_VOLTAGE: Main supply
882e4629600SKory Maincent (Dent Project) * voltage is high
883e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_LOW_VOLTAGE: Main supply
884e4629600SKory Maincent (Dent Project) * voltage is low
885e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_VOLTAGE_INJECTION: Voltage
886e4629600SKory Maincent (Dent Project) * injection into the port
887e4629600SKory Maincent (Dent Project) *
888e4629600SKory Maincent (Dent Project) * option_vport_lim is an optional variable indicates if VPSE is out of the
889e4629600SKory Maincent (Dent Project) * operating range during normal operating state.
890e4629600SKory Maincent (Dent Project) */
891e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_option_vport_lim {
892e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_HIGH_VOLTAGE = 1,
893e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_LOW_VOLTAGE,
894e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_VOLTAGE_INJECTION,
895e4629600SKory Maincent (Dent Project) };
896e4629600SKory Maincent (Dent Project)
897e4629600SKory Maincent (Dent Project) /**
898e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_ovld_detected - ovld_detected states
899e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
900e4629600SKory Maincent (Dent Project) *
901e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OVLD_DETECTED_OVERLOAD: Overload state
902e4629600SKory Maincent (Dent Project) *
903e4629600SKory Maincent (Dent Project) * ovld_detected is a variable indicating if the PSE output current has been
904e4629600SKory Maincent (Dent Project) * in an overload condition (see 33.2.7.6) for at least TCUT of a one-second
905e4629600SKory Maincent (Dent Project) * sliding time.
906e4629600SKory Maincent (Dent Project) */
907e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_ovld_detected {
908e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_OVLD_DETECTED_OVERLOAD = 1,
909e4629600SKory Maincent (Dent Project) };
910e4629600SKory Maincent (Dent Project)
911e4629600SKory Maincent (Dent Project) /**
912e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_power_not_available - power_not_available
913e4629600SKory Maincent (Dent Project) * states functions. IEEE 802.3-2022 33.2.4.4 Variables
914e4629600SKory Maincent (Dent Project) *
915e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_BUDGET_EXCEEDED: Power
916e4629600SKory Maincent (Dent Project) * budget exceeded for the controller
917e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PORT_PW_LIMIT_EXCEEDS_CONTROLLER_BUDGET:
918e4629600SKory Maincent (Dent Project) * Configured port power limit exceeded controller power budget
919e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PD_REQUEST_EXCEEDS_PORT_LIMIT:
920e4629600SKory Maincent (Dent Project) * Power request from PD exceeds port limit
921e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_HW_PW_LIMIT: Power
922e4629600SKory Maincent (Dent Project) * denied due to Hardware power limit
923e4629600SKory Maincent (Dent Project) *
924e4629600SKory Maincent (Dent Project) * power_not_available is a variable that is asserted in an
925e4629600SKory Maincent (Dent Project) * implementation-dependent manner when the PSE is no longer capable of
926e4629600SKory Maincent (Dent Project) * sourcing sufficient power to support the attached PD. Sufficient power
927e4629600SKory Maincent (Dent Project) * is defined by classification; see 33.2.6.
928e4629600SKory Maincent (Dent Project) */
929e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_power_not_available {
930e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_BUDGET_EXCEEDED = 1,
931e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PORT_PW_LIMIT_EXCEEDS_CONTROLLER_BUDGET,
932e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PD_REQUEST_EXCEEDS_PORT_LIMIT,
933e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_HW_PW_LIMIT,
934e4629600SKory Maincent (Dent Project) };
935e4629600SKory Maincent (Dent Project)
936e4629600SKory Maincent (Dent Project) /**
937e4629600SKory Maincent (Dent Project) * enum ethtool_c33_pse_ext_substate_short_detected - short_detected states
938e4629600SKory Maincent (Dent Project) * functions. IEEE 802.3-2022 33.2.4.4 Variables
939e4629600SKory Maincent (Dent Project) *
940e4629600SKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_EXT_SUBSTATE_SHORT_DETECTED_SHORT_CONDITION: Short
941e4629600SKory Maincent (Dent Project) * condition was detected
942e4629600SKory Maincent (Dent Project) *
943e4629600SKory Maincent (Dent Project) * short_detected is a variable indicating if the PSE output current has been
944e4629600SKory Maincent (Dent Project) * in a short circuit condition for TLIM within a sliding window (see 33.2.7.7).
945e4629600SKory Maincent (Dent Project) */
946e4629600SKory Maincent (Dent Project) enum ethtool_c33_pse_ext_substate_short_detected {
947e4629600SKory Maincent (Dent Project) ETHTOOL_C33_PSE_EXT_SUBSTATE_SHORT_DETECTED_SHORT_CONDITION = 1,
948e4629600SKory Maincent (Dent Project) };
949e4629600SKory Maincent (Dent Project)
950e4629600SKory Maincent (Dent Project) /**
95147e0dd53SKory Maincent (Dent Project) * enum ethtool_pse_types - Types of PSE controller.
95247e0dd53SKory Maincent (Dent Project) * @ETHTOOL_PSE_UNKNOWN: Type of PSE controller is unknown
95347e0dd53SKory Maincent (Dent Project) * @ETHTOOL_PSE_PODL: PSE controller which support PoDL
95447e0dd53SKory Maincent (Dent Project) * @ETHTOOL_PSE_C33: PSE controller which support Clause 33 (PoE)
95547e0dd53SKory Maincent (Dent Project) */
95647e0dd53SKory Maincent (Dent Project) enum ethtool_pse_types {
95747e0dd53SKory Maincent (Dent Project) ETHTOOL_PSE_UNKNOWN = 1 << 0,
95847e0dd53SKory Maincent (Dent Project) ETHTOOL_PSE_PODL = 1 << 1,
95947e0dd53SKory Maincent (Dent Project) ETHTOOL_PSE_C33 = 1 << 2,
96047e0dd53SKory Maincent (Dent Project) };
96147e0dd53SKory Maincent (Dent Project)
96247e0dd53SKory Maincent (Dent Project) /**
963b58be8dbSKory Maincent (Dent Project) * enum ethtool_c33_pse_admin_state - operational state of the PoDL PSE
964b58be8dbSKory Maincent (Dent Project) * functions. IEEE 802.3-2022 30.9.1.1.2 aPSEAdminState
965b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN: state of PSE functions is unknown
966b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED: PSE functions are disabled
967b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED: PSE functions are enabled
968b58be8dbSKory Maincent (Dent Project) */
969b58be8dbSKory Maincent (Dent Project) enum ethtool_c33_pse_admin_state {
970b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN = 1,
971b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED,
972b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED,
973b58be8dbSKory Maincent (Dent Project) };
974b58be8dbSKory Maincent (Dent Project)
975b58be8dbSKory Maincent (Dent Project) /**
976b58be8dbSKory Maincent (Dent Project) * enum ethtool_c33_pse_pw_d_status - power detection status of the PSE.
977b58be8dbSKory Maincent (Dent Project) * IEEE 802.3-2022 30.9.1.1.3 aPoDLPSEPowerDetectionStatus:
978b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN: PSE status is unknown
979b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED: The enumeration "disabled"
980b58be8dbSKory Maincent (Dent Project) * indicates that the PSE State diagram is in the state DISABLED.
981b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING: The enumeration "searching"
982b58be8dbSKory Maincent (Dent Project) * indicates the PSE State diagram is in a state other than those
983b58be8dbSKory Maincent (Dent Project) * listed.
984b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING: The enumeration
985b58be8dbSKory Maincent (Dent Project) * "deliveringPower" indicates that the PSE State diagram is in the
986b58be8dbSKory Maincent (Dent Project) * state POWER_ON.
987b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_TEST: The enumeration "test" indicates that
988b58be8dbSKory Maincent (Dent Project) * the PSE State diagram is in the state TEST_MODE.
989b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_FAULT: The enumeration "fault" indicates that
990b58be8dbSKory Maincent (Dent Project) * the PSE State diagram is in the state TEST_ERROR.
991b58be8dbSKory Maincent (Dent Project) * @ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT: The enumeration "otherFault"
992b58be8dbSKory Maincent (Dent Project) * indicates that the PSE State diagram is in the state IDLE due to
993b58be8dbSKory Maincent (Dent Project) * the variable error_condition = true.
994b58be8dbSKory Maincent (Dent Project) */
995b58be8dbSKory Maincent (Dent Project) enum ethtool_c33_pse_pw_d_status {
996b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN = 1,
997b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED,
998b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING,
999b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING,
1000b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_TEST,
1001b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_FAULT,
1002b58be8dbSKory Maincent (Dent Project) ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT,
1003b58be8dbSKory Maincent (Dent Project) };
1004b58be8dbSKory Maincent (Dent Project)
1005b58be8dbSKory Maincent (Dent Project) /**
100618ff0bcdSOleksij Rempel * enum ethtool_podl_pse_admin_state - operational state of the PoDL PSE
100718ff0bcdSOleksij Rempel * functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState
100818ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN: state of PoDL PSE functions are
100918ff0bcdSOleksij Rempel * unknown
101018ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED: PoDL PSE functions are disabled
101118ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED: PoDL PSE functions are enabled
101218ff0bcdSOleksij Rempel */
101318ff0bcdSOleksij Rempel enum ethtool_podl_pse_admin_state {
101418ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN = 1,
101518ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED,
101618ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED,
101718ff0bcdSOleksij Rempel };
101818ff0bcdSOleksij Rempel
101918ff0bcdSOleksij Rempel /**
102018ff0bcdSOleksij Rempel * enum ethtool_podl_pse_pw_d_status - power detection status of the PoDL PSE.
102118ff0bcdSOleksij Rempel * IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus:
102218ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN: PoDL PSE
102318ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED: "The enumeration “disabled” is
102418ff0bcdSOleksij Rempel * asserted true when the PoDL PSE state diagram variable mr_pse_enable is
102518ff0bcdSOleksij Rempel * false"
102618ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING: "The enumeration “searching” is
102718ff0bcdSOleksij Rempel * asserted true when either of the PSE state diagram variables
102818ff0bcdSOleksij Rempel * pi_detecting or pi_classifying is true."
102918ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING: "The enumeration “deliveringPower”
103018ff0bcdSOleksij Rempel * is asserted true when the PoDL PSE state diagram variable pi_powered is
103118ff0bcdSOleksij Rempel * true."
103218ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP: "The enumeration “sleep” is asserted
103318ff0bcdSOleksij Rempel * true when the PoDL PSE state diagram variable pi_sleeping is true."
103418ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE: "The enumeration “idle” is asserted true
103518ff0bcdSOleksij Rempel * when the logical combination of the PoDL PSE state diagram variables
103618ff0bcdSOleksij Rempel * pi_prebiased*!pi_sleeping is true."
103718ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR: "The enumeration “error” is asserted
103818ff0bcdSOleksij Rempel * true when the PoDL PSE state diagram variable overload_held is true."
103918ff0bcdSOleksij Rempel */
104018ff0bcdSOleksij Rempel enum ethtool_podl_pse_pw_d_status {
104118ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN = 1,
104218ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED,
104318ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING,
104418ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING,
104518ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP,
104618ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE,
104718ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR,
104818ff0bcdSOleksij Rempel };
104918ff0bcdSOleksij Rempel
105018ff0bcdSOleksij Rempel /**
10512b30f829SVladimir Oltean * enum ethtool_mm_verify_status - status of MAC Merge Verify function
10522b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_UNKNOWN:
10532b30f829SVladimir Oltean * verification status is unknown
10542b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_INITIAL:
10552b30f829SVladimir Oltean * the 802.3 Verify State diagram is in the state INIT_VERIFICATION
10562b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_VERIFYING:
10572b30f829SVladimir Oltean * the Verify State diagram is in the state VERIFICATION_IDLE,
10582b30f829SVladimir Oltean * SEND_VERIFY or WAIT_FOR_RESPONSE
10592b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED:
10602b30f829SVladimir Oltean * indicates that the Verify State diagram is in the state VERIFIED
10612b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_FAILED:
10622b30f829SVladimir Oltean * the Verify State diagram is in the state VERIFY_FAIL
10632b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_DISABLED:
10642b30f829SVladimir Oltean * verification of preemption operation is disabled
10652b30f829SVladimir Oltean */
10662b30f829SVladimir Oltean enum ethtool_mm_verify_status {
10672b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_UNKNOWN,
10682b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_INITIAL,
10692b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_VERIFYING,
10702b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED,
10712b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_FAILED,
10722b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_DISABLED,
10732b30f829SVladimir Oltean };
10742b30f829SVladimir Oltean
10752b30f829SVladimir Oltean /**
107646fb3ba9SDanielle Ratson * enum ethtool_module_fw_flash_status - plug-in module firmware flashing status
107746fb3ba9SDanielle Ratson * @ETHTOOL_MODULE_FW_FLASH_STATUS_STARTED: The firmware flashing process has
107846fb3ba9SDanielle Ratson * started.
107946fb3ba9SDanielle Ratson * @ETHTOOL_MODULE_FW_FLASH_STATUS_IN_PROGRESS: The firmware flashing process
108046fb3ba9SDanielle Ratson * is in progress.
108146fb3ba9SDanielle Ratson * @ETHTOOL_MODULE_FW_FLASH_STATUS_COMPLETED: The firmware flashing process was
108246fb3ba9SDanielle Ratson * completed successfully.
108346fb3ba9SDanielle Ratson * @ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR: The firmware flashing process was
108446fb3ba9SDanielle Ratson * stopped due to an error.
108546fb3ba9SDanielle Ratson */
108646fb3ba9SDanielle Ratson enum ethtool_module_fw_flash_status {
108746fb3ba9SDanielle Ratson ETHTOOL_MODULE_FW_FLASH_STATUS_STARTED = 1,
108846fb3ba9SDanielle Ratson ETHTOOL_MODULE_FW_FLASH_STATUS_IN_PROGRESS,
108946fb3ba9SDanielle Ratson ETHTOOL_MODULE_FW_FLASH_STATUS_COMPLETED,
109046fb3ba9SDanielle Ratson ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR,
109146fb3ba9SDanielle Ratson };
109246fb3ba9SDanielle Ratson
109346fb3ba9SDanielle Ratson /**
1094fe5df1b9SBen Hutchings * struct ethtool_gstrings - string set for data tagging
1095fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTRINGS
1096fe5df1b9SBen Hutchings * @string_set: String set ID; one of &enum ethtool_stringset
1097fe5df1b9SBen Hutchings * @len: On return, the number of strings in the string set
1098fe5df1b9SBen Hutchings * @data: Buffer for strings. Each string is null-padded to a size of
1099fe5df1b9SBen Hutchings * %ETH_GSTRING_LEN.
1100fe5df1b9SBen Hutchings *
1101fe5df1b9SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
1102fe5df1b9SBen Hutchings * the string set. They must allocate a buffer of the appropriate
1103fe5df1b9SBen Hutchings * size immediately following this structure.
1104fe5df1b9SBen Hutchings */
1105607ca46eSDavid Howells struct ethtool_gstrings {
1106fe5df1b9SBen Hutchings __u32 cmd;
1107fe5df1b9SBen Hutchings __u32 string_set;
1108fe5df1b9SBen Hutchings __u32 len;
110994dfc73eSGustavo A. R. Silva __u8 data[];
1110607ca46eSDavid Howells };
1111607ca46eSDavid Howells
1112fe5df1b9SBen Hutchings /**
1113fe5df1b9SBen Hutchings * struct ethtool_sset_info - string set information
1114fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSSET_INFO
111583e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space.
1116fe5df1b9SBen Hutchings * @sset_mask: On entry, a bitmask of string sets to query, with bits
1117fe5df1b9SBen Hutchings * numbered according to &enum ethtool_stringset. On return, a
1118fe5df1b9SBen Hutchings * bitmask of those string sets queried that are supported.
1119fe5df1b9SBen Hutchings * @data: Buffer for string set sizes. On return, this contains the
1120fe5df1b9SBen Hutchings * size of each string set that was queried and supported, in
1121fe5df1b9SBen Hutchings * order of ID.
1122fe5df1b9SBen Hutchings *
1123fe5df1b9SBen Hutchings * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
1124fe5df1b9SBen Hutchings * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the
1125fe5df1b9SBen Hutchings * size of set 1 and @data[1] contains the size of set 2.
1126fe5df1b9SBen Hutchings *
1127fe5df1b9SBen Hutchings * Users must allocate a buffer of the appropriate size (4 * number of
1128fe5df1b9SBen Hutchings * sets queried) immediately following this structure.
1129fe5df1b9SBen Hutchings */
1130607ca46eSDavid Howells struct ethtool_sset_info {
1131fe5df1b9SBen Hutchings __u32 cmd;
1132607ca46eSDavid Howells __u32 reserved;
1133fe5df1b9SBen Hutchings __u64 sset_mask;
113494dfc73eSGustavo A. R. Silva __u32 data[];
1135607ca46eSDavid Howells };
1136607ca46eSDavid Howells
1137607ca46eSDavid Howells /**
1138607ca46eSDavid Howells * enum ethtool_test_flags - flags definition of ethtool_test
1139607ca46eSDavid Howells * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
1140607ca46eSDavid Howells * only online tests.
1141607ca46eSDavid Howells * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
1142607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
1143607ca46eSDavid Howells * test.
1144607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
1145607ca46eSDavid Howells */
1146607ca46eSDavid Howells
1147607ca46eSDavid Howells enum ethtool_test_flags {
1148607ca46eSDavid Howells ETH_TEST_FL_OFFLINE = (1 << 0),
1149607ca46eSDavid Howells ETH_TEST_FL_FAILED = (1 << 1),
1150607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
1151607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
1152607ca46eSDavid Howells };
1153607ca46eSDavid Howells
11544e5a62dbSBen Hutchings /**
11554e5a62dbSBen Hutchings * struct ethtool_test - device self-test invocation
11564e5a62dbSBen Hutchings * @cmd: Command number = %ETHTOOL_TEST
11574e5a62dbSBen Hutchings * @flags: A bitmask of flags from &enum ethtool_test_flags. Some
11584e5a62dbSBen Hutchings * flags may be set by the user on entry; others may be set by
11594e5a62dbSBen Hutchings * the driver on return.
116083e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space.
11614e5a62dbSBen Hutchings * @len: On return, the number of test results
11624e5a62dbSBen Hutchings * @data: Array of test results
11634e5a62dbSBen Hutchings *
11644e5a62dbSBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
11654e5a62dbSBen Hutchings * number of test results that will be returned. They must allocate a
11664e5a62dbSBen Hutchings * buffer of the appropriate size (8 * number of results) immediately
11674e5a62dbSBen Hutchings * following this structure.
11684e5a62dbSBen Hutchings */
1169607ca46eSDavid Howells struct ethtool_test {
11704e5a62dbSBen Hutchings __u32 cmd;
11714e5a62dbSBen Hutchings __u32 flags;
1172607ca46eSDavid Howells __u32 reserved;
11734e5a62dbSBen Hutchings __u32 len;
117494dfc73eSGustavo A. R. Silva __u64 data[];
1175607ca46eSDavid Howells };
1176607ca46eSDavid Howells
117759091229SBen Hutchings /**
117859091229SBen Hutchings * struct ethtool_stats - device-specific statistics
117959091229SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTATS
118059091229SBen Hutchings * @n_stats: On return, the number of statistics
118159091229SBen Hutchings * @data: Array of statistics
118259091229SBen Hutchings *
118359091229SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
118459091229SBen Hutchings * number of statistics that will be returned. They must allocate a
118559091229SBen Hutchings * buffer of the appropriate size (8 * number of statistics)
118659091229SBen Hutchings * immediately following this structure.
118759091229SBen Hutchings */
1188607ca46eSDavid Howells struct ethtool_stats {
118959091229SBen Hutchings __u32 cmd;
119059091229SBen Hutchings __u32 n_stats;
119194dfc73eSGustavo A. R. Silva __u64 data[];
1192607ca46eSDavid Howells };
1193607ca46eSDavid Howells
1194f432c095SBen Hutchings /**
1195f432c095SBen Hutchings * struct ethtool_perm_addr - permanent hardware address
1196f432c095SBen Hutchings * @cmd: Command number = %ETHTOOL_GPERMADDR
1197f432c095SBen Hutchings * @size: On entry, the size of the buffer. On return, the size of the
1198f432c095SBen Hutchings * address. The command fails if the buffer is too small.
1199f432c095SBen Hutchings * @data: Buffer for the address
1200f432c095SBen Hutchings *
1201f432c095SBen Hutchings * Users must allocate the buffer immediately following this structure.
1202f432c095SBen Hutchings * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
1203f432c095SBen Hutchings * type.
1204f432c095SBen Hutchings */
1205607ca46eSDavid Howells struct ethtool_perm_addr {
1206f432c095SBen Hutchings __u32 cmd;
1207607ca46eSDavid Howells __u32 size;
120894dfc73eSGustavo A. R. Silva __u8 data[];
1209607ca46eSDavid Howells };
1210607ca46eSDavid Howells
1211607ca46eSDavid Howells /* boolean flags controlling per-interface behavior characteristics.
1212607ca46eSDavid Howells * When reading, the flag indicates whether or not a certain behavior
1213607ca46eSDavid Howells * is enabled/present. When writing, the flag indicates whether
1214607ca46eSDavid Howells * or not the driver should turn on (set) or off (clear) a behavior.
1215607ca46eSDavid Howells *
1216607ca46eSDavid Howells * Some behaviors may read-only (unconditionally absent or present).
1217607ca46eSDavid Howells * If such is the case, return EINVAL in the set-flags operation if the
1218607ca46eSDavid Howells * flag differs from the read-only value.
1219607ca46eSDavid Howells */
1220607ca46eSDavid Howells enum ethtool_flags {
1221607ca46eSDavid Howells ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
1222607ca46eSDavid Howells ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
1223607ca46eSDavid Howells ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
1224607ca46eSDavid Howells ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
1225607ca46eSDavid Howells ETH_FLAG_RXHASH = (1 << 28),
1226607ca46eSDavid Howells };
1227607ca46eSDavid Howells
1228607ca46eSDavid Howells /* The following structures are for supporting RX network flow
1229607ca46eSDavid Howells * classification and RX n-tuple configuration. Note, all multibyte
1230607ca46eSDavid Howells * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
1231607ca46eSDavid Howells * be in network byte order.
1232607ca46eSDavid Howells */
1233607ca46eSDavid Howells
1234607ca46eSDavid Howells /**
1235607ca46eSDavid Howells * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
1236607ca46eSDavid Howells * @ip4src: Source host
1237607ca46eSDavid Howells * @ip4dst: Destination host
1238607ca46eSDavid Howells * @psrc: Source port
1239607ca46eSDavid Howells * @pdst: Destination port
1240607ca46eSDavid Howells * @tos: Type-of-service
1241607ca46eSDavid Howells *
1242607ca46eSDavid Howells * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
1243607ca46eSDavid Howells */
1244607ca46eSDavid Howells struct ethtool_tcpip4_spec {
1245607ca46eSDavid Howells __be32 ip4src;
1246607ca46eSDavid Howells __be32 ip4dst;
1247607ca46eSDavid Howells __be16 psrc;
1248607ca46eSDavid Howells __be16 pdst;
1249607ca46eSDavid Howells __u8 tos;
1250607ca46eSDavid Howells };
1251607ca46eSDavid Howells
1252607ca46eSDavid Howells /**
1253607ca46eSDavid Howells * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
1254607ca46eSDavid Howells * @ip4src: Source host
1255607ca46eSDavid Howells * @ip4dst: Destination host
1256607ca46eSDavid Howells * @spi: Security parameters index
1257607ca46eSDavid Howells * @tos: Type-of-service
1258607ca46eSDavid Howells *
1259607ca46eSDavid Howells * This can be used to specify an IPsec transport or tunnel over IPv4.
1260607ca46eSDavid Howells */
1261607ca46eSDavid Howells struct ethtool_ah_espip4_spec {
1262607ca46eSDavid Howells __be32 ip4src;
1263607ca46eSDavid Howells __be32 ip4dst;
1264607ca46eSDavid Howells __be32 spi;
1265607ca46eSDavid Howells __u8 tos;
1266607ca46eSDavid Howells };
1267607ca46eSDavid Howells
1268607ca46eSDavid Howells #define ETH_RX_NFC_IP4 1
1269607ca46eSDavid Howells
1270607ca46eSDavid Howells /**
1271607ca46eSDavid Howells * struct ethtool_usrip4_spec - general flow specification for IPv4
1272607ca46eSDavid Howells * @ip4src: Source host
1273607ca46eSDavid Howells * @ip4dst: Destination host
1274607ca46eSDavid Howells * @l4_4_bytes: First 4 bytes of transport (layer 4) header
1275607ca46eSDavid Howells * @tos: Type-of-service
1276607ca46eSDavid Howells * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
1277607ca46eSDavid Howells * @proto: Transport protocol number; mask must be 0
1278607ca46eSDavid Howells */
1279607ca46eSDavid Howells struct ethtool_usrip4_spec {
1280607ca46eSDavid Howells __be32 ip4src;
1281607ca46eSDavid Howells __be32 ip4dst;
1282607ca46eSDavid Howells __be32 l4_4_bytes;
1283607ca46eSDavid Howells __u8 tos;
1284607ca46eSDavid Howells __u8 ip_ver;
1285607ca46eSDavid Howells __u8 proto;
1286607ca46eSDavid Howells };
1287607ca46eSDavid Howells
128872bb6872SEdward Cree /**
128972bb6872SEdward Cree * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
129072bb6872SEdward Cree * @ip6src: Source host
129172bb6872SEdward Cree * @ip6dst: Destination host
129272bb6872SEdward Cree * @psrc: Source port
129372bb6872SEdward Cree * @pdst: Destination port
129472bb6872SEdward Cree * @tclass: Traffic Class
129572bb6872SEdward Cree *
129672bb6872SEdward Cree * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow.
129772bb6872SEdward Cree */
129872bb6872SEdward Cree struct ethtool_tcpip6_spec {
129972bb6872SEdward Cree __be32 ip6src[4];
130072bb6872SEdward Cree __be32 ip6dst[4];
130172bb6872SEdward Cree __be16 psrc;
130272bb6872SEdward Cree __be16 pdst;
130372bb6872SEdward Cree __u8 tclass;
130472bb6872SEdward Cree };
130572bb6872SEdward Cree
130672bb6872SEdward Cree /**
130772bb6872SEdward Cree * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6
130872bb6872SEdward Cree * @ip6src: Source host
130972bb6872SEdward Cree * @ip6dst: Destination host
131072bb6872SEdward Cree * @spi: Security parameters index
131172bb6872SEdward Cree * @tclass: Traffic Class
131272bb6872SEdward Cree *
131372bb6872SEdward Cree * This can be used to specify an IPsec transport or tunnel over IPv6.
131472bb6872SEdward Cree */
131572bb6872SEdward Cree struct ethtool_ah_espip6_spec {
131672bb6872SEdward Cree __be32 ip6src[4];
131772bb6872SEdward Cree __be32 ip6dst[4];
131872bb6872SEdward Cree __be32 spi;
131972bb6872SEdward Cree __u8 tclass;
132072bb6872SEdward Cree };
132172bb6872SEdward Cree
132272bb6872SEdward Cree /**
132372bb6872SEdward Cree * struct ethtool_usrip6_spec - general flow specification for IPv6
132472bb6872SEdward Cree * @ip6src: Source host
132572bb6872SEdward Cree * @ip6dst: Destination host
132672bb6872SEdward Cree * @l4_4_bytes: First 4 bytes of transport (layer 4) header
132772bb6872SEdward Cree * @tclass: Traffic Class
132872bb6872SEdward Cree * @l4_proto: Transport protocol number (nexthdr after any Extension Headers)
132972bb6872SEdward Cree */
133072bb6872SEdward Cree struct ethtool_usrip6_spec {
133172bb6872SEdward Cree __be32 ip6src[4];
133272bb6872SEdward Cree __be32 ip6dst[4];
133372bb6872SEdward Cree __be32 l4_4_bytes;
133472bb6872SEdward Cree __u8 tclass;
133572bb6872SEdward Cree __u8 l4_proto;
133672bb6872SEdward Cree };
133772bb6872SEdward Cree
1338607ca46eSDavid Howells union ethtool_flow_union {
1339607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec;
1340607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec;
1341607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec;
1342607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec;
1343607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec;
1344607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec;
134572bb6872SEdward Cree struct ethtool_tcpip6_spec tcp_ip6_spec;
134672bb6872SEdward Cree struct ethtool_tcpip6_spec udp_ip6_spec;
134772bb6872SEdward Cree struct ethtool_tcpip6_spec sctp_ip6_spec;
134872bb6872SEdward Cree struct ethtool_ah_espip6_spec ah_ip6_spec;
134972bb6872SEdward Cree struct ethtool_ah_espip6_spec esp_ip6_spec;
135072bb6872SEdward Cree struct ethtool_usrip6_spec usr_ip6_spec;
1351607ca46eSDavid Howells struct ethhdr ether_spec;
1352d4676eacSYan Burman __u8 hdata[52];
1353607ca46eSDavid Howells };
1354607ca46eSDavid Howells
1355dc2e5734SYan Burman /**
1356dc2e5734SYan Burman * struct ethtool_flow_ext - additional RX flow fields
1357dc2e5734SYan Burman * @h_dest: destination MAC address
1358dc2e5734SYan Burman * @vlan_etype: VLAN EtherType
1359dc2e5734SYan Burman * @vlan_tci: VLAN tag control information
1360dc2e5734SYan Burman * @data: user defined data
136183e5feebSJakub Kicinski * @padding: Reserved for future use; see the note on reserved space.
1362dc2e5734SYan Burman *
1363dc2e5734SYan Burman * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
1364dc2e5734SYan Burman * is set in &struct ethtool_rx_flow_spec @flow_type.
1365dc2e5734SYan Burman * @h_dest is valid if %FLOW_MAC_EXT is set.
1366dc2e5734SYan Burman */
1367607ca46eSDavid Howells struct ethtool_flow_ext {
1368d4676eacSYan Burman __u8 padding[2];
1369dc2e5734SYan Burman unsigned char h_dest[ETH_ALEN];
1370607ca46eSDavid Howells __be16 vlan_etype;
1371607ca46eSDavid Howells __be16 vlan_tci;
1372607ca46eSDavid Howells __be32 data[2];
1373607ca46eSDavid Howells };
1374607ca46eSDavid Howells
1375607ca46eSDavid Howells /**
1376607ca46eSDavid Howells * struct ethtool_rx_flow_spec - classification rule for RX flows
1377607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
1378607ca46eSDavid Howells * @h_u: Flow fields to match (dependent on @flow_type)
1379607ca46eSDavid Howells * @h_ext: Additional fields to match
1380607ca46eSDavid Howells * @m_u: Masks for flow field bits to be matched
1381607ca46eSDavid Howells * @m_ext: Masks for additional field bits to be matched
1382607ca46eSDavid Howells * Note, all additional fields must be ignored unless @flow_type
1383dc2e5734SYan Burman * includes the %FLOW_EXT or %FLOW_MAC_EXT flag
1384dc2e5734SYan Burman * (see &struct ethtool_flow_ext description).
1385607ca46eSDavid Howells * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
13866cfef793SFlorian Fainelli * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the
13876cfef793SFlorian Fainelli * packets should be used for Wake-on-LAN with %WAKE_FILTER
1388607ca46eSDavid Howells * @location: Location of rule in the table. Locations must be
1389607ca46eSDavid Howells * numbered such that a flow matching multiple rules will be
1390607ca46eSDavid Howells * classified according to the first (lowest numbered) rule.
1391607ca46eSDavid Howells */
1392607ca46eSDavid Howells struct ethtool_rx_flow_spec {
1393607ca46eSDavid Howells __u32 flow_type;
1394607ca46eSDavid Howells union ethtool_flow_union h_u;
1395607ca46eSDavid Howells struct ethtool_flow_ext h_ext;
1396607ca46eSDavid Howells union ethtool_flow_union m_u;
1397607ca46eSDavid Howells struct ethtool_flow_ext m_ext;
1398607ca46eSDavid Howells __u64 ring_cookie;
1399607ca46eSDavid Howells __u32 location;
1400607ca46eSDavid Howells };
1401607ca46eSDavid Howells
140254e8cb78SStephen Hemminger /* How rings are laid out when accessing virtual functions or
14038cf6f497SJohn Fastabend * offloaded queues is device specific. To allow users to do flow
14048cf6f497SJohn Fastabend * steering and specify these queues the ring cookie is partitioned
14058cf6f497SJohn Fastabend * into a 32bit queue index with an 8 bit virtual function id.
14068cf6f497SJohn Fastabend * This also leaves the 3bytes for further specifiers. It is possible
14078cf6f497SJohn Fastabend * future devices may support more than 256 virtual functions if
14088cf6f497SJohn Fastabend * devices start supporting PCIe w/ARI. However at the moment I
14098cf6f497SJohn Fastabend * do not know of any devices that support this so I do not reserve
14108cf6f497SJohn Fastabend * space for this at this time. If a future patch consumes the next
141154e8cb78SStephen Hemminger * byte it should be aware of this possibility.
14128cf6f497SJohn Fastabend */
14138cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL
14148cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL
14158cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
ethtool_get_flow_spec_ring(__u64 ring_cookie)14168cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
14178cf6f497SJohn Fastabend {
14188cf6f497SJohn Fastabend return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
1419d89d4155SFlorian Fainelli }
14208cf6f497SJohn Fastabend
ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)14218cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
14228cf6f497SJohn Fastabend {
14238cf6f497SJohn Fastabend return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
14248cf6f497SJohn Fastabend ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
1425d89d4155SFlorian Fainelli }
14268cf6f497SJohn Fastabend
1427607ca46eSDavid Howells /**
1428607ca46eSDavid Howells * struct ethtool_rxnfc - command to get or set RX flow classification rules
1429607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
1430607ca46eSDavid Howells * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
1431607ca46eSDavid Howells * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
1432607ca46eSDavid Howells * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
1433607ca46eSDavid Howells * @data: Command-dependent value
1434607ca46eSDavid Howells * @fs: Flow classification rule
143584a1d9c4SEdward Cree * @rss_context: RSS context to be affected
1436607ca46eSDavid Howells * @rule_cnt: Number of rules to be affected
1437607ca46eSDavid Howells * @rule_locs: Array of used rule locations
1438607ca46eSDavid Howells *
1439607ca46eSDavid Howells * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
1440607ca46eSDavid Howells * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
144184a1d9c4SEdward Cree * structure fields must not be used, except that if @flow_type includes
144284a1d9c4SEdward Cree * the %FLOW_RSS flag, then @rss_context determines which RSS context to
144384a1d9c4SEdward Cree * act on.
1444607ca46eSDavid Howells *
1445607ca46eSDavid Howells * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
1446607ca46eSDavid Howells * on return.
1447607ca46eSDavid Howells *
1448607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
1449607ca46eSDavid Howells * rules on return. If @data is non-zero on return then it is the
1450607ca46eSDavid Howells * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
1451607ca46eSDavid Howells * driver supports any special location values. If that flag is not
1452607ca46eSDavid Howells * set in @data then special location values should not be used.
1453607ca46eSDavid Howells *
1454607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
145584a1d9c4SEdward Cree * existing rule on entry and @fs contains the rule on return; if
145684a1d9c4SEdward Cree * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is
145784a1d9c4SEdward Cree * filled with the RSS context ID associated with the rule.
1458607ca46eSDavid Howells *
1459607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
1460607ca46eSDavid Howells * user buffer for @rule_locs on entry. On return, @data is the size
1461607ca46eSDavid Howells * of the rule table, @rule_cnt is the number of defined rules, and
1462607ca46eSDavid Howells * @rule_locs contains the locations of the defined rules. Drivers
1463607ca46eSDavid Howells * must use the second parameter to get_rxnfc() instead of @rule_locs.
1464607ca46eSDavid Howells *
1465607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
1466607ca46eSDavid Howells * @fs.@location either specifies the location to use or is a special
1467607ca46eSDavid Howells * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
146884a1d9c4SEdward Cree * @fs.@location is the actual rule location. If @fs.@flow_type
146984a1d9c4SEdward Cree * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to
147084a1d9c4SEdward Cree * use for flow spreading traffic which matches this rule. The value
147184a1d9c4SEdward Cree * from the rxfh indirection table will be added to @fs.@ring_cookie
147284a1d9c4SEdward Cree * to choose which ring to deliver to.
1473607ca46eSDavid Howells *
1474607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
1475607ca46eSDavid Howells * existing rule on entry.
1476607ca46eSDavid Howells *
1477607ca46eSDavid Howells * A driver supporting the special location values for
1478607ca46eSDavid Howells * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
1479607ca46eSDavid Howells * location, and may remove a rule at a later location (lower
1480607ca46eSDavid Howells * priority) that matches exactly the same set of flows. The special
1481073e3cf2SBen Hutchings * values are %RX_CLS_LOC_ANY, selecting any location;
1482607ca46eSDavid Howells * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
1483607ca46eSDavid Howells * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
1484607ca46eSDavid Howells * location (minimum priority). Additional special values may be
1485607ca46eSDavid Howells * defined in future and drivers must return -%EINVAL for any
1486607ca46eSDavid Howells * unrecognised value.
1487607ca46eSDavid Howells */
1488607ca46eSDavid Howells struct ethtool_rxnfc {
1489607ca46eSDavid Howells __u32 cmd;
1490607ca46eSDavid Howells __u32 flow_type;
1491607ca46eSDavid Howells __u64 data;
1492607ca46eSDavid Howells struct ethtool_rx_flow_spec fs;
149384a1d9c4SEdward Cree union {
1494607ca46eSDavid Howells __u32 rule_cnt;
149584a1d9c4SEdward Cree __u32 rss_context;
149684a1d9c4SEdward Cree };
1497b466a25cSKees Cook __u32 rule_locs[];
1498607ca46eSDavid Howells };
1499607ca46eSDavid Howells
1500607ca46eSDavid Howells
1501607ca46eSDavid Howells /**
1502607ca46eSDavid Howells * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
1503607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
1504607ca46eSDavid Howells * @size: On entry, the array size of the user buffer, which may be zero.
1505607ca46eSDavid Howells * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
1506607ca46eSDavid Howells * indirection table.
1507607ca46eSDavid Howells * @ring_index: RX ring/queue index for each hash value
1508607ca46eSDavid Howells *
1509607ca46eSDavid Howells * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
1510607ca46eSDavid Howells * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
1511607ca46eSDavid Howells * the table should be reset to default values. This last feature
1512607ca46eSDavid Howells * is not supported by the original implementations.
1513607ca46eSDavid Howells */
1514607ca46eSDavid Howells struct ethtool_rxfh_indir {
1515607ca46eSDavid Howells __u32 cmd;
1516607ca46eSDavid Howells __u32 size;
151794dfc73eSGustavo A. R. Silva __u32 ring_index[];
1518607ca46eSDavid Howells };
1519607ca46eSDavid Howells
1520607ca46eSDavid Howells /**
15213de0b592SVenkata Duvvuru * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
15223de0b592SVenkata Duvvuru * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
152384a1d9c4SEdward Cree * @rss_context: RSS context identifier. Context 0 is the default for normal
152484a1d9c4SEdward Cree * traffic; other contexts can be referenced as the destination for RX flow
152584a1d9c4SEdward Cree * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command
152684a1d9c4SEdward Cree * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will
152784a1d9c4SEdward Cree * contain the ID of the newly allocated context.
152838c891a4SBen Hutchings * @indir_size: On entry, the array size of the user buffer for the
152938c891a4SBen Hutchings * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
153038c891a4SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
153138c891a4SBen Hutchings * the array size of the hardware indirection table.
153238c891a4SBen Hutchings * @key_size: On entry, the array size of the user buffer for the hash key,
153338c891a4SBen Hutchings * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
153438c891a4SBen Hutchings * hardware hash key.
1535892311f6SEyal Perry * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
1536892311f6SEyal Perry * Valid values are one of the %ETH_RSS_HASH_*.
153713e59344SAhmed Zaki * @input_xfrm: Defines how the input data is transformed. Valid values are one
153813e59344SAhmed Zaki * of %RXH_XFRM_*.
153983e5feebSJakub Kicinski * @rsvd8: Reserved for future use; see the note on reserved space.
154083e5feebSJakub Kicinski * @rsvd32: Reserved for future use; see the note on reserved space.
15413de0b592SVenkata Duvvuru * @rss_config: RX ring/queue index for each hash value i.e., indirection table
154238c891a4SBen Hutchings * of @indir_size __u32 elements, followed by hash key of @key_size
154338c891a4SBen Hutchings * bytes.
15443de0b592SVenkata Duvvuru *
15453de0b592SVenkata Duvvuru * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
15467455fa24SBen Hutchings * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
15477455fa24SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
15487455fa24SBen Hutchings * and a @indir_size of zero means the indir table should be reset to default
154984a1d9c4SEdward Cree * values (if @rss_context == 0) or that the RSS context should be deleted.
155084a1d9c4SEdward Cree * An hfunc of zero means that hash function setting is not requested.
15513de0b592SVenkata Duvvuru */
15523de0b592SVenkata Duvvuru struct ethtool_rxfh {
15533de0b592SVenkata Duvvuru __u32 cmd;
15543de0b592SVenkata Duvvuru __u32 rss_context;
15553de0b592SVenkata Duvvuru __u32 indir_size;
15563de0b592SVenkata Duvvuru __u32 key_size;
1557892311f6SEyal Perry __u8 hfunc;
155813e59344SAhmed Zaki __u8 input_xfrm;
155913e59344SAhmed Zaki __u8 rsvd8[2];
1560892311f6SEyal Perry __u32 rsvd32;
156194dfc73eSGustavo A. R. Silva __u32 rss_config[];
15623de0b592SVenkata Duvvuru };
156384a1d9c4SEdward Cree #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff
15647455fa24SBen Hutchings #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
15653de0b592SVenkata Duvvuru
15663de0b592SVenkata Duvvuru /**
1567607ca46eSDavid Howells * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
1568607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
1569607ca46eSDavid Howells * @h_u: Flow field values to match (dependent on @flow_type)
1570607ca46eSDavid Howells * @m_u: Masks for flow field value bits to be ignored
1571607ca46eSDavid Howells * @vlan_tag: VLAN tag to match
1572607ca46eSDavid Howells * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
1573607ca46eSDavid Howells * @data: Driver-dependent data to match
1574607ca46eSDavid Howells * @data_mask: Mask for driver-dependent data bits to be ignored
1575607ca46eSDavid Howells * @action: RX ring/queue index to deliver to (non-negative) or other action
1576607ca46eSDavid Howells * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
1577607ca46eSDavid Howells *
1578607ca46eSDavid Howells * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
1579607ca46eSDavid Howells * a field value and mask are both zero this is treated as if all mask
1580607ca46eSDavid Howells * bits are set i.e. the field is ignored.
1581607ca46eSDavid Howells */
1582607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec {
1583607ca46eSDavid Howells __u32 flow_type;
1584607ca46eSDavid Howells union {
1585607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec;
1586607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec;
1587607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec;
1588607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec;
1589607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec;
1590607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec;
1591607ca46eSDavid Howells struct ethhdr ether_spec;
1592607ca46eSDavid Howells __u8 hdata[72];
1593607ca46eSDavid Howells } h_u, m_u;
1594607ca46eSDavid Howells
1595607ca46eSDavid Howells __u16 vlan_tag;
1596607ca46eSDavid Howells __u16 vlan_tag_mask;
1597607ca46eSDavid Howells __u64 data;
1598607ca46eSDavid Howells __u64 data_mask;
1599607ca46eSDavid Howells
1600607ca46eSDavid Howells __s32 action;
1601607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
1602607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
1603607ca46eSDavid Howells };
1604607ca46eSDavid Howells
1605607ca46eSDavid Howells /**
1606607ca46eSDavid Howells * struct ethtool_rx_ntuple - command to set or clear RX flow filter
1607607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_SRXNTUPLE
1608607ca46eSDavid Howells * @fs: Flow filter specification
1609607ca46eSDavid Howells */
1610607ca46eSDavid Howells struct ethtool_rx_ntuple {
1611607ca46eSDavid Howells __u32 cmd;
1612607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec fs;
1613607ca46eSDavid Howells };
1614607ca46eSDavid Howells
1615607ca46eSDavid Howells #define ETHTOOL_FLASH_MAX_FILENAME 128
1616607ca46eSDavid Howells enum ethtool_flash_op_type {
1617607ca46eSDavid Howells ETHTOOL_FLASH_ALL_REGIONS = 0,
1618607ca46eSDavid Howells };
1619607ca46eSDavid Howells
1620607ca46eSDavid Howells /* for passing firmware flashing related parameters */
1621607ca46eSDavid Howells struct ethtool_flash {
1622607ca46eSDavid Howells __u32 cmd;
1623607ca46eSDavid Howells __u32 region;
1624607ca46eSDavid Howells char data[ETHTOOL_FLASH_MAX_FILENAME];
1625607ca46eSDavid Howells };
1626607ca46eSDavid Howells
1627607ca46eSDavid Howells /**
1628607ca46eSDavid Howells * struct ethtool_dump - used for retrieving, setting device dump
1629607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
1630607ca46eSDavid Howells * %ETHTOOL_SET_DUMP
1631607ca46eSDavid Howells * @version: FW version of the dump, filled in by driver
1632607ca46eSDavid Howells * @flag: driver dependent flag for dump setting, filled in by driver during
1633607ca46eSDavid Howells * get and filled in by ethtool for set operation.
1634607ca46eSDavid Howells * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
1635607ca46eSDavid Howells * firmware dump is disabled.
1636607ca46eSDavid Howells * @len: length of dump data, used as the length of the user buffer on entry to
1637607ca46eSDavid Howells * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
1638607ca46eSDavid Howells * for %ETHTOOL_GET_DUMP_FLAG command
1639607ca46eSDavid Howells * @data: data collected for get dump data operation
1640607ca46eSDavid Howells */
1641607ca46eSDavid Howells struct ethtool_dump {
1642607ca46eSDavid Howells __u32 cmd;
1643607ca46eSDavid Howells __u32 version;
1644607ca46eSDavid Howells __u32 flag;
1645607ca46eSDavid Howells __u32 len;
164694dfc73eSGustavo A. R. Silva __u8 data[];
1647607ca46eSDavid Howells };
1648607ca46eSDavid Howells
1649ba569dc3SBen Hutchings #define ETH_FW_DUMP_DISABLE 0
1650ba569dc3SBen Hutchings
1651607ca46eSDavid Howells /* for returning and changing feature sets */
1652607ca46eSDavid Howells
1653607ca46eSDavid Howells /**
1654607ca46eSDavid Howells * struct ethtool_get_features_block - block with state of 32 features
1655607ca46eSDavid Howells * @available: mask of changeable features
1656607ca46eSDavid Howells * @requested: mask of features requested to be enabled if possible
1657607ca46eSDavid Howells * @active: mask of currently enabled features
1658607ca46eSDavid Howells * @never_changed: mask of features not changeable for any device
1659607ca46eSDavid Howells */
1660607ca46eSDavid Howells struct ethtool_get_features_block {
1661607ca46eSDavid Howells __u32 available;
1662607ca46eSDavid Howells __u32 requested;
1663607ca46eSDavid Howells __u32 active;
1664607ca46eSDavid Howells __u32 never_changed;
1665607ca46eSDavid Howells };
1666607ca46eSDavid Howells
1667607ca46eSDavid Howells /**
1668607ca46eSDavid Howells * struct ethtool_gfeatures - command to get state of device's features
1669607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GFEATURES
1670073e3cf2SBen Hutchings * @size: On entry, the number of elements in the features[] array;
1671073e3cf2SBen Hutchings * on return, the number of elements in features[] needed to hold
1672073e3cf2SBen Hutchings * all features
1673607ca46eSDavid Howells * @features: state of features
1674607ca46eSDavid Howells */
1675607ca46eSDavid Howells struct ethtool_gfeatures {
1676607ca46eSDavid Howells __u32 cmd;
1677607ca46eSDavid Howells __u32 size;
167894dfc73eSGustavo A. R. Silva struct ethtool_get_features_block features[];
1679607ca46eSDavid Howells };
1680607ca46eSDavid Howells
1681607ca46eSDavid Howells /**
1682607ca46eSDavid Howells * struct ethtool_set_features_block - block with request for 32 features
1683607ca46eSDavid Howells * @valid: mask of features to be changed
1684607ca46eSDavid Howells * @requested: values of features to be changed
1685607ca46eSDavid Howells */
1686607ca46eSDavid Howells struct ethtool_set_features_block {
1687607ca46eSDavid Howells __u32 valid;
1688607ca46eSDavid Howells __u32 requested;
1689607ca46eSDavid Howells };
1690607ca46eSDavid Howells
1691607ca46eSDavid Howells /**
1692607ca46eSDavid Howells * struct ethtool_sfeatures - command to request change in device's features
1693607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_SFEATURES
1694607ca46eSDavid Howells * @size: array size of the features[] array
1695607ca46eSDavid Howells * @features: feature change masks
1696607ca46eSDavid Howells */
1697607ca46eSDavid Howells struct ethtool_sfeatures {
1698607ca46eSDavid Howells __u32 cmd;
1699607ca46eSDavid Howells __u32 size;
170094dfc73eSGustavo A. R. Silva struct ethtool_set_features_block features[];
1701607ca46eSDavid Howells };
1702607ca46eSDavid Howells
1703607ca46eSDavid Howells /**
1704607ca46eSDavid Howells * struct ethtool_ts_info - holds a device's timestamping and PHC association
1705607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GET_TS_INFO
1706607ca46eSDavid Howells * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
1707607ca46eSDavid Howells * @phc_index: device index of the associated PHC, or -1 if there is none
1708607ca46eSDavid Howells * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
170983e5feebSJakub Kicinski * @tx_reserved: Reserved for future use; see the note on reserved space.
1710607ca46eSDavid Howells * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
171183e5feebSJakub Kicinski * @rx_reserved: Reserved for future use; see the note on reserved space.
1712607ca46eSDavid Howells *
1713607ca46eSDavid Howells * The bits in the 'tx_types' and 'rx_filters' fields correspond to
1714607ca46eSDavid Howells * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
1715607ca46eSDavid Howells * respectively. For example, if the device supports HWTSTAMP_TX_ON,
1716607ca46eSDavid Howells * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
1717eff3cddcSJacob Keller *
1718eff3cddcSJacob Keller * Drivers should only report the filters they actually support without
1719eff3cddcSJacob Keller * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for
1720eff3cddcSJacob Keller * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the
1721eff3cddcSJacob Keller * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op.
1722607ca46eSDavid Howells */
1723607ca46eSDavid Howells struct ethtool_ts_info {
1724607ca46eSDavid Howells __u32 cmd;
1725607ca46eSDavid Howells __u32 so_timestamping;
1726607ca46eSDavid Howells __s32 phc_index;
1727607ca46eSDavid Howells __u32 tx_types;
1728607ca46eSDavid Howells __u32 tx_reserved[3];
1729607ca46eSDavid Howells __u32 rx_filters;
1730607ca46eSDavid Howells __u32 rx_reserved[3];
1731607ca46eSDavid Howells };
1732607ca46eSDavid Howells
1733607ca46eSDavid Howells /*
1734607ca46eSDavid Howells * %ETHTOOL_SFEATURES changes features present in features[].valid to the
1735607ca46eSDavid Howells * values of corresponding bits in features[].requested. Bits in .requested
1736607ca46eSDavid Howells * not set in .valid or not changeable are ignored.
1737607ca46eSDavid Howells *
1738607ca46eSDavid Howells * Returns %EINVAL when .valid contains undefined or never-changeable bits
1739607ca46eSDavid Howells * or size is not equal to required number of features words (32-bit blocks).
1740607ca46eSDavid Howells * Returns >= 0 if request was completed; bits set in the value mean:
1741607ca46eSDavid Howells * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
1742607ca46eSDavid Howells * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
1743607ca46eSDavid Howells * those bits were ignored.
1744607ca46eSDavid Howells * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
1745607ca46eSDavid Howells * resulting state of bits masked by .valid is not equal to .requested.
1746607ca46eSDavid Howells * Probably there are other device-specific constraints on some features
1747607ca46eSDavid Howells * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
1748607ca46eSDavid Howells * here as though ignored bits were cleared.
1749607ca46eSDavid Howells * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
1750607ca46eSDavid Howells * compatibility functions. Requested offload state cannot be properly
1751607ca46eSDavid Howells * managed by kernel.
1752607ca46eSDavid Howells *
1753607ca46eSDavid Howells * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
1754607ca46eSDavid Howells * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
1755607ca46eSDavid Howells * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
1756607ca46eSDavid Howells * significant bit in features[0] fields. Empty strings mark undefined features.
1757607ca46eSDavid Howells */
1758607ca46eSDavid Howells enum ethtool_sfeatures_retval_bits {
1759607ca46eSDavid Howells ETHTOOL_F_UNSUPPORTED__BIT,
1760607ca46eSDavid Howells ETHTOOL_F_WISH__BIT,
1761607ca46eSDavid Howells ETHTOOL_F_COMPAT__BIT,
1762607ca46eSDavid Howells };
1763607ca46eSDavid Howells
1764607ca46eSDavid Howells #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
1765607ca46eSDavid Howells #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
1766607ca46eSDavid Howells #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
1767607ca46eSDavid Howells
1768ac2c7ad0SKan Liang #define MAX_NUM_QUEUE 4096
1769ac2c7ad0SKan Liang
1770ac2c7ad0SKan Liang /**
1771ac2c7ad0SKan Liang * struct ethtool_per_queue_op - apply sub command to the queues in mask.
1772ac2c7ad0SKan Liang * @cmd: ETHTOOL_PERQUEUE
1773ac2c7ad0SKan Liang * @sub_command: the sub command which apply to each queues
1774ac2c7ad0SKan Liang * @queue_mask: Bitmap of the queues which sub command apply to
1775ac2c7ad0SKan Liang * @data: A complete command structure following for each of the queues addressed
1776ac2c7ad0SKan Liang */
1777ac2c7ad0SKan Liang struct ethtool_per_queue_op {
1778ac2c7ad0SKan Liang __u32 cmd;
1779ac2c7ad0SKan Liang __u32 sub_command;
1780b5d3755aSNicolas Dichtel __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
1781ac2c7ad0SKan Liang char data[];
1782ac2c7ad0SKan Liang };
1783607ca46eSDavid Howells
17841a5f3da2SVidya Sagar Ravipati /**
17856dbf94b2SJakub Kicinski * struct ethtool_fecparam - Ethernet Forward Error Correction parameters
17861a5f3da2SVidya Sagar Ravipati * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM
17876dbf94b2SJakub Kicinski * @active_fec: FEC mode which is active on the port, single bit set, GET only.
17886dbf94b2SJakub Kicinski * @fec: Bitmask of configured FEC modes.
1789240e1144SJakub Kicinski * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.
17906dbf94b2SJakub Kicinski *
1791ad1cd785SJakub Kicinski * Note that @reserved was never validated on input and ethtool user space
1792ad1cd785SJakub Kicinski * left it uninitialized when calling SET. Hence going forward it can only be
1793ad1cd785SJakub Kicinski * used to return a value to userspace with GET.
1794ad1cd785SJakub Kicinski *
17956dbf94b2SJakub Kicinski * FEC modes supported by the device can be read via %ETHTOOL_GLINKSETTINGS.
17966dbf94b2SJakub Kicinski * FEC settings are configured by link autonegotiation whenever it's enabled.
17976dbf94b2SJakub Kicinski * With autoneg on %ETHTOOL_GFECPARAM can be used to read the current mode.
17986dbf94b2SJakub Kicinski *
17996dbf94b2SJakub Kicinski * When autoneg is disabled %ETHTOOL_SFECPARAM controls the FEC settings.
18006dbf94b2SJakub Kicinski * It is recommended that drivers only accept a single bit set in @fec.
18016dbf94b2SJakub Kicinski * When multiple bits are set in @fec drivers may pick mode in an implementation
18026dbf94b2SJakub Kicinski * dependent way. Drivers should reject mixing %ETHTOOL_FEC_AUTO_BIT with other
18036dbf94b2SJakub Kicinski * FEC modes, because it's unclear whether in this case other modes constrain
18046dbf94b2SJakub Kicinski * AUTO or are independent choices.
18056dbf94b2SJakub Kicinski * Drivers must reject SET requests if they support none of the requested modes.
18066dbf94b2SJakub Kicinski *
18076dbf94b2SJakub Kicinski * If device does not support FEC drivers may use %ETHTOOL_FEC_NONE instead
18086dbf94b2SJakub Kicinski * of returning %EOPNOTSUPP from %ETHTOOL_GFECPARAM.
18096dbf94b2SJakub Kicinski *
18106dbf94b2SJakub Kicinski * See enum ethtool_fec_config_bits for definition of valid bits for both
18116dbf94b2SJakub Kicinski * @fec and @active_fec.
18121a5f3da2SVidya Sagar Ravipati */
18131a5f3da2SVidya Sagar Ravipati struct ethtool_fecparam {
18141a5f3da2SVidya Sagar Ravipati __u32 cmd;
18151a5f3da2SVidya Sagar Ravipati /* bitmask of FEC modes */
18161a5f3da2SVidya Sagar Ravipati __u32 active_fec;
18171a5f3da2SVidya Sagar Ravipati __u32 fec;
18181a5f3da2SVidya Sagar Ravipati __u32 reserved;
18191a5f3da2SVidya Sagar Ravipati };
18201a5f3da2SVidya Sagar Ravipati
18211a5f3da2SVidya Sagar Ravipati /**
18221a5f3da2SVidya Sagar Ravipati * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration
1823d04feecaSJakub Kicinski * @ETHTOOL_FEC_NONE_BIT: FEC mode configuration is not supported. Should not
18246dbf94b2SJakub Kicinski * be used together with other bits. GET only.
1825d04feecaSJakub Kicinski * @ETHTOOL_FEC_AUTO_BIT: Select default/best FEC mode automatically, usually
1826d04feecaSJakub Kicinski * based link mode and SFP parameters read from module's
1827d04feecaSJakub Kicinski * EEPROM. This bit does _not_ mean autonegotiation.
1828d04feecaSJakub Kicinski * @ETHTOOL_FEC_OFF_BIT: No FEC Mode
1829d04feecaSJakub Kicinski * @ETHTOOL_FEC_RS_BIT: Reed-Solomon FEC Mode
1830d04feecaSJakub Kicinski * @ETHTOOL_FEC_BASER_BIT: Base-R/Reed-Solomon FEC Mode
1831d04feecaSJakub Kicinski * @ETHTOOL_FEC_LLRS_BIT: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet
18326dbf94b2SJakub Kicinski * Consortium)
18331a5f3da2SVidya Sagar Ravipati */
18341a5f3da2SVidya Sagar Ravipati enum ethtool_fec_config_bits {
18351a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_NONE_BIT,
18361a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_AUTO_BIT,
18371a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_OFF_BIT,
18381a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_RS_BIT,
18391a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_BASER_BIT,
1840f623e597SAya Levin ETHTOOL_FEC_LLRS_BIT,
18411a5f3da2SVidya Sagar Ravipati };
18421a5f3da2SVidya Sagar Ravipati
18431a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT)
18441a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT)
18451a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT)
18461a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT)
18471a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT)
1848f623e597SAya Levin #define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT)
18491a5f3da2SVidya Sagar Ravipati
1850607ca46eSDavid Howells /* CMDs currently supported */
18513f1ac7a7SDavid Decotigny #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
18523f1ac7a7SDavid Decotigny * Please use ETHTOOL_GLINKSETTINGS
18533f1ac7a7SDavid Decotigny */
18543f1ac7a7SDavid Decotigny #define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings.
18553f1ac7a7SDavid Decotigny * Please use ETHTOOL_SLINKSETTINGS
18563f1ac7a7SDavid Decotigny */
1857607ca46eSDavid Howells #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
1858607ca46eSDavid Howells #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
1859607ca46eSDavid Howells #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
1860607ca46eSDavid Howells #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
1861607ca46eSDavid Howells #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
1862607ca46eSDavid Howells #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
1863607ca46eSDavid Howells #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
1864607ca46eSDavid Howells /* Get link status for host, i.e. whether the interface *and* the
1865607ca46eSDavid Howells * physical port (if there is one) are up (ethtool_value). */
1866607ca46eSDavid Howells #define ETHTOOL_GLINK 0x0000000a
1867607ca46eSDavid Howells #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
1868607ca46eSDavid Howells #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
1869607ca46eSDavid Howells #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
1870607ca46eSDavid Howells #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
1871607ca46eSDavid Howells #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
1872607ca46eSDavid Howells #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
1873607ca46eSDavid Howells #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
1874607ca46eSDavid Howells #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
1875607ca46eSDavid Howells #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
1876607ca46eSDavid Howells #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
1877607ca46eSDavid Howells #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
1878607ca46eSDavid Howells #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
1879607ca46eSDavid Howells #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
1880607ca46eSDavid Howells * (ethtool_value) */
1881607ca46eSDavid Howells #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
1882607ca46eSDavid Howells * (ethtool_value). */
1883607ca46eSDavid Howells #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
1884607ca46eSDavid Howells #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
1885607ca46eSDavid Howells #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
1886607ca46eSDavid Howells #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
1887607ca46eSDavid Howells #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
1888607ca46eSDavid Howells #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
1889607ca46eSDavid Howells #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
1890607ca46eSDavid Howells #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
1891607ca46eSDavid Howells #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
1892607ca46eSDavid Howells #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
1893607ca46eSDavid Howells #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
1894607ca46eSDavid Howells #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
1895607ca46eSDavid Howells #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
1896607ca46eSDavid Howells #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
1897607ca46eSDavid Howells #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
1898607ca46eSDavid Howells
1899607ca46eSDavid Howells #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
1900607ca46eSDavid Howells #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
1901607ca46eSDavid Howells #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
1902607ca46eSDavid Howells #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
1903607ca46eSDavid Howells #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
1904607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
1905607ca46eSDavid Howells #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
1906607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
1907607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
1908607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
1909607ca46eSDavid Howells #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
1910607ca46eSDavid Howells #define ETHTOOL_RESET 0x00000034 /* Reset hardware */
1911607ca46eSDavid Howells #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
1912607ca46eSDavid Howells #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
1913607ca46eSDavid Howells #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
1914607ca46eSDavid Howells #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
1915607ca46eSDavid Howells #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
1916607ca46eSDavid Howells
1917607ca46eSDavid Howells #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
1918607ca46eSDavid Howells #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
1919607ca46eSDavid Howells #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
1920607ca46eSDavid Howells #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
1921607ca46eSDavid Howells #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1922607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1923607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1924607ca46eSDavid Howells #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
1925607ca46eSDavid Howells #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
1926607ca46eSDavid Howells #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
1927607ca46eSDavid Howells #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
1928607ca46eSDavid Howells #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
1929607ca46eSDavid Howells
19303de0b592SVenkata Duvvuru #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
19313de0b592SVenkata Duvvuru #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
1932f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
1933f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
1934f3a40945SAndrew Lunn #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */
19353de0b592SVenkata Duvvuru
1936ac2c7ad0SKan Liang #define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */
1937ac2c7ad0SKan Liang
19383f1ac7a7SDavid Decotigny #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
19393f1ac7a7SDavid Decotigny #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
19400d27f4e4SRaju Lakkaraju #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */
19410d27f4e4SRaju Lakkaraju #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */
19421a5f3da2SVidya Sagar Ravipati #define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */
19431a5f3da2SVidya Sagar Ravipati #define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */
19443f1ac7a7SDavid Decotigny
1945607ca46eSDavid Howells /* compatibility with older code */
1946607ca46eSDavid Howells #define SPARC_ETH_GSET ETHTOOL_GSET
1947607ca46eSDavid Howells #define SPARC_ETH_SSET ETHTOOL_SSET
1948607ca46eSDavid Howells
19493f1ac7a7SDavid Decotigny /* Link mode bit indices */
19503f1ac7a7SDavid Decotigny enum ethtool_link_mode_bit_indices {
19513f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
19523f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
19533f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
19543f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
19553f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
19563f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
19573f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
19583f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_TP_BIT = 7,
19593f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_AUI_BIT = 8,
19603f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_MII_BIT = 9,
19613f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
19623f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_BNC_BIT = 11,
19633f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
19643f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Pause_BIT = 13,
19653f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
19663f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
19673f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Backplane_BIT = 16,
19683f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
19693f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
19703f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
19713f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
19723f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
19733f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
19743f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
19753f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
19763f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
19773f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
19783f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
19793f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
19803f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
19813f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
19823851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31,
1983e728fdf0SHeiner Kallweit
1984e728fdf0SHeiner Kallweit /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
1985e728fdf0SHeiner Kallweit * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
1986e728fdf0SHeiner Kallweit * macro for bits > 31. The only way to use indices > 31 is to
1987e728fdf0SHeiner Kallweit * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
1988e728fdf0SHeiner Kallweit */
1989e728fdf0SHeiner Kallweit
19903851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32,
19913851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33,
19923851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34,
19933851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35,
19943851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36,
19953851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37,
19963851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38,
19973851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39,
199889da45b8SGal Pressman ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40,
19995711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41,
20005711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42,
20015711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43,
20025711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44,
20035711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45,
20045711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46,
200594842b4fSPavel Belous ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47,
200694842b4fSPavel Belous ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48,
20075711a982SVidya Sagar Ravipati
20081a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49,
20091a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_RS_BIT = 50,
20101a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51,
20112736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 52,
20122736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 53,
20132736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 54,
20142736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 55,
20152736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 56,
20162736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 57,
20172736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 58,
20182736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 59,
20192736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60,
20202736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 61,
20212736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 62,
20222736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 63,
20232736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64,
20242736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65,
20252736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66,
2026b2557764SAndrew Lunn ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67,
2027b2557764SAndrew Lunn ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68,
202814af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 69,
202914af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 70,
203014af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71,
203114af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72,
203214af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73,
2033f623e597SAya Levin ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74,
2034065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75,
2035065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76,
2036065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77,
2037065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78,
2038065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79,
2039065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80,
2040065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81,
2041065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82,
2042065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83,
2043065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84,
2044065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85,
2045065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86,
2046065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87,
2047065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88,
2048065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89,
204955f13311SDan Murphy ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90,
205055f13311SDan Murphy ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91,
20513254e0b9SAlexandru Tachici ETHTOOL_LINK_MODE_10baseT1L_Full_BIT = 92,
2052404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseCR8_Full_BIT = 93,
2053404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseKR8_Full_BIT = 94,
2054404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseDR8_Full_BIT = 95,
2055404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96,
2056404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97,
2057404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98,
205816178c8eSPiergiorgio Beruto ETHTOOL_LINK_MODE_10baseT1S_Full_BIT = 99,
205916178c8eSPiergiorgio Beruto ETHTOOL_LINK_MODE_10baseT1S_Half_BIT = 100,
206016178c8eSPiergiorgio Beruto ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT = 101,
20612c158329SKamil Horák (2N) ETHTOOL_LINK_MODE_10baseT1BRR_Full_BIT = 102,
20624897f9b7SJianbo Liu ETHTOOL_LINK_MODE_200000baseCR_Full_BIT = 103,
20634897f9b7SJianbo Liu ETHTOOL_LINK_MODE_200000baseKR_Full_BIT = 104,
20644897f9b7SJianbo Liu ETHTOOL_LINK_MODE_200000baseDR_Full_BIT = 105,
20654897f9b7SJianbo Liu ETHTOOL_LINK_MODE_200000baseDR_2_Full_BIT = 106,
20664897f9b7SJianbo Liu ETHTOOL_LINK_MODE_200000baseSR_Full_BIT = 107,
20674897f9b7SJianbo Liu ETHTOOL_LINK_MODE_200000baseVR_Full_BIT = 108,
20684897f9b7SJianbo Liu ETHTOOL_LINK_MODE_400000baseCR2_Full_BIT = 109,
20694897f9b7SJianbo Liu ETHTOOL_LINK_MODE_400000baseKR2_Full_BIT = 110,
20704897f9b7SJianbo Liu ETHTOOL_LINK_MODE_400000baseDR2_Full_BIT = 111,
20714897f9b7SJianbo Liu ETHTOOL_LINK_MODE_400000baseDR2_2_Full_BIT = 112,
20724897f9b7SJianbo Liu ETHTOOL_LINK_MODE_400000baseSR2_Full_BIT = 113,
20734897f9b7SJianbo Liu ETHTOOL_LINK_MODE_400000baseVR2_Full_BIT = 114,
20744897f9b7SJianbo Liu ETHTOOL_LINK_MODE_800000baseCR4_Full_BIT = 115,
20754897f9b7SJianbo Liu ETHTOOL_LINK_MODE_800000baseKR4_Full_BIT = 116,
20764897f9b7SJianbo Liu ETHTOOL_LINK_MODE_800000baseDR4_Full_BIT = 117,
20774897f9b7SJianbo Liu ETHTOOL_LINK_MODE_800000baseDR4_2_Full_BIT = 118,
20784897f9b7SJianbo Liu ETHTOOL_LINK_MODE_800000baseSR4_Full_BIT = 119,
20794897f9b7SJianbo Liu ETHTOOL_LINK_MODE_800000baseVR4_Full_BIT = 120,
2080404c7678SAmit Cohen
2081e728fdf0SHeiner Kallweit /* must be last entry */
2082e728fdf0SHeiner Kallweit __ETHTOOL_LINK_MODE_MASK_NBITS
20833f1ac7a7SDavid Decotigny };
20843f1ac7a7SDavid Decotigny
20853f1ac7a7SDavid Decotigny #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
20863f1ac7a7SDavid Decotigny (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
20873f1ac7a7SDavid Decotigny
20883f1ac7a7SDavid Decotigny /* DEPRECATED macros. Please migrate to
20893f1ac7a7SDavid Decotigny * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
20903f1ac7a7SDavid Decotigny * define any new SUPPORTED_* macro for bits > 31.
20913f1ac7a7SDavid Decotigny */
20923f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
20933f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
20943f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
20953f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
20963f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
20973f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
20983f1ac7a7SDavid Decotigny #define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
20993f1ac7a7SDavid Decotigny #define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
21003f1ac7a7SDavid Decotigny #define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
21013f1ac7a7SDavid Decotigny #define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
21023f1ac7a7SDavid Decotigny #define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
21033f1ac7a7SDavid Decotigny #define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
21043f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
21053f1ac7a7SDavid Decotigny #define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
21063f1ac7a7SDavid Decotigny #define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
21073f1ac7a7SDavid Decotigny #define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
21083f1ac7a7SDavid Decotigny #define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
21093f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
21103f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
21113f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
21123f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
21133f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
21143f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
21153f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
21163f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
21173f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
21183f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
21193f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
21203f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
21213f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
21223f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
21233f1ac7a7SDavid Decotigny /* Please do not define any new SUPPORTED_* macro for bits > 31, see
21243f1ac7a7SDavid Decotigny * notice above.
21253f1ac7a7SDavid Decotigny */
21263f1ac7a7SDavid Decotigny
21273f1ac7a7SDavid Decotigny /*
21283f1ac7a7SDavid Decotigny * DEPRECATED macros. Please migrate to
21293f1ac7a7SDavid Decotigny * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
21303f1ac7a7SDavid Decotigny * define any new ADERTISE_* macro for bits > 31.
21313f1ac7a7SDavid Decotigny */
21323f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
21333f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
21343f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
21353f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
21363f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
21373f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
21383f1ac7a7SDavid Decotigny #define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
21393f1ac7a7SDavid Decotigny #define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
21403f1ac7a7SDavid Decotigny #define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
21413f1ac7a7SDavid Decotigny #define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
21423f1ac7a7SDavid Decotigny #define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
21433f1ac7a7SDavid Decotigny #define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
21443f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
21453f1ac7a7SDavid Decotigny #define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
21463f1ac7a7SDavid Decotigny #define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
21473f1ac7a7SDavid Decotigny #define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
21483f1ac7a7SDavid Decotigny #define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
21493f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
21503f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
21513f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
21523f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
21533f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
21543f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
21553f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
21563f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
21573f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
21583f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
21593f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
21603f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
21613f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
21623f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
21633f1ac7a7SDavid Decotigny /* Please do not define any new ADVERTISED_* macro for bits > 31, see
21643f1ac7a7SDavid Decotigny * notice above.
21653f1ac7a7SDavid Decotigny */
2166607ca46eSDavid Howells
2167607ca46eSDavid Howells /* The following are all involved in forcing a particular link
2168607ca46eSDavid Howells * mode for the device for setting things. When getting the
2169607ca46eSDavid Howells * devices settings, these indicate the current mode and whether
2170607ca46eSDavid Howells * it was forced up into this mode or autonegotiated.
2171607ca46eSDavid Howells */
2172607ca46eSDavid Howells
2173297fb414SNicolas Dichtel /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal.
2174297fb414SNicolas Dichtel * Update drivers/net/phy/phy.c:phy_speed_to_str() and
2175297fb414SNicolas Dichtel * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values.
2176297fb414SNicolas Dichtel */
2177607ca46eSDavid Howells #define SPEED_10 10
2178607ca46eSDavid Howells #define SPEED_100 100
2179607ca46eSDavid Howells #define SPEED_1000 1000
2180607ca46eSDavid Howells #define SPEED_2500 2500
2181c9a70d43SParav Pandit #define SPEED_5000 5000
2182607ca46eSDavid Howells #define SPEED_10000 10000
21830d7e2d21SZhu Yanjun #define SPEED_14000 14000
2184dcf972a3SSaeed Mahameed #define SPEED_20000 20000
2185c9a70d43SParav Pandit #define SPEED_25000 25000
2186dcf972a3SSaeed Mahameed #define SPEED_40000 40000
2187c9a70d43SParav Pandit #define SPEED_50000 50000
2188dcf972a3SSaeed Mahameed #define SPEED_56000 56000
2189c9a70d43SParav Pandit #define SPEED_100000 100000
21902736d94fSAya Levin #define SPEED_200000 200000
219114af7fd1SJiri Pirko #define SPEED_400000 400000
2192404c7678SAmit Cohen #define SPEED_800000 800000
2193dcf972a3SSaeed Mahameed
2194607ca46eSDavid Howells #define SPEED_UNKNOWN -1
2195607ca46eSDavid Howells
ethtool_validate_speed(__u32 speed)2196103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_speed(__u32 speed)
2197103a8ad1SNikolay Aleksandrov {
2198afe64245SMichael Zhivich return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
2199103a8ad1SNikolay Aleksandrov }
2200103a8ad1SNikolay Aleksandrov
2201607ca46eSDavid Howells /* Duplex, half or full. */
2202607ca46eSDavid Howells #define DUPLEX_HALF 0x00
2203607ca46eSDavid Howells #define DUPLEX_FULL 0x01
2204607ca46eSDavid Howells #define DUPLEX_UNKNOWN 0xff
2205607ca46eSDavid Howells
ethtool_validate_duplex(__u8 duplex)2206103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_duplex(__u8 duplex)
2207103a8ad1SNikolay Aleksandrov {
2208103a8ad1SNikolay Aleksandrov switch (duplex) {
2209103a8ad1SNikolay Aleksandrov case DUPLEX_HALF:
2210103a8ad1SNikolay Aleksandrov case DUPLEX_FULL:
2211103a8ad1SNikolay Aleksandrov case DUPLEX_UNKNOWN:
2212103a8ad1SNikolay Aleksandrov return 1;
2213103a8ad1SNikolay Aleksandrov }
2214103a8ad1SNikolay Aleksandrov
2215103a8ad1SNikolay Aleksandrov return 0;
2216103a8ad1SNikolay Aleksandrov }
2217103a8ad1SNikolay Aleksandrov
2218bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_UNSUPPORTED 0
2219bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_UNKNOWN 1
2220bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_MASTER_PREFERRED 2
2221bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_SLAVE_PREFERRED 3
2222bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_MASTER_FORCE 4
2223bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_SLAVE_FORCE 5
2224bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_UNSUPPORTED 0
2225bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_UNKNOWN 1
2226bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_MASTER 2
2227bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_SLAVE 3
2228bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_ERR 4
2229bdbdac76SOleksij Rempel
22300c3e10cbSSean Anderson /* These are used to throttle the rate of data on the phy interface when the
22310c3e10cbSSean Anderson * native speed of the interface is higher than the link speed. These should
22320c3e10cbSSean Anderson * not be used for phy interfaces which natively support multiple speeds (e.g.
22330c3e10cbSSean Anderson * MII or SGMII).
22340c3e10cbSSean Anderson */
22350c3e10cbSSean Anderson /* No rate matching performed. */
22360c3e10cbSSean Anderson #define RATE_MATCH_NONE 0
22370c3e10cbSSean Anderson /* The phy sends pause frames to throttle the MAC. */
22380c3e10cbSSean Anderson #define RATE_MATCH_PAUSE 1
22390c3e10cbSSean Anderson /* The phy asserts CRS to prevent the MAC from transmitting. */
22400c3e10cbSSean Anderson #define RATE_MATCH_CRS 2
22410c3e10cbSSean Anderson /* The MAC is programmed with a sufficiently-large IPG. */
22420c3e10cbSSean Anderson #define RATE_MATCH_OPEN_LOOP 3
22430c3e10cbSSean Anderson
2244607ca46eSDavid Howells /* Which connector port. */
2245607ca46eSDavid Howells #define PORT_TP 0x00
2246607ca46eSDavid Howells #define PORT_AUI 0x01
2247607ca46eSDavid Howells #define PORT_MII 0x02
2248607ca46eSDavid Howells #define PORT_FIBRE 0x03
2249607ca46eSDavid Howells #define PORT_BNC 0x04
2250607ca46eSDavid Howells #define PORT_DA 0x05
2251607ca46eSDavid Howells #define PORT_NONE 0xef
2252607ca46eSDavid Howells #define PORT_OTHER 0xff
2253607ca46eSDavid Howells
2254607ca46eSDavid Howells /* Which transceiver to use. */
22557ec87211SFlorian Fainelli #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */
22567ec87211SFlorian Fainelli #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */
2257607ca46eSDavid Howells #define XCVR_DUMMY1 0x02
2258607ca46eSDavid Howells #define XCVR_DUMMY2 0x03
2259607ca46eSDavid Howells #define XCVR_DUMMY3 0x04
2260607ca46eSDavid Howells
2261bf8fc60aSBen Hutchings /* Enable or disable autonegotiation. */
2262607ca46eSDavid Howells #define AUTONEG_DISABLE 0x00
2263607ca46eSDavid Howells #define AUTONEG_ENABLE 0x01
2264607ca46eSDavid Howells
2265607ca46eSDavid Howells /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
2266607ca46eSDavid Howells * the driver is required to renegotiate link
2267607ca46eSDavid Howells */
2268607ca46eSDavid Howells #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
2269607ca46eSDavid Howells #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
2270607ca46eSDavid Howells #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
2271607ca46eSDavid Howells #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
2272607ca46eSDavid Howells
2273607ca46eSDavid Howells /* Wake-On-Lan options. */
2274607ca46eSDavid Howells #define WAKE_PHY (1 << 0)
2275607ca46eSDavid Howells #define WAKE_UCAST (1 << 1)
2276607ca46eSDavid Howells #define WAKE_MCAST (1 << 2)
2277607ca46eSDavid Howells #define WAKE_BCAST (1 << 3)
2278607ca46eSDavid Howells #define WAKE_ARP (1 << 4)
2279607ca46eSDavid Howells #define WAKE_MAGIC (1 << 5)
2280607ca46eSDavid Howells #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
22816cfef793SFlorian Fainelli #define WAKE_FILTER (1 << 7)
2282607ca46eSDavid Howells
228351ea22b0SMichal Kubecek #define WOL_MODE_COUNT 8
228451ea22b0SMichal Kubecek
228513e59344SAhmed Zaki /* RSS hash function data
228613e59344SAhmed Zaki * XOR the corresponding source and destination fields of each specified
228713e59344SAhmed Zaki * protocol. Both copies of the XOR'ed fields are fed into the RSS and RXHASH
228813e59344SAhmed Zaki * calculation. Note that this XORing reduces the input set entropy and could
228913e59344SAhmed Zaki * be exploited to reduce the RSS queue spread.
229013e59344SAhmed Zaki */
229113e59344SAhmed Zaki #define RXH_XFRM_SYM_XOR (1 << 0)
2292*ecdff893SGal Pressman /* Similar to SYM_XOR, except that one copy of the XOR'ed fields is replaced by
2293*ecdff893SGal Pressman * an OR of the same fields
2294*ecdff893SGal Pressman */
2295*ecdff893SGal Pressman #define RXH_XFRM_SYM_OR_XOR (1 << 1)
22960dd415d1SAhmed Zaki #define RXH_XFRM_NO_CHANGE 0xff
229713e59344SAhmed Zaki
2298607ca46eSDavid Howells /* L2-L4 network traffic flow types */
2299607ca46eSDavid Howells #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
2300607ca46eSDavid Howells #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
2301607ca46eSDavid Howells #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
2302607ca46eSDavid Howells #define AH_ESP_V4_FLOW 0x04 /* hash only */
230372bb6872SEdward Cree #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */
230472bb6872SEdward Cree #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */
230572bb6872SEdward Cree #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */
2306607ca46eSDavid Howells #define AH_ESP_V6_FLOW 0x08 /* hash only */
2307607ca46eSDavid Howells #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
2308607ca46eSDavid Howells #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
230972bb6872SEdward Cree #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */
231072bb6872SEdward Cree #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */
231172bb6872SEdward Cree #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
231272bb6872SEdward Cree #define IP_USER_FLOW IPV4_USER_FLOW
231372bb6872SEdward Cree #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */
2314607ca46eSDavid Howells #define IPV4_FLOW 0x10 /* hash only */
2315607ca46eSDavid Howells #define IPV6_FLOW 0x11 /* hash only */
2316607ca46eSDavid Howells #define ETHER_FLOW 0x12 /* spec only (ether_spec) */
23170ed3bba1STakeru Hayasaka
23180ed3bba1STakeru Hayasaka /* Used for GTP-U IPv4 and IPv6.
23190ed3bba1STakeru Hayasaka * The format of GTP packets only includes
23200ed3bba1STakeru Hayasaka * elements such as TEID and GTP version.
23210ed3bba1STakeru Hayasaka * It is primarily intended for data communication of the UE.
23220ed3bba1STakeru Hayasaka */
23230ed3bba1STakeru Hayasaka #define GTPU_V4_FLOW 0x13 /* hash only */
23240ed3bba1STakeru Hayasaka #define GTPU_V6_FLOW 0x14 /* hash only */
23250ed3bba1STakeru Hayasaka
23260ed3bba1STakeru Hayasaka /* Use for GTP-C IPv4 and v6.
23270ed3bba1STakeru Hayasaka * The format of these GTP packets does not include TEID.
23280ed3bba1STakeru Hayasaka * Primarily expected to be used for communication
23290ed3bba1STakeru Hayasaka * to create sessions for UE data communication,
23300ed3bba1STakeru Hayasaka * commonly referred to as CSR (Create Session Request).
23310ed3bba1STakeru Hayasaka */
23320ed3bba1STakeru Hayasaka #define GTPC_V4_FLOW 0x15 /* hash only */
23330ed3bba1STakeru Hayasaka #define GTPC_V6_FLOW 0x16 /* hash only */
23340ed3bba1STakeru Hayasaka
23350ed3bba1STakeru Hayasaka /* Use for GTP-C IPv4 and v6.
23360ed3bba1STakeru Hayasaka * Unlike GTPC_V4_FLOW, the format of these GTP packets includes TEID.
23370ed3bba1STakeru Hayasaka * After session creation, it becomes this packet.
23380ed3bba1STakeru Hayasaka * This is mainly used for requests to realize UE handover.
23390ed3bba1STakeru Hayasaka */
23400ed3bba1STakeru Hayasaka #define GTPC_TEID_V4_FLOW 0x17 /* hash only */
23410ed3bba1STakeru Hayasaka #define GTPC_TEID_V6_FLOW 0x18 /* hash only */
23420ed3bba1STakeru Hayasaka
23430ed3bba1STakeru Hayasaka /* Use for GTP-U and extended headers for the PSC (PDU Session Container).
23440ed3bba1STakeru Hayasaka * The format of these GTP packets includes TEID and QFI.
23450ed3bba1STakeru Hayasaka * In 5G communication using UPF (User Plane Function),
23460ed3bba1STakeru Hayasaka * data communication with this extended header is performed.
23470ed3bba1STakeru Hayasaka */
23480ed3bba1STakeru Hayasaka #define GTPU_EH_V4_FLOW 0x19 /* hash only */
23490ed3bba1STakeru Hayasaka #define GTPU_EH_V6_FLOW 0x1a /* hash only */
23500ed3bba1STakeru Hayasaka
23510ed3bba1STakeru Hayasaka /* Use for GTP-U IPv4 and v6 PSC (PDU Session Container) extended headers.
23520ed3bba1STakeru Hayasaka * This differs from GTPU_EH_V(4|6)_FLOW in that it is distinguished by
23530ed3bba1STakeru Hayasaka * UL/DL included in the PSC.
23540ed3bba1STakeru Hayasaka * There are differences in the data included based on Downlink/Uplink,
23550ed3bba1STakeru Hayasaka * and can be used to distinguish packets.
23560ed3bba1STakeru Hayasaka * The functions described so far are useful when you want to
23570ed3bba1STakeru Hayasaka * handle communication from the mobile network in UPF, PGW, etc.
23580ed3bba1STakeru Hayasaka */
23590ed3bba1STakeru Hayasaka #define GTPU_UL_V4_FLOW 0x1b /* hash only */
23600ed3bba1STakeru Hayasaka #define GTPU_UL_V6_FLOW 0x1c /* hash only */
23610ed3bba1STakeru Hayasaka #define GTPU_DL_V4_FLOW 0x1d /* hash only */
23620ed3bba1STakeru Hayasaka #define GTPU_DL_V6_FLOW 0x1e /* hash only */
23630ed3bba1STakeru Hayasaka
2364607ca46eSDavid Howells /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
2365607ca46eSDavid Howells #define FLOW_EXT 0x80000000
2366d4676eacSYan Burman #define FLOW_MAC_EXT 0x40000000
236784a1d9c4SEdward Cree /* Flag to enable RSS spreading of traffic matching rule (nfc only) */
236884a1d9c4SEdward Cree #define FLOW_RSS 0x20000000
2369607ca46eSDavid Howells
2370607ca46eSDavid Howells /* L3-L4 network traffic flow hash options */
2371607ca46eSDavid Howells #define RXH_L2DA (1 << 1)
2372607ca46eSDavid Howells #define RXH_VLAN (1 << 2)
2373607ca46eSDavid Howells #define RXH_L3_PROTO (1 << 3)
2374607ca46eSDavid Howells #define RXH_IP_SRC (1 << 4)
2375607ca46eSDavid Howells #define RXH_IP_DST (1 << 5)
2376607ca46eSDavid Howells #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
2377607ca46eSDavid Howells #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
23780ed3bba1STakeru Hayasaka #define RXH_GTP_TEID (1 << 8) /* teid in case of GTP */
2379607ca46eSDavid Howells #define RXH_DISCARD (1 << 31)
2380607ca46eSDavid Howells
2381607ca46eSDavid Howells #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
23826cfef793SFlorian Fainelli #define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL
2383607ca46eSDavid Howells
2384607ca46eSDavid Howells /* Special RX classification rule insert location values */
2385607ca46eSDavid Howells #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
2386607ca46eSDavid Howells #define RX_CLS_LOC_ANY 0xffffffff
2387607ca46eSDavid Howells #define RX_CLS_LOC_FIRST 0xfffffffe
2388607ca46eSDavid Howells #define RX_CLS_LOC_LAST 0xfffffffd
2389607ca46eSDavid Howells
2390607ca46eSDavid Howells /* EEPROM Standards for plug in modules */
2391607ca46eSDavid Howells #define ETH_MODULE_SFF_8079 0x1
2392607ca46eSDavid Howells #define ETH_MODULE_SFF_8079_LEN 256
2393607ca46eSDavid Howells #define ETH_MODULE_SFF_8472 0x2
2394607ca46eSDavid Howells #define ETH_MODULE_SFF_8472_LEN 512
23957202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636 0x3
23967202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636_LEN 256
23977202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436 0x4
23987202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436_LEN 256
2399607ca46eSDavid Howells
24000e1a2a3eSErez Alfasi #define ETH_MODULE_SFF_8636_MAX_LEN 640
24010e1a2a3eSErez Alfasi #define ETH_MODULE_SFF_8436_MAX_LEN 640
24020e1a2a3eSErez Alfasi
2403607ca46eSDavid Howells /* Reset flags */
2404607ca46eSDavid Howells /* The reset() operation must clear the flags for the components which
2405607ca46eSDavid Howells * were actually reset. On successful return, the flags indicate the
2406607ca46eSDavid Howells * components which were not reset, either because they do not exist
2407607ca46eSDavid Howells * in the hardware or because they cannot be reset independently. The
2408607ca46eSDavid Howells * driver must never reset any components that were not requested.
2409607ca46eSDavid Howells */
2410607ca46eSDavid Howells enum ethtool_reset_flags {
2411607ca46eSDavid Howells /* These flags represent components dedicated to the interface
2412607ca46eSDavid Howells * the command is addressed to. Shift any flag left by
2413607ca46eSDavid Howells * ETH_RESET_SHARED_SHIFT to reset a shared component of the
2414607ca46eSDavid Howells * same type.
2415607ca46eSDavid Howells */
2416607ca46eSDavid Howells ETH_RESET_MGMT = 1 << 0, /* Management processor */
2417607ca46eSDavid Howells ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
2418607ca46eSDavid Howells ETH_RESET_DMA = 1 << 2, /* DMA engine */
2419607ca46eSDavid Howells ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
2420607ca46eSDavid Howells ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
2421607ca46eSDavid Howells ETH_RESET_MAC = 1 << 5, /* Media access controller */
2422607ca46eSDavid Howells ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
2423607ca46eSDavid Howells ETH_RESET_RAM = 1 << 7, /* RAM shared between
2424607ca46eSDavid Howells * multiple components */
242540e44a1eSScott Branden ETH_RESET_AP = 1 << 8, /* Application processor */
2426607ca46eSDavid Howells
2427607ca46eSDavid Howells ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
2428607ca46eSDavid Howells * this interface */
2429607ca46eSDavid Howells ETH_RESET_ALL = 0xffffffff, /* All components used by this
2430607ca46eSDavid Howells * interface, even if shared */
2431607ca46eSDavid Howells };
2432607ca46eSDavid Howells #define ETH_RESET_SHARED_SHIFT 16
2433607ca46eSDavid Howells
24343f1ac7a7SDavid Decotigny
24353f1ac7a7SDavid Decotigny /**
24363f1ac7a7SDavid Decotigny * struct ethtool_link_settings - link control and status
24373f1ac7a7SDavid Decotigny *
24383f1ac7a7SDavid Decotigny * IMPORTANT, Backward compatibility notice: When implementing new
24393f1ac7a7SDavid Decotigny * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
24403f1ac7a7SDavid Decotigny * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
24413f1ac7a7SDavid Decotigny * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
24423f1ac7a7SDavid Decotigny * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
24433f1ac7a7SDavid Decotigny * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
24443f1ac7a7SDavid Decotigny * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
24453f1ac7a7SDavid Decotigny * settings; do not use %ETHTOOL_SLINKSETTINGS if
24463f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS failed: stick to
24473f1ac7a7SDavid Decotigny * %ETHTOOL_GSET/%ETHTOOL_SSET in that case.
24483f1ac7a7SDavid Decotigny *
24493f1ac7a7SDavid Decotigny * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
24503f1ac7a7SDavid Decotigny * @speed: Link speed (Mbps)
24513f1ac7a7SDavid Decotigny * @duplex: Duplex mode; one of %DUPLEX_*
24523f1ac7a7SDavid Decotigny * @port: Physical connector type; one of %PORT_*
24533f1ac7a7SDavid Decotigny * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
24543f1ac7a7SDavid Decotigny * applicable. For clause 45 PHYs this is the PRTAD.
24553f1ac7a7SDavid Decotigny * @autoneg: Enable/disable autonegotiation and auto-detection;
24563f1ac7a7SDavid Decotigny * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
24573f1ac7a7SDavid Decotigny * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
24583f1ac7a7SDavid Decotigny * protocols supported by the interface; 0 if unknown.
24593f1ac7a7SDavid Decotigny * Read-only.
24603f1ac7a7SDavid Decotigny * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
24613f1ac7a7SDavid Decotigny * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
24623f1ac7a7SDavid Decotigny * value will be %ETH_TP_MDI_INVALID. Read-only.
24633f1ac7a7SDavid Decotigny * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
24643f1ac7a7SDavid Decotigny * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
24653f1ac7a7SDavid Decotigny * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
24663f1ac7a7SDavid Decotigny * When written successfully, the link should be renegotiated if
24673f1ac7a7SDavid Decotigny * necessary.
24683f1ac7a7SDavid Decotigny * @link_mode_masks_nwords: Number of 32-bit words for each of the
24693f1ac7a7SDavid Decotigny * supported, advertising, lp_advertising link mode bitmaps. For
24703f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
24713f1ac7a7SDavid Decotigny * (>= 0); on return, if handshake in progress, negative if
24723f1ac7a7SDavid Decotigny * request size unsupported by kernel: absolute value indicates
24735f2d4724SDavid Decotigny * kernel expected size and all the other fields but cmd
24745f2d4724SDavid Decotigny * are 0; otherwise (handshake completed), strictly positive
24755f2d4724SDavid Decotigny * to indicate size used by kernel and cmd field stays
24763f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
24773f1ac7a7SDavid Decotigny * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
24783f1ac7a7SDavid Decotigny * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
24793f1ac7a7SDavid Decotigny * refused. For drivers: ignore this field (use kernel's
24803f1ac7a7SDavid Decotigny * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
24813f1ac7a7SDavid Decotigny * be overwritten by kernel.
248219cab887SFlorian Fainelli * @transceiver: Used to distinguish different possible PHY types,
248319cab887SFlorian Fainelli * reported consistently by PHYLIB. Read-only.
2484d9c65de0SJakub Kicinski * @master_slave_cfg: Master/slave port mode.
2485d9c65de0SJakub Kicinski * @master_slave_state: Master/slave port state.
24860c3e10cbSSean Anderson * @rate_matching: Rate adaptation performed by the PHY
248783e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space.
2488d9c65de0SJakub Kicinski * @link_mode_masks: Variable length bitmaps.
24893f1ac7a7SDavid Decotigny *
24903f1ac7a7SDavid Decotigny * If autonegotiation is disabled, the speed and @duplex represent the
24913f1ac7a7SDavid Decotigny * fixed link mode and are writable if the driver supports multiple
24923f1ac7a7SDavid Decotigny * link modes. If it is enabled then they are read-only; if the link
24933f1ac7a7SDavid Decotigny * is up they represent the negotiated link mode; if the link is down,
24943f1ac7a7SDavid Decotigny * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
24953f1ac7a7SDavid Decotigny * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
24963f1ac7a7SDavid Decotigny *
24973f1ac7a7SDavid Decotigny * Some hardware interfaces may have multiple PHYs and/or physical
24983f1ac7a7SDavid Decotigny * connectors fitted or do not allow the driver to detect which are
24993f1ac7a7SDavid Decotigny * fitted. For these interfaces @port and/or @phy_address may be
25003f1ac7a7SDavid Decotigny * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
25013f1ac7a7SDavid Decotigny * Otherwise, attempts to write different values may be ignored or
25023f1ac7a7SDavid Decotigny * rejected.
25033f1ac7a7SDavid Decotigny *
25043f1ac7a7SDavid Decotigny * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
25059b300495SMichal Kubecek * are not available in %ethtool_link_settings. These fields will be
25069b300495SMichal Kubecek * always set to zero in %ETHTOOL_GSET reply and %ETHTOOL_SSET will
25079b300495SMichal Kubecek * fail if any of them is set to non-zero value.
25083f1ac7a7SDavid Decotigny *
25093f1ac7a7SDavid Decotigny * Users should assume that all fields not marked read-only are
25103f1ac7a7SDavid Decotigny * writable and subject to validation by the driver. They should use
25113f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
25123f1ac7a7SDavid Decotigny * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
25133f1ac7a7SDavid Decotigny *
25143f1ac7a7SDavid Decotigny * Drivers that implement %get_link_ksettings and/or
25153f1ac7a7SDavid Decotigny * %set_link_ksettings should ignore the @cmd
25163f1ac7a7SDavid Decotigny * and @link_mode_masks_nwords fields (any change to them overwritten
25173f1ac7a7SDavid Decotigny * by kernel), and rely only on kernel's internal
25183f1ac7a7SDavid Decotigny * %__ETHTOOL_LINK_MODE_MASK_NBITS and
25193f1ac7a7SDavid Decotigny * %ethtool_link_mode_mask_t. Drivers that implement
25203f1ac7a7SDavid Decotigny * %set_link_ksettings() should validate all fields other than @cmd
25213f1ac7a7SDavid Decotigny * and @link_mode_masks_nwords that are not described as read-only or
25223f1ac7a7SDavid Decotigny * deprecated, and must ignore all fields described as read-only.
2523d0c3891dSJonathan Corbet *
2524d0c3891dSJonathan Corbet * @link_mode_masks is divided into three bitfields, each of length
2525d0c3891dSJonathan Corbet * @link_mode_masks_nwords:
2526d0c3891dSJonathan Corbet * - supported: Bitmap with each bit meaning given by
2527d0c3891dSJonathan Corbet * %ethtool_link_mode_bit_indices for the link modes, physical
2528d0c3891dSJonathan Corbet * connectors and other link features for which the interface
2529d0c3891dSJonathan Corbet * supports autonegotiation or auto-detection. Read-only.
2530d0c3891dSJonathan Corbet * - advertising: Bitmap with each bit meaning given by
2531d0c3891dSJonathan Corbet * %ethtool_link_mode_bit_indices for the link modes, physical
2532d0c3891dSJonathan Corbet * connectors and other link features that are advertised through
2533d0c3891dSJonathan Corbet * autonegotiation or enabled for auto-detection.
2534d0c3891dSJonathan Corbet * - lp_advertising: Bitmap with each bit meaning given by
2535d0c3891dSJonathan Corbet * %ethtool_link_mode_bit_indices for the link modes, and other
2536d0c3891dSJonathan Corbet * link features that the link partner advertised through
2537d0c3891dSJonathan Corbet * autonegotiation; 0 if unknown or not applicable. Read-only.
25383f1ac7a7SDavid Decotigny */
25393f1ac7a7SDavid Decotigny struct ethtool_link_settings {
25403f1ac7a7SDavid Decotigny __u32 cmd;
25413f1ac7a7SDavid Decotigny __u32 speed;
25423f1ac7a7SDavid Decotigny __u8 duplex;
25433f1ac7a7SDavid Decotigny __u8 port;
25443f1ac7a7SDavid Decotigny __u8 phy_address;
25453f1ac7a7SDavid Decotigny __u8 autoneg;
25463f1ac7a7SDavid Decotigny __u8 mdio_support;
25473f1ac7a7SDavid Decotigny __u8 eth_tp_mdix;
25483f1ac7a7SDavid Decotigny __u8 eth_tp_mdix_ctrl;
25493f1ac7a7SDavid Decotigny __s8 link_mode_masks_nwords;
255019cab887SFlorian Fainelli __u8 transceiver;
2551bdbdac76SOleksij Rempel __u8 master_slave_cfg;
2552bdbdac76SOleksij Rempel __u8 master_slave_state;
25530c3e10cbSSean Anderson __u8 rate_matching;
255419cab887SFlorian Fainelli __u32 reserved[7];
255596c677fcSKees Cook #ifndef __KERNEL__
255696c677fcSKees Cook /* Linux builds with -Wflex-array-member-not-at-end but does
255796c677fcSKees Cook * not use the "link_mode_masks" member. Leave it defined for
255896c677fcSKees Cook * userspace for now, and when userspace wants to start using
255996c677fcSKees Cook * -Wfamnae, we'll need a new solution.
256096c677fcSKees Cook */
256194dfc73eSGustavo A. R. Silva __u32 link_mode_masks[];
25623f1ac7a7SDavid Decotigny /* layout of link_mode_masks fields:
25633f1ac7a7SDavid Decotigny * __u32 map_supported[link_mode_masks_nwords];
25643f1ac7a7SDavid Decotigny * __u32 map_advertising[link_mode_masks_nwords];
25653f1ac7a7SDavid Decotigny * __u32 map_lp_advertising[link_mode_masks_nwords];
25663f1ac7a7SDavid Decotigny */
256796c677fcSKees Cook #endif
25683f1ac7a7SDavid Decotigny };
256938496878SMaxime Chevallier
257038496878SMaxime Chevallier /**
257138496878SMaxime Chevallier * enum phy_upstream - Represents the upstream component a given PHY device
257238496878SMaxime Chevallier * is connected to, as in what is on the other end of the MII bus. Most PHYs
257338496878SMaxime Chevallier * will be attached to an Ethernet MAC controller, but in some cases, there's
257438496878SMaxime Chevallier * an intermediate PHY used as a media-converter, which will driver another
257538496878SMaxime Chevallier * MII interface as its output.
257638496878SMaxime Chevallier * @PHY_UPSTREAM_MAC: Upstream component is a MAC (a switch port,
257738496878SMaxime Chevallier * or ethernet controller)
257838496878SMaxime Chevallier * @PHY_UPSTREAM_PHY: Upstream component is a PHY (likely a media converter)
257938496878SMaxime Chevallier */
258038496878SMaxime Chevallier enum phy_upstream {
258138496878SMaxime Chevallier PHY_UPSTREAM_MAC,
258238496878SMaxime Chevallier PHY_UPSTREAM_PHY,
258338496878SMaxime Chevallier };
258438496878SMaxime Chevallier
2585607ca46eSDavid Howells #endif /* _UAPI_LINUX_ETHTOOL_H */
2586