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