]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/ethtool.h
ethtool: Specify what kind of coalescing struct ethtool_coalesce covers
[mirror_ubuntu-bionic-kernel.git] / include / 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 _LINUX_ETHTOOL_H
14 #define _LINUX_ETHTOOL_H
15
16 #ifdef __KERNEL__
17 #include <linux/compat.h>
18 #endif
19 #include <linux/types.h>
20 #include <linux/if_ether.h>
21
22 /* This should work for both 32 and 64 bit userland. */
23 struct ethtool_cmd {
24 __u32 cmd;
25 __u32 supported; /* Features this interface supports */
26 __u32 advertising; /* Features this interface advertises */
27 __u16 speed; /* The forced speed (lower bits) in
28 * Mbps. Please use
29 * ethtool_cmd_speed()/_set() to
30 * access it */
31 __u8 duplex; /* Duplex, half or full */
32 __u8 port; /* Which connector port */
33 __u8 phy_address;
34 __u8 transceiver; /* Which transceiver to use */
35 __u8 autoneg; /* Enable or disable autonegotiation */
36 __u8 mdio_support;
37 __u32 maxtxpkt; /* Tx pkts before generating tx int */
38 __u32 maxrxpkt; /* Rx pkts before generating rx int */
39 __u16 speed_hi; /* The forced speed (upper
40 * bits) in Mbps. Please use
41 * ethtool_cmd_speed()/_set() to
42 * access it */
43 __u8 eth_tp_mdix;
44 __u8 reserved2;
45 __u32 lp_advertising; /* Features the link partner advertises */
46 __u32 reserved[2];
47 };
48
49 static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
50 __u32 speed)
51 {
52
53 ep->speed = (__u16)speed;
54 ep->speed_hi = (__u16)(speed >> 16);
55 }
56
57 static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
58 {
59 return (ep->speed_hi << 16) | ep->speed;
60 }
61
62 #define ETHTOOL_FWVERS_LEN 32
63 #define ETHTOOL_BUSINFO_LEN 32
64 /* these strings are set to whatever the driver author decides... */
65 struct ethtool_drvinfo {
66 __u32 cmd;
67 char driver[32]; /* driver short name, "tulip", "eepro100" */
68 char version[32]; /* driver version string */
69 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */
70 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
71 /* For PCI devices, use pci_name(pci_dev). */
72 char reserved1[32];
73 char reserved2[12];
74 /*
75 * Some struct members below are filled in
76 * using ops->get_sset_count(). Obtaining
77 * this info from ethtool_drvinfo is now
78 * deprecated; Use ETHTOOL_GSSET_INFO
79 * instead.
80 */
81 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
82 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
83 __u32 testinfo_len;
84 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
85 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
86 };
87
88 #define SOPASS_MAX 6
89 /* wake-on-lan settings */
90 struct ethtool_wolinfo {
91 __u32 cmd;
92 __u32 supported;
93 __u32 wolopts;
94 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */
95 };
96
97 /* for passing single values */
98 struct ethtool_value {
99 __u32 cmd;
100 __u32 data;
101 };
102
103 /* for passing big chunks of data */
104 struct ethtool_regs {
105 __u32 cmd;
106 __u32 version; /* driver-specific, indicates different chips/revs */
107 __u32 len; /* bytes */
108 __u8 data[0];
109 };
110
111 /* for passing EEPROM chunks */
112 struct ethtool_eeprom {
113 __u32 cmd;
114 __u32 magic;
115 __u32 offset; /* in bytes */
116 __u32 len; /* in bytes */
117 __u8 data[0];
118 };
119
120 /**
121 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
122 * @cmd: ETHTOOL_{G,S}COALESCE
123 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
124 * a packet arrives. If 0, only @rx_max_coalesced_frames is used.
125 * @rx_max_coalesced_frames: How many packets to delay an RX interrupt
126 * after a packet arrives. If 0, only @rx_coalesce_usecs is used.
127 * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
128 * this value applies while an IRQ is being serviced by the host.
129 * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
130 * except that this value applies while an IRQ is being serviced
131 * by the host.
132 * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
133 * a packet is sent. If 0, only @tx_max_coalesced_frames
134 * is used.
135 * @tx_max_coalesced_frames: How many packets to delay a TX interrupt
136 * after a packet is sent. If 0, only @tx_coalesce_usecs is
137 * used.
138 * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
139 * this value applies while an IRQ is being serviced by the host.
140 * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
141 * except that this value applies while an IRQ is being serviced
142 * by the host.
143 * @stats_block_coalesce_usecs: How many usecs to delay in-memory
144 * statistics block updates. Some drivers do not have an
145 * in-memory statistic block, and in such cases this value is
146 * ignored. This value must not be zero.
147 * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
148 * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
149 * @pkt_rate_low: Threshold for low packet rate (packets per second).
150 * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
151 * a packet arrives, when the packet rate is below @pkt_rate_low.
152 * @rx_max_coalesced_frames_low: How many packets to delay an RX interrupt
153 * after a packet arrives, when the packet rate is below @pkt_rate_low.
154 * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
155 * a packet is sent, when the packet rate is below @pkt_rate_low.
156 * @tx_max_coalesced_frames_low: How many packets to delay a TX interrupt
157 * after a packet is sent, when the packet rate is below @pkt_rate_low.
158 * @pkt_rate_high: Threshold for high packet rate (packets per second).
159 * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
160 * a packet arrives, when the packet rate is above @pkt_rate_high.
161 * @rx_max_coalesced_frames_high: How many packets to delay an RX interrupt
162 * after a packet arrives, when the packet rate is above @pkt_rate_high.
163 * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
164 * a packet is sent, when the packet rate is above @pkt_rate_high.
165 * @tx_max_coalesced_frames_high: How many packets to delay a TX interrupt
166 * after a packet is sent, when the packet rate is above @pkt_rate_high.
167 * @rate_sample_interval: How often to do adaptive coalescing packet rate
168 * sampling, measured in seconds. Must not be zero.
169 *
170 * It is illegal to set both usecs and max frames to zero as this
171 * would cause interrupts to never be generated.
172 *
173 * Adaptive RX/TX coalescing is an algorithm implemented by some
174 * drivers to improve latency under low packet rates and improve
175 * throughput under high packet rates. Some drivers only implement
176 * one of RX or TX adaptive coalescing. Anything not implemented by
177 * the driver causes these values to be silently ignored.
178 *
179 * When the packet rate is below @pkt_rate_high but above
180 * @pkt_rate_low (both measured in packets per second) the
181 * normal {rx,tx}_* coalescing parameters are used.
182 */
183 struct ethtool_coalesce {
184 __u32 cmd;
185 __u32 rx_coalesce_usecs;
186 __u32 rx_max_coalesced_frames;
187 __u32 rx_coalesce_usecs_irq;
188 __u32 rx_max_coalesced_frames_irq;
189 __u32 tx_coalesce_usecs;
190 __u32 tx_max_coalesced_frames;
191 __u32 tx_coalesce_usecs_irq;
192 __u32 tx_max_coalesced_frames_irq;
193 __u32 stats_block_coalesce_usecs;
194 __u32 use_adaptive_rx_coalesce;
195 __u32 use_adaptive_tx_coalesce;
196 __u32 pkt_rate_low;
197 __u32 rx_coalesce_usecs_low;
198 __u32 rx_max_coalesced_frames_low;
199 __u32 tx_coalesce_usecs_low;
200 __u32 tx_max_coalesced_frames_low;
201 __u32 pkt_rate_high;
202 __u32 rx_coalesce_usecs_high;
203 __u32 rx_max_coalesced_frames_high;
204 __u32 tx_coalesce_usecs_high;
205 __u32 tx_max_coalesced_frames_high;
206 __u32 rate_sample_interval;
207 };
208
209 /* for configuring RX/TX ring parameters */
210 struct ethtool_ringparam {
211 __u32 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 __u32 rx_max_pending;
218 __u32 rx_mini_max_pending;
219 __u32 rx_jumbo_max_pending;
220 __u32 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 __u32 rx_pending;
226 __u32 rx_mini_pending;
227 __u32 rx_jumbo_pending;
228 __u32 tx_pending;
229 };
230
231 /**
232 * struct ethtool_channels - configuring number of network channel
233 * @cmd: ETHTOOL_{G,S}CHANNELS
234 * @max_rx: Read only. Maximum number of receive channel the driver support.
235 * @max_tx: Read only. Maximum number of transmit channel the driver support.
236 * @max_other: Read only. Maximum number of other channel the driver support.
237 * @max_combined: Read only. Maximum number of combined channel the driver
238 * support. Set of queues RX, TX or other.
239 * @rx_count: Valid values are in the range 1 to the max_rx.
240 * @tx_count: Valid values are in the range 1 to the max_tx.
241 * @other_count: Valid values are in the range 1 to the max_other.
242 * @combined_count: Valid values are in the range 1 to the max_combined.
243 *
244 * This can be used to configure RX, TX and other channels.
245 */
246
247 struct ethtool_channels {
248 __u32 cmd;
249 __u32 max_rx;
250 __u32 max_tx;
251 __u32 max_other;
252 __u32 max_combined;
253 __u32 rx_count;
254 __u32 tx_count;
255 __u32 other_count;
256 __u32 combined_count;
257 };
258
259 /* for configuring link flow control parameters */
260 struct ethtool_pauseparam {
261 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
262
263 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
264 * being true) the user may set 'autoneg' here non-zero to have the
265 * pause parameters be auto-negotiated too. In such a case, the
266 * {rx,tx}_pause values below determine what capabilities are
267 * advertised.
268 *
269 * If 'autoneg' is zero or the link is not being auto-negotiated,
270 * then {rx,tx}_pause force the driver to use/not-use pause
271 * flow control.
272 */
273 __u32 autoneg;
274 __u32 rx_pause;
275 __u32 tx_pause;
276 };
277
278 #define ETH_GSTRING_LEN 32
279 enum ethtool_stringset {
280 ETH_SS_TEST = 0,
281 ETH_SS_STATS,
282 ETH_SS_PRIV_FLAGS,
283 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */
284 ETH_SS_FEATURES,
285 };
286
287 /* for passing string sets for data tagging */
288 struct ethtool_gstrings {
289 __u32 cmd; /* ETHTOOL_GSTRINGS */
290 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
291 __u32 len; /* number of strings in the string set */
292 __u8 data[0];
293 };
294
295 struct ethtool_sset_info {
296 __u32 cmd; /* ETHTOOL_GSSET_INFO */
297 __u32 reserved;
298 __u64 sset_mask; /* input: each bit selects an sset to query */
299 /* output: each bit a returned sset */
300 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
301 in sset_mask. One bit implies one
302 __u32, two bits implies two
303 __u32's, etc. */
304 };
305
306 /**
307 * enum ethtool_test_flags - flags definition of ethtool_test
308 * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
309 * only online tests.
310 * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
311 * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
312 * test.
313 * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
314 */
315
316 enum ethtool_test_flags {
317 ETH_TEST_FL_OFFLINE = (1 << 0),
318 ETH_TEST_FL_FAILED = (1 << 1),
319 ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
320 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
321 };
322
323 /* for requesting NIC test and getting results*/
324 struct ethtool_test {
325 __u32 cmd; /* ETHTOOL_TEST */
326 __u32 flags; /* ETH_TEST_FL_xxx */
327 __u32 reserved;
328 __u32 len; /* result length, in number of u64 elements */
329 __u64 data[0];
330 };
331
332 /* for dumping NIC-specific statistics */
333 struct ethtool_stats {
334 __u32 cmd; /* ETHTOOL_GSTATS */
335 __u32 n_stats; /* number of u64's being returned */
336 __u64 data[0];
337 };
338
339 struct ethtool_perm_addr {
340 __u32 cmd; /* ETHTOOL_GPERMADDR */
341 __u32 size;
342 __u8 data[0];
343 };
344
345 /* boolean flags controlling per-interface behavior characteristics.
346 * When reading, the flag indicates whether or not a certain behavior
347 * is enabled/present. When writing, the flag indicates whether
348 * or not the driver should turn on (set) or off (clear) a behavior.
349 *
350 * Some behaviors may read-only (unconditionally absent or present).
351 * If such is the case, return EINVAL in the set-flags operation if the
352 * flag differs from the read-only value.
353 */
354 enum ethtool_flags {
355 ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
356 ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
357 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
358 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
359 ETH_FLAG_RXHASH = (1 << 28),
360 };
361
362 /* The following structures are for supporting RX network flow
363 * classification and RX n-tuple configuration. Note, all multibyte
364 * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
365 * be in network byte order.
366 */
367
368 /**
369 * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
370 * @ip4src: Source host
371 * @ip4dst: Destination host
372 * @psrc: Source port
373 * @pdst: Destination port
374 * @tos: Type-of-service
375 *
376 * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
377 */
378 struct ethtool_tcpip4_spec {
379 __be32 ip4src;
380 __be32 ip4dst;
381 __be16 psrc;
382 __be16 pdst;
383 __u8 tos;
384 };
385
386 /**
387 * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
388 * @ip4src: Source host
389 * @ip4dst: Destination host
390 * @spi: Security parameters index
391 * @tos: Type-of-service
392 *
393 * This can be used to specify an IPsec transport or tunnel over IPv4.
394 */
395 struct ethtool_ah_espip4_spec {
396 __be32 ip4src;
397 __be32 ip4dst;
398 __be32 spi;
399 __u8 tos;
400 };
401
402 #define ETH_RX_NFC_IP4 1
403
404 /**
405 * struct ethtool_usrip4_spec - general flow specification for IPv4
406 * @ip4src: Source host
407 * @ip4dst: Destination host
408 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
409 * @tos: Type-of-service
410 * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
411 * @proto: Transport protocol number; mask must be 0
412 */
413 struct ethtool_usrip4_spec {
414 __be32 ip4src;
415 __be32 ip4dst;
416 __be32 l4_4_bytes;
417 __u8 tos;
418 __u8 ip_ver;
419 __u8 proto;
420 };
421
422 union ethtool_flow_union {
423 struct ethtool_tcpip4_spec tcp_ip4_spec;
424 struct ethtool_tcpip4_spec udp_ip4_spec;
425 struct ethtool_tcpip4_spec sctp_ip4_spec;
426 struct ethtool_ah_espip4_spec ah_ip4_spec;
427 struct ethtool_ah_espip4_spec esp_ip4_spec;
428 struct ethtool_usrip4_spec usr_ip4_spec;
429 struct ethhdr ether_spec;
430 __u8 hdata[60];
431 };
432
433 struct ethtool_flow_ext {
434 __be16 vlan_etype;
435 __be16 vlan_tci;
436 __be32 data[2];
437 };
438
439 /**
440 * struct ethtool_rx_flow_spec - specification for RX flow filter
441 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
442 * @h_u: Flow fields to match (dependent on @flow_type)
443 * @h_ext: Additional fields to match
444 * @m_u: Masks for flow field bits to be matched
445 * @m_ext: Masks for additional field bits to be matched
446 * Note, all additional fields must be ignored unless @flow_type
447 * includes the %FLOW_EXT flag.
448 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
449 * if packets should be discarded
450 * @location: Index of filter in hardware table
451 */
452 struct ethtool_rx_flow_spec {
453 __u32 flow_type;
454 union ethtool_flow_union h_u;
455 struct ethtool_flow_ext h_ext;
456 union ethtool_flow_union m_u;
457 struct ethtool_flow_ext m_ext;
458 __u64 ring_cookie;
459 __u32 location;
460 };
461
462 /**
463 * struct ethtool_rxnfc - command to get or set RX flow classification rules
464 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
465 * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
466 * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
467 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
468 * @data: Command-dependent value
469 * @fs: Flow filter specification
470 * @rule_cnt: Number of rules to be affected
471 * @rule_locs: Array of valid rule indices
472 *
473 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
474 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
475 * structure fields must not be used.
476 *
477 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
478 * on return.
479 *
480 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
481 * rules on return.
482 *
483 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the index of an
484 * existing filter rule on entry and @fs contains the rule on return.
485 *
486 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
487 * user buffer for @rule_locs on entry. On return, @data is the size
488 * of the filter table and @rule_locs contains the indices of the
489 * defined rules.
490 *
491 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the filter rule to add or
492 * update. @fs.@location specifies the index to use and must not be
493 * ignored.
494 *
495 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the index of an
496 * existing filter rule on entry.
497 *
498 * Implementation of indexed classification rules generally requires a
499 * TCAM.
500 */
501 struct ethtool_rxnfc {
502 __u32 cmd;
503 __u32 flow_type;
504 __u64 data;
505 struct ethtool_rx_flow_spec fs;
506 __u32 rule_cnt;
507 __u32 rule_locs[0];
508 };
509
510 #ifdef __KERNEL__
511 #ifdef CONFIG_COMPAT
512
513 struct compat_ethtool_rx_flow_spec {
514 u32 flow_type;
515 union ethtool_flow_union h_u;
516 struct ethtool_flow_ext h_ext;
517 union ethtool_flow_union m_u;
518 struct ethtool_flow_ext m_ext;
519 compat_u64 ring_cookie;
520 u32 location;
521 };
522
523 struct compat_ethtool_rxnfc {
524 u32 cmd;
525 u32 flow_type;
526 compat_u64 data;
527 struct compat_ethtool_rx_flow_spec fs;
528 u32 rule_cnt;
529 u32 rule_locs[0];
530 };
531
532 #endif /* CONFIG_COMPAT */
533 #endif /* __KERNEL__ */
534
535 /**
536 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
537 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
538 * @size: On entry, the array size of the user buffer. On return from
539 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table.
540 * @ring_index: RX ring/queue index for each hash value
541 */
542 struct ethtool_rxfh_indir {
543 __u32 cmd;
544 __u32 size;
545 __u32 ring_index[0];
546 };
547
548 /**
549 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
550 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
551 * @h_u: Flow field values to match (dependent on @flow_type)
552 * @m_u: Masks for flow field value bits to be ignored
553 * @vlan_tag: VLAN tag to match
554 * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
555 * @data: Driver-dependent data to match
556 * @data_mask: Mask for driver-dependent data bits to be ignored
557 * @action: RX ring/queue index to deliver to (non-negative) or other action
558 * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
559 *
560 * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
561 * a field value and mask are both zero this is treated as if all mask
562 * bits are set i.e. the field is ignored.
563 */
564 struct ethtool_rx_ntuple_flow_spec {
565 __u32 flow_type;
566 union {
567 struct ethtool_tcpip4_spec tcp_ip4_spec;
568 struct ethtool_tcpip4_spec udp_ip4_spec;
569 struct ethtool_tcpip4_spec sctp_ip4_spec;
570 struct ethtool_ah_espip4_spec ah_ip4_spec;
571 struct ethtool_ah_espip4_spec esp_ip4_spec;
572 struct ethtool_usrip4_spec usr_ip4_spec;
573 struct ethhdr ether_spec;
574 __u8 hdata[72];
575 } h_u, m_u;
576
577 __u16 vlan_tag;
578 __u16 vlan_tag_mask;
579 __u64 data;
580 __u64 data_mask;
581
582 __s32 action;
583 #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
584 #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
585 };
586
587 /**
588 * struct ethtool_rx_ntuple - command to set or clear RX flow filter
589 * @cmd: Command number - %ETHTOOL_SRXNTUPLE
590 * @fs: Flow filter specification
591 */
592 struct ethtool_rx_ntuple {
593 __u32 cmd;
594 struct ethtool_rx_ntuple_flow_spec fs;
595 };
596
597 #define ETHTOOL_FLASH_MAX_FILENAME 128
598 enum ethtool_flash_op_type {
599 ETHTOOL_FLASH_ALL_REGIONS = 0,
600 };
601
602 /* for passing firmware flashing related parameters */
603 struct ethtool_flash {
604 __u32 cmd;
605 __u32 region;
606 char data[ETHTOOL_FLASH_MAX_FILENAME];
607 };
608
609 /**
610 * struct ethtool_dump - used for retrieving, setting device dump
611 * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
612 * %ETHTOOL_SET_DUMP
613 * @version: FW version of the dump, filled in by driver
614 * @flag: driver dependent flag for dump setting, filled in by driver during
615 * get and filled in by ethtool for set operation
616 * @len: length of dump data, used as the length of the user buffer on entry to
617 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
618 * for %ETHTOOL_GET_DUMP_FLAG command
619 * @data: data collected for get dump data operation
620 */
621 struct ethtool_dump {
622 __u32 cmd;
623 __u32 version;
624 __u32 flag;
625 __u32 len;
626 __u8 data[0];
627 };
628
629 /* for returning and changing feature sets */
630
631 /**
632 * struct ethtool_get_features_block - block with state of 32 features
633 * @available: mask of changeable features
634 * @requested: mask of features requested to be enabled if possible
635 * @active: mask of currently enabled features
636 * @never_changed: mask of features not changeable for any device
637 */
638 struct ethtool_get_features_block {
639 __u32 available;
640 __u32 requested;
641 __u32 active;
642 __u32 never_changed;
643 };
644
645 /**
646 * struct ethtool_gfeatures - command to get state of device's features
647 * @cmd: command number = %ETHTOOL_GFEATURES
648 * @size: in: number of elements in the features[] array;
649 * out: number of elements in features[] needed to hold all features
650 * @features: state of features
651 */
652 struct ethtool_gfeatures {
653 __u32 cmd;
654 __u32 size;
655 struct ethtool_get_features_block features[0];
656 };
657
658 /**
659 * struct ethtool_set_features_block - block with request for 32 features
660 * @valid: mask of features to be changed
661 * @requested: values of features to be changed
662 */
663 struct ethtool_set_features_block {
664 __u32 valid;
665 __u32 requested;
666 };
667
668 /**
669 * struct ethtool_sfeatures - command to request change in device's features
670 * @cmd: command number = %ETHTOOL_SFEATURES
671 * @size: array size of the features[] array
672 * @features: feature change masks
673 */
674 struct ethtool_sfeatures {
675 __u32 cmd;
676 __u32 size;
677 struct ethtool_set_features_block features[0];
678 };
679
680 /*
681 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
682 * values of corresponding bits in features[].requested. Bits in .requested
683 * not set in .valid or not changeable are ignored.
684 *
685 * Returns %EINVAL when .valid contains undefined or never-changeable bits
686 * or size is not equal to required number of features words (32-bit blocks).
687 * Returns >= 0 if request was completed; bits set in the value mean:
688 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
689 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
690 * those bits were ignored.
691 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
692 * resulting state of bits masked by .valid is not equal to .requested.
693 * Probably there are other device-specific constraints on some features
694 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
695 * here as though ignored bits were cleared.
696 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
697 * compatibility functions. Requested offload state cannot be properly
698 * managed by kernel.
699 *
700 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
701 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
702 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
703 * significant bit in features[0] fields. Empty strings mark undefined features.
704 */
705 enum ethtool_sfeatures_retval_bits {
706 ETHTOOL_F_UNSUPPORTED__BIT,
707 ETHTOOL_F_WISH__BIT,
708 ETHTOOL_F_COMPAT__BIT,
709 };
710
711 #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
712 #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
713 #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
714
715 #ifdef __KERNEL__
716
717 #include <linux/rculist.h>
718
719 /* needed by dev_disable_lro() */
720 extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
721
722 /**
723 * enum ethtool_phys_id_state - indicator state for physical identification
724 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
725 * @ETHTOOL_ID_ACTIVE: Physical ID indicator should be activated
726 * @ETHTOOL_ID_ON: LED should be turned on (used iff %ETHTOOL_ID_ACTIVE
727 * is not supported)
728 * @ETHTOOL_ID_OFF: LED should be turned off (used iff %ETHTOOL_ID_ACTIVE
729 * is not supported)
730 */
731 enum ethtool_phys_id_state {
732 ETHTOOL_ID_INACTIVE,
733 ETHTOOL_ID_ACTIVE,
734 ETHTOOL_ID_ON,
735 ETHTOOL_ID_OFF
736 };
737
738 struct net_device;
739
740 /* Some generic methods drivers may use in their ethtool_ops */
741 u32 ethtool_op_get_link(struct net_device *dev);
742 u32 ethtool_op_get_tx_csum(struct net_device *dev);
743 int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
744 int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
745 int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data);
746 u32 ethtool_op_get_sg(struct net_device *dev);
747 int ethtool_op_set_sg(struct net_device *dev, u32 data);
748 u32 ethtool_op_get_tso(struct net_device *dev);
749 int ethtool_op_set_tso(struct net_device *dev, u32 data);
750 u32 ethtool_op_get_ufo(struct net_device *dev);
751 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
752 u32 ethtool_op_get_flags(struct net_device *dev);
753 int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
754 bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
755
756 /**
757 * struct ethtool_ops - optional netdev operations
758 * @get_settings: Get various device settings including Ethernet link
759 * settings. The @cmd parameter is expected to have been cleared
760 * before get_settings is called. Returns a negative error code or
761 * zero.
762 * @set_settings: Set various device settings including Ethernet link
763 * settings. Returns a negative error code or zero.
764 * @get_drvinfo: Report driver/device information. Should only set the
765 * @driver, @version, @fw_version and @bus_info fields. If not
766 * implemented, the @driver and @bus_info fields will be filled in
767 * according to the netdev's parent device.
768 * @get_regs_len: Get buffer length required for @get_regs
769 * @get_regs: Get device registers
770 * @get_wol: Report whether Wake-on-Lan is enabled
771 * @set_wol: Turn Wake-on-Lan on or off. Returns a negative error code
772 * or zero.
773 * @get_msglevel: Report driver message level. This should be the value
774 * of the @msg_enable field used by netif logging functions.
775 * @set_msglevel: Set driver message level
776 * @nway_reset: Restart autonegotiation. Returns a negative error code
777 * or zero.
778 * @get_link: Report whether physical link is up. Will only be called if
779 * the netdev is up. Should usually be set to ethtool_op_get_link(),
780 * which uses netif_carrier_ok().
781 * @get_eeprom: Read data from the device EEPROM.
782 * Should fill in the magic field. Don't need to check len for zero
783 * or wraparound. Fill in the data argument with the eeprom values
784 * from offset to offset + len. Update len to the amount read.
785 * Returns an error or zero.
786 * @set_eeprom: Write data to the device EEPROM.
787 * Should validate the magic field. Don't need to check len for zero
788 * or wraparound. Update len to the amount written. Returns an error
789 * or zero.
790 * @get_coalesce: Get interrupt coalescing parameters. Returns a negative
791 * error code or zero.
792 * @set_coalesce: Set interrupt coalescing parameters. Returns a negative
793 * error code or zero.
794 * @get_ringparam: Report ring sizes
795 * @set_ringparam: Set ring sizes. Returns a negative error code or zero.
796 * @get_pauseparam: Report pause parameters
797 * @set_pauseparam: Set pause parameters. Returns a negative error code
798 * or zero.
799 * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
800 * Report whether receive checksums are turned on or off.
801 * @set_rx_csum: Deprecated in favour of generic netdev features. Turn
802 * receive checksum on or off. Returns a negative error code or zero.
803 * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
804 * are turned on or off.
805 * @set_tx_csum: Deprecated in favour of generic netdev features. Turn
806 * transmit checksums on or off. Returns a negative error code or zero.
807 * @get_sg: Deprecated as redundant. Report whether scatter-gather is
808 * enabled.
809 * @set_sg: Deprecated in favour of generic netdev features. Turn
810 * scatter-gather on or off. Returns a negative error code or zero.
811 * @get_tso: Deprecated as redundant. Report whether TCP segmentation
812 * offload is enabled.
813 * @set_tso: Deprecated in favour of generic netdev features. Turn TCP
814 * segmentation offload on or off. Returns a negative error code or zero.
815 * @self_test: Run specified self-tests
816 * @get_strings: Return a set of strings that describe the requested objects
817 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED
818 * attached to it. The implementation may update the indicator
819 * asynchronously or synchronously, but in either case it must return
820 * quickly. It is initially called with the argument %ETHTOOL_ID_ACTIVE,
821 * and must either activate asynchronous updates and return zero, return
822 * a negative error or return a positive frequency for synchronous
823 * indication (e.g. 1 for one on/off cycle per second). If it returns
824 * a frequency then it will be called again at intervals with the
825 * argument %ETHTOOL_ID_ON or %ETHTOOL_ID_OFF and should set the state of
826 * the indicator accordingly. Finally, it is called with the argument
827 * %ETHTOOL_ID_INACTIVE and must deactivate the indicator. Returns a
828 * negative error code or zero.
829 * @get_ethtool_stats: Return extended statistics about the device.
830 * This is only useful if the device maintains statistics not
831 * included in &struct rtnl_link_stats64.
832 * @begin: Function to be called before any other operation. Returns a
833 * negative error code or zero.
834 * @complete: Function to be called after any other operation except
835 * @begin. Will be called even if the other operation failed.
836 * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
837 * offload is enabled.
838 * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
839 * fragmentation offload on or off. Returns a negative error code or zero.
840 * @get_flags: Deprecated as redundant. Report features included in
841 * &enum ethtool_flags that are enabled.
842 * @set_flags: Deprecated in favour of generic netdev features. Turn
843 * features included in &enum ethtool_flags on or off. Returns a
844 * negative error code or zero.
845 * @get_priv_flags: Report driver-specific feature flags.
846 * @set_priv_flags: Set driver-specific feature flags. Returns a negative
847 * error code or zero.
848 * @get_sset_count: Get number of strings that @get_strings will write.
849 * @get_rxnfc: Get RX flow classification rules. Returns a negative
850 * error code or zero.
851 * @set_rxnfc: Set RX flow classification rules. Returns a negative
852 * error code or zero.
853 * @flash_device: Write a firmware image to device's flash memory.
854 * Returns a negative error code or zero.
855 * @reset: Reset (part of) the device, as specified by a bitmask of
856 * flags from &enum ethtool_reset_flags. Returns a negative
857 * error code or zero.
858 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code
859 * or zero.
860 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
861 * Returns a negative error code or zero.
862 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
863 * Returns a negative error code or zero.
864 * @get_channels: Get number of channels.
865 * @set_channels: Set number of channels. Returns a negative error code or
866 * zero.
867 * @get_dump_flag: Get dump flag indicating current dump length, version,
868 * and flag of the device.
869 * @get_dump_data: Get dump data.
870 * @set_dump: Set dump specific flags to the device.
871 *
872 * All operations are optional (i.e. the function pointer may be set
873 * to %NULL) and callers must take this into account. Callers must
874 * hold the RTNL, except that for @get_drvinfo the caller may or may
875 * not hold the RTNL.
876 *
877 * See the structures used by these operations for further documentation.
878 *
879 * See &struct net_device and &struct net_device_ops for documentation
880 * of the generic netdev features interface.
881 */
882 struct ethtool_ops {
883 int (*get_settings)(struct net_device *, struct ethtool_cmd *);
884 int (*set_settings)(struct net_device *, struct ethtool_cmd *);
885 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
886 int (*get_regs_len)(struct net_device *);
887 void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
888 void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
889 int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
890 u32 (*get_msglevel)(struct net_device *);
891 void (*set_msglevel)(struct net_device *, u32);
892 int (*nway_reset)(struct net_device *);
893 u32 (*get_link)(struct net_device *);
894 int (*get_eeprom_len)(struct net_device *);
895 int (*get_eeprom)(struct net_device *,
896 struct ethtool_eeprom *, u8 *);
897 int (*set_eeprom)(struct net_device *,
898 struct ethtool_eeprom *, u8 *);
899 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
900 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
901 void (*get_ringparam)(struct net_device *,
902 struct ethtool_ringparam *);
903 int (*set_ringparam)(struct net_device *,
904 struct ethtool_ringparam *);
905 void (*get_pauseparam)(struct net_device *,
906 struct ethtool_pauseparam*);
907 int (*set_pauseparam)(struct net_device *,
908 struct ethtool_pauseparam*);
909 u32 (*get_rx_csum)(struct net_device *);
910 int (*set_rx_csum)(struct net_device *, u32);
911 u32 (*get_tx_csum)(struct net_device *);
912 int (*set_tx_csum)(struct net_device *, u32);
913 u32 (*get_sg)(struct net_device *);
914 int (*set_sg)(struct net_device *, u32);
915 u32 (*get_tso)(struct net_device *);
916 int (*set_tso)(struct net_device *, u32);
917 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
918 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
919 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
920 void (*get_ethtool_stats)(struct net_device *,
921 struct ethtool_stats *, u64 *);
922 int (*begin)(struct net_device *);
923 void (*complete)(struct net_device *);
924 u32 (*get_ufo)(struct net_device *);
925 int (*set_ufo)(struct net_device *, u32);
926 u32 (*get_flags)(struct net_device *);
927 int (*set_flags)(struct net_device *, u32);
928 u32 (*get_priv_flags)(struct net_device *);
929 int (*set_priv_flags)(struct net_device *, u32);
930 int (*get_sset_count)(struct net_device *, int);
931 int (*get_rxnfc)(struct net_device *,
932 struct ethtool_rxnfc *, void *);
933 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
934 int (*flash_device)(struct net_device *, struct ethtool_flash *);
935 int (*reset)(struct net_device *, u32 *);
936 int (*set_rx_ntuple)(struct net_device *,
937 struct ethtool_rx_ntuple *);
938 int (*get_rxfh_indir)(struct net_device *,
939 struct ethtool_rxfh_indir *);
940 int (*set_rxfh_indir)(struct net_device *,
941 const struct ethtool_rxfh_indir *);
942 void (*get_channels)(struct net_device *, struct ethtool_channels *);
943 int (*set_channels)(struct net_device *, struct ethtool_channels *);
944 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
945 int (*get_dump_data)(struct net_device *,
946 struct ethtool_dump *, void *);
947 int (*set_dump)(struct net_device *, struct ethtool_dump *);
948
949 };
950 #endif /* __KERNEL__ */
951
952 /* CMDs currently supported */
953 #define ETHTOOL_GSET 0x00000001 /* Get settings. */
954 #define ETHTOOL_SSET 0x00000002 /* Set settings. */
955 #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
956 #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
957 #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
958 #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
959 #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
960 #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
961 #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
962 /* Get link status for host, i.e. whether the interface *and* the
963 * physical port (if there is one) are up (ethtool_value). */
964 #define ETHTOOL_GLINK 0x0000000a
965 #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
966 #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
967 #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
968 #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
969 #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
970 #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
971 #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
972 #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
973 #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
974 #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
975 #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
976 #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
977 #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
978 * (ethtool_value) */
979 #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
980 * (ethtool_value). */
981 #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
982 #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
983 #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
984 #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
985 #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
986 #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
987 #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
988 #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
989 #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
990 #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
991 #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
992 #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
993 #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
994 #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
995 #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
996
997 #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
998 #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
999 #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
1000 #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
1001 #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
1002 #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
1003 #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
1004 #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
1005 #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
1006 #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
1007 #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
1008 #define ETHTOOL_RESET 0x00000034 /* Reset hardware */
1009 #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
1010 #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
1011 #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
1012 #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
1013 #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
1014
1015 #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
1016 #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
1017 #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
1018 #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
1019 #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1020 #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1021 #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1022
1023 /* compatibility with older code */
1024 #define SPARC_ETH_GSET ETHTOOL_GSET
1025 #define SPARC_ETH_SSET ETHTOOL_SSET
1026
1027 /* Indicates what features are supported by the interface. */
1028 #define SUPPORTED_10baseT_Half (1 << 0)
1029 #define SUPPORTED_10baseT_Full (1 << 1)
1030 #define SUPPORTED_100baseT_Half (1 << 2)
1031 #define SUPPORTED_100baseT_Full (1 << 3)
1032 #define SUPPORTED_1000baseT_Half (1 << 4)
1033 #define SUPPORTED_1000baseT_Full (1 << 5)
1034 #define SUPPORTED_Autoneg (1 << 6)
1035 #define SUPPORTED_TP (1 << 7)
1036 #define SUPPORTED_AUI (1 << 8)
1037 #define SUPPORTED_MII (1 << 9)
1038 #define SUPPORTED_FIBRE (1 << 10)
1039 #define SUPPORTED_BNC (1 << 11)
1040 #define SUPPORTED_10000baseT_Full (1 << 12)
1041 #define SUPPORTED_Pause (1 << 13)
1042 #define SUPPORTED_Asym_Pause (1 << 14)
1043 #define SUPPORTED_2500baseX_Full (1 << 15)
1044 #define SUPPORTED_Backplane (1 << 16)
1045 #define SUPPORTED_1000baseKX_Full (1 << 17)
1046 #define SUPPORTED_10000baseKX4_Full (1 << 18)
1047 #define SUPPORTED_10000baseKR_Full (1 << 19)
1048 #define SUPPORTED_10000baseR_FEC (1 << 20)
1049 #define SUPPORTED_20000baseMLD2_Full (1 << 21)
1050 #define SUPPORTED_20000baseKR2_Full (1 << 22)
1051
1052 /* Indicates what features are advertised by the interface. */
1053 #define ADVERTISED_10baseT_Half (1 << 0)
1054 #define ADVERTISED_10baseT_Full (1 << 1)
1055 #define ADVERTISED_100baseT_Half (1 << 2)
1056 #define ADVERTISED_100baseT_Full (1 << 3)
1057 #define ADVERTISED_1000baseT_Half (1 << 4)
1058 #define ADVERTISED_1000baseT_Full (1 << 5)
1059 #define ADVERTISED_Autoneg (1 << 6)
1060 #define ADVERTISED_TP (1 << 7)
1061 #define ADVERTISED_AUI (1 << 8)
1062 #define ADVERTISED_MII (1 << 9)
1063 #define ADVERTISED_FIBRE (1 << 10)
1064 #define ADVERTISED_BNC (1 << 11)
1065 #define ADVERTISED_10000baseT_Full (1 << 12)
1066 #define ADVERTISED_Pause (1 << 13)
1067 #define ADVERTISED_Asym_Pause (1 << 14)
1068 #define ADVERTISED_2500baseX_Full (1 << 15)
1069 #define ADVERTISED_Backplane (1 << 16)
1070 #define ADVERTISED_1000baseKX_Full (1 << 17)
1071 #define ADVERTISED_10000baseKX4_Full (1 << 18)
1072 #define ADVERTISED_10000baseKR_Full (1 << 19)
1073 #define ADVERTISED_10000baseR_FEC (1 << 20)
1074 #define ADVERTISED_20000baseMLD2_Full (1 << 21)
1075 #define ADVERTISED_20000baseKR2_Full (1 << 22)
1076
1077 /* The following are all involved in forcing a particular link
1078 * mode for the device for setting things. When getting the
1079 * devices settings, these indicate the current mode and whether
1080 * it was forced up into this mode or autonegotiated.
1081 */
1082
1083 /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
1084 #define SPEED_10 10
1085 #define SPEED_100 100
1086 #define SPEED_1000 1000
1087 #define SPEED_2500 2500
1088 #define SPEED_10000 10000
1089
1090 /* Duplex, half or full. */
1091 #define DUPLEX_HALF 0x00
1092 #define DUPLEX_FULL 0x01
1093
1094 /* Which connector port. */
1095 #define PORT_TP 0x00
1096 #define PORT_AUI 0x01
1097 #define PORT_MII 0x02
1098 #define PORT_FIBRE 0x03
1099 #define PORT_BNC 0x04
1100 #define PORT_DA 0x05
1101 #define PORT_NONE 0xef
1102 #define PORT_OTHER 0xff
1103
1104 /* Which transceiver to use. */
1105 #define XCVR_INTERNAL 0x00
1106 #define XCVR_EXTERNAL 0x01
1107 #define XCVR_DUMMY1 0x02
1108 #define XCVR_DUMMY2 0x03
1109 #define XCVR_DUMMY3 0x04
1110
1111 /* Enable or disable autonegotiation. If this is set to enable,
1112 * the forced link modes above are completely ignored.
1113 */
1114 #define AUTONEG_DISABLE 0x00
1115 #define AUTONEG_ENABLE 0x01
1116
1117 /* Mode MDI or MDI-X */
1118 #define ETH_TP_MDI_INVALID 0x00
1119 #define ETH_TP_MDI 0x01
1120 #define ETH_TP_MDI_X 0x02
1121
1122 /* Wake-On-Lan options. */
1123 #define WAKE_PHY (1 << 0)
1124 #define WAKE_UCAST (1 << 1)
1125 #define WAKE_MCAST (1 << 2)
1126 #define WAKE_BCAST (1 << 3)
1127 #define WAKE_ARP (1 << 4)
1128 #define WAKE_MAGIC (1 << 5)
1129 #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
1130
1131 /* L2-L4 network traffic flow types */
1132 #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
1133 #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
1134 #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
1135 #define AH_ESP_V4_FLOW 0x04 /* hash only */
1136 #define TCP_V6_FLOW 0x05 /* hash only */
1137 #define UDP_V6_FLOW 0x06 /* hash only */
1138 #define SCTP_V6_FLOW 0x07 /* hash only */
1139 #define AH_ESP_V6_FLOW 0x08 /* hash only */
1140 #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
1141 #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
1142 #define AH_V6_FLOW 0x0b /* hash only */
1143 #define ESP_V6_FLOW 0x0c /* hash only */
1144 #define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
1145 #define IPV4_FLOW 0x10 /* hash only */
1146 #define IPV6_FLOW 0x11 /* hash only */
1147 #define ETHER_FLOW 0x12 /* spec only (ether_spec) */
1148 /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1149 #define FLOW_EXT 0x80000000
1150
1151 /* L3-L4 network traffic flow hash options */
1152 #define RXH_L2DA (1 << 1)
1153 #define RXH_VLAN (1 << 2)
1154 #define RXH_L3_PROTO (1 << 3)
1155 #define RXH_IP_SRC (1 << 4)
1156 #define RXH_IP_DST (1 << 5)
1157 #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
1158 #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
1159 #define RXH_DISCARD (1 << 31)
1160
1161 #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1162
1163 /* Reset flags */
1164 /* The reset() operation must clear the flags for the components which
1165 * were actually reset. On successful return, the flags indicate the
1166 * components which were not reset, either because they do not exist
1167 * in the hardware or because they cannot be reset independently. The
1168 * driver must never reset any components that were not requested.
1169 */
1170 enum ethtool_reset_flags {
1171 /* These flags represent components dedicated to the interface
1172 * the command is addressed to. Shift any flag left by
1173 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
1174 * same type.
1175 */
1176 ETH_RESET_MGMT = 1 << 0, /* Management processor */
1177 ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
1178 ETH_RESET_DMA = 1 << 2, /* DMA engine */
1179 ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
1180 ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
1181 ETH_RESET_MAC = 1 << 5, /* Media access controller */
1182 ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
1183 ETH_RESET_RAM = 1 << 7, /* RAM shared between
1184 * multiple components */
1185
1186 ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
1187 * this interface */
1188 ETH_RESET_ALL = 0xffffffff, /* All components used by this
1189 * interface, even if shared */
1190 };
1191 #define ETH_RESET_SHARED_SHIFT 16
1192
1193 #endif /* _LINUX_ETHTOOL_H */