118600Speter/*
229042Sjdp * @TAG(OTHER_GPL)
318600Speter */
418600Speter
518600Speter/*
618600Speter * ethtool.h: Defines for Linux ethtool.
718600Speter *
818600Speter * Copyright (C) 1998 David S. Miller (davem@redhat.com)
918600Speter * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
1018600Speter * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
1118600Speter * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
1218600Speter *                                christopher.leech@intel.com,
1318600Speter *                                scott.feldman@intel.com)
1418600Speter * Portions Copyright (C) Sun Microsystems 2008
1518600Speter */
1618600Speter
1718600Speter#ifndef _LINUX_ETHTOOL_H
1818600Speter#define _LINUX_ETHTOOL_H
1918600Speter
2018600Speter#include <stdint.h>
2118600Speter
2218600Speter/* This should work for both 32 and 64 bit userland. */
2318600Speterstruct ethtool_cmd {
2418600Speter	uint32_t	cmd;
2518600Speter	uint32_t	supported;	/* Features this interface supports */
2669827Scharnier	uint32_t	advertising;	/* Features this interface advertises */
2769827Scharnier	uint16_t	speed;		/* The forced speed, 10Mb, 100Mb, gigabit */
2869827Scharnier	uint8_t	duplex;		/* Duplex, half or full */
2969827Scharnier	uint8_t	port;		/* Which connector port */
3069827Scharnier	uint8_t	phy_address;
3118600Speter	uint8_t	transceiver;	/* Which transceiver to use */
3218600Speter	uint8_t	autoneg;	/* Enable or disable autonegotiation */
3369827Scharnier	uint8_t	mdio_support;
3418600Speter	uint32_t	maxtxpkt;	/* Tx pkts before generating tx int */
3518600Speter	uint32_t	maxrxpkt;	/* Rx pkts before generating rx int */
3618600Speter	uint16_t	speed_hi;
3718600Speter	uint8_t	eth_tp_mdix;
3818600Speter	uint8_t	reserved2;
3918600Speter	uint32_t	lp_advertising;	/* Features the link partner advertises */
4018600Speter	uint32_t	reserved[2];
4176224Sobrien};
4218600Speter
4339354Sdfrstatic inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
4439354Sdfr						uint32_t speed)
4518600Speter{
4618600Speter
4718600Speter	ep->speed = (uint16_t)speed;
4818600Speter	ep->speed_hi = (uint16_t)(speed >> 16);
4929042Sjdp}
5029042Sjdp
5118600Speterstatic inline uint32_t ethtool_cmd_speed(struct ethtool_cmd *ep)
5218600Speter{
5318600Speter	return (ep->speed_hi << 16) | ep->speed;
5418600Speter}
5518600Speter
5618600Speter#define ETHTOOL_FWVERS_LEN	32
5718600Speter#define ETHTOOL_BUSINFO_LEN	32
5818600Speter/* these strings are set to whatever the driver author decides... */
5918600Speterstruct ethtool_drvinfo {
6018600Speter	uint32_t	cmd;
6118600Speter	char	driver[32];	/* driver short name, "tulip", "eepro100" */
6218600Speter	char	version[32];	/* driver version string */
6318600Speter	char	fw_version[ETHTOOL_FWVERS_LEN];	/* firmware version string */
6418600Speter	char	bus_info[ETHTOOL_BUSINFO_LEN];	/* Bus info for this IF. */
6518600Speter				/* For PCI devices, use pci_name(pci_dev). */
6618600Speter	char	reserved1[32];
6718600Speter	char	reserved2[12];
6818600Speter				/*
6918600Speter				 * Some struct members below are filled in
7018600Speter				 * using ops->get_sset_count().  Obtaining
7118600Speter				 * this info from ethtool_drvinfo is now
7218600Speter				 * deprecated; Use ETHTOOL_GSSET_INFO
7318600Speter				 * instead.
7418600Speter				 */
7518600Speter	uint32_t	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */
7618600Speter	uint32_t	n_stats;	/* number of u64's from ETHTOOL_GSTATS */
7718600Speter	uint32_t	testinfo_len;
7818600Speter	uint32_t	eedump_len;	/* Size of data from ETHTOOL_GEEPROM (bytes) */
7918600Speter	uint32_t	regdump_len;	/* Size of data from ETHTOOL_GREGS (bytes) */
8018600Speter};
8118600Speter
8218600Speter#define SOPASS_MAX	6
8318600Speter/* wake-on-lan settings */
8418600Speterstruct ethtool_wolinfo {
8518600Speter	uint32_t	cmd;
8618600Speter	uint32_t	supported;
8718600Speter	uint32_t	wolopts;
8818600Speter	uint8_t	sopass[SOPASS_MAX]; /* SecureOn(tm) password */
8918600Speter};
9018600Speter
9118600Speter/* for passing single values */
9218600Speterstruct ethtool_value {
9318600Speter	uint32_t	cmd;
9418600Speter	uint32_t	data;
9518600Speter};
9618600Speter
9718600Speter/* for passing big chunks of data */
9818600Speterstruct ethtool_regs {
9918600Speter	uint32_t	cmd;
10018600Speter	uint32_t	version; /* driver-specific, indicates different chips/revs */
10118600Speter	uint32_t	len; /* bytes */
10218600Speter	uint8_t	data[0];
10318600Speter};
10418600Speter
10518600Speter/* for passing EEPROM chunks */
10618600Speterstruct ethtool_eeprom {
10718600Speter	uint32_t	cmd;
10818600Speter	uint32_t	magic;
10918600Speter	uint32_t	offset; /* in bytes */
11018600Speter	uint32_t	len; /* in bytes */
11118600Speter	uint8_t	data[0];
11218600Speter};
11318600Speter
11418600Speter/* for configuring coalescing parameters of chip */
11518600Speterstruct ethtool_coalesce {
11618600Speter	uint32_t	cmd;	/* ETHTOOL_{G,S}COALESCE */
11718600Speter
11818600Speter	/* How many usecs to delay an RX interrupt after
11918600Speter	 * a packet arrives.  If 0, only rx_max_coalesced_frames
12018600Speter	 * is used.
12118600Speter	 */
12218600Speter	uint32_t	rx_coalesce_usecs;
12318600Speter
12418600Speter	/* How many packets to delay an RX interrupt after
12518600Speter	 * a packet arrives.  If 0, only rx_coalesce_usecs is
12618600Speter	 * used.  It is illegal to set both usecs and max frames
12718600Speter	 * to zero as this would cause RX interrupts to never be
12818600Speter	 * generated.
12918600Speter	 */
13018600Speter	uint32_t	rx_max_coalesced_frames;
13118600Speter
13269827Scharnier	/* Same as above two parameters, except that these values
13318600Speter	 * apply while an IRQ is being serviced by the host.  Not
13418600Speter	 * all cards support this feature and the values are ignored
13518600Speter	 * in that case.
13618600Speter	 */
13729042Sjdp	uint32_t	rx_coalesce_usecs_irq;
13818600Speter	uint32_t	rx_max_coalesced_frames_irq;
13918600Speter
14018600Speter	/* How many usecs to delay a TX interrupt after
14118600Speter	 * a packet is sent.  If 0, only tx_max_coalesced_frames
14218600Speter	 * is used.
14318600Speter	 */
14418600Speter	uint32_t	tx_coalesce_usecs;
14518600Speter
14618600Speter	/* How many packets to delay a TX interrupt after
14718600Speter	 * a packet is sent.  If 0, only tx_coalesce_usecs is
14818600Speter	 * used.  It is illegal to set both usecs and max frames
14918600Speter	 * to zero as this would cause TX interrupts to never be
15018600Speter	 * generated.
15118600Speter	 */
15218600Speter	uint32_t	tx_max_coalesced_frames;
15318600Speter
15429042Sjdp	/* Same as above two parameters, except that these values
15569827Scharnier	 * apply while an IRQ is being serviced by the host.  Not
15669827Scharnier	 * all cards support this feature and the values are ignored
15718600Speter	 * in that case.
15818600Speter	 */
15918600Speter	uint32_t	tx_coalesce_usecs_irq;
16029042Sjdp	uint32_t	tx_max_coalesced_frames_irq;
16169827Scharnier
16269827Scharnier	/* How many usecs to delay in-memory statistics
16318600Speter	 * block updates.  Some drivers do not have an in-memory
16418600Speter	 * statistic block, and in such cases this value is ignored.
16518600Speter	 * This value must not be zero.
16629042Sjdp	 */
16769827Scharnier	uint32_t	stats_block_coalesce_usecs;
16869827Scharnier
16918600Speter	/* Adaptive RX/TX coalescing is an algorithm implemented by
17018600Speter	 * some drivers to improve latency under low packet rates and
17118600Speter	 * improve throughput under high packet rates.  Some drivers
17218600Speter	 * only implement one of RX or TX adaptive coalescing.  Anything
17329042Sjdp	 * not implemented by the driver causes these values to be
17469827Scharnier	 * silently ignored.
17569827Scharnier	 */
17618600Speter	uint32_t	use_adaptive_rx_coalesce;
17718600Speter	uint32_t	use_adaptive_tx_coalesce;
17818600Speter
17918600Speter	/* When the packet rate (measured in packets per second)
18018600Speter	 * is below pkt_rate_low, the {rx,tx}_*_low parameters are
18118600Speter	 * used.
18218600Speter	 */
18318600Speter	uint32_t	pkt_rate_low;
18435575Sdfr	uint32_t	rx_coalesce_usecs_low;
18569827Scharnier	uint32_t	rx_max_coalesced_frames_low;
18669827Scharnier	uint32_t	tx_coalesce_usecs_low;
18735575Sdfr	uint32_t	tx_max_coalesced_frames_low;
18835575Sdfr
18935575Sdfr	/* When the packet rate is below pkt_rate_high but above
19035575Sdfr	 * pkt_rate_low (both measured in packets per second) the
19135575Sdfr	 * normal {rx,tx}_* coalescing parameters are used.
19218600Speter	 */
19318600Speter
19418600Speter	/* When the packet rate is (measured in packets per second)
19529042Sjdp	 * is above pkt_rate_high, the {rx,tx}_*_high parameters are
19618600Speter	 * used.
19785647Sdillon	 */
19818600Speter	uint32_t	pkt_rate_high;
19929042Sjdp	uint32_t	rx_coalesce_usecs_high;
20069827Scharnier	uint32_t	rx_max_coalesced_frames_high;
20169827Scharnier	uint32_t	tx_coalesce_usecs_high;
20218600Speter	uint32_t	tx_max_coalesced_frames_high;
20318600Speter
20418600Speter	/* How often to do adaptive coalescing packet rate sampling,
20518600Speter	 * measured in seconds.  Must not be zero.
20618600Speter	 */
20718600Speter	uint32_t	rate_sample_interval;
20818600Speter};
20918600Speter
21018600Speter/* for configuring RX/TX ring parameters */
21118600Speterstruct ethtool_ringparam {
21218600Speter	uint32_t	cmd;	/* ETHTOOL_{G,S}RINGPARAM */
21318600Speter
21418600Speter	/* Read only attributes.  These indicate the maximum number
21518600Speter	 * of pending RX/TX ring entries the driver will allow the
21618600Speter	 * user to set.
21718600Speter	 */
21818600Speter	uint32_t	rx_max_pending;
21918600Speter	uint32_t	rx_mini_max_pending;
22018600Speter	uint32_t	rx_jumbo_max_pending;
22118600Speter	uint32_t	tx_max_pending;
22218600Speter
22318600Speter	/* Values changeable by the user.  The valid values are
22418600Speter	 * in the range 1 to the "*_max_pending" counterpart above.
22529042Sjdp	 */
22618600Speter	uint32_t	rx_pending;
22718600Speter	uint32_t	rx_mini_pending;
22818600Speter	uint32_t	rx_jumbo_pending;
22918600Speter	uint32_t	tx_pending;
23029042Sjdp};
23135575Sdfr
23218600Speter/* for configuring link flow control parameters */
23318600Speterstruct ethtool_pauseparam {
23418600Speter	uint32_t	cmd;	/* ETHTOOL_{G,S}PAUSEPARAM */
23518600Speter
23618600Speter	/* If the link is being auto-negotiated (via ethtool_cmd.autoneg
23718600Speter	 * being true) the user may set 'autonet' here non-zero to have the
23818600Speter	 * pause parameters be auto-negotiated too.  In such a case, the
23918600Speter	 * {rx,tx}_pause values below determine what capabilities are
24018600Speter	 * advertised.
24118600Speter	 *
24218600Speter	 * If 'autoneg' is zero or the link is not being auto-negotiated,
24318600Speter	 * then {rx,tx}_pause force the driver to use/not-use pause
24418600Speter	 * flow control.
24518600Speter	 */
24618600Speter	uint32_t	autoneg;
24718600Speter	uint32_t	rx_pause;
24818600Speter	uint32_t	tx_pause;
24918600Speter};
25018600Speter
25118600Speter#define ETH_GSTRING_LEN		32
25218600Speterenum ethtool_stringset {
25318600Speter	ETH_SS_TEST		= 0,
25418600Speter	ETH_SS_STATS,
25518600Speter	ETH_SS_PRIV_FLAGS,
25618600Speter	ETH_SS_NTUPLE_FILTERS,
25718600Speter	ETH_SS_FEATURES,
25818600Speter};
25918600Speter
26018600Speter/* for passing string sets for data tagging */
26118600Speterstruct ethtool_gstrings {
26229042Sjdp	uint32_t	cmd;		/* ETHTOOL_GSTRINGS */
26318600Speter	uint32_t	string_set;	/* string set id e.c. ETH_SS_TEST, etc*/
26418600Speter	uint32_t	len;		/* number of strings in the string set */
26518600Speter	uint8_t	data[0];
26618600Speter};
26718600Speter
26829042Sjdpstruct ethtool_sset_info {
26929042Sjdp	uint32_t	cmd;		/* ETHTOOL_GSSET_INFO */
27029042Sjdp	uint32_t	reserved;
27118600Speter	uint64_t	sset_mask;	/* input: each bit selects an sset to query */
27229042Sjdp				/* output: each bit a returned sset */
27329042Sjdp	uint32_t	data[0];	/* ETH_SS_xxx count, in order, based on bits
27429042Sjdp				   in sset_mask.  One bit implies one
27529042Sjdp				   uint32_t, two bits implies two
27618600Speter				   uint32_t's, etc. */
27729042Sjdp};
27818600Speter
27929042Sjdpenum ethtool_test_flags {
28029042Sjdp	ETH_TEST_FL_OFFLINE	= (1 << 0),	/* online / offline */
28118600Speter	ETH_TEST_FL_FAILED	= (1 << 1),	/* test passed / failed */
28218600Speter};
28318600Speter
28418600Speter/* for requesting NIC test and getting results*/
28518600Speterstruct ethtool_test {
28618600Speter	uint32_t	cmd;		/* ETHTOOL_TEST */
28718600Speter	uint32_t	flags;		/* ETH_TEST_FL_xxx */
28818600Speter	uint32_t	reserved;
28918600Speter	uint32_t	len;		/* result length, in number of u64 elements */
29018600Speter	uint64_t	data[0];
29118600Speter};
29218600Speter
29318600Speter/* for dumping NIC-specific statistics */
29418600Speterstruct ethtool_stats {
29518600Speter	uint32_t	cmd;		/* ETHTOOL_GSTATS */
29629042Sjdp	uint32_t	n_stats;	/* number of u64's being returned */
29718600Speter	uint64_t	data[0];
29818600Speter};
29918600Speter
30018600Speterstruct ethtool_perm_addr {
30118600Speter	uint32_t	cmd;		/* ETHTOOL_GPERMADDR */
30218600Speter	uint32_t	size;
30318600Speter	uint8_t	data[0];
30418600Speter};
30518600Speter
30618600Speter/* boolean flags controlling per-interface behavior characteristics.
30718600Speter * When reading, the flag indicates whether or not a certain behavior
30818600Speter * is enabled/present.  When writing, the flag indicates whether
30918600Speter * or not the driver should turn on (set) or off (clear) a behavior.
31018600Speter *
31118600Speter * Some behaviors may read-only (unconditionally absent or present).
31218600Speter * If such is the case, return EINVAL in the set-flags operation if the
31318600Speter * flag differs from the read-only value.
31429042Sjdp */
31518600Speterenum ethtool_flags {
31618600Speter	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */
31718600Speter	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */
31829042Sjdp	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
31918600Speter	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
32018600Speter	ETH_FLAG_RXHASH		= (1 << 28),
32118600Speter};
32218600Speter
32318600Speter/* The following structures are for supporting RX network flow
32418600Speter * classification and RX n-tuple configuration. Note, all multibyte
32518600Speter * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
32618600Speter * be in network byte order.
32718600Speter */
32818600Speter
32918600Speter/**
33018600Speter * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
33118600Speter * @ip4src: Source host
33218600Speter * @ip4dst: Destination host
33329042Sjdp * @psrc: Source port
33418600Speter * @pdst: Destination port
33529042Sjdp * @tos: Type-of-service
33629042Sjdp *
33718600Speter * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
33829042Sjdp */
33929042Sjdpstruct ethtool_tcpip4_spec {
34029042Sjdp	uint32_t	ip4src;
34129042Sjdp	uint32_t	ip4dst;
34229042Sjdp	uint16_t	psrc;
34329042Sjdp	uint16_t	pdst;
34429042Sjdp	uint8_t    tos;
34529042Sjdp};
34629042Sjdp
34729042Sjdp/**
34829042Sjdp * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
34929042Sjdp * @ip4src: Source host
35029042Sjdp * @ip4dst: Destination host
35129042Sjdp * @spi: Security parameters index
35229042Sjdp * @tos: Type-of-service
35329042Sjdp *
35429042Sjdp * This can be used to specify an IPsec transport or tunnel over IPv4.
35529042Sjdp */
35629042Sjdpstruct ethtool_ah_espip4_spec {
35729042Sjdp	uint32_t	ip4src;
35829042Sjdp	uint32_t	ip4dst;
35929042Sjdp	uint32_t	spi;
36029042Sjdp	uint8_t    tos;
36129042Sjdp};
36229042Sjdp
36329042Sjdp#define	ETH_RX_NFC_IP4	1
36429042Sjdp
36529042Sjdp/**
36629042Sjdp * struct ethtool_usrip4_spec - general flow specification for IPv4
36718600Speter * @ip4src: Source host
36818600Speter * @ip4dst: Destination host
36918600Speter * @l4_4_bytes: First 4 bytes of transport (layer 4) header
37018600Speter * @tos: Type-of-service
37118600Speter * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
37218600Speter * @proto: Transport protocol number; mask must be 0
37318600Speter */
37429042Sjdpstruct ethtool_usrip4_spec {
37518600Speter	uint32_t	ip4src;
37618600Speter	uint32_t	ip4dst;
37718600Speter	uint32_t	l4_4_bytes;
37818600Speter	uint8_t    tos;
37918600Speter	uint8_t    ip_ver;
38018600Speter	uint8_t    proto;
38118600Speter};
38218600Speter
38318600Speter
38418600Speter/**
38518600Speter * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
38618600Speter * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
38718600Speter * @size: On entry, the array size of the user buffer.  On return from
38818600Speter *	%ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table.
38929042Sjdp * @ring_index: RX ring/queue index for each hash value
39018600Speter */
39118600Speterstruct ethtool_rxfh_indir {
39218600Speter	uint32_t	cmd;
39318600Speter	uint32_t	size;
39418600Speter	uint32_t	ring_index[0];
39518600Speter};
39618600Speter
39718600Speter#define ETHTOOL_FLASH_MAX_FILENAME	128
39818600Speterenum ethtool_flash_op_type {
39918600Speter	ETHTOOL_FLASH_ALL_REGIONS	= 0,
40029042Sjdp};
40118600Speter
40218600Speter/* for passing firmware flashing related parameters */
40318600Speterstruct ethtool_flash {
40418600Speter	uint32_t	cmd;
40518600Speter	uint32_t	region;
40618600Speter	char	data[ETHTOOL_FLASH_MAX_FILENAME];
40718600Speter};
40829042Sjdp
40918600Speter/* for returning and changing feature sets */
41018600Speter
41118600Speter/**
41218600Speter * struct ethtool_get_features_block - block with state of 32 features
41318600Speter * @available: mask of changeable features
41418600Speter * @requested: mask of features requested to be enabled if possible
41518600Speter * @active: mask of currently enabled features
41618600Speter * @never_changed: mask of features not changeable for any device
41718600Speter */
41818600Speterstruct ethtool_get_features_block {
41918600Speter	uint32_t	available;
42018600Speter	uint32_t	requested;
42118600Speter	uint32_t	active;
42218600Speter	uint32_t	never_changed;
42318600Speter};
42418600Speter
42529042Sjdp/**
42618600Speter * struct ethtool_gfeatures - command to get state of device's features
42718600Speter * @cmd: command number = %ETHTOOL_GFEATURES
42818600Speter * @size: in: number of elements in the features[] array;
42918600Speter *       out: number of elements in features[] needed to hold all features
43029042Sjdp * @features: state of features
43118600Speter */
43218600Speterstruct ethtool_gfeatures {
43318600Speter	uint32_t	cmd;
43421469Sjdp	uint32_t	size;
43521469Sjdp	struct ethtool_get_features_block features[0];
43621469Sjdp};
43721469Sjdp
43821469Sjdp/**
43918600Speter * struct ethtool_set_features_block - block with request for 32 features
44018600Speter * @valid: mask of features to be changed
44118600Speter * @requested: values of features to be changed
44218600Speter */
44318600Speterstruct ethtool_set_features_block {
44418600Speter	uint32_t	valid;
44518600Speter	uint32_t	requested;
44618600Speter};
44729042Sjdp
44818600Speter/**
44918600Speter * struct ethtool_sfeatures - command to request change in device's features
45018600Speter * @cmd: command number = %ETHTOOL_SFEATURES
45118600Speter * @size: array size of the features[] array
45218600Speter * @features: feature change masks
45318600Speter */
45418600Speterstruct ethtool_sfeatures {
45531442Sjdp	uint32_t	cmd;
45629042Sjdp	uint32_t	size;
45718600Speter	struct ethtool_set_features_block features[0];
45818600Speter};
45929042Sjdp
46018600Speter/*
46118600Speter * %ETHTOOL_SFEATURES changes features present in features[].valid to the
46218600Speter * values of corresponding bits in features[].requested. Bits in .requested
46318600Speter * not set in .valid or not changeable are ignored.
46418600Speter *
46518600Speter * Returns %EINVAL when .valid contains undefined or never-changable bits
46618600Speter * or size is not equal to required number of features words (32-bit blocks).
46718600Speter * Returns >= 0 if request was completed; bits set in the value mean:
46818600Speter *   %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
46918600Speter *	changeable (not present in %ETHTOOL_GFEATURES' features[].available)
47018600Speter *	those bits were ignored.
47118600Speter *   %ETHTOOL_F_WISH - some or all changes requested were recorded but the
47218600Speter *      resulting state of bits masked by .valid is not equal to .requested.
47318600Speter *      Probably there are other device-specific constraints on some features
47418600Speter *      in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
47518600Speter *      here as though ignored bits were cleared.
47618600Speter *   %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
47718600Speter *      compatibility functions. Requested offload state cannot be properly
47818600Speter *      managed by kernel.
47918600Speter *
48018600Speter * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
48118600Speter * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
48218600Speter * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
48318600Speter * significant bit in features[0] fields. Empty strings mark undefined features.
48418600Speter */
48518600Speterenum ethtool_sfeatures_retval_bits {
48618600Speter	ETHTOOL_F_UNSUPPORTED__BIT,
48718600Speter	ETHTOOL_F_WISH__BIT,
48818600Speter	ETHTOOL_F_COMPAT__BIT,
48918600Speter};
49018600Speter
49118600Speter#define ETHTOOL_F_UNSUPPORTED   (1 << ETHTOOL_F_UNSUPPORTED__BIT)
49218600Speter#define ETHTOOL_F_WISH          (1 << ETHTOOL_F_WISH__BIT)
49318600Speter#define ETHTOOL_F_COMPAT        (1 << ETHTOOL_F_COMPAT__BIT)
49418600Speter
49518600Speter/* CMDs currently supported */
49618600Speter#define ETHTOOL_GSET		0x00000001 /* Get settings. */
49718600Speter#define ETHTOOL_SSET		0x00000002 /* Set settings. */
49818600Speter#define ETHTOOL_GDRVINFO	0x00000003 /* Get driver info. */
49918600Speter#define ETHTOOL_GREGS		0x00000004 /* Get NIC registers. */
50031442Sjdp#define ETHTOOL_GWOL		0x00000005 /* Get wake-on-lan options. */
50131442Sjdp#define ETHTOOL_SWOL		0x00000006 /* Set wake-on-lan options. */
50231442Sjdp#define ETHTOOL_GMSGLVL		0x00000007 /* Get driver message level */
50318600Speter#define ETHTOOL_SMSGLVL		0x00000008 /* Set driver msg level. */
50418600Speter#define ETHTOOL_NWAY_RST	0x00000009 /* Restart autonegotiation. */
50529042Sjdp/* Get link status for host, i.e. whether the interface *and* the
50629042Sjdp * physical port (if there is one) are up (ethtool_value). */
50718600Speter#define ETHTOOL_GLINK		0x0000000a
50818600Speter#define ETHTOOL_GEEPROM		0x0000000b /* Get EEPROM data */
50931442Sjdp#define ETHTOOL_SEEPROM		0x0000000c /* Set EEPROM data. */
51031442Sjdp#define ETHTOOL_GCOALESCE	0x0000000e /* Get coalesce config */
51131442Sjdp#define ETHTOOL_SCOALESCE	0x0000000f /* Set coalesce config. */
51231442Sjdp#define ETHTOOL_GRINGPARAM	0x00000010 /* Get ring parameters */
51331442Sjdp#define ETHTOOL_SRINGPARAM	0x00000011 /* Set ring parameters. */
51431442Sjdp#define ETHTOOL_GPAUSEPARAM	0x00000012 /* Get pause parameters */
51531442Sjdp#define ETHTOOL_SPAUSEPARAM	0x00000013 /* Set pause parameters. */
51629042Sjdp#define ETHTOOL_GRXCSUM		0x00000014 /* Get RX hw csum enable (ethtool_value) */
51729042Sjdp#define ETHTOOL_SRXCSUM		0x00000015 /* Set RX hw csum enable (ethtool_value) */
51831442Sjdp#define ETHTOOL_GTXCSUM		0x00000016 /* Get TX hw csum enable (ethtool_value) */
51918600Speter#define ETHTOOL_STXCSUM		0x00000017 /* Set TX hw csum enable (ethtool_value) */
52018600Speter#define ETHTOOL_GSG		0x00000018 /* Get scatter-gather enable
52118600Speter					    * (ethtool_value) */
52218600Speter#define ETHTOOL_SSG		0x00000019 /* Set scatter-gather enable
52318600Speter					    * (ethtool_value). */
52418600Speter#define ETHTOOL_TEST		0x0000001a /* execute NIC self-test. */
52518600Speter#define ETHTOOL_GSTRINGS	0x0000001b /* get specified string set */
52618600Speter#define ETHTOOL_PHYS_ID		0x0000001c /* identify the NIC */
52729042Sjdp#define ETHTOOL_GSTATS		0x0000001d /* get NIC-specific statistics */
52818600Speter#define ETHTOOL_GTSO		0x0000001e /* Get TSO enable (ethtool_value) */
52918600Speter#define ETHTOOL_STSO		0x0000001f /* Set TSO enable (ethtool_value) */
53018600Speter#define ETHTOOL_GPERMADDR	0x00000020 /* Get permanent hardware address */
53118600Speter#define ETHTOOL_GUFO		0x00000021 /* Get UFO enable (ethtool_value) */
53218600Speter#define ETHTOOL_SUFO		0x00000022 /* Set UFO enable (ethtool_value) */
53318600Speter#define ETHTOOL_GGSO		0x00000023 /* Get GSO enable (ethtool_value) */
53418600Speter#define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */
53518600Speter#define ETHTOOL_GFLAGS		0x00000025 /* Get flags bitmap(ethtool_value) */
53618600Speter#define ETHTOOL_SFLAGS		0x00000026 /* Set flags bitmap(ethtool_value) */
53718600Speter#define ETHTOOL_GPFLAGS		0x00000027 /* Get driver-private flags bitmap */
53829042Sjdp#define ETHTOOL_SPFLAGS		0x00000028 /* Set driver-private flags bitmap */
53918600Speter
54018600Speter#define ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */
54118600Speter#define ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */
54218600Speter#define ETHTOOL_GGRO		0x0000002b /* Get GRO enable (ethtool_value) */
54318600Speter#define ETHTOOL_SGRO		0x0000002c /* Set GRO enable (ethtool_value) */
54418600Speter#define ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */
54518600Speter#define ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */
54618600Speter#define ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */
54729042Sjdp#define ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */
54818600Speter#define ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */
54918600Speter#define ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
55018600Speter#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