]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - include/uapi/linux/ethtool.h
UAPI: (Scripted) Disintegrate include/linux
[karo-tx-linux.git] / include / uapi / linux / ethtool.h
1 /*
2  * ethtool.h: Defines for Linux ethtool.
3  *
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
11  */
12
13 #ifndef _UAPI_LINUX_ETHTOOL_H
14 #define _UAPI_LINUX_ETHTOOL_H
15
16 #include <linux/types.h>
17 #include <linux/if_ether.h>
18
19 /* This should work for both 32 and 64 bit userland. */
20 struct ethtool_cmd {
21         __u32   cmd;
22         __u32   supported;      /* Features this interface supports */
23         __u32   advertising;    /* Features this interface advertises */
24         __u16   speed;          /* The forced speed (lower bits) in
25                                  * Mbps. Please use
26                                  * ethtool_cmd_speed()/_set() to
27                                  * access it */
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.
33                                  */
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.
38                                  */
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
44                                  * access it */
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
48                                    */
49         __u32   lp_advertising; /* Features the link partner advertises */
50         __u32   reserved[2];
51 };
52
53 static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
54                                          __u32 speed)
55 {
56
57         ep->speed = (__u16)speed;
58         ep->speed_hi = (__u16)(speed >> 16);
59 }
60
61 static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
62 {
63         return (ep->speed_hi << 16) | ep->speed;
64 }
65
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.
70  */
71 #define ETH_MDIO_SUPPORTS_C22   1
72
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
76  * present.
77  */
78 #define ETH_MDIO_SUPPORTS_C45   2
79
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 {
84         __u32   cmd;
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). */
90         char    reserved1[32];
91         char    reserved2[12];
92                                 /*
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
97                                  * instead.
98                                  */
99         __u32   n_priv_flags;   /* number of flags valid in ETHTOOL_GPFLAGS */
100         __u32   n_stats;        /* number of u64's from ETHTOOL_GSTATS */
101         __u32   testinfo_len;
102         __u32   eedump_len;     /* Size of data from ETHTOOL_GEEPROM (bytes) */
103         __u32   regdump_len;    /* Size of data from ETHTOOL_GREGS (bytes) */
104 };
105
106 #define SOPASS_MAX      6
107 /* wake-on-lan settings */
108 struct ethtool_wolinfo {
109         __u32   cmd;
110         __u32   supported;
111         __u32   wolopts;
112         __u8    sopass[SOPASS_MAX]; /* SecureOn(tm) password */
113 };
114
115 /* for passing single values */
116 struct ethtool_value {
117         __u32   cmd;
118         __u32   data;
119 };
120
121 /* for passing big chunks of data */
122 struct ethtool_regs {
123         __u32   cmd;
124         __u32   version; /* driver-specific, indicates different chips/revs */
125         __u32   len; /* bytes */
126         __u8    data[0];
127 };
128
129 /* for passing EEPROM chunks */
130 struct ethtool_eeprom {
131         __u32   cmd;
132         __u32   magic;
133         __u32   offset; /* in bytes */
134         __u32   len; /* in bytes */
135         __u8    data[0];
136 };
137
138 /**
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.
154  */
155 struct ethtool_eee {
156         __u32   cmd;
157         __u32   supported;
158         __u32   advertised;
159         __u32   lp_advertised;
160         __u32   eee_active;
161         __u32   eee_enabled;
162         __u32   tx_lpi_enabled;
163         __u32   tx_lpi_timer;
164         __u32   reserved[2];
165 };
166
167 /**
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
172  *
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
176  */
177 struct ethtool_modinfo {
178         __u32   cmd;
179         __u32   type;
180         __u32   eeprom_len;
181         __u32   reserved[8];
182 };
183
184 /**
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
188  *      a packet arrives.
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
195  *      by the host.
196  * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
197  *      a packet is sent.
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
204  *      by the host.
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.
231  *
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.
239  *
240  * Some implementations ignore the value of max_frames and use the
241  * condition:
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.
245  *
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.
251  *
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.
255  */
256 struct ethtool_coalesce {
257         __u32   cmd;
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;
269         __u32   pkt_rate_low;
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;
274         __u32   pkt_rate_high;
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;
280 };
281
282 /* for configuring RX/TX ring parameters */
283 struct ethtool_ringparam {
284         __u32   cmd;    /* ETHTOOL_{G,S}RINGPARAM */
285
286         /* Read only attributes.  These indicate the maximum number
287          * of pending RX/TX ring entries the driver will allow the
288          * user to set.
289          */
290         __u32   rx_max_pending;
291         __u32   rx_mini_max_pending;
292         __u32   rx_jumbo_max_pending;
293         __u32   tx_max_pending;
294
295         /* Values changeable by the user.  The valid values are
296          * in the range 1 to the "*_max_pending" counterpart above.
297          */
298         __u32   rx_pending;
299         __u32   rx_mini_pending;
300         __u32   rx_jumbo_pending;
301         __u32   tx_pending;
302 };
303
304 /**
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.
316  *
317  * This can be used to configure RX, TX and other channels.
318  */
319
320 struct ethtool_channels {
321         __u32   cmd;
322         __u32   max_rx;
323         __u32   max_tx;
324         __u32   max_other;
325         __u32   max_combined;
326         __u32   rx_count;
327         __u32   tx_count;
328         __u32   other_count;
329         __u32   combined_count;
330 };
331
332 /* for configuring link flow control parameters */
333 struct ethtool_pauseparam {
334         __u32   cmd;    /* ETHTOOL_{G,S}PAUSEPARAM */
335
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
340          * advertised.
341          *
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
344          * flow control.
345          */
346         __u32   autoneg;
347         __u32   rx_pause;
348         __u32   tx_pause;
349 };
350
351 #define ETH_GSTRING_LEN         32
352 enum ethtool_stringset {
353         ETH_SS_TEST             = 0,
354         ETH_SS_STATS,
355         ETH_SS_PRIV_FLAGS,
356         ETH_SS_NTUPLE_FILTERS,  /* Do not use, GRXNTUPLE is now deprecated */
357         ETH_SS_FEATURES,
358 };
359
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 */
365         __u8    data[0];
366 };
367
368 struct ethtool_sset_info {
369         __u32   cmd;            /* ETHTOOL_GSSET_INFO */
370         __u32   reserved;
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
376                                    __u32's, etc. */
377 };
378
379 /**
380  * enum ethtool_test_flags - flags definition of ethtool_test
381  * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
382  *      only online tests.
383  * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
384  * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
385  *      test.
386  * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
387  */
388
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),
394 };
395
396 /* for requesting NIC test and getting results*/
397 struct ethtool_test {
398         __u32   cmd;            /* ETHTOOL_TEST */
399         __u32   flags;          /* ETH_TEST_FL_xxx */
400         __u32   reserved;
401         __u32   len;            /* result length, in number of u64 elements */
402         __u64   data[0];
403 };
404
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 */
409         __u64   data[0];
410 };
411
412 struct ethtool_perm_addr {
413         __u32   cmd;            /* ETHTOOL_GPERMADDR */
414         __u32   size;
415         __u8    data[0];
416 };
417
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.
422  *
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.
426  */
427 enum ethtool_flags {
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),
433 };
434
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.
439  */
440
441 /**
442  * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
443  * @ip4src: Source host
444  * @ip4dst: Destination host
445  * @psrc: Source port
446  * @pdst: Destination port
447  * @tos: Type-of-service
448  *
449  * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
450  */
451 struct ethtool_tcpip4_spec {
452         __be32  ip4src;
453         __be32  ip4dst;
454         __be16  psrc;
455         __be16  pdst;
456         __u8    tos;
457 };
458
459 /**
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
465  *
466  * This can be used to specify an IPsec transport or tunnel over IPv4.
467  */
468 struct ethtool_ah_espip4_spec {
469         __be32  ip4src;
470         __be32  ip4dst;
471         __be32  spi;
472         __u8    tos;
473 };
474
475 #define ETH_RX_NFC_IP4  1
476
477 /**
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
485  */
486 struct ethtool_usrip4_spec {
487         __be32  ip4src;
488         __be32  ip4dst;
489         __be32  l4_4_bytes;
490         __u8    tos;
491         __u8    ip_ver;
492         __u8    proto;
493 };
494
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;
503         __u8                                    hdata[60];
504 };
505
506 struct ethtool_flow_ext {
507         __be16  vlan_etype;
508         __be16  vlan_tci;
509         __be32  data[2];
510 };
511
512 /**
513  * struct ethtool_rx_flow_spec - classification rule for RX flows
514  * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
515  * @h_u: Flow fields to match (dependent on @flow_type)
516  * @h_ext: Additional fields to match
517  * @m_u: Masks for flow field bits to be matched
518  * @m_ext: Masks for additional field bits to be matched
519  *      Note, all additional fields must be ignored unless @flow_type
520  *      includes the %FLOW_EXT flag.
521  * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
522  *      if packets should be discarded
523  * @location: Location of rule in the table.  Locations must be
524  *      numbered such that a flow matching multiple rules will be
525  *      classified according to the first (lowest numbered) rule.
526  */
527 struct ethtool_rx_flow_spec {
528         __u32           flow_type;
529         union ethtool_flow_union h_u;
530         struct ethtool_flow_ext h_ext;
531         union ethtool_flow_union m_u;
532         struct ethtool_flow_ext m_ext;
533         __u64           ring_cookie;
534         __u32           location;
535 };
536
537 /**
538  * struct ethtool_rxnfc - command to get or set RX flow classification rules
539  * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
540  *      %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
541  *      %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
542  * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
543  * @data: Command-dependent value
544  * @fs: Flow classification rule
545  * @rule_cnt: Number of rules to be affected
546  * @rule_locs: Array of used rule locations
547  *
548  * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
549  * the fields included in the flow hash, e.g. %RXH_IP_SRC.  The following
550  * structure fields must not be used.
551  *
552  * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
553  * on return.
554  *
555  * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
556  * rules on return.  If @data is non-zero on return then it is the
557  * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
558  * driver supports any special location values.  If that flag is not
559  * set in @data then special location values should not be used.
560  *
561  * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
562  * existing rule on entry and @fs contains the rule on return.
563  *
564  * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
565  * user buffer for @rule_locs on entry.  On return, @data is the size
566  * of the rule table, @rule_cnt is the number of defined rules, and
567  * @rule_locs contains the locations of the defined rules.  Drivers
568  * must use the second parameter to get_rxnfc() instead of @rule_locs.
569  *
570  * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
571  * @fs.@location either specifies the location to use or is a special
572  * location value with %RX_CLS_LOC_SPECIAL flag set.  On return,
573  * @fs.@location is the actual rule location.
574  *
575  * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
576  * existing rule on entry.
577  *
578  * A driver supporting the special location values for
579  * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
580  * location, and may remove a rule at a later location (lower
581  * priority) that matches exactly the same set of flows.  The special
582  * values are: %RX_CLS_LOC_ANY, selecting any location;
583  * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
584  * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
585  * location (minimum priority).  Additional special values may be
586  * defined in future and drivers must return -%EINVAL for any
587  * unrecognised value.
588  */
589 struct ethtool_rxnfc {
590         __u32                           cmd;
591         __u32                           flow_type;
592         __u64                           data;
593         struct ethtool_rx_flow_spec     fs;
594         __u32                           rule_cnt;
595         __u32                           rule_locs[0];
596 };
597
598
599 /**
600  * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
601  * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
602  * @size: On entry, the array size of the user buffer, which may be zero.
603  *      On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
604  *      indirection table.
605  * @ring_index: RX ring/queue index for each hash value
606  *
607  * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
608  * should be returned.  For %ETHTOOL_SRXFHINDIR, a @size of zero means
609  * the table should be reset to default values.  This last feature
610  * is not supported by the original implementations.
611  */
612 struct ethtool_rxfh_indir {
613         __u32   cmd;
614         __u32   size;
615         __u32   ring_index[0];
616 };
617
618 /**
619  * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
620  * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
621  * @h_u: Flow field values to match (dependent on @flow_type)
622  * @m_u: Masks for flow field value bits to be ignored
623  * @vlan_tag: VLAN tag to match
624  * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
625  * @data: Driver-dependent data to match
626  * @data_mask: Mask for driver-dependent data bits to be ignored
627  * @action: RX ring/queue index to deliver to (non-negative) or other action
628  *      (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
629  *
630  * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
631  * a field value and mask are both zero this is treated as if all mask
632  * bits are set i.e. the field is ignored.
633  */
634 struct ethtool_rx_ntuple_flow_spec {
635         __u32            flow_type;
636         union {
637                 struct ethtool_tcpip4_spec              tcp_ip4_spec;
638                 struct ethtool_tcpip4_spec              udp_ip4_spec;
639                 struct ethtool_tcpip4_spec              sctp_ip4_spec;
640                 struct ethtool_ah_espip4_spec           ah_ip4_spec;
641                 struct ethtool_ah_espip4_spec           esp_ip4_spec;
642                 struct ethtool_usrip4_spec              usr_ip4_spec;
643                 struct ethhdr                           ether_spec;
644                 __u8                                    hdata[72];
645         } h_u, m_u;
646
647         __u16           vlan_tag;
648         __u16           vlan_tag_mask;
649         __u64           data;
650         __u64           data_mask;
651
652         __s32           action;
653 #define ETHTOOL_RXNTUPLE_ACTION_DROP    (-1)    /* drop packet */
654 #define ETHTOOL_RXNTUPLE_ACTION_CLEAR   (-2)    /* clear filter */
655 };
656
657 /**
658  * struct ethtool_rx_ntuple - command to set or clear RX flow filter
659  * @cmd: Command number - %ETHTOOL_SRXNTUPLE
660  * @fs: Flow filter specification
661  */
662 struct ethtool_rx_ntuple {
663         __u32                                   cmd;
664         struct ethtool_rx_ntuple_flow_spec      fs;
665 };
666
667 #define ETHTOOL_FLASH_MAX_FILENAME      128
668 enum ethtool_flash_op_type {
669         ETHTOOL_FLASH_ALL_REGIONS       = 0,
670 };
671
672 /* for passing firmware flashing related parameters */
673 struct ethtool_flash {
674         __u32   cmd;
675         __u32   region;
676         char    data[ETHTOOL_FLASH_MAX_FILENAME];
677 };
678
679 /**
680  * struct ethtool_dump - used for retrieving, setting device dump
681  * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
682  *      %ETHTOOL_SET_DUMP
683  * @version: FW version of the dump, filled in by driver
684  * @flag: driver dependent flag for dump setting, filled in by driver during
685  *        get and filled in by ethtool for set operation.
686  *        flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
687  *        firmware dump is disabled.
688  * @len: length of dump data, used as the length of the user buffer on entry to
689  *       %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
690  *       for %ETHTOOL_GET_DUMP_FLAG command
691  * @data: data collected for get dump data operation
692  */
693
694 #define ETH_FW_DUMP_DISABLE 0
695
696 struct ethtool_dump {
697         __u32   cmd;
698         __u32   version;
699         __u32   flag;
700         __u32   len;
701         __u8    data[0];
702 };
703
704 /* for returning and changing feature sets */
705
706 /**
707  * struct ethtool_get_features_block - block with state of 32 features
708  * @available: mask of changeable features
709  * @requested: mask of features requested to be enabled if possible
710  * @active: mask of currently enabled features
711  * @never_changed: mask of features not changeable for any device
712  */
713 struct ethtool_get_features_block {
714         __u32   available;
715         __u32   requested;
716         __u32   active;
717         __u32   never_changed;
718 };
719
720 /**
721  * struct ethtool_gfeatures - command to get state of device's features
722  * @cmd: command number = %ETHTOOL_GFEATURES
723  * @size: in: number of elements in the features[] array;
724  *       out: number of elements in features[] needed to hold all features
725  * @features: state of features
726  */
727 struct ethtool_gfeatures {
728         __u32   cmd;
729         __u32   size;
730         struct ethtool_get_features_block features[0];
731 };
732
733 /**
734  * struct ethtool_set_features_block - block with request for 32 features
735  * @valid: mask of features to be changed
736  * @requested: values of features to be changed
737  */
738 struct ethtool_set_features_block {
739         __u32   valid;
740         __u32   requested;
741 };
742
743 /**
744  * struct ethtool_sfeatures - command to request change in device's features
745  * @cmd: command number = %ETHTOOL_SFEATURES
746  * @size: array size of the features[] array
747  * @features: feature change masks
748  */
749 struct ethtool_sfeatures {
750         __u32   cmd;
751         __u32   size;
752         struct ethtool_set_features_block features[0];
753 };
754
755 /**
756  * struct ethtool_ts_info - holds a device's timestamping and PHC association
757  * @cmd: command number = %ETHTOOL_GET_TS_INFO
758  * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
759  * @phc_index: device index of the associated PHC, or -1 if there is none
760  * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
761  * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
762  *
763  * The bits in the 'tx_types' and 'rx_filters' fields correspond to
764  * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
765  * respectively.  For example, if the device supports HWTSTAMP_TX_ON,
766  * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
767  */
768 struct ethtool_ts_info {
769         __u32   cmd;
770         __u32   so_timestamping;
771         __s32   phc_index;
772         __u32   tx_types;
773         __u32   tx_reserved[3];
774         __u32   rx_filters;
775         __u32   rx_reserved[3];
776 };
777
778 /*
779  * %ETHTOOL_SFEATURES changes features present in features[].valid to the
780  * values of corresponding bits in features[].requested. Bits in .requested
781  * not set in .valid or not changeable are ignored.
782  *
783  * Returns %EINVAL when .valid contains undefined or never-changeable bits
784  * or size is not equal to required number of features words (32-bit blocks).
785  * Returns >= 0 if request was completed; bits set in the value mean:
786  *   %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
787  *      changeable (not present in %ETHTOOL_GFEATURES' features[].available)
788  *      those bits were ignored.
789  *   %ETHTOOL_F_WISH - some or all changes requested were recorded but the
790  *      resulting state of bits masked by .valid is not equal to .requested.
791  *      Probably there are other device-specific constraints on some features
792  *      in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
793  *      here as though ignored bits were cleared.
794  *   %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
795  *      compatibility functions. Requested offload state cannot be properly
796  *      managed by kernel.
797  *
798  * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
799  * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
800  * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
801  * significant bit in features[0] fields. Empty strings mark undefined features.
802  */
803 enum ethtool_sfeatures_retval_bits {
804         ETHTOOL_F_UNSUPPORTED__BIT,
805         ETHTOOL_F_WISH__BIT,
806         ETHTOOL_F_COMPAT__BIT,
807 };
808
809 #define ETHTOOL_F_UNSUPPORTED   (1 << ETHTOOL_F_UNSUPPORTED__BIT)
810 #define ETHTOOL_F_WISH          (1 << ETHTOOL_F_WISH__BIT)
811 #define ETHTOOL_F_COMPAT        (1 << ETHTOOL_F_COMPAT__BIT)
812
813
814 /* CMDs currently supported */
815 #define ETHTOOL_GSET            0x00000001 /* Get settings. */
816 #define ETHTOOL_SSET            0x00000002 /* Set settings. */
817 #define ETHTOOL_GDRVINFO        0x00000003 /* Get driver info. */
818 #define ETHTOOL_GREGS           0x00000004 /* Get NIC registers. */
819 #define ETHTOOL_GWOL            0x00000005 /* Get wake-on-lan options. */
820 #define ETHTOOL_SWOL            0x00000006 /* Set wake-on-lan options. */
821 #define ETHTOOL_GMSGLVL         0x00000007 /* Get driver message level */
822 #define ETHTOOL_SMSGLVL         0x00000008 /* Set driver msg level. */
823 #define ETHTOOL_NWAY_RST        0x00000009 /* Restart autonegotiation. */
824 /* Get link status for host, i.e. whether the interface *and* the
825  * physical port (if there is one) are up (ethtool_value). */
826 #define ETHTOOL_GLINK           0x0000000a
827 #define ETHTOOL_GEEPROM         0x0000000b /* Get EEPROM data */
828 #define ETHTOOL_SEEPROM         0x0000000c /* Set EEPROM data. */
829 #define ETHTOOL_GCOALESCE       0x0000000e /* Get coalesce config */
830 #define ETHTOOL_SCOALESCE       0x0000000f /* Set coalesce config. */
831 #define ETHTOOL_GRINGPARAM      0x00000010 /* Get ring parameters */
832 #define ETHTOOL_SRINGPARAM      0x00000011 /* Set ring parameters. */
833 #define ETHTOOL_GPAUSEPARAM     0x00000012 /* Get pause parameters */
834 #define ETHTOOL_SPAUSEPARAM     0x00000013 /* Set pause parameters. */
835 #define ETHTOOL_GRXCSUM         0x00000014 /* Get RX hw csum enable (ethtool_value) */
836 #define ETHTOOL_SRXCSUM         0x00000015 /* Set RX hw csum enable (ethtool_value) */
837 #define ETHTOOL_GTXCSUM         0x00000016 /* Get TX hw csum enable (ethtool_value) */
838 #define ETHTOOL_STXCSUM         0x00000017 /* Set TX hw csum enable (ethtool_value) */
839 #define ETHTOOL_GSG             0x00000018 /* Get scatter-gather enable
840                                             * (ethtool_value) */
841 #define ETHTOOL_SSG             0x00000019 /* Set scatter-gather enable
842                                             * (ethtool_value). */
843 #define ETHTOOL_TEST            0x0000001a /* execute NIC self-test. */
844 #define ETHTOOL_GSTRINGS        0x0000001b /* get specified string set */
845 #define ETHTOOL_PHYS_ID         0x0000001c /* identify the NIC */
846 #define ETHTOOL_GSTATS          0x0000001d /* get NIC-specific statistics */
847 #define ETHTOOL_GTSO            0x0000001e /* Get TSO enable (ethtool_value) */
848 #define ETHTOOL_STSO            0x0000001f /* Set TSO enable (ethtool_value) */
849 #define ETHTOOL_GPERMADDR       0x00000020 /* Get permanent hardware address */
850 #define ETHTOOL_GUFO            0x00000021 /* Get UFO enable (ethtool_value) */
851 #define ETHTOOL_SUFO            0x00000022 /* Set UFO enable (ethtool_value) */
852 #define ETHTOOL_GGSO            0x00000023 /* Get GSO enable (ethtool_value) */
853 #define ETHTOOL_SGSO            0x00000024 /* Set GSO enable (ethtool_value) */
854 #define ETHTOOL_GFLAGS          0x00000025 /* Get flags bitmap(ethtool_value) */
855 #define ETHTOOL_SFLAGS          0x00000026 /* Set flags bitmap(ethtool_value) */
856 #define ETHTOOL_GPFLAGS         0x00000027 /* Get driver-private flags bitmap */
857 #define ETHTOOL_SPFLAGS         0x00000028 /* Set driver-private flags bitmap */
858
859 #define ETHTOOL_GRXFH           0x00000029 /* Get RX flow hash configuration */
860 #define ETHTOOL_SRXFH           0x0000002a /* Set RX flow hash configuration */
861 #define ETHTOOL_GGRO            0x0000002b /* Get GRO enable (ethtool_value) */
862 #define ETHTOOL_SGRO            0x0000002c /* Set GRO enable (ethtool_value) */
863 #define ETHTOOL_GRXRINGS        0x0000002d /* Get RX rings available for LB */
864 #define ETHTOOL_GRXCLSRLCNT     0x0000002e /* Get RX class rule count */
865 #define ETHTOOL_GRXCLSRULE      0x0000002f /* Get RX classification rule */
866 #define ETHTOOL_GRXCLSRLALL     0x00000030 /* Get all RX classification rule */
867 #define ETHTOOL_SRXCLSRLDEL     0x00000031 /* Delete RX classification rule */
868 #define ETHTOOL_SRXCLSRLINS     0x00000032 /* Insert RX classification rule */
869 #define ETHTOOL_FLASHDEV        0x00000033 /* Flash firmware to device */
870 #define ETHTOOL_RESET           0x00000034 /* Reset hardware */
871 #define ETHTOOL_SRXNTUPLE       0x00000035 /* Add an n-tuple filter to device */
872 #define ETHTOOL_GRXNTUPLE       0x00000036 /* deprecated */
873 #define ETHTOOL_GSSET_INFO      0x00000037 /* Get string set info */
874 #define ETHTOOL_GRXFHINDIR      0x00000038 /* Get RX flow hash indir'n table */
875 #define ETHTOOL_SRXFHINDIR      0x00000039 /* Set RX flow hash indir'n table */
876
877 #define ETHTOOL_GFEATURES       0x0000003a /* Get device offload settings */
878 #define ETHTOOL_SFEATURES       0x0000003b /* Change device offload settings */
879 #define ETHTOOL_GCHANNELS       0x0000003c /* Get no of channels */
880 #define ETHTOOL_SCHANNELS       0x0000003d /* Set no of channels */
881 #define ETHTOOL_SET_DUMP        0x0000003e /* Set dump settings */
882 #define ETHTOOL_GET_DUMP_FLAG   0x0000003f /* Get dump settings */
883 #define ETHTOOL_GET_DUMP_DATA   0x00000040 /* Get dump data */
884 #define ETHTOOL_GET_TS_INFO     0x00000041 /* Get time stamping and PHC info */
885 #define ETHTOOL_GMODULEINFO     0x00000042 /* Get plug-in module information */
886 #define ETHTOOL_GMODULEEEPROM   0x00000043 /* Get plug-in module eeprom */
887 #define ETHTOOL_GEEE            0x00000044 /* Get EEE settings */
888 #define ETHTOOL_SEEE            0x00000045 /* Set EEE settings */
889
890 /* compatibility with older code */
891 #define SPARC_ETH_GSET          ETHTOOL_GSET
892 #define SPARC_ETH_SSET          ETHTOOL_SSET
893
894 /* Indicates what features are supported by the interface. */
895 #define SUPPORTED_10baseT_Half          (1 << 0)
896 #define SUPPORTED_10baseT_Full          (1 << 1)
897 #define SUPPORTED_100baseT_Half         (1 << 2)
898 #define SUPPORTED_100baseT_Full         (1 << 3)
899 #define SUPPORTED_1000baseT_Half        (1 << 4)
900 #define SUPPORTED_1000baseT_Full        (1 << 5)
901 #define SUPPORTED_Autoneg               (1 << 6)
902 #define SUPPORTED_TP                    (1 << 7)
903 #define SUPPORTED_AUI                   (1 << 8)
904 #define SUPPORTED_MII                   (1 << 9)
905 #define SUPPORTED_FIBRE                 (1 << 10)
906 #define SUPPORTED_BNC                   (1 << 11)
907 #define SUPPORTED_10000baseT_Full       (1 << 12)
908 #define SUPPORTED_Pause                 (1 << 13)
909 #define SUPPORTED_Asym_Pause            (1 << 14)
910 #define SUPPORTED_2500baseX_Full        (1 << 15)
911 #define SUPPORTED_Backplane             (1 << 16)
912 #define SUPPORTED_1000baseKX_Full       (1 << 17)
913 #define SUPPORTED_10000baseKX4_Full     (1 << 18)
914 #define SUPPORTED_10000baseKR_Full      (1 << 19)
915 #define SUPPORTED_10000baseR_FEC        (1 << 20)
916 #define SUPPORTED_20000baseMLD2_Full    (1 << 21)
917 #define SUPPORTED_20000baseKR2_Full     (1 << 22)
918 #define SUPPORTED_40000baseKR4_Full     (1 << 23)
919 #define SUPPORTED_40000baseCR4_Full     (1 << 24)
920 #define SUPPORTED_40000baseSR4_Full     (1 << 25)
921 #define SUPPORTED_40000baseLR4_Full     (1 << 26)
922
923 /* Indicates what features are advertised by the interface. */
924 #define ADVERTISED_10baseT_Half         (1 << 0)
925 #define ADVERTISED_10baseT_Full         (1 << 1)
926 #define ADVERTISED_100baseT_Half        (1 << 2)
927 #define ADVERTISED_100baseT_Full        (1 << 3)
928 #define ADVERTISED_1000baseT_Half       (1 << 4)
929 #define ADVERTISED_1000baseT_Full       (1 << 5)
930 #define ADVERTISED_Autoneg              (1 << 6)
931 #define ADVERTISED_TP                   (1 << 7)
932 #define ADVERTISED_AUI                  (1 << 8)
933 #define ADVERTISED_MII                  (1 << 9)
934 #define ADVERTISED_FIBRE                (1 << 10)
935 #define ADVERTISED_BNC                  (1 << 11)
936 #define ADVERTISED_10000baseT_Full      (1 << 12)
937 #define ADVERTISED_Pause                (1 << 13)
938 #define ADVERTISED_Asym_Pause           (1 << 14)
939 #define ADVERTISED_2500baseX_Full       (1 << 15)
940 #define ADVERTISED_Backplane            (1 << 16)
941 #define ADVERTISED_1000baseKX_Full      (1 << 17)
942 #define ADVERTISED_10000baseKX4_Full    (1 << 18)
943 #define ADVERTISED_10000baseKR_Full     (1 << 19)
944 #define ADVERTISED_10000baseR_FEC       (1 << 20)
945 #define ADVERTISED_20000baseMLD2_Full   (1 << 21)
946 #define ADVERTISED_20000baseKR2_Full    (1 << 22)
947 #define ADVERTISED_40000baseKR4_Full    (1 << 23)
948 #define ADVERTISED_40000baseCR4_Full    (1 << 24)
949 #define ADVERTISED_40000baseSR4_Full    (1 << 25)
950 #define ADVERTISED_40000baseLR4_Full    (1 << 26)
951
952 /* The following are all involved in forcing a particular link
953  * mode for the device for setting things.  When getting the
954  * devices settings, these indicate the current mode and whether
955  * it was forced up into this mode or autonegotiated.
956  */
957
958 /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
959 #define SPEED_10                10
960 #define SPEED_100               100
961 #define SPEED_1000              1000
962 #define SPEED_2500              2500
963 #define SPEED_10000             10000
964 #define SPEED_UNKNOWN           -1
965
966 /* Duplex, half or full. */
967 #define DUPLEX_HALF             0x00
968 #define DUPLEX_FULL             0x01
969 #define DUPLEX_UNKNOWN          0xff
970
971 /* Which connector port. */
972 #define PORT_TP                 0x00
973 #define PORT_AUI                0x01
974 #define PORT_MII                0x02
975 #define PORT_FIBRE              0x03
976 #define PORT_BNC                0x04
977 #define PORT_DA                 0x05
978 #define PORT_NONE               0xef
979 #define PORT_OTHER              0xff
980
981 /* Which transceiver to use. */
982 #define XCVR_INTERNAL           0x00
983 #define XCVR_EXTERNAL           0x01
984 #define XCVR_DUMMY1             0x02
985 #define XCVR_DUMMY2             0x03
986 #define XCVR_DUMMY3             0x04
987
988 /* Enable or disable autonegotiation.  If this is set to enable,
989  * the forced link modes above are completely ignored.
990  */
991 #define AUTONEG_DISABLE         0x00
992 #define AUTONEG_ENABLE          0x01
993
994 /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
995  * the driver is required to renegotiate link
996  */
997 #define ETH_TP_MDI_INVALID      0x00 /* status: unknown; control: unsupported */
998 #define ETH_TP_MDI              0x01 /* status: MDI;     control: force MDI */
999 #define ETH_TP_MDI_X            0x02 /* status: MDI-X;   control: force MDI-X */
1000 #define ETH_TP_MDI_AUTO         0x03 /*                  control: auto-select */
1001
1002 /* Wake-On-Lan options. */
1003 #define WAKE_PHY                (1 << 0)
1004 #define WAKE_UCAST              (1 << 1)
1005 #define WAKE_MCAST              (1 << 2)
1006 #define WAKE_BCAST              (1 << 3)
1007 #define WAKE_ARP                (1 << 4)
1008 #define WAKE_MAGIC              (1 << 5)
1009 #define WAKE_MAGICSECURE        (1 << 6) /* only meaningful if WAKE_MAGIC */
1010
1011 /* L2-L4 network traffic flow types */
1012 #define TCP_V4_FLOW     0x01    /* hash or spec (tcp_ip4_spec) */
1013 #define UDP_V4_FLOW     0x02    /* hash or spec (udp_ip4_spec) */
1014 #define SCTP_V4_FLOW    0x03    /* hash or spec (sctp_ip4_spec) */
1015 #define AH_ESP_V4_FLOW  0x04    /* hash only */
1016 #define TCP_V6_FLOW     0x05    /* hash only */
1017 #define UDP_V6_FLOW     0x06    /* hash only */
1018 #define SCTP_V6_FLOW    0x07    /* hash only */
1019 #define AH_ESP_V6_FLOW  0x08    /* hash only */
1020 #define AH_V4_FLOW      0x09    /* hash or spec (ah_ip4_spec) */
1021 #define ESP_V4_FLOW     0x0a    /* hash or spec (esp_ip4_spec) */
1022 #define AH_V6_FLOW      0x0b    /* hash only */
1023 #define ESP_V6_FLOW     0x0c    /* hash only */
1024 #define IP_USER_FLOW    0x0d    /* spec only (usr_ip4_spec) */
1025 #define IPV4_FLOW       0x10    /* hash only */
1026 #define IPV6_FLOW       0x11    /* hash only */
1027 #define ETHER_FLOW      0x12    /* spec only (ether_spec) */
1028 /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1029 #define FLOW_EXT        0x80000000
1030
1031 /* L3-L4 network traffic flow hash options */
1032 #define RXH_L2DA        (1 << 1)
1033 #define RXH_VLAN        (1 << 2)
1034 #define RXH_L3_PROTO    (1 << 3)
1035 #define RXH_IP_SRC      (1 << 4)
1036 #define RXH_IP_DST      (1 << 5)
1037 #define RXH_L4_B_0_1    (1 << 6) /* src port in case of TCP/UDP/SCTP */
1038 #define RXH_L4_B_2_3    (1 << 7) /* dst port in case of TCP/UDP/SCTP */
1039 #define RXH_DISCARD     (1 << 31)
1040
1041 #define RX_CLS_FLOW_DISC        0xffffffffffffffffULL
1042
1043 /* Special RX classification rule insert location values */
1044 #define RX_CLS_LOC_SPECIAL      0x80000000      /* flag */
1045 #define RX_CLS_LOC_ANY          0xffffffff
1046 #define RX_CLS_LOC_FIRST        0xfffffffe
1047 #define RX_CLS_LOC_LAST         0xfffffffd
1048
1049 /* EEPROM Standards for plug in modules */
1050 #define ETH_MODULE_SFF_8079             0x1
1051 #define ETH_MODULE_SFF_8079_LEN         256
1052 #define ETH_MODULE_SFF_8472             0x2
1053 #define ETH_MODULE_SFF_8472_LEN         512
1054
1055 /* Reset flags */
1056 /* The reset() operation must clear the flags for the components which
1057  * were actually reset.  On successful return, the flags indicate the
1058  * components which were not reset, either because they do not exist
1059  * in the hardware or because they cannot be reset independently.  The
1060  * driver must never reset any components that were not requested.
1061  */
1062 enum ethtool_reset_flags {
1063         /* These flags represent components dedicated to the interface
1064          * the command is addressed to.  Shift any flag left by
1065          * ETH_RESET_SHARED_SHIFT to reset a shared component of the
1066          * same type.
1067          */
1068         ETH_RESET_MGMT          = 1 << 0,       /* Management processor */
1069         ETH_RESET_IRQ           = 1 << 1,       /* Interrupt requester */
1070         ETH_RESET_DMA           = 1 << 2,       /* DMA engine */
1071         ETH_RESET_FILTER        = 1 << 3,       /* Filtering/flow direction */
1072         ETH_RESET_OFFLOAD       = 1 << 4,       /* Protocol offload */
1073         ETH_RESET_MAC           = 1 << 5,       /* Media access controller */
1074         ETH_RESET_PHY           = 1 << 6,       /* Transceiver/PHY */
1075         ETH_RESET_RAM           = 1 << 7,       /* RAM shared between
1076                                                  * multiple components */
1077
1078         ETH_RESET_DEDICATED     = 0x0000ffff,   /* All components dedicated to
1079                                                  * this interface */
1080         ETH_RESET_ALL           = 0xffffffff,   /* All components used by this
1081                                                  * interface, even if shared */
1082 };
1083 #define ETH_RESET_SHARED_SHIFT  16
1084
1085 #endif /* _UAPI_LINUX_ETHTOOL_H */