zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

ethtool.h (102722B) - Raw


      1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
      2 /*
      3  * ethtool.h: Defines for Linux ethtool.
      4  *
      5  * Copyright (C) 1998 David S. Miller (davem@redhat.com)
      6  * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
      7  * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
      8  * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
      9  *                                christopher.leech@intel.com,
     10  *                                scott.feldman@intel.com)
     11  * Portions Copyright (C) Sun Microsystems 2008
     12  */
     13 
     14 #ifndef _LINUX_ETHTOOL_H
     15 #define _LINUX_ETHTOOL_H
     16 
     17 #include <linux/const.h>
     18 #include <linux/types.h>
     19 #include <linux/if_ether.h>
     20 
     21 #include <limits.h> /* for INT_MAX */
     22 
     23 /* All structures exposed to userland should be defined such that they
     24  * have the same layout for 32-bit and 64-bit userland.
     25  */
     26 
     27 /* Note on reserved space.
     28  * Reserved fields must not be accessed directly by user space because
     29  * they may be replaced by a different field in the future. They must
     30  * be initialized to zero before making the request, e.g. via memset
     31  * of the entire structure or implicitly by not being set in a structure
     32  * initializer.
     33  */
     34 
     35 /**
     36  * struct ethtool_cmd - DEPRECATED, link control and status
     37  * This structure is DEPRECATED, please use struct ethtool_link_settings.
     38  * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
     39  * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
     40  *	physical connectors and other link features for which the
     41  *	interface supports autonegotiation or auto-detection.
     42  *	Read-only.
     43  * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
     44  *	physical connectors and other link features that are
     45  *	advertised through autonegotiation or enabled for
     46  *	auto-detection.
     47  * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
     48  * @duplex: Duplex mode; one of %DUPLEX_*
     49  * @port: Physical connector type; one of %PORT_*
     50  * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
     51  *	applicable.  For clause 45 PHYs this is the PRTAD.
     52  * @transceiver: Historically used to distinguish different possible
     53  *	PHY types, but not in a consistent way.  Deprecated.
     54  * @autoneg: Enable/disable autonegotiation and auto-detection;
     55  *	either %AUTONEG_DISABLE or %AUTONEG_ENABLE
     56  * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
     57  *	protocols supported by the interface; 0 if unknown.
     58  *	Read-only.
     59  * @maxtxpkt: Historically used to report TX IRQ coalescing; now
     60  *	obsoleted by &struct ethtool_coalesce.  Read-only; deprecated.
     61  * @maxrxpkt: Historically used to report RX IRQ coalescing; now
     62  *	obsoleted by &struct ethtool_coalesce.  Read-only; deprecated.
     63  * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
     64  * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
     65  *	%ETH_TP_MDI_*.  If the status is unknown or not applicable, the
     66  *	value will be %ETH_TP_MDI_INVALID.  Read-only.
     67  * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
     68  *	%ETH_TP_MDI_*.  If MDI(-X) control is not implemented, reads
     69  *	yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
     70  *	When written successfully, the link should be renegotiated if
     71  *	necessary.
     72  * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
     73  *	and other link features that the link partner advertised
     74  *	through autonegotiation; 0 if unknown or not applicable.
     75  *	Read-only.
     76  * @reserved: Reserved for future use; see the note on reserved space.
     77  *
     78  * The link speed in Mbps is split between @speed and @speed_hi.  Use
     79  * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
     80  * access it.
     81  *
     82  * If autonegotiation is disabled, the speed and @duplex represent the
     83  * fixed link mode and are writable if the driver supports multiple
     84  * link modes.  If it is enabled then they are read-only; if the link
     85  * is up they represent the negotiated link mode; if the link is down,
     86  * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
     87  * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
     88  *
     89  * Some hardware interfaces may have multiple PHYs and/or physical
     90  * connectors fitted or do not allow the driver to detect which are
     91  * fitted.  For these interfaces @port and/or @phy_address may be
     92  * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
     93  * Otherwise, attempts to write different values may be ignored or
     94  * rejected.
     95  *
     96  * Users should assume that all fields not marked read-only are
     97  * writable and subject to validation by the driver.  They should use
     98  * %ETHTOOL_GSET to get the current values before making specific
     99  * changes and then applying them with %ETHTOOL_SSET.
    100  *
    101  * Deprecated fields should be ignored by both users and drivers.
    102  */
    103 struct ethtool_cmd {
    104 	__u32	cmd;
    105 	__u32	supported;
    106 	__u32	advertising;
    107 	__u16	speed;
    108 	__u8	duplex;
    109 	__u8	port;
    110 	__u8	phy_address;
    111 	__u8	transceiver;
    112 	__u8	autoneg;
    113 	__u8	mdio_support;
    114 	__u32	maxtxpkt;
    115 	__u32	maxrxpkt;
    116 	__u16	speed_hi;
    117 	__u8	eth_tp_mdix;
    118 	__u8	eth_tp_mdix_ctrl;
    119 	__u32	lp_advertising;
    120 	__u32	reserved[2];
    121 };
    122 
    123 static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
    124 					 __u32 speed)
    125 {
    126 	ep->speed = (__u16)(speed & 0xFFFF);
    127 	ep->speed_hi = (__u16)(speed >> 16);
    128 }
    129 
    130 static __inline__ __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
    131 {
    132 	return (ep->speed_hi << 16) | ep->speed;
    133 }
    134 
    135 /* Device supports clause 22 register access to PHY or peripherals
    136  * using the interface defined in <linux/mii.h>.  This should not be
    137  * set if there are known to be no such peripherals present or if
    138  * the driver only emulates clause 22 registers for compatibility.
    139  */
    140 #define ETH_MDIO_SUPPORTS_C22	1
    141 
    142 /* Device supports clause 45 register access to PHY or peripherals
    143  * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
    144  * This should not be set if there are known to be no such peripherals
    145  * present.
    146  */
    147 #define ETH_MDIO_SUPPORTS_C45	2
    148 
    149 #define ETHTOOL_FWVERS_LEN	32
    150 #define ETHTOOL_BUSINFO_LEN	32
    151 #define ETHTOOL_EROMVERS_LEN	32
    152 
    153 /**
    154  * struct ethtool_drvinfo - general driver and device information
    155  * @cmd: Command number = %ETHTOOL_GDRVINFO
    156  * @driver: Driver short name.  This should normally match the name
    157  *	in its bus driver structure (e.g. pci_driver::name).  Must
    158  *	not be an empty string.
    159  * @version: Driver version string; may be an empty string
    160  * @fw_version: Firmware version string; driver defined; may be an
    161  *	empty string
    162  * @erom_version: Expansion ROM version string; driver defined; may be
    163  *	an empty string
    164  * @bus_info: Device bus address.  This should match the dev_name()
    165  *	string for the underlying bus device, if there is one.  May be
    166  *	an empty string.
    167  * @reserved2: Reserved for future use; see the note on reserved space.
    168  * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
    169  *	%ETHTOOL_SPFLAGS commands; also the number of strings in the
    170  *	%ETH_SS_PRIV_FLAGS set
    171  * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
    172  *	command; also the number of strings in the %ETH_SS_STATS set
    173  * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
    174  *	command; also the number of strings in the %ETH_SS_TEST set
    175  * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
    176  *	and %ETHTOOL_SEEPROM commands, in bytes
    177  * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
    178  *	command, in bytes
    179  *
    180  * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
    181  * strings in any string set (from Linux 2.6.34).
    182  */
    183 struct ethtool_drvinfo {
    184 	__u32	cmd;
    185 	char	driver[32];
    186 	char	version[32];
    187 	char	fw_version[ETHTOOL_FWVERS_LEN];
    188 	char	bus_info[ETHTOOL_BUSINFO_LEN];
    189 	char	erom_version[ETHTOOL_EROMVERS_LEN];
    190 	char	reserved2[12];
    191 	__u32	n_priv_flags;
    192 	__u32	n_stats;
    193 	__u32	testinfo_len;
    194 	__u32	eedump_len;
    195 	__u32	regdump_len;
    196 };
    197 
    198 #define SOPASS_MAX	6
    199 
    200 /**
    201  * struct ethtool_wolinfo - Wake-On-Lan configuration
    202  * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
    203  * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
    204  *	Read-only.
    205  * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
    206  * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
    207  *	is set in @wolopts.
    208  */
    209 struct ethtool_wolinfo {
    210 	__u32	cmd;
    211 	__u32	supported;
    212 	__u32	wolopts;
    213 	__u8	sopass[SOPASS_MAX];
    214 };
    215 
    216 /* for passing single values */
    217 struct ethtool_value {
    218 	__u32	cmd;
    219 	__u32	data;
    220 };
    221 
    222 #define PFC_STORM_PREVENTION_AUTO	0xffff
    223 #define PFC_STORM_PREVENTION_DISABLE	0
    224 
    225 enum tunable_id {
    226 	ETHTOOL_ID_UNSPEC,
    227 	ETHTOOL_RX_COPYBREAK,
    228 	ETHTOOL_TX_COPYBREAK,
    229 	ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
    230 	ETHTOOL_TX_COPYBREAK_BUF_SIZE,
    231 	/*
    232 	 * Add your fresh new tunable attribute above and remember to update
    233 	 * tunable_strings[] in net/ethtool/common.c
    234 	 */
    235 	__ETHTOOL_TUNABLE_COUNT,
    236 };
    237 
    238 enum tunable_type_id {
    239 	ETHTOOL_TUNABLE_UNSPEC,
    240 	ETHTOOL_TUNABLE_U8,
    241 	ETHTOOL_TUNABLE_U16,
    242 	ETHTOOL_TUNABLE_U32,
    243 	ETHTOOL_TUNABLE_U64,
    244 	ETHTOOL_TUNABLE_STRING,
    245 	ETHTOOL_TUNABLE_S8,
    246 	ETHTOOL_TUNABLE_S16,
    247 	ETHTOOL_TUNABLE_S32,
    248 	ETHTOOL_TUNABLE_S64,
    249 };
    250 
    251 struct ethtool_tunable {
    252 	__u32	cmd;
    253 	__u32	id;
    254 	__u32	type_id;
    255 	__u32	len;
    256 	void	*data[];
    257 };
    258 
    259 #define DOWNSHIFT_DEV_DEFAULT_COUNT	0xff
    260 #define DOWNSHIFT_DEV_DISABLE		0
    261 
    262 /* Time in msecs after which link is reported as down
    263  * 0 = lowest time supported by the PHY
    264  * 0xff = off, link down detection according to standard
    265  */
    266 #define ETHTOOL_PHY_FAST_LINK_DOWN_ON	0
    267 #define ETHTOOL_PHY_FAST_LINK_DOWN_OFF	0xff
    268 
    269 /* Energy Detect Power Down (EDPD) is a feature supported by some PHYs, where
    270  * the PHY's RX & TX blocks are put into a low-power mode when there is no
    271  * link detected (typically cable is un-plugged). For RX, only a minimal
    272  * link-detection is available, and for TX the PHY wakes up to send link pulses
    273  * to avoid any lock-ups in case the peer PHY may also be running in EDPD mode.
    274  *
    275  * Some PHYs may support configuration of the wake-up interval for TX pulses,
    276  * and some PHYs may support only disabling TX pulses entirely. For the latter
    277  * a special value is required (ETHTOOL_PHY_EDPD_NO_TX) so that this can be
    278  * configured from userspace (should the user want it).
    279  *
    280  * The interval units for TX wake-up are in milliseconds, since this should
    281  * cover a reasonable range of intervals:
    282  *  - from 1 millisecond, which does not sound like much of a power-saver
    283  *  - to ~65 seconds which is quite a lot to wait for a link to come up when
    284  *    plugging a cable
    285  */
    286 #define ETHTOOL_PHY_EDPD_DFLT_TX_MSECS		0xffff
    287 #define ETHTOOL_PHY_EDPD_NO_TX			0xfffe
    288 #define ETHTOOL_PHY_EDPD_DISABLE		0
    289 
    290 enum phy_tunable_id {
    291 	ETHTOOL_PHY_ID_UNSPEC,
    292 	ETHTOOL_PHY_DOWNSHIFT,
    293 	ETHTOOL_PHY_FAST_LINK_DOWN,
    294 	ETHTOOL_PHY_EDPD,
    295 	/*
    296 	 * Add your fresh new phy tunable attribute above and remember to update
    297 	 * phy_tunable_strings[] in net/ethtool/common.c
    298 	 */
    299 	__ETHTOOL_PHY_TUNABLE_COUNT,
    300 };
    301 
    302 /**
    303  * struct ethtool_regs - hardware register dump
    304  * @cmd: Command number = %ETHTOOL_GREGS
    305  * @version: Dump format version.  This is driver-specific and may
    306  *	distinguish different chips/revisions.  Drivers must use new
    307  *	version numbers whenever the dump format changes in an
    308  *	incompatible way.
    309  * @len: On entry, the real length of @data.  On return, the number of
    310  *	bytes used.
    311  * @data: Buffer for the register dump
    312  *
    313  * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
    314  * a register dump for the interface.  They must allocate the buffer
    315  * immediately following this structure.
    316  */
    317 struct ethtool_regs {
    318 	__u32	cmd;
    319 	__u32	version;
    320 	__u32	len;
    321 	__u8	data[];
    322 };
    323 
    324 /**
    325  * struct ethtool_eeprom - EEPROM dump
    326  * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
    327  *	%ETHTOOL_SEEPROM
    328  * @magic: A 'magic cookie' value to guard against accidental changes.
    329  *	The value passed in to %ETHTOOL_SEEPROM must match the value
    330  *	returned by %ETHTOOL_GEEPROM for the same device.  This is
    331  *	unused when @cmd is %ETHTOOL_GMODULEEEPROM.
    332  * @offset: Offset within the EEPROM to begin reading/writing, in bytes
    333  * @len: On entry, number of bytes to read/write.  On successful
    334  *	return, number of bytes actually read/written.  In case of
    335  *	error, this may indicate at what point the error occurred.
    336  * @data: Buffer to read/write from
    337  *
    338  * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
    339  * the length of an on-board or module EEPROM, respectively.  They
    340  * must allocate the buffer immediately following this structure.
    341  */
    342 struct ethtool_eeprom {
    343 	__u32	cmd;
    344 	__u32	magic;
    345 	__u32	offset;
    346 	__u32	len;
    347 	__u8	data[];
    348 };
    349 
    350 /**
    351  * struct ethtool_eee - Energy Efficient Ethernet information
    352  * @cmd: ETHTOOL_{G,S}EEE
    353  * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
    354  *	for which there is EEE support.
    355  * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
    356  *	advertised as eee capable.
    357  * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
    358  *	combinations advertised by the link partner as eee capable.
    359  * @eee_active: Result of the eee auto negotiation.
    360  * @eee_enabled: EEE configured mode (enabled/disabled).
    361  * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
    362  *	that eee was negotiated.
    363  * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
    364  *	its tx lpi (after reaching 'idle' state). Effective only when eee
    365  *	was negotiated and tx_lpi_enabled was set.
    366  * @reserved: Reserved for future use; see the note on reserved space.
    367  */
    368 struct ethtool_eee {
    369 	__u32	cmd;
    370 	__u32	supported;
    371 	__u32	advertised;
    372 	__u32	lp_advertised;
    373 	__u32	eee_active;
    374 	__u32	eee_enabled;
    375 	__u32	tx_lpi_enabled;
    376 	__u32	tx_lpi_timer;
    377 	__u32	reserved[2];
    378 };
    379 
    380 /**
    381  * struct ethtool_modinfo - plugin module eeprom information
    382  * @cmd: %ETHTOOL_GMODULEINFO
    383  * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
    384  * @eeprom_len: Length of the eeprom
    385  * @reserved: Reserved for future use; see the note on reserved space.
    386  *
    387  * This structure is used to return the information to
    388  * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
    389  * The type code indicates the eeprom data format
    390  */
    391 struct ethtool_modinfo {
    392 	__u32   cmd;
    393 	__u32   type;
    394 	__u32   eeprom_len;
    395 	__u32   reserved[8];
    396 };
    397 
    398 /**
    399  * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
    400  * @cmd: ETHTOOL_{G,S}COALESCE
    401  * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
    402  *	a packet arrives.
    403  * @rx_max_coalesced_frames: Maximum number of packets to receive
    404  *	before an RX interrupt.
    405  * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
    406  *	this value applies while an IRQ is being serviced by the host.
    407  * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
    408  *	except that this value applies while an IRQ is being serviced
    409  *	by the host.
    410  * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
    411  *	a packet is sent.
    412  * @tx_max_coalesced_frames: Maximum number of packets to be sent
    413  *	before a TX interrupt.
    414  * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
    415  *	this value applies while an IRQ is being serviced by the host.
    416  * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
    417  *	except that this value applies while an IRQ is being serviced
    418  *	by the host.
    419  * @stats_block_coalesce_usecs: How many usecs to delay in-memory
    420  *	statistics block updates.  Some drivers do not have an
    421  *	in-memory statistic block, and in such cases this value is
    422  *	ignored.  This value must not be zero.
    423  * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
    424  * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
    425  * @pkt_rate_low: Threshold for low packet rate (packets per second).
    426  * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
    427  *	a packet arrives, when the packet rate is below @pkt_rate_low.
    428  * @rx_max_coalesced_frames_low: Maximum number of packets to be received
    429  *	before an RX interrupt, when the packet rate is below @pkt_rate_low.
    430  * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
    431  *	a packet is sent, when the packet rate is below @pkt_rate_low.
    432  * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
    433  *	a TX interrupt, when the packet rate is below @pkt_rate_low.
    434  * @pkt_rate_high: Threshold for high packet rate (packets per second).
    435  * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
    436  *	a packet arrives, when the packet rate is above @pkt_rate_high.
    437  * @rx_max_coalesced_frames_high: Maximum number of packets to be received
    438  *	before an RX interrupt, when the packet rate is above @pkt_rate_high.
    439  * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
    440  *	a packet is sent, when the packet rate is above @pkt_rate_high.
    441  * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
    442  *	a TX interrupt, when the packet rate is above @pkt_rate_high.
    443  * @rate_sample_interval: How often to do adaptive coalescing packet rate
    444  *	sampling, measured in seconds.  Must not be zero.
    445  *
    446  * Each pair of (usecs, max_frames) fields specifies that interrupts
    447  * should be coalesced until
    448  *	(usecs > 0 && time_since_first_completion >= usecs) ||
    449  *	(max_frames > 0 && completed_frames >= max_frames)
    450  *
    451  * It is illegal to set both usecs and max_frames to zero as this
    452  * would cause interrupts to never be generated.  To disable
    453  * coalescing, set usecs = 0 and max_frames = 1.
    454  *
    455  * Some implementations ignore the value of max_frames and use the
    456  * condition time_since_first_completion >= usecs
    457  *
    458  * This is deprecated.  Drivers for hardware that does not support
    459  * counting completions should validate that max_frames == !rx_usecs.
    460  *
    461  * Adaptive RX/TX coalescing is an algorithm implemented by some
    462  * drivers to improve latency under low packet rates and improve
    463  * throughput under high packet rates.  Some drivers only implement
    464  * one of RX or TX adaptive coalescing.  Anything not implemented by
    465  * the driver causes these values to be silently ignored.
    466  *
    467  * When the packet rate is below @pkt_rate_high but above
    468  * @pkt_rate_low (both measured in packets per second) the
    469  * normal {rx,tx}_* coalescing parameters are used.
    470  */
    471 struct ethtool_coalesce {
    472 	__u32	cmd;
    473 	__u32	rx_coalesce_usecs;
    474 	__u32	rx_max_coalesced_frames;
    475 	__u32	rx_coalesce_usecs_irq;
    476 	__u32	rx_max_coalesced_frames_irq;
    477 	__u32	tx_coalesce_usecs;
    478 	__u32	tx_max_coalesced_frames;
    479 	__u32	tx_coalesce_usecs_irq;
    480 	__u32	tx_max_coalesced_frames_irq;
    481 	__u32	stats_block_coalesce_usecs;
    482 	__u32	use_adaptive_rx_coalesce;
    483 	__u32	use_adaptive_tx_coalesce;
    484 	__u32	pkt_rate_low;
    485 	__u32	rx_coalesce_usecs_low;
    486 	__u32	rx_max_coalesced_frames_low;
    487 	__u32	tx_coalesce_usecs_low;
    488 	__u32	tx_max_coalesced_frames_low;
    489 	__u32	pkt_rate_high;
    490 	__u32	rx_coalesce_usecs_high;
    491 	__u32	rx_max_coalesced_frames_high;
    492 	__u32	tx_coalesce_usecs_high;
    493 	__u32	tx_max_coalesced_frames_high;
    494 	__u32	rate_sample_interval;
    495 };
    496 
    497 /**
    498  * struct ethtool_ringparam - RX/TX ring parameters
    499  * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
    500  * @rx_max_pending: Maximum supported number of pending entries per
    501  *	RX ring.  Read-only.
    502  * @rx_mini_max_pending: Maximum supported number of pending entries
    503  *	per RX mini ring.  Read-only.
    504  * @rx_jumbo_max_pending: Maximum supported number of pending entries
    505  *	per RX jumbo ring.  Read-only.
    506  * @tx_max_pending: Maximum supported number of pending entries per
    507  *	TX ring.  Read-only.
    508  * @rx_pending: Current maximum number of pending entries per RX ring
    509  * @rx_mini_pending: Current maximum number of pending entries per RX
    510  *	mini ring
    511  * @rx_jumbo_pending: Current maximum number of pending entries per RX
    512  *	jumbo ring
    513  * @tx_pending: Current maximum supported number of pending entries
    514  *	per TX ring
    515  *
    516  * If the interface does not have separate RX mini and/or jumbo rings,
    517  * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
    518  *
    519  * There may also be driver-dependent minimum values for the number
    520  * of entries per ring.
    521  */
    522 struct ethtool_ringparam {
    523 	__u32	cmd;
    524 	__u32	rx_max_pending;
    525 	__u32	rx_mini_max_pending;
    526 	__u32	rx_jumbo_max_pending;
    527 	__u32	tx_max_pending;
    528 	__u32	rx_pending;
    529 	__u32	rx_mini_pending;
    530 	__u32	rx_jumbo_pending;
    531 	__u32	tx_pending;
    532 };
    533 
    534 /**
    535  * struct ethtool_channels - configuring number of network channel
    536  * @cmd: ETHTOOL_{G,S}CHANNELS
    537  * @max_rx: Read only. Maximum number of receive channel the driver support.
    538  * @max_tx: Read only. Maximum number of transmit channel the driver support.
    539  * @max_other: Read only. Maximum number of other channel the driver support.
    540  * @max_combined: Read only. Maximum number of combined channel the driver
    541  *	support. Set of queues RX, TX or other.
    542  * @rx_count: Valid values are in the range 1 to the max_rx.
    543  * @tx_count: Valid values are in the range 1 to the max_tx.
    544  * @other_count: Valid values are in the range 1 to the max_other.
    545  * @combined_count: Valid values are in the range 1 to the max_combined.
    546  *
    547  * This can be used to configure RX, TX and other channels.
    548  */
    549 
    550 struct ethtool_channels {
    551 	__u32	cmd;
    552 	__u32	max_rx;
    553 	__u32	max_tx;
    554 	__u32	max_other;
    555 	__u32	max_combined;
    556 	__u32	rx_count;
    557 	__u32	tx_count;
    558 	__u32	other_count;
    559 	__u32	combined_count;
    560 };
    561 
    562 /**
    563  * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
    564  * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
    565  * @autoneg: Flag to enable autonegotiation of pause frame use
    566  * @rx_pause: Flag to enable reception of pause frames
    567  * @tx_pause: Flag to enable transmission of pause frames
    568  *
    569  * Drivers should reject a non-zero setting of @autoneg when
    570  * autoneogotiation is disabled (or not supported) for the link.
    571  *
    572  * If the link is autonegotiated, drivers should use
    573  * mii_advertise_flowctrl() or similar code to set the advertised
    574  * pause frame capabilities based on the @rx_pause and @tx_pause flags,
    575  * even if @autoneg is zero.  They should also allow the advertised
    576  * pause frame capabilities to be controlled directly through the
    577  * advertising field of &struct ethtool_cmd.
    578  *
    579  * If @autoneg is non-zero, the MAC is configured to send and/or
    580  * receive pause frames according to the result of autonegotiation.
    581  * Otherwise, it is configured directly based on the @rx_pause and
    582  * @tx_pause flags.
    583  */
    584 struct ethtool_pauseparam {
    585 	__u32	cmd;
    586 	__u32	autoneg;
    587 	__u32	rx_pause;
    588 	__u32	tx_pause;
    589 };
    590 
    591 /* Link extended state */
    592 enum ethtool_link_ext_state {
    593 	ETHTOOL_LINK_EXT_STATE_AUTONEG,
    594 	ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
    595 	ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
    596 	ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY,
    597 	ETHTOOL_LINK_EXT_STATE_NO_CABLE,
    598 	ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
    599 	ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE,
    600 	ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE,
    601 	ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED,
    602 	ETHTOOL_LINK_EXT_STATE_OVERHEAT,
    603 	ETHTOOL_LINK_EXT_STATE_MODULE,
    604 };
    605 
    606 /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */
    607 enum ethtool_link_ext_substate_autoneg {
    608 	ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1,
    609 	ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED,
    610 	ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED,
    611 	ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE,
    612 	ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE,
    613 	ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD,
    614 };
    615 
    616 /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE.
    617  */
    618 enum ethtool_link_ext_substate_link_training {
    619 	ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1,
    620 	ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT,
    621 	ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY,
    622 	ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT,
    623 };
    624 
    625 /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH.
    626  */
    627 enum ethtool_link_ext_substate_link_logical_mismatch {
    628 	ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1,
    629 	ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK,
    630 	ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS,
    631 	ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED,
    632 	ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED,
    633 };
    634 
    635 /* More information in addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY.
    636  */
    637 enum ethtool_link_ext_substate_bad_signal_integrity {
    638 	ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,
    639 	ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,
    640 	ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_REFERENCE_CLOCK_LOST,
    641 	ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_ALOS,
    642 };
    643 
    644 /* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */
    645 enum ethtool_link_ext_substate_cable_issue {
    646 	ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1,
    647 	ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE,
    648 };
    649 
    650 /* More information in addition to ETHTOOL_LINK_EXT_STATE_MODULE. */
    651 enum ethtool_link_ext_substate_module {
    652 	ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY = 1,
    653 };
    654 
    655 #define ETH_GSTRING_LEN		32
    656 
    657 /**
    658  * enum ethtool_stringset - string set ID
    659  * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
    660  * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
    661  * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
    662  *	%ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
    663  * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
    664  *	now deprecated
    665  * @ETH_SS_FEATURES: Device feature names
    666  * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
    667  * @ETH_SS_TUNABLES: tunable names
    668  * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
    669  * @ETH_SS_PHY_TUNABLES: PHY tunable names
    670  * @ETH_SS_LINK_MODES: link mode names
    671  * @ETH_SS_MSG_CLASSES: debug message class names
    672  * @ETH_SS_WOL_MODES: wake-on-lan modes
    673  * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags
    674  * @ETH_SS_TS_TX_TYPES: timestamping Tx types
    675  * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters
    676  * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types
    677  * @ETH_SS_STATS_STD: standardized stats
    678  * @ETH_SS_STATS_ETH_PHY: names of IEEE 802.3 PHY statistics
    679  * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics
    680  * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics
    681  * @ETH_SS_STATS_RMON: names of RMON statistics
    682  *
    683  * @ETH_SS_COUNT: number of defined string sets
    684  */
    685 enum ethtool_stringset {
    686 	ETH_SS_TEST		= 0,
    687 	ETH_SS_STATS,
    688 	ETH_SS_PRIV_FLAGS,
    689 	ETH_SS_NTUPLE_FILTERS,
    690 	ETH_SS_FEATURES,
    691 	ETH_SS_RSS_HASH_FUNCS,
    692 	ETH_SS_TUNABLES,
    693 	ETH_SS_PHY_STATS,
    694 	ETH_SS_PHY_TUNABLES,
    695 	ETH_SS_LINK_MODES,
    696 	ETH_SS_MSG_CLASSES,
    697 	ETH_SS_WOL_MODES,
    698 	ETH_SS_SOF_TIMESTAMPING,
    699 	ETH_SS_TS_TX_TYPES,
    700 	ETH_SS_TS_RX_FILTERS,
    701 	ETH_SS_UDP_TUNNEL_TYPES,
    702 	ETH_SS_STATS_STD,
    703 	ETH_SS_STATS_ETH_PHY,
    704 	ETH_SS_STATS_ETH_MAC,
    705 	ETH_SS_STATS_ETH_CTRL,
    706 	ETH_SS_STATS_RMON,
    707 
    708 	/* add new constants above here */
    709 	ETH_SS_COUNT
    710 };
    711 
    712 /**
    713  * enum ethtool_mac_stats_src - source of ethtool MAC statistics
    714  * @ETHTOOL_MAC_STATS_SRC_AGGREGATE:
    715  *	if device supports a MAC merge layer, this retrieves the aggregate
    716  *	statistics of the eMAC and pMAC. Otherwise, it retrieves just the
    717  *	statistics of the single (express) MAC.
    718  * @ETHTOOL_MAC_STATS_SRC_EMAC:
    719  *	if device supports a MM layer, this retrieves the eMAC statistics.
    720  *	Otherwise, it retrieves the statistics of the single (express) MAC.
    721  * @ETHTOOL_MAC_STATS_SRC_PMAC:
    722  *	if device supports a MM layer, this retrieves the pMAC statistics.
    723  */
    724 enum ethtool_mac_stats_src {
    725 	ETHTOOL_MAC_STATS_SRC_AGGREGATE,
    726 	ETHTOOL_MAC_STATS_SRC_EMAC,
    727 	ETHTOOL_MAC_STATS_SRC_PMAC,
    728 };
    729 
    730 /**
    731  * enum ethtool_module_power_mode_policy - plug-in module power mode policy
    732  * @ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH: Module is always in high power mode.
    733  * @ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO: Module is transitioned by the host
    734  *	to high power mode when the first port using it is put administratively
    735  *	up and to low power mode when the last port using it is put
    736  *	administratively down.
    737  */
    738 enum ethtool_module_power_mode_policy {
    739 	ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH = 1,
    740 	ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO,
    741 };
    742 
    743 /**
    744  * enum ethtool_module_power_mode - plug-in module power mode
    745  * @ETHTOOL_MODULE_POWER_MODE_LOW: Module is in low power mode.
    746  * @ETHTOOL_MODULE_POWER_MODE_HIGH: Module is in high power mode.
    747  */
    748 enum ethtool_module_power_mode {
    749 	ETHTOOL_MODULE_POWER_MODE_LOW = 1,
    750 	ETHTOOL_MODULE_POWER_MODE_HIGH,
    751 };
    752 
    753 /**
    754  * enum ethtool_c33_pse_ext_state - groups of PSE extended states
    755  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    756  *
    757  * @ETHTOOL_C33_PSE_EXT_STATE_ERROR_CONDITION: Group of error_condition states
    758  * @ETHTOOL_C33_PSE_EXT_STATE_MR_MPS_VALID: Group of mr_mps_valid states
    759  * @ETHTOOL_C33_PSE_EXT_STATE_MR_PSE_ENABLE: Group of mr_pse_enable states
    760  * @ETHTOOL_C33_PSE_EXT_STATE_OPTION_DETECT_TED: Group of option_detect_ted
    761  *	states
    762  * @ETHTOOL_C33_PSE_EXT_STATE_OPTION_VPORT_LIM: Group of option_vport_lim states
    763  * @ETHTOOL_C33_PSE_EXT_STATE_OVLD_DETECTED: Group of ovld_detected states
    764  * @ETHTOOL_C33_PSE_EXT_STATE_PD_DLL_POWER_TYPE: Group of pd_dll_power_type
    765  *	states
    766  * @ETHTOOL_C33_PSE_EXT_STATE_POWER_NOT_AVAILABLE: Group of power_not_available
    767  *	states
    768  * @ETHTOOL_C33_PSE_EXT_STATE_SHORT_DETECTED: Group of short_detected states
    769  */
    770 enum ethtool_c33_pse_ext_state {
    771 	ETHTOOL_C33_PSE_EXT_STATE_ERROR_CONDITION = 1,
    772 	ETHTOOL_C33_PSE_EXT_STATE_MR_MPS_VALID,
    773 	ETHTOOL_C33_PSE_EXT_STATE_MR_PSE_ENABLE,
    774 	ETHTOOL_C33_PSE_EXT_STATE_OPTION_DETECT_TED,
    775 	ETHTOOL_C33_PSE_EXT_STATE_OPTION_VPORT_LIM,
    776 	ETHTOOL_C33_PSE_EXT_STATE_OVLD_DETECTED,
    777 	ETHTOOL_C33_PSE_EXT_STATE_PD_DLL_POWER_TYPE,
    778 	ETHTOOL_C33_PSE_EXT_STATE_POWER_NOT_AVAILABLE,
    779 	ETHTOOL_C33_PSE_EXT_STATE_SHORT_DETECTED,
    780 };
    781 
    782 /**
    783  * enum ethtool_c33_pse_ext_substate_mr_mps_valid - mr_mps_valid states
    784  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    785  *
    786  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_DETECTED_UNDERLOAD: Underload
    787  *	state
    788  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_CONNECTION_OPEN: Port is not
    789  *	connected
    790  *
    791  * The PSE monitors either the DC or AC Maintain Power Signature
    792  * (MPS, see 33.2.9.1). This variable indicates the presence or absence of
    793  * a valid MPS.
    794  */
    795 enum ethtool_c33_pse_ext_substate_mr_mps_valid {
    796 	ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_DETECTED_UNDERLOAD = 1,
    797 	ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_MPS_VALID_CONNECTION_OPEN,
    798 };
    799 
    800 /**
    801  * enum ethtool_c33_pse_ext_substate_error_condition - error_condition states
    802  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    803  *
    804  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_NON_EXISTING_PORT: Non-existing
    805  *	port number
    806  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNDEFINED_PORT: Undefined port
    807  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_INTERNAL_HW_FAULT: Internal
    808  *	hardware fault
    809  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_COMM_ERROR_AFTER_FORCE_ON:
    810  *	Communication error after force on
    811  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNKNOWN_PORT_STATUS: Unknown
    812  *	port status
    813  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_TURN_OFF: Host
    814  *	crash turn off
    815  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_FORCE_SHUTDOWN:
    816  *	Host crash force shutdown
    817  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_CONFIG_CHANGE: Configuration
    818  *	change
    819  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_DETECTED_OVER_TEMP: Over
    820  *	temperature detected
    821  *
    822  * error_condition is a variable indicating the status of
    823  * implementation-specific fault conditions or optionally other system faults
    824  * that prevent the PSE from meeting the specifications in Table 33–11 and that
    825  * require the PSE not to source power. These error conditions are different
    826  * from those monitored by the state diagrams in Figure 33–10.
    827  */
    828 enum ethtool_c33_pse_ext_substate_error_condition {
    829 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_NON_EXISTING_PORT = 1,
    830 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNDEFINED_PORT,
    831 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_INTERNAL_HW_FAULT,
    832 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_COMM_ERROR_AFTER_FORCE_ON,
    833 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_UNKNOWN_PORT_STATUS,
    834 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_TURN_OFF,
    835 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_HOST_CRASH_FORCE_SHUTDOWN,
    836 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_CONFIG_CHANGE,
    837 	ETHTOOL_C33_PSE_EXT_SUBSTATE_ERROR_CONDITION_DETECTED_OVER_TEMP,
    838 };
    839 
    840 /**
    841  * enum ethtool_c33_pse_ext_substate_mr_pse_enable - mr_pse_enable states
    842  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    843  *
    844  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_PSE_ENABLE_DISABLE_PIN_ACTIVE: Disable
    845  *	pin active
    846  *
    847  * mr_pse_enable is control variable that selects PSE operation and test
    848  * functions.
    849  */
    850 enum ethtool_c33_pse_ext_substate_mr_pse_enable {
    851 	ETHTOOL_C33_PSE_EXT_SUBSTATE_MR_PSE_ENABLE_DISABLE_PIN_ACTIVE = 1,
    852 };
    853 
    854 /**
    855  * enum ethtool_c33_pse_ext_substate_option_detect_ted - option_detect_ted
    856  *	states functions. IEEE 802.3-2022 33.2.4.4 Variables
    857  *
    858  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_DET_IN_PROCESS: Detection
    859  *	in process
    860  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_CONNECTION_CHECK_ERROR:
    861  *	Connection check error
    862  *
    863  * option_detect_ted is a variable indicating if detection can be performed
    864  * by the PSE during the ted_timer interval.
    865  */
    866 enum ethtool_c33_pse_ext_substate_option_detect_ted {
    867 	ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_DET_IN_PROCESS = 1,
    868 	ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_DETECT_TED_CONNECTION_CHECK_ERROR,
    869 };
    870 
    871 /**
    872  * enum ethtool_c33_pse_ext_substate_option_vport_lim - option_vport_lim states
    873  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    874  *
    875  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_HIGH_VOLTAGE: Main supply
    876  *	voltage is high
    877  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_LOW_VOLTAGE: Main supply
    878  *	voltage is low
    879  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_VOLTAGE_INJECTION: Voltage
    880  *	injection into the port
    881  *
    882  * option_vport_lim is an optional variable indicates if VPSE is out of the
    883  * operating range during normal operating state.
    884  */
    885 enum ethtool_c33_pse_ext_substate_option_vport_lim {
    886 	ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_HIGH_VOLTAGE = 1,
    887 	ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_LOW_VOLTAGE,
    888 	ETHTOOL_C33_PSE_EXT_SUBSTATE_OPTION_VPORT_LIM_VOLTAGE_INJECTION,
    889 };
    890 
    891 /**
    892  * enum ethtool_c33_pse_ext_substate_ovld_detected - ovld_detected states
    893  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    894  *
    895  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_OVLD_DETECTED_OVERLOAD: Overload state
    896  *
    897  * ovld_detected is a variable indicating if the PSE output current has been
    898  * in an overload condition (see 33.2.7.6) for at least TCUT of a one-second
    899  * sliding time.
    900  */
    901 enum ethtool_c33_pse_ext_substate_ovld_detected {
    902 	ETHTOOL_C33_PSE_EXT_SUBSTATE_OVLD_DETECTED_OVERLOAD = 1,
    903 };
    904 
    905 /**
    906  * enum ethtool_c33_pse_ext_substate_power_not_available - power_not_available
    907  *	states functions. IEEE 802.3-2022 33.2.4.4 Variables
    908  *
    909  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_BUDGET_EXCEEDED: Power
    910  *	budget exceeded for the controller
    911  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PORT_PW_LIMIT_EXCEEDS_CONTROLLER_BUDGET:
    912  *	Configured port power limit exceeded controller power budget
    913  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PD_REQUEST_EXCEEDS_PORT_LIMIT:
    914  *	Power request from PD exceeds port limit
    915  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_HW_PW_LIMIT: Power
    916  *	denied due to Hardware power limit
    917  *
    918  * power_not_available is a variable that is asserted in an
    919  * implementation-dependent manner when the PSE is no longer capable of
    920  * sourcing sufficient power to support the attached PD. Sufficient power
    921  * is defined by classification; see 33.2.6.
    922  */
    923 enum ethtool_c33_pse_ext_substate_power_not_available {
    924 	ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_BUDGET_EXCEEDED =  1,
    925 	ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PORT_PW_LIMIT_EXCEEDS_CONTROLLER_BUDGET,
    926 	ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_PD_REQUEST_EXCEEDS_PORT_LIMIT,
    927 	ETHTOOL_C33_PSE_EXT_SUBSTATE_POWER_NOT_AVAILABLE_HW_PW_LIMIT,
    928 };
    929 
    930 /**
    931  * enum ethtool_c33_pse_ext_substate_short_detected - short_detected states
    932  *      functions. IEEE 802.3-2022 33.2.4.4 Variables
    933  *
    934  * @ETHTOOL_C33_PSE_EXT_SUBSTATE_SHORT_DETECTED_SHORT_CONDITION: Short
    935  *	condition was detected
    936  *
    937  * short_detected is a variable indicating if the PSE output current has been
    938  * in a short circuit condition for TLIM within a sliding window (see 33.2.7.7).
    939  */
    940 enum ethtool_c33_pse_ext_substate_short_detected {
    941 	ETHTOOL_C33_PSE_EXT_SUBSTATE_SHORT_DETECTED_SHORT_CONDITION = 1,
    942 };
    943 
    944 /**
    945  * enum ethtool_pse_types - Types of PSE controller.
    946  * @ETHTOOL_PSE_UNKNOWN: Type of PSE controller is unknown
    947  * @ETHTOOL_PSE_PODL: PSE controller which support PoDL
    948  * @ETHTOOL_PSE_C33: PSE controller which support Clause 33 (PoE)
    949  */
    950 enum ethtool_pse_types {
    951 	ETHTOOL_PSE_UNKNOWN =	1 << 0,
    952 	ETHTOOL_PSE_PODL =	1 << 1,
    953 	ETHTOOL_PSE_C33 =	1 << 2,
    954 };
    955 
    956 /**
    957  * enum ethtool_c33_pse_admin_state - operational state of the PoDL PSE
    958  *	functions. IEEE 802.3-2022 30.9.1.1.2 aPSEAdminState
    959  * @ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN: state of PSE functions is unknown
    960  * @ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED: PSE functions are disabled
    961  * @ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED: PSE functions are enabled
    962  */
    963 enum ethtool_c33_pse_admin_state {
    964 	ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN = 1,
    965 	ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED,
    966 	ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED,
    967 };
    968 
    969 /**
    970  * enum ethtool_c33_pse_pw_d_status - power detection status of the PSE.
    971  *	IEEE 802.3-2022 30.9.1.1.3 aPoDLPSEPowerDetectionStatus:
    972  * @ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN: PSE status is unknown
    973  * @ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED: The enumeration "disabled"
    974  *	indicates that the PSE State diagram is in the state DISABLED.
    975  * @ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING: The enumeration "searching"
    976  *	indicates the PSE State diagram is in a state other than those
    977  *	listed.
    978  * @ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING: The enumeration
    979  *	"deliveringPower" indicates that the PSE State diagram is in the
    980  *	state POWER_ON.
    981  * @ETHTOOL_C33_PSE_PW_D_STATUS_TEST: The enumeration "test" indicates that
    982  *	the PSE State diagram is in the state TEST_MODE.
    983  * @ETHTOOL_C33_PSE_PW_D_STATUS_FAULT: The enumeration "fault" indicates that
    984  *	the PSE State diagram is in the state TEST_ERROR.
    985  * @ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT: The enumeration "otherFault"
    986  *	indicates that the PSE State diagram is in the state IDLE due to
    987  *	the variable error_condition = true.
    988  */
    989 enum ethtool_c33_pse_pw_d_status {
    990 	ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN = 1,
    991 	ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED,
    992 	ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING,
    993 	ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING,
    994 	ETHTOOL_C33_PSE_PW_D_STATUS_TEST,
    995 	ETHTOOL_C33_PSE_PW_D_STATUS_FAULT,
    996 	ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT,
    997 };
    998 
    999 /**
   1000  * enum ethtool_podl_pse_admin_state - operational state of the PoDL PSE
   1001  *	functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState
   1002  * @ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN: state of PoDL PSE functions are
   1003  * 	unknown
   1004  * @ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED: PoDL PSE functions are disabled
   1005  * @ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED: PoDL PSE functions are enabled
   1006  */
   1007 enum ethtool_podl_pse_admin_state {
   1008 	ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN = 1,
   1009 	ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED,
   1010 	ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED,
   1011 };
   1012 
   1013 /**
   1014  * enum ethtool_podl_pse_pw_d_status - power detection status of the PoDL PSE.
   1015  *	IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus:
   1016  * @ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN: PoDL PSE
   1017  * @ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED: "The enumeration “disabled” is
   1018  *	asserted true when the PoDL PSE state diagram variable mr_pse_enable is
   1019  *	false"
   1020  * @ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING: "The enumeration “searching” is
   1021  *	asserted true when either of the PSE state diagram variables
   1022  *	pi_detecting or pi_classifying is true."
   1023  * @ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING: "The enumeration “deliveringPower”
   1024  *	is asserted true when the PoDL PSE state diagram variable pi_powered is
   1025  *	true."
   1026  * @ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP: "The enumeration “sleep” is asserted
   1027  *	true when the PoDL PSE state diagram variable pi_sleeping is true."
   1028  * @ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE: "The enumeration “idle” is asserted true
   1029  *	when the logical combination of the PoDL PSE state diagram variables
   1030  *	pi_prebiased*!pi_sleeping is true."
   1031  * @ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR: "The enumeration “error” is asserted
   1032  *	true when the PoDL PSE state diagram variable overload_held is true."
   1033  */
   1034 enum ethtool_podl_pse_pw_d_status {
   1035 	ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN = 1,
   1036 	ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED,
   1037 	ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING,
   1038 	ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING,
   1039 	ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP,
   1040 	ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE,
   1041 	ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR,
   1042 };
   1043 
   1044 /**
   1045  * enum ethtool_mm_verify_status - status of MAC Merge Verify function
   1046  * @ETHTOOL_MM_VERIFY_STATUS_UNKNOWN:
   1047  *	verification status is unknown
   1048  * @ETHTOOL_MM_VERIFY_STATUS_INITIAL:
   1049  *	the 802.3 Verify State diagram is in the state INIT_VERIFICATION
   1050  * @ETHTOOL_MM_VERIFY_STATUS_VERIFYING:
   1051  *	the Verify State diagram is in the state VERIFICATION_IDLE,
   1052  *	SEND_VERIFY or WAIT_FOR_RESPONSE
   1053  * @ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED:
   1054  *	indicates that the Verify State diagram is in the state VERIFIED
   1055  * @ETHTOOL_MM_VERIFY_STATUS_FAILED:
   1056  *	the Verify State diagram is in the state VERIFY_FAIL
   1057  * @ETHTOOL_MM_VERIFY_STATUS_DISABLED:
   1058  *	verification of preemption operation is disabled
   1059  */
   1060 enum ethtool_mm_verify_status {
   1061 	ETHTOOL_MM_VERIFY_STATUS_UNKNOWN,
   1062 	ETHTOOL_MM_VERIFY_STATUS_INITIAL,
   1063 	ETHTOOL_MM_VERIFY_STATUS_VERIFYING,
   1064 	ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED,
   1065 	ETHTOOL_MM_VERIFY_STATUS_FAILED,
   1066 	ETHTOOL_MM_VERIFY_STATUS_DISABLED,
   1067 };
   1068 
   1069 /**
   1070  * enum ethtool_module_fw_flash_status - plug-in module firmware flashing status
   1071  * @ETHTOOL_MODULE_FW_FLASH_STATUS_STARTED: The firmware flashing process has
   1072  *	started.
   1073  * @ETHTOOL_MODULE_FW_FLASH_STATUS_IN_PROGRESS: The firmware flashing process
   1074  *	is in progress.
   1075  * @ETHTOOL_MODULE_FW_FLASH_STATUS_COMPLETED: The firmware flashing process was
   1076  *	completed successfully.
   1077  * @ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR: The firmware flashing process was
   1078  *	stopped due to an error.
   1079  */
   1080 enum ethtool_module_fw_flash_status {
   1081 	ETHTOOL_MODULE_FW_FLASH_STATUS_STARTED = 1,
   1082 	ETHTOOL_MODULE_FW_FLASH_STATUS_IN_PROGRESS,
   1083 	ETHTOOL_MODULE_FW_FLASH_STATUS_COMPLETED,
   1084 	ETHTOOL_MODULE_FW_FLASH_STATUS_ERROR,
   1085 };
   1086 
   1087 /**
   1088  * struct ethtool_gstrings - string set for data tagging
   1089  * @cmd: Command number = %ETHTOOL_GSTRINGS
   1090  * @string_set: String set ID; one of &enum ethtool_stringset
   1091  * @len: On return, the number of strings in the string set
   1092  * @data: Buffer for strings.  Each string is null-padded to a size of
   1093  *	%ETH_GSTRING_LEN.
   1094  *
   1095  * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
   1096  * the string set.  They must allocate a buffer of the appropriate
   1097  * size immediately following this structure.
   1098  */
   1099 struct ethtool_gstrings {
   1100 	__u32	cmd;
   1101 	__u32	string_set;
   1102 	__u32	len;
   1103 	__u8	data[];
   1104 };
   1105 
   1106 /**
   1107  * struct ethtool_sset_info - string set information
   1108  * @cmd: Command number = %ETHTOOL_GSSET_INFO
   1109  * @reserved: Reserved for future use; see the note on reserved space.
   1110  * @sset_mask: On entry, a bitmask of string sets to query, with bits
   1111  *	numbered according to &enum ethtool_stringset.  On return, a
   1112  *	bitmask of those string sets queried that are supported.
   1113  * @data: Buffer for string set sizes.  On return, this contains the
   1114  *	size of each string set that was queried and supported, in
   1115  *	order of ID.
   1116  *
   1117  * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
   1118  * return @sset_mask == 0x6 (sets 1, 2).  Then @data[0] contains the
   1119  * size of set 1 and @data[1] contains the size of set 2.
   1120  *
   1121  * Users must allocate a buffer of the appropriate size (4 * number of
   1122  * sets queried) immediately following this structure.
   1123  */
   1124 struct ethtool_sset_info {
   1125 	__u32	cmd;
   1126 	__u32	reserved;
   1127 	__u64	sset_mask;
   1128 	__u32	data[];
   1129 };
   1130 
   1131 /**
   1132  * enum ethtool_test_flags - flags definition of ethtool_test
   1133  * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
   1134  *	only online tests.
   1135  * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
   1136  * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
   1137  *	test.
   1138  * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
   1139  */
   1140 
   1141 enum ethtool_test_flags {
   1142 	ETH_TEST_FL_OFFLINE	= (1 << 0),
   1143 	ETH_TEST_FL_FAILED	= (1 << 1),
   1144 	ETH_TEST_FL_EXTERNAL_LB	= (1 << 2),
   1145 	ETH_TEST_FL_EXTERNAL_LB_DONE	= (1 << 3),
   1146 };
   1147 
   1148 /**
   1149  * struct ethtool_test - device self-test invocation
   1150  * @cmd: Command number = %ETHTOOL_TEST
   1151  * @flags: A bitmask of flags from &enum ethtool_test_flags.  Some
   1152  *	flags may be set by the user on entry; others may be set by
   1153  *	the driver on return.
   1154  * @reserved: Reserved for future use; see the note on reserved space.
   1155  * @len: On return, the number of test results
   1156  * @data: Array of test results
   1157  *
   1158  * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
   1159  * number of test results that will be returned.  They must allocate a
   1160  * buffer of the appropriate size (8 * number of results) immediately
   1161  * following this structure.
   1162  */
   1163 struct ethtool_test {
   1164 	__u32	cmd;
   1165 	__u32	flags;
   1166 	__u32	reserved;
   1167 	__u32	len;
   1168 	__u64	data[];
   1169 };
   1170 
   1171 /**
   1172  * struct ethtool_stats - device-specific statistics
   1173  * @cmd: Command number = %ETHTOOL_GSTATS
   1174  * @n_stats: On return, the number of statistics
   1175  * @data: Array of statistics
   1176  *
   1177  * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
   1178  * number of statistics that will be returned.  They must allocate a
   1179  * buffer of the appropriate size (8 * number of statistics)
   1180  * immediately following this structure.
   1181  */
   1182 struct ethtool_stats {
   1183 	__u32	cmd;
   1184 	__u32	n_stats;
   1185 	__u64	data[];
   1186 };
   1187 
   1188 /**
   1189  * struct ethtool_perm_addr - permanent hardware address
   1190  * @cmd: Command number = %ETHTOOL_GPERMADDR
   1191  * @size: On entry, the size of the buffer.  On return, the size of the
   1192  *	address.  The command fails if the buffer is too small.
   1193  * @data: Buffer for the address
   1194  *
   1195  * Users must allocate the buffer immediately following this structure.
   1196  * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
   1197  * type.
   1198  */
   1199 struct ethtool_perm_addr {
   1200 	__u32	cmd;
   1201 	__u32	size;
   1202 	__u8	data[];
   1203 };
   1204 
   1205 /* boolean flags controlling per-interface behavior characteristics.
   1206  * When reading, the flag indicates whether or not a certain behavior
   1207  * is enabled/present.  When writing, the flag indicates whether
   1208  * or not the driver should turn on (set) or off (clear) a behavior.
   1209  *
   1210  * Some behaviors may read-only (unconditionally absent or present).
   1211  * If such is the case, return EINVAL in the set-flags operation if the
   1212  * flag differs from the read-only value.
   1213  */
   1214 enum ethtool_flags {
   1215 	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */
   1216 	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */
   1217 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
   1218 	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
   1219 	ETH_FLAG_RXHASH		= (1 << 28),
   1220 };
   1221 
   1222 /* The following structures are for supporting RX network flow
   1223  * classification and RX n-tuple configuration. Note, all multibyte
   1224  * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
   1225  * be in network byte order.
   1226  */
   1227 
   1228 /**
   1229  * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
   1230  * @ip4src: Source host
   1231  * @ip4dst: Destination host
   1232  * @psrc: Source port
   1233  * @pdst: Destination port
   1234  * @tos: Type-of-service
   1235  *
   1236  * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
   1237  */
   1238 struct ethtool_tcpip4_spec {
   1239 	__be32	ip4src;
   1240 	__be32	ip4dst;
   1241 	__be16	psrc;
   1242 	__be16	pdst;
   1243 	__u8    tos;
   1244 };
   1245 
   1246 /**
   1247  * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
   1248  * @ip4src: Source host
   1249  * @ip4dst: Destination host
   1250  * @spi: Security parameters index
   1251  * @tos: Type-of-service
   1252  *
   1253  * This can be used to specify an IPsec transport or tunnel over IPv4.
   1254  */
   1255 struct ethtool_ah_espip4_spec {
   1256 	__be32	ip4src;
   1257 	__be32	ip4dst;
   1258 	__be32	spi;
   1259 	__u8    tos;
   1260 };
   1261 
   1262 #define	ETH_RX_NFC_IP4	1
   1263 
   1264 /**
   1265  * struct ethtool_usrip4_spec - general flow specification for IPv4
   1266  * @ip4src: Source host
   1267  * @ip4dst: Destination host
   1268  * @l4_4_bytes: First 4 bytes of transport (layer 4) header
   1269  * @tos: Type-of-service
   1270  * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
   1271  * @proto: Transport protocol number; mask must be 0
   1272  */
   1273 struct ethtool_usrip4_spec {
   1274 	__be32	ip4src;
   1275 	__be32	ip4dst;
   1276 	__be32	l4_4_bytes;
   1277 	__u8    tos;
   1278 	__u8    ip_ver;
   1279 	__u8    proto;
   1280 };
   1281 
   1282 /**
   1283  * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
   1284  * @ip6src: Source host
   1285  * @ip6dst: Destination host
   1286  * @psrc: Source port
   1287  * @pdst: Destination port
   1288  * @tclass: Traffic Class
   1289  *
   1290  * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow.
   1291  */
   1292 struct ethtool_tcpip6_spec {
   1293 	__be32	ip6src[4];
   1294 	__be32	ip6dst[4];
   1295 	__be16	psrc;
   1296 	__be16	pdst;
   1297 	__u8    tclass;
   1298 };
   1299 
   1300 /**
   1301  * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6
   1302  * @ip6src: Source host
   1303  * @ip6dst: Destination host
   1304  * @spi: Security parameters index
   1305  * @tclass: Traffic Class
   1306  *
   1307  * This can be used to specify an IPsec transport or tunnel over IPv6.
   1308  */
   1309 struct ethtool_ah_espip6_spec {
   1310 	__be32	ip6src[4];
   1311 	__be32	ip6dst[4];
   1312 	__be32	spi;
   1313 	__u8    tclass;
   1314 };
   1315 
   1316 /**
   1317  * struct ethtool_usrip6_spec - general flow specification for IPv6
   1318  * @ip6src: Source host
   1319  * @ip6dst: Destination host
   1320  * @l4_4_bytes: First 4 bytes of transport (layer 4) header
   1321  * @tclass: Traffic Class
   1322  * @l4_proto: Transport protocol number (nexthdr after any Extension Headers)
   1323  */
   1324 struct ethtool_usrip6_spec {
   1325 	__be32	ip6src[4];
   1326 	__be32	ip6dst[4];
   1327 	__be32	l4_4_bytes;
   1328 	__u8    tclass;
   1329 	__u8    l4_proto;
   1330 };
   1331 
   1332 union ethtool_flow_union {
   1333 	struct ethtool_tcpip4_spec		tcp_ip4_spec;
   1334 	struct ethtool_tcpip4_spec		udp_ip4_spec;
   1335 	struct ethtool_tcpip4_spec		sctp_ip4_spec;
   1336 	struct ethtool_ah_espip4_spec		ah_ip4_spec;
   1337 	struct ethtool_ah_espip4_spec		esp_ip4_spec;
   1338 	struct ethtool_usrip4_spec		usr_ip4_spec;
   1339 	struct ethtool_tcpip6_spec		tcp_ip6_spec;
   1340 	struct ethtool_tcpip6_spec		udp_ip6_spec;
   1341 	struct ethtool_tcpip6_spec		sctp_ip6_spec;
   1342 	struct ethtool_ah_espip6_spec		ah_ip6_spec;
   1343 	struct ethtool_ah_espip6_spec		esp_ip6_spec;
   1344 	struct ethtool_usrip6_spec		usr_ip6_spec;
   1345 	struct ethhdr				ether_spec;
   1346 	__u8					hdata[52];
   1347 };
   1348 
   1349 /**
   1350  * struct ethtool_flow_ext - additional RX flow fields
   1351  * @h_dest: destination MAC address
   1352  * @vlan_etype: VLAN EtherType
   1353  * @vlan_tci: VLAN tag control information
   1354  * @data: user defined data
   1355  * @padding: Reserved for future use; see the note on reserved space.
   1356  *
   1357  * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
   1358  * is set in &struct ethtool_rx_flow_spec @flow_type.
   1359  * @h_dest is valid if %FLOW_MAC_EXT is set.
   1360  */
   1361 struct ethtool_flow_ext {
   1362 	__u8		padding[2];
   1363 	unsigned char	h_dest[ETH_ALEN];
   1364 	__be16		vlan_etype;
   1365 	__be16		vlan_tci;
   1366 	__be32		data[2];
   1367 };
   1368 
   1369 /**
   1370  * struct ethtool_rx_flow_spec - classification rule for RX flows
   1371  * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
   1372  * @h_u: Flow fields to match (dependent on @flow_type)
   1373  * @h_ext: Additional fields to match
   1374  * @m_u: Masks for flow field bits to be matched
   1375  * @m_ext: Masks for additional field bits to be matched
   1376  *	Note, all additional fields must be ignored unless @flow_type
   1377  *	includes the %FLOW_EXT or %FLOW_MAC_EXT flag
   1378  *	(see &struct ethtool_flow_ext description).
   1379  * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
   1380  *	if packets should be discarded, or %RX_CLS_FLOW_WAKE if the
   1381  *	packets should be used for Wake-on-LAN with %WAKE_FILTER
   1382  * @location: Location of rule in the table.  Locations must be
   1383  *	numbered such that a flow matching multiple rules will be
   1384  *	classified according to the first (lowest numbered) rule.
   1385  */
   1386 struct ethtool_rx_flow_spec {
   1387 	__u32		flow_type;
   1388 	union ethtool_flow_union h_u;
   1389 	struct ethtool_flow_ext h_ext;
   1390 	union ethtool_flow_union m_u;
   1391 	struct ethtool_flow_ext m_ext;
   1392 	__u64		ring_cookie;
   1393 	__u32		location;
   1394 };
   1395 
   1396 /* How rings are laid out when accessing virtual functions or
   1397  * offloaded queues is device specific. To allow users to do flow
   1398  * steering and specify these queues the ring cookie is partitioned
   1399  * into a 32bit queue index with an 8 bit virtual function id.
   1400  * This also leaves the 3bytes for further specifiers. It is possible
   1401  * future devices may support more than 256 virtual functions if
   1402  * devices start supporting PCIe w/ARI. However at the moment I
   1403  * do not know of any devices that support this so I do not reserve
   1404  * space for this at this time. If a future patch consumes the next
   1405  * byte it should be aware of this possibility.
   1406  */
   1407 #define ETHTOOL_RX_FLOW_SPEC_RING	0x00000000FFFFFFFFLL
   1408 #define ETHTOOL_RX_FLOW_SPEC_RING_VF	0x000000FF00000000LL
   1409 #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
   1410 static __inline__ __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
   1411 {
   1412 	return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
   1413 }
   1414 
   1415 static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
   1416 {
   1417 	return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
   1418 				ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
   1419 }
   1420 
   1421 /**
   1422  * struct ethtool_rxnfc - command to get or set RX flow classification rules
   1423  * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
   1424  *	%ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
   1425  *	%ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
   1426  * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
   1427  * @data: Command-dependent value
   1428  * @fs: Flow classification rule
   1429  * @rss_context: RSS context to be affected
   1430  * @rule_cnt: Number of rules to be affected
   1431  * @rule_locs: Array of used rule locations
   1432  *
   1433  * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
   1434  * the fields included in the flow hash, e.g. %RXH_IP_SRC.  The following
   1435  * structure fields must not be used, except that if @flow_type includes
   1436  * the %FLOW_RSS flag, then @rss_context determines which RSS context to
   1437  * act on.
   1438  *
   1439  * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
   1440  * on return.
   1441  *
   1442  * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
   1443  * rules on return.  If @data is non-zero on return then it is the
   1444  * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
   1445  * driver supports any special location values.  If that flag is not
   1446  * set in @data then special location values should not be used.
   1447  *
   1448  * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
   1449  * existing rule on entry and @fs contains the rule on return; if
   1450  * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is
   1451  * filled with the RSS context ID associated with the rule.
   1452  *
   1453  * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
   1454  * user buffer for @rule_locs on entry.  On return, @data is the size
   1455  * of the rule table, @rule_cnt is the number of defined rules, and
   1456  * @rule_locs contains the locations of the defined rules.  Drivers
   1457  * must use the second parameter to get_rxnfc() instead of @rule_locs.
   1458  *
   1459  * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
   1460  * @fs.@location either specifies the location to use or is a special
   1461  * location value with %RX_CLS_LOC_SPECIAL flag set.  On return,
   1462  * @fs.@location is the actual rule location.  If @fs.@flow_type
   1463  * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to
   1464  * use for flow spreading traffic which matches this rule.  The value
   1465  * from the rxfh indirection table will be added to @fs.@ring_cookie
   1466  * to choose which ring to deliver to.
   1467  *
   1468  * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
   1469  * existing rule on entry.
   1470  *
   1471  * A driver supporting the special location values for
   1472  * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
   1473  * location, and may remove a rule at a later location (lower
   1474  * priority) that matches exactly the same set of flows.  The special
   1475  * values are %RX_CLS_LOC_ANY, selecting any location;
   1476  * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
   1477  * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
   1478  * location (minimum priority).  Additional special values may be
   1479  * defined in future and drivers must return -%EINVAL for any
   1480  * unrecognised value.
   1481  */
   1482 struct ethtool_rxnfc {
   1483 	__u32				cmd;
   1484 	__u32				flow_type;
   1485 	__u64				data;
   1486 	struct ethtool_rx_flow_spec	fs;
   1487 	union {
   1488 		__u32			rule_cnt;
   1489 		__u32			rss_context;
   1490 	};
   1491 	__u32				rule_locs[];
   1492 };
   1493 
   1494 
   1495 /**
   1496  * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
   1497  * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
   1498  * @size: On entry, the array size of the user buffer, which may be zero.
   1499  *	On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
   1500  *	indirection table.
   1501  * @ring_index: RX ring/queue index for each hash value
   1502  *
   1503  * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
   1504  * should be returned.  For %ETHTOOL_SRXFHINDIR, a @size of zero means
   1505  * the table should be reset to default values.  This last feature
   1506  * is not supported by the original implementations.
   1507  */
   1508 struct ethtool_rxfh_indir {
   1509 	__u32	cmd;
   1510 	__u32	size;
   1511 	__u32	ring_index[];
   1512 };
   1513 
   1514 /**
   1515  * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
   1516  * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
   1517  * @rss_context: RSS context identifier.  Context 0 is the default for normal
   1518  *	traffic; other contexts can be referenced as the destination for RX flow
   1519  *	classification rules.  %ETH_RXFH_CONTEXT_ALLOC is used with command
   1520  *	%ETHTOOL_SRSSH to allocate a new RSS context; on return this field will
   1521  *	contain the ID of the newly allocated context.
   1522  * @indir_size: On entry, the array size of the user buffer for the
   1523  *	indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
   1524  *	%ETH_RXFH_INDIR_NO_CHANGE.  On return from %ETHTOOL_GRSSH,
   1525  *	the array size of the hardware indirection table.
   1526  * @key_size: On entry, the array size of the user buffer for the hash key,
   1527  *	which may be zero.  On return from %ETHTOOL_GRSSH, the size of the
   1528  *	hardware hash key.
   1529  * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
   1530  *	Valid values are one of the %ETH_RSS_HASH_*.
   1531  * @input_xfrm: Defines how the input data is transformed. Valid values are one
   1532  *	of %RXH_XFRM_*.
   1533  * @rsvd8: Reserved for future use; see the note on reserved space.
   1534  * @rsvd32: Reserved for future use; see the note on reserved space.
   1535  * @rss_config: RX ring/queue index for each hash value i.e., indirection table
   1536  *	of @indir_size __u32 elements, followed by hash key of @key_size
   1537  *	bytes.
   1538  *
   1539  * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
   1540  * size should be returned.  For %ETHTOOL_SRSSH, an @indir_size of
   1541  * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
   1542  * and a @indir_size of zero means the indir table should be reset to default
   1543  * values (if @rss_context == 0) or that the RSS context should be deleted.
   1544  * An hfunc of zero means that hash function setting is not requested.
   1545  */
   1546 struct ethtool_rxfh {
   1547 	__u32   cmd;
   1548 	__u32	rss_context;
   1549 	__u32   indir_size;
   1550 	__u32   key_size;
   1551 	__u8	hfunc;
   1552 	__u8	input_xfrm;
   1553 	__u8	rsvd8[2];
   1554 	__u32	rsvd32;
   1555 	__u32   rss_config[];
   1556 };
   1557 #define ETH_RXFH_CONTEXT_ALLOC		0xffffffff
   1558 #define ETH_RXFH_INDIR_NO_CHANGE	0xffffffff
   1559 
   1560 /**
   1561  * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
   1562  * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
   1563  * @h_u: Flow field values to match (dependent on @flow_type)
   1564  * @m_u: Masks for flow field value bits to be ignored
   1565  * @vlan_tag: VLAN tag to match
   1566  * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
   1567  * @data: Driver-dependent data to match
   1568  * @data_mask: Mask for driver-dependent data bits to be ignored
   1569  * @action: RX ring/queue index to deliver to (non-negative) or other action
   1570  *	(negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
   1571  *
   1572  * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
   1573  * a field value and mask are both zero this is treated as if all mask
   1574  * bits are set i.e. the field is ignored.
   1575  */
   1576 struct ethtool_rx_ntuple_flow_spec {
   1577 	__u32		 flow_type;
   1578 	union {
   1579 		struct ethtool_tcpip4_spec		tcp_ip4_spec;
   1580 		struct ethtool_tcpip4_spec		udp_ip4_spec;
   1581 		struct ethtool_tcpip4_spec		sctp_ip4_spec;
   1582 		struct ethtool_ah_espip4_spec		ah_ip4_spec;
   1583 		struct ethtool_ah_espip4_spec		esp_ip4_spec;
   1584 		struct ethtool_usrip4_spec		usr_ip4_spec;
   1585 		struct ethhdr				ether_spec;
   1586 		__u8					hdata[72];
   1587 	} h_u, m_u;
   1588 
   1589 	__u16	        vlan_tag;
   1590 	__u16	        vlan_tag_mask;
   1591 	__u64		data;
   1592 	__u64		data_mask;
   1593 
   1594 	__s32		action;
   1595 #define ETHTOOL_RXNTUPLE_ACTION_DROP	(-1)	/* drop packet */
   1596 #define ETHTOOL_RXNTUPLE_ACTION_CLEAR	(-2)	/* clear filter */
   1597 };
   1598 
   1599 /**
   1600  * struct ethtool_rx_ntuple - command to set or clear RX flow filter
   1601  * @cmd: Command number - %ETHTOOL_SRXNTUPLE
   1602  * @fs: Flow filter specification
   1603  */
   1604 struct ethtool_rx_ntuple {
   1605 	__u32					cmd;
   1606 	struct ethtool_rx_ntuple_flow_spec	fs;
   1607 };
   1608 
   1609 #define ETHTOOL_FLASH_MAX_FILENAME	128
   1610 enum ethtool_flash_op_type {
   1611 	ETHTOOL_FLASH_ALL_REGIONS	= 0,
   1612 };
   1613 
   1614 /* for passing firmware flashing related parameters */
   1615 struct ethtool_flash {
   1616 	__u32	cmd;
   1617 	__u32	region;
   1618 	char	data[ETHTOOL_FLASH_MAX_FILENAME];
   1619 };
   1620 
   1621 /**
   1622  * struct ethtool_dump - used for retrieving, setting device dump
   1623  * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
   1624  * 	%ETHTOOL_SET_DUMP
   1625  * @version: FW version of the dump, filled in by driver
   1626  * @flag: driver dependent flag for dump setting, filled in by driver during
   1627  *        get and filled in by ethtool for set operation.
   1628  *        flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
   1629  *        firmware dump is disabled.
   1630  * @len: length of dump data, used as the length of the user buffer on entry to
   1631  * 	 %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
   1632  * 	 for %ETHTOOL_GET_DUMP_FLAG command
   1633  * @data: data collected for get dump data operation
   1634  */
   1635 struct ethtool_dump {
   1636 	__u32	cmd;
   1637 	__u32	version;
   1638 	__u32	flag;
   1639 	__u32	len;
   1640 	__u8	data[];
   1641 };
   1642 
   1643 #define ETH_FW_DUMP_DISABLE 0
   1644 
   1645 /* for returning and changing feature sets */
   1646 
   1647 /**
   1648  * struct ethtool_get_features_block - block with state of 32 features
   1649  * @available: mask of changeable features
   1650  * @requested: mask of features requested to be enabled if possible
   1651  * @active: mask of currently enabled features
   1652  * @never_changed: mask of features not changeable for any device
   1653  */
   1654 struct ethtool_get_features_block {
   1655 	__u32	available;
   1656 	__u32	requested;
   1657 	__u32	active;
   1658 	__u32	never_changed;
   1659 };
   1660 
   1661 /**
   1662  * struct ethtool_gfeatures - command to get state of device's features
   1663  * @cmd: command number = %ETHTOOL_GFEATURES
   1664  * @size: On entry, the number of elements in the features[] array;
   1665  *	on return, the number of elements in features[] needed to hold
   1666  *	all features
   1667  * @features: state of features
   1668  */
   1669 struct ethtool_gfeatures {
   1670 	__u32	cmd;
   1671 	__u32	size;
   1672 	struct ethtool_get_features_block features[];
   1673 };
   1674 
   1675 /**
   1676  * struct ethtool_set_features_block - block with request for 32 features
   1677  * @valid: mask of features to be changed
   1678  * @requested: values of features to be changed
   1679  */
   1680 struct ethtool_set_features_block {
   1681 	__u32	valid;
   1682 	__u32	requested;
   1683 };
   1684 
   1685 /**
   1686  * struct ethtool_sfeatures - command to request change in device's features
   1687  * @cmd: command number = %ETHTOOL_SFEATURES
   1688  * @size: array size of the features[] array
   1689  * @features: feature change masks
   1690  */
   1691 struct ethtool_sfeatures {
   1692 	__u32	cmd;
   1693 	__u32	size;
   1694 	struct ethtool_set_features_block features[];
   1695 };
   1696 
   1697 /**
   1698  * struct ethtool_ts_info - holds a device's timestamping and PHC association
   1699  * @cmd: command number = %ETHTOOL_GET_TS_INFO
   1700  * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
   1701  * @phc_index: device index of the associated PHC, or -1 if there is none
   1702  * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
   1703  * @tx_reserved: Reserved for future use; see the note on reserved space.
   1704  * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
   1705  * @rx_reserved: Reserved for future use; see the note on reserved space.
   1706  *
   1707  * The bits in the 'tx_types' and 'rx_filters' fields correspond to
   1708  * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
   1709  * respectively.  For example, if the device supports HWTSTAMP_TX_ON,
   1710  * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
   1711  *
   1712  * Drivers should only report the filters they actually support without
   1713  * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for
   1714  * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the
   1715  * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op.
   1716  */
   1717 struct ethtool_ts_info {
   1718 	__u32	cmd;
   1719 	__u32	so_timestamping;
   1720 	__s32	phc_index;
   1721 	__u32	tx_types;
   1722 	__u32	tx_reserved[3];
   1723 	__u32	rx_filters;
   1724 	__u32	rx_reserved[3];
   1725 };
   1726 
   1727 /*
   1728  * %ETHTOOL_SFEATURES changes features present in features[].valid to the
   1729  * values of corresponding bits in features[].requested. Bits in .requested
   1730  * not set in .valid or not changeable are ignored.
   1731  *
   1732  * Returns %EINVAL when .valid contains undefined or never-changeable bits
   1733  * or size is not equal to required number of features words (32-bit blocks).
   1734  * Returns >= 0 if request was completed; bits set in the value mean:
   1735  *   %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
   1736  *	changeable (not present in %ETHTOOL_GFEATURES' features[].available)
   1737  *	those bits were ignored.
   1738  *   %ETHTOOL_F_WISH - some or all changes requested were recorded but the
   1739  *      resulting state of bits masked by .valid is not equal to .requested.
   1740  *      Probably there are other device-specific constraints on some features
   1741  *      in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
   1742  *      here as though ignored bits were cleared.
   1743  *   %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
   1744  *      compatibility functions. Requested offload state cannot be properly
   1745  *      managed by kernel.
   1746  *
   1747  * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
   1748  * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
   1749  * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
   1750  * significant bit in features[0] fields. Empty strings mark undefined features.
   1751  */
   1752 enum ethtool_sfeatures_retval_bits {
   1753 	ETHTOOL_F_UNSUPPORTED__BIT,
   1754 	ETHTOOL_F_WISH__BIT,
   1755 	ETHTOOL_F_COMPAT__BIT,
   1756 };
   1757 
   1758 #define ETHTOOL_F_UNSUPPORTED   (1 << ETHTOOL_F_UNSUPPORTED__BIT)
   1759 #define ETHTOOL_F_WISH          (1 << ETHTOOL_F_WISH__BIT)
   1760 #define ETHTOOL_F_COMPAT        (1 << ETHTOOL_F_COMPAT__BIT)
   1761 
   1762 #define MAX_NUM_QUEUE		4096
   1763 
   1764 /**
   1765  * struct ethtool_per_queue_op - apply sub command to the queues in mask.
   1766  * @cmd: ETHTOOL_PERQUEUE
   1767  * @sub_command: the sub command which apply to each queues
   1768  * @queue_mask: Bitmap of the queues which sub command apply to
   1769  * @data: A complete command structure following for each of the queues addressed
   1770  */
   1771 struct ethtool_per_queue_op {
   1772 	__u32	cmd;
   1773 	__u32	sub_command;
   1774 	__u32	queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
   1775 	char	data[];
   1776 };
   1777 
   1778 /**
   1779  * struct ethtool_fecparam - Ethernet Forward Error Correction parameters
   1780  * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM
   1781  * @active_fec: FEC mode which is active on the port, single bit set, GET only.
   1782  * @fec: Bitmask of configured FEC modes.
   1783  * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.
   1784  *
   1785  * Note that @reserved was never validated on input and ethtool user space
   1786  * left it uninitialized when calling SET. Hence going forward it can only be
   1787  * used to return a value to userspace with GET.
   1788  *
   1789  * FEC modes supported by the device can be read via %ETHTOOL_GLINKSETTINGS.
   1790  * FEC settings are configured by link autonegotiation whenever it's enabled.
   1791  * With autoneg on %ETHTOOL_GFECPARAM can be used to read the current mode.
   1792  *
   1793  * When autoneg is disabled %ETHTOOL_SFECPARAM controls the FEC settings.
   1794  * It is recommended that drivers only accept a single bit set in @fec.
   1795  * When multiple bits are set in @fec drivers may pick mode in an implementation
   1796  * dependent way. Drivers should reject mixing %ETHTOOL_FEC_AUTO_BIT with other
   1797  * FEC modes, because it's unclear whether in this case other modes constrain
   1798  * AUTO or are independent choices.
   1799  * Drivers must reject SET requests if they support none of the requested modes.
   1800  *
   1801  * If device does not support FEC drivers may use %ETHTOOL_FEC_NONE instead
   1802  * of returning %EOPNOTSUPP from %ETHTOOL_GFECPARAM.
   1803  *
   1804  * See enum ethtool_fec_config_bits for definition of valid bits for both
   1805  * @fec and @active_fec.
   1806  */
   1807 struct ethtool_fecparam {
   1808 	__u32   cmd;
   1809 	/* bitmask of FEC modes */
   1810 	__u32   active_fec;
   1811 	__u32   fec;
   1812 	__u32   reserved;
   1813 };
   1814 
   1815 /**
   1816  * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration
   1817  * @ETHTOOL_FEC_NONE_BIT: FEC mode configuration is not supported. Should not
   1818  *			be used together with other bits. GET only.
   1819  * @ETHTOOL_FEC_AUTO_BIT: Select default/best FEC mode automatically, usually
   1820  *			based link mode and SFP parameters read from module's
   1821  *			EEPROM. This bit does _not_ mean autonegotiation.
   1822  * @ETHTOOL_FEC_OFF_BIT: No FEC Mode
   1823  * @ETHTOOL_FEC_RS_BIT: Reed-Solomon FEC Mode
   1824  * @ETHTOOL_FEC_BASER_BIT: Base-R/Reed-Solomon FEC Mode
   1825  * @ETHTOOL_FEC_LLRS_BIT: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet
   1826  *			Consortium)
   1827  */
   1828 enum ethtool_fec_config_bits {
   1829 	ETHTOOL_FEC_NONE_BIT,
   1830 	ETHTOOL_FEC_AUTO_BIT,
   1831 	ETHTOOL_FEC_OFF_BIT,
   1832 	ETHTOOL_FEC_RS_BIT,
   1833 	ETHTOOL_FEC_BASER_BIT,
   1834 	ETHTOOL_FEC_LLRS_BIT,
   1835 };
   1836 
   1837 #define ETHTOOL_FEC_NONE		(1 << ETHTOOL_FEC_NONE_BIT)
   1838 #define ETHTOOL_FEC_AUTO		(1 << ETHTOOL_FEC_AUTO_BIT)
   1839 #define ETHTOOL_FEC_OFF			(1 << ETHTOOL_FEC_OFF_BIT)
   1840 #define ETHTOOL_FEC_RS			(1 << ETHTOOL_FEC_RS_BIT)
   1841 #define ETHTOOL_FEC_BASER		(1 << ETHTOOL_FEC_BASER_BIT)
   1842 #define ETHTOOL_FEC_LLRS		(1 << ETHTOOL_FEC_LLRS_BIT)
   1843 
   1844 /* CMDs currently supported */
   1845 #define ETHTOOL_GSET		0x00000001 /* DEPRECATED, Get settings.
   1846 					    * Please use ETHTOOL_GLINKSETTINGS
   1847 					    */
   1848 #define ETHTOOL_SSET		0x00000002 /* DEPRECATED, Set settings.
   1849 					    * Please use ETHTOOL_SLINKSETTINGS
   1850 					    */
   1851 #define ETHTOOL_GDRVINFO	0x00000003 /* Get driver info. */
   1852 #define ETHTOOL_GREGS		0x00000004 /* Get NIC registers. */
   1853 #define ETHTOOL_GWOL		0x00000005 /* Get wake-on-lan options. */
   1854 #define ETHTOOL_SWOL		0x00000006 /* Set wake-on-lan options. */
   1855 #define ETHTOOL_GMSGLVL		0x00000007 /* Get driver message level */
   1856 #define ETHTOOL_SMSGLVL		0x00000008 /* Set driver msg level. */
   1857 #define ETHTOOL_NWAY_RST	0x00000009 /* Restart autonegotiation. */
   1858 /* Get link status for host, i.e. whether the interface *and* the
   1859  * physical port (if there is one) are up (ethtool_value). */
   1860 #define ETHTOOL_GLINK		0x0000000a
   1861 #define ETHTOOL_GEEPROM		0x0000000b /* Get EEPROM data */
   1862 #define ETHTOOL_SEEPROM		0x0000000c /* Set EEPROM data. */
   1863 #define ETHTOOL_GCOALESCE	0x0000000e /* Get coalesce config */
   1864 #define ETHTOOL_SCOALESCE	0x0000000f /* Set coalesce config. */
   1865 #define ETHTOOL_GRINGPARAM	0x00000010 /* Get ring parameters */
   1866 #define ETHTOOL_SRINGPARAM	0x00000011 /* Set ring parameters. */
   1867 #define ETHTOOL_GPAUSEPARAM	0x00000012 /* Get pause parameters */
   1868 #define ETHTOOL_SPAUSEPARAM	0x00000013 /* Set pause parameters. */
   1869 #define ETHTOOL_GRXCSUM		0x00000014 /* Get RX hw csum enable (ethtool_value) */
   1870 #define ETHTOOL_SRXCSUM		0x00000015 /* Set RX hw csum enable (ethtool_value) */
   1871 #define ETHTOOL_GTXCSUM		0x00000016 /* Get TX hw csum enable (ethtool_value) */
   1872 #define ETHTOOL_STXCSUM		0x00000017 /* Set TX hw csum enable (ethtool_value) */
   1873 #define ETHTOOL_GSG		0x00000018 /* Get scatter-gather enable
   1874 					    * (ethtool_value) */
   1875 #define ETHTOOL_SSG		0x00000019 /* Set scatter-gather enable
   1876 					    * (ethtool_value). */
   1877 #define ETHTOOL_TEST		0x0000001a /* execute NIC self-test. */
   1878 #define ETHTOOL_GSTRINGS	0x0000001b /* get specified string set */
   1879 #define ETHTOOL_PHYS_ID		0x0000001c /* identify the NIC */
   1880 #define ETHTOOL_GSTATS		0x0000001d /* get NIC-specific statistics */
   1881 #define ETHTOOL_GTSO		0x0000001e /* Get TSO enable (ethtool_value) */
   1882 #define ETHTOOL_STSO		0x0000001f /* Set TSO enable (ethtool_value) */
   1883 #define ETHTOOL_GPERMADDR	0x00000020 /* Get permanent hardware address */
   1884 #define ETHTOOL_GUFO		0x00000021 /* Get UFO enable (ethtool_value) */
   1885 #define ETHTOOL_SUFO		0x00000022 /* Set UFO enable (ethtool_value) */
   1886 #define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
   1887 #define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
   1888 #define ETHTOOL_GFLAGS		0x00000025 /* Get flags bitmap(ethtool_value) */
   1889 #define ETHTOOL_SFLAGS		0x00000026 /* Set flags bitmap(ethtool_value) */
   1890 #define ETHTOOL_GPFLAGS		0x00000027 /* Get driver-private flags bitmap */
   1891 #define ETHTOOL_SPFLAGS		0x00000028 /* Set driver-private flags bitmap */
   1892 
   1893 #define ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */
   1894 #define ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */
   1895 #define ETHTOOL_GGRO		0x0000002b /* Get GRO enable (ethtool_value) */
   1896 #define ETHTOOL_SGRO		0x0000002c /* Set GRO enable (ethtool_value) */
   1897 #define ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */
   1898 #define ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */
   1899 #define ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */
   1900 #define ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */
   1901 #define ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */
   1902 #define ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
   1903 #define ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
   1904 #define ETHTOOL_RESET		0x00000034 /* Reset hardware */
   1905 #define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
   1906 #define ETHTOOL_GRXNTUPLE	0x00000036 /* deprecated */
   1907 #define ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */
   1908 #define ETHTOOL_GRXFHINDIR	0x00000038 /* Get RX flow hash indir'n table */
   1909 #define ETHTOOL_SRXFHINDIR	0x00000039 /* Set RX flow hash indir'n table */
   1910 
   1911 #define ETHTOOL_GFEATURES	0x0000003a /* Get device offload settings */
   1912 #define ETHTOOL_SFEATURES	0x0000003b /* Change device offload settings */
   1913 #define ETHTOOL_GCHANNELS	0x0000003c /* Get no of channels */
   1914 #define ETHTOOL_SCHANNELS	0x0000003d /* Set no of channels */
   1915 #define ETHTOOL_SET_DUMP	0x0000003e /* Set dump settings */
   1916 #define ETHTOOL_GET_DUMP_FLAG	0x0000003f /* Get dump settings */
   1917 #define ETHTOOL_GET_DUMP_DATA	0x00000040 /* Get dump data */
   1918 #define ETHTOOL_GET_TS_INFO	0x00000041 /* Get time stamping and PHC info */
   1919 #define ETHTOOL_GMODULEINFO	0x00000042 /* Get plug-in module information */
   1920 #define ETHTOOL_GMODULEEEPROM	0x00000043 /* Get plug-in module eeprom */
   1921 #define ETHTOOL_GEEE		0x00000044 /* Get EEE settings */
   1922 #define ETHTOOL_SEEE		0x00000045 /* Set EEE settings */
   1923 
   1924 #define ETHTOOL_GRSSH		0x00000046 /* Get RX flow hash configuration */
   1925 #define ETHTOOL_SRSSH		0x00000047 /* Set RX flow hash configuration */
   1926 #define ETHTOOL_GTUNABLE	0x00000048 /* Get tunable configuration */
   1927 #define ETHTOOL_STUNABLE	0x00000049 /* Set tunable configuration */
   1928 #define ETHTOOL_GPHYSTATS	0x0000004a /* get PHY-specific statistics */
   1929 
   1930 #define ETHTOOL_PERQUEUE	0x0000004b /* Set per queue options */
   1931 
   1932 #define ETHTOOL_GLINKSETTINGS	0x0000004c /* Get ethtool_link_settings */
   1933 #define ETHTOOL_SLINKSETTINGS	0x0000004d /* Set ethtool_link_settings */
   1934 #define ETHTOOL_PHY_GTUNABLE	0x0000004e /* Get PHY tunable configuration */
   1935 #define ETHTOOL_PHY_STUNABLE	0x0000004f /* Set PHY tunable configuration */
   1936 #define ETHTOOL_GFECPARAM	0x00000050 /* Get FEC settings */
   1937 #define ETHTOOL_SFECPARAM	0x00000051 /* Set FEC settings */
   1938 
   1939 /* compatibility with older code */
   1940 #define SPARC_ETH_GSET		ETHTOOL_GSET
   1941 #define SPARC_ETH_SSET		ETHTOOL_SSET
   1942 
   1943 /* Link mode bit indices */
   1944 enum ethtool_link_mode_bit_indices {
   1945 	ETHTOOL_LINK_MODE_10baseT_Half_BIT	= 0,
   1946 	ETHTOOL_LINK_MODE_10baseT_Full_BIT	= 1,
   1947 	ETHTOOL_LINK_MODE_100baseT_Half_BIT	= 2,
   1948 	ETHTOOL_LINK_MODE_100baseT_Full_BIT	= 3,
   1949 	ETHTOOL_LINK_MODE_1000baseT_Half_BIT	= 4,
   1950 	ETHTOOL_LINK_MODE_1000baseT_Full_BIT	= 5,
   1951 	ETHTOOL_LINK_MODE_Autoneg_BIT		= 6,
   1952 	ETHTOOL_LINK_MODE_TP_BIT		= 7,
   1953 	ETHTOOL_LINK_MODE_AUI_BIT		= 8,
   1954 	ETHTOOL_LINK_MODE_MII_BIT		= 9,
   1955 	ETHTOOL_LINK_MODE_FIBRE_BIT		= 10,
   1956 	ETHTOOL_LINK_MODE_BNC_BIT		= 11,
   1957 	ETHTOOL_LINK_MODE_10000baseT_Full_BIT	= 12,
   1958 	ETHTOOL_LINK_MODE_Pause_BIT		= 13,
   1959 	ETHTOOL_LINK_MODE_Asym_Pause_BIT	= 14,
   1960 	ETHTOOL_LINK_MODE_2500baseX_Full_BIT	= 15,
   1961 	ETHTOOL_LINK_MODE_Backplane_BIT		= 16,
   1962 	ETHTOOL_LINK_MODE_1000baseKX_Full_BIT	= 17,
   1963 	ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT	= 18,
   1964 	ETHTOOL_LINK_MODE_10000baseKR_Full_BIT	= 19,
   1965 	ETHTOOL_LINK_MODE_10000baseR_FEC_BIT	= 20,
   1966 	ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
   1967 	ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT	= 22,
   1968 	ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT	= 23,
   1969 	ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT	= 24,
   1970 	ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT	= 25,
   1971 	ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT	= 26,
   1972 	ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT	= 27,
   1973 	ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT	= 28,
   1974 	ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT	= 29,
   1975 	ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT	= 30,
   1976 	ETHTOOL_LINK_MODE_25000baseCR_Full_BIT	= 31,
   1977 
   1978 	/* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
   1979 	 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
   1980 	 * macro for bits > 31. The only way to use indices > 31 is to
   1981 	 * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
   1982 	 */
   1983 
   1984 	ETHTOOL_LINK_MODE_25000baseKR_Full_BIT	= 32,
   1985 	ETHTOOL_LINK_MODE_25000baseSR_Full_BIT	= 33,
   1986 	ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT	= 34,
   1987 	ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT	= 35,
   1988 	ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT	= 36,
   1989 	ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT	= 37,
   1990 	ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT	= 38,
   1991 	ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT	= 39,
   1992 	ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT		= 40,
   1993 	ETHTOOL_LINK_MODE_1000baseX_Full_BIT	= 41,
   1994 	ETHTOOL_LINK_MODE_10000baseCR_Full_BIT	= 42,
   1995 	ETHTOOL_LINK_MODE_10000baseSR_Full_BIT	= 43,
   1996 	ETHTOOL_LINK_MODE_10000baseLR_Full_BIT	= 44,
   1997 	ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT	= 45,
   1998 	ETHTOOL_LINK_MODE_10000baseER_Full_BIT	= 46,
   1999 	ETHTOOL_LINK_MODE_2500baseT_Full_BIT	= 47,
   2000 	ETHTOOL_LINK_MODE_5000baseT_Full_BIT	= 48,
   2001 
   2002 	ETHTOOL_LINK_MODE_FEC_NONE_BIT	= 49,
   2003 	ETHTOOL_LINK_MODE_FEC_RS_BIT	= 50,
   2004 	ETHTOOL_LINK_MODE_FEC_BASER_BIT	= 51,
   2005 	ETHTOOL_LINK_MODE_50000baseKR_Full_BIT		 = 52,
   2006 	ETHTOOL_LINK_MODE_50000baseSR_Full_BIT		 = 53,
   2007 	ETHTOOL_LINK_MODE_50000baseCR_Full_BIT		 = 54,
   2008 	ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT	 = 55,
   2009 	ETHTOOL_LINK_MODE_50000baseDR_Full_BIT		 = 56,
   2010 	ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT	 = 57,
   2011 	ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT	 = 58,
   2012 	ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT	 = 59,
   2013 	ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60,
   2014 	ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT	 = 61,
   2015 	ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT	 = 62,
   2016 	ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT	 = 63,
   2017 	ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64,
   2018 	ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT	 = 65,
   2019 	ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT	 = 66,
   2020 	ETHTOOL_LINK_MODE_100baseT1_Full_BIT		 = 67,
   2021 	ETHTOOL_LINK_MODE_1000baseT1_Full_BIT		 = 68,
   2022 	ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT	 = 69,
   2023 	ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT	 = 70,
   2024 	ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71,
   2025 	ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT	 = 72,
   2026 	ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT	 = 73,
   2027 	ETHTOOL_LINK_MODE_FEC_LLRS_BIT			 = 74,
   2028 	ETHTOOL_LINK_MODE_100000baseKR_Full_BIT		 = 75,
   2029 	ETHTOOL_LINK_MODE_100000baseSR_Full_BIT		 = 76,
   2030 	ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT	 = 77,
   2031 	ETHTOOL_LINK_MODE_100000baseCR_Full_BIT		 = 78,
   2032 	ETHTOOL_LINK_MODE_100000baseDR_Full_BIT		 = 79,
   2033 	ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT	 = 80,
   2034 	ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT	 = 81,
   2035 	ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82,
   2036 	ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT	 = 83,
   2037 	ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT	 = 84,
   2038 	ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT	 = 85,
   2039 	ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT	 = 86,
   2040 	ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87,
   2041 	ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT	 = 88,
   2042 	ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT	 = 89,
   2043 	ETHTOOL_LINK_MODE_100baseFX_Half_BIT		 = 90,
   2044 	ETHTOOL_LINK_MODE_100baseFX_Full_BIT		 = 91,
   2045 	ETHTOOL_LINK_MODE_10baseT1L_Full_BIT		 = 92,
   2046 	ETHTOOL_LINK_MODE_800000baseCR8_Full_BIT	 = 93,
   2047 	ETHTOOL_LINK_MODE_800000baseKR8_Full_BIT	 = 94,
   2048 	ETHTOOL_LINK_MODE_800000baseDR8_Full_BIT	 = 95,
   2049 	ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT	 = 96,
   2050 	ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT	 = 97,
   2051 	ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT	 = 98,
   2052 	ETHTOOL_LINK_MODE_10baseT1S_Full_BIT		 = 99,
   2053 	ETHTOOL_LINK_MODE_10baseT1S_Half_BIT		 = 100,
   2054 	ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT	 = 101,
   2055 	ETHTOOL_LINK_MODE_10baseT1BRR_Full_BIT		 = 102,
   2056 
   2057 	/* must be last entry */
   2058 	__ETHTOOL_LINK_MODE_MASK_NBITS
   2059 };
   2060 
   2061 #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name)	\
   2062 	(1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
   2063 
   2064 /* DEPRECATED macros. Please migrate to
   2065  * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
   2066  * define any new SUPPORTED_* macro for bits > 31.
   2067  */
   2068 #define SUPPORTED_10baseT_Half		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
   2069 #define SUPPORTED_10baseT_Full		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
   2070 #define SUPPORTED_100baseT_Half		__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
   2071 #define SUPPORTED_100baseT_Full		__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
   2072 #define SUPPORTED_1000baseT_Half	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
   2073 #define SUPPORTED_1000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
   2074 #define SUPPORTED_Autoneg		__ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
   2075 #define SUPPORTED_TP			__ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
   2076 #define SUPPORTED_AUI			__ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
   2077 #define SUPPORTED_MII			__ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
   2078 #define SUPPORTED_FIBRE			__ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
   2079 #define SUPPORTED_BNC			__ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
   2080 #define SUPPORTED_10000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
   2081 #define SUPPORTED_Pause			__ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
   2082 #define SUPPORTED_Asym_Pause		__ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
   2083 #define SUPPORTED_2500baseX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
   2084 #define SUPPORTED_Backplane		__ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
   2085 #define SUPPORTED_1000baseKX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
   2086 #define SUPPORTED_10000baseKX4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
   2087 #define SUPPORTED_10000baseKR_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
   2088 #define SUPPORTED_10000baseR_FEC	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
   2089 #define SUPPORTED_20000baseMLD2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
   2090 #define SUPPORTED_20000baseKR2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
   2091 #define SUPPORTED_40000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
   2092 #define SUPPORTED_40000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
   2093 #define SUPPORTED_40000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
   2094 #define SUPPORTED_40000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
   2095 #define SUPPORTED_56000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
   2096 #define SUPPORTED_56000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
   2097 #define SUPPORTED_56000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
   2098 #define SUPPORTED_56000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
   2099 /* Please do not define any new SUPPORTED_* macro for bits > 31, see
   2100  * notice above.
   2101  */
   2102 
   2103 /*
   2104  * DEPRECATED macros. Please migrate to
   2105  * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
   2106  * define any new ADERTISE_* macro for bits > 31.
   2107  */
   2108 #define ADVERTISED_10baseT_Half		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
   2109 #define ADVERTISED_10baseT_Full		__ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
   2110 #define ADVERTISED_100baseT_Half	__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
   2111 #define ADVERTISED_100baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
   2112 #define ADVERTISED_1000baseT_Half	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
   2113 #define ADVERTISED_1000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
   2114 #define ADVERTISED_Autoneg		__ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
   2115 #define ADVERTISED_TP			__ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
   2116 #define ADVERTISED_AUI			__ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
   2117 #define ADVERTISED_MII			__ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
   2118 #define ADVERTISED_FIBRE		__ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
   2119 #define ADVERTISED_BNC			__ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
   2120 #define ADVERTISED_10000baseT_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
   2121 #define ADVERTISED_Pause		__ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
   2122 #define ADVERTISED_Asym_Pause		__ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
   2123 #define ADVERTISED_2500baseX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
   2124 #define ADVERTISED_Backplane		__ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
   2125 #define ADVERTISED_1000baseKX_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
   2126 #define ADVERTISED_10000baseKX4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
   2127 #define ADVERTISED_10000baseKR_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
   2128 #define ADVERTISED_10000baseR_FEC	__ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
   2129 #define ADVERTISED_20000baseMLD2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
   2130 #define ADVERTISED_20000baseKR2_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
   2131 #define ADVERTISED_40000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
   2132 #define ADVERTISED_40000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
   2133 #define ADVERTISED_40000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
   2134 #define ADVERTISED_40000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
   2135 #define ADVERTISED_56000baseKR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
   2136 #define ADVERTISED_56000baseCR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
   2137 #define ADVERTISED_56000baseSR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
   2138 #define ADVERTISED_56000baseLR4_Full	__ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
   2139 /* Please do not define any new ADVERTISED_* macro for bits > 31, see
   2140  * notice above.
   2141  */
   2142 
   2143 /* The following are all involved in forcing a particular link
   2144  * mode for the device for setting things.  When getting the
   2145  * devices settings, these indicate the current mode and whether
   2146  * it was forced up into this mode or autonegotiated.
   2147  */
   2148 
   2149 /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal.
   2150  * Update drivers/net/phy/phy.c:phy_speed_to_str() and
   2151  * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values.
   2152  */
   2153 #define SPEED_10		10
   2154 #define SPEED_100		100
   2155 #define SPEED_1000		1000
   2156 #define SPEED_2500		2500
   2157 #define SPEED_5000		5000
   2158 #define SPEED_10000		10000
   2159 #define SPEED_14000		14000
   2160 #define SPEED_20000		20000
   2161 #define SPEED_25000		25000
   2162 #define SPEED_40000		40000
   2163 #define SPEED_50000		50000
   2164 #define SPEED_56000		56000
   2165 #define SPEED_100000		100000
   2166 #define SPEED_200000		200000
   2167 #define SPEED_400000		400000
   2168 #define SPEED_800000		800000
   2169 
   2170 #define SPEED_UNKNOWN		-1
   2171 
   2172 static __inline__ int ethtool_validate_speed(__u32 speed)
   2173 {
   2174 	return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
   2175 }
   2176 
   2177 /* Duplex, half or full. */
   2178 #define DUPLEX_HALF		0x00
   2179 #define DUPLEX_FULL		0x01
   2180 #define DUPLEX_UNKNOWN		0xff
   2181 
   2182 static __inline__ int ethtool_validate_duplex(__u8 duplex)
   2183 {
   2184 	switch (duplex) {
   2185 	case DUPLEX_HALF:
   2186 	case DUPLEX_FULL:
   2187 	case DUPLEX_UNKNOWN:
   2188 		return 1;
   2189 	}
   2190 
   2191 	return 0;
   2192 }
   2193 
   2194 #define MASTER_SLAVE_CFG_UNSUPPORTED		0
   2195 #define MASTER_SLAVE_CFG_UNKNOWN		1
   2196 #define MASTER_SLAVE_CFG_MASTER_PREFERRED	2
   2197 #define MASTER_SLAVE_CFG_SLAVE_PREFERRED	3
   2198 #define MASTER_SLAVE_CFG_MASTER_FORCE		4
   2199 #define MASTER_SLAVE_CFG_SLAVE_FORCE		5
   2200 #define MASTER_SLAVE_STATE_UNSUPPORTED		0
   2201 #define MASTER_SLAVE_STATE_UNKNOWN		1
   2202 #define MASTER_SLAVE_STATE_MASTER		2
   2203 #define MASTER_SLAVE_STATE_SLAVE		3
   2204 #define MASTER_SLAVE_STATE_ERR			4
   2205 
   2206 /* These are used to throttle the rate of data on the phy interface when the
   2207  * native speed of the interface is higher than the link speed. These should
   2208  * not be used for phy interfaces which natively support multiple speeds (e.g.
   2209  * MII or SGMII).
   2210  */
   2211 /* No rate matching performed. */
   2212 #define RATE_MATCH_NONE		0
   2213 /* The phy sends pause frames to throttle the MAC. */
   2214 #define RATE_MATCH_PAUSE	1
   2215 /* The phy asserts CRS to prevent the MAC from transmitting. */
   2216 #define RATE_MATCH_CRS		2
   2217 /* The MAC is programmed with a sufficiently-large IPG. */
   2218 #define RATE_MATCH_OPEN_LOOP	3
   2219 
   2220 /* Which connector port. */
   2221 #define PORT_TP			0x00
   2222 #define PORT_AUI		0x01
   2223 #define PORT_MII		0x02
   2224 #define PORT_FIBRE		0x03
   2225 #define PORT_BNC		0x04
   2226 #define PORT_DA			0x05
   2227 #define PORT_NONE		0xef
   2228 #define PORT_OTHER		0xff
   2229 
   2230 /* Which transceiver to use. */
   2231 #define XCVR_INTERNAL		0x00 /* PHY and MAC are in the same package */
   2232 #define XCVR_EXTERNAL		0x01 /* PHY and MAC are in different packages */
   2233 #define XCVR_DUMMY1		0x02
   2234 #define XCVR_DUMMY2		0x03
   2235 #define XCVR_DUMMY3		0x04
   2236 
   2237 /* Enable or disable autonegotiation. */
   2238 #define AUTONEG_DISABLE		0x00
   2239 #define AUTONEG_ENABLE		0x01
   2240 
   2241 /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
   2242  * the driver is required to renegotiate link
   2243  */
   2244 #define ETH_TP_MDI_INVALID	0x00 /* status: unknown; control: unsupported */
   2245 #define ETH_TP_MDI		0x01 /* status: MDI;     control: force MDI */
   2246 #define ETH_TP_MDI_X		0x02 /* status: MDI-X;   control: force MDI-X */
   2247 #define ETH_TP_MDI_AUTO		0x03 /*                  control: auto-select */
   2248 
   2249 /* Wake-On-Lan options. */
   2250 #define WAKE_PHY		(1 << 0)
   2251 #define WAKE_UCAST		(1 << 1)
   2252 #define WAKE_MCAST		(1 << 2)
   2253 #define WAKE_BCAST		(1 << 3)
   2254 #define WAKE_ARP		(1 << 4)
   2255 #define WAKE_MAGIC		(1 << 5)
   2256 #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
   2257 #define WAKE_FILTER		(1 << 7)
   2258 
   2259 #define WOL_MODE_COUNT		8
   2260 
   2261 /* RSS hash function data
   2262  * XOR the corresponding source and destination fields of each specified
   2263  * protocol. Both copies of the XOR'ed fields are fed into the RSS and RXHASH
   2264  * calculation. Note that this XORing reduces the input set entropy and could
   2265  * be exploited to reduce the RSS queue spread.
   2266  */
   2267 #define	RXH_XFRM_SYM_XOR	(1 << 0)
   2268 #define	RXH_XFRM_NO_CHANGE	0xff
   2269 
   2270 /* L2-L4 network traffic flow types */
   2271 #define	TCP_V4_FLOW	0x01	/* hash or spec (tcp_ip4_spec) */
   2272 #define	UDP_V4_FLOW	0x02	/* hash or spec (udp_ip4_spec) */
   2273 #define	SCTP_V4_FLOW	0x03	/* hash or spec (sctp_ip4_spec) */
   2274 #define	AH_ESP_V4_FLOW	0x04	/* hash only */
   2275 #define	TCP_V6_FLOW	0x05	/* hash or spec (tcp_ip6_spec; nfc only) */
   2276 #define	UDP_V6_FLOW	0x06	/* hash or spec (udp_ip6_spec; nfc only) */
   2277 #define	SCTP_V6_FLOW	0x07	/* hash or spec (sctp_ip6_spec; nfc only) */
   2278 #define	AH_ESP_V6_FLOW	0x08	/* hash only */
   2279 #define	AH_V4_FLOW	0x09	/* hash or spec (ah_ip4_spec) */
   2280 #define	ESP_V4_FLOW	0x0a	/* hash or spec (esp_ip4_spec) */
   2281 #define	AH_V6_FLOW	0x0b	/* hash or spec (ah_ip6_spec; nfc only) */
   2282 #define	ESP_V6_FLOW	0x0c	/* hash or spec (esp_ip6_spec; nfc only) */
   2283 #define	IPV4_USER_FLOW	0x0d	/* spec only (usr_ip4_spec) */
   2284 #define	IP_USER_FLOW	IPV4_USER_FLOW
   2285 #define	IPV6_USER_FLOW	0x0e	/* spec only (usr_ip6_spec; nfc only) */
   2286 #define	IPV4_FLOW	0x10	/* hash only */
   2287 #define	IPV6_FLOW	0x11	/* hash only */
   2288 #define	ETHER_FLOW	0x12	/* spec only (ether_spec) */
   2289 
   2290 /* Used for GTP-U IPv4 and IPv6.
   2291  * The format of GTP packets only includes
   2292  * elements such as TEID and GTP version.
   2293  * It is primarily intended for data communication of the UE.
   2294  */
   2295 #define GTPU_V4_FLOW 0x13	/* hash only */
   2296 #define GTPU_V6_FLOW 0x14	/* hash only */
   2297 
   2298 /* Use for GTP-C IPv4 and v6.
   2299  * The format of these GTP packets does not include TEID.
   2300  * Primarily expected to be used for communication
   2301  * to create sessions for UE data communication,
   2302  * commonly referred to as CSR (Create Session Request).
   2303  */
   2304 #define GTPC_V4_FLOW 0x15	/* hash only */
   2305 #define GTPC_V6_FLOW 0x16	/* hash only */
   2306 
   2307 /* Use for GTP-C IPv4 and v6.
   2308  * Unlike GTPC_V4_FLOW, the format of these GTP packets includes TEID.
   2309  * After session creation, it becomes this packet.
   2310  * This is mainly used for requests to realize UE handover.
   2311  */
   2312 #define GTPC_TEID_V4_FLOW 0x17	/* hash only */
   2313 #define GTPC_TEID_V6_FLOW 0x18	/* hash only */
   2314 
   2315 /* Use for GTP-U and extended headers for the PSC (PDU Session Container).
   2316  * The format of these GTP packets includes TEID and QFI.
   2317  * In 5G communication using UPF (User Plane Function),
   2318  * data communication with this extended header is performed.
   2319  */
   2320 #define GTPU_EH_V4_FLOW 0x19	/* hash only */
   2321 #define GTPU_EH_V6_FLOW 0x1a	/* hash only */
   2322 
   2323 /* Use for GTP-U IPv4 and v6 PSC (PDU Session Container) extended headers.
   2324  * This differs from GTPU_EH_V(4|6)_FLOW in that it is distinguished by
   2325  * UL/DL included in the PSC.
   2326  * There are differences in the data included based on Downlink/Uplink,
   2327  * and can be used to distinguish packets.
   2328  * The functions described so far are useful when you want to
   2329  * handle communication from the mobile network in UPF, PGW, etc.
   2330  */
   2331 #define GTPU_UL_V4_FLOW 0x1b	/* hash only */
   2332 #define GTPU_UL_V6_FLOW 0x1c	/* hash only */
   2333 #define GTPU_DL_V4_FLOW 0x1d	/* hash only */
   2334 #define GTPU_DL_V6_FLOW 0x1e	/* hash only */
   2335 
   2336 /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
   2337 #define	FLOW_EXT	0x80000000
   2338 #define	FLOW_MAC_EXT	0x40000000
   2339 /* Flag to enable RSS spreading of traffic matching rule (nfc only) */
   2340 #define	FLOW_RSS	0x20000000
   2341 
   2342 /* L3-L4 network traffic flow hash options */
   2343 #define	RXH_L2DA	(1 << 1)
   2344 #define	RXH_VLAN	(1 << 2)
   2345 #define	RXH_L3_PROTO	(1 << 3)
   2346 #define	RXH_IP_SRC	(1 << 4)
   2347 #define	RXH_IP_DST	(1 << 5)
   2348 #define	RXH_L4_B_0_1	(1 << 6) /* src port in case of TCP/UDP/SCTP */
   2349 #define	RXH_L4_B_2_3	(1 << 7) /* dst port in case of TCP/UDP/SCTP */
   2350 #define	RXH_GTP_TEID	(1 << 8) /* teid in case of GTP */
   2351 #define	RXH_DISCARD	(1 << 31)
   2352 
   2353 #define	RX_CLS_FLOW_DISC	0xffffffffffffffffULL
   2354 #define RX_CLS_FLOW_WAKE	0xfffffffffffffffeULL
   2355 
   2356 /* Special RX classification rule insert location values */
   2357 #define RX_CLS_LOC_SPECIAL	0x80000000	/* flag */
   2358 #define RX_CLS_LOC_ANY		0xffffffff
   2359 #define RX_CLS_LOC_FIRST	0xfffffffe
   2360 #define RX_CLS_LOC_LAST		0xfffffffd
   2361 
   2362 /* EEPROM Standards for plug in modules */
   2363 #define ETH_MODULE_SFF_8079		0x1
   2364 #define ETH_MODULE_SFF_8079_LEN		256
   2365 #define ETH_MODULE_SFF_8472		0x2
   2366 #define ETH_MODULE_SFF_8472_LEN		512
   2367 #define ETH_MODULE_SFF_8636		0x3
   2368 #define ETH_MODULE_SFF_8636_LEN		256
   2369 #define ETH_MODULE_SFF_8436		0x4
   2370 #define ETH_MODULE_SFF_8436_LEN		256
   2371 
   2372 #define ETH_MODULE_SFF_8636_MAX_LEN     640
   2373 #define ETH_MODULE_SFF_8436_MAX_LEN     640
   2374 
   2375 /* Reset flags */
   2376 /* The reset() operation must clear the flags for the components which
   2377  * were actually reset.  On successful return, the flags indicate the
   2378  * components which were not reset, either because they do not exist
   2379  * in the hardware or because they cannot be reset independently.  The
   2380  * driver must never reset any components that were not requested.
   2381  */
   2382 enum ethtool_reset_flags {
   2383 	/* These flags represent components dedicated to the interface
   2384 	 * the command is addressed to.  Shift any flag left by
   2385 	 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
   2386 	 * same type.
   2387 	 */
   2388 	ETH_RESET_MGMT		= 1 << 0,	/* Management processor */
   2389 	ETH_RESET_IRQ		= 1 << 1,	/* Interrupt requester */
   2390 	ETH_RESET_DMA		= 1 << 2,	/* DMA engine */
   2391 	ETH_RESET_FILTER	= 1 << 3,	/* Filtering/flow direction */
   2392 	ETH_RESET_OFFLOAD	= 1 << 4,	/* Protocol offload */
   2393 	ETH_RESET_MAC		= 1 << 5,	/* Media access controller */
   2394 	ETH_RESET_PHY		= 1 << 6,	/* Transceiver/PHY */
   2395 	ETH_RESET_RAM		= 1 << 7,	/* RAM shared between
   2396 						 * multiple components */
   2397 	ETH_RESET_AP		= 1 << 8,	/* Application processor */
   2398 
   2399 	ETH_RESET_DEDICATED	= 0x0000ffff,	/* All components dedicated to
   2400 						 * this interface */
   2401 	ETH_RESET_ALL		= 0xffffffff,	/* All components used by this
   2402 						 * interface, even if shared */
   2403 };
   2404 #define ETH_RESET_SHARED_SHIFT	16
   2405 
   2406 
   2407 /**
   2408  * struct ethtool_link_settings - link control and status
   2409  *
   2410  * IMPORTANT, Backward compatibility notice: When implementing new
   2411  *	user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
   2412  *	if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
   2413  *	settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
   2414  *	succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
   2415  *	that case.  Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
   2416  *	%ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
   2417  *	settings; do not use %ETHTOOL_SLINKSETTINGS if
   2418  *	%ETHTOOL_GLINKSETTINGS failed: stick to
   2419  *	%ETHTOOL_GSET/%ETHTOOL_SSET in that case.
   2420  *
   2421  * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
   2422  * @speed: Link speed (Mbps)
   2423  * @duplex: Duplex mode; one of %DUPLEX_*
   2424  * @port: Physical connector type; one of %PORT_*
   2425  * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
   2426  *	applicable.  For clause 45 PHYs this is the PRTAD.
   2427  * @autoneg: Enable/disable autonegotiation and auto-detection;
   2428  *	either %AUTONEG_DISABLE or %AUTONEG_ENABLE
   2429  * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
   2430  *	protocols supported by the interface; 0 if unknown.
   2431  *	Read-only.
   2432  * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
   2433  *	%ETH_TP_MDI_*.  If the status is unknown or not applicable, the
   2434  *	value will be %ETH_TP_MDI_INVALID.  Read-only.
   2435  * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
   2436  *	%ETH_TP_MDI_*.  If MDI(-X) control is not implemented, reads
   2437  *	yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
   2438  *	When written successfully, the link should be renegotiated if
   2439  *	necessary.
   2440  * @link_mode_masks_nwords: Number of 32-bit words for each of the
   2441  *	supported, advertising, lp_advertising link mode bitmaps. For
   2442  *	%ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
   2443  *	(>= 0); on return, if handshake in progress, negative if
   2444  *	request size unsupported by kernel: absolute value indicates
   2445  *	kernel expected size and all the other fields but cmd
   2446  *	are 0; otherwise (handshake completed), strictly positive
   2447  *	to indicate size used by kernel and cmd field stays
   2448  *	%ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
   2449  *	%ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
   2450  *	value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
   2451  *	refused. For drivers: ignore this field (use kernel's
   2452  *	__ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
   2453  *	be overwritten by kernel.
   2454  * @transceiver: Used to distinguish different possible PHY types,
   2455  *	reported consistently by PHYLIB.  Read-only.
   2456  * @master_slave_cfg: Master/slave port mode.
   2457  * @master_slave_state: Master/slave port state.
   2458  * @rate_matching: Rate adaptation performed by the PHY
   2459  * @reserved: Reserved for future use; see the note on reserved space.
   2460  * @link_mode_masks: Variable length bitmaps.
   2461  *
   2462  * If autonegotiation is disabled, the speed and @duplex represent the
   2463  * fixed link mode and are writable if the driver supports multiple
   2464  * link modes.  If it is enabled then they are read-only; if the link
   2465  * is up they represent the negotiated link mode; if the link is down,
   2466  * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
   2467  * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
   2468  *
   2469  * Some hardware interfaces may have multiple PHYs and/or physical
   2470  * connectors fitted or do not allow the driver to detect which are
   2471  * fitted.  For these interfaces @port and/or @phy_address may be
   2472  * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
   2473  * Otherwise, attempts to write different values may be ignored or
   2474  * rejected.
   2475  *
   2476  * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
   2477  * are not available in %ethtool_link_settings. These fields will be
   2478  * always set to zero in %ETHTOOL_GSET reply and %ETHTOOL_SSET will
   2479  * fail if any of them is set to non-zero value.
   2480  *
   2481  * Users should assume that all fields not marked read-only are
   2482  * writable and subject to validation by the driver.  They should use
   2483  * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
   2484  * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
   2485  *
   2486  * Drivers that implement %get_link_ksettings and/or
   2487  * %set_link_ksettings should ignore the @cmd
   2488  * and @link_mode_masks_nwords fields (any change to them overwritten
   2489  * by kernel), and rely only on kernel's internal
   2490  * %__ETHTOOL_LINK_MODE_MASK_NBITS and
   2491  * %ethtool_link_mode_mask_t. Drivers that implement
   2492  * %set_link_ksettings() should validate all fields other than @cmd
   2493  * and @link_mode_masks_nwords that are not described as read-only or
   2494  * deprecated, and must ignore all fields described as read-only.
   2495  *
   2496  * @link_mode_masks is divided into three bitfields, each of length
   2497  * @link_mode_masks_nwords:
   2498  * - supported: Bitmap with each bit meaning given by
   2499  *	%ethtool_link_mode_bit_indices for the link modes, physical
   2500  *	connectors and other link features for which the interface
   2501  *	supports autonegotiation or auto-detection.  Read-only.
   2502  * - advertising: Bitmap with each bit meaning given by
   2503  *	%ethtool_link_mode_bit_indices for the link modes, physical
   2504  *	connectors and other link features that are advertised through
   2505  *	autonegotiation or enabled for auto-detection.
   2506  * - lp_advertising: Bitmap with each bit meaning given by
   2507  *	%ethtool_link_mode_bit_indices for the link modes, and other
   2508  *	link features that the link partner advertised through
   2509  *	autonegotiation; 0 if unknown or not applicable.  Read-only.
   2510  */
   2511 struct ethtool_link_settings {
   2512 	__u32	cmd;
   2513 	__u32	speed;
   2514 	__u8	duplex;
   2515 	__u8	port;
   2516 	__u8	phy_address;
   2517 	__u8	autoneg;
   2518 	__u8	mdio_support;
   2519 	__u8	eth_tp_mdix;
   2520 	__u8	eth_tp_mdix_ctrl;
   2521 	__s8	link_mode_masks_nwords;
   2522 	__u8	transceiver;
   2523 	__u8	master_slave_cfg;
   2524 	__u8	master_slave_state;
   2525 	__u8	rate_matching;
   2526 	__u32	reserved[7];
   2527 	/* Linux builds with -Wflex-array-member-not-at-end but does
   2528 	 * not use the "link_mode_masks" member. Leave it defined for
   2529 	 * userspace for now, and when userspace wants to start using
   2530 	 * -Wfamnae, we'll need a new solution.
   2531 	 */
   2532 	__u32	link_mode_masks[];
   2533 	/* layout of link_mode_masks fields:
   2534 	 * __u32 map_supported[link_mode_masks_nwords];
   2535 	 * __u32 map_advertising[link_mode_masks_nwords];
   2536 	 * __u32 map_lp_advertising[link_mode_masks_nwords];
   2537 	 */
   2538 };
   2539 
   2540 /**
   2541  * enum phy_upstream - Represents the upstream component a given PHY device
   2542  * is connected to, as in what is on the other end of the MII bus. Most PHYs
   2543  * will be attached to an Ethernet MAC controller, but in some cases, there's
   2544  * an intermediate PHY used as a media-converter, which will driver another
   2545  * MII interface as its output.
   2546  * @PHY_UPSTREAM_MAC: Upstream component is a MAC (a switch port,
   2547  *		      or ethernet controller)
   2548  * @PHY_UPSTREAM_PHY: Upstream component is a PHY (likely a media converter)
   2549  */
   2550 enum phy_upstream {
   2551 	PHY_UPSTREAM_MAC,
   2552 	PHY_UPSTREAM_PHY,
   2553 };
   2554 
   2555 #endif /* _LINUX_ETHTOOL_H */