16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * ethtool.h: Defines for Linux ethtool. 4607ca46eSDavid Howells * 5607ca46eSDavid Howells * Copyright (C) 1998 David S. Miller ([email protected]) 6607ca46eSDavid Howells * Copyright 2001 Jeff Garzik <[email protected]> 7607ca46eSDavid Howells * Portions Copyright 2001 Sun Microsystems ([email protected]) 8607ca46eSDavid Howells * Portions Copyright 2002 Intel ([email protected], 9607ca46eSDavid Howells * [email protected], 10607ca46eSDavid Howells * [email protected]) 11607ca46eSDavid Howells * Portions Copyright (C) Sun Microsystems 2008 12607ca46eSDavid Howells */ 13607ca46eSDavid Howells 14607ca46eSDavid Howells #ifndef _UAPI_LINUX_ETHTOOL_H 15607ca46eSDavid Howells #define _UAPI_LINUX_ETHTOOL_H 16607ca46eSDavid Howells 17a85cbe61SPetr Vorel #include <linux/const.h> 18607ca46eSDavid Howells #include <linux/types.h> 19607ca46eSDavid Howells #include <linux/if_ether.h> 20607ca46eSDavid Howells 2114e20379SNicolas Dichtel #ifndef __KERNEL__ 2214e20379SNicolas Dichtel #include <limits.h> /* for INT_MAX */ 2314e20379SNicolas Dichtel #endif 2414e20379SNicolas Dichtel 25bf8fc60aSBen Hutchings /* All structures exposed to userland should be defined such that they 26bf8fc60aSBen Hutchings * have the same layout for 32-bit and 64-bit userland. 27bf8fc60aSBen Hutchings */ 28bf8fc60aSBen Hutchings 2983e5feebSJakub Kicinski /* Note on reserved space. 3083e5feebSJakub Kicinski * Reserved fields must not be accessed directly by user space because 3183e5feebSJakub Kicinski * they may be replaced by a different field in the future. They must 3283e5feebSJakub Kicinski * be initialized to zero before making the request, e.g. via memset 3383e5feebSJakub Kicinski * of the entire structure or implicitly by not being set in a structure 3483e5feebSJakub Kicinski * initializer. 3583e5feebSJakub Kicinski */ 3683e5feebSJakub Kicinski 37bf8fc60aSBen Hutchings /** 383f1ac7a7SDavid Decotigny * struct ethtool_cmd - DEPRECATED, link control and status 393f1ac7a7SDavid Decotigny * This structure is DEPRECATED, please use struct ethtool_link_settings. 40bf8fc60aSBen Hutchings * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET 41bf8fc60aSBen Hutchings * @supported: Bitmask of %SUPPORTED_* flags for the link modes, 42bf8fc60aSBen Hutchings * physical connectors and other link features for which the 43bf8fc60aSBen Hutchings * interface supports autonegotiation or auto-detection. 44bf8fc60aSBen Hutchings * Read-only. 45bf8fc60aSBen Hutchings * @advertising: Bitmask of %ADVERTISED_* flags for the link modes, 46bf8fc60aSBen Hutchings * physical connectors and other link features that are 47bf8fc60aSBen Hutchings * advertised through autonegotiation or enabled for 48bf8fc60aSBen Hutchings * auto-detection. 494456ed04SMichael S. Tsirkin * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN 50bf8fc60aSBen Hutchings * @duplex: Duplex mode; one of %DUPLEX_* 51bf8fc60aSBen Hutchings * @port: Physical connector type; one of %PORT_* 52bf8fc60aSBen Hutchings * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not 53bf8fc60aSBen Hutchings * applicable. For clause 45 PHYs this is the PRTAD. 54bf8fc60aSBen Hutchings * @transceiver: Historically used to distinguish different possible 55bf8fc60aSBen Hutchings * PHY types, but not in a consistent way. Deprecated. 56bf8fc60aSBen Hutchings * @autoneg: Enable/disable autonegotiation and auto-detection; 57bf8fc60aSBen Hutchings * either %AUTONEG_DISABLE or %AUTONEG_ENABLE 58bf8fc60aSBen Hutchings * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO 59bf8fc60aSBen Hutchings * protocols supported by the interface; 0 if unknown. 60bf8fc60aSBen Hutchings * Read-only. 61bf8fc60aSBen Hutchings * @maxtxpkt: Historically used to report TX IRQ coalescing; now 62bf8fc60aSBen Hutchings * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 63bf8fc60aSBen Hutchings * @maxrxpkt: Historically used to report RX IRQ coalescing; now 64bf8fc60aSBen Hutchings * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 654456ed04SMichael S. Tsirkin * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN 66bf8fc60aSBen Hutchings * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of 67bf8fc60aSBen Hutchings * %ETH_TP_MDI_*. If the status is unknown or not applicable, the 68bf8fc60aSBen Hutchings * value will be %ETH_TP_MDI_INVALID. Read-only. 69bf8fc60aSBen Hutchings * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of 70bf8fc60aSBen Hutchings * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads 71bf8fc60aSBen Hutchings * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. 72bf8fc60aSBen Hutchings * When written successfully, the link should be renegotiated if 73bf8fc60aSBen Hutchings * necessary. 74bf8fc60aSBen Hutchings * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes 75bf8fc60aSBen Hutchings * and other link features that the link partner advertised 76bf8fc60aSBen Hutchings * through autonegotiation; 0 if unknown or not applicable. 77bf8fc60aSBen Hutchings * Read-only. 7883e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 79bf8fc60aSBen Hutchings * 80bf8fc60aSBen Hutchings * The link speed in Mbps is split between @speed and @speed_hi. Use 81bf8fc60aSBen Hutchings * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to 82bf8fc60aSBen Hutchings * access it. 83bf8fc60aSBen Hutchings * 84bf8fc60aSBen Hutchings * If autonegotiation is disabled, the speed and @duplex represent the 85bf8fc60aSBen Hutchings * fixed link mode and are writable if the driver supports multiple 86bf8fc60aSBen Hutchings * link modes. If it is enabled then they are read-only; if the link 87bf8fc60aSBen Hutchings * is up they represent the negotiated link mode; if the link is down, 88bf8fc60aSBen Hutchings * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and 89bf8fc60aSBen Hutchings * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. 90bf8fc60aSBen Hutchings * 91bf8fc60aSBen Hutchings * Some hardware interfaces may have multiple PHYs and/or physical 92bf8fc60aSBen Hutchings * connectors fitted or do not allow the driver to detect which are 93bf8fc60aSBen Hutchings * fitted. For these interfaces @port and/or @phy_address may be 94bf8fc60aSBen Hutchings * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. 95bf8fc60aSBen Hutchings * Otherwise, attempts to write different values may be ignored or 96bf8fc60aSBen Hutchings * rejected. 97bf8fc60aSBen Hutchings * 98bf8fc60aSBen Hutchings * Users should assume that all fields not marked read-only are 99bf8fc60aSBen Hutchings * writable and subject to validation by the driver. They should use 100bf8fc60aSBen Hutchings * %ETHTOOL_GSET to get the current values before making specific 101bf8fc60aSBen Hutchings * changes and then applying them with %ETHTOOL_SSET. 102bf8fc60aSBen Hutchings * 103bf8fc60aSBen Hutchings * Deprecated fields should be ignored by both users and drivers. 104bf8fc60aSBen Hutchings */ 105607ca46eSDavid Howells struct ethtool_cmd { 106607ca46eSDavid Howells __u32 cmd; 107bf8fc60aSBen Hutchings __u32 supported; 108bf8fc60aSBen Hutchings __u32 advertising; 109bf8fc60aSBen Hutchings __u16 speed; 110bf8fc60aSBen Hutchings __u8 duplex; 111bf8fc60aSBen Hutchings __u8 port; 112bf8fc60aSBen Hutchings __u8 phy_address; 113bf8fc60aSBen Hutchings __u8 transceiver; 114bf8fc60aSBen Hutchings __u8 autoneg; 115bf8fc60aSBen Hutchings __u8 mdio_support; 116bf8fc60aSBen Hutchings __u32 maxtxpkt; 117bf8fc60aSBen Hutchings __u32 maxrxpkt; 118bf8fc60aSBen Hutchings __u16 speed_hi; 119bf8fc60aSBen Hutchings __u8 eth_tp_mdix; 120bf8fc60aSBen Hutchings __u8 eth_tp_mdix_ctrl; 121bf8fc60aSBen Hutchings __u32 lp_advertising; 122607ca46eSDavid Howells __u32 reserved[2]; 123607ca46eSDavid Howells }; 124607ca46eSDavid Howells 125607ca46eSDavid Howells static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 126607ca46eSDavid Howells __u32 speed) 127607ca46eSDavid Howells { 12885a62440SJesse Brandeburg ep->speed = (__u16)(speed & 0xFFFF); 129607ca46eSDavid Howells ep->speed_hi = (__u16)(speed >> 16); 130607ca46eSDavid Howells } 131607ca46eSDavid Howells 132607ca46eSDavid Howells static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) 133607ca46eSDavid Howells { 134607ca46eSDavid Howells return (ep->speed_hi << 16) | ep->speed; 135607ca46eSDavid Howells } 136607ca46eSDavid Howells 137607ca46eSDavid Howells /* Device supports clause 22 register access to PHY or peripherals 138607ca46eSDavid Howells * using the interface defined in <linux/mii.h>. This should not be 139607ca46eSDavid Howells * set if there are known to be no such peripherals present or if 140607ca46eSDavid Howells * the driver only emulates clause 22 registers for compatibility. 141607ca46eSDavid Howells */ 142607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C22 1 143607ca46eSDavid Howells 144607ca46eSDavid Howells /* Device supports clause 45 register access to PHY or peripherals 145607ca46eSDavid Howells * using the interface defined in <linux/mii.h> and <linux/mdio.h>. 146607ca46eSDavid Howells * This should not be set if there are known to be no such peripherals 147607ca46eSDavid Howells * present. 148607ca46eSDavid Howells */ 149607ca46eSDavid Howells #define ETH_MDIO_SUPPORTS_C45 2 150607ca46eSDavid Howells 151607ca46eSDavid Howells #define ETHTOOL_FWVERS_LEN 32 152607ca46eSDavid Howells #define ETHTOOL_BUSINFO_LEN 32 153a4505152SHariprasad Shenai #define ETHTOOL_EROMVERS_LEN 32 154daba1b6bSBen Hutchings 155daba1b6bSBen Hutchings /** 156daba1b6bSBen Hutchings * struct ethtool_drvinfo - general driver and device information 157daba1b6bSBen Hutchings * @cmd: Command number = %ETHTOOL_GDRVINFO 158daba1b6bSBen Hutchings * @driver: Driver short name. This should normally match the name 159daba1b6bSBen Hutchings * in its bus driver structure (e.g. pci_driver::name). Must 160daba1b6bSBen Hutchings * not be an empty string. 161daba1b6bSBen Hutchings * @version: Driver version string; may be an empty string 162daba1b6bSBen Hutchings * @fw_version: Firmware version string; may be an empty string 163a4505152SHariprasad Shenai * @erom_version: Expansion ROM version string; may be an empty string 164daba1b6bSBen Hutchings * @bus_info: Device bus address. This should match the dev_name() 165daba1b6bSBen Hutchings * string for the underlying bus device, if there is one. May be 166daba1b6bSBen Hutchings * an empty string. 16783e5feebSJakub Kicinski * @reserved2: Reserved for future use; see the note on reserved space. 168daba1b6bSBen Hutchings * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and 169daba1b6bSBen Hutchings * %ETHTOOL_SPFLAGS commands; also the number of strings in the 170daba1b6bSBen Hutchings * %ETH_SS_PRIV_FLAGS set 171daba1b6bSBen Hutchings * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS 172daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_STATS set 173daba1b6bSBen Hutchings * @testinfo_len: Number of results returned by the %ETHTOOL_TEST 174daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_TEST set 175daba1b6bSBen Hutchings * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM 176daba1b6bSBen Hutchings * and %ETHTOOL_SEEPROM commands, in bytes 177daba1b6bSBen Hutchings * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS 178daba1b6bSBen Hutchings * command, in bytes 179daba1b6bSBen Hutchings * 180daba1b6bSBen Hutchings * Users can use the %ETHTOOL_GSSET_INFO command to get the number of 181daba1b6bSBen Hutchings * strings in any string set (from Linux 2.6.34). 182daba1b6bSBen Hutchings * 183daba1b6bSBen Hutchings * Drivers should set at most @driver, @version, @fw_version and 184daba1b6bSBen Hutchings * @bus_info in their get_drvinfo() implementation. The ethtool 185daba1b6bSBen Hutchings * core fills in the other fields using other driver operations. 186daba1b6bSBen Hutchings */ 187607ca46eSDavid Howells struct ethtool_drvinfo { 188607ca46eSDavid Howells __u32 cmd; 189daba1b6bSBen Hutchings char driver[32]; 190daba1b6bSBen Hutchings char version[32]; 191daba1b6bSBen Hutchings char fw_version[ETHTOOL_FWVERS_LEN]; 192daba1b6bSBen Hutchings char bus_info[ETHTOOL_BUSINFO_LEN]; 193a4505152SHariprasad Shenai char erom_version[ETHTOOL_EROMVERS_LEN]; 194607ca46eSDavid Howells char reserved2[12]; 195daba1b6bSBen Hutchings __u32 n_priv_flags; 196daba1b6bSBen Hutchings __u32 n_stats; 197607ca46eSDavid Howells __u32 testinfo_len; 198daba1b6bSBen Hutchings __u32 eedump_len; 199daba1b6bSBen Hutchings __u32 regdump_len; 200607ca46eSDavid Howells }; 201607ca46eSDavid Howells 202607ca46eSDavid Howells #define SOPASS_MAX 6 20302d59f3fSBen Hutchings 20402d59f3fSBen Hutchings /** 20502d59f3fSBen Hutchings * struct ethtool_wolinfo - Wake-On-Lan configuration 20602d59f3fSBen Hutchings * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL 20702d59f3fSBen Hutchings * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes. 20802d59f3fSBen Hutchings * Read-only. 20902d59f3fSBen Hutchings * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes. 21002d59f3fSBen Hutchings * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE 21102d59f3fSBen Hutchings * is set in @wolopts. 21202d59f3fSBen Hutchings */ 213607ca46eSDavid Howells struct ethtool_wolinfo { 214607ca46eSDavid Howells __u32 cmd; 215607ca46eSDavid Howells __u32 supported; 216607ca46eSDavid Howells __u32 wolopts; 21702d59f3fSBen Hutchings __u8 sopass[SOPASS_MAX]; 218607ca46eSDavid Howells }; 219607ca46eSDavid Howells 220607ca46eSDavid Howells /* for passing single values */ 221607ca46eSDavid Howells struct ethtool_value { 222607ca46eSDavid Howells __u32 cmd; 223607ca46eSDavid Howells __u32 data; 224607ca46eSDavid Howells }; 225607ca46eSDavid Howells 226e1577c1cSInbar Karmy #define PFC_STORM_PREVENTION_AUTO 0xffff 227e1577c1cSInbar Karmy #define PFC_STORM_PREVENTION_DISABLE 0 228e1577c1cSInbar Karmy 229f0db9b07SGovindarajulu Varadarajan enum tunable_id { 230f0db9b07SGovindarajulu Varadarajan ETHTOOL_ID_UNSPEC, 231f0db9b07SGovindarajulu Varadarajan ETHTOOL_RX_COPYBREAK, 2321255a505SEric Dumazet ETHTOOL_TX_COPYBREAK, 233e1577c1cSInbar Karmy ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ 234a4244b0cSHadar Hen Zion /* 235c3086637SMichael Heimpold * Add your fresh new tunable attribute above and remember to update 2362d8ea148SJian Shen * tunable_strings[] in net/ethtool/common.c 237a4244b0cSHadar Hen Zion */ 238a4244b0cSHadar Hen Zion __ETHTOOL_TUNABLE_COUNT, 239f0db9b07SGovindarajulu Varadarajan }; 240f0db9b07SGovindarajulu Varadarajan 241f0db9b07SGovindarajulu Varadarajan enum tunable_type_id { 242f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_UNSPEC, 243f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U8, 244f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U16, 245f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U32, 246f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U64, 247f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_STRING, 248f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S8, 249f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S16, 250f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S32, 251f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S64, 252f0db9b07SGovindarajulu Varadarajan }; 253f0db9b07SGovindarajulu Varadarajan 254f0db9b07SGovindarajulu Varadarajan struct ethtool_tunable { 255f0db9b07SGovindarajulu Varadarajan __u32 cmd; 256f0db9b07SGovindarajulu Varadarajan __u32 id; 257f0db9b07SGovindarajulu Varadarajan __u32 type_id; 258f0db9b07SGovindarajulu Varadarajan __u32 len; 259f0db9b07SGovindarajulu Varadarajan void *data[0]; 260f0db9b07SGovindarajulu Varadarajan }; 261f0db9b07SGovindarajulu Varadarajan 262607c7029SRaju Lakkaraju #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff 263607c7029SRaju Lakkaraju #define DOWNSHIFT_DEV_DISABLE 0 264607c7029SRaju Lakkaraju 2653aeb0803SHeiner Kallweit /* Time in msecs after which link is reported as down 2663aeb0803SHeiner Kallweit * 0 = lowest time supported by the PHY 2673aeb0803SHeiner Kallweit * 0xff = off, link down detection according to standard 2683aeb0803SHeiner Kallweit */ 2693aeb0803SHeiner Kallweit #define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0 2703aeb0803SHeiner Kallweit #define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff 2713aeb0803SHeiner Kallweit 2729f2f13f4SAlexandru Ardelean /* Energy Detect Power Down (EDPD) is a feature supported by some PHYs, where 2739f2f13f4SAlexandru Ardelean * the PHY's RX & TX blocks are put into a low-power mode when there is no 2749f2f13f4SAlexandru Ardelean * link detected (typically cable is un-plugged). For RX, only a minimal 2759f2f13f4SAlexandru Ardelean * link-detection is available, and for TX the PHY wakes up to send link pulses 2769f2f13f4SAlexandru Ardelean * to avoid any lock-ups in case the peer PHY may also be running in EDPD mode. 2779f2f13f4SAlexandru Ardelean * 2789f2f13f4SAlexandru Ardelean * Some PHYs may support configuration of the wake-up interval for TX pulses, 2799f2f13f4SAlexandru Ardelean * and some PHYs may support only disabling TX pulses entirely. For the latter 2809f2f13f4SAlexandru Ardelean * a special value is required (ETHTOOL_PHY_EDPD_NO_TX) so that this can be 2819f2f13f4SAlexandru Ardelean * configured from userspace (should the user want it). 2829f2f13f4SAlexandru Ardelean * 2839f2f13f4SAlexandru Ardelean * The interval units for TX wake-up are in milliseconds, since this should 2849f2f13f4SAlexandru Ardelean * cover a reasonable range of intervals: 2859f2f13f4SAlexandru Ardelean * - from 1 millisecond, which does not sound like much of a power-saver 2869f2f13f4SAlexandru Ardelean * - to ~65 seconds which is quite a lot to wait for a link to come up when 2879f2f13f4SAlexandru Ardelean * plugging a cable 2889f2f13f4SAlexandru Ardelean */ 2899f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_DFLT_TX_MSECS 0xffff 2909f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_NO_TX 0xfffe 2919f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_DISABLE 0 2929f2f13f4SAlexandru Ardelean 2930d27f4e4SRaju Lakkaraju enum phy_tunable_id { 2940d27f4e4SRaju Lakkaraju ETHTOOL_PHY_ID_UNSPEC, 295607c7029SRaju Lakkaraju ETHTOOL_PHY_DOWNSHIFT, 2963aeb0803SHeiner Kallweit ETHTOOL_PHY_FAST_LINK_DOWN, 2979f2f13f4SAlexandru Ardelean ETHTOOL_PHY_EDPD, 2980d27f4e4SRaju Lakkaraju /* 2990d27f4e4SRaju Lakkaraju * Add your fresh new phy tunable attribute above and remember to update 3002d8ea148SJian Shen * phy_tunable_strings[] in net/ethtool/common.c 3010d27f4e4SRaju Lakkaraju */ 3020d27f4e4SRaju Lakkaraju __ETHTOOL_PHY_TUNABLE_COUNT, 3030d27f4e4SRaju Lakkaraju }; 3040d27f4e4SRaju Lakkaraju 30509fb8bb0SBen Hutchings /** 30609fb8bb0SBen Hutchings * struct ethtool_regs - hardware register dump 30709fb8bb0SBen Hutchings * @cmd: Command number = %ETHTOOL_GREGS 30809fb8bb0SBen Hutchings * @version: Dump format version. This is driver-specific and may 30909fb8bb0SBen Hutchings * distinguish different chips/revisions. Drivers must use new 31009fb8bb0SBen Hutchings * version numbers whenever the dump format changes in an 31109fb8bb0SBen Hutchings * incompatible way. 31209fb8bb0SBen Hutchings * @len: On entry, the real length of @data. On return, the number of 31309fb8bb0SBen Hutchings * bytes used. 31409fb8bb0SBen Hutchings * @data: Buffer for the register dump 31509fb8bb0SBen Hutchings * 31609fb8bb0SBen Hutchings * Users should use %ETHTOOL_GDRVINFO to find the maximum length of 31709fb8bb0SBen Hutchings * a register dump for the interface. They must allocate the buffer 31809fb8bb0SBen Hutchings * immediately following this structure. 31909fb8bb0SBen Hutchings */ 320607ca46eSDavid Howells struct ethtool_regs { 321607ca46eSDavid Howells __u32 cmd; 32209fb8bb0SBen Hutchings __u32 version; 32309fb8bb0SBen Hutchings __u32 len; 324607ca46eSDavid Howells __u8 data[0]; 325607ca46eSDavid Howells }; 326607ca46eSDavid Howells 327c8364a63SBen Hutchings /** 328c8364a63SBen Hutchings * struct ethtool_eeprom - EEPROM dump 329c8364a63SBen Hutchings * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or 330c8364a63SBen Hutchings * %ETHTOOL_SEEPROM 331c8364a63SBen Hutchings * @magic: A 'magic cookie' value to guard against accidental changes. 332c8364a63SBen Hutchings * The value passed in to %ETHTOOL_SEEPROM must match the value 333c8364a63SBen Hutchings * returned by %ETHTOOL_GEEPROM for the same device. This is 334c8364a63SBen Hutchings * unused when @cmd is %ETHTOOL_GMODULEEEPROM. 335c8364a63SBen Hutchings * @offset: Offset within the EEPROM to begin reading/writing, in bytes 336c8364a63SBen Hutchings * @len: On entry, number of bytes to read/write. On successful 337c8364a63SBen Hutchings * return, number of bytes actually read/written. In case of 338c8364a63SBen Hutchings * error, this may indicate at what point the error occurred. 339c8364a63SBen Hutchings * @data: Buffer to read/write from 340c8364a63SBen Hutchings * 341c8364a63SBen Hutchings * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find 342c8364a63SBen Hutchings * the length of an on-board or module EEPROM, respectively. They 343c8364a63SBen Hutchings * must allocate the buffer immediately following this structure. 344c8364a63SBen Hutchings */ 345607ca46eSDavid Howells struct ethtool_eeprom { 346607ca46eSDavid Howells __u32 cmd; 347607ca46eSDavid Howells __u32 magic; 348c8364a63SBen Hutchings __u32 offset; 349c8364a63SBen Hutchings __u32 len; 350607ca46eSDavid Howells __u8 data[0]; 351607ca46eSDavid Howells }; 352607ca46eSDavid Howells 353607ca46eSDavid Howells /** 354607ca46eSDavid Howells * struct ethtool_eee - Energy Efficient Ethernet information 355607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}EEE 356607ca46eSDavid Howells * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations 357607ca46eSDavid Howells * for which there is EEE support. 358607ca46eSDavid Howells * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations 359607ca46eSDavid Howells * advertised as eee capable. 360607ca46eSDavid Howells * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex 361607ca46eSDavid Howells * combinations advertised by the link partner as eee capable. 362607ca46eSDavid Howells * @eee_active: Result of the eee auto negotiation. 363607ca46eSDavid Howells * @eee_enabled: EEE configured mode (enabled/disabled). 364607ca46eSDavid Howells * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given 365607ca46eSDavid Howells * that eee was negotiated. 366607ca46eSDavid Howells * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting 367607ca46eSDavid Howells * its tx lpi (after reaching 'idle' state). Effective only when eee 368607ca46eSDavid Howells * was negotiated and tx_lpi_enabled was set. 36983e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 370607ca46eSDavid Howells */ 371607ca46eSDavid Howells struct ethtool_eee { 372607ca46eSDavid Howells __u32 cmd; 373607ca46eSDavid Howells __u32 supported; 374607ca46eSDavid Howells __u32 advertised; 375607ca46eSDavid Howells __u32 lp_advertised; 376607ca46eSDavid Howells __u32 eee_active; 377607ca46eSDavid Howells __u32 eee_enabled; 378607ca46eSDavid Howells __u32 tx_lpi_enabled; 379607ca46eSDavid Howells __u32 tx_lpi_timer; 380607ca46eSDavid Howells __u32 reserved[2]; 381607ca46eSDavid Howells }; 382607ca46eSDavid Howells 383607ca46eSDavid Howells /** 384607ca46eSDavid Howells * struct ethtool_modinfo - plugin module eeprom information 385607ca46eSDavid Howells * @cmd: %ETHTOOL_GMODULEINFO 386607ca46eSDavid Howells * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx 387607ca46eSDavid Howells * @eeprom_len: Length of the eeprom 38883e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 389607ca46eSDavid Howells * 390607ca46eSDavid Howells * This structure is used to return the information to 391607ca46eSDavid Howells * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. 392607ca46eSDavid Howells * The type code indicates the eeprom data format 393607ca46eSDavid Howells */ 394607ca46eSDavid Howells struct ethtool_modinfo { 395607ca46eSDavid Howells __u32 cmd; 396607ca46eSDavid Howells __u32 type; 397607ca46eSDavid Howells __u32 eeprom_len; 398607ca46eSDavid Howells __u32 reserved[8]; 399607ca46eSDavid Howells }; 400607ca46eSDavid Howells 401607ca46eSDavid Howells /** 402607ca46eSDavid Howells * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates 403607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}COALESCE 404607ca46eSDavid Howells * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after 405607ca46eSDavid Howells * a packet arrives. 406607ca46eSDavid Howells * @rx_max_coalesced_frames: Maximum number of packets to receive 407607ca46eSDavid Howells * before an RX interrupt. 408607ca46eSDavid Howells * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that 409607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host. 410607ca46eSDavid Howells * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, 411607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced 412607ca46eSDavid Howells * by the host. 413607ca46eSDavid Howells * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after 414607ca46eSDavid Howells * a packet is sent. 415607ca46eSDavid Howells * @tx_max_coalesced_frames: Maximum number of packets to be sent 416607ca46eSDavid Howells * before a TX interrupt. 417607ca46eSDavid Howells * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that 418607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host. 419607ca46eSDavid Howells * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, 420607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced 421607ca46eSDavid Howells * by the host. 422607ca46eSDavid Howells * @stats_block_coalesce_usecs: How many usecs to delay in-memory 423607ca46eSDavid Howells * statistics block updates. Some drivers do not have an 424607ca46eSDavid Howells * in-memory statistic block, and in such cases this value is 425607ca46eSDavid Howells * ignored. This value must not be zero. 426607ca46eSDavid Howells * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. 427607ca46eSDavid Howells * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. 428607ca46eSDavid Howells * @pkt_rate_low: Threshold for low packet rate (packets per second). 429607ca46eSDavid Howells * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after 430607ca46eSDavid Howells * a packet arrives, when the packet rate is below @pkt_rate_low. 431607ca46eSDavid Howells * @rx_max_coalesced_frames_low: Maximum number of packets to be received 432607ca46eSDavid Howells * before an RX interrupt, when the packet rate is below @pkt_rate_low. 433607ca46eSDavid Howells * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after 434607ca46eSDavid Howells * a packet is sent, when the packet rate is below @pkt_rate_low. 435607ca46eSDavid Howells * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before 436607ca46eSDavid Howells * a TX interrupt, when the packet rate is below @pkt_rate_low. 437607ca46eSDavid Howells * @pkt_rate_high: Threshold for high packet rate (packets per second). 438607ca46eSDavid Howells * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after 439607ca46eSDavid Howells * a packet arrives, when the packet rate is above @pkt_rate_high. 440607ca46eSDavid Howells * @rx_max_coalesced_frames_high: Maximum number of packets to be received 441607ca46eSDavid Howells * before an RX interrupt, when the packet rate is above @pkt_rate_high. 442607ca46eSDavid Howells * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after 443607ca46eSDavid Howells * a packet is sent, when the packet rate is above @pkt_rate_high. 444607ca46eSDavid Howells * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before 445607ca46eSDavid Howells * a TX interrupt, when the packet rate is above @pkt_rate_high. 446607ca46eSDavid Howells * @rate_sample_interval: How often to do adaptive coalescing packet rate 447607ca46eSDavid Howells * sampling, measured in seconds. Must not be zero. 448607ca46eSDavid Howells * 449073e3cf2SBen Hutchings * Each pair of (usecs, max_frames) fields specifies that interrupts 450073e3cf2SBen Hutchings * should be coalesced until 451607ca46eSDavid Howells * (usecs > 0 && time_since_first_completion >= usecs) || 452607ca46eSDavid Howells * (max_frames > 0 && completed_frames >= max_frames) 453073e3cf2SBen Hutchings * 454607ca46eSDavid Howells * It is illegal to set both usecs and max_frames to zero as this 455607ca46eSDavid Howells * would cause interrupts to never be generated. To disable 456607ca46eSDavid Howells * coalescing, set usecs = 0 and max_frames = 1. 457607ca46eSDavid Howells * 458607ca46eSDavid Howells * Some implementations ignore the value of max_frames and use the 459073e3cf2SBen Hutchings * condition time_since_first_completion >= usecs 460073e3cf2SBen Hutchings * 461607ca46eSDavid Howells * This is deprecated. Drivers for hardware that does not support 462607ca46eSDavid Howells * counting completions should validate that max_frames == !rx_usecs. 463607ca46eSDavid Howells * 464607ca46eSDavid Howells * Adaptive RX/TX coalescing is an algorithm implemented by some 465607ca46eSDavid Howells * drivers to improve latency under low packet rates and improve 466607ca46eSDavid Howells * throughput under high packet rates. Some drivers only implement 467607ca46eSDavid Howells * one of RX or TX adaptive coalescing. Anything not implemented by 468607ca46eSDavid Howells * the driver causes these values to be silently ignored. 469607ca46eSDavid Howells * 470607ca46eSDavid Howells * When the packet rate is below @pkt_rate_high but above 471607ca46eSDavid Howells * @pkt_rate_low (both measured in packets per second) the 472607ca46eSDavid Howells * normal {rx,tx}_* coalescing parameters are used. 473607ca46eSDavid Howells */ 474607ca46eSDavid Howells struct ethtool_coalesce { 475607ca46eSDavid Howells __u32 cmd; 476607ca46eSDavid Howells __u32 rx_coalesce_usecs; 477607ca46eSDavid Howells __u32 rx_max_coalesced_frames; 478607ca46eSDavid Howells __u32 rx_coalesce_usecs_irq; 479607ca46eSDavid Howells __u32 rx_max_coalesced_frames_irq; 480607ca46eSDavid Howells __u32 tx_coalesce_usecs; 481607ca46eSDavid Howells __u32 tx_max_coalesced_frames; 482607ca46eSDavid Howells __u32 tx_coalesce_usecs_irq; 483607ca46eSDavid Howells __u32 tx_max_coalesced_frames_irq; 484607ca46eSDavid Howells __u32 stats_block_coalesce_usecs; 485607ca46eSDavid Howells __u32 use_adaptive_rx_coalesce; 486607ca46eSDavid Howells __u32 use_adaptive_tx_coalesce; 487607ca46eSDavid Howells __u32 pkt_rate_low; 488607ca46eSDavid Howells __u32 rx_coalesce_usecs_low; 489607ca46eSDavid Howells __u32 rx_max_coalesced_frames_low; 490607ca46eSDavid Howells __u32 tx_coalesce_usecs_low; 491607ca46eSDavid Howells __u32 tx_max_coalesced_frames_low; 492607ca46eSDavid Howells __u32 pkt_rate_high; 493607ca46eSDavid Howells __u32 rx_coalesce_usecs_high; 494607ca46eSDavid Howells __u32 rx_max_coalesced_frames_high; 495607ca46eSDavid Howells __u32 tx_coalesce_usecs_high; 496607ca46eSDavid Howells __u32 tx_max_coalesced_frames_high; 497607ca46eSDavid Howells __u32 rate_sample_interval; 498607ca46eSDavid Howells }; 499607ca46eSDavid Howells 500af440a8aSBen Hutchings /** 501af440a8aSBen Hutchings * struct ethtool_ringparam - RX/TX ring parameters 502af440a8aSBen Hutchings * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM 503af440a8aSBen Hutchings * @rx_max_pending: Maximum supported number of pending entries per 504af440a8aSBen Hutchings * RX ring. Read-only. 505af440a8aSBen Hutchings * @rx_mini_max_pending: Maximum supported number of pending entries 506af440a8aSBen Hutchings * per RX mini ring. Read-only. 507af440a8aSBen Hutchings * @rx_jumbo_max_pending: Maximum supported number of pending entries 508af440a8aSBen Hutchings * per RX jumbo ring. Read-only. 509af440a8aSBen Hutchings * @tx_max_pending: Maximum supported number of pending entries per 510af440a8aSBen Hutchings * TX ring. Read-only. 511af440a8aSBen Hutchings * @rx_pending: Current maximum number of pending entries per RX ring 512af440a8aSBen Hutchings * @rx_mini_pending: Current maximum number of pending entries per RX 513af440a8aSBen Hutchings * mini ring 514af440a8aSBen Hutchings * @rx_jumbo_pending: Current maximum number of pending entries per RX 515af440a8aSBen Hutchings * jumbo ring 516af440a8aSBen Hutchings * @tx_pending: Current maximum supported number of pending entries 517af440a8aSBen Hutchings * per TX ring 518af440a8aSBen Hutchings * 519af440a8aSBen Hutchings * If the interface does not have separate RX mini and/or jumbo rings, 520af440a8aSBen Hutchings * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0. 521af440a8aSBen Hutchings * 522af440a8aSBen Hutchings * There may also be driver-dependent minimum values for the number 523af440a8aSBen Hutchings * of entries per ring. 524607ca46eSDavid Howells */ 525af440a8aSBen Hutchings struct ethtool_ringparam { 526af440a8aSBen Hutchings __u32 cmd; 527607ca46eSDavid Howells __u32 rx_max_pending; 528607ca46eSDavid Howells __u32 rx_mini_max_pending; 529607ca46eSDavid Howells __u32 rx_jumbo_max_pending; 530607ca46eSDavid Howells __u32 tx_max_pending; 531607ca46eSDavid Howells __u32 rx_pending; 532607ca46eSDavid Howells __u32 rx_mini_pending; 533607ca46eSDavid Howells __u32 rx_jumbo_pending; 534607ca46eSDavid Howells __u32 tx_pending; 535607ca46eSDavid Howells }; 536607ca46eSDavid Howells 537607ca46eSDavid Howells /** 538607ca46eSDavid Howells * struct ethtool_channels - configuring number of network channel 539607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}CHANNELS 540607ca46eSDavid Howells * @max_rx: Read only. Maximum number of receive channel the driver support. 541607ca46eSDavid Howells * @max_tx: Read only. Maximum number of transmit channel the driver support. 542607ca46eSDavid Howells * @max_other: Read only. Maximum number of other channel the driver support. 543607ca46eSDavid Howells * @max_combined: Read only. Maximum number of combined channel the driver 544607ca46eSDavid Howells * support. Set of queues RX, TX or other. 545607ca46eSDavid Howells * @rx_count: Valid values are in the range 1 to the max_rx. 546607ca46eSDavid Howells * @tx_count: Valid values are in the range 1 to the max_tx. 547607ca46eSDavid Howells * @other_count: Valid values are in the range 1 to the max_other. 548607ca46eSDavid Howells * @combined_count: Valid values are in the range 1 to the max_combined. 549607ca46eSDavid Howells * 550607ca46eSDavid Howells * This can be used to configure RX, TX and other channels. 551607ca46eSDavid Howells */ 552607ca46eSDavid Howells 553607ca46eSDavid Howells struct ethtool_channels { 554607ca46eSDavid Howells __u32 cmd; 555607ca46eSDavid Howells __u32 max_rx; 556607ca46eSDavid Howells __u32 max_tx; 557607ca46eSDavid Howells __u32 max_other; 558607ca46eSDavid Howells __u32 max_combined; 559607ca46eSDavid Howells __u32 rx_count; 560607ca46eSDavid Howells __u32 tx_count; 561607ca46eSDavid Howells __u32 other_count; 562607ca46eSDavid Howells __u32 combined_count; 563607ca46eSDavid Howells }; 564607ca46eSDavid Howells 5656a7a1081SBen Hutchings /** 5666a7a1081SBen Hutchings * struct ethtool_pauseparam - Ethernet pause (flow control) parameters 5676a7a1081SBen Hutchings * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM 5686a7a1081SBen Hutchings * @autoneg: Flag to enable autonegotiation of pause frame use 5696a7a1081SBen Hutchings * @rx_pause: Flag to enable reception of pause frames 5706a7a1081SBen Hutchings * @tx_pause: Flag to enable transmission of pause frames 571607ca46eSDavid Howells * 5726a7a1081SBen Hutchings * Drivers should reject a non-zero setting of @autoneg when 5736a7a1081SBen Hutchings * autoneogotiation is disabled (or not supported) for the link. 5746a7a1081SBen Hutchings * 5756a7a1081SBen Hutchings * If the link is autonegotiated, drivers should use 5766a7a1081SBen Hutchings * mii_advertise_flowctrl() or similar code to set the advertised 5776a7a1081SBen Hutchings * pause frame capabilities based on the @rx_pause and @tx_pause flags, 5786a7a1081SBen Hutchings * even if @autoneg is zero. They should also allow the advertised 5796a7a1081SBen Hutchings * pause frame capabilities to be controlled directly through the 5806a7a1081SBen Hutchings * advertising field of &struct ethtool_cmd. 5816a7a1081SBen Hutchings * 5826a7a1081SBen Hutchings * If @autoneg is non-zero, the MAC is configured to send and/or 5836a7a1081SBen Hutchings * receive pause frames according to the result of autonegotiation. 5846a7a1081SBen Hutchings * Otherwise, it is configured directly based on the @rx_pause and 5856a7a1081SBen Hutchings * @tx_pause flags. 586607ca46eSDavid Howells */ 5876a7a1081SBen Hutchings struct ethtool_pauseparam { 5886a7a1081SBen Hutchings __u32 cmd; 589607ca46eSDavid Howells __u32 autoneg; 590607ca46eSDavid Howells __u32 rx_pause; 591607ca46eSDavid Howells __u32 tx_pause; 592607ca46eSDavid Howells }; 593607ca46eSDavid Howells 594f0ebc2b6SJakub Kicinski /* Link extended state */ 595ecc31c60SAmit Cohen enum ethtool_link_ext_state { 596ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_AUTONEG, 597ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE, 598ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH, 599ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY, 600ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_NO_CABLE, 601ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE, 602ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE, 603ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE, 604ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED, 605ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_OVERHEAT, 606ecc31c60SAmit Cohen }; 607ecc31c60SAmit Cohen 608f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */ 609ecc31c60SAmit Cohen enum ethtool_link_ext_substate_autoneg { 610ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1, 611ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED, 612ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED, 613ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE, 614ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE, 615ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD, 616ecc31c60SAmit Cohen }; 617ecc31c60SAmit Cohen 618f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE. 619ecc31c60SAmit Cohen */ 620ecc31c60SAmit Cohen enum ethtool_link_ext_substate_link_training { 621ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1, 622ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT, 623ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY, 624ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT, 625ecc31c60SAmit Cohen }; 626ecc31c60SAmit Cohen 627f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH. 628ecc31c60SAmit Cohen */ 629ecc31c60SAmit Cohen enum ethtool_link_ext_substate_link_logical_mismatch { 630ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1, 631ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK, 632ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS, 633ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED, 634ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED, 635ecc31c60SAmit Cohen }; 636ecc31c60SAmit Cohen 637f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY. 638ecc31c60SAmit Cohen */ 639ecc31c60SAmit Cohen enum ethtool_link_ext_substate_bad_signal_integrity { 640ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1, 641ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE, 642*5b4ecc3dSGuangbin Huang ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_REFERENCE_CLOCK_LOST, 643*5b4ecc3dSGuangbin Huang ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_ALOS, 644ecc31c60SAmit Cohen }; 645ecc31c60SAmit Cohen 646f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */ 647ecc31c60SAmit Cohen enum ethtool_link_ext_substate_cable_issue { 648ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1, 649ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE, 650ecc31c60SAmit Cohen }; 651ecc31c60SAmit Cohen 652607ca46eSDavid Howells #define ETH_GSTRING_LEN 32 653fe5df1b9SBen Hutchings 654fe5df1b9SBen Hutchings /** 655fe5df1b9SBen Hutchings * enum ethtool_stringset - string set ID 656fe5df1b9SBen Hutchings * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST 657fe5df1b9SBen Hutchings * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS 658fe5df1b9SBen Hutchings * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with 659fe5df1b9SBen Hutchings * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS 660fe5df1b9SBen Hutchings * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; 661fe5df1b9SBen Hutchings * now deprecated 662fe5df1b9SBen Hutchings * @ETH_SS_FEATURES: Device feature names 663892311f6SEyal Perry * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names 664d9c65de0SJakub Kicinski * @ETH_SS_TUNABLES: tunable names 665f3a40945SAndrew Lunn * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS 6660d27f4e4SRaju Lakkaraju * @ETH_SS_PHY_TUNABLES: PHY tunable names 667428c122fSMichal Kubecek * @ETH_SS_LINK_MODES: link mode names 6686a94b8ccSMichal Kubecek * @ETH_SS_MSG_CLASSES: debug message class names 66951ea22b0SMichal Kubecek * @ETH_SS_WOL_MODES: wake-on-lan modes 670f76510b4SMichal Kubecek * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags 671f76510b4SMichal Kubecek * @ETH_SS_TS_TX_TYPES: timestamping Tx types 672f76510b4SMichal Kubecek * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters 673c7d759ebSJakub Kicinski * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types 674f09ea6fbSJakub Kicinski * @ETH_SS_STATS_STD: standardized stats 675f09ea6fbSJakub Kicinski * @ETH_SS_STATS_ETH_PHY: names of IEEE 802.3 PHY statistics 676ca224454SJakub Kicinski * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics 677bfad2b97SJakub Kicinski * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics 678a8b06e9dSJakub Kicinski * @ETH_SS_STATS_RMON: names of RMON statistics 679d9c65de0SJakub Kicinski * 680d9c65de0SJakub Kicinski * @ETH_SS_COUNT: number of defined string sets 681fe5df1b9SBen Hutchings */ 682607ca46eSDavid Howells enum ethtool_stringset { 683607ca46eSDavid Howells ETH_SS_TEST = 0, 684607ca46eSDavid Howells ETH_SS_STATS, 685607ca46eSDavid Howells ETH_SS_PRIV_FLAGS, 686fe5df1b9SBen Hutchings ETH_SS_NTUPLE_FILTERS, 687607ca46eSDavid Howells ETH_SS_FEATURES, 688892311f6SEyal Perry ETH_SS_RSS_HASH_FUNCS, 689a4244b0cSHadar Hen Zion ETH_SS_TUNABLES, 690f3a40945SAndrew Lunn ETH_SS_PHY_STATS, 6910d27f4e4SRaju Lakkaraju ETH_SS_PHY_TUNABLES, 692428c122fSMichal Kubecek ETH_SS_LINK_MODES, 6936a94b8ccSMichal Kubecek ETH_SS_MSG_CLASSES, 69451ea22b0SMichal Kubecek ETH_SS_WOL_MODES, 695f76510b4SMichal Kubecek ETH_SS_SOF_TIMESTAMPING, 696f76510b4SMichal Kubecek ETH_SS_TS_TX_TYPES, 697f76510b4SMichal Kubecek ETH_SS_TS_RX_FILTERS, 698c7d759ebSJakub Kicinski ETH_SS_UDP_TUNNEL_TYPES, 699f09ea6fbSJakub Kicinski ETH_SS_STATS_STD, 700f09ea6fbSJakub Kicinski ETH_SS_STATS_ETH_PHY, 701ca224454SJakub Kicinski ETH_SS_STATS_ETH_MAC, 702bfad2b97SJakub Kicinski ETH_SS_STATS_ETH_CTRL, 703a8b06e9dSJakub Kicinski ETH_SS_STATS_RMON, 70471921690SMichal Kubecek 70571921690SMichal Kubecek /* add new constants above here */ 70671921690SMichal Kubecek ETH_SS_COUNT 707607ca46eSDavid Howells }; 708607ca46eSDavid Howells 709fe5df1b9SBen Hutchings /** 710fe5df1b9SBen Hutchings * struct ethtool_gstrings - string set for data tagging 711fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTRINGS 712fe5df1b9SBen Hutchings * @string_set: String set ID; one of &enum ethtool_stringset 713fe5df1b9SBen Hutchings * @len: On return, the number of strings in the string set 714fe5df1b9SBen Hutchings * @data: Buffer for strings. Each string is null-padded to a size of 715fe5df1b9SBen Hutchings * %ETH_GSTRING_LEN. 716fe5df1b9SBen Hutchings * 717fe5df1b9SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in 718fe5df1b9SBen Hutchings * the string set. They must allocate a buffer of the appropriate 719fe5df1b9SBen Hutchings * size immediately following this structure. 720fe5df1b9SBen Hutchings */ 721607ca46eSDavid Howells struct ethtool_gstrings { 722fe5df1b9SBen Hutchings __u32 cmd; 723fe5df1b9SBen Hutchings __u32 string_set; 724fe5df1b9SBen Hutchings __u32 len; 725607ca46eSDavid Howells __u8 data[0]; 726607ca46eSDavid Howells }; 727607ca46eSDavid Howells 728fe5df1b9SBen Hutchings /** 729fe5df1b9SBen Hutchings * struct ethtool_sset_info - string set information 730fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSSET_INFO 73183e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 732fe5df1b9SBen Hutchings * @sset_mask: On entry, a bitmask of string sets to query, with bits 733fe5df1b9SBen Hutchings * numbered according to &enum ethtool_stringset. On return, a 734fe5df1b9SBen Hutchings * bitmask of those string sets queried that are supported. 735fe5df1b9SBen Hutchings * @data: Buffer for string set sizes. On return, this contains the 736fe5df1b9SBen Hutchings * size of each string set that was queried and supported, in 737fe5df1b9SBen Hutchings * order of ID. 738fe5df1b9SBen Hutchings * 739fe5df1b9SBen Hutchings * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on 740fe5df1b9SBen Hutchings * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the 741fe5df1b9SBen Hutchings * size of set 1 and @data[1] contains the size of set 2. 742fe5df1b9SBen Hutchings * 743fe5df1b9SBen Hutchings * Users must allocate a buffer of the appropriate size (4 * number of 744fe5df1b9SBen Hutchings * sets queried) immediately following this structure. 745fe5df1b9SBen Hutchings */ 746607ca46eSDavid Howells struct ethtool_sset_info { 747fe5df1b9SBen Hutchings __u32 cmd; 748607ca46eSDavid Howells __u32 reserved; 749fe5df1b9SBen Hutchings __u64 sset_mask; 750fe5df1b9SBen Hutchings __u32 data[0]; 751607ca46eSDavid Howells }; 752607ca46eSDavid Howells 753607ca46eSDavid Howells /** 754607ca46eSDavid Howells * enum ethtool_test_flags - flags definition of ethtool_test 755607ca46eSDavid Howells * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise 756607ca46eSDavid Howells * only online tests. 757607ca46eSDavid Howells * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. 758607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback 759607ca46eSDavid Howells * test. 760607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test 761607ca46eSDavid Howells */ 762607ca46eSDavid Howells 763607ca46eSDavid Howells enum ethtool_test_flags { 764607ca46eSDavid Howells ETH_TEST_FL_OFFLINE = (1 << 0), 765607ca46eSDavid Howells ETH_TEST_FL_FAILED = (1 << 1), 766607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB = (1 << 2), 767607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), 768607ca46eSDavid Howells }; 769607ca46eSDavid Howells 7704e5a62dbSBen Hutchings /** 7714e5a62dbSBen Hutchings * struct ethtool_test - device self-test invocation 7724e5a62dbSBen Hutchings * @cmd: Command number = %ETHTOOL_TEST 7734e5a62dbSBen Hutchings * @flags: A bitmask of flags from &enum ethtool_test_flags. Some 7744e5a62dbSBen Hutchings * flags may be set by the user on entry; others may be set by 7754e5a62dbSBen Hutchings * the driver on return. 77683e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 7774e5a62dbSBen Hutchings * @len: On return, the number of test results 7784e5a62dbSBen Hutchings * @data: Array of test results 7794e5a62dbSBen Hutchings * 7804e5a62dbSBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the 7814e5a62dbSBen Hutchings * number of test results that will be returned. They must allocate a 7824e5a62dbSBen Hutchings * buffer of the appropriate size (8 * number of results) immediately 7834e5a62dbSBen Hutchings * following this structure. 7844e5a62dbSBen Hutchings */ 785607ca46eSDavid Howells struct ethtool_test { 7864e5a62dbSBen Hutchings __u32 cmd; 7874e5a62dbSBen Hutchings __u32 flags; 788607ca46eSDavid Howells __u32 reserved; 7894e5a62dbSBen Hutchings __u32 len; 790607ca46eSDavid Howells __u64 data[0]; 791607ca46eSDavid Howells }; 792607ca46eSDavid Howells 79359091229SBen Hutchings /** 79459091229SBen Hutchings * struct ethtool_stats - device-specific statistics 79559091229SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTATS 79659091229SBen Hutchings * @n_stats: On return, the number of statistics 79759091229SBen Hutchings * @data: Array of statistics 79859091229SBen Hutchings * 79959091229SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the 80059091229SBen Hutchings * number of statistics that will be returned. They must allocate a 80159091229SBen Hutchings * buffer of the appropriate size (8 * number of statistics) 80259091229SBen Hutchings * immediately following this structure. 80359091229SBen Hutchings */ 804607ca46eSDavid Howells struct ethtool_stats { 80559091229SBen Hutchings __u32 cmd; 80659091229SBen Hutchings __u32 n_stats; 807607ca46eSDavid Howells __u64 data[0]; 808607ca46eSDavid Howells }; 809607ca46eSDavid Howells 810f432c095SBen Hutchings /** 811f432c095SBen Hutchings * struct ethtool_perm_addr - permanent hardware address 812f432c095SBen Hutchings * @cmd: Command number = %ETHTOOL_GPERMADDR 813f432c095SBen Hutchings * @size: On entry, the size of the buffer. On return, the size of the 814f432c095SBen Hutchings * address. The command fails if the buffer is too small. 815f432c095SBen Hutchings * @data: Buffer for the address 816f432c095SBen Hutchings * 817f432c095SBen Hutchings * Users must allocate the buffer immediately following this structure. 818f432c095SBen Hutchings * A buffer size of %MAX_ADDR_LEN should be sufficient for any address 819f432c095SBen Hutchings * type. 820f432c095SBen Hutchings */ 821607ca46eSDavid Howells struct ethtool_perm_addr { 822f432c095SBen Hutchings __u32 cmd; 823607ca46eSDavid Howells __u32 size; 824607ca46eSDavid Howells __u8 data[0]; 825607ca46eSDavid Howells }; 826607ca46eSDavid Howells 827607ca46eSDavid Howells /* boolean flags controlling per-interface behavior characteristics. 828607ca46eSDavid Howells * When reading, the flag indicates whether or not a certain behavior 829607ca46eSDavid Howells * is enabled/present. When writing, the flag indicates whether 830607ca46eSDavid Howells * or not the driver should turn on (set) or off (clear) a behavior. 831607ca46eSDavid Howells * 832607ca46eSDavid Howells * Some behaviors may read-only (unconditionally absent or present). 833607ca46eSDavid Howells * If such is the case, return EINVAL in the set-flags operation if the 834607ca46eSDavid Howells * flag differs from the read-only value. 835607ca46eSDavid Howells */ 836607ca46eSDavid Howells enum ethtool_flags { 837607ca46eSDavid Howells ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ 838607ca46eSDavid Howells ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ 839607ca46eSDavid Howells ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 840607ca46eSDavid Howells ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ 841607ca46eSDavid Howells ETH_FLAG_RXHASH = (1 << 28), 842607ca46eSDavid Howells }; 843607ca46eSDavid Howells 844607ca46eSDavid Howells /* The following structures are for supporting RX network flow 845607ca46eSDavid Howells * classification and RX n-tuple configuration. Note, all multibyte 846607ca46eSDavid Howells * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to 847607ca46eSDavid Howells * be in network byte order. 848607ca46eSDavid Howells */ 849607ca46eSDavid Howells 850607ca46eSDavid Howells /** 851607ca46eSDavid Howells * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. 852607ca46eSDavid Howells * @ip4src: Source host 853607ca46eSDavid Howells * @ip4dst: Destination host 854607ca46eSDavid Howells * @psrc: Source port 855607ca46eSDavid Howells * @pdst: Destination port 856607ca46eSDavid Howells * @tos: Type-of-service 857607ca46eSDavid Howells * 858607ca46eSDavid Howells * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. 859607ca46eSDavid Howells */ 860607ca46eSDavid Howells struct ethtool_tcpip4_spec { 861607ca46eSDavid Howells __be32 ip4src; 862607ca46eSDavid Howells __be32 ip4dst; 863607ca46eSDavid Howells __be16 psrc; 864607ca46eSDavid Howells __be16 pdst; 865607ca46eSDavid Howells __u8 tos; 866607ca46eSDavid Howells }; 867607ca46eSDavid Howells 868607ca46eSDavid Howells /** 869607ca46eSDavid Howells * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 870607ca46eSDavid Howells * @ip4src: Source host 871607ca46eSDavid Howells * @ip4dst: Destination host 872607ca46eSDavid Howells * @spi: Security parameters index 873607ca46eSDavid Howells * @tos: Type-of-service 874607ca46eSDavid Howells * 875607ca46eSDavid Howells * This can be used to specify an IPsec transport or tunnel over IPv4. 876607ca46eSDavid Howells */ 877607ca46eSDavid Howells struct ethtool_ah_espip4_spec { 878607ca46eSDavid Howells __be32 ip4src; 879607ca46eSDavid Howells __be32 ip4dst; 880607ca46eSDavid Howells __be32 spi; 881607ca46eSDavid Howells __u8 tos; 882607ca46eSDavid Howells }; 883607ca46eSDavid Howells 884607ca46eSDavid Howells #define ETH_RX_NFC_IP4 1 885607ca46eSDavid Howells 886607ca46eSDavid Howells /** 887607ca46eSDavid Howells * struct ethtool_usrip4_spec - general flow specification for IPv4 888607ca46eSDavid Howells * @ip4src: Source host 889607ca46eSDavid Howells * @ip4dst: Destination host 890607ca46eSDavid Howells * @l4_4_bytes: First 4 bytes of transport (layer 4) header 891607ca46eSDavid Howells * @tos: Type-of-service 892607ca46eSDavid Howells * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 893607ca46eSDavid Howells * @proto: Transport protocol number; mask must be 0 894607ca46eSDavid Howells */ 895607ca46eSDavid Howells struct ethtool_usrip4_spec { 896607ca46eSDavid Howells __be32 ip4src; 897607ca46eSDavid Howells __be32 ip4dst; 898607ca46eSDavid Howells __be32 l4_4_bytes; 899607ca46eSDavid Howells __u8 tos; 900607ca46eSDavid Howells __u8 ip_ver; 901607ca46eSDavid Howells __u8 proto; 902607ca46eSDavid Howells }; 903607ca46eSDavid Howells 90472bb6872SEdward Cree /** 90572bb6872SEdward Cree * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc. 90672bb6872SEdward Cree * @ip6src: Source host 90772bb6872SEdward Cree * @ip6dst: Destination host 90872bb6872SEdward Cree * @psrc: Source port 90972bb6872SEdward Cree * @pdst: Destination port 91072bb6872SEdward Cree * @tclass: Traffic Class 91172bb6872SEdward Cree * 91272bb6872SEdward Cree * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow. 91372bb6872SEdward Cree */ 91472bb6872SEdward Cree struct ethtool_tcpip6_spec { 91572bb6872SEdward Cree __be32 ip6src[4]; 91672bb6872SEdward Cree __be32 ip6dst[4]; 91772bb6872SEdward Cree __be16 psrc; 91872bb6872SEdward Cree __be16 pdst; 91972bb6872SEdward Cree __u8 tclass; 92072bb6872SEdward Cree }; 92172bb6872SEdward Cree 92272bb6872SEdward Cree /** 92372bb6872SEdward Cree * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6 92472bb6872SEdward Cree * @ip6src: Source host 92572bb6872SEdward Cree * @ip6dst: Destination host 92672bb6872SEdward Cree * @spi: Security parameters index 92772bb6872SEdward Cree * @tclass: Traffic Class 92872bb6872SEdward Cree * 92972bb6872SEdward Cree * This can be used to specify an IPsec transport or tunnel over IPv6. 93072bb6872SEdward Cree */ 93172bb6872SEdward Cree struct ethtool_ah_espip6_spec { 93272bb6872SEdward Cree __be32 ip6src[4]; 93372bb6872SEdward Cree __be32 ip6dst[4]; 93472bb6872SEdward Cree __be32 spi; 93572bb6872SEdward Cree __u8 tclass; 93672bb6872SEdward Cree }; 93772bb6872SEdward Cree 93872bb6872SEdward Cree /** 93972bb6872SEdward Cree * struct ethtool_usrip6_spec - general flow specification for IPv6 94072bb6872SEdward Cree * @ip6src: Source host 94172bb6872SEdward Cree * @ip6dst: Destination host 94272bb6872SEdward Cree * @l4_4_bytes: First 4 bytes of transport (layer 4) header 94372bb6872SEdward Cree * @tclass: Traffic Class 94472bb6872SEdward Cree * @l4_proto: Transport protocol number (nexthdr after any Extension Headers) 94572bb6872SEdward Cree */ 94672bb6872SEdward Cree struct ethtool_usrip6_spec { 94772bb6872SEdward Cree __be32 ip6src[4]; 94872bb6872SEdward Cree __be32 ip6dst[4]; 94972bb6872SEdward Cree __be32 l4_4_bytes; 95072bb6872SEdward Cree __u8 tclass; 95172bb6872SEdward Cree __u8 l4_proto; 95272bb6872SEdward Cree }; 95372bb6872SEdward Cree 954607ca46eSDavid Howells union ethtool_flow_union { 955607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec; 956607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec; 957607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec; 958607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec; 959607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec; 960607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec; 96172bb6872SEdward Cree struct ethtool_tcpip6_spec tcp_ip6_spec; 96272bb6872SEdward Cree struct ethtool_tcpip6_spec udp_ip6_spec; 96372bb6872SEdward Cree struct ethtool_tcpip6_spec sctp_ip6_spec; 96472bb6872SEdward Cree struct ethtool_ah_espip6_spec ah_ip6_spec; 96572bb6872SEdward Cree struct ethtool_ah_espip6_spec esp_ip6_spec; 96672bb6872SEdward Cree struct ethtool_usrip6_spec usr_ip6_spec; 967607ca46eSDavid Howells struct ethhdr ether_spec; 968d4676eacSYan Burman __u8 hdata[52]; 969607ca46eSDavid Howells }; 970607ca46eSDavid Howells 971dc2e5734SYan Burman /** 972dc2e5734SYan Burman * struct ethtool_flow_ext - additional RX flow fields 973dc2e5734SYan Burman * @h_dest: destination MAC address 974dc2e5734SYan Burman * @vlan_etype: VLAN EtherType 975dc2e5734SYan Burman * @vlan_tci: VLAN tag control information 976dc2e5734SYan Burman * @data: user defined data 97783e5feebSJakub Kicinski * @padding: Reserved for future use; see the note on reserved space. 978dc2e5734SYan Burman * 979dc2e5734SYan Burman * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT 980dc2e5734SYan Burman * is set in &struct ethtool_rx_flow_spec @flow_type. 981dc2e5734SYan Burman * @h_dest is valid if %FLOW_MAC_EXT is set. 982dc2e5734SYan Burman */ 983607ca46eSDavid Howells struct ethtool_flow_ext { 984d4676eacSYan Burman __u8 padding[2]; 985dc2e5734SYan Burman unsigned char h_dest[ETH_ALEN]; 986607ca46eSDavid Howells __be16 vlan_etype; 987607ca46eSDavid Howells __be16 vlan_tci; 988607ca46eSDavid Howells __be32 data[2]; 989607ca46eSDavid Howells }; 990607ca46eSDavid Howells 991607ca46eSDavid Howells /** 992607ca46eSDavid Howells * struct ethtool_rx_flow_spec - classification rule for RX flows 993607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 994607ca46eSDavid Howells * @h_u: Flow fields to match (dependent on @flow_type) 995607ca46eSDavid Howells * @h_ext: Additional fields to match 996607ca46eSDavid Howells * @m_u: Masks for flow field bits to be matched 997607ca46eSDavid Howells * @m_ext: Masks for additional field bits to be matched 998607ca46eSDavid Howells * Note, all additional fields must be ignored unless @flow_type 999dc2e5734SYan Burman * includes the %FLOW_EXT or %FLOW_MAC_EXT flag 1000dc2e5734SYan Burman * (see &struct ethtool_flow_ext description). 1001607ca46eSDavid Howells * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC 10026cfef793SFlorian Fainelli * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the 10036cfef793SFlorian Fainelli * packets should be used for Wake-on-LAN with %WAKE_FILTER 1004607ca46eSDavid Howells * @location: Location of rule in the table. Locations must be 1005607ca46eSDavid Howells * numbered such that a flow matching multiple rules will be 1006607ca46eSDavid Howells * classified according to the first (lowest numbered) rule. 1007607ca46eSDavid Howells */ 1008607ca46eSDavid Howells struct ethtool_rx_flow_spec { 1009607ca46eSDavid Howells __u32 flow_type; 1010607ca46eSDavid Howells union ethtool_flow_union h_u; 1011607ca46eSDavid Howells struct ethtool_flow_ext h_ext; 1012607ca46eSDavid Howells union ethtool_flow_union m_u; 1013607ca46eSDavid Howells struct ethtool_flow_ext m_ext; 1014607ca46eSDavid Howells __u64 ring_cookie; 1015607ca46eSDavid Howells __u32 location; 1016607ca46eSDavid Howells }; 1017607ca46eSDavid Howells 101854e8cb78SStephen Hemminger /* How rings are laid out when accessing virtual functions or 10198cf6f497SJohn Fastabend * offloaded queues is device specific. To allow users to do flow 10208cf6f497SJohn Fastabend * steering and specify these queues the ring cookie is partitioned 10218cf6f497SJohn Fastabend * into a 32bit queue index with an 8 bit virtual function id. 10228cf6f497SJohn Fastabend * This also leaves the 3bytes for further specifiers. It is possible 10238cf6f497SJohn Fastabend * future devices may support more than 256 virtual functions if 10248cf6f497SJohn Fastabend * devices start supporting PCIe w/ARI. However at the moment I 10258cf6f497SJohn Fastabend * do not know of any devices that support this so I do not reserve 10268cf6f497SJohn Fastabend * space for this at this time. If a future patch consumes the next 102754e8cb78SStephen Hemminger * byte it should be aware of this possibility. 10288cf6f497SJohn Fastabend */ 10298cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL 10308cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL 10318cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 10328cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) 10338cf6f497SJohn Fastabend { 10348cf6f497SJohn Fastabend return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; 1035d89d4155SFlorian Fainelli } 10368cf6f497SJohn Fastabend 10378cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) 10388cf6f497SJohn Fastabend { 10398cf6f497SJohn Fastabend return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> 10408cf6f497SJohn Fastabend ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; 1041d89d4155SFlorian Fainelli } 10428cf6f497SJohn Fastabend 1043607ca46eSDavid Howells /** 1044607ca46eSDavid Howells * struct ethtool_rxnfc - command to get or set RX flow classification rules 1045607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, 1046607ca46eSDavid Howells * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, 1047607ca46eSDavid Howells * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS 1048607ca46eSDavid Howells * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW 1049607ca46eSDavid Howells * @data: Command-dependent value 1050607ca46eSDavid Howells * @fs: Flow classification rule 105184a1d9c4SEdward Cree * @rss_context: RSS context to be affected 1052607ca46eSDavid Howells * @rule_cnt: Number of rules to be affected 1053607ca46eSDavid Howells * @rule_locs: Array of used rule locations 1054607ca46eSDavid Howells * 1055607ca46eSDavid Howells * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating 1056607ca46eSDavid Howells * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following 105784a1d9c4SEdward Cree * structure fields must not be used, except that if @flow_type includes 105884a1d9c4SEdward Cree * the %FLOW_RSS flag, then @rss_context determines which RSS context to 105984a1d9c4SEdward Cree * act on. 1060607ca46eSDavid Howells * 1061607ca46eSDavid Howells * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues 1062607ca46eSDavid Howells * on return. 1063607ca46eSDavid Howells * 1064607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 1065607ca46eSDavid Howells * rules on return. If @data is non-zero on return then it is the 1066607ca46eSDavid Howells * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the 1067607ca46eSDavid Howells * driver supports any special location values. If that flag is not 1068607ca46eSDavid Howells * set in @data then special location values should not be used. 1069607ca46eSDavid Howells * 1070607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 107184a1d9c4SEdward Cree * existing rule on entry and @fs contains the rule on return; if 107284a1d9c4SEdward Cree * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is 107384a1d9c4SEdward Cree * filled with the RSS context ID associated with the rule. 1074607ca46eSDavid Howells * 1075607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the 1076607ca46eSDavid Howells * user buffer for @rule_locs on entry. On return, @data is the size 1077607ca46eSDavid Howells * of the rule table, @rule_cnt is the number of defined rules, and 1078607ca46eSDavid Howells * @rule_locs contains the locations of the defined rules. Drivers 1079607ca46eSDavid Howells * must use the second parameter to get_rxnfc() instead of @rule_locs. 1080607ca46eSDavid Howells * 1081607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 1082607ca46eSDavid Howells * @fs.@location either specifies the location to use or is a special 1083607ca46eSDavid Howells * location value with %RX_CLS_LOC_SPECIAL flag set. On return, 108484a1d9c4SEdward Cree * @fs.@location is the actual rule location. If @fs.@flow_type 108584a1d9c4SEdward Cree * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to 108684a1d9c4SEdward Cree * use for flow spreading traffic which matches this rule. The value 108784a1d9c4SEdward Cree * from the rxfh indirection table will be added to @fs.@ring_cookie 108884a1d9c4SEdward Cree * to choose which ring to deliver to. 1089607ca46eSDavid Howells * 1090607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 1091607ca46eSDavid Howells * existing rule on entry. 1092607ca46eSDavid Howells * 1093607ca46eSDavid Howells * A driver supporting the special location values for 1094607ca46eSDavid Howells * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused 1095607ca46eSDavid Howells * location, and may remove a rule at a later location (lower 1096607ca46eSDavid Howells * priority) that matches exactly the same set of flows. The special 1097073e3cf2SBen Hutchings * values are %RX_CLS_LOC_ANY, selecting any location; 1098607ca46eSDavid Howells * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum 1099607ca46eSDavid Howells * priority); and %RX_CLS_LOC_LAST, selecting the last suitable 1100607ca46eSDavid Howells * location (minimum priority). Additional special values may be 1101607ca46eSDavid Howells * defined in future and drivers must return -%EINVAL for any 1102607ca46eSDavid Howells * unrecognised value. 1103607ca46eSDavid Howells */ 1104607ca46eSDavid Howells struct ethtool_rxnfc { 1105607ca46eSDavid Howells __u32 cmd; 1106607ca46eSDavid Howells __u32 flow_type; 1107607ca46eSDavid Howells __u64 data; 1108607ca46eSDavid Howells struct ethtool_rx_flow_spec fs; 110984a1d9c4SEdward Cree union { 1110607ca46eSDavid Howells __u32 rule_cnt; 111184a1d9c4SEdward Cree __u32 rss_context; 111284a1d9c4SEdward Cree }; 1113607ca46eSDavid Howells __u32 rule_locs[0]; 1114607ca46eSDavid Howells }; 1115607ca46eSDavid Howells 1116607ca46eSDavid Howells 1117607ca46eSDavid Howells /** 1118607ca46eSDavid Howells * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 1119607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 1120607ca46eSDavid Howells * @size: On entry, the array size of the user buffer, which may be zero. 1121607ca46eSDavid Howells * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware 1122607ca46eSDavid Howells * indirection table. 1123607ca46eSDavid Howells * @ring_index: RX ring/queue index for each hash value 1124607ca46eSDavid Howells * 1125607ca46eSDavid Howells * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size 1126607ca46eSDavid Howells * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means 1127607ca46eSDavid Howells * the table should be reset to default values. This last feature 1128607ca46eSDavid Howells * is not supported by the original implementations. 1129607ca46eSDavid Howells */ 1130607ca46eSDavid Howells struct ethtool_rxfh_indir { 1131607ca46eSDavid Howells __u32 cmd; 1132607ca46eSDavid Howells __u32 size; 1133607ca46eSDavid Howells __u32 ring_index[0]; 1134607ca46eSDavid Howells }; 1135607ca46eSDavid Howells 1136607ca46eSDavid Howells /** 11373de0b592SVenkata Duvvuru * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key. 11383de0b592SVenkata Duvvuru * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH 113984a1d9c4SEdward Cree * @rss_context: RSS context identifier. Context 0 is the default for normal 114084a1d9c4SEdward Cree * traffic; other contexts can be referenced as the destination for RX flow 114184a1d9c4SEdward Cree * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command 114284a1d9c4SEdward Cree * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will 114384a1d9c4SEdward Cree * contain the ID of the newly allocated context. 114438c891a4SBen Hutchings * @indir_size: On entry, the array size of the user buffer for the 114538c891a4SBen Hutchings * indirection table, which may be zero, or (for %ETHTOOL_SRSSH), 114638c891a4SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH, 114738c891a4SBen Hutchings * the array size of the hardware indirection table. 114838c891a4SBen Hutchings * @key_size: On entry, the array size of the user buffer for the hash key, 114938c891a4SBen Hutchings * which may be zero. On return from %ETHTOOL_GRSSH, the size of the 115038c891a4SBen Hutchings * hardware hash key. 1151892311f6SEyal Perry * @hfunc: Defines the current RSS hash function used by HW (or to be set to). 1152892311f6SEyal Perry * Valid values are one of the %ETH_RSS_HASH_*. 115383e5feebSJakub Kicinski * @rsvd8: Reserved for future use; see the note on reserved space. 115483e5feebSJakub Kicinski * @rsvd32: Reserved for future use; see the note on reserved space. 11553de0b592SVenkata Duvvuru * @rss_config: RX ring/queue index for each hash value i.e., indirection table 115638c891a4SBen Hutchings * of @indir_size __u32 elements, followed by hash key of @key_size 115738c891a4SBen Hutchings * bytes. 11583de0b592SVenkata Duvvuru * 11593de0b592SVenkata Duvvuru * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the 11607455fa24SBen Hutchings * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of 11617455fa24SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested 11627455fa24SBen Hutchings * and a @indir_size of zero means the indir table should be reset to default 116384a1d9c4SEdward Cree * values (if @rss_context == 0) or that the RSS context should be deleted. 116484a1d9c4SEdward Cree * An hfunc of zero means that hash function setting is not requested. 11653de0b592SVenkata Duvvuru */ 11663de0b592SVenkata Duvvuru struct ethtool_rxfh { 11673de0b592SVenkata Duvvuru __u32 cmd; 11683de0b592SVenkata Duvvuru __u32 rss_context; 11693de0b592SVenkata Duvvuru __u32 indir_size; 11703de0b592SVenkata Duvvuru __u32 key_size; 1171892311f6SEyal Perry __u8 hfunc; 1172892311f6SEyal Perry __u8 rsvd8[3]; 1173892311f6SEyal Perry __u32 rsvd32; 11743de0b592SVenkata Duvvuru __u32 rss_config[0]; 11753de0b592SVenkata Duvvuru }; 117684a1d9c4SEdward Cree #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff 11777455fa24SBen Hutchings #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff 11783de0b592SVenkata Duvvuru 11793de0b592SVenkata Duvvuru /** 1180607ca46eSDavid Howells * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter 1181607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 1182607ca46eSDavid Howells * @h_u: Flow field values to match (dependent on @flow_type) 1183607ca46eSDavid Howells * @m_u: Masks for flow field value bits to be ignored 1184607ca46eSDavid Howells * @vlan_tag: VLAN tag to match 1185607ca46eSDavid Howells * @vlan_tag_mask: Mask for VLAN tag bits to be ignored 1186607ca46eSDavid Howells * @data: Driver-dependent data to match 1187607ca46eSDavid Howells * @data_mask: Mask for driver-dependent data bits to be ignored 1188607ca46eSDavid Howells * @action: RX ring/queue index to deliver to (non-negative) or other action 1189607ca46eSDavid Howells * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) 1190607ca46eSDavid Howells * 1191607ca46eSDavid Howells * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where 1192607ca46eSDavid Howells * a field value and mask are both zero this is treated as if all mask 1193607ca46eSDavid Howells * bits are set i.e. the field is ignored. 1194607ca46eSDavid Howells */ 1195607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec { 1196607ca46eSDavid Howells __u32 flow_type; 1197607ca46eSDavid Howells union { 1198607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec; 1199607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec; 1200607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec; 1201607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec; 1202607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec; 1203607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec; 1204607ca46eSDavid Howells struct ethhdr ether_spec; 1205607ca46eSDavid Howells __u8 hdata[72]; 1206607ca46eSDavid Howells } h_u, m_u; 1207607ca46eSDavid Howells 1208607ca46eSDavid Howells __u16 vlan_tag; 1209607ca46eSDavid Howells __u16 vlan_tag_mask; 1210607ca46eSDavid Howells __u64 data; 1211607ca46eSDavid Howells __u64 data_mask; 1212607ca46eSDavid Howells 1213607ca46eSDavid Howells __s32 action; 1214607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ 1215607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ 1216607ca46eSDavid Howells }; 1217607ca46eSDavid Howells 1218607ca46eSDavid Howells /** 1219607ca46eSDavid Howells * struct ethtool_rx_ntuple - command to set or clear RX flow filter 1220607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_SRXNTUPLE 1221607ca46eSDavid Howells * @fs: Flow filter specification 1222607ca46eSDavid Howells */ 1223607ca46eSDavid Howells struct ethtool_rx_ntuple { 1224607ca46eSDavid Howells __u32 cmd; 1225607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec fs; 1226607ca46eSDavid Howells }; 1227607ca46eSDavid Howells 1228607ca46eSDavid Howells #define ETHTOOL_FLASH_MAX_FILENAME 128 1229607ca46eSDavid Howells enum ethtool_flash_op_type { 1230607ca46eSDavid Howells ETHTOOL_FLASH_ALL_REGIONS = 0, 1231607ca46eSDavid Howells }; 1232607ca46eSDavid Howells 1233607ca46eSDavid Howells /* for passing firmware flashing related parameters */ 1234607ca46eSDavid Howells struct ethtool_flash { 1235607ca46eSDavid Howells __u32 cmd; 1236607ca46eSDavid Howells __u32 region; 1237607ca46eSDavid Howells char data[ETHTOOL_FLASH_MAX_FILENAME]; 1238607ca46eSDavid Howells }; 1239607ca46eSDavid Howells 1240607ca46eSDavid Howells /** 1241607ca46eSDavid Howells * struct ethtool_dump - used for retrieving, setting device dump 1242607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or 1243607ca46eSDavid Howells * %ETHTOOL_SET_DUMP 1244607ca46eSDavid Howells * @version: FW version of the dump, filled in by driver 1245607ca46eSDavid Howells * @flag: driver dependent flag for dump setting, filled in by driver during 1246607ca46eSDavid Howells * get and filled in by ethtool for set operation. 1247607ca46eSDavid Howells * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when 1248607ca46eSDavid Howells * firmware dump is disabled. 1249607ca46eSDavid Howells * @len: length of dump data, used as the length of the user buffer on entry to 1250607ca46eSDavid Howells * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver 1251607ca46eSDavid Howells * for %ETHTOOL_GET_DUMP_FLAG command 1252607ca46eSDavid Howells * @data: data collected for get dump data operation 1253607ca46eSDavid Howells */ 1254607ca46eSDavid Howells struct ethtool_dump { 1255607ca46eSDavid Howells __u32 cmd; 1256607ca46eSDavid Howells __u32 version; 1257607ca46eSDavid Howells __u32 flag; 1258607ca46eSDavid Howells __u32 len; 1259607ca46eSDavid Howells __u8 data[0]; 1260607ca46eSDavid Howells }; 1261607ca46eSDavid Howells 1262ba569dc3SBen Hutchings #define ETH_FW_DUMP_DISABLE 0 1263ba569dc3SBen Hutchings 1264607ca46eSDavid Howells /* for returning and changing feature sets */ 1265607ca46eSDavid Howells 1266607ca46eSDavid Howells /** 1267607ca46eSDavid Howells * struct ethtool_get_features_block - block with state of 32 features 1268607ca46eSDavid Howells * @available: mask of changeable features 1269607ca46eSDavid Howells * @requested: mask of features requested to be enabled if possible 1270607ca46eSDavid Howells * @active: mask of currently enabled features 1271607ca46eSDavid Howells * @never_changed: mask of features not changeable for any device 1272607ca46eSDavid Howells */ 1273607ca46eSDavid Howells struct ethtool_get_features_block { 1274607ca46eSDavid Howells __u32 available; 1275607ca46eSDavid Howells __u32 requested; 1276607ca46eSDavid Howells __u32 active; 1277607ca46eSDavid Howells __u32 never_changed; 1278607ca46eSDavid Howells }; 1279607ca46eSDavid Howells 1280607ca46eSDavid Howells /** 1281607ca46eSDavid Howells * struct ethtool_gfeatures - command to get state of device's features 1282607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GFEATURES 1283073e3cf2SBen Hutchings * @size: On entry, the number of elements in the features[] array; 1284073e3cf2SBen Hutchings * on return, the number of elements in features[] needed to hold 1285073e3cf2SBen Hutchings * all features 1286607ca46eSDavid Howells * @features: state of features 1287607ca46eSDavid Howells */ 1288607ca46eSDavid Howells struct ethtool_gfeatures { 1289607ca46eSDavid Howells __u32 cmd; 1290607ca46eSDavid Howells __u32 size; 1291607ca46eSDavid Howells struct ethtool_get_features_block features[0]; 1292607ca46eSDavid Howells }; 1293607ca46eSDavid Howells 1294607ca46eSDavid Howells /** 1295607ca46eSDavid Howells * struct ethtool_set_features_block - block with request for 32 features 1296607ca46eSDavid Howells * @valid: mask of features to be changed 1297607ca46eSDavid Howells * @requested: values of features to be changed 1298607ca46eSDavid Howells */ 1299607ca46eSDavid Howells struct ethtool_set_features_block { 1300607ca46eSDavid Howells __u32 valid; 1301607ca46eSDavid Howells __u32 requested; 1302607ca46eSDavid Howells }; 1303607ca46eSDavid Howells 1304607ca46eSDavid Howells /** 1305607ca46eSDavid Howells * struct ethtool_sfeatures - command to request change in device's features 1306607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_SFEATURES 1307607ca46eSDavid Howells * @size: array size of the features[] array 1308607ca46eSDavid Howells * @features: feature change masks 1309607ca46eSDavid Howells */ 1310607ca46eSDavid Howells struct ethtool_sfeatures { 1311607ca46eSDavid Howells __u32 cmd; 1312607ca46eSDavid Howells __u32 size; 1313607ca46eSDavid Howells struct ethtool_set_features_block features[0]; 1314607ca46eSDavid Howells }; 1315607ca46eSDavid Howells 1316607ca46eSDavid Howells /** 1317607ca46eSDavid Howells * struct ethtool_ts_info - holds a device's timestamping and PHC association 1318607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GET_TS_INFO 1319607ca46eSDavid Howells * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags 1320607ca46eSDavid Howells * @phc_index: device index of the associated PHC, or -1 if there is none 1321607ca46eSDavid Howells * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values 132283e5feebSJakub Kicinski * @tx_reserved: Reserved for future use; see the note on reserved space. 1323607ca46eSDavid Howells * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values 132483e5feebSJakub Kicinski * @rx_reserved: Reserved for future use; see the note on reserved space. 1325607ca46eSDavid Howells * 1326607ca46eSDavid Howells * The bits in the 'tx_types' and 'rx_filters' fields correspond to 1327607ca46eSDavid Howells * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, 1328607ca46eSDavid Howells * respectively. For example, if the device supports HWTSTAMP_TX_ON, 1329607ca46eSDavid Howells * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set. 1330eff3cddcSJacob Keller * 1331eff3cddcSJacob Keller * Drivers should only report the filters they actually support without 1332eff3cddcSJacob Keller * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for 1333eff3cddcSJacob Keller * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the 1334eff3cddcSJacob Keller * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op. 1335607ca46eSDavid Howells */ 1336607ca46eSDavid Howells struct ethtool_ts_info { 1337607ca46eSDavid Howells __u32 cmd; 1338607ca46eSDavid Howells __u32 so_timestamping; 1339607ca46eSDavid Howells __s32 phc_index; 1340607ca46eSDavid Howells __u32 tx_types; 1341607ca46eSDavid Howells __u32 tx_reserved[3]; 1342607ca46eSDavid Howells __u32 rx_filters; 1343607ca46eSDavid Howells __u32 rx_reserved[3]; 1344607ca46eSDavid Howells }; 1345607ca46eSDavid Howells 1346607ca46eSDavid Howells /* 1347607ca46eSDavid Howells * %ETHTOOL_SFEATURES changes features present in features[].valid to the 1348607ca46eSDavid Howells * values of corresponding bits in features[].requested. Bits in .requested 1349607ca46eSDavid Howells * not set in .valid or not changeable are ignored. 1350607ca46eSDavid Howells * 1351607ca46eSDavid Howells * Returns %EINVAL when .valid contains undefined or never-changeable bits 1352607ca46eSDavid Howells * or size is not equal to required number of features words (32-bit blocks). 1353607ca46eSDavid Howells * Returns >= 0 if request was completed; bits set in the value mean: 1354607ca46eSDavid Howells * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not 1355607ca46eSDavid Howells * changeable (not present in %ETHTOOL_GFEATURES' features[].available) 1356607ca46eSDavid Howells * those bits were ignored. 1357607ca46eSDavid Howells * %ETHTOOL_F_WISH - some or all changes requested were recorded but the 1358607ca46eSDavid Howells * resulting state of bits masked by .valid is not equal to .requested. 1359607ca46eSDavid Howells * Probably there are other device-specific constraints on some features 1360607ca46eSDavid Howells * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered 1361607ca46eSDavid Howells * here as though ignored bits were cleared. 1362607ca46eSDavid Howells * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling 1363607ca46eSDavid Howells * compatibility functions. Requested offload state cannot be properly 1364607ca46eSDavid Howells * managed by kernel. 1365607ca46eSDavid Howells * 1366607ca46eSDavid Howells * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of 1367607ca46eSDavid Howells * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands 1368607ca46eSDavid Howells * for ETH_SS_FEATURES string set. First entry in the table corresponds to least 1369607ca46eSDavid Howells * significant bit in features[0] fields. Empty strings mark undefined features. 1370607ca46eSDavid Howells */ 1371607ca46eSDavid Howells enum ethtool_sfeatures_retval_bits { 1372607ca46eSDavid Howells ETHTOOL_F_UNSUPPORTED__BIT, 1373607ca46eSDavid Howells ETHTOOL_F_WISH__BIT, 1374607ca46eSDavid Howells ETHTOOL_F_COMPAT__BIT, 1375607ca46eSDavid Howells }; 1376607ca46eSDavid Howells 1377607ca46eSDavid Howells #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) 1378607ca46eSDavid Howells #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) 1379607ca46eSDavid Howells #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) 1380607ca46eSDavid Howells 1381ac2c7ad0SKan Liang #define MAX_NUM_QUEUE 4096 1382ac2c7ad0SKan Liang 1383ac2c7ad0SKan Liang /** 1384ac2c7ad0SKan Liang * struct ethtool_per_queue_op - apply sub command to the queues in mask. 1385ac2c7ad0SKan Liang * @cmd: ETHTOOL_PERQUEUE 1386ac2c7ad0SKan Liang * @sub_command: the sub command which apply to each queues 1387ac2c7ad0SKan Liang * @queue_mask: Bitmap of the queues which sub command apply to 1388ac2c7ad0SKan Liang * @data: A complete command structure following for each of the queues addressed 1389ac2c7ad0SKan Liang */ 1390ac2c7ad0SKan Liang struct ethtool_per_queue_op { 1391ac2c7ad0SKan Liang __u32 cmd; 1392ac2c7ad0SKan Liang __u32 sub_command; 1393b5d3755aSNicolas Dichtel __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)]; 1394ac2c7ad0SKan Liang char data[]; 1395ac2c7ad0SKan Liang }; 1396607ca46eSDavid Howells 13971a5f3da2SVidya Sagar Ravipati /** 13986dbf94b2SJakub Kicinski * struct ethtool_fecparam - Ethernet Forward Error Correction parameters 13991a5f3da2SVidya Sagar Ravipati * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM 14006dbf94b2SJakub Kicinski * @active_fec: FEC mode which is active on the port, single bit set, GET only. 14016dbf94b2SJakub Kicinski * @fec: Bitmask of configured FEC modes. 1402240e1144SJakub Kicinski * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET. 14036dbf94b2SJakub Kicinski * 1404ad1cd785SJakub Kicinski * Note that @reserved was never validated on input and ethtool user space 1405ad1cd785SJakub Kicinski * left it uninitialized when calling SET. Hence going forward it can only be 1406ad1cd785SJakub Kicinski * used to return a value to userspace with GET. 1407ad1cd785SJakub Kicinski * 14086dbf94b2SJakub Kicinski * FEC modes supported by the device can be read via %ETHTOOL_GLINKSETTINGS. 14096dbf94b2SJakub Kicinski * FEC settings are configured by link autonegotiation whenever it's enabled. 14106dbf94b2SJakub Kicinski * With autoneg on %ETHTOOL_GFECPARAM can be used to read the current mode. 14116dbf94b2SJakub Kicinski * 14126dbf94b2SJakub Kicinski * When autoneg is disabled %ETHTOOL_SFECPARAM controls the FEC settings. 14136dbf94b2SJakub Kicinski * It is recommended that drivers only accept a single bit set in @fec. 14146dbf94b2SJakub Kicinski * When multiple bits are set in @fec drivers may pick mode in an implementation 14156dbf94b2SJakub Kicinski * dependent way. Drivers should reject mixing %ETHTOOL_FEC_AUTO_BIT with other 14166dbf94b2SJakub Kicinski * FEC modes, because it's unclear whether in this case other modes constrain 14176dbf94b2SJakub Kicinski * AUTO or are independent choices. 14186dbf94b2SJakub Kicinski * Drivers must reject SET requests if they support none of the requested modes. 14196dbf94b2SJakub Kicinski * 14206dbf94b2SJakub Kicinski * If device does not support FEC drivers may use %ETHTOOL_FEC_NONE instead 14216dbf94b2SJakub Kicinski * of returning %EOPNOTSUPP from %ETHTOOL_GFECPARAM. 14226dbf94b2SJakub Kicinski * 14236dbf94b2SJakub Kicinski * See enum ethtool_fec_config_bits for definition of valid bits for both 14246dbf94b2SJakub Kicinski * @fec and @active_fec. 14251a5f3da2SVidya Sagar Ravipati */ 14261a5f3da2SVidya Sagar Ravipati struct ethtool_fecparam { 14271a5f3da2SVidya Sagar Ravipati __u32 cmd; 14281a5f3da2SVidya Sagar Ravipati /* bitmask of FEC modes */ 14291a5f3da2SVidya Sagar Ravipati __u32 active_fec; 14301a5f3da2SVidya Sagar Ravipati __u32 fec; 14311a5f3da2SVidya Sagar Ravipati __u32 reserved; 14321a5f3da2SVidya Sagar Ravipati }; 14331a5f3da2SVidya Sagar Ravipati 14341a5f3da2SVidya Sagar Ravipati /** 14351a5f3da2SVidya Sagar Ravipati * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration 1436d04feecaSJakub Kicinski * @ETHTOOL_FEC_NONE_BIT: FEC mode configuration is not supported. Should not 14376dbf94b2SJakub Kicinski * be used together with other bits. GET only. 1438d04feecaSJakub Kicinski * @ETHTOOL_FEC_AUTO_BIT: Select default/best FEC mode automatically, usually 1439d04feecaSJakub Kicinski * based link mode and SFP parameters read from module's 1440d04feecaSJakub Kicinski * EEPROM. This bit does _not_ mean autonegotiation. 1441d04feecaSJakub Kicinski * @ETHTOOL_FEC_OFF_BIT: No FEC Mode 1442d04feecaSJakub Kicinski * @ETHTOOL_FEC_RS_BIT: Reed-Solomon FEC Mode 1443d04feecaSJakub Kicinski * @ETHTOOL_FEC_BASER_BIT: Base-R/Reed-Solomon FEC Mode 1444d04feecaSJakub Kicinski * @ETHTOOL_FEC_LLRS_BIT: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet 14456dbf94b2SJakub Kicinski * Consortium) 14461a5f3da2SVidya Sagar Ravipati */ 14471a5f3da2SVidya Sagar Ravipati enum ethtool_fec_config_bits { 14481a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_NONE_BIT, 14491a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_AUTO_BIT, 14501a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_OFF_BIT, 14511a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_RS_BIT, 14521a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_BASER_BIT, 1453f623e597SAya Levin ETHTOOL_FEC_LLRS_BIT, 14541a5f3da2SVidya Sagar Ravipati }; 14551a5f3da2SVidya Sagar Ravipati 14561a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT) 14571a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT) 14581a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT) 14591a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT) 14601a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) 1461f623e597SAya Levin #define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT) 14621a5f3da2SVidya Sagar Ravipati 1463607ca46eSDavid Howells /* CMDs currently supported */ 14643f1ac7a7SDavid Decotigny #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings. 14653f1ac7a7SDavid Decotigny * Please use ETHTOOL_GLINKSETTINGS 14663f1ac7a7SDavid Decotigny */ 14673f1ac7a7SDavid Decotigny #define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings. 14683f1ac7a7SDavid Decotigny * Please use ETHTOOL_SLINKSETTINGS 14693f1ac7a7SDavid Decotigny */ 1470607ca46eSDavid Howells #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 1471607ca46eSDavid Howells #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 1472607ca46eSDavid Howells #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 1473607ca46eSDavid Howells #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 1474607ca46eSDavid Howells #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 1475607ca46eSDavid Howells #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 1476607ca46eSDavid Howells #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 1477607ca46eSDavid Howells /* Get link status for host, i.e. whether the interface *and* the 1478607ca46eSDavid Howells * physical port (if there is one) are up (ethtool_value). */ 1479607ca46eSDavid Howells #define ETHTOOL_GLINK 0x0000000a 1480607ca46eSDavid Howells #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 1481607ca46eSDavid Howells #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 1482607ca46eSDavid Howells #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 1483607ca46eSDavid Howells #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 1484607ca46eSDavid Howells #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 1485607ca46eSDavid Howells #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 1486607ca46eSDavid Howells #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 1487607ca46eSDavid Howells #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 1488607ca46eSDavid Howells #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 1489607ca46eSDavid Howells #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 1490607ca46eSDavid Howells #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 1491607ca46eSDavid Howells #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 1492607ca46eSDavid Howells #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 1493607ca46eSDavid Howells * (ethtool_value) */ 1494607ca46eSDavid Howells #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 1495607ca46eSDavid Howells * (ethtool_value). */ 1496607ca46eSDavid Howells #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 1497607ca46eSDavid Howells #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 1498607ca46eSDavid Howells #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 1499607ca46eSDavid Howells #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 1500607ca46eSDavid Howells #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 1501607ca46eSDavid Howells #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 1502607ca46eSDavid Howells #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ 1503607ca46eSDavid Howells #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ 1504607ca46eSDavid Howells #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 1505607ca46eSDavid Howells #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ 1506607ca46eSDavid Howells #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 1507607ca46eSDavid Howells #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 1508607ca46eSDavid Howells #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 1509607ca46eSDavid Howells #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 1510607ca46eSDavid Howells #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 1511607ca46eSDavid Howells 1512607ca46eSDavid Howells #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 1513607ca46eSDavid Howells #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 1514607ca46eSDavid Howells #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 1515607ca46eSDavid Howells #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 1516607ca46eSDavid Howells #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 1517607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 1518607ca46eSDavid Howells #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 1519607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 1520607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 1521607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 1522607ca46eSDavid Howells #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 1523607ca46eSDavid Howells #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 1524607ca46eSDavid Howells #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 1525607ca46eSDavid Howells #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */ 1526607ca46eSDavid Howells #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 1527607ca46eSDavid Howells #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 1528607ca46eSDavid Howells #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 1529607ca46eSDavid Howells 1530607ca46eSDavid Howells #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ 1531607ca46eSDavid Howells #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ 1532607ca46eSDavid Howells #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */ 1533607ca46eSDavid Howells #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */ 1534607ca46eSDavid Howells #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1535607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1536607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1537607ca46eSDavid Howells #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */ 1538607ca46eSDavid Howells #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */ 1539607ca46eSDavid Howells #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */ 1540607ca46eSDavid Howells #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ 1541607ca46eSDavid Howells #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ 1542607ca46eSDavid Howells 15433de0b592SVenkata Duvvuru #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */ 15443de0b592SVenkata Duvvuru #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ 1545f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */ 1546f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ 1547f3a40945SAndrew Lunn #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ 15483de0b592SVenkata Duvvuru 1549ac2c7ad0SKan Liang #define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */ 1550ac2c7ad0SKan Liang 15513f1ac7a7SDavid Decotigny #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ 15523f1ac7a7SDavid Decotigny #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ 15530d27f4e4SRaju Lakkaraju #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */ 15540d27f4e4SRaju Lakkaraju #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */ 15551a5f3da2SVidya Sagar Ravipati #define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */ 15561a5f3da2SVidya Sagar Ravipati #define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */ 15573f1ac7a7SDavid Decotigny 1558607ca46eSDavid Howells /* compatibility with older code */ 1559607ca46eSDavid Howells #define SPARC_ETH_GSET ETHTOOL_GSET 1560607ca46eSDavid Howells #define SPARC_ETH_SSET ETHTOOL_SSET 1561607ca46eSDavid Howells 15623f1ac7a7SDavid Decotigny /* Link mode bit indices */ 15633f1ac7a7SDavid Decotigny enum ethtool_link_mode_bit_indices { 15643f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0, 15653f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1, 15663f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2, 15673f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3, 15683f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4, 15693f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5, 15703f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Autoneg_BIT = 6, 15713f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_TP_BIT = 7, 15723f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_AUI_BIT = 8, 15733f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_MII_BIT = 9, 15743f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_FIBRE_BIT = 10, 15753f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_BNC_BIT = 11, 15763f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12, 15773f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Pause_BIT = 13, 15783f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14, 15793f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15, 15803f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Backplane_BIT = 16, 15813f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, 15823f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18, 15833f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, 15843f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20, 15853f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21, 15863f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22, 15873f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, 15883f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, 15893f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25, 15903f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26, 15913f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27, 15923f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, 15933f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, 15943f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, 15953851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31, 1596e728fdf0SHeiner Kallweit 1597e728fdf0SHeiner Kallweit /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit 1598e728fdf0SHeiner Kallweit * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* 1599e728fdf0SHeiner Kallweit * macro for bits > 31. The only way to use indices > 31 is to 1600e728fdf0SHeiner Kallweit * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. 1601e728fdf0SHeiner Kallweit */ 1602e728fdf0SHeiner Kallweit 16033851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32, 16043851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33, 16053851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34, 16063851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35, 16073851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36, 16083851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37, 16093851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38, 16103851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39, 161189da45b8SGal Pressman ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40, 16125711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41, 16135711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42, 16145711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43, 16155711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, 16165711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, 16175711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, 161894842b4fSPavel Belous ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, 161994842b4fSPavel Belous ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, 16205711a982SVidya Sagar Ravipati 16211a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49, 16221a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_RS_BIT = 50, 16231a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51, 16242736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 52, 16252736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 53, 16262736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 54, 16272736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 55, 16282736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 56, 16292736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 57, 16302736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 58, 16312736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 59, 16322736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60, 16332736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 61, 16342736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 62, 16352736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 63, 16362736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64, 16372736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65, 16382736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66, 1639b2557764SAndrew Lunn ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67, 1640b2557764SAndrew Lunn ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68, 164114af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 69, 164214af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 70, 164314af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71, 164414af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72, 164514af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73, 1646f623e597SAya Levin ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74, 1647065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75, 1648065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76, 1649065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77, 1650065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78, 1651065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79, 1652065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80, 1653065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81, 1654065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82, 1655065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83, 1656065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84, 1657065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85, 1658065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86, 1659065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87, 1660065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88, 1661065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89, 166255f13311SDan Murphy ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90, 166355f13311SDan Murphy ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91, 1664e728fdf0SHeiner Kallweit /* must be last entry */ 1665e728fdf0SHeiner Kallweit __ETHTOOL_LINK_MODE_MASK_NBITS 16663f1ac7a7SDavid Decotigny }; 16673f1ac7a7SDavid Decotigny 16683f1ac7a7SDavid Decotigny #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ 16693f1ac7a7SDavid Decotigny (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT)) 16703f1ac7a7SDavid Decotigny 16713f1ac7a7SDavid Decotigny /* DEPRECATED macros. Please migrate to 16723f1ac7a7SDavid Decotigny * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT 16733f1ac7a7SDavid Decotigny * define any new SUPPORTED_* macro for bits > 31. 16743f1ac7a7SDavid Decotigny */ 16753f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) 16763f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) 16773f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) 16783f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) 16793f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) 16803f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) 16813f1ac7a7SDavid Decotigny #define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) 16823f1ac7a7SDavid Decotigny #define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) 16833f1ac7a7SDavid Decotigny #define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) 16843f1ac7a7SDavid Decotigny #define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) 16853f1ac7a7SDavid Decotigny #define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) 16863f1ac7a7SDavid Decotigny #define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) 16873f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) 16883f1ac7a7SDavid Decotigny #define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) 16893f1ac7a7SDavid Decotigny #define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) 16903f1ac7a7SDavid Decotigny #define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) 16913f1ac7a7SDavid Decotigny #define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) 16923f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) 16933f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) 16943f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) 16953f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) 16963f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) 16973f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) 16983f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) 16993f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) 17003f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) 17013f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) 17023f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) 17033f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) 17043f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) 17053f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) 17063f1ac7a7SDavid Decotigny /* Please do not define any new SUPPORTED_* macro for bits > 31, see 17073f1ac7a7SDavid Decotigny * notice above. 17083f1ac7a7SDavid Decotigny */ 17093f1ac7a7SDavid Decotigny 17103f1ac7a7SDavid Decotigny /* 17113f1ac7a7SDavid Decotigny * DEPRECATED macros. Please migrate to 17123f1ac7a7SDavid Decotigny * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT 17133f1ac7a7SDavid Decotigny * define any new ADERTISE_* macro for bits > 31. 17143f1ac7a7SDavid Decotigny */ 17153f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) 17163f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) 17173f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) 17183f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) 17193f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) 17203f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) 17213f1ac7a7SDavid Decotigny #define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) 17223f1ac7a7SDavid Decotigny #define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) 17233f1ac7a7SDavid Decotigny #define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) 17243f1ac7a7SDavid Decotigny #define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) 17253f1ac7a7SDavid Decotigny #define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) 17263f1ac7a7SDavid Decotigny #define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) 17273f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) 17283f1ac7a7SDavid Decotigny #define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) 17293f1ac7a7SDavid Decotigny #define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) 17303f1ac7a7SDavid Decotigny #define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) 17313f1ac7a7SDavid Decotigny #define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) 17323f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) 17333f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) 17343f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) 17353f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) 17363f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) 17373f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) 17383f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) 17393f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) 17403f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) 17413f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) 17423f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) 17433f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) 17443f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) 17453f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) 17463f1ac7a7SDavid Decotigny /* Please do not define any new ADVERTISED_* macro for bits > 31, see 17473f1ac7a7SDavid Decotigny * notice above. 17483f1ac7a7SDavid Decotigny */ 1749607ca46eSDavid Howells 1750607ca46eSDavid Howells /* The following are all involved in forcing a particular link 1751607ca46eSDavid Howells * mode for the device for setting things. When getting the 1752607ca46eSDavid Howells * devices settings, these indicate the current mode and whether 1753607ca46eSDavid Howells * it was forced up into this mode or autonegotiated. 1754607ca46eSDavid Howells */ 1755607ca46eSDavid Howells 1756297fb414SNicolas Dichtel /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. 1757297fb414SNicolas Dichtel * Update drivers/net/phy/phy.c:phy_speed_to_str() and 1758297fb414SNicolas Dichtel * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. 1759297fb414SNicolas Dichtel */ 1760607ca46eSDavid Howells #define SPEED_10 10 1761607ca46eSDavid Howells #define SPEED_100 100 1762607ca46eSDavid Howells #define SPEED_1000 1000 1763607ca46eSDavid Howells #define SPEED_2500 2500 1764c9a70d43SParav Pandit #define SPEED_5000 5000 1765607ca46eSDavid Howells #define SPEED_10000 10000 17660d7e2d21SZhu Yanjun #define SPEED_14000 14000 1767dcf972a3SSaeed Mahameed #define SPEED_20000 20000 1768c9a70d43SParav Pandit #define SPEED_25000 25000 1769dcf972a3SSaeed Mahameed #define SPEED_40000 40000 1770c9a70d43SParav Pandit #define SPEED_50000 50000 1771dcf972a3SSaeed Mahameed #define SPEED_56000 56000 1772c9a70d43SParav Pandit #define SPEED_100000 100000 17732736d94fSAya Levin #define SPEED_200000 200000 177414af7fd1SJiri Pirko #define SPEED_400000 400000 1775dcf972a3SSaeed Mahameed 1776607ca46eSDavid Howells #define SPEED_UNKNOWN -1 1777607ca46eSDavid Howells 1778103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_speed(__u32 speed) 1779103a8ad1SNikolay Aleksandrov { 1780afe64245SMichael Zhivich return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN; 1781103a8ad1SNikolay Aleksandrov } 1782103a8ad1SNikolay Aleksandrov 1783607ca46eSDavid Howells /* Duplex, half or full. */ 1784607ca46eSDavid Howells #define DUPLEX_HALF 0x00 1785607ca46eSDavid Howells #define DUPLEX_FULL 0x01 1786607ca46eSDavid Howells #define DUPLEX_UNKNOWN 0xff 1787607ca46eSDavid Howells 1788103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_duplex(__u8 duplex) 1789103a8ad1SNikolay Aleksandrov { 1790103a8ad1SNikolay Aleksandrov switch (duplex) { 1791103a8ad1SNikolay Aleksandrov case DUPLEX_HALF: 1792103a8ad1SNikolay Aleksandrov case DUPLEX_FULL: 1793103a8ad1SNikolay Aleksandrov case DUPLEX_UNKNOWN: 1794103a8ad1SNikolay Aleksandrov return 1; 1795103a8ad1SNikolay Aleksandrov } 1796103a8ad1SNikolay Aleksandrov 1797103a8ad1SNikolay Aleksandrov return 0; 1798103a8ad1SNikolay Aleksandrov } 1799103a8ad1SNikolay Aleksandrov 1800bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_UNSUPPORTED 0 1801bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_UNKNOWN 1 1802bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_MASTER_PREFERRED 2 1803bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_SLAVE_PREFERRED 3 1804bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_MASTER_FORCE 4 1805bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_SLAVE_FORCE 5 1806bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_UNSUPPORTED 0 1807bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_UNKNOWN 1 1808bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_MASTER 2 1809bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_SLAVE 3 1810bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_ERR 4 1811bdbdac76SOleksij Rempel 1812607ca46eSDavid Howells /* Which connector port. */ 1813607ca46eSDavid Howells #define PORT_TP 0x00 1814607ca46eSDavid Howells #define PORT_AUI 0x01 1815607ca46eSDavid Howells #define PORT_MII 0x02 1816607ca46eSDavid Howells #define PORT_FIBRE 0x03 1817607ca46eSDavid Howells #define PORT_BNC 0x04 1818607ca46eSDavid Howells #define PORT_DA 0x05 1819607ca46eSDavid Howells #define PORT_NONE 0xef 1820607ca46eSDavid Howells #define PORT_OTHER 0xff 1821607ca46eSDavid Howells 1822607ca46eSDavid Howells /* Which transceiver to use. */ 18237ec87211SFlorian Fainelli #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */ 18247ec87211SFlorian Fainelli #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */ 1825607ca46eSDavid Howells #define XCVR_DUMMY1 0x02 1826607ca46eSDavid Howells #define XCVR_DUMMY2 0x03 1827607ca46eSDavid Howells #define XCVR_DUMMY3 0x04 1828607ca46eSDavid Howells 1829bf8fc60aSBen Hutchings /* Enable or disable autonegotiation. */ 1830607ca46eSDavid Howells #define AUTONEG_DISABLE 0x00 1831607ca46eSDavid Howells #define AUTONEG_ENABLE 0x01 1832607ca46eSDavid Howells 1833607ca46eSDavid Howells /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then 1834607ca46eSDavid Howells * the driver is required to renegotiate link 1835607ca46eSDavid Howells */ 1836607ca46eSDavid Howells #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */ 1837607ca46eSDavid Howells #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */ 1838607ca46eSDavid Howells #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */ 1839607ca46eSDavid Howells #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */ 1840607ca46eSDavid Howells 1841607ca46eSDavid Howells /* Wake-On-Lan options. */ 1842607ca46eSDavid Howells #define WAKE_PHY (1 << 0) 1843607ca46eSDavid Howells #define WAKE_UCAST (1 << 1) 1844607ca46eSDavid Howells #define WAKE_MCAST (1 << 2) 1845607ca46eSDavid Howells #define WAKE_BCAST (1 << 3) 1846607ca46eSDavid Howells #define WAKE_ARP (1 << 4) 1847607ca46eSDavid Howells #define WAKE_MAGIC (1 << 5) 1848607ca46eSDavid Howells #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ 18496cfef793SFlorian Fainelli #define WAKE_FILTER (1 << 7) 1850607ca46eSDavid Howells 185151ea22b0SMichal Kubecek #define WOL_MODE_COUNT 8 185251ea22b0SMichal Kubecek 1853607ca46eSDavid Howells /* L2-L4 network traffic flow types */ 1854607ca46eSDavid Howells #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ 1855607ca46eSDavid Howells #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ 1856607ca46eSDavid Howells #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ 1857607ca46eSDavid Howells #define AH_ESP_V4_FLOW 0x04 /* hash only */ 185872bb6872SEdward Cree #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */ 185972bb6872SEdward Cree #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */ 186072bb6872SEdward Cree #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */ 1861607ca46eSDavid Howells #define AH_ESP_V6_FLOW 0x08 /* hash only */ 1862607ca46eSDavid Howells #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ 1863607ca46eSDavid Howells #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ 186472bb6872SEdward Cree #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */ 186572bb6872SEdward Cree #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */ 186672bb6872SEdward Cree #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ 186772bb6872SEdward Cree #define IP_USER_FLOW IPV4_USER_FLOW 186872bb6872SEdward Cree #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */ 1869607ca46eSDavid Howells #define IPV4_FLOW 0x10 /* hash only */ 1870607ca46eSDavid Howells #define IPV6_FLOW 0x11 /* hash only */ 1871607ca46eSDavid Howells #define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 1872607ca46eSDavid Howells /* Flag to enable additional fields in struct ethtool_rx_flow_spec */ 1873607ca46eSDavid Howells #define FLOW_EXT 0x80000000 1874d4676eacSYan Burman #define FLOW_MAC_EXT 0x40000000 187584a1d9c4SEdward Cree /* Flag to enable RSS spreading of traffic matching rule (nfc only) */ 187684a1d9c4SEdward Cree #define FLOW_RSS 0x20000000 1877607ca46eSDavid Howells 1878607ca46eSDavid Howells /* L3-L4 network traffic flow hash options */ 1879607ca46eSDavid Howells #define RXH_L2DA (1 << 1) 1880607ca46eSDavid Howells #define RXH_VLAN (1 << 2) 1881607ca46eSDavid Howells #define RXH_L3_PROTO (1 << 3) 1882607ca46eSDavid Howells #define RXH_IP_SRC (1 << 4) 1883607ca46eSDavid Howells #define RXH_IP_DST (1 << 5) 1884607ca46eSDavid Howells #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ 1885607ca46eSDavid Howells #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ 1886607ca46eSDavid Howells #define RXH_DISCARD (1 << 31) 1887607ca46eSDavid Howells 1888607ca46eSDavid Howells #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 18896cfef793SFlorian Fainelli #define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL 1890607ca46eSDavid Howells 1891607ca46eSDavid Howells /* Special RX classification rule insert location values */ 1892607ca46eSDavid Howells #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */ 1893607ca46eSDavid Howells #define RX_CLS_LOC_ANY 0xffffffff 1894607ca46eSDavid Howells #define RX_CLS_LOC_FIRST 0xfffffffe 1895607ca46eSDavid Howells #define RX_CLS_LOC_LAST 0xfffffffd 1896607ca46eSDavid Howells 1897607ca46eSDavid Howells /* EEPROM Standards for plug in modules */ 1898607ca46eSDavid Howells #define ETH_MODULE_SFF_8079 0x1 1899607ca46eSDavid Howells #define ETH_MODULE_SFF_8079_LEN 256 1900607ca46eSDavid Howells #define ETH_MODULE_SFF_8472 0x2 1901607ca46eSDavid Howells #define ETH_MODULE_SFF_8472_LEN 512 19027202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636 0x3 19037202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636_LEN 256 19047202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436 0x4 19057202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436_LEN 256 1906607ca46eSDavid Howells 19070e1a2a3eSErez Alfasi #define ETH_MODULE_SFF_8636_MAX_LEN 640 19080e1a2a3eSErez Alfasi #define ETH_MODULE_SFF_8436_MAX_LEN 640 19090e1a2a3eSErez Alfasi 1910607ca46eSDavid Howells /* Reset flags */ 1911607ca46eSDavid Howells /* The reset() operation must clear the flags for the components which 1912607ca46eSDavid Howells * were actually reset. On successful return, the flags indicate the 1913607ca46eSDavid Howells * components which were not reset, either because they do not exist 1914607ca46eSDavid Howells * in the hardware or because they cannot be reset independently. The 1915607ca46eSDavid Howells * driver must never reset any components that were not requested. 1916607ca46eSDavid Howells */ 1917607ca46eSDavid Howells enum ethtool_reset_flags { 1918607ca46eSDavid Howells /* These flags represent components dedicated to the interface 1919607ca46eSDavid Howells * the command is addressed to. Shift any flag left by 1920607ca46eSDavid Howells * ETH_RESET_SHARED_SHIFT to reset a shared component of the 1921607ca46eSDavid Howells * same type. 1922607ca46eSDavid Howells */ 1923607ca46eSDavid Howells ETH_RESET_MGMT = 1 << 0, /* Management processor */ 1924607ca46eSDavid Howells ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ 1925607ca46eSDavid Howells ETH_RESET_DMA = 1 << 2, /* DMA engine */ 1926607ca46eSDavid Howells ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ 1927607ca46eSDavid Howells ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ 1928607ca46eSDavid Howells ETH_RESET_MAC = 1 << 5, /* Media access controller */ 1929607ca46eSDavid Howells ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ 1930607ca46eSDavid Howells ETH_RESET_RAM = 1 << 7, /* RAM shared between 1931607ca46eSDavid Howells * multiple components */ 193240e44a1eSScott Branden ETH_RESET_AP = 1 << 8, /* Application processor */ 1933607ca46eSDavid Howells 1934607ca46eSDavid Howells ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to 1935607ca46eSDavid Howells * this interface */ 1936607ca46eSDavid Howells ETH_RESET_ALL = 0xffffffff, /* All components used by this 1937607ca46eSDavid Howells * interface, even if shared */ 1938607ca46eSDavid Howells }; 1939607ca46eSDavid Howells #define ETH_RESET_SHARED_SHIFT 16 1940607ca46eSDavid Howells 19413f1ac7a7SDavid Decotigny 19423f1ac7a7SDavid Decotigny /** 19433f1ac7a7SDavid Decotigny * struct ethtool_link_settings - link control and status 19443f1ac7a7SDavid Decotigny * 19453f1ac7a7SDavid Decotigny * IMPORTANT, Backward compatibility notice: When implementing new 19463f1ac7a7SDavid Decotigny * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and 19473f1ac7a7SDavid Decotigny * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link 19483f1ac7a7SDavid Decotigny * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS 19493f1ac7a7SDavid Decotigny * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in 19503f1ac7a7SDavid Decotigny * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use 19513f1ac7a7SDavid Decotigny * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link 19523f1ac7a7SDavid Decotigny * settings; do not use %ETHTOOL_SLINKSETTINGS if 19533f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS failed: stick to 19543f1ac7a7SDavid Decotigny * %ETHTOOL_GSET/%ETHTOOL_SSET in that case. 19553f1ac7a7SDavid Decotigny * 19563f1ac7a7SDavid Decotigny * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS 19573f1ac7a7SDavid Decotigny * @speed: Link speed (Mbps) 19583f1ac7a7SDavid Decotigny * @duplex: Duplex mode; one of %DUPLEX_* 19593f1ac7a7SDavid Decotigny * @port: Physical connector type; one of %PORT_* 19603f1ac7a7SDavid Decotigny * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not 19613f1ac7a7SDavid Decotigny * applicable. For clause 45 PHYs this is the PRTAD. 19623f1ac7a7SDavid Decotigny * @autoneg: Enable/disable autonegotiation and auto-detection; 19633f1ac7a7SDavid Decotigny * either %AUTONEG_DISABLE or %AUTONEG_ENABLE 19643f1ac7a7SDavid Decotigny * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO 19653f1ac7a7SDavid Decotigny * protocols supported by the interface; 0 if unknown. 19663f1ac7a7SDavid Decotigny * Read-only. 19673f1ac7a7SDavid Decotigny * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of 19683f1ac7a7SDavid Decotigny * %ETH_TP_MDI_*. If the status is unknown or not applicable, the 19693f1ac7a7SDavid Decotigny * value will be %ETH_TP_MDI_INVALID. Read-only. 19703f1ac7a7SDavid Decotigny * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of 19713f1ac7a7SDavid Decotigny * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads 19723f1ac7a7SDavid Decotigny * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. 19733f1ac7a7SDavid Decotigny * When written successfully, the link should be renegotiated if 19743f1ac7a7SDavid Decotigny * necessary. 19753f1ac7a7SDavid Decotigny * @link_mode_masks_nwords: Number of 32-bit words for each of the 19763f1ac7a7SDavid Decotigny * supported, advertising, lp_advertising link mode bitmaps. For 19773f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user 19783f1ac7a7SDavid Decotigny * (>= 0); on return, if handshake in progress, negative if 19793f1ac7a7SDavid Decotigny * request size unsupported by kernel: absolute value indicates 19805f2d4724SDavid Decotigny * kernel expected size and all the other fields but cmd 19815f2d4724SDavid Decotigny * are 0; otherwise (handshake completed), strictly positive 19825f2d4724SDavid Decotigny * to indicate size used by kernel and cmd field stays 19833f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For 19843f1ac7a7SDavid Decotigny * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive 19853f1ac7a7SDavid Decotigny * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise 19863f1ac7a7SDavid Decotigny * refused. For drivers: ignore this field (use kernel's 19873f1ac7a7SDavid Decotigny * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will 19883f1ac7a7SDavid Decotigny * be overwritten by kernel. 19893f1ac7a7SDavid Decotigny * @supported: Bitmap with each bit meaning given by 19903f1ac7a7SDavid Decotigny * %ethtool_link_mode_bit_indices for the link modes, physical 19913f1ac7a7SDavid Decotigny * connectors and other link features for which the interface 19923f1ac7a7SDavid Decotigny * supports autonegotiation or auto-detection. Read-only. 19933f1ac7a7SDavid Decotigny * @advertising: Bitmap with each bit meaning given by 19943f1ac7a7SDavid Decotigny * %ethtool_link_mode_bit_indices for the link modes, physical 19953f1ac7a7SDavid Decotigny * connectors and other link features that are advertised through 19963f1ac7a7SDavid Decotigny * autonegotiation or enabled for auto-detection. 19973f1ac7a7SDavid Decotigny * @lp_advertising: Bitmap with each bit meaning given by 19983f1ac7a7SDavid Decotigny * %ethtool_link_mode_bit_indices for the link modes, and other 19993f1ac7a7SDavid Decotigny * link features that the link partner advertised through 20003f1ac7a7SDavid Decotigny * autonegotiation; 0 if unknown or not applicable. Read-only. 200119cab887SFlorian Fainelli * @transceiver: Used to distinguish different possible PHY types, 200219cab887SFlorian Fainelli * reported consistently by PHYLIB. Read-only. 2003d9c65de0SJakub Kicinski * @master_slave_cfg: Master/slave port mode. 2004d9c65de0SJakub Kicinski * @master_slave_state: Master/slave port state. 200583e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 200683e5feebSJakub Kicinski * @reserved1: Reserved for future use; see the note on reserved space. 2007d9c65de0SJakub Kicinski * @link_mode_masks: Variable length bitmaps. 20083f1ac7a7SDavid Decotigny * 20093f1ac7a7SDavid Decotigny * If autonegotiation is disabled, the speed and @duplex represent the 20103f1ac7a7SDavid Decotigny * fixed link mode and are writable if the driver supports multiple 20113f1ac7a7SDavid Decotigny * link modes. If it is enabled then they are read-only; if the link 20123f1ac7a7SDavid Decotigny * is up they represent the negotiated link mode; if the link is down, 20133f1ac7a7SDavid Decotigny * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and 20143f1ac7a7SDavid Decotigny * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. 20153f1ac7a7SDavid Decotigny * 20163f1ac7a7SDavid Decotigny * Some hardware interfaces may have multiple PHYs and/or physical 20173f1ac7a7SDavid Decotigny * connectors fitted or do not allow the driver to detect which are 20183f1ac7a7SDavid Decotigny * fitted. For these interfaces @port and/or @phy_address may be 20193f1ac7a7SDavid Decotigny * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. 20203f1ac7a7SDavid Decotigny * Otherwise, attempts to write different values may be ignored or 20213f1ac7a7SDavid Decotigny * rejected. 20223f1ac7a7SDavid Decotigny * 20233f1ac7a7SDavid Decotigny * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt 20249b300495SMichal Kubecek * are not available in %ethtool_link_settings. These fields will be 20259b300495SMichal Kubecek * always set to zero in %ETHTOOL_GSET reply and %ETHTOOL_SSET will 20269b300495SMichal Kubecek * fail if any of them is set to non-zero value. 20273f1ac7a7SDavid Decotigny * 20283f1ac7a7SDavid Decotigny * Users should assume that all fields not marked read-only are 20293f1ac7a7SDavid Decotigny * writable and subject to validation by the driver. They should use 20303f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS to get the current values before making specific 20313f1ac7a7SDavid Decotigny * changes and then applying them with %ETHTOOL_SLINKSETTINGS. 20323f1ac7a7SDavid Decotigny * 20333f1ac7a7SDavid Decotigny * Drivers that implement %get_link_ksettings and/or 20343f1ac7a7SDavid Decotigny * %set_link_ksettings should ignore the @cmd 20353f1ac7a7SDavid Decotigny * and @link_mode_masks_nwords fields (any change to them overwritten 20363f1ac7a7SDavid Decotigny * by kernel), and rely only on kernel's internal 20373f1ac7a7SDavid Decotigny * %__ETHTOOL_LINK_MODE_MASK_NBITS and 20383f1ac7a7SDavid Decotigny * %ethtool_link_mode_mask_t. Drivers that implement 20393f1ac7a7SDavid Decotigny * %set_link_ksettings() should validate all fields other than @cmd 20403f1ac7a7SDavid Decotigny * and @link_mode_masks_nwords that are not described as read-only or 20413f1ac7a7SDavid Decotigny * deprecated, and must ignore all fields described as read-only. 20423f1ac7a7SDavid Decotigny */ 20433f1ac7a7SDavid Decotigny struct ethtool_link_settings { 20443f1ac7a7SDavid Decotigny __u32 cmd; 20453f1ac7a7SDavid Decotigny __u32 speed; 20463f1ac7a7SDavid Decotigny __u8 duplex; 20473f1ac7a7SDavid Decotigny __u8 port; 20483f1ac7a7SDavid Decotigny __u8 phy_address; 20493f1ac7a7SDavid Decotigny __u8 autoneg; 20503f1ac7a7SDavid Decotigny __u8 mdio_support; 20513f1ac7a7SDavid Decotigny __u8 eth_tp_mdix; 20523f1ac7a7SDavid Decotigny __u8 eth_tp_mdix_ctrl; 20533f1ac7a7SDavid Decotigny __s8 link_mode_masks_nwords; 205419cab887SFlorian Fainelli __u8 transceiver; 2055bdbdac76SOleksij Rempel __u8 master_slave_cfg; 2056bdbdac76SOleksij Rempel __u8 master_slave_state; 2057bdbdac76SOleksij Rempel __u8 reserved1[1]; 205819cab887SFlorian Fainelli __u32 reserved[7]; 20593f1ac7a7SDavid Decotigny __u32 link_mode_masks[0]; 20603f1ac7a7SDavid Decotigny /* layout of link_mode_masks fields: 20613f1ac7a7SDavid Decotigny * __u32 map_supported[link_mode_masks_nwords]; 20623f1ac7a7SDavid Decotigny * __u32 map_advertising[link_mode_masks_nwords]; 20633f1ac7a7SDavid Decotigny * __u32 map_lp_advertising[link_mode_masks_nwords]; 20643f1ac7a7SDavid Decotigny */ 20653f1ac7a7SDavid Decotigny }; 2066607ca46eSDavid Howells #endif /* _UAPI_LINUX_ETHTOOL_H */ 2067