1607ca46eSDavid Howells /* 2607ca46eSDavid Howells * ethtool.h: Defines for Linux ethtool. 3607ca46eSDavid Howells * 4607ca46eSDavid Howells * Copyright (C) 1998 David S. Miller ([email protected]) 5607ca46eSDavid Howells * Copyright 2001 Jeff Garzik <[email protected]> 6607ca46eSDavid Howells * Portions Copyright 2001 Sun Microsystems ([email protected]) 7607ca46eSDavid Howells * Portions Copyright 2002 Intel ([email protected], 8607ca46eSDavid Howells * [email protected], 9607ca46eSDavid Howells * [email protected]) 10607ca46eSDavid Howells * Portions Copyright (C) Sun Microsystems 2008 11607ca46eSDavid Howells */ 12607ca46eSDavid Howells 13607ca46eSDavid Howells #ifndef _UAPI_LINUX_ETHTOOL_H 14607ca46eSDavid Howells #define _UAPI_LINUX_ETHTOOL_H 15607ca46eSDavid Howells 16607ca46eSDavid Howells #include <linux/types.h> 17607ca46eSDavid Howells #include <linux/if_ether.h> 18607ca46eSDavid Howells 19bf8fc60aSBen Hutchings /* All structures exposed to userland should be defined such that they 20bf8fc60aSBen Hutchings * have the same layout for 32-bit and 64-bit userland. 21bf8fc60aSBen Hutchings */ 22bf8fc60aSBen Hutchings 23bf8fc60aSBen Hutchings /** 24bf8fc60aSBen Hutchings * struct ethtool_cmd - link control and status 25bf8fc60aSBen Hutchings * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET 26bf8fc60aSBen Hutchings * @supported: Bitmask of %SUPPORTED_* flags for the link modes, 27bf8fc60aSBen Hutchings * physical connectors and other link features for which the 28bf8fc60aSBen Hutchings * interface supports autonegotiation or auto-detection. 29bf8fc60aSBen Hutchings * Read-only. 30bf8fc60aSBen Hutchings * @advertising: Bitmask of %ADVERTISED_* flags for the link modes, 31bf8fc60aSBen Hutchings * physical connectors and other link features that are 32bf8fc60aSBen Hutchings * advertised through autonegotiation or enabled for 33bf8fc60aSBen Hutchings * auto-detection. 344456ed04SMichael S. Tsirkin * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN 35bf8fc60aSBen Hutchings * @duplex: Duplex mode; one of %DUPLEX_* 36bf8fc60aSBen Hutchings * @port: Physical connector type; one of %PORT_* 37bf8fc60aSBen Hutchings * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not 38bf8fc60aSBen Hutchings * applicable. For clause 45 PHYs this is the PRTAD. 39bf8fc60aSBen Hutchings * @transceiver: Historically used to distinguish different possible 40bf8fc60aSBen Hutchings * PHY types, but not in a consistent way. Deprecated. 41bf8fc60aSBen Hutchings * @autoneg: Enable/disable autonegotiation and auto-detection; 42bf8fc60aSBen Hutchings * either %AUTONEG_DISABLE or %AUTONEG_ENABLE 43bf8fc60aSBen Hutchings * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO 44bf8fc60aSBen Hutchings * protocols supported by the interface; 0 if unknown. 45bf8fc60aSBen Hutchings * Read-only. 46bf8fc60aSBen Hutchings * @maxtxpkt: Historically used to report TX IRQ coalescing; now 47bf8fc60aSBen Hutchings * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 48bf8fc60aSBen Hutchings * @maxrxpkt: Historically used to report RX IRQ coalescing; now 49bf8fc60aSBen Hutchings * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 504456ed04SMichael S. Tsirkin * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN 51bf8fc60aSBen Hutchings * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of 52bf8fc60aSBen Hutchings * %ETH_TP_MDI_*. If the status is unknown or not applicable, the 53bf8fc60aSBen Hutchings * value will be %ETH_TP_MDI_INVALID. Read-only. 54bf8fc60aSBen Hutchings * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of 55bf8fc60aSBen Hutchings * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads 56bf8fc60aSBen Hutchings * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. 57bf8fc60aSBen Hutchings * When written successfully, the link should be renegotiated if 58bf8fc60aSBen Hutchings * necessary. 59bf8fc60aSBen Hutchings * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes 60bf8fc60aSBen Hutchings * and other link features that the link partner advertised 61bf8fc60aSBen Hutchings * through autonegotiation; 0 if unknown or not applicable. 62bf8fc60aSBen Hutchings * Read-only. 63bf8fc60aSBen Hutchings * 64bf8fc60aSBen Hutchings * The link speed in Mbps is split between @speed and @speed_hi. Use 65bf8fc60aSBen Hutchings * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to 66bf8fc60aSBen Hutchings * access it. 67bf8fc60aSBen Hutchings * 68bf8fc60aSBen Hutchings * If autonegotiation is disabled, the speed and @duplex represent the 69bf8fc60aSBen Hutchings * fixed link mode and are writable if the driver supports multiple 70bf8fc60aSBen Hutchings * link modes. If it is enabled then they are read-only; if the link 71bf8fc60aSBen Hutchings * is up they represent the negotiated link mode; if the link is down, 72bf8fc60aSBen Hutchings * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and 73bf8fc60aSBen Hutchings * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. 74bf8fc60aSBen Hutchings * 75bf8fc60aSBen Hutchings * Some hardware interfaces may have multiple PHYs and/or physical 76bf8fc60aSBen Hutchings * connectors fitted or do not allow the driver to detect which are 77bf8fc60aSBen Hutchings * fitted. For these interfaces @port and/or @phy_address may be 78bf8fc60aSBen Hutchings * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. 79bf8fc60aSBen Hutchings * Otherwise, attempts to write different values may be ignored or 80bf8fc60aSBen Hutchings * rejected. 81bf8fc60aSBen Hutchings * 82bf8fc60aSBen Hutchings * Users should assume that all fields not marked read-only are 83bf8fc60aSBen Hutchings * writable and subject to validation by the driver. They should use 84bf8fc60aSBen Hutchings * %ETHTOOL_GSET to get the current values before making specific 85bf8fc60aSBen Hutchings * changes and then applying them with %ETHTOOL_SSET. 86bf8fc60aSBen Hutchings * 87bf8fc60aSBen Hutchings * Drivers that implement set_settings() should validate all fields 88bf8fc60aSBen Hutchings * other than @cmd that are not described as read-only or deprecated, 89bf8fc60aSBen Hutchings * and must ignore all fields described as read-only. 90bf8fc60aSBen Hutchings * 91bf8fc60aSBen Hutchings * Deprecated fields should be ignored by both users and drivers. 92bf8fc60aSBen Hutchings */ 93607ca46eSDavid Howells struct ethtool_cmd { 94607ca46eSDavid Howells __u32 cmd; 95bf8fc60aSBen Hutchings __u32 supported; 96bf8fc60aSBen Hutchings __u32 advertising; 97bf8fc60aSBen Hutchings __u16 speed; 98bf8fc60aSBen Hutchings __u8 duplex; 99bf8fc60aSBen Hutchings __u8 port; 100bf8fc60aSBen Hutchings __u8 phy_address; 101bf8fc60aSBen Hutchings __u8 transceiver; 102bf8fc60aSBen Hutchings __u8 autoneg; 103bf8fc60aSBen Hutchings __u8 mdio_support; 104bf8fc60aSBen Hutchings __u32 maxtxpkt; 105bf8fc60aSBen Hutchings __u32 maxrxpkt; 106bf8fc60aSBen Hutchings __u16 speed_hi; 107bf8fc60aSBen Hutchings __u8 eth_tp_mdix; 108bf8fc60aSBen Hutchings __u8 eth_tp_mdix_ctrl; 109bf8fc60aSBen Hutchings __u32 lp_advertising; 110607ca46eSDavid Howells __u32 reserved[2]; 111607ca46eSDavid Howells }; 112607ca46eSDavid Howells 113607ca46eSDavid Howells static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 114607ca46eSDavid Howells __u32 speed) 115607ca46eSDavid Howells { 116607ca46eSDavid Howells 117607ca46eSDavid Howells ep->speed = (__u16)speed; 118607ca46eSDavid Howells ep->speed_hi = (__u16)(speed >> 16); 119607ca46eSDavid Howells } 120607ca46eSDavid Howells 121607ca46eSDavid Howells static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) 122607ca46eSDavid Howells { 123607ca46eSDavid Howells return (ep->speed_hi << 16) | ep->speed; 124607ca46eSDavid Howells } 125607ca46eSDavid Howells 126607ca46eSDavid Howells /* Device supports clause 22 register access to PHY or peripherals 127607ca46eSDavid Howells * using the interface defined in <linux/mii.h>. This should not be 128607ca46eSDavid Howells * set if there are known to be no such peripherals present or if 129607ca46eSDavid Howells * the driver only emulates clause 22 registers for compatibility. 130607ca46eSDavid Howells */ 131607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C22 1 132607ca46eSDavid Howells 133607ca46eSDavid Howells /* Device supports clause 45 register access to PHY or peripherals 134607ca46eSDavid Howells * using the interface defined in <linux/mii.h> and <linux/mdio.h>. 135607ca46eSDavid Howells * This should not be set if there are known to be no such peripherals 136607ca46eSDavid Howells * present. 137607ca46eSDavid Howells */ 138607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C45 2 139607ca46eSDavid Howells 140607ca46eSDavid Howells #define ETHTOOL_FWVERS_LEN 32 141607ca46eSDavid Howells #define ETHTOOL_BUSINFO_LEN 32 142a4505152SHariprasad Shenai #define ETHTOOL_EROMVERS_LEN 32 143daba1b6bSBen Hutchings 144daba1b6bSBen Hutchings /** 145daba1b6bSBen Hutchings * struct ethtool_drvinfo - general driver and device information 146daba1b6bSBen Hutchings * @cmd: Command number = %ETHTOOL_GDRVINFO 147daba1b6bSBen Hutchings * @driver: Driver short name. This should normally match the name 148daba1b6bSBen Hutchings * in its bus driver structure (e.g. pci_driver::name). Must 149daba1b6bSBen Hutchings * not be an empty string. 150daba1b6bSBen Hutchings * @version: Driver version string; may be an empty string 151daba1b6bSBen Hutchings * @fw_version: Firmware version string; may be an empty string 152a4505152SHariprasad Shenai * @erom_version: Expansion ROM version string; may be an empty string 153daba1b6bSBen Hutchings * @bus_info: Device bus address. This should match the dev_name() 154daba1b6bSBen Hutchings * string for the underlying bus device, if there is one. May be 155daba1b6bSBen Hutchings * an empty string. 156daba1b6bSBen Hutchings * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and 157daba1b6bSBen Hutchings * %ETHTOOL_SPFLAGS commands; also the number of strings in the 158daba1b6bSBen Hutchings * %ETH_SS_PRIV_FLAGS set 159daba1b6bSBen Hutchings * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS 160daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_STATS set 161daba1b6bSBen Hutchings * @testinfo_len: Number of results returned by the %ETHTOOL_TEST 162daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_TEST set 163daba1b6bSBen Hutchings * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM 164daba1b6bSBen Hutchings * and %ETHTOOL_SEEPROM commands, in bytes 165daba1b6bSBen Hutchings * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS 166daba1b6bSBen Hutchings * command, in bytes 167daba1b6bSBen Hutchings * 168daba1b6bSBen Hutchings * Users can use the %ETHTOOL_GSSET_INFO command to get the number of 169daba1b6bSBen Hutchings * strings in any string set (from Linux 2.6.34). 170daba1b6bSBen Hutchings * 171daba1b6bSBen Hutchings * Drivers should set at most @driver, @version, @fw_version and 172daba1b6bSBen Hutchings * @bus_info in their get_drvinfo() implementation. The ethtool 173daba1b6bSBen Hutchings * core fills in the other fields using other driver operations. 174daba1b6bSBen Hutchings */ 175607ca46eSDavid Howells struct ethtool_drvinfo { 176607ca46eSDavid Howells __u32 cmd; 177daba1b6bSBen Hutchings char driver[32]; 178daba1b6bSBen Hutchings char version[32]; 179daba1b6bSBen Hutchings char fw_version[ETHTOOL_FWVERS_LEN]; 180daba1b6bSBen Hutchings char bus_info[ETHTOOL_BUSINFO_LEN]; 181a4505152SHariprasad Shenai char erom_version[ETHTOOL_EROMVERS_LEN]; 182607ca46eSDavid Howells char reserved2[12]; 183daba1b6bSBen Hutchings __u32 n_priv_flags; 184daba1b6bSBen Hutchings __u32 n_stats; 185607ca46eSDavid Howells __u32 testinfo_len; 186daba1b6bSBen Hutchings __u32 eedump_len; 187daba1b6bSBen Hutchings __u32 regdump_len; 188607ca46eSDavid Howells }; 189607ca46eSDavid Howells 190607ca46eSDavid Howells #define SOPASS_MAX 6 19102d59f3fSBen Hutchings 19202d59f3fSBen Hutchings /** 19302d59f3fSBen Hutchings * struct ethtool_wolinfo - Wake-On-Lan configuration 19402d59f3fSBen Hutchings * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL 19502d59f3fSBen Hutchings * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes. 19602d59f3fSBen Hutchings * Read-only. 19702d59f3fSBen Hutchings * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes. 19802d59f3fSBen Hutchings * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE 19902d59f3fSBen Hutchings * is set in @wolopts. 20002d59f3fSBen Hutchings */ 201607ca46eSDavid Howells struct ethtool_wolinfo { 202607ca46eSDavid Howells __u32 cmd; 203607ca46eSDavid Howells __u32 supported; 204607ca46eSDavid Howells __u32 wolopts; 20502d59f3fSBen Hutchings __u8 sopass[SOPASS_MAX]; 206607ca46eSDavid Howells }; 207607ca46eSDavid Howells 208607ca46eSDavid Howells /* for passing single values */ 209607ca46eSDavid Howells struct ethtool_value { 210607ca46eSDavid Howells __u32 cmd; 211607ca46eSDavid Howells __u32 data; 212607ca46eSDavid Howells }; 213607ca46eSDavid Howells 214f0db9b07SGovindarajulu Varadarajan enum tunable_id { 215f0db9b07SGovindarajulu Varadarajan ETHTOOL_ID_UNSPEC, 216f0db9b07SGovindarajulu Varadarajan ETHTOOL_RX_COPYBREAK, 2171255a505SEric Dumazet ETHTOOL_TX_COPYBREAK, 218a4244b0cSHadar Hen Zion /* 219a4244b0cSHadar Hen Zion * Add your fresh new tubale attribute above and remember to update 220a4244b0cSHadar Hen Zion * tunable_strings[] in net/core/ethtool.c 221a4244b0cSHadar Hen Zion */ 222a4244b0cSHadar Hen Zion __ETHTOOL_TUNABLE_COUNT, 223f0db9b07SGovindarajulu Varadarajan }; 224f0db9b07SGovindarajulu Varadarajan 225f0db9b07SGovindarajulu Varadarajan enum tunable_type_id { 226f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_UNSPEC, 227f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U8, 228f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U16, 229f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U32, 230f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U64, 231f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_STRING, 232f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S8, 233f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S16, 234f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S32, 235f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S64, 236f0db9b07SGovindarajulu Varadarajan }; 237f0db9b07SGovindarajulu Varadarajan 238f0db9b07SGovindarajulu Varadarajan struct ethtool_tunable { 239f0db9b07SGovindarajulu Varadarajan __u32 cmd; 240f0db9b07SGovindarajulu Varadarajan __u32 id; 241f0db9b07SGovindarajulu Varadarajan __u32 type_id; 242f0db9b07SGovindarajulu Varadarajan __u32 len; 243f0db9b07SGovindarajulu Varadarajan void *data[0]; 244f0db9b07SGovindarajulu Varadarajan }; 245f0db9b07SGovindarajulu Varadarajan 24609fb8bb0SBen Hutchings /** 24709fb8bb0SBen Hutchings * struct ethtool_regs - hardware register dump 24809fb8bb0SBen Hutchings * @cmd: Command number = %ETHTOOL_GREGS 24909fb8bb0SBen Hutchings * @version: Dump format version. This is driver-specific and may 25009fb8bb0SBen Hutchings * distinguish different chips/revisions. Drivers must use new 25109fb8bb0SBen Hutchings * version numbers whenever the dump format changes in an 25209fb8bb0SBen Hutchings * incompatible way. 25309fb8bb0SBen Hutchings * @len: On entry, the real length of @data. On return, the number of 25409fb8bb0SBen Hutchings * bytes used. 25509fb8bb0SBen Hutchings * @data: Buffer for the register dump 25609fb8bb0SBen Hutchings * 25709fb8bb0SBen Hutchings * Users should use %ETHTOOL_GDRVINFO to find the maximum length of 25809fb8bb0SBen Hutchings * a register dump for the interface. They must allocate the buffer 25909fb8bb0SBen Hutchings * immediately following this structure. 26009fb8bb0SBen Hutchings */ 261607ca46eSDavid Howells struct ethtool_regs { 262607ca46eSDavid Howells __u32 cmd; 26309fb8bb0SBen Hutchings __u32 version; 26409fb8bb0SBen Hutchings __u32 len; 265607ca46eSDavid Howells __u8 data[0]; 266607ca46eSDavid Howells }; 267607ca46eSDavid Howells 268c8364a63SBen Hutchings /** 269c8364a63SBen Hutchings * struct ethtool_eeprom - EEPROM dump 270c8364a63SBen Hutchings * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or 271c8364a63SBen Hutchings * %ETHTOOL_SEEPROM 272c8364a63SBen Hutchings * @magic: A 'magic cookie' value to guard against accidental changes. 273c8364a63SBen Hutchings * The value passed in to %ETHTOOL_SEEPROM must match the value 274c8364a63SBen Hutchings * returned by %ETHTOOL_GEEPROM for the same device. This is 275c8364a63SBen Hutchings * unused when @cmd is %ETHTOOL_GMODULEEEPROM. 276c8364a63SBen Hutchings * @offset: Offset within the EEPROM to begin reading/writing, in bytes 277c8364a63SBen Hutchings * @len: On entry, number of bytes to read/write. On successful 278c8364a63SBen Hutchings * return, number of bytes actually read/written. In case of 279c8364a63SBen Hutchings * error, this may indicate at what point the error occurred. 280c8364a63SBen Hutchings * @data: Buffer to read/write from 281c8364a63SBen Hutchings * 282c8364a63SBen Hutchings * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find 283c8364a63SBen Hutchings * the length of an on-board or module EEPROM, respectively. They 284c8364a63SBen Hutchings * must allocate the buffer immediately following this structure. 285c8364a63SBen Hutchings */ 286607ca46eSDavid Howells struct ethtool_eeprom { 287607ca46eSDavid Howells __u32 cmd; 288607ca46eSDavid Howells __u32 magic; 289c8364a63SBen Hutchings __u32 offset; 290c8364a63SBen Hutchings __u32 len; 291607ca46eSDavid Howells __u8 data[0]; 292607ca46eSDavid Howells }; 293607ca46eSDavid Howells 294607ca46eSDavid Howells /** 295607ca46eSDavid Howells * struct ethtool_eee - Energy Efficient Ethernet information 296607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}EEE 297607ca46eSDavid Howells * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations 298607ca46eSDavid Howells * for which there is EEE support. 299607ca46eSDavid Howells * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations 300607ca46eSDavid Howells * advertised as eee capable. 301607ca46eSDavid Howells * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex 302607ca46eSDavid Howells * combinations advertised by the link partner as eee capable. 303607ca46eSDavid Howells * @eee_active: Result of the eee auto negotiation. 304607ca46eSDavid Howells * @eee_enabled: EEE configured mode (enabled/disabled). 305607ca46eSDavid Howells * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given 306607ca46eSDavid Howells * that eee was negotiated. 307607ca46eSDavid Howells * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting 308607ca46eSDavid Howells * its tx lpi (after reaching 'idle' state). Effective only when eee 309607ca46eSDavid Howells * was negotiated and tx_lpi_enabled was set. 310607ca46eSDavid Howells */ 311607ca46eSDavid Howells struct ethtool_eee { 312607ca46eSDavid Howells __u32 cmd; 313607ca46eSDavid Howells __u32 supported; 314607ca46eSDavid Howells __u32 advertised; 315607ca46eSDavid Howells __u32 lp_advertised; 316607ca46eSDavid Howells __u32 eee_active; 317607ca46eSDavid Howells __u32 eee_enabled; 318607ca46eSDavid Howells __u32 tx_lpi_enabled; 319607ca46eSDavid Howells __u32 tx_lpi_timer; 320607ca46eSDavid Howells __u32 reserved[2]; 321607ca46eSDavid Howells }; 322607ca46eSDavid Howells 323607ca46eSDavid Howells /** 324607ca46eSDavid Howells * struct ethtool_modinfo - plugin module eeprom information 325607ca46eSDavid Howells * @cmd: %ETHTOOL_GMODULEINFO 326607ca46eSDavid Howells * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx 327607ca46eSDavid Howells * @eeprom_len: Length of the eeprom 328607ca46eSDavid Howells * 329607ca46eSDavid Howells * This structure is used to return the information to 330607ca46eSDavid Howells * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. 331607ca46eSDavid Howells * The type code indicates the eeprom data format 332607ca46eSDavid Howells */ 333607ca46eSDavid Howells struct ethtool_modinfo { 334607ca46eSDavid Howells __u32 cmd; 335607ca46eSDavid Howells __u32 type; 336607ca46eSDavid Howells __u32 eeprom_len; 337607ca46eSDavid Howells __u32 reserved[8]; 338607ca46eSDavid Howells }; 339607ca46eSDavid Howells 340607ca46eSDavid Howells /** 341607ca46eSDavid Howells * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates 342607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}COALESCE 343607ca46eSDavid Howells * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after 344607ca46eSDavid Howells * a packet arrives. 345607ca46eSDavid Howells * @rx_max_coalesced_frames: Maximum number of packets to receive 346607ca46eSDavid Howells * before an RX interrupt. 347607ca46eSDavid Howells * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that 348607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host. 349607ca46eSDavid Howells * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, 350607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced 351607ca46eSDavid Howells * by the host. 352607ca46eSDavid Howells * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after 353607ca46eSDavid Howells * a packet is sent. 354607ca46eSDavid Howells * @tx_max_coalesced_frames: Maximum number of packets to be sent 355607ca46eSDavid Howells * before a TX interrupt. 356607ca46eSDavid Howells * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that 357607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host. 358607ca46eSDavid Howells * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, 359607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced 360607ca46eSDavid Howells * by the host. 361607ca46eSDavid Howells * @stats_block_coalesce_usecs: How many usecs to delay in-memory 362607ca46eSDavid Howells * statistics block updates. Some drivers do not have an 363607ca46eSDavid Howells * in-memory statistic block, and in such cases this value is 364607ca46eSDavid Howells * ignored. This value must not be zero. 365607ca46eSDavid Howells * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. 366607ca46eSDavid Howells * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. 367607ca46eSDavid Howells * @pkt_rate_low: Threshold for low packet rate (packets per second). 368607ca46eSDavid Howells * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after 369607ca46eSDavid Howells * a packet arrives, when the packet rate is below @pkt_rate_low. 370607ca46eSDavid Howells * @rx_max_coalesced_frames_low: Maximum number of packets to be received 371607ca46eSDavid Howells * before an RX interrupt, when the packet rate is below @pkt_rate_low. 372607ca46eSDavid Howells * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after 373607ca46eSDavid Howells * a packet is sent, when the packet rate is below @pkt_rate_low. 374607ca46eSDavid Howells * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before 375607ca46eSDavid Howells * a TX interrupt, when the packet rate is below @pkt_rate_low. 376607ca46eSDavid Howells * @pkt_rate_high: Threshold for high packet rate (packets per second). 377607ca46eSDavid Howells * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after 378607ca46eSDavid Howells * a packet arrives, when the packet rate is above @pkt_rate_high. 379607ca46eSDavid Howells * @rx_max_coalesced_frames_high: Maximum number of packets to be received 380607ca46eSDavid Howells * before an RX interrupt, when the packet rate is above @pkt_rate_high. 381607ca46eSDavid Howells * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after 382607ca46eSDavid Howells * a packet is sent, when the packet rate is above @pkt_rate_high. 383607ca46eSDavid Howells * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before 384607ca46eSDavid Howells * a TX interrupt, when the packet rate is above @pkt_rate_high. 385607ca46eSDavid Howells * @rate_sample_interval: How often to do adaptive coalescing packet rate 386607ca46eSDavid Howells * sampling, measured in seconds. Must not be zero. 387607ca46eSDavid Howells * 388073e3cf2SBen Hutchings * Each pair of (usecs, max_frames) fields specifies that interrupts 389073e3cf2SBen Hutchings * should be coalesced until 390607ca46eSDavid Howells * (usecs > 0 && time_since_first_completion >= usecs) || 391607ca46eSDavid Howells * (max_frames > 0 && completed_frames >= max_frames) 392073e3cf2SBen Hutchings * 393607ca46eSDavid Howells * It is illegal to set both usecs and max_frames to zero as this 394607ca46eSDavid Howells * would cause interrupts to never be generated. To disable 395607ca46eSDavid Howells * coalescing, set usecs = 0 and max_frames = 1. 396607ca46eSDavid Howells * 397607ca46eSDavid Howells * Some implementations ignore the value of max_frames and use the 398073e3cf2SBen Hutchings * condition time_since_first_completion >= usecs 399073e3cf2SBen Hutchings * 400607ca46eSDavid Howells * This is deprecated. Drivers for hardware that does not support 401607ca46eSDavid Howells * counting completions should validate that max_frames == !rx_usecs. 402607ca46eSDavid Howells * 403607ca46eSDavid Howells * Adaptive RX/TX coalescing is an algorithm implemented by some 404607ca46eSDavid Howells * drivers to improve latency under low packet rates and improve 405607ca46eSDavid Howells * throughput under high packet rates. Some drivers only implement 406607ca46eSDavid Howells * one of RX or TX adaptive coalescing. Anything not implemented by 407607ca46eSDavid Howells * the driver causes these values to be silently ignored. 408607ca46eSDavid Howells * 409607ca46eSDavid Howells * When the packet rate is below @pkt_rate_high but above 410607ca46eSDavid Howells * @pkt_rate_low (both measured in packets per second) the 411607ca46eSDavid Howells * normal {rx,tx}_* coalescing parameters are used. 412607ca46eSDavid Howells */ 413607ca46eSDavid Howells struct ethtool_coalesce { 414607ca46eSDavid Howells __u32 cmd; 415607ca46eSDavid Howells __u32 rx_coalesce_usecs; 416607ca46eSDavid Howells __u32 rx_max_coalesced_frames; 417607ca46eSDavid Howells __u32 rx_coalesce_usecs_irq; 418607ca46eSDavid Howells __u32 rx_max_coalesced_frames_irq; 419607ca46eSDavid Howells __u32 tx_coalesce_usecs; 420607ca46eSDavid Howells __u32 tx_max_coalesced_frames; 421607ca46eSDavid Howells __u32 tx_coalesce_usecs_irq; 422607ca46eSDavid Howells __u32 tx_max_coalesced_frames_irq; 423607ca46eSDavid Howells __u32 stats_block_coalesce_usecs; 424607ca46eSDavid Howells __u32 use_adaptive_rx_coalesce; 425607ca46eSDavid Howells __u32 use_adaptive_tx_coalesce; 426607ca46eSDavid Howells __u32 pkt_rate_low; 427607ca46eSDavid Howells __u32 rx_coalesce_usecs_low; 428607ca46eSDavid Howells __u32 rx_max_coalesced_frames_low; 429607ca46eSDavid Howells __u32 tx_coalesce_usecs_low; 430607ca46eSDavid Howells __u32 tx_max_coalesced_frames_low; 431607ca46eSDavid Howells __u32 pkt_rate_high; 432607ca46eSDavid Howells __u32 rx_coalesce_usecs_high; 433607ca46eSDavid Howells __u32 rx_max_coalesced_frames_high; 434607ca46eSDavid Howells __u32 tx_coalesce_usecs_high; 435607ca46eSDavid Howells __u32 tx_max_coalesced_frames_high; 436607ca46eSDavid Howells __u32 rate_sample_interval; 437607ca46eSDavid Howells }; 438607ca46eSDavid Howells 439af440a8aSBen Hutchings /** 440af440a8aSBen Hutchings * struct ethtool_ringparam - RX/TX ring parameters 441af440a8aSBen Hutchings * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM 442af440a8aSBen Hutchings * @rx_max_pending: Maximum supported number of pending entries per 443af440a8aSBen Hutchings * RX ring. Read-only. 444af440a8aSBen Hutchings * @rx_mini_max_pending: Maximum supported number of pending entries 445af440a8aSBen Hutchings * per RX mini ring. Read-only. 446af440a8aSBen Hutchings * @rx_jumbo_max_pending: Maximum supported number of pending entries 447af440a8aSBen Hutchings * per RX jumbo ring. Read-only. 448af440a8aSBen Hutchings * @tx_max_pending: Maximum supported number of pending entries per 449af440a8aSBen Hutchings * TX ring. Read-only. 450af440a8aSBen Hutchings * @rx_pending: Current maximum number of pending entries per RX ring 451af440a8aSBen Hutchings * @rx_mini_pending: Current maximum number of pending entries per RX 452af440a8aSBen Hutchings * mini ring 453af440a8aSBen Hutchings * @rx_jumbo_pending: Current maximum number of pending entries per RX 454af440a8aSBen Hutchings * jumbo ring 455af440a8aSBen Hutchings * @tx_pending: Current maximum supported number of pending entries 456af440a8aSBen Hutchings * per TX ring 457af440a8aSBen Hutchings * 458af440a8aSBen Hutchings * If the interface does not have separate RX mini and/or jumbo rings, 459af440a8aSBen Hutchings * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0. 460af440a8aSBen Hutchings * 461af440a8aSBen Hutchings * There may also be driver-dependent minimum values for the number 462af440a8aSBen Hutchings * of entries per ring. 463607ca46eSDavid Howells */ 464af440a8aSBen Hutchings struct ethtool_ringparam { 465af440a8aSBen Hutchings __u32 cmd; 466607ca46eSDavid Howells __u32 rx_max_pending; 467607ca46eSDavid Howells __u32 rx_mini_max_pending; 468607ca46eSDavid Howells __u32 rx_jumbo_max_pending; 469607ca46eSDavid Howells __u32 tx_max_pending; 470607ca46eSDavid Howells __u32 rx_pending; 471607ca46eSDavid Howells __u32 rx_mini_pending; 472607ca46eSDavid Howells __u32 rx_jumbo_pending; 473607ca46eSDavid Howells __u32 tx_pending; 474607ca46eSDavid Howells }; 475607ca46eSDavid Howells 476607ca46eSDavid Howells /** 477607ca46eSDavid Howells * struct ethtool_channels - configuring number of network channel 478607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}CHANNELS 479607ca46eSDavid Howells * @max_rx: Read only. Maximum number of receive channel the driver support. 480607ca46eSDavid Howells * @max_tx: Read only. Maximum number of transmit channel the driver support. 481607ca46eSDavid Howells * @max_other: Read only. Maximum number of other channel the driver support. 482607ca46eSDavid Howells * @max_combined: Read only. Maximum number of combined channel the driver 483607ca46eSDavid Howells * support. Set of queues RX, TX or other. 484607ca46eSDavid Howells * @rx_count: Valid values are in the range 1 to the max_rx. 485607ca46eSDavid Howells * @tx_count: Valid values are in the range 1 to the max_tx. 486607ca46eSDavid Howells * @other_count: Valid values are in the range 1 to the max_other. 487607ca46eSDavid Howells * @combined_count: Valid values are in the range 1 to the max_combined. 488607ca46eSDavid Howells * 489607ca46eSDavid Howells * This can be used to configure RX, TX and other channels. 490607ca46eSDavid Howells */ 491607ca46eSDavid Howells 492607ca46eSDavid Howells struct ethtool_channels { 493607ca46eSDavid Howells __u32 cmd; 494607ca46eSDavid Howells __u32 max_rx; 495607ca46eSDavid Howells __u32 max_tx; 496607ca46eSDavid Howells __u32 max_other; 497607ca46eSDavid Howells __u32 max_combined; 498607ca46eSDavid Howells __u32 rx_count; 499607ca46eSDavid Howells __u32 tx_count; 500607ca46eSDavid Howells __u32 other_count; 501607ca46eSDavid Howells __u32 combined_count; 502607ca46eSDavid Howells }; 503607ca46eSDavid Howells 5046a7a1081SBen Hutchings /** 5056a7a1081SBen Hutchings * struct ethtool_pauseparam - Ethernet pause (flow control) parameters 5066a7a1081SBen Hutchings * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM 5076a7a1081SBen Hutchings * @autoneg: Flag to enable autonegotiation of pause frame use 5086a7a1081SBen Hutchings * @rx_pause: Flag to enable reception of pause frames 5096a7a1081SBen Hutchings * @tx_pause: Flag to enable transmission of pause frames 510607ca46eSDavid Howells * 5116a7a1081SBen Hutchings * Drivers should reject a non-zero setting of @autoneg when 5126a7a1081SBen Hutchings * autoneogotiation is disabled (or not supported) for the link. 5136a7a1081SBen Hutchings * 5146a7a1081SBen Hutchings * If the link is autonegotiated, drivers should use 5156a7a1081SBen Hutchings * mii_advertise_flowctrl() or similar code to set the advertised 5166a7a1081SBen Hutchings * pause frame capabilities based on the @rx_pause and @tx_pause flags, 5176a7a1081SBen Hutchings * even if @autoneg is zero. They should also allow the advertised 5186a7a1081SBen Hutchings * pause frame capabilities to be controlled directly through the 5196a7a1081SBen Hutchings * advertising field of &struct ethtool_cmd. 5206a7a1081SBen Hutchings * 5216a7a1081SBen Hutchings * If @autoneg is non-zero, the MAC is configured to send and/or 5226a7a1081SBen Hutchings * receive pause frames according to the result of autonegotiation. 5236a7a1081SBen Hutchings * Otherwise, it is configured directly based on the @rx_pause and 5246a7a1081SBen Hutchings * @tx_pause flags. 525607ca46eSDavid Howells */ 5266a7a1081SBen Hutchings struct ethtool_pauseparam { 5276a7a1081SBen Hutchings __u32 cmd; 528607ca46eSDavid Howells __u32 autoneg; 529607ca46eSDavid Howells __u32 rx_pause; 530607ca46eSDavid Howells __u32 tx_pause; 531607ca46eSDavid Howells }; 532607ca46eSDavid Howells 533607ca46eSDavid Howells #define ETH_GSTRING_LEN 32 534fe5df1b9SBen Hutchings 535fe5df1b9SBen Hutchings /** 536fe5df1b9SBen Hutchings * enum ethtool_stringset - string set ID 537fe5df1b9SBen Hutchings * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST 538fe5df1b9SBen Hutchings * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS 539fe5df1b9SBen Hutchings * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with 540fe5df1b9SBen Hutchings * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS 541fe5df1b9SBen Hutchings * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; 542fe5df1b9SBen Hutchings * now deprecated 543fe5df1b9SBen Hutchings * @ETH_SS_FEATURES: Device feature names 544892311f6SEyal Perry * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names 545f3a40945SAndrew Lunn * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS 546fe5df1b9SBen Hutchings */ 547607ca46eSDavid Howells enum ethtool_stringset { 548607ca46eSDavid Howells ETH_SS_TEST = 0, 549607ca46eSDavid Howells ETH_SS_STATS, 550607ca46eSDavid Howells ETH_SS_PRIV_FLAGS, 551fe5df1b9SBen Hutchings ETH_SS_NTUPLE_FILTERS, 552607ca46eSDavid Howells ETH_SS_FEATURES, 553892311f6SEyal Perry ETH_SS_RSS_HASH_FUNCS, 554a4244b0cSHadar Hen Zion ETH_SS_TUNABLES, 555f3a40945SAndrew Lunn ETH_SS_PHY_STATS, 556607ca46eSDavid Howells }; 557607ca46eSDavid Howells 558fe5df1b9SBen Hutchings /** 559fe5df1b9SBen Hutchings * struct ethtool_gstrings - string set for data tagging 560fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTRINGS 561fe5df1b9SBen Hutchings * @string_set: String set ID; one of &enum ethtool_stringset 562fe5df1b9SBen Hutchings * @len: On return, the number of strings in the string set 563fe5df1b9SBen Hutchings * @data: Buffer for strings. Each string is null-padded to a size of 564fe5df1b9SBen Hutchings * %ETH_GSTRING_LEN. 565fe5df1b9SBen Hutchings * 566fe5df1b9SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in 567fe5df1b9SBen Hutchings * the string set. They must allocate a buffer of the appropriate 568fe5df1b9SBen Hutchings * size immediately following this structure. 569fe5df1b9SBen Hutchings */ 570607ca46eSDavid Howells struct ethtool_gstrings { 571fe5df1b9SBen Hutchings __u32 cmd; 572fe5df1b9SBen Hutchings __u32 string_set; 573fe5df1b9SBen Hutchings __u32 len; 574607ca46eSDavid Howells __u8 data[0]; 575607ca46eSDavid Howells }; 576607ca46eSDavid Howells 577fe5df1b9SBen Hutchings /** 578fe5df1b9SBen Hutchings * struct ethtool_sset_info - string set information 579fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSSET_INFO 580fe5df1b9SBen Hutchings * @sset_mask: On entry, a bitmask of string sets to query, with bits 581fe5df1b9SBen Hutchings * numbered according to &enum ethtool_stringset. On return, a 582fe5df1b9SBen Hutchings * bitmask of those string sets queried that are supported. 583fe5df1b9SBen Hutchings * @data: Buffer for string set sizes. On return, this contains the 584fe5df1b9SBen Hutchings * size of each string set that was queried and supported, in 585fe5df1b9SBen Hutchings * order of ID. 586fe5df1b9SBen Hutchings * 587fe5df1b9SBen Hutchings * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on 588fe5df1b9SBen Hutchings * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the 589fe5df1b9SBen Hutchings * size of set 1 and @data[1] contains the size of set 2. 590fe5df1b9SBen Hutchings * 591fe5df1b9SBen Hutchings * Users must allocate a buffer of the appropriate size (4 * number of 592fe5df1b9SBen Hutchings * sets queried) immediately following this structure. 593fe5df1b9SBen Hutchings */ 594607ca46eSDavid Howells struct ethtool_sset_info { 595fe5df1b9SBen Hutchings __u32 cmd; 596607ca46eSDavid Howells __u32 reserved; 597fe5df1b9SBen Hutchings __u64 sset_mask; 598fe5df1b9SBen Hutchings __u32 data[0]; 599607ca46eSDavid Howells }; 600607ca46eSDavid Howells 601607ca46eSDavid Howells /** 602607ca46eSDavid Howells * enum ethtool_test_flags - flags definition of ethtool_test 603607ca46eSDavid Howells * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise 604607ca46eSDavid Howells * only online tests. 605607ca46eSDavid Howells * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. 606607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback 607607ca46eSDavid Howells * test. 608607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test 609607ca46eSDavid Howells */ 610607ca46eSDavid Howells 611607ca46eSDavid Howells enum ethtool_test_flags { 612607ca46eSDavid Howells ETH_TEST_FL_OFFLINE = (1 << 0), 613607ca46eSDavid Howells ETH_TEST_FL_FAILED = (1 << 1), 614607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB = (1 << 2), 615607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), 616607ca46eSDavid Howells }; 617607ca46eSDavid Howells 6184e5a62dbSBen Hutchings /** 6194e5a62dbSBen Hutchings * struct ethtool_test - device self-test invocation 6204e5a62dbSBen Hutchings * @cmd: Command number = %ETHTOOL_TEST 6214e5a62dbSBen Hutchings * @flags: A bitmask of flags from &enum ethtool_test_flags. Some 6224e5a62dbSBen Hutchings * flags may be set by the user on entry; others may be set by 6234e5a62dbSBen Hutchings * the driver on return. 6244e5a62dbSBen Hutchings * @len: On return, the number of test results 6254e5a62dbSBen Hutchings * @data: Array of test results 6264e5a62dbSBen Hutchings * 6274e5a62dbSBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the 6284e5a62dbSBen Hutchings * number of test results that will be returned. They must allocate a 6294e5a62dbSBen Hutchings * buffer of the appropriate size (8 * number of results) immediately 6304e5a62dbSBen Hutchings * following this structure. 6314e5a62dbSBen Hutchings */ 632607ca46eSDavid Howells struct ethtool_test { 6334e5a62dbSBen Hutchings __u32 cmd; 6344e5a62dbSBen Hutchings __u32 flags; 635607ca46eSDavid Howells __u32 reserved; 6364e5a62dbSBen Hutchings __u32 len; 637607ca46eSDavid Howells __u64 data[0]; 638607ca46eSDavid Howells }; 639607ca46eSDavid Howells 64059091229SBen Hutchings /** 64159091229SBen Hutchings * struct ethtool_stats - device-specific statistics 64259091229SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTATS 64359091229SBen Hutchings * @n_stats: On return, the number of statistics 64459091229SBen Hutchings * @data: Array of statistics 64559091229SBen Hutchings * 64659091229SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the 64759091229SBen Hutchings * number of statistics that will be returned. They must allocate a 64859091229SBen Hutchings * buffer of the appropriate size (8 * number of statistics) 64959091229SBen Hutchings * immediately following this structure. 65059091229SBen Hutchings */ 651607ca46eSDavid Howells struct ethtool_stats { 65259091229SBen Hutchings __u32 cmd; 65359091229SBen Hutchings __u32 n_stats; 654607ca46eSDavid Howells __u64 data[0]; 655607ca46eSDavid Howells }; 656607ca46eSDavid Howells 657f432c095SBen Hutchings /** 658f432c095SBen Hutchings * struct ethtool_perm_addr - permanent hardware address 659f432c095SBen Hutchings * @cmd: Command number = %ETHTOOL_GPERMADDR 660f432c095SBen Hutchings * @size: On entry, the size of the buffer. On return, the size of the 661f432c095SBen Hutchings * address. The command fails if the buffer is too small. 662f432c095SBen Hutchings * @data: Buffer for the address 663f432c095SBen Hutchings * 664f432c095SBen Hutchings * Users must allocate the buffer immediately following this structure. 665f432c095SBen Hutchings * A buffer size of %MAX_ADDR_LEN should be sufficient for any address 666f432c095SBen Hutchings * type. 667f432c095SBen Hutchings */ 668607ca46eSDavid Howells struct ethtool_perm_addr { 669f432c095SBen Hutchings __u32 cmd; 670607ca46eSDavid Howells __u32 size; 671607ca46eSDavid Howells __u8 data[0]; 672607ca46eSDavid Howells }; 673607ca46eSDavid Howells 674607ca46eSDavid Howells /* boolean flags controlling per-interface behavior characteristics. 675607ca46eSDavid Howells * When reading, the flag indicates whether or not a certain behavior 676607ca46eSDavid Howells * is enabled/present. When writing, the flag indicates whether 677607ca46eSDavid Howells * or not the driver should turn on (set) or off (clear) a behavior. 678607ca46eSDavid Howells * 679607ca46eSDavid Howells * Some behaviors may read-only (unconditionally absent or present). 680607ca46eSDavid Howells * If such is the case, return EINVAL in the set-flags operation if the 681607ca46eSDavid Howells * flag differs from the read-only value. 682607ca46eSDavid Howells */ 683607ca46eSDavid Howells enum ethtool_flags { 684607ca46eSDavid Howells ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ 685607ca46eSDavid Howells ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ 686607ca46eSDavid Howells ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 687607ca46eSDavid Howells ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ 688607ca46eSDavid Howells ETH_FLAG_RXHASH = (1 << 28), 689607ca46eSDavid Howells }; 690607ca46eSDavid Howells 691607ca46eSDavid Howells /* The following structures are for supporting RX network flow 692607ca46eSDavid Howells * classification and RX n-tuple configuration. Note, all multibyte 693607ca46eSDavid Howells * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to 694607ca46eSDavid Howells * be in network byte order. 695607ca46eSDavid Howells */ 696607ca46eSDavid Howells 697607ca46eSDavid Howells /** 698607ca46eSDavid Howells * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. 699607ca46eSDavid Howells * @ip4src: Source host 700607ca46eSDavid Howells * @ip4dst: Destination host 701607ca46eSDavid Howells * @psrc: Source port 702607ca46eSDavid Howells * @pdst: Destination port 703607ca46eSDavid Howells * @tos: Type-of-service 704607ca46eSDavid Howells * 705607ca46eSDavid Howells * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. 706607ca46eSDavid Howells */ 707607ca46eSDavid Howells struct ethtool_tcpip4_spec { 708607ca46eSDavid Howells __be32 ip4src; 709607ca46eSDavid Howells __be32 ip4dst; 710607ca46eSDavid Howells __be16 psrc; 711607ca46eSDavid Howells __be16 pdst; 712607ca46eSDavid Howells __u8 tos; 713607ca46eSDavid Howells }; 714607ca46eSDavid Howells 715607ca46eSDavid Howells /** 716607ca46eSDavid Howells * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 717607ca46eSDavid Howells * @ip4src: Source host 718607ca46eSDavid Howells * @ip4dst: Destination host 719607ca46eSDavid Howells * @spi: Security parameters index 720607ca46eSDavid Howells * @tos: Type-of-service 721607ca46eSDavid Howells * 722607ca46eSDavid Howells * This can be used to specify an IPsec transport or tunnel over IPv4. 723607ca46eSDavid Howells */ 724607ca46eSDavid Howells struct ethtool_ah_espip4_spec { 725607ca46eSDavid Howells __be32 ip4src; 726607ca46eSDavid Howells __be32 ip4dst; 727607ca46eSDavid Howells __be32 spi; 728607ca46eSDavid Howells __u8 tos; 729607ca46eSDavid Howells }; 730607ca46eSDavid Howells 731607ca46eSDavid Howells #define ETH_RX_NFC_IP4 1 732607ca46eSDavid Howells 733607ca46eSDavid Howells /** 734607ca46eSDavid Howells * struct ethtool_usrip4_spec - general flow specification for IPv4 735607ca46eSDavid Howells * @ip4src: Source host 736607ca46eSDavid Howells * @ip4dst: Destination host 737607ca46eSDavid Howells * @l4_4_bytes: First 4 bytes of transport (layer 4) header 738607ca46eSDavid Howells * @tos: Type-of-service 739607ca46eSDavid Howells * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 740607ca46eSDavid Howells * @proto: Transport protocol number; mask must be 0 741607ca46eSDavid Howells */ 742607ca46eSDavid Howells struct ethtool_usrip4_spec { 743607ca46eSDavid Howells __be32 ip4src; 744607ca46eSDavid Howells __be32 ip4dst; 745607ca46eSDavid Howells __be32 l4_4_bytes; 746607ca46eSDavid Howells __u8 tos; 747607ca46eSDavid Howells __u8 ip_ver; 748607ca46eSDavid Howells __u8 proto; 749607ca46eSDavid Howells }; 750607ca46eSDavid Howells 75172bb6872SEdward Cree /** 75272bb6872SEdward Cree * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc. 75372bb6872SEdward Cree * @ip6src: Source host 75472bb6872SEdward Cree * @ip6dst: Destination host 75572bb6872SEdward Cree * @psrc: Source port 75672bb6872SEdward Cree * @pdst: Destination port 75772bb6872SEdward Cree * @tclass: Traffic Class 75872bb6872SEdward Cree * 75972bb6872SEdward Cree * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow. 76072bb6872SEdward Cree */ 76172bb6872SEdward Cree struct ethtool_tcpip6_spec { 76272bb6872SEdward Cree __be32 ip6src[4]; 76372bb6872SEdward Cree __be32 ip6dst[4]; 76472bb6872SEdward Cree __be16 psrc; 76572bb6872SEdward Cree __be16 pdst; 76672bb6872SEdward Cree __u8 tclass; 76772bb6872SEdward Cree }; 76872bb6872SEdward Cree 76972bb6872SEdward Cree /** 77072bb6872SEdward Cree * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6 77172bb6872SEdward Cree * @ip6src: Source host 77272bb6872SEdward Cree * @ip6dst: Destination host 77372bb6872SEdward Cree * @spi: Security parameters index 77472bb6872SEdward Cree * @tclass: Traffic Class 77572bb6872SEdward Cree * 77672bb6872SEdward Cree * This can be used to specify an IPsec transport or tunnel over IPv6. 77772bb6872SEdward Cree */ 77872bb6872SEdward Cree struct ethtool_ah_espip6_spec { 77972bb6872SEdward Cree __be32 ip6src[4]; 78072bb6872SEdward Cree __be32 ip6dst[4]; 78172bb6872SEdward Cree __be32 spi; 78272bb6872SEdward Cree __u8 tclass; 78372bb6872SEdward Cree }; 78472bb6872SEdward Cree 78572bb6872SEdward Cree /** 78672bb6872SEdward Cree * struct ethtool_usrip6_spec - general flow specification for IPv6 78772bb6872SEdward Cree * @ip6src: Source host 78872bb6872SEdward Cree * @ip6dst: Destination host 78972bb6872SEdward Cree * @l4_4_bytes: First 4 bytes of transport (layer 4) header 79072bb6872SEdward Cree * @tclass: Traffic Class 79172bb6872SEdward Cree * @l4_proto: Transport protocol number (nexthdr after any Extension Headers) 79272bb6872SEdward Cree */ 79372bb6872SEdward Cree struct ethtool_usrip6_spec { 79472bb6872SEdward Cree __be32 ip6src[4]; 79572bb6872SEdward Cree __be32 ip6dst[4]; 79672bb6872SEdward Cree __be32 l4_4_bytes; 79772bb6872SEdward Cree __u8 tclass; 79872bb6872SEdward Cree __u8 l4_proto; 79972bb6872SEdward Cree }; 80072bb6872SEdward Cree 801607ca46eSDavid Howells union ethtool_flow_union { 802607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec; 803607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec; 804607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec; 805607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec; 806607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec; 807607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec; 80872bb6872SEdward Cree struct ethtool_tcpip6_spec tcp_ip6_spec; 80972bb6872SEdward Cree struct ethtool_tcpip6_spec udp_ip6_spec; 81072bb6872SEdward Cree struct ethtool_tcpip6_spec sctp_ip6_spec; 81172bb6872SEdward Cree struct ethtool_ah_espip6_spec ah_ip6_spec; 81272bb6872SEdward Cree struct ethtool_ah_espip6_spec esp_ip6_spec; 81372bb6872SEdward Cree struct ethtool_usrip6_spec usr_ip6_spec; 814607ca46eSDavid Howells struct ethhdr ether_spec; 815d4676eacSYan Burman __u8 hdata[52]; 816607ca46eSDavid Howells }; 817607ca46eSDavid Howells 818dc2e5734SYan Burman /** 819dc2e5734SYan Burman * struct ethtool_flow_ext - additional RX flow fields 820dc2e5734SYan Burman * @h_dest: destination MAC address 821dc2e5734SYan Burman * @vlan_etype: VLAN EtherType 822dc2e5734SYan Burman * @vlan_tci: VLAN tag control information 823dc2e5734SYan Burman * @data: user defined data 824dc2e5734SYan Burman * 825dc2e5734SYan Burman * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT 826dc2e5734SYan Burman * is set in &struct ethtool_rx_flow_spec @flow_type. 827dc2e5734SYan Burman * @h_dest is valid if %FLOW_MAC_EXT is set. 828dc2e5734SYan Burman */ 829607ca46eSDavid Howells struct ethtool_flow_ext { 830d4676eacSYan Burman __u8 padding[2]; 831dc2e5734SYan Burman unsigned char h_dest[ETH_ALEN]; 832607ca46eSDavid Howells __be16 vlan_etype; 833607ca46eSDavid Howells __be16 vlan_tci; 834607ca46eSDavid Howells __be32 data[2]; 835607ca46eSDavid Howells }; 836607ca46eSDavid Howells 837607ca46eSDavid Howells /** 838607ca46eSDavid Howells * struct ethtool_rx_flow_spec - classification rule for RX flows 839607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 840607ca46eSDavid Howells * @h_u: Flow fields to match (dependent on @flow_type) 841607ca46eSDavid Howells * @h_ext: Additional fields to match 842607ca46eSDavid Howells * @m_u: Masks for flow field bits to be matched 843607ca46eSDavid Howells * @m_ext: Masks for additional field bits to be matched 844607ca46eSDavid Howells * Note, all additional fields must be ignored unless @flow_type 845dc2e5734SYan Burman * includes the %FLOW_EXT or %FLOW_MAC_EXT flag 846dc2e5734SYan Burman * (see &struct ethtool_flow_ext description). 847607ca46eSDavid Howells * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC 848607ca46eSDavid Howells * if packets should be discarded 849607ca46eSDavid Howells * @location: Location of rule in the table. Locations must be 850607ca46eSDavid Howells * numbered such that a flow matching multiple rules will be 851607ca46eSDavid Howells * classified according to the first (lowest numbered) rule. 852607ca46eSDavid Howells */ 853607ca46eSDavid Howells struct ethtool_rx_flow_spec { 854607ca46eSDavid Howells __u32 flow_type; 855607ca46eSDavid Howells union ethtool_flow_union h_u; 856607ca46eSDavid Howells struct ethtool_flow_ext h_ext; 857607ca46eSDavid Howells union ethtool_flow_union m_u; 858607ca46eSDavid Howells struct ethtool_flow_ext m_ext; 859607ca46eSDavid Howells __u64 ring_cookie; 860607ca46eSDavid Howells __u32 location; 861607ca46eSDavid Howells }; 862607ca46eSDavid Howells 8638cf6f497SJohn Fastabend /* How rings are layed out when accessing virtual functions or 8648cf6f497SJohn Fastabend * offloaded queues is device specific. To allow users to do flow 8658cf6f497SJohn Fastabend * steering and specify these queues the ring cookie is partitioned 8668cf6f497SJohn Fastabend * into a 32bit queue index with an 8 bit virtual function id. 8678cf6f497SJohn Fastabend * This also leaves the 3bytes for further specifiers. It is possible 8688cf6f497SJohn Fastabend * future devices may support more than 256 virtual functions if 8698cf6f497SJohn Fastabend * devices start supporting PCIe w/ARI. However at the moment I 8708cf6f497SJohn Fastabend * do not know of any devices that support this so I do not reserve 8718cf6f497SJohn Fastabend * space for this at this time. If a future patch consumes the next 8728cf6f497SJohn Fastabend * byte it should be aware of this possiblity. 8738cf6f497SJohn Fastabend */ 8748cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL 8758cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL 8768cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 8778cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) 8788cf6f497SJohn Fastabend { 8798cf6f497SJohn Fastabend return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; 8808cf6f497SJohn Fastabend }; 8818cf6f497SJohn Fastabend 8828cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) 8838cf6f497SJohn Fastabend { 8848cf6f497SJohn Fastabend return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> 8858cf6f497SJohn Fastabend ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; 8868cf6f497SJohn Fastabend }; 8878cf6f497SJohn Fastabend 888607ca46eSDavid Howells /** 889607ca46eSDavid Howells * struct ethtool_rxnfc - command to get or set RX flow classification rules 890607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, 891607ca46eSDavid Howells * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, 892607ca46eSDavid Howells * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS 893607ca46eSDavid Howells * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW 894607ca46eSDavid Howells * @data: Command-dependent value 895607ca46eSDavid Howells * @fs: Flow classification rule 896607ca46eSDavid Howells * @rule_cnt: Number of rules to be affected 897607ca46eSDavid Howells * @rule_locs: Array of used rule locations 898607ca46eSDavid Howells * 899607ca46eSDavid Howells * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating 900607ca46eSDavid Howells * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following 901607ca46eSDavid Howells * structure fields must not be used. 902607ca46eSDavid Howells * 903607ca46eSDavid Howells * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues 904607ca46eSDavid Howells * on return. 905607ca46eSDavid Howells * 906607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 907607ca46eSDavid Howells * rules on return. If @data is non-zero on return then it is the 908607ca46eSDavid Howells * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the 909607ca46eSDavid Howells * driver supports any special location values. If that flag is not 910607ca46eSDavid Howells * set in @data then special location values should not be used. 911607ca46eSDavid Howells * 912607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 913607ca46eSDavid Howells * existing rule on entry and @fs contains the rule on return. 914607ca46eSDavid Howells * 915607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the 916607ca46eSDavid Howells * user buffer for @rule_locs on entry. On return, @data is the size 917607ca46eSDavid Howells * of the rule table, @rule_cnt is the number of defined rules, and 918607ca46eSDavid Howells * @rule_locs contains the locations of the defined rules. Drivers 919607ca46eSDavid Howells * must use the second parameter to get_rxnfc() instead of @rule_locs. 920607ca46eSDavid Howells * 921607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 922607ca46eSDavid Howells * @fs.@location either specifies the location to use or is a special 923607ca46eSDavid Howells * location value with %RX_CLS_LOC_SPECIAL flag set. On return, 924607ca46eSDavid Howells * @fs.@location is the actual rule location. 925607ca46eSDavid Howells * 926607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 927607ca46eSDavid Howells * existing rule on entry. 928607ca46eSDavid Howells * 929607ca46eSDavid Howells * A driver supporting the special location values for 930607ca46eSDavid Howells * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused 931607ca46eSDavid Howells * location, and may remove a rule at a later location (lower 932607ca46eSDavid Howells * priority) that matches exactly the same set of flows. The special 933073e3cf2SBen Hutchings * values are %RX_CLS_LOC_ANY, selecting any location; 934607ca46eSDavid Howells * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum 935607ca46eSDavid Howells * priority); and %RX_CLS_LOC_LAST, selecting the last suitable 936607ca46eSDavid Howells * location (minimum priority). Additional special values may be 937607ca46eSDavid Howells * defined in future and drivers must return -%EINVAL for any 938607ca46eSDavid Howells * unrecognised value. 939607ca46eSDavid Howells */ 940607ca46eSDavid Howells struct ethtool_rxnfc { 941607ca46eSDavid Howells __u32 cmd; 942607ca46eSDavid Howells __u32 flow_type; 943607ca46eSDavid Howells __u64 data; 944607ca46eSDavid Howells struct ethtool_rx_flow_spec fs; 945607ca46eSDavid Howells __u32 rule_cnt; 946607ca46eSDavid Howells __u32 rule_locs[0]; 947607ca46eSDavid Howells }; 948607ca46eSDavid Howells 949607ca46eSDavid Howells 950607ca46eSDavid Howells /** 951607ca46eSDavid Howells * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 952607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 953607ca46eSDavid Howells * @size: On entry, the array size of the user buffer, which may be zero. 954607ca46eSDavid Howells * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware 955607ca46eSDavid Howells * indirection table. 956607ca46eSDavid Howells * @ring_index: RX ring/queue index for each hash value 957607ca46eSDavid Howells * 958607ca46eSDavid Howells * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size 959607ca46eSDavid Howells * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means 960607ca46eSDavid Howells * the table should be reset to default values. This last feature 961607ca46eSDavid Howells * is not supported by the original implementations. 962607ca46eSDavid Howells */ 963607ca46eSDavid Howells struct ethtool_rxfh_indir { 964607ca46eSDavid Howells __u32 cmd; 965607ca46eSDavid Howells __u32 size; 966607ca46eSDavid Howells __u32 ring_index[0]; 967607ca46eSDavid Howells }; 968607ca46eSDavid Howells 969607ca46eSDavid Howells /** 9703de0b592SVenkata Duvvuru * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key. 9713de0b592SVenkata Duvvuru * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH 9723de0b592SVenkata Duvvuru * @rss_context: RSS context identifier. 97338c891a4SBen Hutchings * @indir_size: On entry, the array size of the user buffer for the 97438c891a4SBen Hutchings * indirection table, which may be zero, or (for %ETHTOOL_SRSSH), 97538c891a4SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH, 97638c891a4SBen Hutchings * the array size of the hardware indirection table. 97738c891a4SBen Hutchings * @key_size: On entry, the array size of the user buffer for the hash key, 97838c891a4SBen Hutchings * which may be zero. On return from %ETHTOOL_GRSSH, the size of the 97938c891a4SBen Hutchings * hardware hash key. 980892311f6SEyal Perry * @hfunc: Defines the current RSS hash function used by HW (or to be set to). 981892311f6SEyal Perry * Valid values are one of the %ETH_RSS_HASH_*. 9823de0b592SVenkata Duvvuru * @rsvd: Reserved for future extensions. 9833de0b592SVenkata Duvvuru * @rss_config: RX ring/queue index for each hash value i.e., indirection table 98438c891a4SBen Hutchings * of @indir_size __u32 elements, followed by hash key of @key_size 98538c891a4SBen Hutchings * bytes. 9863de0b592SVenkata Duvvuru * 9873de0b592SVenkata Duvvuru * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the 9887455fa24SBen Hutchings * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of 9897455fa24SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested 9907455fa24SBen Hutchings * and a @indir_size of zero means the indir table should be reset to default 991892311f6SEyal Perry * values. An hfunc of zero means that hash function setting is not requested. 9923de0b592SVenkata Duvvuru */ 9933de0b592SVenkata Duvvuru struct ethtool_rxfh { 9943de0b592SVenkata Duvvuru __u32 cmd; 9953de0b592SVenkata Duvvuru __u32 rss_context; 9963de0b592SVenkata Duvvuru __u32 indir_size; 9973de0b592SVenkata Duvvuru __u32 key_size; 998892311f6SEyal Perry __u8 hfunc; 999892311f6SEyal Perry __u8 rsvd8[3]; 1000892311f6SEyal Perry __u32 rsvd32; 10013de0b592SVenkata Duvvuru __u32 rss_config[0]; 10023de0b592SVenkata Duvvuru }; 10037455fa24SBen Hutchings #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff 10043de0b592SVenkata Duvvuru 10053de0b592SVenkata Duvvuru /** 1006607ca46eSDavid Howells * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter 1007607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 1008607ca46eSDavid Howells * @h_u: Flow field values to match (dependent on @flow_type) 1009607ca46eSDavid Howells * @m_u: Masks for flow field value bits to be ignored 1010607ca46eSDavid Howells * @vlan_tag: VLAN tag to match 1011607ca46eSDavid Howells * @vlan_tag_mask: Mask for VLAN tag bits to be ignored 1012607ca46eSDavid Howells * @data: Driver-dependent data to match 1013607ca46eSDavid Howells * @data_mask: Mask for driver-dependent data bits to be ignored 1014607ca46eSDavid Howells * @action: RX ring/queue index to deliver to (non-negative) or other action 1015607ca46eSDavid Howells * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) 1016607ca46eSDavid Howells * 1017607ca46eSDavid Howells * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where 1018607ca46eSDavid Howells * a field value and mask are both zero this is treated as if all mask 1019607ca46eSDavid Howells * bits are set i.e. the field is ignored. 1020607ca46eSDavid Howells */ 1021607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec { 1022607ca46eSDavid Howells __u32 flow_type; 1023607ca46eSDavid Howells union { 1024607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec; 1025607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec; 1026607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec; 1027607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec; 1028607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec; 1029607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec; 1030607ca46eSDavid Howells struct ethhdr ether_spec; 1031607ca46eSDavid Howells __u8 hdata[72]; 1032607ca46eSDavid Howells } h_u, m_u; 1033607ca46eSDavid Howells 1034607ca46eSDavid Howells __u16 vlan_tag; 1035607ca46eSDavid Howells __u16 vlan_tag_mask; 1036607ca46eSDavid Howells __u64 data; 1037607ca46eSDavid Howells __u64 data_mask; 1038607ca46eSDavid Howells 1039607ca46eSDavid Howells __s32 action; 1040607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ 1041607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ 1042607ca46eSDavid Howells }; 1043607ca46eSDavid Howells 1044607ca46eSDavid Howells /** 1045607ca46eSDavid Howells * struct ethtool_rx_ntuple - command to set or clear RX flow filter 1046607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_SRXNTUPLE 1047607ca46eSDavid Howells * @fs: Flow filter specification 1048607ca46eSDavid Howells */ 1049607ca46eSDavid Howells struct ethtool_rx_ntuple { 1050607ca46eSDavid Howells __u32 cmd; 1051607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec fs; 1052607ca46eSDavid Howells }; 1053607ca46eSDavid Howells 1054607ca46eSDavid Howells #define ETHTOOL_FLASH_MAX_FILENAME 128 1055607ca46eSDavid Howells enum ethtool_flash_op_type { 1056607ca46eSDavid Howells ETHTOOL_FLASH_ALL_REGIONS = 0, 1057607ca46eSDavid Howells }; 1058607ca46eSDavid Howells 1059607ca46eSDavid Howells /* for passing firmware flashing related parameters */ 1060607ca46eSDavid Howells struct ethtool_flash { 1061607ca46eSDavid Howells __u32 cmd; 1062607ca46eSDavid Howells __u32 region; 1063607ca46eSDavid Howells char data[ETHTOOL_FLASH_MAX_FILENAME]; 1064607ca46eSDavid Howells }; 1065607ca46eSDavid Howells 1066607ca46eSDavid Howells /** 1067607ca46eSDavid Howells * struct ethtool_dump - used for retrieving, setting device dump 1068607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or 1069607ca46eSDavid Howells * %ETHTOOL_SET_DUMP 1070607ca46eSDavid Howells * @version: FW version of the dump, filled in by driver 1071607ca46eSDavid Howells * @flag: driver dependent flag for dump setting, filled in by driver during 1072607ca46eSDavid Howells * get and filled in by ethtool for set operation. 1073607ca46eSDavid Howells * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when 1074607ca46eSDavid Howells * firmware dump is disabled. 1075607ca46eSDavid Howells * @len: length of dump data, used as the length of the user buffer on entry to 1076607ca46eSDavid Howells * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver 1077607ca46eSDavid Howells * for %ETHTOOL_GET_DUMP_FLAG command 1078607ca46eSDavid Howells * @data: data collected for get dump data operation 1079607ca46eSDavid Howells */ 1080607ca46eSDavid Howells struct ethtool_dump { 1081607ca46eSDavid Howells __u32 cmd; 1082607ca46eSDavid Howells __u32 version; 1083607ca46eSDavid Howells __u32 flag; 1084607ca46eSDavid Howells __u32 len; 1085607ca46eSDavid Howells __u8 data[0]; 1086607ca46eSDavid Howells }; 1087607ca46eSDavid Howells 1088ba569dc3SBen Hutchings #define ETH_FW_DUMP_DISABLE 0 1089ba569dc3SBen Hutchings 1090607ca46eSDavid Howells /* for returning and changing feature sets */ 1091607ca46eSDavid Howells 1092607ca46eSDavid Howells /** 1093607ca46eSDavid Howells * struct ethtool_get_features_block - block with state of 32 features 1094607ca46eSDavid Howells * @available: mask of changeable features 1095607ca46eSDavid Howells * @requested: mask of features requested to be enabled if possible 1096607ca46eSDavid Howells * @active: mask of currently enabled features 1097607ca46eSDavid Howells * @never_changed: mask of features not changeable for any device 1098607ca46eSDavid Howells */ 1099607ca46eSDavid Howells struct ethtool_get_features_block { 1100607ca46eSDavid Howells __u32 available; 1101607ca46eSDavid Howells __u32 requested; 1102607ca46eSDavid Howells __u32 active; 1103607ca46eSDavid Howells __u32 never_changed; 1104607ca46eSDavid Howells }; 1105607ca46eSDavid Howells 1106607ca46eSDavid Howells /** 1107607ca46eSDavid Howells * struct ethtool_gfeatures - command to get state of device's features 1108607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GFEATURES 1109073e3cf2SBen Hutchings * @size: On entry, the number of elements in the features[] array; 1110073e3cf2SBen Hutchings * on return, the number of elements in features[] needed to hold 1111073e3cf2SBen Hutchings * all features 1112607ca46eSDavid Howells * @features: state of features 1113607ca46eSDavid Howells */ 1114607ca46eSDavid Howells struct ethtool_gfeatures { 1115607ca46eSDavid Howells __u32 cmd; 1116607ca46eSDavid Howells __u32 size; 1117607ca46eSDavid Howells struct ethtool_get_features_block features[0]; 1118607ca46eSDavid Howells }; 1119607ca46eSDavid Howells 1120607ca46eSDavid Howells /** 1121607ca46eSDavid Howells * struct ethtool_set_features_block - block with request for 32 features 1122607ca46eSDavid Howells * @valid: mask of features to be changed 1123607ca46eSDavid Howells * @requested: values of features to be changed 1124607ca46eSDavid Howells */ 1125607ca46eSDavid Howells struct ethtool_set_features_block { 1126607ca46eSDavid Howells __u32 valid; 1127607ca46eSDavid Howells __u32 requested; 1128607ca46eSDavid Howells }; 1129607ca46eSDavid Howells 1130607ca46eSDavid Howells /** 1131607ca46eSDavid Howells * struct ethtool_sfeatures - command to request change in device's features 1132607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_SFEATURES 1133607ca46eSDavid Howells * @size: array size of the features[] array 1134607ca46eSDavid Howells * @features: feature change masks 1135607ca46eSDavid Howells */ 1136607ca46eSDavid Howells struct ethtool_sfeatures { 1137607ca46eSDavid Howells __u32 cmd; 1138607ca46eSDavid Howells __u32 size; 1139607ca46eSDavid Howells struct ethtool_set_features_block features[0]; 1140607ca46eSDavid Howells }; 1141607ca46eSDavid Howells 1142607ca46eSDavid Howells /** 1143607ca46eSDavid Howells * struct ethtool_ts_info - holds a device's timestamping and PHC association 1144607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GET_TS_INFO 1145607ca46eSDavid Howells * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags 1146607ca46eSDavid Howells * @phc_index: device index of the associated PHC, or -1 if there is none 1147607ca46eSDavid Howells * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values 1148607ca46eSDavid Howells * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values 1149607ca46eSDavid Howells * 1150607ca46eSDavid Howells * The bits in the 'tx_types' and 'rx_filters' fields correspond to 1151607ca46eSDavid Howells * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, 1152607ca46eSDavid Howells * respectively. For example, if the device supports HWTSTAMP_TX_ON, 1153607ca46eSDavid Howells * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set. 1154eff3cddcSJacob Keller * 1155eff3cddcSJacob Keller * Drivers should only report the filters they actually support without 1156eff3cddcSJacob Keller * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for 1157eff3cddcSJacob Keller * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the 1158eff3cddcSJacob Keller * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op. 1159607ca46eSDavid Howells */ 1160607ca46eSDavid Howells struct ethtool_ts_info { 1161607ca46eSDavid Howells __u32 cmd; 1162607ca46eSDavid Howells __u32 so_timestamping; 1163607ca46eSDavid Howells __s32 phc_index; 1164607ca46eSDavid Howells __u32 tx_types; 1165607ca46eSDavid Howells __u32 tx_reserved[3]; 1166607ca46eSDavid Howells __u32 rx_filters; 1167607ca46eSDavid Howells __u32 rx_reserved[3]; 1168607ca46eSDavid Howells }; 1169607ca46eSDavid Howells 1170607ca46eSDavid Howells /* 1171607ca46eSDavid Howells * %ETHTOOL_SFEATURES changes features present in features[].valid to the 1172607ca46eSDavid Howells * values of corresponding bits in features[].requested. Bits in .requested 1173607ca46eSDavid Howells * not set in .valid or not changeable are ignored. 1174607ca46eSDavid Howells * 1175607ca46eSDavid Howells * Returns %EINVAL when .valid contains undefined or never-changeable bits 1176607ca46eSDavid Howells * or size is not equal to required number of features words (32-bit blocks). 1177607ca46eSDavid Howells * Returns >= 0 if request was completed; bits set in the value mean: 1178607ca46eSDavid Howells * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not 1179607ca46eSDavid Howells * changeable (not present in %ETHTOOL_GFEATURES' features[].available) 1180607ca46eSDavid Howells * those bits were ignored. 1181607ca46eSDavid Howells * %ETHTOOL_F_WISH - some or all changes requested were recorded but the 1182607ca46eSDavid Howells * resulting state of bits masked by .valid is not equal to .requested. 1183607ca46eSDavid Howells * Probably there are other device-specific constraints on some features 1184607ca46eSDavid Howells * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered 1185607ca46eSDavid Howells * here as though ignored bits were cleared. 1186607ca46eSDavid Howells * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling 1187607ca46eSDavid Howells * compatibility functions. Requested offload state cannot be properly 1188607ca46eSDavid Howells * managed by kernel. 1189607ca46eSDavid Howells * 1190607ca46eSDavid Howells * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of 1191607ca46eSDavid Howells * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands 1192607ca46eSDavid Howells * for ETH_SS_FEATURES string set. First entry in the table corresponds to least 1193607ca46eSDavid Howells * significant bit in features[0] fields. Empty strings mark undefined features. 1194607ca46eSDavid Howells */ 1195607ca46eSDavid Howells enum ethtool_sfeatures_retval_bits { 1196607ca46eSDavid Howells ETHTOOL_F_UNSUPPORTED__BIT, 1197607ca46eSDavid Howells ETHTOOL_F_WISH__BIT, 1198607ca46eSDavid Howells ETHTOOL_F_COMPAT__BIT, 1199607ca46eSDavid Howells }; 1200607ca46eSDavid Howells 1201607ca46eSDavid Howells #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) 1202607ca46eSDavid Howells #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) 1203607ca46eSDavid Howells #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) 1204607ca46eSDavid Howells 1205607ca46eSDavid Howells 1206607ca46eSDavid Howells /* CMDs currently supported */ 1207607ca46eSDavid Howells #define ETHTOOL_GSET 0x00000001 /* Get settings. */ 1208607ca46eSDavid Howells #define ETHTOOL_SSET 0x00000002 /* Set settings. */ 1209607ca46eSDavid Howells #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 1210607ca46eSDavid Howells #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 1211607ca46eSDavid Howells #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 1212607ca46eSDavid Howells #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 1213607ca46eSDavid Howells #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 1214607ca46eSDavid Howells #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 1215607ca46eSDavid Howells #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 1216607ca46eSDavid Howells /* Get link status for host, i.e. whether the interface *and* the 1217607ca46eSDavid Howells * physical port (if there is one) are up (ethtool_value). */ 1218607ca46eSDavid Howells #define ETHTOOL_GLINK 0x0000000a 1219607ca46eSDavid Howells #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 1220607ca46eSDavid Howells #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 1221607ca46eSDavid Howells #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 1222607ca46eSDavid Howells #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 1223607ca46eSDavid Howells #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 1224607ca46eSDavid Howells #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 1225607ca46eSDavid Howells #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 1226607ca46eSDavid Howells #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 1227607ca46eSDavid Howells #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 1228607ca46eSDavid Howells #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 1229607ca46eSDavid Howells #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 1230607ca46eSDavid Howells #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 1231607ca46eSDavid Howells #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 1232607ca46eSDavid Howells * (ethtool_value) */ 1233607ca46eSDavid Howells #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 1234607ca46eSDavid Howells * (ethtool_value). */ 1235607ca46eSDavid Howells #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 1236607ca46eSDavid Howells #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 1237607ca46eSDavid Howells #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 1238607ca46eSDavid Howells #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 1239607ca46eSDavid Howells #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 1240607ca46eSDavid Howells #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 1241607ca46eSDavid Howells #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ 1242607ca46eSDavid Howells #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ 1243607ca46eSDavid Howells #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 1244607ca46eSDavid Howells #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ 1245607ca46eSDavid Howells #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 1246607ca46eSDavid Howells #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 1247607ca46eSDavid Howells #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 1248607ca46eSDavid Howells #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 1249607ca46eSDavid Howells #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 1250607ca46eSDavid Howells 1251607ca46eSDavid Howells #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 1252607ca46eSDavid Howells #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 1253607ca46eSDavid Howells #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 1254607ca46eSDavid Howells #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 1255607ca46eSDavid Howells #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 1256607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 1257607ca46eSDavid Howells #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 1258607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 1259607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 1260607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 1261607ca46eSDavid Howells #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 1262607ca46eSDavid Howells #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 1263607ca46eSDavid Howells #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 1264607ca46eSDavid Howells #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */ 1265607ca46eSDavid Howells #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 1266607ca46eSDavid Howells #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 1267607ca46eSDavid Howells #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 1268607ca46eSDavid Howells 1269607ca46eSDavid Howells #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ 1270607ca46eSDavid Howells #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ 1271607ca46eSDavid Howells #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */ 1272607ca46eSDavid Howells #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */ 1273607ca46eSDavid Howells #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1274607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1275607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1276607ca46eSDavid Howells #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */ 1277607ca46eSDavid Howells #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */ 1278607ca46eSDavid Howells #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */ 1279607ca46eSDavid Howells #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ 1280607ca46eSDavid Howells #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ 1281607ca46eSDavid Howells 12823de0b592SVenkata Duvvuru #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */ 12833de0b592SVenkata Duvvuru #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ 1284f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */ 1285f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ 1286f3a40945SAndrew Lunn #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ 12873de0b592SVenkata Duvvuru 1288607ca46eSDavid Howells /* compatibility with older code */ 1289607ca46eSDavid Howells #define SPARC_ETH_GSET ETHTOOL_GSET 1290607ca46eSDavid Howells #define SPARC_ETH_SSET ETHTOOL_SSET 1291607ca46eSDavid Howells 1292607ca46eSDavid Howells #define SUPPORTED_10baseT_Half (1 << 0) 1293607ca46eSDavid Howells #define SUPPORTED_10baseT_Full (1 << 1) 1294607ca46eSDavid Howells #define SUPPORTED_100baseT_Half (1 << 2) 1295607ca46eSDavid Howells #define SUPPORTED_100baseT_Full (1 << 3) 1296607ca46eSDavid Howells #define SUPPORTED_1000baseT_Half (1 << 4) 1297607ca46eSDavid Howells #define SUPPORTED_1000baseT_Full (1 << 5) 1298607ca46eSDavid Howells #define SUPPORTED_Autoneg (1 << 6) 1299607ca46eSDavid Howells #define SUPPORTED_TP (1 << 7) 1300607ca46eSDavid Howells #define SUPPORTED_AUI (1 << 8) 1301607ca46eSDavid Howells #define SUPPORTED_MII (1 << 9) 1302607ca46eSDavid Howells #define SUPPORTED_FIBRE (1 << 10) 1303607ca46eSDavid Howells #define SUPPORTED_BNC (1 << 11) 1304607ca46eSDavid Howells #define SUPPORTED_10000baseT_Full (1 << 12) 1305607ca46eSDavid Howells #define SUPPORTED_Pause (1 << 13) 1306607ca46eSDavid Howells #define SUPPORTED_Asym_Pause (1 << 14) 1307607ca46eSDavid Howells #define SUPPORTED_2500baseX_Full (1 << 15) 1308607ca46eSDavid Howells #define SUPPORTED_Backplane (1 << 16) 1309607ca46eSDavid Howells #define SUPPORTED_1000baseKX_Full (1 << 17) 1310607ca46eSDavid Howells #define SUPPORTED_10000baseKX4_Full (1 << 18) 1311607ca46eSDavid Howells #define SUPPORTED_10000baseKR_Full (1 << 19) 1312607ca46eSDavid Howells #define SUPPORTED_10000baseR_FEC (1 << 20) 1313607ca46eSDavid Howells #define SUPPORTED_20000baseMLD2_Full (1 << 21) 1314607ca46eSDavid Howells #define SUPPORTED_20000baseKR2_Full (1 << 22) 1315607ca46eSDavid Howells #define SUPPORTED_40000baseKR4_Full (1 << 23) 1316607ca46eSDavid Howells #define SUPPORTED_40000baseCR4_Full (1 << 24) 1317607ca46eSDavid Howells #define SUPPORTED_40000baseSR4_Full (1 << 25) 1318607ca46eSDavid Howells #define SUPPORTED_40000baseLR4_Full (1 << 26) 1319dcf972a3SSaeed Mahameed #define SUPPORTED_56000baseKR4_Full (1 << 27) 1320dcf972a3SSaeed Mahameed #define SUPPORTED_56000baseCR4_Full (1 << 28) 1321dcf972a3SSaeed Mahameed #define SUPPORTED_56000baseSR4_Full (1 << 29) 1322dcf972a3SSaeed Mahameed #define SUPPORTED_56000baseLR4_Full (1 << 30) 1323607ca46eSDavid Howells 1324607ca46eSDavid Howells #define ADVERTISED_10baseT_Half (1 << 0) 1325607ca46eSDavid Howells #define ADVERTISED_10baseT_Full (1 << 1) 1326607ca46eSDavid Howells #define ADVERTISED_100baseT_Half (1 << 2) 1327607ca46eSDavid Howells #define ADVERTISED_100baseT_Full (1 << 3) 1328607ca46eSDavid Howells #define ADVERTISED_1000baseT_Half (1 << 4) 1329607ca46eSDavid Howells #define ADVERTISED_1000baseT_Full (1 << 5) 1330607ca46eSDavid Howells #define ADVERTISED_Autoneg (1 << 6) 1331607ca46eSDavid Howells #define ADVERTISED_TP (1 << 7) 1332607ca46eSDavid Howells #define ADVERTISED_AUI (1 << 8) 1333607ca46eSDavid Howells #define ADVERTISED_MII (1 << 9) 1334607ca46eSDavid Howells #define ADVERTISED_FIBRE (1 << 10) 1335607ca46eSDavid Howells #define ADVERTISED_BNC (1 << 11) 1336607ca46eSDavid Howells #define ADVERTISED_10000baseT_Full (1 << 12) 1337607ca46eSDavid Howells #define ADVERTISED_Pause (1 << 13) 1338607ca46eSDavid Howells #define ADVERTISED_Asym_Pause (1 << 14) 1339607ca46eSDavid Howells #define ADVERTISED_2500baseX_Full (1 << 15) 1340607ca46eSDavid Howells #define ADVERTISED_Backplane (1 << 16) 1341607ca46eSDavid Howells #define ADVERTISED_1000baseKX_Full (1 << 17) 1342607ca46eSDavid Howells #define ADVERTISED_10000baseKX4_Full (1 << 18) 1343607ca46eSDavid Howells #define ADVERTISED_10000baseKR_Full (1 << 19) 1344607ca46eSDavid Howells #define ADVERTISED_10000baseR_FEC (1 << 20) 1345607ca46eSDavid Howells #define ADVERTISED_20000baseMLD2_Full (1 << 21) 1346607ca46eSDavid Howells #define ADVERTISED_20000baseKR2_Full (1 << 22) 1347607ca46eSDavid Howells #define ADVERTISED_40000baseKR4_Full (1 << 23) 1348607ca46eSDavid Howells #define ADVERTISED_40000baseCR4_Full (1 << 24) 1349607ca46eSDavid Howells #define ADVERTISED_40000baseSR4_Full (1 << 25) 1350607ca46eSDavid Howells #define ADVERTISED_40000baseLR4_Full (1 << 26) 1351dcf972a3SSaeed Mahameed #define ADVERTISED_56000baseKR4_Full (1 << 27) 1352dcf972a3SSaeed Mahameed #define ADVERTISED_56000baseCR4_Full (1 << 28) 1353dcf972a3SSaeed Mahameed #define ADVERTISED_56000baseSR4_Full (1 << 29) 1354dcf972a3SSaeed Mahameed #define ADVERTISED_56000baseLR4_Full (1 << 30) 1355607ca46eSDavid Howells 1356607ca46eSDavid Howells /* The following are all involved in forcing a particular link 1357607ca46eSDavid Howells * mode for the device for setting things. When getting the 1358607ca46eSDavid Howells * devices settings, these indicate the current mode and whether 1359607ca46eSDavid Howells * it was forced up into this mode or autonegotiated. 1360607ca46eSDavid Howells */ 1361607ca46eSDavid Howells 13624456ed04SMichael S. Tsirkin /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */ 1363607ca46eSDavid Howells #define SPEED_10 10 1364607ca46eSDavid Howells #define SPEED_100 100 1365607ca46eSDavid Howells #define SPEED_1000 1000 1366607ca46eSDavid Howells #define SPEED_2500 2500 1367c9a70d43SParav Pandit #define SPEED_5000 5000 1368607ca46eSDavid Howells #define SPEED_10000 10000 1369dcf972a3SSaeed Mahameed #define SPEED_20000 20000 1370c9a70d43SParav Pandit #define SPEED_25000 25000 1371dcf972a3SSaeed Mahameed #define SPEED_40000 40000 1372c9a70d43SParav Pandit #define SPEED_50000 50000 1373dcf972a3SSaeed Mahameed #define SPEED_56000 56000 1374c9a70d43SParav Pandit #define SPEED_100000 100000 1375dcf972a3SSaeed Mahameed 1376607ca46eSDavid Howells #define SPEED_UNKNOWN -1 1377607ca46eSDavid Howells 1378103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_speed(__u32 speed) 1379103a8ad1SNikolay Aleksandrov { 1380*e02564eeSNikolay Aleksandrov return speed <= INT_MAX || speed == SPEED_UNKNOWN; 1381103a8ad1SNikolay Aleksandrov } 1382103a8ad1SNikolay Aleksandrov 1383607ca46eSDavid Howells /* Duplex, half or full. */ 1384607ca46eSDavid Howells #define DUPLEX_HALF 0x00 1385607ca46eSDavid Howells #define DUPLEX_FULL 0x01 1386607ca46eSDavid Howells #define DUPLEX_UNKNOWN 0xff 1387607ca46eSDavid Howells 1388103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_duplex(__u8 duplex) 1389103a8ad1SNikolay Aleksandrov { 1390103a8ad1SNikolay Aleksandrov switch (duplex) { 1391103a8ad1SNikolay Aleksandrov case DUPLEX_HALF: 1392103a8ad1SNikolay Aleksandrov case DUPLEX_FULL: 1393103a8ad1SNikolay Aleksandrov case DUPLEX_UNKNOWN: 1394103a8ad1SNikolay Aleksandrov return 1; 1395103a8ad1SNikolay Aleksandrov } 1396103a8ad1SNikolay Aleksandrov 1397103a8ad1SNikolay Aleksandrov return 0; 1398103a8ad1SNikolay Aleksandrov } 1399103a8ad1SNikolay Aleksandrov 1400607ca46eSDavid Howells /* Which connector port. */ 1401607ca46eSDavid Howells #define PORT_TP 0x00 1402607ca46eSDavid Howells #define PORT_AUI 0x01 1403607ca46eSDavid Howells #define PORT_MII 0x02 1404607ca46eSDavid Howells #define PORT_FIBRE 0x03 1405607ca46eSDavid Howells #define PORT_BNC 0x04 1406607ca46eSDavid Howells #define PORT_DA 0x05 1407607ca46eSDavid Howells #define PORT_NONE 0xef 1408607ca46eSDavid Howells #define PORT_OTHER 0xff 1409607ca46eSDavid Howells 1410607ca46eSDavid Howells /* Which transceiver to use. */ 14117ec87211SFlorian Fainelli #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */ 14127ec87211SFlorian Fainelli #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */ 1413607ca46eSDavid Howells #define XCVR_DUMMY1 0x02 1414607ca46eSDavid Howells #define XCVR_DUMMY2 0x03 1415607ca46eSDavid Howells #define XCVR_DUMMY3 0x04 1416607ca46eSDavid Howells 1417bf8fc60aSBen Hutchings /* Enable or disable autonegotiation. */ 1418607ca46eSDavid Howells #define AUTONEG_DISABLE 0x00 1419607ca46eSDavid Howells #define AUTONEG_ENABLE 0x01 1420607ca46eSDavid Howells 1421607ca46eSDavid Howells /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then 1422607ca46eSDavid Howells * the driver is required to renegotiate link 1423607ca46eSDavid Howells */ 1424607ca46eSDavid Howells #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */ 1425607ca46eSDavid Howells #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */ 1426607ca46eSDavid Howells #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */ 1427607ca46eSDavid Howells #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */ 1428607ca46eSDavid Howells 1429607ca46eSDavid Howells /* Wake-On-Lan options. */ 1430607ca46eSDavid Howells #define WAKE_PHY (1 << 0) 1431607ca46eSDavid Howells #define WAKE_UCAST (1 << 1) 1432607ca46eSDavid Howells #define WAKE_MCAST (1 << 2) 1433607ca46eSDavid Howells #define WAKE_BCAST (1 << 3) 1434607ca46eSDavid Howells #define WAKE_ARP (1 << 4) 1435607ca46eSDavid Howells #define WAKE_MAGIC (1 << 5) 1436607ca46eSDavid Howells #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ 1437607ca46eSDavid Howells 1438607ca46eSDavid Howells /* L2-L4 network traffic flow types */ 1439607ca46eSDavid Howells #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ 1440607ca46eSDavid Howells #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ 1441607ca46eSDavid Howells #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ 1442607ca46eSDavid Howells #define AH_ESP_V4_FLOW 0x04 /* hash only */ 144372bb6872SEdward Cree #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */ 144472bb6872SEdward Cree #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */ 144572bb6872SEdward Cree #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */ 1446607ca46eSDavid Howells #define AH_ESP_V6_FLOW 0x08 /* hash only */ 1447607ca46eSDavid Howells #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ 1448607ca46eSDavid Howells #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ 144972bb6872SEdward Cree #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */ 145072bb6872SEdward Cree #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */ 145172bb6872SEdward Cree #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ 145272bb6872SEdward Cree #define IP_USER_FLOW IPV4_USER_FLOW 145372bb6872SEdward Cree #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */ 1454607ca46eSDavid Howells #define IPV4_FLOW 0x10 /* hash only */ 1455607ca46eSDavid Howells #define IPV6_FLOW 0x11 /* hash only */ 1456607ca46eSDavid Howells #define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 1457607ca46eSDavid Howells /* Flag to enable additional fields in struct ethtool_rx_flow_spec */ 1458607ca46eSDavid Howells #define FLOW_EXT 0x80000000 1459d4676eacSYan Burman #define FLOW_MAC_EXT 0x40000000 1460607ca46eSDavid Howells 1461607ca46eSDavid Howells /* L3-L4 network traffic flow hash options */ 1462607ca46eSDavid Howells #define RXH_L2DA (1 << 1) 1463607ca46eSDavid Howells #define RXH_VLAN (1 << 2) 1464607ca46eSDavid Howells #define RXH_L3_PROTO (1 << 3) 1465607ca46eSDavid Howells #define RXH_IP_SRC (1 << 4) 1466607ca46eSDavid Howells #define RXH_IP_DST (1 << 5) 1467607ca46eSDavid Howells #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ 1468607ca46eSDavid Howells #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ 1469607ca46eSDavid Howells #define RXH_DISCARD (1 << 31) 1470607ca46eSDavid Howells 1471607ca46eSDavid Howells #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 1472607ca46eSDavid Howells 1473607ca46eSDavid Howells /* Special RX classification rule insert location values */ 1474607ca46eSDavid Howells #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */ 1475607ca46eSDavid Howells #define RX_CLS_LOC_ANY 0xffffffff 1476607ca46eSDavid Howells #define RX_CLS_LOC_FIRST 0xfffffffe 1477607ca46eSDavid Howells #define RX_CLS_LOC_LAST 0xfffffffd 1478607ca46eSDavid Howells 1479607ca46eSDavid Howells /* EEPROM Standards for plug in modules */ 1480607ca46eSDavid Howells #define ETH_MODULE_SFF_8079 0x1 1481607ca46eSDavid Howells #define ETH_MODULE_SFF_8079_LEN 256 1482607ca46eSDavid Howells #define ETH_MODULE_SFF_8472 0x2 1483607ca46eSDavid Howells #define ETH_MODULE_SFF_8472_LEN 512 14847202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636 0x3 14857202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636_LEN 256 14867202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436 0x4 14877202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436_LEN 256 1488607ca46eSDavid Howells 1489607ca46eSDavid Howells /* Reset flags */ 1490607ca46eSDavid Howells /* The reset() operation must clear the flags for the components which 1491607ca46eSDavid Howells * were actually reset. On successful return, the flags indicate the 1492607ca46eSDavid Howells * components which were not reset, either because they do not exist 1493607ca46eSDavid Howells * in the hardware or because they cannot be reset independently. The 1494607ca46eSDavid Howells * driver must never reset any components that were not requested. 1495607ca46eSDavid Howells */ 1496607ca46eSDavid Howells enum ethtool_reset_flags { 1497607ca46eSDavid Howells /* These flags represent components dedicated to the interface 1498607ca46eSDavid Howells * the command is addressed to. Shift any flag left by 1499607ca46eSDavid Howells * ETH_RESET_SHARED_SHIFT to reset a shared component of the 1500607ca46eSDavid Howells * same type. 1501607ca46eSDavid Howells */ 1502607ca46eSDavid Howells ETH_RESET_MGMT = 1 << 0, /* Management processor */ 1503607ca46eSDavid Howells ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ 1504607ca46eSDavid Howells ETH_RESET_DMA = 1 << 2, /* DMA engine */ 1505607ca46eSDavid Howells ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ 1506607ca46eSDavid Howells ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ 1507607ca46eSDavid Howells ETH_RESET_MAC = 1 << 5, /* Media access controller */ 1508607ca46eSDavid Howells ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ 1509607ca46eSDavid Howells ETH_RESET_RAM = 1 << 7, /* RAM shared between 1510607ca46eSDavid Howells * multiple components */ 1511607ca46eSDavid Howells 1512607ca46eSDavid Howells ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to 1513607ca46eSDavid Howells * this interface */ 1514607ca46eSDavid Howells ETH_RESET_ALL = 0xffffffff, /* All components used by this 1515607ca46eSDavid Howells * interface, even if shared */ 1516607ca46eSDavid Howells }; 1517607ca46eSDavid Howells #define ETH_RESET_SHARED_SHIFT 16 1518607ca46eSDavid Howells 1519607ca46eSDavid Howells #endif /* _UAPI_LINUX_ETHTOOL_H */ 1520