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 (davem@redhat.com) 6607ca46eSDavid Howells * Copyright 2001 Jeff Garzik <jgarzik@pobox.com> 7607ca46eSDavid Howells * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) 8607ca46eSDavid Howells * Portions Copyright 2002 Intel (eli.kupermann@intel.com, 9607ca46eSDavid Howells * christopher.leech@intel.com, 10607ca46eSDavid Howells * scott.feldman@intel.com) 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 162f20a0a05SVincent Mailhol * @fw_version: Firmware version string; driver defined; may be an 163f20a0a05SVincent Mailhol * empty string 164f20a0a05SVincent Mailhol * @erom_version: Expansion ROM version string; driver defined; may be 165f20a0a05SVincent Mailhol * an empty string 166daba1b6bSBen Hutchings * @bus_info: Device bus address. This should match the dev_name() 167daba1b6bSBen Hutchings * string for the underlying bus device, if there is one. May be 168daba1b6bSBen Hutchings * an empty string. 16983e5feebSJakub Kicinski * @reserved2: Reserved for future use; see the note on reserved space. 170daba1b6bSBen Hutchings * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and 171daba1b6bSBen Hutchings * %ETHTOOL_SPFLAGS commands; also the number of strings in the 172daba1b6bSBen Hutchings * %ETH_SS_PRIV_FLAGS set 173daba1b6bSBen Hutchings * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS 174daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_STATS set 175daba1b6bSBen Hutchings * @testinfo_len: Number of results returned by the %ETHTOOL_TEST 176daba1b6bSBen Hutchings * command; also the number of strings in the %ETH_SS_TEST set 177daba1b6bSBen Hutchings * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM 178daba1b6bSBen Hutchings * and %ETHTOOL_SEEPROM commands, in bytes 179daba1b6bSBen Hutchings * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS 180daba1b6bSBen Hutchings * command, in bytes 181daba1b6bSBen Hutchings * 182daba1b6bSBen Hutchings * Users can use the %ETHTOOL_GSSET_INFO command to get the number of 183daba1b6bSBen Hutchings * strings in any string set (from Linux 2.6.34). 184daba1b6bSBen Hutchings */ 185607ca46eSDavid Howells struct ethtool_drvinfo { 186607ca46eSDavid Howells __u32 cmd; 187daba1b6bSBen Hutchings char driver[32]; 188daba1b6bSBen Hutchings char version[32]; 189daba1b6bSBen Hutchings char fw_version[ETHTOOL_FWVERS_LEN]; 190daba1b6bSBen Hutchings char bus_info[ETHTOOL_BUSINFO_LEN]; 191a4505152SHariprasad Shenai char erom_version[ETHTOOL_EROMVERS_LEN]; 192607ca46eSDavid Howells char reserved2[12]; 193daba1b6bSBen Hutchings __u32 n_priv_flags; 194daba1b6bSBen Hutchings __u32 n_stats; 195607ca46eSDavid Howells __u32 testinfo_len; 196daba1b6bSBen Hutchings __u32 eedump_len; 197daba1b6bSBen Hutchings __u32 regdump_len; 198607ca46eSDavid Howells }; 199607ca46eSDavid Howells 200607ca46eSDavid Howells #define SOPASS_MAX 6 20102d59f3fSBen Hutchings 20202d59f3fSBen Hutchings /** 20302d59f3fSBen Hutchings * struct ethtool_wolinfo - Wake-On-Lan configuration 20402d59f3fSBen Hutchings * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL 20502d59f3fSBen Hutchings * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes. 20602d59f3fSBen Hutchings * Read-only. 20702d59f3fSBen Hutchings * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes. 20802d59f3fSBen Hutchings * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE 20902d59f3fSBen Hutchings * is set in @wolopts. 21002d59f3fSBen Hutchings */ 211607ca46eSDavid Howells struct ethtool_wolinfo { 212607ca46eSDavid Howells __u32 cmd; 213607ca46eSDavid Howells __u32 supported; 214607ca46eSDavid Howells __u32 wolopts; 21502d59f3fSBen Hutchings __u8 sopass[SOPASS_MAX]; 216607ca46eSDavid Howells }; 217607ca46eSDavid Howells 218607ca46eSDavid Howells /* for passing single values */ 219607ca46eSDavid Howells struct ethtool_value { 220607ca46eSDavid Howells __u32 cmd; 221607ca46eSDavid Howells __u32 data; 222607ca46eSDavid Howells }; 223607ca46eSDavid Howells 224e1577c1cSInbar Karmy #define PFC_STORM_PREVENTION_AUTO 0xffff 225e1577c1cSInbar Karmy #define PFC_STORM_PREVENTION_DISABLE 0 226e1577c1cSInbar Karmy 227f0db9b07SGovindarajulu Varadarajan enum tunable_id { 228f0db9b07SGovindarajulu Varadarajan ETHTOOL_ID_UNSPEC, 229f0db9b07SGovindarajulu Varadarajan ETHTOOL_RX_COPYBREAK, 2301255a505SEric Dumazet ETHTOOL_TX_COPYBREAK, 231e1577c1cSInbar Karmy ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */ 232448f413aSHao Chen ETHTOOL_TX_COPYBREAK_BUF_SIZE, 233a4244b0cSHadar Hen Zion /* 234c3086637SMichael Heimpold * Add your fresh new tunable attribute above and remember to update 2352d8ea148SJian Shen * tunable_strings[] in net/ethtool/common.c 236a4244b0cSHadar Hen Zion */ 237a4244b0cSHadar Hen Zion __ETHTOOL_TUNABLE_COUNT, 238f0db9b07SGovindarajulu Varadarajan }; 239f0db9b07SGovindarajulu Varadarajan 240f0db9b07SGovindarajulu Varadarajan enum tunable_type_id { 241f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_UNSPEC, 242f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U8, 243f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U16, 244f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U32, 245f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_U64, 246f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_STRING, 247f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S8, 248f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S16, 249f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S32, 250f0db9b07SGovindarajulu Varadarajan ETHTOOL_TUNABLE_S64, 251f0db9b07SGovindarajulu Varadarajan }; 252f0db9b07SGovindarajulu Varadarajan 253f0db9b07SGovindarajulu Varadarajan struct ethtool_tunable { 254f0db9b07SGovindarajulu Varadarajan __u32 cmd; 255f0db9b07SGovindarajulu Varadarajan __u32 id; 256f0db9b07SGovindarajulu Varadarajan __u32 type_id; 257f0db9b07SGovindarajulu Varadarajan __u32 len; 25894dfc73eSGustavo A. R. Silva void *data[]; 259f0db9b07SGovindarajulu Varadarajan }; 260f0db9b07SGovindarajulu Varadarajan 261607c7029SRaju Lakkaraju #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff 262607c7029SRaju Lakkaraju #define DOWNSHIFT_DEV_DISABLE 0 263607c7029SRaju Lakkaraju 2643aeb0803SHeiner Kallweit /* Time in msecs after which link is reported as down 2653aeb0803SHeiner Kallweit * 0 = lowest time supported by the PHY 2663aeb0803SHeiner Kallweit * 0xff = off, link down detection according to standard 2673aeb0803SHeiner Kallweit */ 2683aeb0803SHeiner Kallweit #define ETHTOOL_PHY_FAST_LINK_DOWN_ON 0 2693aeb0803SHeiner Kallweit #define ETHTOOL_PHY_FAST_LINK_DOWN_OFF 0xff 2703aeb0803SHeiner Kallweit 2719f2f13f4SAlexandru Ardelean /* Energy Detect Power Down (EDPD) is a feature supported by some PHYs, where 2729f2f13f4SAlexandru Ardelean * the PHY's RX & TX blocks are put into a low-power mode when there is no 2739f2f13f4SAlexandru Ardelean * link detected (typically cable is un-plugged). For RX, only a minimal 2749f2f13f4SAlexandru Ardelean * link-detection is available, and for TX the PHY wakes up to send link pulses 2759f2f13f4SAlexandru Ardelean * to avoid any lock-ups in case the peer PHY may also be running in EDPD mode. 2769f2f13f4SAlexandru Ardelean * 2779f2f13f4SAlexandru Ardelean * Some PHYs may support configuration of the wake-up interval for TX pulses, 2789f2f13f4SAlexandru Ardelean * and some PHYs may support only disabling TX pulses entirely. For the latter 2799f2f13f4SAlexandru Ardelean * a special value is required (ETHTOOL_PHY_EDPD_NO_TX) so that this can be 2809f2f13f4SAlexandru Ardelean * configured from userspace (should the user want it). 2819f2f13f4SAlexandru Ardelean * 2829f2f13f4SAlexandru Ardelean * The interval units for TX wake-up are in milliseconds, since this should 2839f2f13f4SAlexandru Ardelean * cover a reasonable range of intervals: 2849f2f13f4SAlexandru Ardelean * - from 1 millisecond, which does not sound like much of a power-saver 2859f2f13f4SAlexandru Ardelean * - to ~65 seconds which is quite a lot to wait for a link to come up when 2869f2f13f4SAlexandru Ardelean * plugging a cable 2879f2f13f4SAlexandru Ardelean */ 2889f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_DFLT_TX_MSECS 0xffff 2899f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_NO_TX 0xfffe 2909f2f13f4SAlexandru Ardelean #define ETHTOOL_PHY_EDPD_DISABLE 0 2919f2f13f4SAlexandru Ardelean 2920d27f4e4SRaju Lakkaraju enum phy_tunable_id { 2930d27f4e4SRaju Lakkaraju ETHTOOL_PHY_ID_UNSPEC, 294607c7029SRaju Lakkaraju ETHTOOL_PHY_DOWNSHIFT, 2953aeb0803SHeiner Kallweit ETHTOOL_PHY_FAST_LINK_DOWN, 2969f2f13f4SAlexandru Ardelean ETHTOOL_PHY_EDPD, 2970d27f4e4SRaju Lakkaraju /* 2980d27f4e4SRaju Lakkaraju * Add your fresh new phy tunable attribute above and remember to update 2992d8ea148SJian Shen * phy_tunable_strings[] in net/ethtool/common.c 3000d27f4e4SRaju Lakkaraju */ 3010d27f4e4SRaju Lakkaraju __ETHTOOL_PHY_TUNABLE_COUNT, 3020d27f4e4SRaju Lakkaraju }; 3030d27f4e4SRaju Lakkaraju 30409fb8bb0SBen Hutchings /** 30509fb8bb0SBen Hutchings * struct ethtool_regs - hardware register dump 30609fb8bb0SBen Hutchings * @cmd: Command number = %ETHTOOL_GREGS 30709fb8bb0SBen Hutchings * @version: Dump format version. This is driver-specific and may 30809fb8bb0SBen Hutchings * distinguish different chips/revisions. Drivers must use new 30909fb8bb0SBen Hutchings * version numbers whenever the dump format changes in an 31009fb8bb0SBen Hutchings * incompatible way. 31109fb8bb0SBen Hutchings * @len: On entry, the real length of @data. On return, the number of 31209fb8bb0SBen Hutchings * bytes used. 31309fb8bb0SBen Hutchings * @data: Buffer for the register dump 31409fb8bb0SBen Hutchings * 31509fb8bb0SBen Hutchings * Users should use %ETHTOOL_GDRVINFO to find the maximum length of 31609fb8bb0SBen Hutchings * a register dump for the interface. They must allocate the buffer 31709fb8bb0SBen Hutchings * immediately following this structure. 31809fb8bb0SBen Hutchings */ 319607ca46eSDavid Howells struct ethtool_regs { 320607ca46eSDavid Howells __u32 cmd; 32109fb8bb0SBen Hutchings __u32 version; 32209fb8bb0SBen Hutchings __u32 len; 32394dfc73eSGustavo A. R. Silva __u8 data[]; 324607ca46eSDavid Howells }; 325607ca46eSDavid Howells 326c8364a63SBen Hutchings /** 327c8364a63SBen Hutchings * struct ethtool_eeprom - EEPROM dump 328c8364a63SBen Hutchings * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or 329c8364a63SBen Hutchings * %ETHTOOL_SEEPROM 330c8364a63SBen Hutchings * @magic: A 'magic cookie' value to guard against accidental changes. 331c8364a63SBen Hutchings * The value passed in to %ETHTOOL_SEEPROM must match the value 332c8364a63SBen Hutchings * returned by %ETHTOOL_GEEPROM for the same device. This is 333c8364a63SBen Hutchings * unused when @cmd is %ETHTOOL_GMODULEEEPROM. 334c8364a63SBen Hutchings * @offset: Offset within the EEPROM to begin reading/writing, in bytes 335c8364a63SBen Hutchings * @len: On entry, number of bytes to read/write. On successful 336c8364a63SBen Hutchings * return, number of bytes actually read/written. In case of 337c8364a63SBen Hutchings * error, this may indicate at what point the error occurred. 338c8364a63SBen Hutchings * @data: Buffer to read/write from 339c8364a63SBen Hutchings * 340c8364a63SBen Hutchings * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find 341c8364a63SBen Hutchings * the length of an on-board or module EEPROM, respectively. They 342c8364a63SBen Hutchings * must allocate the buffer immediately following this structure. 343c8364a63SBen Hutchings */ 344607ca46eSDavid Howells struct ethtool_eeprom { 345607ca46eSDavid Howells __u32 cmd; 346607ca46eSDavid Howells __u32 magic; 347c8364a63SBen Hutchings __u32 offset; 348c8364a63SBen Hutchings __u32 len; 34994dfc73eSGustavo A. R. Silva __u8 data[]; 350607ca46eSDavid Howells }; 351607ca46eSDavid Howells 352607ca46eSDavid Howells /** 353607ca46eSDavid Howells * struct ethtool_eee - Energy Efficient Ethernet information 354607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}EEE 355607ca46eSDavid Howells * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations 356607ca46eSDavid Howells * for which there is EEE support. 357607ca46eSDavid Howells * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations 358607ca46eSDavid Howells * advertised as eee capable. 359607ca46eSDavid Howells * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex 360607ca46eSDavid Howells * combinations advertised by the link partner as eee capable. 361607ca46eSDavid Howells * @eee_active: Result of the eee auto negotiation. 362607ca46eSDavid Howells * @eee_enabled: EEE configured mode (enabled/disabled). 363607ca46eSDavid Howells * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given 364607ca46eSDavid Howells * that eee was negotiated. 365607ca46eSDavid Howells * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting 366607ca46eSDavid Howells * its tx lpi (after reaching 'idle' state). Effective only when eee 367607ca46eSDavid Howells * was negotiated and tx_lpi_enabled was set. 36883e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 369607ca46eSDavid Howells */ 370607ca46eSDavid Howells struct ethtool_eee { 371607ca46eSDavid Howells __u32 cmd; 372607ca46eSDavid Howells __u32 supported; 373607ca46eSDavid Howells __u32 advertised; 374607ca46eSDavid Howells __u32 lp_advertised; 375607ca46eSDavid Howells __u32 eee_active; 376607ca46eSDavid Howells __u32 eee_enabled; 377607ca46eSDavid Howells __u32 tx_lpi_enabled; 378607ca46eSDavid Howells __u32 tx_lpi_timer; 379607ca46eSDavid Howells __u32 reserved[2]; 380607ca46eSDavid Howells }; 381607ca46eSDavid Howells 382607ca46eSDavid Howells /** 383607ca46eSDavid Howells * struct ethtool_modinfo - plugin module eeprom information 384607ca46eSDavid Howells * @cmd: %ETHTOOL_GMODULEINFO 385607ca46eSDavid Howells * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx 386607ca46eSDavid Howells * @eeprom_len: Length of the eeprom 38783e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 388607ca46eSDavid Howells * 389607ca46eSDavid Howells * This structure is used to return the information to 390607ca46eSDavid Howells * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. 391607ca46eSDavid Howells * The type code indicates the eeprom data format 392607ca46eSDavid Howells */ 393607ca46eSDavid Howells struct ethtool_modinfo { 394607ca46eSDavid Howells __u32 cmd; 395607ca46eSDavid Howells __u32 type; 396607ca46eSDavid Howells __u32 eeprom_len; 397607ca46eSDavid Howells __u32 reserved[8]; 398607ca46eSDavid Howells }; 399607ca46eSDavid Howells 400607ca46eSDavid Howells /** 401607ca46eSDavid Howells * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates 402607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}COALESCE 403607ca46eSDavid Howells * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after 404607ca46eSDavid Howells * a packet arrives. 405607ca46eSDavid Howells * @rx_max_coalesced_frames: Maximum number of packets to receive 406607ca46eSDavid Howells * before an RX interrupt. 407607ca46eSDavid Howells * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that 408607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host. 409607ca46eSDavid Howells * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, 410607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced 411607ca46eSDavid Howells * by the host. 412607ca46eSDavid Howells * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after 413607ca46eSDavid Howells * a packet is sent. 414607ca46eSDavid Howells * @tx_max_coalesced_frames: Maximum number of packets to be sent 415607ca46eSDavid Howells * before a TX interrupt. 416607ca46eSDavid Howells * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that 417607ca46eSDavid Howells * this value applies while an IRQ is being serviced by the host. 418607ca46eSDavid Howells * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, 419607ca46eSDavid Howells * except that this value applies while an IRQ is being serviced 420607ca46eSDavid Howells * by the host. 421607ca46eSDavid Howells * @stats_block_coalesce_usecs: How many usecs to delay in-memory 422607ca46eSDavid Howells * statistics block updates. Some drivers do not have an 423607ca46eSDavid Howells * in-memory statistic block, and in such cases this value is 424607ca46eSDavid Howells * ignored. This value must not be zero. 425607ca46eSDavid Howells * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. 426607ca46eSDavid Howells * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. 427607ca46eSDavid Howells * @pkt_rate_low: Threshold for low packet rate (packets per second). 428607ca46eSDavid Howells * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after 429607ca46eSDavid Howells * a packet arrives, when the packet rate is below @pkt_rate_low. 430607ca46eSDavid Howells * @rx_max_coalesced_frames_low: Maximum number of packets to be received 431607ca46eSDavid Howells * before an RX interrupt, when the packet rate is below @pkt_rate_low. 432607ca46eSDavid Howells * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after 433607ca46eSDavid Howells * a packet is sent, when the packet rate is below @pkt_rate_low. 434607ca46eSDavid Howells * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before 435607ca46eSDavid Howells * a TX interrupt, when the packet rate is below @pkt_rate_low. 436607ca46eSDavid Howells * @pkt_rate_high: Threshold for high packet rate (packets per second). 437607ca46eSDavid Howells * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after 438607ca46eSDavid Howells * a packet arrives, when the packet rate is above @pkt_rate_high. 439607ca46eSDavid Howells * @rx_max_coalesced_frames_high: Maximum number of packets to be received 440607ca46eSDavid Howells * before an RX interrupt, when the packet rate is above @pkt_rate_high. 441607ca46eSDavid Howells * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after 442607ca46eSDavid Howells * a packet is sent, when the packet rate is above @pkt_rate_high. 443607ca46eSDavid Howells * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before 444607ca46eSDavid Howells * a TX interrupt, when the packet rate is above @pkt_rate_high. 445607ca46eSDavid Howells * @rate_sample_interval: How often to do adaptive coalescing packet rate 446607ca46eSDavid Howells * sampling, measured in seconds. Must not be zero. 447607ca46eSDavid Howells * 448073e3cf2SBen Hutchings * Each pair of (usecs, max_frames) fields specifies that interrupts 449073e3cf2SBen Hutchings * should be coalesced until 450607ca46eSDavid Howells * (usecs > 0 && time_since_first_completion >= usecs) || 451607ca46eSDavid Howells * (max_frames > 0 && completed_frames >= max_frames) 452073e3cf2SBen Hutchings * 453607ca46eSDavid Howells * It is illegal to set both usecs and max_frames to zero as this 454607ca46eSDavid Howells * would cause interrupts to never be generated. To disable 455607ca46eSDavid Howells * coalescing, set usecs = 0 and max_frames = 1. 456607ca46eSDavid Howells * 457607ca46eSDavid Howells * Some implementations ignore the value of max_frames and use the 458073e3cf2SBen Hutchings * condition time_since_first_completion >= usecs 459073e3cf2SBen Hutchings * 460607ca46eSDavid Howells * This is deprecated. Drivers for hardware that does not support 461607ca46eSDavid Howells * counting completions should validate that max_frames == !rx_usecs. 462607ca46eSDavid Howells * 463607ca46eSDavid Howells * Adaptive RX/TX coalescing is an algorithm implemented by some 464607ca46eSDavid Howells * drivers to improve latency under low packet rates and improve 465607ca46eSDavid Howells * throughput under high packet rates. Some drivers only implement 466607ca46eSDavid Howells * one of RX or TX adaptive coalescing. Anything not implemented by 467607ca46eSDavid Howells * the driver causes these values to be silently ignored. 468607ca46eSDavid Howells * 469607ca46eSDavid Howells * When the packet rate is below @pkt_rate_high but above 470607ca46eSDavid Howells * @pkt_rate_low (both measured in packets per second) the 471607ca46eSDavid Howells * normal {rx,tx}_* coalescing parameters are used. 472607ca46eSDavid Howells */ 473607ca46eSDavid Howells struct ethtool_coalesce { 474607ca46eSDavid Howells __u32 cmd; 475607ca46eSDavid Howells __u32 rx_coalesce_usecs; 476607ca46eSDavid Howells __u32 rx_max_coalesced_frames; 477607ca46eSDavid Howells __u32 rx_coalesce_usecs_irq; 478607ca46eSDavid Howells __u32 rx_max_coalesced_frames_irq; 479607ca46eSDavid Howells __u32 tx_coalesce_usecs; 480607ca46eSDavid Howells __u32 tx_max_coalesced_frames; 481607ca46eSDavid Howells __u32 tx_coalesce_usecs_irq; 482607ca46eSDavid Howells __u32 tx_max_coalesced_frames_irq; 483607ca46eSDavid Howells __u32 stats_block_coalesce_usecs; 484607ca46eSDavid Howells __u32 use_adaptive_rx_coalesce; 485607ca46eSDavid Howells __u32 use_adaptive_tx_coalesce; 486607ca46eSDavid Howells __u32 pkt_rate_low; 487607ca46eSDavid Howells __u32 rx_coalesce_usecs_low; 488607ca46eSDavid Howells __u32 rx_max_coalesced_frames_low; 489607ca46eSDavid Howells __u32 tx_coalesce_usecs_low; 490607ca46eSDavid Howells __u32 tx_max_coalesced_frames_low; 491607ca46eSDavid Howells __u32 pkt_rate_high; 492607ca46eSDavid Howells __u32 rx_coalesce_usecs_high; 493607ca46eSDavid Howells __u32 rx_max_coalesced_frames_high; 494607ca46eSDavid Howells __u32 tx_coalesce_usecs_high; 495607ca46eSDavid Howells __u32 tx_max_coalesced_frames_high; 496607ca46eSDavid Howells __u32 rate_sample_interval; 497607ca46eSDavid Howells }; 498607ca46eSDavid Howells 499af440a8aSBen Hutchings /** 500af440a8aSBen Hutchings * struct ethtool_ringparam - RX/TX ring parameters 501af440a8aSBen Hutchings * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM 502af440a8aSBen Hutchings * @rx_max_pending: Maximum supported number of pending entries per 503af440a8aSBen Hutchings * RX ring. Read-only. 504af440a8aSBen Hutchings * @rx_mini_max_pending: Maximum supported number of pending entries 505af440a8aSBen Hutchings * per RX mini ring. Read-only. 506af440a8aSBen Hutchings * @rx_jumbo_max_pending: Maximum supported number of pending entries 507af440a8aSBen Hutchings * per RX jumbo ring. Read-only. 508af440a8aSBen Hutchings * @tx_max_pending: Maximum supported number of pending entries per 509af440a8aSBen Hutchings * TX ring. Read-only. 510af440a8aSBen Hutchings * @rx_pending: Current maximum number of pending entries per RX ring 511af440a8aSBen Hutchings * @rx_mini_pending: Current maximum number of pending entries per RX 512af440a8aSBen Hutchings * mini ring 513af440a8aSBen Hutchings * @rx_jumbo_pending: Current maximum number of pending entries per RX 514af440a8aSBen Hutchings * jumbo ring 515af440a8aSBen Hutchings * @tx_pending: Current maximum supported number of pending entries 516af440a8aSBen Hutchings * per TX ring 517af440a8aSBen Hutchings * 518af440a8aSBen Hutchings * If the interface does not have separate RX mini and/or jumbo rings, 519af440a8aSBen Hutchings * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0. 520af440a8aSBen Hutchings * 521af440a8aSBen Hutchings * There may also be driver-dependent minimum values for the number 522af440a8aSBen Hutchings * of entries per ring. 523607ca46eSDavid Howells */ 524af440a8aSBen Hutchings struct ethtool_ringparam { 525af440a8aSBen Hutchings __u32 cmd; 526607ca46eSDavid Howells __u32 rx_max_pending; 527607ca46eSDavid Howells __u32 rx_mini_max_pending; 528607ca46eSDavid Howells __u32 rx_jumbo_max_pending; 529607ca46eSDavid Howells __u32 tx_max_pending; 530607ca46eSDavid Howells __u32 rx_pending; 531607ca46eSDavid Howells __u32 rx_mini_pending; 532607ca46eSDavid Howells __u32 rx_jumbo_pending; 533607ca46eSDavid Howells __u32 tx_pending; 534607ca46eSDavid Howells }; 535607ca46eSDavid Howells 536607ca46eSDavid Howells /** 537607ca46eSDavid Howells * struct ethtool_channels - configuring number of network channel 538607ca46eSDavid Howells * @cmd: ETHTOOL_{G,S}CHANNELS 539607ca46eSDavid Howells * @max_rx: Read only. Maximum number of receive channel the driver support. 540607ca46eSDavid Howells * @max_tx: Read only. Maximum number of transmit channel the driver support. 541607ca46eSDavid Howells * @max_other: Read only. Maximum number of other channel the driver support. 542607ca46eSDavid Howells * @max_combined: Read only. Maximum number of combined channel the driver 543607ca46eSDavid Howells * support. Set of queues RX, TX or other. 544607ca46eSDavid Howells * @rx_count: Valid values are in the range 1 to the max_rx. 545607ca46eSDavid Howells * @tx_count: Valid values are in the range 1 to the max_tx. 546607ca46eSDavid Howells * @other_count: Valid values are in the range 1 to the max_other. 547607ca46eSDavid Howells * @combined_count: Valid values are in the range 1 to the max_combined. 548607ca46eSDavid Howells * 549607ca46eSDavid Howells * This can be used to configure RX, TX and other channels. 550607ca46eSDavid Howells */ 551607ca46eSDavid Howells 552607ca46eSDavid Howells struct ethtool_channels { 553607ca46eSDavid Howells __u32 cmd; 554607ca46eSDavid Howells __u32 max_rx; 555607ca46eSDavid Howells __u32 max_tx; 556607ca46eSDavid Howells __u32 max_other; 557607ca46eSDavid Howells __u32 max_combined; 558607ca46eSDavid Howells __u32 rx_count; 559607ca46eSDavid Howells __u32 tx_count; 560607ca46eSDavid Howells __u32 other_count; 561607ca46eSDavid Howells __u32 combined_count; 562607ca46eSDavid Howells }; 563607ca46eSDavid Howells 5646a7a1081SBen Hutchings /** 5656a7a1081SBen Hutchings * struct ethtool_pauseparam - Ethernet pause (flow control) parameters 5666a7a1081SBen Hutchings * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM 5676a7a1081SBen Hutchings * @autoneg: Flag to enable autonegotiation of pause frame use 5686a7a1081SBen Hutchings * @rx_pause: Flag to enable reception of pause frames 5696a7a1081SBen Hutchings * @tx_pause: Flag to enable transmission of pause frames 570607ca46eSDavid Howells * 5716a7a1081SBen Hutchings * Drivers should reject a non-zero setting of @autoneg when 5726a7a1081SBen Hutchings * autoneogotiation is disabled (or not supported) for the link. 5736a7a1081SBen Hutchings * 5746a7a1081SBen Hutchings * If the link is autonegotiated, drivers should use 5756a7a1081SBen Hutchings * mii_advertise_flowctrl() or similar code to set the advertised 5766a7a1081SBen Hutchings * pause frame capabilities based on the @rx_pause and @tx_pause flags, 5776a7a1081SBen Hutchings * even if @autoneg is zero. They should also allow the advertised 5786a7a1081SBen Hutchings * pause frame capabilities to be controlled directly through the 5796a7a1081SBen Hutchings * advertising field of &struct ethtool_cmd. 5806a7a1081SBen Hutchings * 5816a7a1081SBen Hutchings * If @autoneg is non-zero, the MAC is configured to send and/or 5826a7a1081SBen Hutchings * receive pause frames according to the result of autonegotiation. 5836a7a1081SBen Hutchings * Otherwise, it is configured directly based on the @rx_pause and 5846a7a1081SBen Hutchings * @tx_pause flags. 585607ca46eSDavid Howells */ 5866a7a1081SBen Hutchings struct ethtool_pauseparam { 5876a7a1081SBen Hutchings __u32 cmd; 588607ca46eSDavid Howells __u32 autoneg; 589607ca46eSDavid Howells __u32 rx_pause; 590607ca46eSDavid Howells __u32 tx_pause; 591607ca46eSDavid Howells }; 592607ca46eSDavid Howells 593f0ebc2b6SJakub Kicinski /* Link extended state */ 594ecc31c60SAmit Cohen enum ethtool_link_ext_state { 595ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_AUTONEG, 596ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE, 597ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH, 598ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY, 599ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_NO_CABLE, 600ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE, 601ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE, 602ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE, 603ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED, 604ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_STATE_OVERHEAT, 6053dfb5112SIdo Schimmel ETHTOOL_LINK_EXT_STATE_MODULE, 606ecc31c60SAmit Cohen }; 607ecc31c60SAmit Cohen 608f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */ 609ecc31c60SAmit Cohen enum ethtool_link_ext_substate_autoneg { 610ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1, 611ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED, 612ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED, 613ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE, 614ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE, 615ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD, 616ecc31c60SAmit Cohen }; 617ecc31c60SAmit Cohen 618f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE. 619ecc31c60SAmit Cohen */ 620ecc31c60SAmit Cohen enum ethtool_link_ext_substate_link_training { 621ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1, 622ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT, 623ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY, 624ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT, 625ecc31c60SAmit Cohen }; 626ecc31c60SAmit Cohen 627f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH. 628ecc31c60SAmit Cohen */ 629ecc31c60SAmit Cohen enum ethtool_link_ext_substate_link_logical_mismatch { 630ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1, 631ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK, 632ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS, 633ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED, 634ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED, 635ecc31c60SAmit Cohen }; 636ecc31c60SAmit Cohen 637f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY. 638ecc31c60SAmit Cohen */ 639ecc31c60SAmit Cohen enum ethtool_link_ext_substate_bad_signal_integrity { 640ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1, 641ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE, 6425b4ecc3dSGuangbin Huang ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_REFERENCE_CLOCK_LOST, 6435b4ecc3dSGuangbin Huang ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_ALOS, 644ecc31c60SAmit Cohen }; 645ecc31c60SAmit Cohen 646f0ebc2b6SJakub Kicinski /* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */ 647ecc31c60SAmit Cohen enum ethtool_link_ext_substate_cable_issue { 648ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1, 649ecc31c60SAmit Cohen ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE, 650ecc31c60SAmit Cohen }; 651ecc31c60SAmit Cohen 6523dfb5112SIdo Schimmel /* More information in addition to ETHTOOL_LINK_EXT_STATE_MODULE. */ 6533dfb5112SIdo Schimmel enum ethtool_link_ext_substate_module { 6543dfb5112SIdo Schimmel ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY = 1, 6553dfb5112SIdo Schimmel }; 6563dfb5112SIdo Schimmel 657607ca46eSDavid Howells #define ETH_GSTRING_LEN 32 658fe5df1b9SBen Hutchings 659fe5df1b9SBen Hutchings /** 660fe5df1b9SBen Hutchings * enum ethtool_stringset - string set ID 661fe5df1b9SBen Hutchings * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST 662fe5df1b9SBen Hutchings * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS 663fe5df1b9SBen Hutchings * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with 664fe5df1b9SBen Hutchings * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS 665fe5df1b9SBen Hutchings * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; 666fe5df1b9SBen Hutchings * now deprecated 667fe5df1b9SBen Hutchings * @ETH_SS_FEATURES: Device feature names 668892311f6SEyal Perry * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names 669d9c65de0SJakub Kicinski * @ETH_SS_TUNABLES: tunable names 670f3a40945SAndrew Lunn * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS 6710d27f4e4SRaju Lakkaraju * @ETH_SS_PHY_TUNABLES: PHY tunable names 672428c122fSMichal Kubecek * @ETH_SS_LINK_MODES: link mode names 6736a94b8ccSMichal Kubecek * @ETH_SS_MSG_CLASSES: debug message class names 67451ea22b0SMichal Kubecek * @ETH_SS_WOL_MODES: wake-on-lan modes 675f76510b4SMichal Kubecek * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags 676f76510b4SMichal Kubecek * @ETH_SS_TS_TX_TYPES: timestamping Tx types 677f76510b4SMichal Kubecek * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters 678c7d759ebSJakub Kicinski * @ETH_SS_UDP_TUNNEL_TYPES: UDP tunnel types 679f09ea6fbSJakub Kicinski * @ETH_SS_STATS_STD: standardized stats 680f09ea6fbSJakub Kicinski * @ETH_SS_STATS_ETH_PHY: names of IEEE 802.3 PHY statistics 681ca224454SJakub Kicinski * @ETH_SS_STATS_ETH_MAC: names of IEEE 802.3 MAC statistics 682bfad2b97SJakub Kicinski * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics 683a8b06e9dSJakub Kicinski * @ETH_SS_STATS_RMON: names of RMON statistics 684d9c65de0SJakub Kicinski * 685d9c65de0SJakub Kicinski * @ETH_SS_COUNT: number of defined string sets 686fe5df1b9SBen Hutchings */ 687607ca46eSDavid Howells enum ethtool_stringset { 688607ca46eSDavid Howells ETH_SS_TEST = 0, 689607ca46eSDavid Howells ETH_SS_STATS, 690607ca46eSDavid Howells ETH_SS_PRIV_FLAGS, 691fe5df1b9SBen Hutchings ETH_SS_NTUPLE_FILTERS, 692607ca46eSDavid Howells ETH_SS_FEATURES, 693892311f6SEyal Perry ETH_SS_RSS_HASH_FUNCS, 694a4244b0cSHadar Hen Zion ETH_SS_TUNABLES, 695f3a40945SAndrew Lunn ETH_SS_PHY_STATS, 6960d27f4e4SRaju Lakkaraju ETH_SS_PHY_TUNABLES, 697428c122fSMichal Kubecek ETH_SS_LINK_MODES, 6986a94b8ccSMichal Kubecek ETH_SS_MSG_CLASSES, 69951ea22b0SMichal Kubecek ETH_SS_WOL_MODES, 700f76510b4SMichal Kubecek ETH_SS_SOF_TIMESTAMPING, 701f76510b4SMichal Kubecek ETH_SS_TS_TX_TYPES, 702f76510b4SMichal Kubecek ETH_SS_TS_RX_FILTERS, 703c7d759ebSJakub Kicinski ETH_SS_UDP_TUNNEL_TYPES, 704f09ea6fbSJakub Kicinski ETH_SS_STATS_STD, 705f09ea6fbSJakub Kicinski ETH_SS_STATS_ETH_PHY, 706ca224454SJakub Kicinski ETH_SS_STATS_ETH_MAC, 707bfad2b97SJakub Kicinski ETH_SS_STATS_ETH_CTRL, 708a8b06e9dSJakub Kicinski ETH_SS_STATS_RMON, 70971921690SMichal Kubecek 71071921690SMichal Kubecek /* add new constants above here */ 71171921690SMichal Kubecek ETH_SS_COUNT 712607ca46eSDavid Howells }; 713607ca46eSDavid Howells 714fe5df1b9SBen Hutchings /** 71504692c90SVladimir Oltean * enum ethtool_mac_stats_src - source of ethtool MAC statistics 71604692c90SVladimir Oltean * @ETHTOOL_MAC_STATS_SRC_AGGREGATE: 71704692c90SVladimir Oltean * if device supports a MAC merge layer, this retrieves the aggregate 71804692c90SVladimir Oltean * statistics of the eMAC and pMAC. Otherwise, it retrieves just the 71904692c90SVladimir Oltean * statistics of the single (express) MAC. 72004692c90SVladimir Oltean * @ETHTOOL_MAC_STATS_SRC_EMAC: 72104692c90SVladimir Oltean * if device supports a MM layer, this retrieves the eMAC statistics. 72204692c90SVladimir Oltean * Otherwise, it retrieves the statistics of the single (express) MAC. 72304692c90SVladimir Oltean * @ETHTOOL_MAC_STATS_SRC_PMAC: 72404692c90SVladimir Oltean * if device supports a MM layer, this retrieves the pMAC statistics. 72504692c90SVladimir Oltean */ 72604692c90SVladimir Oltean enum ethtool_mac_stats_src { 72704692c90SVladimir Oltean ETHTOOL_MAC_STATS_SRC_AGGREGATE, 72804692c90SVladimir Oltean ETHTOOL_MAC_STATS_SRC_EMAC, 72904692c90SVladimir Oltean ETHTOOL_MAC_STATS_SRC_PMAC, 73004692c90SVladimir Oltean }; 73104692c90SVladimir Oltean 73204692c90SVladimir Oltean /** 733353407d9SIdo Schimmel * enum ethtool_module_power_mode_policy - plug-in module power mode policy 734353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH: Module is always in high power mode. 735353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO: Module is transitioned by the host 736353407d9SIdo Schimmel * to high power mode when the first port using it is put administratively 737353407d9SIdo Schimmel * up and to low power mode when the last port using it is put 738353407d9SIdo Schimmel * administratively down. 739353407d9SIdo Schimmel */ 740353407d9SIdo Schimmel enum ethtool_module_power_mode_policy { 741353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH = 1, 742353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO, 743353407d9SIdo Schimmel }; 744353407d9SIdo Schimmel 745353407d9SIdo Schimmel /** 746353407d9SIdo Schimmel * enum ethtool_module_power_mode - plug-in module power mode 747353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_LOW: Module is in low power mode. 748353407d9SIdo Schimmel * @ETHTOOL_MODULE_POWER_MODE_HIGH: Module is in high power mode. 749353407d9SIdo Schimmel */ 750353407d9SIdo Schimmel enum ethtool_module_power_mode { 751353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_LOW = 1, 752353407d9SIdo Schimmel ETHTOOL_MODULE_POWER_MODE_HIGH, 753353407d9SIdo Schimmel }; 754353407d9SIdo Schimmel 755353407d9SIdo Schimmel /** 75618ff0bcdSOleksij Rempel * enum ethtool_podl_pse_admin_state - operational state of the PoDL PSE 75718ff0bcdSOleksij Rempel * functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState 75818ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN: state of PoDL PSE functions are 75918ff0bcdSOleksij Rempel * unknown 76018ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED: PoDL PSE functions are disabled 76118ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED: PoDL PSE functions are enabled 76218ff0bcdSOleksij Rempel */ 76318ff0bcdSOleksij Rempel enum ethtool_podl_pse_admin_state { 76418ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN = 1, 76518ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED, 76618ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED, 76718ff0bcdSOleksij Rempel }; 76818ff0bcdSOleksij Rempel 76918ff0bcdSOleksij Rempel /** 77018ff0bcdSOleksij Rempel * enum ethtool_podl_pse_pw_d_status - power detection status of the PoDL PSE. 77118ff0bcdSOleksij Rempel * IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus: 77218ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN: PoDL PSE 77318ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED: "The enumeration “disabled” is 77418ff0bcdSOleksij Rempel * asserted true when the PoDL PSE state diagram variable mr_pse_enable is 77518ff0bcdSOleksij Rempel * false" 77618ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING: "The enumeration “searching” is 77718ff0bcdSOleksij Rempel * asserted true when either of the PSE state diagram variables 77818ff0bcdSOleksij Rempel * pi_detecting or pi_classifying is true." 77918ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING: "The enumeration “deliveringPower” 78018ff0bcdSOleksij Rempel * is asserted true when the PoDL PSE state diagram variable pi_powered is 78118ff0bcdSOleksij Rempel * true." 78218ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP: "The enumeration “sleep” is asserted 78318ff0bcdSOleksij Rempel * true when the PoDL PSE state diagram variable pi_sleeping is true." 78418ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE: "The enumeration “idle” is asserted true 78518ff0bcdSOleksij Rempel * when the logical combination of the PoDL PSE state diagram variables 78618ff0bcdSOleksij Rempel * pi_prebiased*!pi_sleeping is true." 78718ff0bcdSOleksij Rempel * @ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR: "The enumeration “error” is asserted 78818ff0bcdSOleksij Rempel * true when the PoDL PSE state diagram variable overload_held is true." 78918ff0bcdSOleksij Rempel */ 79018ff0bcdSOleksij Rempel enum ethtool_podl_pse_pw_d_status { 79118ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN = 1, 79218ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED, 79318ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING, 79418ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING, 79518ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP, 79618ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE, 79718ff0bcdSOleksij Rempel ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR, 79818ff0bcdSOleksij Rempel }; 79918ff0bcdSOleksij Rempel 80018ff0bcdSOleksij Rempel /** 8012b30f829SVladimir Oltean * enum ethtool_mm_verify_status - status of MAC Merge Verify function 8022b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_UNKNOWN: 8032b30f829SVladimir Oltean * verification status is unknown 8042b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_INITIAL: 8052b30f829SVladimir Oltean * the 802.3 Verify State diagram is in the state INIT_VERIFICATION 8062b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_VERIFYING: 8072b30f829SVladimir Oltean * the Verify State diagram is in the state VERIFICATION_IDLE, 8082b30f829SVladimir Oltean * SEND_VERIFY or WAIT_FOR_RESPONSE 8092b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED: 8102b30f829SVladimir Oltean * indicates that the Verify State diagram is in the state VERIFIED 8112b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_FAILED: 8122b30f829SVladimir Oltean * the Verify State diagram is in the state VERIFY_FAIL 8132b30f829SVladimir Oltean * @ETHTOOL_MM_VERIFY_STATUS_DISABLED: 8142b30f829SVladimir Oltean * verification of preemption operation is disabled 8152b30f829SVladimir Oltean */ 8162b30f829SVladimir Oltean enum ethtool_mm_verify_status { 8172b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_UNKNOWN, 8182b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_INITIAL, 8192b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_VERIFYING, 8202b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED, 8212b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_FAILED, 8222b30f829SVladimir Oltean ETHTOOL_MM_VERIFY_STATUS_DISABLED, 8232b30f829SVladimir Oltean }; 8242b30f829SVladimir Oltean 8252b30f829SVladimir Oltean /** 826fe5df1b9SBen Hutchings * struct ethtool_gstrings - string set for data tagging 827fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTRINGS 828fe5df1b9SBen Hutchings * @string_set: String set ID; one of &enum ethtool_stringset 829fe5df1b9SBen Hutchings * @len: On return, the number of strings in the string set 830fe5df1b9SBen Hutchings * @data: Buffer for strings. Each string is null-padded to a size of 831fe5df1b9SBen Hutchings * %ETH_GSTRING_LEN. 832fe5df1b9SBen Hutchings * 833fe5df1b9SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in 834fe5df1b9SBen Hutchings * the string set. They must allocate a buffer of the appropriate 835fe5df1b9SBen Hutchings * size immediately following this structure. 836fe5df1b9SBen Hutchings */ 837607ca46eSDavid Howells struct ethtool_gstrings { 838fe5df1b9SBen Hutchings __u32 cmd; 839fe5df1b9SBen Hutchings __u32 string_set; 840fe5df1b9SBen Hutchings __u32 len; 84194dfc73eSGustavo A. R. Silva __u8 data[]; 842607ca46eSDavid Howells }; 843607ca46eSDavid Howells 844fe5df1b9SBen Hutchings /** 845fe5df1b9SBen Hutchings * struct ethtool_sset_info - string set information 846fe5df1b9SBen Hutchings * @cmd: Command number = %ETHTOOL_GSSET_INFO 84783e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 848fe5df1b9SBen Hutchings * @sset_mask: On entry, a bitmask of string sets to query, with bits 849fe5df1b9SBen Hutchings * numbered according to &enum ethtool_stringset. On return, a 850fe5df1b9SBen Hutchings * bitmask of those string sets queried that are supported. 851fe5df1b9SBen Hutchings * @data: Buffer for string set sizes. On return, this contains the 852fe5df1b9SBen Hutchings * size of each string set that was queried and supported, in 853fe5df1b9SBen Hutchings * order of ID. 854fe5df1b9SBen Hutchings * 855fe5df1b9SBen Hutchings * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on 856fe5df1b9SBen Hutchings * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the 857fe5df1b9SBen Hutchings * size of set 1 and @data[1] contains the size of set 2. 858fe5df1b9SBen Hutchings * 859fe5df1b9SBen Hutchings * Users must allocate a buffer of the appropriate size (4 * number of 860fe5df1b9SBen Hutchings * sets queried) immediately following this structure. 861fe5df1b9SBen Hutchings */ 862607ca46eSDavid Howells struct ethtool_sset_info { 863fe5df1b9SBen Hutchings __u32 cmd; 864607ca46eSDavid Howells __u32 reserved; 865fe5df1b9SBen Hutchings __u64 sset_mask; 86694dfc73eSGustavo A. R. Silva __u32 data[]; 867607ca46eSDavid Howells }; 868607ca46eSDavid Howells 869607ca46eSDavid Howells /** 870607ca46eSDavid Howells * enum ethtool_test_flags - flags definition of ethtool_test 871607ca46eSDavid Howells * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise 872607ca46eSDavid Howells * only online tests. 873607ca46eSDavid Howells * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. 874607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback 875607ca46eSDavid Howells * test. 876607ca46eSDavid Howells * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test 877607ca46eSDavid Howells */ 878607ca46eSDavid Howells 879607ca46eSDavid Howells enum ethtool_test_flags { 880607ca46eSDavid Howells ETH_TEST_FL_OFFLINE = (1 << 0), 881607ca46eSDavid Howells ETH_TEST_FL_FAILED = (1 << 1), 882607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB = (1 << 2), 883607ca46eSDavid Howells ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), 884607ca46eSDavid Howells }; 885607ca46eSDavid Howells 8864e5a62dbSBen Hutchings /** 8874e5a62dbSBen Hutchings * struct ethtool_test - device self-test invocation 8884e5a62dbSBen Hutchings * @cmd: Command number = %ETHTOOL_TEST 8894e5a62dbSBen Hutchings * @flags: A bitmask of flags from &enum ethtool_test_flags. Some 8904e5a62dbSBen Hutchings * flags may be set by the user on entry; others may be set by 8914e5a62dbSBen Hutchings * the driver on return. 89283e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 8934e5a62dbSBen Hutchings * @len: On return, the number of test results 8944e5a62dbSBen Hutchings * @data: Array of test results 8954e5a62dbSBen Hutchings * 8964e5a62dbSBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the 8974e5a62dbSBen Hutchings * number of test results that will be returned. They must allocate a 8984e5a62dbSBen Hutchings * buffer of the appropriate size (8 * number of results) immediately 8994e5a62dbSBen Hutchings * following this structure. 9004e5a62dbSBen Hutchings */ 901607ca46eSDavid Howells struct ethtool_test { 9024e5a62dbSBen Hutchings __u32 cmd; 9034e5a62dbSBen Hutchings __u32 flags; 904607ca46eSDavid Howells __u32 reserved; 9054e5a62dbSBen Hutchings __u32 len; 90694dfc73eSGustavo A. R. Silva __u64 data[]; 907607ca46eSDavid Howells }; 908607ca46eSDavid Howells 90959091229SBen Hutchings /** 91059091229SBen Hutchings * struct ethtool_stats - device-specific statistics 91159091229SBen Hutchings * @cmd: Command number = %ETHTOOL_GSTATS 91259091229SBen Hutchings * @n_stats: On return, the number of statistics 91359091229SBen Hutchings * @data: Array of statistics 91459091229SBen Hutchings * 91559091229SBen Hutchings * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the 91659091229SBen Hutchings * number of statistics that will be returned. They must allocate a 91759091229SBen Hutchings * buffer of the appropriate size (8 * number of statistics) 91859091229SBen Hutchings * immediately following this structure. 91959091229SBen Hutchings */ 920607ca46eSDavid Howells struct ethtool_stats { 92159091229SBen Hutchings __u32 cmd; 92259091229SBen Hutchings __u32 n_stats; 92394dfc73eSGustavo A. R. Silva __u64 data[]; 924607ca46eSDavid Howells }; 925607ca46eSDavid Howells 926f432c095SBen Hutchings /** 927f432c095SBen Hutchings * struct ethtool_perm_addr - permanent hardware address 928f432c095SBen Hutchings * @cmd: Command number = %ETHTOOL_GPERMADDR 929f432c095SBen Hutchings * @size: On entry, the size of the buffer. On return, the size of the 930f432c095SBen Hutchings * address. The command fails if the buffer is too small. 931f432c095SBen Hutchings * @data: Buffer for the address 932f432c095SBen Hutchings * 933f432c095SBen Hutchings * Users must allocate the buffer immediately following this structure. 934f432c095SBen Hutchings * A buffer size of %MAX_ADDR_LEN should be sufficient for any address 935f432c095SBen Hutchings * type. 936f432c095SBen Hutchings */ 937607ca46eSDavid Howells struct ethtool_perm_addr { 938f432c095SBen Hutchings __u32 cmd; 939607ca46eSDavid Howells __u32 size; 94094dfc73eSGustavo A. R. Silva __u8 data[]; 941607ca46eSDavid Howells }; 942607ca46eSDavid Howells 943607ca46eSDavid Howells /* boolean flags controlling per-interface behavior characteristics. 944607ca46eSDavid Howells * When reading, the flag indicates whether or not a certain behavior 945607ca46eSDavid Howells * is enabled/present. When writing, the flag indicates whether 946607ca46eSDavid Howells * or not the driver should turn on (set) or off (clear) a behavior. 947607ca46eSDavid Howells * 948607ca46eSDavid Howells * Some behaviors may read-only (unconditionally absent or present). 949607ca46eSDavid Howells * If such is the case, return EINVAL in the set-flags operation if the 950607ca46eSDavid Howells * flag differs from the read-only value. 951607ca46eSDavid Howells */ 952607ca46eSDavid Howells enum ethtool_flags { 953607ca46eSDavid Howells ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */ 954607ca46eSDavid Howells ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */ 955607ca46eSDavid Howells ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 956607ca46eSDavid Howells ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ 957607ca46eSDavid Howells ETH_FLAG_RXHASH = (1 << 28), 958607ca46eSDavid Howells }; 959607ca46eSDavid Howells 960607ca46eSDavid Howells /* The following structures are for supporting RX network flow 961607ca46eSDavid Howells * classification and RX n-tuple configuration. Note, all multibyte 962607ca46eSDavid Howells * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to 963607ca46eSDavid Howells * be in network byte order. 964607ca46eSDavid Howells */ 965607ca46eSDavid Howells 966607ca46eSDavid Howells /** 967607ca46eSDavid Howells * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. 968607ca46eSDavid Howells * @ip4src: Source host 969607ca46eSDavid Howells * @ip4dst: Destination host 970607ca46eSDavid Howells * @psrc: Source port 971607ca46eSDavid Howells * @pdst: Destination port 972607ca46eSDavid Howells * @tos: Type-of-service 973607ca46eSDavid Howells * 974607ca46eSDavid Howells * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. 975607ca46eSDavid Howells */ 976607ca46eSDavid Howells struct ethtool_tcpip4_spec { 977607ca46eSDavid Howells __be32 ip4src; 978607ca46eSDavid Howells __be32 ip4dst; 979607ca46eSDavid Howells __be16 psrc; 980607ca46eSDavid Howells __be16 pdst; 981607ca46eSDavid Howells __u8 tos; 982607ca46eSDavid Howells }; 983607ca46eSDavid Howells 984607ca46eSDavid Howells /** 985607ca46eSDavid Howells * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 986607ca46eSDavid Howells * @ip4src: Source host 987607ca46eSDavid Howells * @ip4dst: Destination host 988607ca46eSDavid Howells * @spi: Security parameters index 989607ca46eSDavid Howells * @tos: Type-of-service 990607ca46eSDavid Howells * 991607ca46eSDavid Howells * This can be used to specify an IPsec transport or tunnel over IPv4. 992607ca46eSDavid Howells */ 993607ca46eSDavid Howells struct ethtool_ah_espip4_spec { 994607ca46eSDavid Howells __be32 ip4src; 995607ca46eSDavid Howells __be32 ip4dst; 996607ca46eSDavid Howells __be32 spi; 997607ca46eSDavid Howells __u8 tos; 998607ca46eSDavid Howells }; 999607ca46eSDavid Howells 1000607ca46eSDavid Howells #define ETH_RX_NFC_IP4 1 1001607ca46eSDavid Howells 1002607ca46eSDavid Howells /** 1003607ca46eSDavid Howells * struct ethtool_usrip4_spec - general flow specification for IPv4 1004607ca46eSDavid Howells * @ip4src: Source host 1005607ca46eSDavid Howells * @ip4dst: Destination host 1006607ca46eSDavid Howells * @l4_4_bytes: First 4 bytes of transport (layer 4) header 1007607ca46eSDavid Howells * @tos: Type-of-service 1008607ca46eSDavid Howells * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 1009607ca46eSDavid Howells * @proto: Transport protocol number; mask must be 0 1010607ca46eSDavid Howells */ 1011607ca46eSDavid Howells struct ethtool_usrip4_spec { 1012607ca46eSDavid Howells __be32 ip4src; 1013607ca46eSDavid Howells __be32 ip4dst; 1014607ca46eSDavid Howells __be32 l4_4_bytes; 1015607ca46eSDavid Howells __u8 tos; 1016607ca46eSDavid Howells __u8 ip_ver; 1017607ca46eSDavid Howells __u8 proto; 1018607ca46eSDavid Howells }; 1019607ca46eSDavid Howells 102072bb6872SEdward Cree /** 102172bb6872SEdward Cree * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc. 102272bb6872SEdward Cree * @ip6src: Source host 102372bb6872SEdward Cree * @ip6dst: Destination host 102472bb6872SEdward Cree * @psrc: Source port 102572bb6872SEdward Cree * @pdst: Destination port 102672bb6872SEdward Cree * @tclass: Traffic Class 102772bb6872SEdward Cree * 102872bb6872SEdward Cree * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow. 102972bb6872SEdward Cree */ 103072bb6872SEdward Cree struct ethtool_tcpip6_spec { 103172bb6872SEdward Cree __be32 ip6src[4]; 103272bb6872SEdward Cree __be32 ip6dst[4]; 103372bb6872SEdward Cree __be16 psrc; 103472bb6872SEdward Cree __be16 pdst; 103572bb6872SEdward Cree __u8 tclass; 103672bb6872SEdward Cree }; 103772bb6872SEdward Cree 103872bb6872SEdward Cree /** 103972bb6872SEdward Cree * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6 104072bb6872SEdward Cree * @ip6src: Source host 104172bb6872SEdward Cree * @ip6dst: Destination host 104272bb6872SEdward Cree * @spi: Security parameters index 104372bb6872SEdward Cree * @tclass: Traffic Class 104472bb6872SEdward Cree * 104572bb6872SEdward Cree * This can be used to specify an IPsec transport or tunnel over IPv6. 104672bb6872SEdward Cree */ 104772bb6872SEdward Cree struct ethtool_ah_espip6_spec { 104872bb6872SEdward Cree __be32 ip6src[4]; 104972bb6872SEdward Cree __be32 ip6dst[4]; 105072bb6872SEdward Cree __be32 spi; 105172bb6872SEdward Cree __u8 tclass; 105272bb6872SEdward Cree }; 105372bb6872SEdward Cree 105472bb6872SEdward Cree /** 105572bb6872SEdward Cree * struct ethtool_usrip6_spec - general flow specification for IPv6 105672bb6872SEdward Cree * @ip6src: Source host 105772bb6872SEdward Cree * @ip6dst: Destination host 105872bb6872SEdward Cree * @l4_4_bytes: First 4 bytes of transport (layer 4) header 105972bb6872SEdward Cree * @tclass: Traffic Class 106072bb6872SEdward Cree * @l4_proto: Transport protocol number (nexthdr after any Extension Headers) 106172bb6872SEdward Cree */ 106272bb6872SEdward Cree struct ethtool_usrip6_spec { 106372bb6872SEdward Cree __be32 ip6src[4]; 106472bb6872SEdward Cree __be32 ip6dst[4]; 106572bb6872SEdward Cree __be32 l4_4_bytes; 106672bb6872SEdward Cree __u8 tclass; 106772bb6872SEdward Cree __u8 l4_proto; 106872bb6872SEdward Cree }; 106972bb6872SEdward Cree 1070607ca46eSDavid Howells union ethtool_flow_union { 1071607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec; 1072607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec; 1073607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec; 1074607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec; 1075607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec; 1076607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec; 107772bb6872SEdward Cree struct ethtool_tcpip6_spec tcp_ip6_spec; 107872bb6872SEdward Cree struct ethtool_tcpip6_spec udp_ip6_spec; 107972bb6872SEdward Cree struct ethtool_tcpip6_spec sctp_ip6_spec; 108072bb6872SEdward Cree struct ethtool_ah_espip6_spec ah_ip6_spec; 108172bb6872SEdward Cree struct ethtool_ah_espip6_spec esp_ip6_spec; 108272bb6872SEdward Cree struct ethtool_usrip6_spec usr_ip6_spec; 1083607ca46eSDavid Howells struct ethhdr ether_spec; 1084d4676eacSYan Burman __u8 hdata[52]; 1085607ca46eSDavid Howells }; 1086607ca46eSDavid Howells 1087dc2e5734SYan Burman /** 1088dc2e5734SYan Burman * struct ethtool_flow_ext - additional RX flow fields 1089dc2e5734SYan Burman * @h_dest: destination MAC address 1090dc2e5734SYan Burman * @vlan_etype: VLAN EtherType 1091dc2e5734SYan Burman * @vlan_tci: VLAN tag control information 1092dc2e5734SYan Burman * @data: user defined data 109383e5feebSJakub Kicinski * @padding: Reserved for future use; see the note on reserved space. 1094dc2e5734SYan Burman * 1095dc2e5734SYan Burman * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT 1096dc2e5734SYan Burman * is set in &struct ethtool_rx_flow_spec @flow_type. 1097dc2e5734SYan Burman * @h_dest is valid if %FLOW_MAC_EXT is set. 1098dc2e5734SYan Burman */ 1099607ca46eSDavid Howells struct ethtool_flow_ext { 1100d4676eacSYan Burman __u8 padding[2]; 1101dc2e5734SYan Burman unsigned char h_dest[ETH_ALEN]; 1102607ca46eSDavid Howells __be16 vlan_etype; 1103607ca46eSDavid Howells __be16 vlan_tci; 1104607ca46eSDavid Howells __be32 data[2]; 1105607ca46eSDavid Howells }; 1106607ca46eSDavid Howells 1107607ca46eSDavid Howells /** 1108607ca46eSDavid Howells * struct ethtool_rx_flow_spec - classification rule for RX flows 1109607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 1110607ca46eSDavid Howells * @h_u: Flow fields to match (dependent on @flow_type) 1111607ca46eSDavid Howells * @h_ext: Additional fields to match 1112607ca46eSDavid Howells * @m_u: Masks for flow field bits to be matched 1113607ca46eSDavid Howells * @m_ext: Masks for additional field bits to be matched 1114607ca46eSDavid Howells * Note, all additional fields must be ignored unless @flow_type 1115dc2e5734SYan Burman * includes the %FLOW_EXT or %FLOW_MAC_EXT flag 1116dc2e5734SYan Burman * (see &struct ethtool_flow_ext description). 1117607ca46eSDavid Howells * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC 11186cfef793SFlorian Fainelli * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the 11196cfef793SFlorian Fainelli * packets should be used for Wake-on-LAN with %WAKE_FILTER 1120607ca46eSDavid Howells * @location: Location of rule in the table. Locations must be 1121607ca46eSDavid Howells * numbered such that a flow matching multiple rules will be 1122607ca46eSDavid Howells * classified according to the first (lowest numbered) rule. 1123607ca46eSDavid Howells */ 1124607ca46eSDavid Howells struct ethtool_rx_flow_spec { 1125607ca46eSDavid Howells __u32 flow_type; 1126607ca46eSDavid Howells union ethtool_flow_union h_u; 1127607ca46eSDavid Howells struct ethtool_flow_ext h_ext; 1128607ca46eSDavid Howells union ethtool_flow_union m_u; 1129607ca46eSDavid Howells struct ethtool_flow_ext m_ext; 1130607ca46eSDavid Howells __u64 ring_cookie; 1131607ca46eSDavid Howells __u32 location; 1132607ca46eSDavid Howells }; 1133607ca46eSDavid Howells 113454e8cb78SStephen Hemminger /* How rings are laid out when accessing virtual functions or 11358cf6f497SJohn Fastabend * offloaded queues is device specific. To allow users to do flow 11368cf6f497SJohn Fastabend * steering and specify these queues the ring cookie is partitioned 11378cf6f497SJohn Fastabend * into a 32bit queue index with an 8 bit virtual function id. 11388cf6f497SJohn Fastabend * This also leaves the 3bytes for further specifiers. It is possible 11398cf6f497SJohn Fastabend * future devices may support more than 256 virtual functions if 11408cf6f497SJohn Fastabend * devices start supporting PCIe w/ARI. However at the moment I 11418cf6f497SJohn Fastabend * do not know of any devices that support this so I do not reserve 11428cf6f497SJohn Fastabend * space for this at this time. If a future patch consumes the next 114354e8cb78SStephen Hemminger * byte it should be aware of this possibility. 11448cf6f497SJohn Fastabend */ 11458cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL 11468cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL 11478cf6f497SJohn Fastabend #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32 11488cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie) 11498cf6f497SJohn Fastabend { 11508cf6f497SJohn Fastabend return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie; 1151d89d4155SFlorian Fainelli } 11528cf6f497SJohn Fastabend 11538cf6f497SJohn Fastabend static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) 11548cf6f497SJohn Fastabend { 11558cf6f497SJohn Fastabend return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >> 11568cf6f497SJohn Fastabend ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF; 1157d89d4155SFlorian Fainelli } 11588cf6f497SJohn Fastabend 1159607ca46eSDavid Howells /** 1160607ca46eSDavid Howells * struct ethtool_rxnfc - command to get or set RX flow classification rules 1161607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH, 1162607ca46eSDavid Howells * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE, 1163607ca46eSDavid Howells * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS 1164607ca46eSDavid Howells * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW 1165607ca46eSDavid Howells * @data: Command-dependent value 1166607ca46eSDavid Howells * @fs: Flow classification rule 116784a1d9c4SEdward Cree * @rss_context: RSS context to be affected 1168607ca46eSDavid Howells * @rule_cnt: Number of rules to be affected 1169607ca46eSDavid Howells * @rule_locs: Array of used rule locations 1170607ca46eSDavid Howells * 1171607ca46eSDavid Howells * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating 1172607ca46eSDavid Howells * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following 117384a1d9c4SEdward Cree * structure fields must not be used, except that if @flow_type includes 117484a1d9c4SEdward Cree * the %FLOW_RSS flag, then @rss_context determines which RSS context to 117584a1d9c4SEdward Cree * act on. 1176607ca46eSDavid Howells * 1177607ca46eSDavid Howells * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues 1178607ca46eSDavid Howells * on return. 1179607ca46eSDavid Howells * 1180607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 1181607ca46eSDavid Howells * rules on return. If @data is non-zero on return then it is the 1182607ca46eSDavid Howells * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the 1183607ca46eSDavid Howells * driver supports any special location values. If that flag is not 1184607ca46eSDavid Howells * set in @data then special location values should not be used. 1185607ca46eSDavid Howells * 1186607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 118784a1d9c4SEdward Cree * existing rule on entry and @fs contains the rule on return; if 118884a1d9c4SEdward Cree * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is 118984a1d9c4SEdward Cree * filled with the RSS context ID associated with the rule. 1190607ca46eSDavid Howells * 1191607ca46eSDavid Howells * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the 1192607ca46eSDavid Howells * user buffer for @rule_locs on entry. On return, @data is the size 1193607ca46eSDavid Howells * of the rule table, @rule_cnt is the number of defined rules, and 1194607ca46eSDavid Howells * @rule_locs contains the locations of the defined rules. Drivers 1195607ca46eSDavid Howells * must use the second parameter to get_rxnfc() instead of @rule_locs. 1196607ca46eSDavid Howells * 1197607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 1198607ca46eSDavid Howells * @fs.@location either specifies the location to use or is a special 1199607ca46eSDavid Howells * location value with %RX_CLS_LOC_SPECIAL flag set. On return, 120084a1d9c4SEdward Cree * @fs.@location is the actual rule location. If @fs.@flow_type 120184a1d9c4SEdward Cree * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to 120284a1d9c4SEdward Cree * use for flow spreading traffic which matches this rule. The value 120384a1d9c4SEdward Cree * from the rxfh indirection table will be added to @fs.@ring_cookie 120484a1d9c4SEdward Cree * to choose which ring to deliver to. 1205607ca46eSDavid Howells * 1206607ca46eSDavid Howells * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 1207607ca46eSDavid Howells * existing rule on entry. 1208607ca46eSDavid Howells * 1209607ca46eSDavid Howells * A driver supporting the special location values for 1210607ca46eSDavid Howells * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused 1211607ca46eSDavid Howells * location, and may remove a rule at a later location (lower 1212607ca46eSDavid Howells * priority) that matches exactly the same set of flows. The special 1213073e3cf2SBen Hutchings * values are %RX_CLS_LOC_ANY, selecting any location; 1214607ca46eSDavid Howells * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum 1215607ca46eSDavid Howells * priority); and %RX_CLS_LOC_LAST, selecting the last suitable 1216607ca46eSDavid Howells * location (minimum priority). Additional special values may be 1217607ca46eSDavid Howells * defined in future and drivers must return -%EINVAL for any 1218607ca46eSDavid Howells * unrecognised value. 1219607ca46eSDavid Howells */ 1220607ca46eSDavid Howells struct ethtool_rxnfc { 1221607ca46eSDavid Howells __u32 cmd; 1222607ca46eSDavid Howells __u32 flow_type; 1223607ca46eSDavid Howells __u64 data; 1224607ca46eSDavid Howells struct ethtool_rx_flow_spec fs; 122584a1d9c4SEdward Cree union { 1226607ca46eSDavid Howells __u32 rule_cnt; 122784a1d9c4SEdward Cree __u32 rss_context; 122884a1d9c4SEdward Cree }; 1229b466a25cSKees Cook __u32 rule_locs[]; 1230607ca46eSDavid Howells }; 1231607ca46eSDavid Howells 1232607ca46eSDavid Howells 1233607ca46eSDavid Howells /** 1234607ca46eSDavid Howells * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 1235607ca46eSDavid Howells * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 1236607ca46eSDavid Howells * @size: On entry, the array size of the user buffer, which may be zero. 1237607ca46eSDavid Howells * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware 1238607ca46eSDavid Howells * indirection table. 1239607ca46eSDavid Howells * @ring_index: RX ring/queue index for each hash value 1240607ca46eSDavid Howells * 1241607ca46eSDavid Howells * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size 1242607ca46eSDavid Howells * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means 1243607ca46eSDavid Howells * the table should be reset to default values. This last feature 1244607ca46eSDavid Howells * is not supported by the original implementations. 1245607ca46eSDavid Howells */ 1246607ca46eSDavid Howells struct ethtool_rxfh_indir { 1247607ca46eSDavid Howells __u32 cmd; 1248607ca46eSDavid Howells __u32 size; 124994dfc73eSGustavo A. R. Silva __u32 ring_index[]; 1250607ca46eSDavid Howells }; 1251607ca46eSDavid Howells 1252607ca46eSDavid Howells /** 12533de0b592SVenkata Duvvuru * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key. 12543de0b592SVenkata Duvvuru * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH 125584a1d9c4SEdward Cree * @rss_context: RSS context identifier. Context 0 is the default for normal 125684a1d9c4SEdward Cree * traffic; other contexts can be referenced as the destination for RX flow 125784a1d9c4SEdward Cree * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command 125884a1d9c4SEdward Cree * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will 125984a1d9c4SEdward Cree * contain the ID of the newly allocated context. 126038c891a4SBen Hutchings * @indir_size: On entry, the array size of the user buffer for the 126138c891a4SBen Hutchings * indirection table, which may be zero, or (for %ETHTOOL_SRSSH), 126238c891a4SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH, 126338c891a4SBen Hutchings * the array size of the hardware indirection table. 126438c891a4SBen Hutchings * @key_size: On entry, the array size of the user buffer for the hash key, 126538c891a4SBen Hutchings * which may be zero. On return from %ETHTOOL_GRSSH, the size of the 126638c891a4SBen Hutchings * hardware hash key. 1267892311f6SEyal Perry * @hfunc: Defines the current RSS hash function used by HW (or to be set to). 1268892311f6SEyal Perry * Valid values are one of the %ETH_RSS_HASH_*. 126913e59344SAhmed Zaki * @input_xfrm: Defines how the input data is transformed. Valid values are one 127013e59344SAhmed Zaki * of %RXH_XFRM_*. 127183e5feebSJakub Kicinski * @rsvd8: Reserved for future use; see the note on reserved space. 127283e5feebSJakub Kicinski * @rsvd32: Reserved for future use; see the note on reserved space. 12733de0b592SVenkata Duvvuru * @rss_config: RX ring/queue index for each hash value i.e., indirection table 127438c891a4SBen Hutchings * of @indir_size __u32 elements, followed by hash key of @key_size 127538c891a4SBen Hutchings * bytes. 12763de0b592SVenkata Duvvuru * 12773de0b592SVenkata Duvvuru * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the 12787455fa24SBen Hutchings * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of 12797455fa24SBen Hutchings * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested 12807455fa24SBen Hutchings * and a @indir_size of zero means the indir table should be reset to default 128184a1d9c4SEdward Cree * values (if @rss_context == 0) or that the RSS context should be deleted. 128284a1d9c4SEdward Cree * An hfunc of zero means that hash function setting is not requested. 12833de0b592SVenkata Duvvuru */ 12843de0b592SVenkata Duvvuru struct ethtool_rxfh { 12853de0b592SVenkata Duvvuru __u32 cmd; 12863de0b592SVenkata Duvvuru __u32 rss_context; 12873de0b592SVenkata Duvvuru __u32 indir_size; 12883de0b592SVenkata Duvvuru __u32 key_size; 1289892311f6SEyal Perry __u8 hfunc; 129013e59344SAhmed Zaki __u8 input_xfrm; 129113e59344SAhmed Zaki __u8 rsvd8[2]; 1292892311f6SEyal Perry __u32 rsvd32; 129394dfc73eSGustavo A. R. Silva __u32 rss_config[]; 12943de0b592SVenkata Duvvuru }; 129584a1d9c4SEdward Cree #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff 12967455fa24SBen Hutchings #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff 12973de0b592SVenkata Duvvuru 12983de0b592SVenkata Duvvuru /** 1299607ca46eSDavid Howells * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter 1300607ca46eSDavid Howells * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 1301607ca46eSDavid Howells * @h_u: Flow field values to match (dependent on @flow_type) 1302607ca46eSDavid Howells * @m_u: Masks for flow field value bits to be ignored 1303607ca46eSDavid Howells * @vlan_tag: VLAN tag to match 1304607ca46eSDavid Howells * @vlan_tag_mask: Mask for VLAN tag bits to be ignored 1305607ca46eSDavid Howells * @data: Driver-dependent data to match 1306607ca46eSDavid Howells * @data_mask: Mask for driver-dependent data bits to be ignored 1307607ca46eSDavid Howells * @action: RX ring/queue index to deliver to (non-negative) or other action 1308607ca46eSDavid Howells * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP) 1309607ca46eSDavid Howells * 1310607ca46eSDavid Howells * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where 1311607ca46eSDavid Howells * a field value and mask are both zero this is treated as if all mask 1312607ca46eSDavid Howells * bits are set i.e. the field is ignored. 1313607ca46eSDavid Howells */ 1314607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec { 1315607ca46eSDavid Howells __u32 flow_type; 1316607ca46eSDavid Howells union { 1317607ca46eSDavid Howells struct ethtool_tcpip4_spec tcp_ip4_spec; 1318607ca46eSDavid Howells struct ethtool_tcpip4_spec udp_ip4_spec; 1319607ca46eSDavid Howells struct ethtool_tcpip4_spec sctp_ip4_spec; 1320607ca46eSDavid Howells struct ethtool_ah_espip4_spec ah_ip4_spec; 1321607ca46eSDavid Howells struct ethtool_ah_espip4_spec esp_ip4_spec; 1322607ca46eSDavid Howells struct ethtool_usrip4_spec usr_ip4_spec; 1323607ca46eSDavid Howells struct ethhdr ether_spec; 1324607ca46eSDavid Howells __u8 hdata[72]; 1325607ca46eSDavid Howells } h_u, m_u; 1326607ca46eSDavid Howells 1327607ca46eSDavid Howells __u16 vlan_tag; 1328607ca46eSDavid Howells __u16 vlan_tag_mask; 1329607ca46eSDavid Howells __u64 data; 1330607ca46eSDavid Howells __u64 data_mask; 1331607ca46eSDavid Howells 1332607ca46eSDavid Howells __s32 action; 1333607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */ 1334607ca46eSDavid Howells #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */ 1335607ca46eSDavid Howells }; 1336607ca46eSDavid Howells 1337607ca46eSDavid Howells /** 1338607ca46eSDavid Howells * struct ethtool_rx_ntuple - command to set or clear RX flow filter 1339607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_SRXNTUPLE 1340607ca46eSDavid Howells * @fs: Flow filter specification 1341607ca46eSDavid Howells */ 1342607ca46eSDavid Howells struct ethtool_rx_ntuple { 1343607ca46eSDavid Howells __u32 cmd; 1344607ca46eSDavid Howells struct ethtool_rx_ntuple_flow_spec fs; 1345607ca46eSDavid Howells }; 1346607ca46eSDavid Howells 1347607ca46eSDavid Howells #define ETHTOOL_FLASH_MAX_FILENAME 128 1348607ca46eSDavid Howells enum ethtool_flash_op_type { 1349607ca46eSDavid Howells ETHTOOL_FLASH_ALL_REGIONS = 0, 1350607ca46eSDavid Howells }; 1351607ca46eSDavid Howells 1352607ca46eSDavid Howells /* for passing firmware flashing related parameters */ 1353607ca46eSDavid Howells struct ethtool_flash { 1354607ca46eSDavid Howells __u32 cmd; 1355607ca46eSDavid Howells __u32 region; 1356607ca46eSDavid Howells char data[ETHTOOL_FLASH_MAX_FILENAME]; 1357607ca46eSDavid Howells }; 1358607ca46eSDavid Howells 1359607ca46eSDavid Howells /** 1360607ca46eSDavid Howells * struct ethtool_dump - used for retrieving, setting device dump 1361607ca46eSDavid Howells * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or 1362607ca46eSDavid Howells * %ETHTOOL_SET_DUMP 1363607ca46eSDavid Howells * @version: FW version of the dump, filled in by driver 1364607ca46eSDavid Howells * @flag: driver dependent flag for dump setting, filled in by driver during 1365607ca46eSDavid Howells * get and filled in by ethtool for set operation. 1366607ca46eSDavid Howells * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when 1367607ca46eSDavid Howells * firmware dump is disabled. 1368607ca46eSDavid Howells * @len: length of dump data, used as the length of the user buffer on entry to 1369607ca46eSDavid Howells * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver 1370607ca46eSDavid Howells * for %ETHTOOL_GET_DUMP_FLAG command 1371607ca46eSDavid Howells * @data: data collected for get dump data operation 1372607ca46eSDavid Howells */ 1373607ca46eSDavid Howells struct ethtool_dump { 1374607ca46eSDavid Howells __u32 cmd; 1375607ca46eSDavid Howells __u32 version; 1376607ca46eSDavid Howells __u32 flag; 1377607ca46eSDavid Howells __u32 len; 137894dfc73eSGustavo A. R. Silva __u8 data[]; 1379607ca46eSDavid Howells }; 1380607ca46eSDavid Howells 1381ba569dc3SBen Hutchings #define ETH_FW_DUMP_DISABLE 0 1382ba569dc3SBen Hutchings 1383607ca46eSDavid Howells /* for returning and changing feature sets */ 1384607ca46eSDavid Howells 1385607ca46eSDavid Howells /** 1386607ca46eSDavid Howells * struct ethtool_get_features_block - block with state of 32 features 1387607ca46eSDavid Howells * @available: mask of changeable features 1388607ca46eSDavid Howells * @requested: mask of features requested to be enabled if possible 1389607ca46eSDavid Howells * @active: mask of currently enabled features 1390607ca46eSDavid Howells * @never_changed: mask of features not changeable for any device 1391607ca46eSDavid Howells */ 1392607ca46eSDavid Howells struct ethtool_get_features_block { 1393607ca46eSDavid Howells __u32 available; 1394607ca46eSDavid Howells __u32 requested; 1395607ca46eSDavid Howells __u32 active; 1396607ca46eSDavid Howells __u32 never_changed; 1397607ca46eSDavid Howells }; 1398607ca46eSDavid Howells 1399607ca46eSDavid Howells /** 1400607ca46eSDavid Howells * struct ethtool_gfeatures - command to get state of device's features 1401607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GFEATURES 1402073e3cf2SBen Hutchings * @size: On entry, the number of elements in the features[] array; 1403073e3cf2SBen Hutchings * on return, the number of elements in features[] needed to hold 1404073e3cf2SBen Hutchings * all features 1405607ca46eSDavid Howells * @features: state of features 1406607ca46eSDavid Howells */ 1407607ca46eSDavid Howells struct ethtool_gfeatures { 1408607ca46eSDavid Howells __u32 cmd; 1409607ca46eSDavid Howells __u32 size; 141094dfc73eSGustavo A. R. Silva struct ethtool_get_features_block features[]; 1411607ca46eSDavid Howells }; 1412607ca46eSDavid Howells 1413607ca46eSDavid Howells /** 1414607ca46eSDavid Howells * struct ethtool_set_features_block - block with request for 32 features 1415607ca46eSDavid Howells * @valid: mask of features to be changed 1416607ca46eSDavid Howells * @requested: values of features to be changed 1417607ca46eSDavid Howells */ 1418607ca46eSDavid Howells struct ethtool_set_features_block { 1419607ca46eSDavid Howells __u32 valid; 1420607ca46eSDavid Howells __u32 requested; 1421607ca46eSDavid Howells }; 1422607ca46eSDavid Howells 1423607ca46eSDavid Howells /** 1424607ca46eSDavid Howells * struct ethtool_sfeatures - command to request change in device's features 1425607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_SFEATURES 1426607ca46eSDavid Howells * @size: array size of the features[] array 1427607ca46eSDavid Howells * @features: feature change masks 1428607ca46eSDavid Howells */ 1429607ca46eSDavid Howells struct ethtool_sfeatures { 1430607ca46eSDavid Howells __u32 cmd; 1431607ca46eSDavid Howells __u32 size; 143294dfc73eSGustavo A. R. Silva struct ethtool_set_features_block features[]; 1433607ca46eSDavid Howells }; 1434607ca46eSDavid Howells 1435607ca46eSDavid Howells /** 1436607ca46eSDavid Howells * struct ethtool_ts_info - holds a device's timestamping and PHC association 1437607ca46eSDavid Howells * @cmd: command number = %ETHTOOL_GET_TS_INFO 1438607ca46eSDavid Howells * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags 1439607ca46eSDavid Howells * @phc_index: device index of the associated PHC, or -1 if there is none 1440607ca46eSDavid Howells * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values 144183e5feebSJakub Kicinski * @tx_reserved: Reserved for future use; see the note on reserved space. 1442607ca46eSDavid Howells * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values 144383e5feebSJakub Kicinski * @rx_reserved: Reserved for future use; see the note on reserved space. 1444607ca46eSDavid Howells * 1445607ca46eSDavid Howells * The bits in the 'tx_types' and 'rx_filters' fields correspond to 1446607ca46eSDavid Howells * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values, 1447607ca46eSDavid Howells * respectively. For example, if the device supports HWTSTAMP_TX_ON, 1448607ca46eSDavid Howells * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set. 1449eff3cddcSJacob Keller * 1450eff3cddcSJacob Keller * Drivers should only report the filters they actually support without 1451eff3cddcSJacob Keller * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for 1452eff3cddcSJacob Keller * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the 1453eff3cddcSJacob Keller * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op. 1454607ca46eSDavid Howells */ 1455607ca46eSDavid Howells struct ethtool_ts_info { 1456607ca46eSDavid Howells __u32 cmd; 1457607ca46eSDavid Howells __u32 so_timestamping; 1458607ca46eSDavid Howells __s32 phc_index; 1459607ca46eSDavid Howells __u32 tx_types; 1460607ca46eSDavid Howells __u32 tx_reserved[3]; 1461607ca46eSDavid Howells __u32 rx_filters; 1462607ca46eSDavid Howells __u32 rx_reserved[3]; 1463607ca46eSDavid Howells }; 1464607ca46eSDavid Howells 1465607ca46eSDavid Howells /* 1466607ca46eSDavid Howells * %ETHTOOL_SFEATURES changes features present in features[].valid to the 1467607ca46eSDavid Howells * values of corresponding bits in features[].requested. Bits in .requested 1468607ca46eSDavid Howells * not set in .valid or not changeable are ignored. 1469607ca46eSDavid Howells * 1470607ca46eSDavid Howells * Returns %EINVAL when .valid contains undefined or never-changeable bits 1471607ca46eSDavid Howells * or size is not equal to required number of features words (32-bit blocks). 1472607ca46eSDavid Howells * Returns >= 0 if request was completed; bits set in the value mean: 1473607ca46eSDavid Howells * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not 1474607ca46eSDavid Howells * changeable (not present in %ETHTOOL_GFEATURES' features[].available) 1475607ca46eSDavid Howells * those bits were ignored. 1476607ca46eSDavid Howells * %ETHTOOL_F_WISH - some or all changes requested were recorded but the 1477607ca46eSDavid Howells * resulting state of bits masked by .valid is not equal to .requested. 1478607ca46eSDavid Howells * Probably there are other device-specific constraints on some features 1479607ca46eSDavid Howells * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered 1480607ca46eSDavid Howells * here as though ignored bits were cleared. 1481607ca46eSDavid Howells * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling 1482607ca46eSDavid Howells * compatibility functions. Requested offload state cannot be properly 1483607ca46eSDavid Howells * managed by kernel. 1484607ca46eSDavid Howells * 1485607ca46eSDavid Howells * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of 1486607ca46eSDavid Howells * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands 1487607ca46eSDavid Howells * for ETH_SS_FEATURES string set. First entry in the table corresponds to least 1488607ca46eSDavid Howells * significant bit in features[0] fields. Empty strings mark undefined features. 1489607ca46eSDavid Howells */ 1490607ca46eSDavid Howells enum ethtool_sfeatures_retval_bits { 1491607ca46eSDavid Howells ETHTOOL_F_UNSUPPORTED__BIT, 1492607ca46eSDavid Howells ETHTOOL_F_WISH__BIT, 1493607ca46eSDavid Howells ETHTOOL_F_COMPAT__BIT, 1494607ca46eSDavid Howells }; 1495607ca46eSDavid Howells 1496607ca46eSDavid Howells #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT) 1497607ca46eSDavid Howells #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) 1498607ca46eSDavid Howells #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) 1499607ca46eSDavid Howells 1500ac2c7ad0SKan Liang #define MAX_NUM_QUEUE 4096 1501ac2c7ad0SKan Liang 1502ac2c7ad0SKan Liang /** 1503ac2c7ad0SKan Liang * struct ethtool_per_queue_op - apply sub command to the queues in mask. 1504ac2c7ad0SKan Liang * @cmd: ETHTOOL_PERQUEUE 1505ac2c7ad0SKan Liang * @sub_command: the sub command which apply to each queues 1506ac2c7ad0SKan Liang * @queue_mask: Bitmap of the queues which sub command apply to 1507ac2c7ad0SKan Liang * @data: A complete command structure following for each of the queues addressed 1508ac2c7ad0SKan Liang */ 1509ac2c7ad0SKan Liang struct ethtool_per_queue_op { 1510ac2c7ad0SKan Liang __u32 cmd; 1511ac2c7ad0SKan Liang __u32 sub_command; 1512b5d3755aSNicolas Dichtel __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)]; 1513ac2c7ad0SKan Liang char data[]; 1514ac2c7ad0SKan Liang }; 1515607ca46eSDavid Howells 15161a5f3da2SVidya Sagar Ravipati /** 15176dbf94b2SJakub Kicinski * struct ethtool_fecparam - Ethernet Forward Error Correction parameters 15181a5f3da2SVidya Sagar Ravipati * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM 15196dbf94b2SJakub Kicinski * @active_fec: FEC mode which is active on the port, single bit set, GET only. 15206dbf94b2SJakub Kicinski * @fec: Bitmask of configured FEC modes. 1521240e1144SJakub Kicinski * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET. 15226dbf94b2SJakub Kicinski * 1523ad1cd785SJakub Kicinski * Note that @reserved was never validated on input and ethtool user space 1524ad1cd785SJakub Kicinski * left it uninitialized when calling SET. Hence going forward it can only be 1525ad1cd785SJakub Kicinski * used to return a value to userspace with GET. 1526ad1cd785SJakub Kicinski * 15276dbf94b2SJakub Kicinski * FEC modes supported by the device can be read via %ETHTOOL_GLINKSETTINGS. 15286dbf94b2SJakub Kicinski * FEC settings are configured by link autonegotiation whenever it's enabled. 15296dbf94b2SJakub Kicinski * With autoneg on %ETHTOOL_GFECPARAM can be used to read the current mode. 15306dbf94b2SJakub Kicinski * 15316dbf94b2SJakub Kicinski * When autoneg is disabled %ETHTOOL_SFECPARAM controls the FEC settings. 15326dbf94b2SJakub Kicinski * It is recommended that drivers only accept a single bit set in @fec. 15336dbf94b2SJakub Kicinski * When multiple bits are set in @fec drivers may pick mode in an implementation 15346dbf94b2SJakub Kicinski * dependent way. Drivers should reject mixing %ETHTOOL_FEC_AUTO_BIT with other 15356dbf94b2SJakub Kicinski * FEC modes, because it's unclear whether in this case other modes constrain 15366dbf94b2SJakub Kicinski * AUTO or are independent choices. 15376dbf94b2SJakub Kicinski * Drivers must reject SET requests if they support none of the requested modes. 15386dbf94b2SJakub Kicinski * 15396dbf94b2SJakub Kicinski * If device does not support FEC drivers may use %ETHTOOL_FEC_NONE instead 15406dbf94b2SJakub Kicinski * of returning %EOPNOTSUPP from %ETHTOOL_GFECPARAM. 15416dbf94b2SJakub Kicinski * 15426dbf94b2SJakub Kicinski * See enum ethtool_fec_config_bits for definition of valid bits for both 15436dbf94b2SJakub Kicinski * @fec and @active_fec. 15441a5f3da2SVidya Sagar Ravipati */ 15451a5f3da2SVidya Sagar Ravipati struct ethtool_fecparam { 15461a5f3da2SVidya Sagar Ravipati __u32 cmd; 15471a5f3da2SVidya Sagar Ravipati /* bitmask of FEC modes */ 15481a5f3da2SVidya Sagar Ravipati __u32 active_fec; 15491a5f3da2SVidya Sagar Ravipati __u32 fec; 15501a5f3da2SVidya Sagar Ravipati __u32 reserved; 15511a5f3da2SVidya Sagar Ravipati }; 15521a5f3da2SVidya Sagar Ravipati 15531a5f3da2SVidya Sagar Ravipati /** 15541a5f3da2SVidya Sagar Ravipati * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration 1555d04feecaSJakub Kicinski * @ETHTOOL_FEC_NONE_BIT: FEC mode configuration is not supported. Should not 15566dbf94b2SJakub Kicinski * be used together with other bits. GET only. 1557d04feecaSJakub Kicinski * @ETHTOOL_FEC_AUTO_BIT: Select default/best FEC mode automatically, usually 1558d04feecaSJakub Kicinski * based link mode and SFP parameters read from module's 1559d04feecaSJakub Kicinski * EEPROM. This bit does _not_ mean autonegotiation. 1560d04feecaSJakub Kicinski * @ETHTOOL_FEC_OFF_BIT: No FEC Mode 1561d04feecaSJakub Kicinski * @ETHTOOL_FEC_RS_BIT: Reed-Solomon FEC Mode 1562d04feecaSJakub Kicinski * @ETHTOOL_FEC_BASER_BIT: Base-R/Reed-Solomon FEC Mode 1563d04feecaSJakub Kicinski * @ETHTOOL_FEC_LLRS_BIT: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet 15646dbf94b2SJakub Kicinski * Consortium) 15651a5f3da2SVidya Sagar Ravipati */ 15661a5f3da2SVidya Sagar Ravipati enum ethtool_fec_config_bits { 15671a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_NONE_BIT, 15681a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_AUTO_BIT, 15691a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_OFF_BIT, 15701a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_RS_BIT, 15711a5f3da2SVidya Sagar Ravipati ETHTOOL_FEC_BASER_BIT, 1572f623e597SAya Levin ETHTOOL_FEC_LLRS_BIT, 15731a5f3da2SVidya Sagar Ravipati }; 15741a5f3da2SVidya Sagar Ravipati 15751a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT) 15761a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT) 15771a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT) 15781a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT) 15791a5f3da2SVidya Sagar Ravipati #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) 1580f623e597SAya Levin #define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT) 15811a5f3da2SVidya Sagar Ravipati 1582607ca46eSDavid Howells /* CMDs currently supported */ 15833f1ac7a7SDavid Decotigny #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings. 15843f1ac7a7SDavid Decotigny * Please use ETHTOOL_GLINKSETTINGS 15853f1ac7a7SDavid Decotigny */ 15863f1ac7a7SDavid Decotigny #define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings. 15873f1ac7a7SDavid Decotigny * Please use ETHTOOL_SLINKSETTINGS 15883f1ac7a7SDavid Decotigny */ 1589607ca46eSDavid Howells #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 1590607ca46eSDavid Howells #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 1591607ca46eSDavid Howells #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 1592607ca46eSDavid Howells #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 1593607ca46eSDavid Howells #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 1594607ca46eSDavid Howells #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 1595607ca46eSDavid Howells #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 1596607ca46eSDavid Howells /* Get link status for host, i.e. whether the interface *and* the 1597607ca46eSDavid Howells * physical port (if there is one) are up (ethtool_value). */ 1598607ca46eSDavid Howells #define ETHTOOL_GLINK 0x0000000a 1599607ca46eSDavid Howells #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 1600607ca46eSDavid Howells #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 1601607ca46eSDavid Howells #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 1602607ca46eSDavid Howells #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 1603607ca46eSDavid Howells #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 1604607ca46eSDavid Howells #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 1605607ca46eSDavid Howells #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 1606607ca46eSDavid Howells #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 1607607ca46eSDavid Howells #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 1608607ca46eSDavid Howells #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 1609607ca46eSDavid Howells #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 1610607ca46eSDavid Howells #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 1611607ca46eSDavid Howells #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 1612607ca46eSDavid Howells * (ethtool_value) */ 1613607ca46eSDavid Howells #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 1614607ca46eSDavid Howells * (ethtool_value). */ 1615607ca46eSDavid Howells #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 1616607ca46eSDavid Howells #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 1617607ca46eSDavid Howells #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 1618607ca46eSDavid Howells #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 1619607ca46eSDavid Howells #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 1620607ca46eSDavid Howells #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 1621607ca46eSDavid Howells #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ 1622607ca46eSDavid Howells #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ 1623607ca46eSDavid Howells #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 1624607ca46eSDavid Howells #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ 1625607ca46eSDavid Howells #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 1626607ca46eSDavid Howells #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 1627607ca46eSDavid Howells #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 1628607ca46eSDavid Howells #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 1629607ca46eSDavid Howells #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 1630607ca46eSDavid Howells 1631607ca46eSDavid Howells #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 1632607ca46eSDavid Howells #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 1633607ca46eSDavid Howells #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 1634607ca46eSDavid Howells #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 1635607ca46eSDavid Howells #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 1636607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 1637607ca46eSDavid Howells #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 1638607ca46eSDavid Howells #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 1639607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 1640607ca46eSDavid Howells #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 1641607ca46eSDavid Howells #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 1642607ca46eSDavid Howells #define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 1643607ca46eSDavid Howells #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 1644607ca46eSDavid Howells #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */ 1645607ca46eSDavid Howells #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 1646607ca46eSDavid Howells #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 1647607ca46eSDavid Howells #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 1648607ca46eSDavid Howells 1649607ca46eSDavid Howells #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ 1650607ca46eSDavid Howells #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ 1651607ca46eSDavid Howells #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */ 1652607ca46eSDavid Howells #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */ 1653607ca46eSDavid Howells #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1654607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1655607ca46eSDavid Howells #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1656607ca46eSDavid Howells #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */ 1657607ca46eSDavid Howells #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */ 1658607ca46eSDavid Howells #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */ 1659607ca46eSDavid Howells #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ 1660607ca46eSDavid Howells #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ 1661607ca46eSDavid Howells 16623de0b592SVenkata Duvvuru #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */ 16633de0b592SVenkata Duvvuru #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */ 1664f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */ 1665f0db9b07SGovindarajulu Varadarajan #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ 1666f3a40945SAndrew Lunn #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ 16673de0b592SVenkata Duvvuru 1668ac2c7ad0SKan Liang #define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */ 1669ac2c7ad0SKan Liang 16703f1ac7a7SDavid Decotigny #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */ 16713f1ac7a7SDavid Decotigny #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */ 16720d27f4e4SRaju Lakkaraju #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */ 16730d27f4e4SRaju Lakkaraju #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */ 16741a5f3da2SVidya Sagar Ravipati #define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */ 16751a5f3da2SVidya Sagar Ravipati #define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */ 16763f1ac7a7SDavid Decotigny 1677607ca46eSDavid Howells /* compatibility with older code */ 1678607ca46eSDavid Howells #define SPARC_ETH_GSET ETHTOOL_GSET 1679607ca46eSDavid Howells #define SPARC_ETH_SSET ETHTOOL_SSET 1680607ca46eSDavid Howells 16813f1ac7a7SDavid Decotigny /* Link mode bit indices */ 16823f1ac7a7SDavid Decotigny enum ethtool_link_mode_bit_indices { 16833f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0, 16843f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1, 16853f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2, 16863f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3, 16873f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4, 16883f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5, 16893f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Autoneg_BIT = 6, 16903f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_TP_BIT = 7, 16913f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_AUI_BIT = 8, 16923f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_MII_BIT = 9, 16933f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_FIBRE_BIT = 10, 16943f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_BNC_BIT = 11, 16953f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12, 16963f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Pause_BIT = 13, 16973f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14, 16983f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15, 16993f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_Backplane_BIT = 16, 17003f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, 17013f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18, 17023f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, 17033f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20, 17043f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21, 17053f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22, 17063f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, 17073f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, 17083f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25, 17093f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26, 17103f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27, 17113f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, 17123f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, 17133f1ac7a7SDavid Decotigny ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, 17143851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31, 1715e728fdf0SHeiner Kallweit 1716e728fdf0SHeiner Kallweit /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit 1717e728fdf0SHeiner Kallweit * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_* 1718e728fdf0SHeiner Kallweit * macro for bits > 31. The only way to use indices > 31 is to 1719e728fdf0SHeiner Kallweit * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. 1720e728fdf0SHeiner Kallweit */ 1721e728fdf0SHeiner Kallweit 17223851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32, 17233851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33, 17243851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34, 17253851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35, 17263851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36, 17273851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37, 17283851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38, 17293851112eSVidya Sagar Ravipati ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39, 173089da45b8SGal Pressman ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40, 17315711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41, 17325711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42, 17335711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43, 17345711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, 17355711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, 17365711a982SVidya Sagar Ravipati ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, 173794842b4fSPavel Belous ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, 173894842b4fSPavel Belous ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, 17395711a982SVidya Sagar Ravipati 17401a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49, 17411a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_RS_BIT = 50, 17421a5f3da2SVidya Sagar Ravipati ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51, 17432736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 52, 17442736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 53, 17452736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 54, 17462736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 55, 17472736d94fSAya Levin ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 56, 17482736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 57, 17492736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 58, 17502736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 59, 17512736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60, 17522736d94fSAya Levin ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 61, 17532736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 62, 17542736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 63, 17552736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64, 17562736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65, 17572736d94fSAya Levin ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66, 1758b2557764SAndrew Lunn ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67, 1759b2557764SAndrew Lunn ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68, 176014af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 69, 176114af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 70, 176214af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71, 176314af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72, 176414af7fd1SJiri Pirko ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73, 1765f623e597SAya Levin ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74, 1766065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75, 1767065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76, 1768065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77, 1769065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78, 1770065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79, 1771065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80, 1772065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81, 1773065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82, 1774065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83, 1775065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84, 1776065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85, 1777065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86, 1778065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87, 1779065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88, 1780065e0d42SMeir Lichtinger ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89, 178155f13311SDan Murphy ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90, 178255f13311SDan Murphy ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91, 17833254e0b9SAlexandru Tachici ETHTOOL_LINK_MODE_10baseT1L_Full_BIT = 92, 1784404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseCR8_Full_BIT = 93, 1785404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseKR8_Full_BIT = 94, 1786404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseDR8_Full_BIT = 95, 1787404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96, 1788404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97, 1789404c7678SAmit Cohen ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98, 179016178c8eSPiergiorgio Beruto ETHTOOL_LINK_MODE_10baseT1S_Full_BIT = 99, 179116178c8eSPiergiorgio Beruto ETHTOOL_LINK_MODE_10baseT1S_Half_BIT = 100, 179216178c8eSPiergiorgio Beruto ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT = 101, 1793404c7678SAmit Cohen 1794e728fdf0SHeiner Kallweit /* must be last entry */ 1795e728fdf0SHeiner Kallweit __ETHTOOL_LINK_MODE_MASK_NBITS 17963f1ac7a7SDavid Decotigny }; 17973f1ac7a7SDavid Decotigny 17983f1ac7a7SDavid Decotigny #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \ 17993f1ac7a7SDavid Decotigny (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT)) 18003f1ac7a7SDavid Decotigny 18013f1ac7a7SDavid Decotigny /* DEPRECATED macros. Please migrate to 18023f1ac7a7SDavid Decotigny * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT 18033f1ac7a7SDavid Decotigny * define any new SUPPORTED_* macro for bits > 31. 18043f1ac7a7SDavid Decotigny */ 18053f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) 18063f1ac7a7SDavid Decotigny #define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) 18073f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) 18083f1ac7a7SDavid Decotigny #define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) 18093f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) 18103f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) 18113f1ac7a7SDavid Decotigny #define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) 18123f1ac7a7SDavid Decotigny #define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) 18133f1ac7a7SDavid Decotigny #define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) 18143f1ac7a7SDavid Decotigny #define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) 18153f1ac7a7SDavid Decotigny #define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) 18163f1ac7a7SDavid Decotigny #define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) 18173f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) 18183f1ac7a7SDavid Decotigny #define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) 18193f1ac7a7SDavid Decotigny #define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) 18203f1ac7a7SDavid Decotigny #define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) 18213f1ac7a7SDavid Decotigny #define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) 18223f1ac7a7SDavid Decotigny #define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) 18233f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) 18243f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) 18253f1ac7a7SDavid Decotigny #define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) 18263f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) 18273f1ac7a7SDavid Decotigny #define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) 18283f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) 18293f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) 18303f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) 18313f1ac7a7SDavid Decotigny #define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) 18323f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) 18333f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) 18343f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) 18353f1ac7a7SDavid Decotigny #define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) 18363f1ac7a7SDavid Decotigny /* Please do not define any new SUPPORTED_* macro for bits > 31, see 18373f1ac7a7SDavid Decotigny * notice above. 18383f1ac7a7SDavid Decotigny */ 18393f1ac7a7SDavid Decotigny 18403f1ac7a7SDavid Decotigny /* 18413f1ac7a7SDavid Decotigny * DEPRECATED macros. Please migrate to 18423f1ac7a7SDavid Decotigny * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT 18433f1ac7a7SDavid Decotigny * define any new ADERTISE_* macro for bits > 31. 18443f1ac7a7SDavid Decotigny */ 18453f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half) 18463f1ac7a7SDavid Decotigny #define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full) 18473f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half) 18483f1ac7a7SDavid Decotigny #define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full) 18493f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half) 18503f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full) 18513f1ac7a7SDavid Decotigny #define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg) 18523f1ac7a7SDavid Decotigny #define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP) 18533f1ac7a7SDavid Decotigny #define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI) 18543f1ac7a7SDavid Decotigny #define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII) 18553f1ac7a7SDavid Decotigny #define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE) 18563f1ac7a7SDavid Decotigny #define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC) 18573f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full) 18583f1ac7a7SDavid Decotigny #define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause) 18593f1ac7a7SDavid Decotigny #define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause) 18603f1ac7a7SDavid Decotigny #define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full) 18613f1ac7a7SDavid Decotigny #define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane) 18623f1ac7a7SDavid Decotigny #define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full) 18633f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full) 18643f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full) 18653f1ac7a7SDavid Decotigny #define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC) 18663f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full) 18673f1ac7a7SDavid Decotigny #define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full) 18683f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full) 18693f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full) 18703f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full) 18713f1ac7a7SDavid Decotigny #define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full) 18723f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full) 18733f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full) 18743f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full) 18753f1ac7a7SDavid Decotigny #define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full) 18763f1ac7a7SDavid Decotigny /* Please do not define any new ADVERTISED_* macro for bits > 31, see 18773f1ac7a7SDavid Decotigny * notice above. 18783f1ac7a7SDavid Decotigny */ 1879607ca46eSDavid Howells 1880607ca46eSDavid Howells /* The following are all involved in forcing a particular link 1881607ca46eSDavid Howells * mode for the device for setting things. When getting the 1882607ca46eSDavid Howells * devices settings, these indicate the current mode and whether 1883607ca46eSDavid Howells * it was forced up into this mode or autonegotiated. 1884607ca46eSDavid Howells */ 1885607ca46eSDavid Howells 1886297fb414SNicolas Dichtel /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. 1887297fb414SNicolas Dichtel * Update drivers/net/phy/phy.c:phy_speed_to_str() and 1888297fb414SNicolas Dichtel * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. 1889297fb414SNicolas Dichtel */ 1890607ca46eSDavid Howells #define SPEED_10 10 1891607ca46eSDavid Howells #define SPEED_100 100 1892607ca46eSDavid Howells #define SPEED_1000 1000 1893607ca46eSDavid Howells #define SPEED_2500 2500 1894c9a70d43SParav Pandit #define SPEED_5000 5000 1895607ca46eSDavid Howells #define SPEED_10000 10000 18960d7e2d21SZhu Yanjun #define SPEED_14000 14000 1897dcf972a3SSaeed Mahameed #define SPEED_20000 20000 1898c9a70d43SParav Pandit #define SPEED_25000 25000 1899dcf972a3SSaeed Mahameed #define SPEED_40000 40000 1900c9a70d43SParav Pandit #define SPEED_50000 50000 1901dcf972a3SSaeed Mahameed #define SPEED_56000 56000 1902c9a70d43SParav Pandit #define SPEED_100000 100000 19032736d94fSAya Levin #define SPEED_200000 200000 190414af7fd1SJiri Pirko #define SPEED_400000 400000 1905404c7678SAmit Cohen #define SPEED_800000 800000 1906dcf972a3SSaeed Mahameed 1907607ca46eSDavid Howells #define SPEED_UNKNOWN -1 1908607ca46eSDavid Howells 1909103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_speed(__u32 speed) 1910103a8ad1SNikolay Aleksandrov { 1911afe64245SMichael Zhivich return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN; 1912103a8ad1SNikolay Aleksandrov } 1913103a8ad1SNikolay Aleksandrov 1914607ca46eSDavid Howells /* Duplex, half or full. */ 1915607ca46eSDavid Howells #define DUPLEX_HALF 0x00 1916607ca46eSDavid Howells #define DUPLEX_FULL 0x01 1917607ca46eSDavid Howells #define DUPLEX_UNKNOWN 0xff 1918607ca46eSDavid Howells 1919103a8ad1SNikolay Aleksandrov static inline int ethtool_validate_duplex(__u8 duplex) 1920103a8ad1SNikolay Aleksandrov { 1921103a8ad1SNikolay Aleksandrov switch (duplex) { 1922103a8ad1SNikolay Aleksandrov case DUPLEX_HALF: 1923103a8ad1SNikolay Aleksandrov case DUPLEX_FULL: 1924103a8ad1SNikolay Aleksandrov case DUPLEX_UNKNOWN: 1925103a8ad1SNikolay Aleksandrov return 1; 1926103a8ad1SNikolay Aleksandrov } 1927103a8ad1SNikolay Aleksandrov 1928103a8ad1SNikolay Aleksandrov return 0; 1929103a8ad1SNikolay Aleksandrov } 1930103a8ad1SNikolay Aleksandrov 1931bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_UNSUPPORTED 0 1932bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_UNKNOWN 1 1933bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_MASTER_PREFERRED 2 1934bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_SLAVE_PREFERRED 3 1935bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_MASTER_FORCE 4 1936bdbdac76SOleksij Rempel #define MASTER_SLAVE_CFG_SLAVE_FORCE 5 1937bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_UNSUPPORTED 0 1938bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_UNKNOWN 1 1939bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_MASTER 2 1940bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_SLAVE 3 1941bdbdac76SOleksij Rempel #define MASTER_SLAVE_STATE_ERR 4 1942bdbdac76SOleksij Rempel 19430c3e10cbSSean Anderson /* These are used to throttle the rate of data on the phy interface when the 19440c3e10cbSSean Anderson * native speed of the interface is higher than the link speed. These should 19450c3e10cbSSean Anderson * not be used for phy interfaces which natively support multiple speeds (e.g. 19460c3e10cbSSean Anderson * MII or SGMII). 19470c3e10cbSSean Anderson */ 19480c3e10cbSSean Anderson /* No rate matching performed. */ 19490c3e10cbSSean Anderson #define RATE_MATCH_NONE 0 19500c3e10cbSSean Anderson /* The phy sends pause frames to throttle the MAC. */ 19510c3e10cbSSean Anderson #define RATE_MATCH_PAUSE 1 19520c3e10cbSSean Anderson /* The phy asserts CRS to prevent the MAC from transmitting. */ 19530c3e10cbSSean Anderson #define RATE_MATCH_CRS 2 19540c3e10cbSSean Anderson /* The MAC is programmed with a sufficiently-large IPG. */ 19550c3e10cbSSean Anderson #define RATE_MATCH_OPEN_LOOP 3 19560c3e10cbSSean Anderson 1957607ca46eSDavid Howells /* Which connector port. */ 1958607ca46eSDavid Howells #define PORT_TP 0x00 1959607ca46eSDavid Howells #define PORT_AUI 0x01 1960607ca46eSDavid Howells #define PORT_MII 0x02 1961607ca46eSDavid Howells #define PORT_FIBRE 0x03 1962607ca46eSDavid Howells #define PORT_BNC 0x04 1963607ca46eSDavid Howells #define PORT_DA 0x05 1964607ca46eSDavid Howells #define PORT_NONE 0xef 1965607ca46eSDavid Howells #define PORT_OTHER 0xff 1966607ca46eSDavid Howells 1967607ca46eSDavid Howells /* Which transceiver to use. */ 19687ec87211SFlorian Fainelli #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */ 19697ec87211SFlorian Fainelli #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */ 1970607ca46eSDavid Howells #define XCVR_DUMMY1 0x02 1971607ca46eSDavid Howells #define XCVR_DUMMY2 0x03 1972607ca46eSDavid Howells #define XCVR_DUMMY3 0x04 1973607ca46eSDavid Howells 1974bf8fc60aSBen Hutchings /* Enable or disable autonegotiation. */ 1975607ca46eSDavid Howells #define AUTONEG_DISABLE 0x00 1976607ca46eSDavid Howells #define AUTONEG_ENABLE 0x01 1977607ca46eSDavid Howells 1978607ca46eSDavid Howells /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then 1979607ca46eSDavid Howells * the driver is required to renegotiate link 1980607ca46eSDavid Howells */ 1981607ca46eSDavid Howells #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */ 1982607ca46eSDavid Howells #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */ 1983607ca46eSDavid Howells #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */ 1984607ca46eSDavid Howells #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */ 1985607ca46eSDavid Howells 1986607ca46eSDavid Howells /* Wake-On-Lan options. */ 1987607ca46eSDavid Howells #define WAKE_PHY (1 << 0) 1988607ca46eSDavid Howells #define WAKE_UCAST (1 << 1) 1989607ca46eSDavid Howells #define WAKE_MCAST (1 << 2) 1990607ca46eSDavid Howells #define WAKE_BCAST (1 << 3) 1991607ca46eSDavid Howells #define WAKE_ARP (1 << 4) 1992607ca46eSDavid Howells #define WAKE_MAGIC (1 << 5) 1993607ca46eSDavid Howells #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ 19946cfef793SFlorian Fainelli #define WAKE_FILTER (1 << 7) 1995607ca46eSDavid Howells 199651ea22b0SMichal Kubecek #define WOL_MODE_COUNT 8 199751ea22b0SMichal Kubecek 199813e59344SAhmed Zaki /* RSS hash function data 199913e59344SAhmed Zaki * XOR the corresponding source and destination fields of each specified 200013e59344SAhmed Zaki * protocol. Both copies of the XOR'ed fields are fed into the RSS and RXHASH 200113e59344SAhmed Zaki * calculation. Note that this XORing reduces the input set entropy and could 200213e59344SAhmed Zaki * be exploited to reduce the RSS queue spread. 200313e59344SAhmed Zaki */ 200413e59344SAhmed Zaki #define RXH_XFRM_SYM_XOR (1 << 0) 20050dd415d1SAhmed Zaki #define RXH_XFRM_NO_CHANGE 0xff 200613e59344SAhmed Zaki 2007607ca46eSDavid Howells /* L2-L4 network traffic flow types */ 2008607ca46eSDavid Howells #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ 2009607ca46eSDavid Howells #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ 2010607ca46eSDavid Howells #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ 2011607ca46eSDavid Howells #define AH_ESP_V4_FLOW 0x04 /* hash only */ 201272bb6872SEdward Cree #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */ 201372bb6872SEdward Cree #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */ 201472bb6872SEdward Cree #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */ 2015607ca46eSDavid Howells #define AH_ESP_V6_FLOW 0x08 /* hash only */ 2016607ca46eSDavid Howells #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ 2017607ca46eSDavid Howells #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ 201872bb6872SEdward Cree #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */ 201972bb6872SEdward Cree #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */ 202072bb6872SEdward Cree #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ 202172bb6872SEdward Cree #define IP_USER_FLOW IPV4_USER_FLOW 202272bb6872SEdward Cree #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */ 2023607ca46eSDavid Howells #define IPV4_FLOW 0x10 /* hash only */ 2024607ca46eSDavid Howells #define IPV6_FLOW 0x11 /* hash only */ 2025607ca46eSDavid Howells #define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 2026*0ed3bba1STakeru Hayasaka 2027*0ed3bba1STakeru Hayasaka /* Used for GTP-U IPv4 and IPv6. 2028*0ed3bba1STakeru Hayasaka * The format of GTP packets only includes 2029*0ed3bba1STakeru Hayasaka * elements such as TEID and GTP version. 2030*0ed3bba1STakeru Hayasaka * It is primarily intended for data communication of the UE. 2031*0ed3bba1STakeru Hayasaka */ 2032*0ed3bba1STakeru Hayasaka #define GTPU_V4_FLOW 0x13 /* hash only */ 2033*0ed3bba1STakeru Hayasaka #define GTPU_V6_FLOW 0x14 /* hash only */ 2034*0ed3bba1STakeru Hayasaka 2035*0ed3bba1STakeru Hayasaka /* Use for GTP-C IPv4 and v6. 2036*0ed3bba1STakeru Hayasaka * The format of these GTP packets does not include TEID. 2037*0ed3bba1STakeru Hayasaka * Primarily expected to be used for communication 2038*0ed3bba1STakeru Hayasaka * to create sessions for UE data communication, 2039*0ed3bba1STakeru Hayasaka * commonly referred to as CSR (Create Session Request). 2040*0ed3bba1STakeru Hayasaka */ 2041*0ed3bba1STakeru Hayasaka #define GTPC_V4_FLOW 0x15 /* hash only */ 2042*0ed3bba1STakeru Hayasaka #define GTPC_V6_FLOW 0x16 /* hash only */ 2043*0ed3bba1STakeru Hayasaka 2044*0ed3bba1STakeru Hayasaka /* Use for GTP-C IPv4 and v6. 2045*0ed3bba1STakeru Hayasaka * Unlike GTPC_V4_FLOW, the format of these GTP packets includes TEID. 2046*0ed3bba1STakeru Hayasaka * After session creation, it becomes this packet. 2047*0ed3bba1STakeru Hayasaka * This is mainly used for requests to realize UE handover. 2048*0ed3bba1STakeru Hayasaka */ 2049*0ed3bba1STakeru Hayasaka #define GTPC_TEID_V4_FLOW 0x17 /* hash only */ 2050*0ed3bba1STakeru Hayasaka #define GTPC_TEID_V6_FLOW 0x18 /* hash only */ 2051*0ed3bba1STakeru Hayasaka 2052*0ed3bba1STakeru Hayasaka /* Use for GTP-U and extended headers for the PSC (PDU Session Container). 2053*0ed3bba1STakeru Hayasaka * The format of these GTP packets includes TEID and QFI. 2054*0ed3bba1STakeru Hayasaka * In 5G communication using UPF (User Plane Function), 2055*0ed3bba1STakeru Hayasaka * data communication with this extended header is performed. 2056*0ed3bba1STakeru Hayasaka */ 2057*0ed3bba1STakeru Hayasaka #define GTPU_EH_V4_FLOW 0x19 /* hash only */ 2058*0ed3bba1STakeru Hayasaka #define GTPU_EH_V6_FLOW 0x1a /* hash only */ 2059*0ed3bba1STakeru Hayasaka 2060*0ed3bba1STakeru Hayasaka /* Use for GTP-U IPv4 and v6 PSC (PDU Session Container) extended headers. 2061*0ed3bba1STakeru Hayasaka * This differs from GTPU_EH_V(4|6)_FLOW in that it is distinguished by 2062*0ed3bba1STakeru Hayasaka * UL/DL included in the PSC. 2063*0ed3bba1STakeru Hayasaka * There are differences in the data included based on Downlink/Uplink, 2064*0ed3bba1STakeru Hayasaka * and can be used to distinguish packets. 2065*0ed3bba1STakeru Hayasaka * The functions described so far are useful when you want to 2066*0ed3bba1STakeru Hayasaka * handle communication from the mobile network in UPF, PGW, etc. 2067*0ed3bba1STakeru Hayasaka */ 2068*0ed3bba1STakeru Hayasaka #define GTPU_UL_V4_FLOW 0x1b /* hash only */ 2069*0ed3bba1STakeru Hayasaka #define GTPU_UL_V6_FLOW 0x1c /* hash only */ 2070*0ed3bba1STakeru Hayasaka #define GTPU_DL_V4_FLOW 0x1d /* hash only */ 2071*0ed3bba1STakeru Hayasaka #define GTPU_DL_V6_FLOW 0x1e /* hash only */ 2072*0ed3bba1STakeru Hayasaka 2073607ca46eSDavid Howells /* Flag to enable additional fields in struct ethtool_rx_flow_spec */ 2074607ca46eSDavid Howells #define FLOW_EXT 0x80000000 2075d4676eacSYan Burman #define FLOW_MAC_EXT 0x40000000 207684a1d9c4SEdward Cree /* Flag to enable RSS spreading of traffic matching rule (nfc only) */ 207784a1d9c4SEdward Cree #define FLOW_RSS 0x20000000 2078607ca46eSDavid Howells 2079607ca46eSDavid Howells /* L3-L4 network traffic flow hash options */ 2080607ca46eSDavid Howells #define RXH_L2DA (1 << 1) 2081607ca46eSDavid Howells #define RXH_VLAN (1 << 2) 2082607ca46eSDavid Howells #define RXH_L3_PROTO (1 << 3) 2083607ca46eSDavid Howells #define RXH_IP_SRC (1 << 4) 2084607ca46eSDavid Howells #define RXH_IP_DST (1 << 5) 2085607ca46eSDavid Howells #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ 2086607ca46eSDavid Howells #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ 2087*0ed3bba1STakeru Hayasaka #define RXH_GTP_TEID (1 << 8) /* teid in case of GTP */ 2088607ca46eSDavid Howells #define RXH_DISCARD (1 << 31) 2089607ca46eSDavid Howells 2090607ca46eSDavid Howells #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 20916cfef793SFlorian Fainelli #define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL 2092607ca46eSDavid Howells 2093607ca46eSDavid Howells /* Special RX classification rule insert location values */ 2094607ca46eSDavid Howells #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */ 2095607ca46eSDavid Howells #define RX_CLS_LOC_ANY 0xffffffff 2096607ca46eSDavid Howells #define RX_CLS_LOC_FIRST 0xfffffffe 2097607ca46eSDavid Howells #define RX_CLS_LOC_LAST 0xfffffffd 2098607ca46eSDavid Howells 2099607ca46eSDavid Howells /* EEPROM Standards for plug in modules */ 2100607ca46eSDavid Howells #define ETH_MODULE_SFF_8079 0x1 2101607ca46eSDavid Howells #define ETH_MODULE_SFF_8079_LEN 256 2102607ca46eSDavid Howells #define ETH_MODULE_SFF_8472 0x2 2103607ca46eSDavid Howells #define ETH_MODULE_SFF_8472_LEN 512 21047202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636 0x3 21057202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8636_LEN 256 21067202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436 0x4 21077202da8bSSaeed Mahameed #define ETH_MODULE_SFF_8436_LEN 256 2108607ca46eSDavid Howells 21090e1a2a3eSErez Alfasi #define ETH_MODULE_SFF_8636_MAX_LEN 640 21100e1a2a3eSErez Alfasi #define ETH_MODULE_SFF_8436_MAX_LEN 640 21110e1a2a3eSErez Alfasi 2112607ca46eSDavid Howells /* Reset flags */ 2113607ca46eSDavid Howells /* The reset() operation must clear the flags for the components which 2114607ca46eSDavid Howells * were actually reset. On successful return, the flags indicate the 2115607ca46eSDavid Howells * components which were not reset, either because they do not exist 2116607ca46eSDavid Howells * in the hardware or because they cannot be reset independently. The 2117607ca46eSDavid Howells * driver must never reset any components that were not requested. 2118607ca46eSDavid Howells */ 2119607ca46eSDavid Howells enum ethtool_reset_flags { 2120607ca46eSDavid Howells /* These flags represent components dedicated to the interface 2121607ca46eSDavid Howells * the command is addressed to. Shift any flag left by 2122607ca46eSDavid Howells * ETH_RESET_SHARED_SHIFT to reset a shared component of the 2123607ca46eSDavid Howells * same type. 2124607ca46eSDavid Howells */ 2125607ca46eSDavid Howells ETH_RESET_MGMT = 1 << 0, /* Management processor */ 2126607ca46eSDavid Howells ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */ 2127607ca46eSDavid Howells ETH_RESET_DMA = 1 << 2, /* DMA engine */ 2128607ca46eSDavid Howells ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */ 2129607ca46eSDavid Howells ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */ 2130607ca46eSDavid Howells ETH_RESET_MAC = 1 << 5, /* Media access controller */ 2131607ca46eSDavid Howells ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */ 2132607ca46eSDavid Howells ETH_RESET_RAM = 1 << 7, /* RAM shared between 2133607ca46eSDavid Howells * multiple components */ 213440e44a1eSScott Branden ETH_RESET_AP = 1 << 8, /* Application processor */ 2135607ca46eSDavid Howells 2136607ca46eSDavid Howells ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to 2137607ca46eSDavid Howells * this interface */ 2138607ca46eSDavid Howells ETH_RESET_ALL = 0xffffffff, /* All components used by this 2139607ca46eSDavid Howells * interface, even if shared */ 2140607ca46eSDavid Howells }; 2141607ca46eSDavid Howells #define ETH_RESET_SHARED_SHIFT 16 2142607ca46eSDavid Howells 21433f1ac7a7SDavid Decotigny 21443f1ac7a7SDavid Decotigny /** 21453f1ac7a7SDavid Decotigny * struct ethtool_link_settings - link control and status 21463f1ac7a7SDavid Decotigny * 21473f1ac7a7SDavid Decotigny * IMPORTANT, Backward compatibility notice: When implementing new 21483f1ac7a7SDavid Decotigny * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and 21493f1ac7a7SDavid Decotigny * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link 21503f1ac7a7SDavid Decotigny * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS 21513f1ac7a7SDavid Decotigny * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in 21523f1ac7a7SDavid Decotigny * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use 21533f1ac7a7SDavid Decotigny * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link 21543f1ac7a7SDavid Decotigny * settings; do not use %ETHTOOL_SLINKSETTINGS if 21553f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS failed: stick to 21563f1ac7a7SDavid Decotigny * %ETHTOOL_GSET/%ETHTOOL_SSET in that case. 21573f1ac7a7SDavid Decotigny * 21583f1ac7a7SDavid Decotigny * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS 21593f1ac7a7SDavid Decotigny * @speed: Link speed (Mbps) 21603f1ac7a7SDavid Decotigny * @duplex: Duplex mode; one of %DUPLEX_* 21613f1ac7a7SDavid Decotigny * @port: Physical connector type; one of %PORT_* 21623f1ac7a7SDavid Decotigny * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not 21633f1ac7a7SDavid Decotigny * applicable. For clause 45 PHYs this is the PRTAD. 21643f1ac7a7SDavid Decotigny * @autoneg: Enable/disable autonegotiation and auto-detection; 21653f1ac7a7SDavid Decotigny * either %AUTONEG_DISABLE or %AUTONEG_ENABLE 21663f1ac7a7SDavid Decotigny * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO 21673f1ac7a7SDavid Decotigny * protocols supported by the interface; 0 if unknown. 21683f1ac7a7SDavid Decotigny * Read-only. 21693f1ac7a7SDavid Decotigny * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of 21703f1ac7a7SDavid Decotigny * %ETH_TP_MDI_*. If the status is unknown or not applicable, the 21713f1ac7a7SDavid Decotigny * value will be %ETH_TP_MDI_INVALID. Read-only. 21723f1ac7a7SDavid Decotigny * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of 21733f1ac7a7SDavid Decotigny * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads 21743f1ac7a7SDavid Decotigny * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected. 21753f1ac7a7SDavid Decotigny * When written successfully, the link should be renegotiated if 21763f1ac7a7SDavid Decotigny * necessary. 21773f1ac7a7SDavid Decotigny * @link_mode_masks_nwords: Number of 32-bit words for each of the 21783f1ac7a7SDavid Decotigny * supported, advertising, lp_advertising link mode bitmaps. For 21793f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user 21803f1ac7a7SDavid Decotigny * (>= 0); on return, if handshake in progress, negative if 21813f1ac7a7SDavid Decotigny * request size unsupported by kernel: absolute value indicates 21825f2d4724SDavid Decotigny * kernel expected size and all the other fields but cmd 21835f2d4724SDavid Decotigny * are 0; otherwise (handshake completed), strictly positive 21845f2d4724SDavid Decotigny * to indicate size used by kernel and cmd field stays 21853f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For 21863f1ac7a7SDavid Decotigny * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive 21873f1ac7a7SDavid Decotigny * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise 21883f1ac7a7SDavid Decotigny * refused. For drivers: ignore this field (use kernel's 21893f1ac7a7SDavid Decotigny * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will 21903f1ac7a7SDavid Decotigny * be overwritten by kernel. 219119cab887SFlorian Fainelli * @transceiver: Used to distinguish different possible PHY types, 219219cab887SFlorian Fainelli * reported consistently by PHYLIB. Read-only. 2193d9c65de0SJakub Kicinski * @master_slave_cfg: Master/slave port mode. 2194d9c65de0SJakub Kicinski * @master_slave_state: Master/slave port state. 21950c3e10cbSSean Anderson * @rate_matching: Rate adaptation performed by the PHY 219683e5feebSJakub Kicinski * @reserved: Reserved for future use; see the note on reserved space. 2197d9c65de0SJakub Kicinski * @link_mode_masks: Variable length bitmaps. 21983f1ac7a7SDavid Decotigny * 21993f1ac7a7SDavid Decotigny * If autonegotiation is disabled, the speed and @duplex represent the 22003f1ac7a7SDavid Decotigny * fixed link mode and are writable if the driver supports multiple 22013f1ac7a7SDavid Decotigny * link modes. If it is enabled then they are read-only; if the link 22023f1ac7a7SDavid Decotigny * is up they represent the negotiated link mode; if the link is down, 22033f1ac7a7SDavid Decotigny * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and 22043f1ac7a7SDavid Decotigny * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode. 22053f1ac7a7SDavid Decotigny * 22063f1ac7a7SDavid Decotigny * Some hardware interfaces may have multiple PHYs and/or physical 22073f1ac7a7SDavid Decotigny * connectors fitted or do not allow the driver to detect which are 22083f1ac7a7SDavid Decotigny * fitted. For these interfaces @port and/or @phy_address may be 22093f1ac7a7SDavid Decotigny * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE. 22103f1ac7a7SDavid Decotigny * Otherwise, attempts to write different values may be ignored or 22113f1ac7a7SDavid Decotigny * rejected. 22123f1ac7a7SDavid Decotigny * 22133f1ac7a7SDavid Decotigny * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt 22149b300495SMichal Kubecek * are not available in %ethtool_link_settings. These fields will be 22159b300495SMichal Kubecek * always set to zero in %ETHTOOL_GSET reply and %ETHTOOL_SSET will 22169b300495SMichal Kubecek * fail if any of them is set to non-zero value. 22173f1ac7a7SDavid Decotigny * 22183f1ac7a7SDavid Decotigny * Users should assume that all fields not marked read-only are 22193f1ac7a7SDavid Decotigny * writable and subject to validation by the driver. They should use 22203f1ac7a7SDavid Decotigny * %ETHTOOL_GLINKSETTINGS to get the current values before making specific 22213f1ac7a7SDavid Decotigny * changes and then applying them with %ETHTOOL_SLINKSETTINGS. 22223f1ac7a7SDavid Decotigny * 22233f1ac7a7SDavid Decotigny * Drivers that implement %get_link_ksettings and/or 22243f1ac7a7SDavid Decotigny * %set_link_ksettings should ignore the @cmd 22253f1ac7a7SDavid Decotigny * and @link_mode_masks_nwords fields (any change to them overwritten 22263f1ac7a7SDavid Decotigny * by kernel), and rely only on kernel's internal 22273f1ac7a7SDavid Decotigny * %__ETHTOOL_LINK_MODE_MASK_NBITS and 22283f1ac7a7SDavid Decotigny * %ethtool_link_mode_mask_t. Drivers that implement 22293f1ac7a7SDavid Decotigny * %set_link_ksettings() should validate all fields other than @cmd 22303f1ac7a7SDavid Decotigny * and @link_mode_masks_nwords that are not described as read-only or 22313f1ac7a7SDavid Decotigny * deprecated, and must ignore all fields described as read-only. 2232d0c3891dSJonathan Corbet * 2233d0c3891dSJonathan Corbet * @link_mode_masks is divided into three bitfields, each of length 2234d0c3891dSJonathan Corbet * @link_mode_masks_nwords: 2235d0c3891dSJonathan Corbet * - supported: Bitmap with each bit meaning given by 2236d0c3891dSJonathan Corbet * %ethtool_link_mode_bit_indices for the link modes, physical 2237d0c3891dSJonathan Corbet * connectors and other link features for which the interface 2238d0c3891dSJonathan Corbet * supports autonegotiation or auto-detection. Read-only. 2239d0c3891dSJonathan Corbet * - advertising: Bitmap with each bit meaning given by 2240d0c3891dSJonathan Corbet * %ethtool_link_mode_bit_indices for the link modes, physical 2241d0c3891dSJonathan Corbet * connectors and other link features that are advertised through 2242d0c3891dSJonathan Corbet * autonegotiation or enabled for auto-detection. 2243d0c3891dSJonathan Corbet * - lp_advertising: Bitmap with each bit meaning given by 2244d0c3891dSJonathan Corbet * %ethtool_link_mode_bit_indices for the link modes, and other 2245d0c3891dSJonathan Corbet * link features that the link partner advertised through 2246d0c3891dSJonathan Corbet * autonegotiation; 0 if unknown or not applicable. Read-only. 22473f1ac7a7SDavid Decotigny */ 22483f1ac7a7SDavid Decotigny struct ethtool_link_settings { 22493f1ac7a7SDavid Decotigny __u32 cmd; 22503f1ac7a7SDavid Decotigny __u32 speed; 22513f1ac7a7SDavid Decotigny __u8 duplex; 22523f1ac7a7SDavid Decotigny __u8 port; 22533f1ac7a7SDavid Decotigny __u8 phy_address; 22543f1ac7a7SDavid Decotigny __u8 autoneg; 22553f1ac7a7SDavid Decotigny __u8 mdio_support; 22563f1ac7a7SDavid Decotigny __u8 eth_tp_mdix; 22573f1ac7a7SDavid Decotigny __u8 eth_tp_mdix_ctrl; 22583f1ac7a7SDavid Decotigny __s8 link_mode_masks_nwords; 225919cab887SFlorian Fainelli __u8 transceiver; 2260bdbdac76SOleksij Rempel __u8 master_slave_cfg; 2261bdbdac76SOleksij Rempel __u8 master_slave_state; 22620c3e10cbSSean Anderson __u8 rate_matching; 226319cab887SFlorian Fainelli __u32 reserved[7]; 226494dfc73eSGustavo A. R. Silva __u32 link_mode_masks[]; 22653f1ac7a7SDavid Decotigny /* layout of link_mode_masks fields: 22663f1ac7a7SDavid Decotigny * __u32 map_supported[link_mode_masks_nwords]; 22673f1ac7a7SDavid Decotigny * __u32 map_advertising[link_mode_masks_nwords]; 22683f1ac7a7SDavid Decotigny * __u32 map_lp_advertising[link_mode_masks_nwords]; 22693f1ac7a7SDavid Decotigny */ 22703f1ac7a7SDavid Decotigny }; 2271607ca46eSDavid Howells #endif /* _UAPI_LINUX_ETHTOOL_H */ 2272