1/* 2 * @TAG(OTHER_GPL) 3 */ 4 5/* 6 * ethtool.h: Defines for Linux ethtool. 7 * 8 * Copyright (C) 1998 David S. Miller (davem@redhat.com) 9 * Copyright 2001 Jeff Garzik <jgarzik@pobox.com> 10 * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) 11 * Portions Copyright 2002 Intel (eli.kupermann@intel.com, 12 * christopher.leech@intel.com, 13 * scott.feldman@intel.com) 14 * Portions Copyright (C) Sun Microsystems 2008 15 */ 16 17#pragma once 18 19#include <stdint.h> 20 21/* This should work for both 32 and 64 bit userland. */ 22struct ethtool_cmd { 23 uint32_t cmd; 24 uint32_t supported; /* Features this interface supports */ 25 uint32_t advertising; /* Features this interface advertises */ 26 uint16_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ 27 uint8_t duplex; /* Duplex, half or full */ 28 uint8_t port; /* Which connector port */ 29 uint8_t phy_address; 30 uint8_t transceiver; /* Which transceiver to use */ 31 uint8_t autoneg; /* Enable or disable autonegotiation */ 32 uint8_t mdio_support; 33 uint32_t maxtxpkt; /* Tx pkts before generating tx int */ 34 uint32_t maxrxpkt; /* Rx pkts before generating rx int */ 35 uint16_t speed_hi; 36 uint8_t eth_tp_mdix; 37 uint8_t reserved2; 38 uint32_t lp_advertising; /* Features the link partner advertises */ 39 uint32_t reserved[2]; 40}; 41 42static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 43 uint32_t speed) 44{ 45 46 ep->speed = (uint16_t)speed; 47 ep->speed_hi = (uint16_t)(speed >> 16); 48} 49 50static inline uint32_t ethtool_cmd_speed(struct ethtool_cmd *ep) 51{ 52 return (ep->speed_hi << 16) | ep->speed; 53} 54 55#define ETHTOOL_FWVERS_LEN 32 56#define ETHTOOL_BUSINFO_LEN 32 57/* these strings are set to whatever the driver author decides... */ 58struct ethtool_drvinfo { 59 uint32_t cmd; 60 char driver[32]; /* driver short name, "tulip", "eepro100" */ 61 char version[32]; /* driver version string */ 62 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */ 63 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ 64 /* For PCI devices, use pci_name(pci_dev). */ 65 char reserved1[32]; 66 char reserved2[12]; 67 /* 68 * Some struct members below are filled in 69 * using ops->get_sset_count(). Obtaining 70 * this info from ethtool_drvinfo is now 71 * deprecated; Use ETHTOOL_GSSET_INFO 72 * instead. 73 */ 74 uint32_t n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ 75 uint32_t n_stats; /* number of u64's from ETHTOOL_GSTATS */ 76 uint32_t testinfo_len; 77 uint32_t eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ 78 uint32_t regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ 79}; 80 81#define SOPASS_MAX 6 82/* wake-on-lan settings */ 83struct ethtool_wolinfo { 84 uint32_t cmd; 85 uint32_t supported; 86 uint32_t wolopts; 87 uint8_t sopass[SOPASS_MAX]; /* SecureOn(tm) password */ 88}; 89 90/* for passing single values */ 91struct ethtool_value { 92 uint32_t cmd; 93 uint32_t data; 94}; 95 96/* for passing big chunks of data */ 97struct ethtool_regs { 98 uint32_t cmd; 99 uint32_t version; /* driver-specific, indicates different chips/revs */ 100 uint32_t len; /* bytes */ 101 uint8_t data[0]; 102}; 103 104/* for passing EEPROM chunks */ 105struct ethtool_eeprom { 106 uint32_t cmd; 107 uint32_t magic; 108 uint32_t offset; /* in bytes */ 109 uint32_t len; /* in bytes */ 110 uint8_t data[0]; 111}; 112 113/* for configuring coalescing parameters of chip */ 114struct ethtool_coalesce { 115 uint32_t cmd; /* ETHTOOL_{G,S}COALESCE */ 116 117 /* How many usecs to delay an RX interrupt after 118 * a packet arrives. If 0, only rx_max_coalesced_frames 119 * is used. 120 */ 121 uint32_t rx_coalesce_usecs; 122 123 /* How many packets to delay an RX interrupt after 124 * a packet arrives. If 0, only rx_coalesce_usecs is 125 * used. It is illegal to set both usecs and max frames 126 * to zero as this would cause RX interrupts to never be 127 * generated. 128 */ 129 uint32_t rx_max_coalesced_frames; 130 131 /* Same as above two parameters, except that these values 132 * apply while an IRQ is being serviced by the host. Not 133 * all cards support this feature and the values are ignored 134 * in that case. 135 */ 136 uint32_t rx_coalesce_usecs_irq; 137 uint32_t rx_max_coalesced_frames_irq; 138 139 /* How many usecs to delay a TX interrupt after 140 * a packet is sent. If 0, only tx_max_coalesced_frames 141 * is used. 142 */ 143 uint32_t tx_coalesce_usecs; 144 145 /* How many packets to delay a TX interrupt after 146 * a packet is sent. If 0, only tx_coalesce_usecs is 147 * used. It is illegal to set both usecs and max frames 148 * to zero as this would cause TX interrupts to never be 149 * generated. 150 */ 151 uint32_t tx_max_coalesced_frames; 152 153 /* Same as above two parameters, except that these values 154 * apply while an IRQ is being serviced by the host. Not 155 * all cards support this feature and the values are ignored 156 * in that case. 157 */ 158 uint32_t tx_coalesce_usecs_irq; 159 uint32_t tx_max_coalesced_frames_irq; 160 161 /* How many usecs to delay in-memory statistics 162 * block updates. Some drivers do not have an in-memory 163 * statistic block, and in such cases this value is ignored. 164 * This value must not be zero. 165 */ 166 uint32_t stats_block_coalesce_usecs; 167 168 /* Adaptive RX/TX coalescing is an algorithm implemented by 169 * some drivers to improve latency under low packet rates and 170 * improve throughput under high packet rates. Some drivers 171 * only implement one of RX or TX adaptive coalescing. Anything 172 * not implemented by the driver causes these values to be 173 * silently ignored. 174 */ 175 uint32_t use_adaptive_rx_coalesce; 176 uint32_t use_adaptive_tx_coalesce; 177 178 /* When the packet rate (measured in packets per second) 179 * is below pkt_rate_low, the {rx,tx}_*_low parameters are 180 * used. 181 */ 182 uint32_t pkt_rate_low; 183 uint32_t rx_coalesce_usecs_low; 184 uint32_t rx_max_coalesced_frames_low; 185 uint32_t tx_coalesce_usecs_low; 186 uint32_t tx_max_coalesced_frames_low; 187 188 /* When the packet rate is below pkt_rate_high but above 189 * pkt_rate_low (both measured in packets per second) the 190 * normal {rx,tx}_* coalescing parameters are used. 191 */ 192 193 /* When the packet rate is (measured in packets per second) 194 * is above pkt_rate_high, the {rx,tx}_*_high parameters are 195 * used. 196 */ 197 uint32_t pkt_rate_high; 198 uint32_t rx_coalesce_usecs_high; 199 uint32_t rx_max_coalesced_frames_high; 200 uint32_t tx_coalesce_usecs_high; 201 uint32_t tx_max_coalesced_frames_high; 202 203 /* How often to do adaptive coalescing packet rate sampling, 204 * measured in seconds. Must not be zero. 205 */ 206 uint32_t rate_sample_interval; 207}; 208 209/* for configuring RX/TX ring parameters */ 210struct ethtool_ringparam { 211 uint32_t cmd; /* ETHTOOL_{G,S}RINGPARAM */ 212 213 /* Read only attributes. These indicate the maximum number 214 * of pending RX/TX ring entries the driver will allow the 215 * user to set. 216 */ 217 uint32_t rx_max_pending; 218 uint32_t rx_mini_max_pending; 219 uint32_t rx_jumbo_max_pending; 220 uint32_t tx_max_pending; 221 222 /* Values changeable by the user. The valid values are 223 * in the range 1 to the "*_max_pending" counterpart above. 224 */ 225 uint32_t rx_pending; 226 uint32_t rx_mini_pending; 227 uint32_t rx_jumbo_pending; 228 uint32_t tx_pending; 229}; 230 231/* for configuring link flow control parameters */ 232struct ethtool_pauseparam { 233 uint32_t cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ 234 235 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg 236 * being true) the user may set 'autonet' here non-zero to have the 237 * pause parameters be auto-negotiated too. In such a case, the 238 * {rx,tx}_pause values below determine what capabilities are 239 * advertised. 240 * 241 * If 'autoneg' is zero or the link is not being auto-negotiated, 242 * then {rx,tx}_pause force the driver to use/not-use pause 243 * flow control. 244 */ 245 uint32_t autoneg; 246 uint32_t rx_pause; 247 uint32_t tx_pause; 248}; 249 250#define ETH_GSTRING_LEN 32 251enum ethtool_stringset { 252 ETH_SS_TEST = 0, 253 ETH_SS_STATS, 254 ETH_SS_PRIV_FLAGS, 255 ETH_SS_NTUPLE_FILTERS, 256 ETH_SS_FEATURES, 257}; 258 259/* for passing string sets for data tagging */ 260struct ethtool_gstrings { 261 uint32_t cmd; /* ETHTOOL_GSTRINGS */ 262 uint32_t string_set; /* string set id e.c. ETH_SS_TEST, etc*/ 263 uint32_t len; /* number of strings in the string set */ 264 uint8_t data[0]; 265}; 266 267struct ethtool_sset_info { 268 uint32_t cmd; /* ETHTOOL_GSSET_INFO */ 269 uint32_t reserved; 270 uint64_t sset_mask; /* input: each bit selects an sset to query */ 271 /* output: each bit a returned sset */ 272 uint32_t data[0]; /* ETH_SS_xxx count, in order, based on bits 273 in sset_mask. One bit implies one 274 uint32_t, two bits implies two 275 uint32_t's, etc. */ 276}; 277 278enum ethtool_test_flags { 279 ETH_TEST_FL_OFFLINE = (BIT(0)), /* online / offline */ 280 ETH_TEST_FL_FAILED = (BIT(1)), /* test passed / failed */ 281}; 282 283/* for requesting NIC test and getting results*/ 284struct ethtool_test { 285 uint32_t cmd; /* ETHTOOL_TEST */ 286 uint32_t flags; /* ETH_TEST_FL_xxx */ 287 uint32_t reserved; 288 uint32_t len; /* result length, in number of u64 elements */ 289 uint64_t data[0]; 290}; 291 292/* for dumping NIC-specific statistics */ 293struct ethtool_stats { 294 uint32_t cmd; /* ETHTOOL_GSTATS */ 295 uint32_t n_stats; /* number of u64's being returned */ 296 uint64_t data[0]; 297}; 298 299struct ethtool_perm_addr { 300 uint32_t cmd; /* ETHTOOL_GPERMADDR */ 301 uint32_t size; 302 uint8_t data[0]; 303}; 304 305/* boolean flags controlling per-interface behavior characteristics. 306 * When reading, the flag indicates whether or not a certain behavior 307 * is enabled/present. When writing, the flag indicates whether 308 * or not the driver should turn on (set) or off (clear) a behavior. 309 * 310 * Some behaviors may read-only (unconditionally absent or present). 311 * If such is the case, return EINVAL in the set-flags operation if the 312 * flag differs from the read-only value. 313 */ 314enum ethtool_flags { 315 ETH_FLAG_TXVLAN = (BIT(7)), /* TX VLAN offload enabled */ 316 ETH_FLAG_RXVLAN = (BIT(8)), /* RX VLAN offload enabled */ 317 ETH_FLAG_LRO = (BIT(15)), /* LRO is enabled */ 318 ETH_FLAG_NTUPLE = (BIT(27)), /* N-tuple filters enabled */ 319 ETH_FLAG_RXHASH = (BIT(28)), 320}; 321 322/* The following structures are for supporting RX network flow 323 * classification and RX n-tuple configuration. Note, all multibyte 324 * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to 325 * be in network byte order. 326 */ 327 328/** 329 * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. 330 * @ip4src: Source host 331 * @ip4dst: Destination host 332 * @psrc: Source port 333 * @pdst: Destination port 334 * @tos: Type-of-service 335 * 336 * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. 337 */ 338struct ethtool_tcpip4_spec { 339 uint32_t ip4src; 340 uint32_t ip4dst; 341 uint16_t psrc; 342 uint16_t pdst; 343 uint8_t tos; 344}; 345 346/** 347 * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 348 * @ip4src: Source host 349 * @ip4dst: Destination host 350 * @spi: Security parameters index 351 * @tos: Type-of-service 352 * 353 * This can be used to specify an IPsec transport or tunnel over IPv4. 354 */ 355struct ethtool_ah_espip4_spec { 356 uint32_t ip4src; 357 uint32_t ip4dst; 358 uint32_t spi; 359 uint8_t tos; 360}; 361 362#define ETH_RX_NFC_IP4 1 363 364/** 365 * struct ethtool_usrip4_spec - general flow specification for IPv4 366 * @ip4src: Source host 367 * @ip4dst: Destination host 368 * @l4_4_bytes: First 4 bytes of transport (layer 4) header 369 * @tos: Type-of-service 370 * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 371 * @proto: Transport protocol number; mask must be 0 372 */ 373struct ethtool_usrip4_spec { 374 uint32_t ip4src; 375 uint32_t ip4dst; 376 uint32_t l4_4_bytes; 377 uint8_t tos; 378 uint8_t ip_ver; 379 uint8_t proto; 380}; 381 382/** 383 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 384 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 385 * @size: On entry, the array size of the user buffer. On return from 386 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table. 387 * @ring_index: RX ring/queue index for each hash value 388 */ 389struct ethtool_rxfh_indir { 390 uint32_t cmd; 391 uint32_t size; 392 uint32_t ring_index[0]; 393}; 394 395#define ETHTOOL_FLASH_MAX_FILENAME 128 396enum ethtool_flash_op_type { 397 ETHTOOL_FLASH_ALL_REGIONS = 0, 398}; 399 400/* for passing firmware flashing related parameters */ 401struct ethtool_flash { 402 uint32_t cmd; 403 uint32_t region; 404 char data[ETHTOOL_FLASH_MAX_FILENAME]; 405}; 406 407/* for returning and changing feature sets */ 408 409/** 410 * struct ethtool_get_features_block - block with state of 32 features 411 * @available: mask of changeable features 412 * @requested: mask of features requested to be enabled if possible 413 * @active: mask of currently enabled features 414 * @never_changed: mask of features not changeable for any device 415 */ 416struct ethtool_get_features_block { 417 uint32_t available; 418 uint32_t requested; 419 uint32_t active; 420 uint32_t never_changed; 421}; 422 423/** 424 * struct ethtool_gfeatures - command to get state of device's features 425 * @cmd: command number = %ETHTOOL_GFEATURES 426 * @size: in: number of elements in the features[] array; 427 * out: number of elements in features[] needed to hold all features 428 * @features: state of features 429 */ 430struct ethtool_gfeatures { 431 uint32_t cmd; 432 uint32_t size; 433 struct ethtool_get_features_block features[0]; 434}; 435 436/** 437 * struct ethtool_set_features_block - block with request for 32 features 438 * @valid: mask of features to be changed 439 * @requested: values of features to be changed 440 */ 441struct ethtool_set_features_block { 442 uint32_t valid; 443 uint32_t requested; 444}; 445 446/** 447 * struct ethtool_sfeatures - command to request change in device's features 448 * @cmd: command number = %ETHTOOL_SFEATURES 449 * @size: array size of the features[] array 450 * @features: feature change masks 451 */ 452struct ethtool_sfeatures { 453 uint32_t cmd; 454 uint32_t size; 455 struct ethtool_set_features_block features[0]; 456}; 457 458/* 459 * %ETHTOOL_SFEATURES changes features present in features[].valid to the 460 * values of corresponding bits in features[].requested. Bits in .requested 461 * not set in .valid or not changeable are ignored. 462 * 463 * Returns %EINVAL when .valid contains undefined or never-changable bits 464 * or size is not equal to required number of features words (32-bit blocks). 465 * Returns >= 0 if request was completed; bits set in the value mean: 466 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not 467 * changeable (not present in %ETHTOOL_GFEATURES' features[].available) 468 * those bits were ignored. 469 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the 470 * resulting state of bits masked by .valid is not equal to .requested. 471 * Probably there are other device-specific constraints on some features 472 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered 473 * here as though ignored bits were cleared. 474 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling 475 * compatibility functions. Requested offload state cannot be properly 476 * managed by kernel. 477 * 478 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of 479 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands 480 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least 481 * significant bit in features[0] fields. Empty strings mark undefined features. 482 */ 483enum ethtool_sfeatures_retval_bits { 484 ETHTOOL_F_UNSUPPORTED__BIT, 485 ETHTOOL_F_WISH__BIT, 486 ETHTOOL_F_COMPAT__BIT, 487}; 488 489#define ETHTOOL_F_UNSUPPORTED (BIT(ETHTOOL_F_UNSUPPORTED__BIT)) 490#define ETHTOOL_F_WISH (BIT(ETHTOOL_F_WISH__BIT)) 491#define ETHTOOL_F_COMPAT (BIT(ETHTOOL_F_COMPAT__BIT)) 492 493/* CMDs currently supported */ 494#define ETHTOOL_GSET 0x00000001 /* Get settings. */ 495#define ETHTOOL_SSET 0x00000002 /* Set settings. */ 496#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 497#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 498#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 499#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 500#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 501#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 502#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 503/* Get link status for host, i.e. whether the interface *and* the 504 * physical port (if there is one) are up (ethtool_value). */ 505#define ETHTOOL_GLINK 0x0000000a 506#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 507#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 508#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 509#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 510#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 511#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 512#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 513#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 514#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 515#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 516#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 517#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 518#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 519 * (ethtool_value) */ 520#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 521 * (ethtool_value). */ 522#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 523#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 524#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 525#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 526#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 527#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 528#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ 529#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ 530#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ 531#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ 532#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 533#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 534#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 535#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 536#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 537 538#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 539#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 540#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 541#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 542#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 543#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 544#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 545#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 546#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 547#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 548#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 549#define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 550#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 551#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ 552#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 553#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 554#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 555 556#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */ 557#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */ 558 559/* compatibility with older code */ 560#define SPARC_ETH_GSET ETHTOOL_GSET 561#define SPARC_ETH_SSET ETHTOOL_SSET 562 563/* Indicates what features are supported by the interface. */ 564#define SUPPORTED_10baseT_Half (BIT(0)) 565#define SUPPORTED_10baseT_Full (BIT(1)) 566#define SUPPORTED_100baseT_Half (BIT(2)) 567#define SUPPORTED_100baseT_Full (BIT(3)) 568#define SUPPORTED_1000baseT_Half (BIT(4)) 569#define SUPPORTED_1000baseT_Full (BIT(5)) 570#define SUPPORTED_Autoneg (BIT(6)) 571#define SUPPORTED_TP (BIT(7)) 572#define SUPPORTED_AUI (BIT(8)) 573#define SUPPORTED_MII (BIT(9)) 574#define SUPPORTED_FIBRE (BIT(10)) 575#define SUPPORTED_BNC (BIT(11)) 576#define SUPPORTED_10000baseT_Full (BIT(12)) 577#define SUPPORTED_Pause (BIT(13)) 578#define SUPPORTED_Asym_Pause (BIT(14)) 579#define SUPPORTED_2500baseX_Full (BIT(15)) 580#define SUPPORTED_Backplane (BIT(16)) 581#define SUPPORTED_1000baseKX_Full (BIT(17)) 582#define SUPPORTED_10000baseKX4_Full (BIT(18)) 583#define SUPPORTED_10000baseKR_Full (BIT(19)) 584#define SUPPORTED_10000baseR_FEC (BIT(20)) 585 586/* Indicates what features are advertised by the interface. */ 587#define ADVERTISED_10baseT_Half (BIT(0)) 588#define ADVERTISED_10baseT_Full (BIT(1)) 589#define ADVERTISED_100baseT_Half (BIT(2)) 590#define ADVERTISED_100baseT_Full (BIT(3)) 591#define ADVERTISED_1000baseT_Half (BIT(4)) 592#define ADVERTISED_1000baseT_Full (BIT(5)) 593#define ADVERTISED_Autoneg (BIT(6)) 594#define ADVERTISED_TP (BIT(7)) 595#define ADVERTISED_AUI (BIT(8)) 596#define ADVERTISED_MII (BIT(9)) 597#define ADVERTISED_FIBRE (BIT(10)) 598#define ADVERTISED_BNC (BIT(11)) 599#define ADVERTISED_10000baseT_Full (BIT(12)) 600#define ADVERTISED_Pause (BIT(13)) 601#define ADVERTISED_Asym_Pause (BIT(14)) 602#define ADVERTISED_2500baseX_Full (BIT(15)) 603#define ADVERTISED_Backplane (BIT(16)) 604#define ADVERTISED_1000baseKX_Full (BIT(17)) 605#define ADVERTISED_10000baseKX4_Full (BIT(18)) 606#define ADVERTISED_10000baseKR_Full (BIT(19)) 607#define ADVERTISED_10000baseR_FEC (BIT(20)) 608 609/* The following are all involved in forcing a particular link 610 * mode for the device for setting things. When getting the 611 * devices settings, these indicate the current mode and whether 612 * it was foced up into this mode or autonegotiated. 613 */ 614 615/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ 616#define SPEED_10 10 617#define SPEED_100 100 618#define SPEED_1000 1000 619#define SPEED_2500 2500 620#define SPEED_10000 10000 621 622/* Duplex, half or full. */ 623#define DUPLEX_HALF 0x00 624#define DUPLEX_FULL 0x01 625 626/* Which connector port. */ 627#define PORT_TP 0x00 628#define PORT_AUI 0x01 629#define PORT_MII 0x02 630#define PORT_FIBRE 0x03 631#define PORT_BNC 0x04 632#define PORT_DA 0x05 633#define PORT_NONE 0xef 634#define PORT_OTHER 0xff 635 636/* Which transceiver to use. */ 637#define XCVR_INTERNAL 0x00 638#define XCVR_EXTERNAL 0x01 639#define XCVR_DUMMY1 0x02 640#define XCVR_DUMMY2 0x03 641#define XCVR_DUMMY3 0x04 642 643/* Enable or disable autonegotiation. If this is set to enable, 644 * the forced link modes above are completely ignored. 645 */ 646#define AUTONEG_DISABLE 0x00 647#define AUTONEG_ENABLE 0x01 648 649/* Mode MDI or MDI-X */ 650#define ETH_TP_MDI_INVALID 0x00 651#define ETH_TP_MDI 0x01 652#define ETH_TP_MDI_X 0x02 653 654/* Wake-On-Lan options. */ 655#define WAKE_PHY (BIT(0)) 656#define WAKE_UCAST (BIT(1)) 657#define WAKE_MCAST (BIT(2)) 658#define WAKE_BCAST (BIT(3)) 659#define WAKE_ARP (BIT(4)) 660#define WAKE_MAGIC (BIT(5)) 661#define WAKE_MAGICSECURE (BIT(6)) /* only meaningful if WAKE_MAGIC */ 662 663/* L2-L4 network traffic flow types */ 664#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ 665#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ 666#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ 667#define AH_ESP_V4_FLOW 0x04 /* hash only */ 668#define TCP_V6_FLOW 0x05 /* hash only */ 669#define UDP_V6_FLOW 0x06 /* hash only */ 670#define SCTP_V6_FLOW 0x07 /* hash only */ 671#define AH_ESP_V6_FLOW 0x08 /* hash only */ 672#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ 673#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ 674#define AH_V6_FLOW 0x0b /* hash only */ 675#define ESP_V6_FLOW 0x0c /* hash only */ 676#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ 677#define IPV4_FLOW 0x10 /* hash only */ 678#define IPV6_FLOW 0x11 /* hash only */ 679#define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 680 681/* L3-L4 network traffic flow hash options */ 682#define RXH_L2DA (BIT(1)) 683#define RXH_VLAN (BIT(2)) 684#define RXH_L3_PROTO (BIT(3)) 685#define RXH_IP_SRC (BIT(4)) 686#define RXH_IP_DST (BIT(5)) 687#define RXH_L4_B_0_1 (BIT(6)) /* src port in case of TCP/UDP/SCTP */ 688#define RXH_L4_B_2_3 (BIT(7)) /* dst port in case of TCP/UDP/SCTP */ 689#define RXH_DISCARD (1U << 31) 690 691#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 692 693/* Reset flags */ 694/* The reset() operation must clear the flags for the components which 695 * were actually reset. On successful return, the flags indicate the 696 * components which were not reset, either because they do not exist 697 * in the hardware or because they cannot be reset independently. The 698 * driver must never reset any components that were not requested. 699 */ 700enum ethtool_reset_flags { 701 /* These flags represent components dedicated to the interface 702 * the command is addressed to. Shift any flag left by 703 * ETH_RESET_SHARED_SHIFT to reset a shared component of the 704 * same type. 705 */ 706 ETH_RESET_MGMT = BIT(0), /* Management processor */ 707 ETH_RESET_IRQ = BIT(1), /* Interrupt requester */ 708 ETH_RESET_DMA = BIT(2), /* DMA engine */ 709 ETH_RESET_FILTER = BIT(3), /* Filtering/flow direction */ 710 ETH_RESET_OFFLOAD = BIT(4), /* Protocol offload */ 711 ETH_RESET_MAC = BIT(5), /* Media access controller */ 712 ETH_RESET_PHY = BIT(6), /* Transceiver/PHY */ 713 ETH_RESET_RAM = BIT(7), /* RAM shared between 714 * multiple components */ 715 716 ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to 717 * this interface */ 718 ETH_RESET_ALL = 0xffffffff, /* All components used by this 719 * interface, even if shared */ 720}; 721#define ETH_RESET_SHARED_SHIFT 16 722 723