2 * ethtool.h: Defines for Linux ethtool.
4 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
5 * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
6 * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
8 * christopher.leech@intel.com,
9 * scott.feldman@intel.com)
10 * Portions Copyright (C) Sun Microsystems 2008
13 #ifndef _UAPI_LINUX_ETHTOOL_H
14 #define _UAPI_LINUX_ETHTOOL_H
16 #include <linux/types.h>
17 #include <linux/if_ether.h>
19 /* This should work for both 32 and 64 bit userland. */
22 __u32 supported; /* Features this interface supports */
23 __u32 advertising; /* Features this interface advertises */
24 __u16 speed; /* The forced speed (lower bits) in
26 * ethtool_cmd_speed()/_set() to
28 __u8 duplex; /* Duplex, half or full */
29 __u8 port; /* Which connector port */
30 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45).
31 * May be read-only or read-write
32 * depending on the driver.
34 __u8 transceiver; /* Which transceiver to use */
35 __u8 autoneg; /* Enable or disable autonegotiation */
36 __u8 mdio_support; /* MDIO protocols supported. Read-only.
37 * Not set by all drivers.
39 __u32 maxtxpkt; /* Tx pkts before generating tx int */
40 __u32 maxrxpkt; /* Rx pkts before generating rx int */
41 __u16 speed_hi; /* The forced speed (upper
42 * bits) in Mbps. Please use
43 * ethtool_cmd_speed()/_set() to
45 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
46 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
47 * link should be renegotiated if necessary
49 __u32 lp_advertising; /* Features the link partner advertises */
53 static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
57 ep->speed = (__u16)speed;
58 ep->speed_hi = (__u16)(speed >> 16);
61 static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
63 return (ep->speed_hi << 16) | ep->speed;
66 /* Device supports clause 22 register access to PHY or peripherals
67 * using the interface defined in <linux/mii.h>. This should not be
68 * set if there are known to be no such peripherals present or if
69 * the driver only emulates clause 22 registers for compatibility.
71 #define ETH_MDIO_SUPPORTS_C22 1
73 /* Device supports clause 45 register access to PHY or peripherals
74 * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
75 * This should not be set if there are known to be no such peripherals
78 #define ETH_MDIO_SUPPORTS_C45 2
80 #define ETHTOOL_FWVERS_LEN 32
81 #define ETHTOOL_BUSINFO_LEN 32
82 /* these strings are set to whatever the driver author decides... */
83 struct ethtool_drvinfo {
85 char driver[32]; /* driver short name, "tulip", "eepro100" */
86 char version[32]; /* driver version string */
87 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */
88 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
89 /* For PCI devices, use pci_name(pci_dev). */
93 * Some struct members below are filled in
94 * using ops->get_sset_count(). Obtaining
95 * this info from ethtool_drvinfo is now
96 * deprecated; Use ETHTOOL_GSSET_INFO
99 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
100 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
102 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
103 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
107 /* wake-on-lan settings */
108 struct ethtool_wolinfo {
112 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */
115 /* for passing single values */
116 struct ethtool_value {
121 /* for passing big chunks of data */
122 struct ethtool_regs {
124 __u32 version; /* driver-specific, indicates different chips/revs */
125 __u32 len; /* bytes */
129 /* for passing EEPROM chunks */
130 struct ethtool_eeprom {
133 __u32 offset; /* in bytes */
134 __u32 len; /* in bytes */
139 * struct ethtool_eee - Energy Efficient Ethernet information
140 * @cmd: ETHTOOL_{G,S}EEE
141 * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
142 * for which there is EEE support.
143 * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
144 * advertised as eee capable.
145 * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
146 * combinations advertised by the link partner as eee capable.
147 * @eee_active: Result of the eee auto negotiation.
148 * @eee_enabled: EEE configured mode (enabled/disabled).
149 * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
150 * that eee was negotiated.
151 * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
152 * its tx lpi (after reaching 'idle' state). Effective only when eee
153 * was negotiated and tx_lpi_enabled was set.
162 __u32 tx_lpi_enabled;
168 * struct ethtool_modinfo - plugin module eeprom information
169 * @cmd: %ETHTOOL_GMODULEINFO
170 * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
171 * @eeprom_len: Length of the eeprom
173 * This structure is used to return the information to
174 * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
175 * The type code indicates the eeprom data format
177 struct ethtool_modinfo {
185 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
186 * @cmd: ETHTOOL_{G,S}COALESCE
187 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
189 * @rx_max_coalesced_frames: Maximum number of packets to receive
190 * before an RX interrupt.
191 * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
192 * this value applies while an IRQ is being serviced by the host.
193 * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
194 * except that this value applies while an IRQ is being serviced
196 * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
198 * @tx_max_coalesced_frames: Maximum number of packets to be sent
199 * before a TX interrupt.
200 * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
201 * this value applies while an IRQ is being serviced by the host.
202 * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
203 * except that this value applies while an IRQ is being serviced
205 * @stats_block_coalesce_usecs: How many usecs to delay in-memory
206 * statistics block updates. Some drivers do not have an
207 * in-memory statistic block, and in such cases this value is
208 * ignored. This value must not be zero.
209 * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
210 * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
211 * @pkt_rate_low: Threshold for low packet rate (packets per second).
212 * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
213 * a packet arrives, when the packet rate is below @pkt_rate_low.
214 * @rx_max_coalesced_frames_low: Maximum number of packets to be received
215 * before an RX interrupt, when the packet rate is below @pkt_rate_low.
216 * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
217 * a packet is sent, when the packet rate is below @pkt_rate_low.
218 * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
219 * a TX interrupt, when the packet rate is below @pkt_rate_low.
220 * @pkt_rate_high: Threshold for high packet rate (packets per second).
221 * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
222 * a packet arrives, when the packet rate is above @pkt_rate_high.
223 * @rx_max_coalesced_frames_high: Maximum number of packets to be received
224 * before an RX interrupt, when the packet rate is above @pkt_rate_high.
225 * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
226 * a packet is sent, when the packet rate is above @pkt_rate_high.
227 * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
228 * a TX interrupt, when the packet rate is above @pkt_rate_high.
229 * @rate_sample_interval: How often to do adaptive coalescing packet rate
230 * sampling, measured in seconds. Must not be zero.
232 * Each pair of (usecs, max_frames) fields specifies this exit
233 * condition for interrupt coalescing:
234 * (usecs > 0 && time_since_first_completion >= usecs) ||
235 * (max_frames > 0 && completed_frames >= max_frames)
236 * It is illegal to set both usecs and max_frames to zero as this
237 * would cause interrupts to never be generated. To disable
238 * coalescing, set usecs = 0 and max_frames = 1.
240 * Some implementations ignore the value of max_frames and use the
242 * time_since_first_completion >= usecs
243 * This is deprecated. Drivers for hardware that does not support
244 * counting completions should validate that max_frames == !rx_usecs.
246 * Adaptive RX/TX coalescing is an algorithm implemented by some
247 * drivers to improve latency under low packet rates and improve
248 * throughput under high packet rates. Some drivers only implement
249 * one of RX or TX adaptive coalescing. Anything not implemented by
250 * the driver causes these values to be silently ignored.
252 * When the packet rate is below @pkt_rate_high but above
253 * @pkt_rate_low (both measured in packets per second) the
254 * normal {rx,tx}_* coalescing parameters are used.
256 struct ethtool_coalesce {
258 __u32 rx_coalesce_usecs;
259 __u32 rx_max_coalesced_frames;
260 __u32 rx_coalesce_usecs_irq;
261 __u32 rx_max_coalesced_frames_irq;
262 __u32 tx_coalesce_usecs;
263 __u32 tx_max_coalesced_frames;
264 __u32 tx_coalesce_usecs_irq;
265 __u32 tx_max_coalesced_frames_irq;
266 __u32 stats_block_coalesce_usecs;
267 __u32 use_adaptive_rx_coalesce;
268 __u32 use_adaptive_tx_coalesce;
270 __u32 rx_coalesce_usecs_low;
271 __u32 rx_max_coalesced_frames_low;
272 __u32 tx_coalesce_usecs_low;
273 __u32 tx_max_coalesced_frames_low;
275 __u32 rx_coalesce_usecs_high;
276 __u32 rx_max_coalesced_frames_high;
277 __u32 tx_coalesce_usecs_high;
278 __u32 tx_max_coalesced_frames_high;
279 __u32 rate_sample_interval;
282 /* for configuring RX/TX ring parameters */
283 struct ethtool_ringparam {
284 __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */
286 /* Read only attributes. These indicate the maximum number
287 * of pending RX/TX ring entries the driver will allow the
290 __u32 rx_max_pending;
291 __u32 rx_mini_max_pending;
292 __u32 rx_jumbo_max_pending;
293 __u32 tx_max_pending;
295 /* Values changeable by the user. The valid values are
296 * in the range 1 to the "*_max_pending" counterpart above.
299 __u32 rx_mini_pending;
300 __u32 rx_jumbo_pending;
305 * struct ethtool_channels - configuring number of network channel
306 * @cmd: ETHTOOL_{G,S}CHANNELS
307 * @max_rx: Read only. Maximum number of receive channel the driver support.
308 * @max_tx: Read only. Maximum number of transmit channel the driver support.
309 * @max_other: Read only. Maximum number of other channel the driver support.
310 * @max_combined: Read only. Maximum number of combined channel the driver
311 * support. Set of queues RX, TX or other.
312 * @rx_count: Valid values are in the range 1 to the max_rx.
313 * @tx_count: Valid values are in the range 1 to the max_tx.
314 * @other_count: Valid values are in the range 1 to the max_other.
315 * @combined_count: Valid values are in the range 1 to the max_combined.
317 * This can be used to configure RX, TX and other channels.
320 struct ethtool_channels {
329 __u32 combined_count;
332 /* for configuring link flow control parameters */
333 struct ethtool_pauseparam {
334 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
336 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
337 * being true) the user may set 'autoneg' here non-zero to have the
338 * pause parameters be auto-negotiated too. In such a case, the
339 * {rx,tx}_pause values below determine what capabilities are
342 * If 'autoneg' is zero or the link is not being auto-negotiated,
343 * then {rx,tx}_pause force the driver to use/not-use pause
351 #define ETH_GSTRING_LEN 32
352 enum ethtool_stringset {
356 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */
360 /* for passing string sets for data tagging */
361 struct ethtool_gstrings {
362 __u32 cmd; /* ETHTOOL_GSTRINGS */
363 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
364 __u32 len; /* number of strings in the string set */
368 struct ethtool_sset_info {
369 __u32 cmd; /* ETHTOOL_GSSET_INFO */
371 __u64 sset_mask; /* input: each bit selects an sset to query */
372 /* output: each bit a returned sset */
373 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
374 in sset_mask. One bit implies one
375 __u32, two bits implies two
380 * enum ethtool_test_flags - flags definition of ethtool_test
381 * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
383 * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
384 * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
386 * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
389 enum ethtool_test_flags {
390 ETH_TEST_FL_OFFLINE = (1 << 0),
391 ETH_TEST_FL_FAILED = (1 << 1),
392 ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
393 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
396 /* for requesting NIC test and getting results*/
397 struct ethtool_test {
398 __u32 cmd; /* ETHTOOL_TEST */
399 __u32 flags; /* ETH_TEST_FL_xxx */
401 __u32 len; /* result length, in number of u64 elements */
405 /* for dumping NIC-specific statistics */
406 struct ethtool_stats {
407 __u32 cmd; /* ETHTOOL_GSTATS */
408 __u32 n_stats; /* number of u64's being returned */
412 struct ethtool_perm_addr {
413 __u32 cmd; /* ETHTOOL_GPERMADDR */
418 /* boolean flags controlling per-interface behavior characteristics.
419 * When reading, the flag indicates whether or not a certain behavior
420 * is enabled/present. When writing, the flag indicates whether
421 * or not the driver should turn on (set) or off (clear) a behavior.
423 * Some behaviors may read-only (unconditionally absent or present).
424 * If such is the case, return EINVAL in the set-flags operation if the
425 * flag differs from the read-only value.
428 ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
429 ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
430 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
431 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
432 ETH_FLAG_RXHASH = (1 << 28),
435 /* The following structures are for supporting RX network flow
436 * classification and RX n-tuple configuration. Note, all multibyte
437 * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
438 * be in network byte order.
442 * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
443 * @ip4src: Source host
444 * @ip4dst: Destination host
446 * @pdst: Destination port
447 * @tos: Type-of-service
449 * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
451 struct ethtool_tcpip4_spec {
460 * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
461 * @ip4src: Source host
462 * @ip4dst: Destination host
463 * @spi: Security parameters index
464 * @tos: Type-of-service
466 * This can be used to specify an IPsec transport or tunnel over IPv4.
468 struct ethtool_ah_espip4_spec {
475 #define ETH_RX_NFC_IP4 1
478 * struct ethtool_usrip4_spec - general flow specification for IPv4
479 * @ip4src: Source host
480 * @ip4dst: Destination host
481 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
482 * @tos: Type-of-service
483 * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
484 * @proto: Transport protocol number; mask must be 0
486 struct ethtool_usrip4_spec {
495 union ethtool_flow_union {
496 struct ethtool_tcpip4_spec tcp_ip4_spec;
497 struct ethtool_tcpip4_spec udp_ip4_spec;
498 struct ethtool_tcpip4_spec sctp_ip4_spec;
499 struct ethtool_ah_espip4_spec ah_ip4_spec;
500 struct ethtool_ah_espip4_spec esp_ip4_spec;
501 struct ethtool_usrip4_spec usr_ip4_spec;
502 struct ethhdr ether_spec;
507 * struct ethtool_flow_ext - additional RX flow fields
508 * @h_dest: destination MAC address
509 * @vlan_etype: VLAN EtherType
510 * @vlan_tci: VLAN tag control information
511 * @data: user defined data
513 * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
514 * is set in &struct ethtool_rx_flow_spec @flow_type.
515 * @h_dest is valid if %FLOW_MAC_EXT is set.
517 struct ethtool_flow_ext {
519 unsigned char h_dest[ETH_ALEN];
526 * struct ethtool_rx_flow_spec - classification rule for RX flows
527 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
528 * @h_u: Flow fields to match (dependent on @flow_type)
529 * @h_ext: Additional fields to match
530 * @m_u: Masks for flow field bits to be matched
531 * @m_ext: Masks for additional field bits to be matched
532 * Note, all additional fields must be ignored unless @flow_type
533 * includes the %FLOW_EXT or %FLOW_MAC_EXT flag
534 * (see &struct ethtool_flow_ext description).
535 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
536 * if packets should be discarded
537 * @location: Location of rule in the table. Locations must be
538 * numbered such that a flow matching multiple rules will be
539 * classified according to the first (lowest numbered) rule.
541 struct ethtool_rx_flow_spec {
543 union ethtool_flow_union h_u;
544 struct ethtool_flow_ext h_ext;
545 union ethtool_flow_union m_u;
546 struct ethtool_flow_ext m_ext;
552 * struct ethtool_rxnfc - command to get or set RX flow classification rules
553 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
554 * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
555 * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
556 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
557 * @data: Command-dependent value
558 * @fs: Flow classification rule
559 * @rule_cnt: Number of rules to be affected
560 * @rule_locs: Array of used rule locations
562 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
563 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
564 * structure fields must not be used.
566 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
569 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
570 * rules on return. If @data is non-zero on return then it is the
571 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
572 * driver supports any special location values. If that flag is not
573 * set in @data then special location values should not be used.
575 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
576 * existing rule on entry and @fs contains the rule on return.
578 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
579 * user buffer for @rule_locs on entry. On return, @data is the size
580 * of the rule table, @rule_cnt is the number of defined rules, and
581 * @rule_locs contains the locations of the defined rules. Drivers
582 * must use the second parameter to get_rxnfc() instead of @rule_locs.
584 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
585 * @fs.@location either specifies the location to use or is a special
586 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
587 * @fs.@location is the actual rule location.
589 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
590 * existing rule on entry.
592 * A driver supporting the special location values for
593 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
594 * location, and may remove a rule at a later location (lower
595 * priority) that matches exactly the same set of flows. The special
596 * values are: %RX_CLS_LOC_ANY, selecting any location;
597 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
598 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
599 * location (minimum priority). Additional special values may be
600 * defined in future and drivers must return -%EINVAL for any
601 * unrecognised value.
603 struct ethtool_rxnfc {
607 struct ethtool_rx_flow_spec fs;
614 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
615 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
616 * @size: On entry, the array size of the user buffer, which may be zero.
617 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
619 * @ring_index: RX ring/queue index for each hash value
621 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
622 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
623 * the table should be reset to default values. This last feature
624 * is not supported by the original implementations.
626 struct ethtool_rxfh_indir {
633 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
634 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
635 * @h_u: Flow field values to match (dependent on @flow_type)
636 * @m_u: Masks for flow field value bits to be ignored
637 * @vlan_tag: VLAN tag to match
638 * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
639 * @data: Driver-dependent data to match
640 * @data_mask: Mask for driver-dependent data bits to be ignored
641 * @action: RX ring/queue index to deliver to (non-negative) or other action
642 * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
644 * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
645 * a field value and mask are both zero this is treated as if all mask
646 * bits are set i.e. the field is ignored.
648 struct ethtool_rx_ntuple_flow_spec {
651 struct ethtool_tcpip4_spec tcp_ip4_spec;
652 struct ethtool_tcpip4_spec udp_ip4_spec;
653 struct ethtool_tcpip4_spec sctp_ip4_spec;
654 struct ethtool_ah_espip4_spec ah_ip4_spec;
655 struct ethtool_ah_espip4_spec esp_ip4_spec;
656 struct ethtool_usrip4_spec usr_ip4_spec;
657 struct ethhdr ether_spec;
667 #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
668 #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
672 * struct ethtool_rx_ntuple - command to set or clear RX flow filter
673 * @cmd: Command number - %ETHTOOL_SRXNTUPLE
674 * @fs: Flow filter specification
676 struct ethtool_rx_ntuple {
678 struct ethtool_rx_ntuple_flow_spec fs;
681 #define ETHTOOL_FLASH_MAX_FILENAME 128
682 enum ethtool_flash_op_type {
683 ETHTOOL_FLASH_ALL_REGIONS = 0,
686 /* for passing firmware flashing related parameters */
687 struct ethtool_flash {
690 char data[ETHTOOL_FLASH_MAX_FILENAME];
694 * struct ethtool_dump - used for retrieving, setting device dump
695 * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
697 * @version: FW version of the dump, filled in by driver
698 * @flag: driver dependent flag for dump setting, filled in by driver during
699 * get and filled in by ethtool for set operation.
700 * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
701 * firmware dump is disabled.
702 * @len: length of dump data, used as the length of the user buffer on entry to
703 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
704 * for %ETHTOOL_GET_DUMP_FLAG command
705 * @data: data collected for get dump data operation
708 #define ETH_FW_DUMP_DISABLE 0
710 struct ethtool_dump {
718 /* for returning and changing feature sets */
721 * struct ethtool_get_features_block - block with state of 32 features
722 * @available: mask of changeable features
723 * @requested: mask of features requested to be enabled if possible
724 * @active: mask of currently enabled features
725 * @never_changed: mask of features not changeable for any device
727 struct ethtool_get_features_block {
735 * struct ethtool_gfeatures - command to get state of device's features
736 * @cmd: command number = %ETHTOOL_GFEATURES
737 * @size: in: number of elements in the features[] array;
738 * out: number of elements in features[] needed to hold all features
739 * @features: state of features
741 struct ethtool_gfeatures {
744 struct ethtool_get_features_block features[0];
748 * struct ethtool_set_features_block - block with request for 32 features
749 * @valid: mask of features to be changed
750 * @requested: values of features to be changed
752 struct ethtool_set_features_block {
758 * struct ethtool_sfeatures - command to request change in device's features
759 * @cmd: command number = %ETHTOOL_SFEATURES
760 * @size: array size of the features[] array
761 * @features: feature change masks
763 struct ethtool_sfeatures {
766 struct ethtool_set_features_block features[0];
770 * struct ethtool_ts_info - holds a device's timestamping and PHC association
771 * @cmd: command number = %ETHTOOL_GET_TS_INFO
772 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
773 * @phc_index: device index of the associated PHC, or -1 if there is none
774 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
775 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
777 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
778 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
779 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
780 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
782 struct ethtool_ts_info {
784 __u32 so_timestamping;
787 __u32 tx_reserved[3];
789 __u32 rx_reserved[3];
793 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
794 * values of corresponding bits in features[].requested. Bits in .requested
795 * not set in .valid or not changeable are ignored.
797 * Returns %EINVAL when .valid contains undefined or never-changeable bits
798 * or size is not equal to required number of features words (32-bit blocks).
799 * Returns >= 0 if request was completed; bits set in the value mean:
800 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
801 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
802 * those bits were ignored.
803 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
804 * resulting state of bits masked by .valid is not equal to .requested.
805 * Probably there are other device-specific constraints on some features
806 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
807 * here as though ignored bits were cleared.
808 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
809 * compatibility functions. Requested offload state cannot be properly
812 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
813 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
814 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
815 * significant bit in features[0] fields. Empty strings mark undefined features.
817 enum ethtool_sfeatures_retval_bits {
818 ETHTOOL_F_UNSUPPORTED__BIT,
820 ETHTOOL_F_COMPAT__BIT,
823 #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
824 #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
825 #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
828 /* CMDs currently supported */
829 #define ETHTOOL_GSET 0x00000001 /* Get settings. */
830 #define ETHTOOL_SSET 0x00000002 /* Set settings. */
831 #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
832 #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
833 #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
834 #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
835 #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
836 #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
837 #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
838 /* Get link status for host, i.e. whether the interface *and* the
839 * physical port (if there is one) are up (ethtool_value). */
840 #define ETHTOOL_GLINK 0x0000000a
841 #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
842 #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
843 #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
844 #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
845 #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
846 #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
847 #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
848 #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
849 #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
850 #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
851 #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
852 #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
853 #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
855 #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
856 * (ethtool_value). */
857 #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
858 #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
859 #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
860 #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
861 #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
862 #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
863 #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
864 #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
865 #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
866 #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
867 #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
868 #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
869 #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
870 #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
871 #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
873 #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
874 #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
875 #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
876 #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
877 #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
878 #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
879 #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
880 #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
881 #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
882 #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
883 #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
884 #define ETHTOOL_RESET 0x00000034 /* Reset hardware */
885 #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
886 #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
887 #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
888 #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
889 #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
891 #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
892 #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
893 #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
894 #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
895 #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
896 #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
897 #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
898 #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
899 #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
900 #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
901 #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
902 #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
904 /* compatibility with older code */
905 #define SPARC_ETH_GSET ETHTOOL_GSET
906 #define SPARC_ETH_SSET ETHTOOL_SSET
908 /* Indicates what features are supported by the interface. */
909 #define SUPPORTED_10baseT_Half (1 << 0)
910 #define SUPPORTED_10baseT_Full (1 << 1)
911 #define SUPPORTED_100baseT_Half (1 << 2)
912 #define SUPPORTED_100baseT_Full (1 << 3)
913 #define SUPPORTED_1000baseT_Half (1 << 4)
914 #define SUPPORTED_1000baseT_Full (1 << 5)
915 #define SUPPORTED_Autoneg (1 << 6)
916 #define SUPPORTED_TP (1 << 7)
917 #define SUPPORTED_AUI (1 << 8)
918 #define SUPPORTED_MII (1 << 9)
919 #define SUPPORTED_FIBRE (1 << 10)
920 #define SUPPORTED_BNC (1 << 11)
921 #define SUPPORTED_10000baseT_Full (1 << 12)
922 #define SUPPORTED_Pause (1 << 13)
923 #define SUPPORTED_Asym_Pause (1 << 14)
924 #define SUPPORTED_2500baseX_Full (1 << 15)
925 #define SUPPORTED_Backplane (1 << 16)
926 #define SUPPORTED_1000baseKX_Full (1 << 17)
927 #define SUPPORTED_10000baseKX4_Full (1 << 18)
928 #define SUPPORTED_10000baseKR_Full (1 << 19)
929 #define SUPPORTED_10000baseR_FEC (1 << 20)
930 #define SUPPORTED_20000baseMLD2_Full (1 << 21)
931 #define SUPPORTED_20000baseKR2_Full (1 << 22)
932 #define SUPPORTED_40000baseKR4_Full (1 << 23)
933 #define SUPPORTED_40000baseCR4_Full (1 << 24)
934 #define SUPPORTED_40000baseSR4_Full (1 << 25)
935 #define SUPPORTED_40000baseLR4_Full (1 << 26)
937 /* Indicates what features are advertised by the interface. */
938 #define ADVERTISED_10baseT_Half (1 << 0)
939 #define ADVERTISED_10baseT_Full (1 << 1)
940 #define ADVERTISED_100baseT_Half (1 << 2)
941 #define ADVERTISED_100baseT_Full (1 << 3)
942 #define ADVERTISED_1000baseT_Half (1 << 4)
943 #define ADVERTISED_1000baseT_Full (1 << 5)
944 #define ADVERTISED_Autoneg (1 << 6)
945 #define ADVERTISED_TP (1 << 7)
946 #define ADVERTISED_AUI (1 << 8)
947 #define ADVERTISED_MII (1 << 9)
948 #define ADVERTISED_FIBRE (1 << 10)
949 #define ADVERTISED_BNC (1 << 11)
950 #define ADVERTISED_10000baseT_Full (1 << 12)
951 #define ADVERTISED_Pause (1 << 13)
952 #define ADVERTISED_Asym_Pause (1 << 14)
953 #define ADVERTISED_2500baseX_Full (1 << 15)
954 #define ADVERTISED_Backplane (1 << 16)
955 #define ADVERTISED_1000baseKX_Full (1 << 17)
956 #define ADVERTISED_10000baseKX4_Full (1 << 18)
957 #define ADVERTISED_10000baseKR_Full (1 << 19)
958 #define ADVERTISED_10000baseR_FEC (1 << 20)
959 #define ADVERTISED_20000baseMLD2_Full (1 << 21)
960 #define ADVERTISED_20000baseKR2_Full (1 << 22)
961 #define ADVERTISED_40000baseKR4_Full (1 << 23)
962 #define ADVERTISED_40000baseCR4_Full (1 << 24)
963 #define ADVERTISED_40000baseSR4_Full (1 << 25)
964 #define ADVERTISED_40000baseLR4_Full (1 << 26)
966 /* The following are all involved in forcing a particular link
967 * mode for the device for setting things. When getting the
968 * devices settings, these indicate the current mode and whether
969 * it was forced up into this mode or autonegotiated.
972 /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
974 #define SPEED_100 100
975 #define SPEED_1000 1000
976 #define SPEED_2500 2500
977 #define SPEED_10000 10000
978 #define SPEED_UNKNOWN -1
980 /* Duplex, half or full. */
981 #define DUPLEX_HALF 0x00
982 #define DUPLEX_FULL 0x01
983 #define DUPLEX_UNKNOWN 0xff
985 /* Which connector port. */
987 #define PORT_AUI 0x01
988 #define PORT_MII 0x02
989 #define PORT_FIBRE 0x03
990 #define PORT_BNC 0x04
992 #define PORT_NONE 0xef
993 #define PORT_OTHER 0xff
995 /* Which transceiver to use. */
996 #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */
997 #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */
998 #define XCVR_DUMMY1 0x02
999 #define XCVR_DUMMY2 0x03
1000 #define XCVR_DUMMY3 0x04
1002 /* Enable or disable autonegotiation. If this is set to enable,
1003 * the forced link modes above are completely ignored.
1005 #define AUTONEG_DISABLE 0x00
1006 #define AUTONEG_ENABLE 0x01
1008 /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
1009 * the driver is required to renegotiate link
1011 #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
1012 #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
1013 #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
1014 #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
1016 /* Wake-On-Lan options. */
1017 #define WAKE_PHY (1 << 0)
1018 #define WAKE_UCAST (1 << 1)
1019 #define WAKE_MCAST (1 << 2)
1020 #define WAKE_BCAST (1 << 3)
1021 #define WAKE_ARP (1 << 4)
1022 #define WAKE_MAGIC (1 << 5)
1023 #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
1025 /* L2-L4 network traffic flow types */
1026 #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
1027 #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
1028 #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
1029 #define AH_ESP_V4_FLOW 0x04 /* hash only */
1030 #define TCP_V6_FLOW 0x05 /* hash only */
1031 #define UDP_V6_FLOW 0x06 /* hash only */
1032 #define SCTP_V6_FLOW 0x07 /* hash only */
1033 #define AH_ESP_V6_FLOW 0x08 /* hash only */
1034 #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
1035 #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
1036 #define AH_V6_FLOW 0x0b /* hash only */
1037 #define ESP_V6_FLOW 0x0c /* hash only */
1038 #define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
1039 #define IPV4_FLOW 0x10 /* hash only */
1040 #define IPV6_FLOW 0x11 /* hash only */
1041 #define ETHER_FLOW 0x12 /* spec only (ether_spec) */
1042 /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1043 #define FLOW_EXT 0x80000000
1044 #define FLOW_MAC_EXT 0x40000000
1046 /* L3-L4 network traffic flow hash options */
1047 #define RXH_L2DA (1 << 1)
1048 #define RXH_VLAN (1 << 2)
1049 #define RXH_L3_PROTO (1 << 3)
1050 #define RXH_IP_SRC (1 << 4)
1051 #define RXH_IP_DST (1 << 5)
1052 #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
1053 #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
1054 #define RXH_DISCARD (1 << 31)
1056 #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1058 /* Special RX classification rule insert location values */
1059 #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1060 #define RX_CLS_LOC_ANY 0xffffffff
1061 #define RX_CLS_LOC_FIRST 0xfffffffe
1062 #define RX_CLS_LOC_LAST 0xfffffffd
1064 /* EEPROM Standards for plug in modules */
1065 #define ETH_MODULE_SFF_8079 0x1
1066 #define ETH_MODULE_SFF_8079_LEN 256
1067 #define ETH_MODULE_SFF_8472 0x2
1068 #define ETH_MODULE_SFF_8472_LEN 512
1071 /* The reset() operation must clear the flags for the components which
1072 * were actually reset. On successful return, the flags indicate the
1073 * components which were not reset, either because they do not exist
1074 * in the hardware or because they cannot be reset independently. The
1075 * driver must never reset any components that were not requested.
1077 enum ethtool_reset_flags {
1078 /* These flags represent components dedicated to the interface
1079 * the command is addressed to. Shift any flag left by
1080 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
1083 ETH_RESET_MGMT = 1 << 0, /* Management processor */
1084 ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
1085 ETH_RESET_DMA = 1 << 2, /* DMA engine */
1086 ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
1087 ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
1088 ETH_RESET_MAC = 1 << 5, /* Media access controller */
1089 ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
1090 ETH_RESET_RAM = 1 << 7, /* RAM shared between
1091 * multiple components */
1093 ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
1095 ETH_RESET_ALL = 0xffffffff, /* All components used by this
1096 * interface, even if shared */
1098 #define ETH_RESET_SHARED_SHIFT 16
1100 #endif /* _UAPI_LINUX_ETHTOOL_H */