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