1
2
3
4
5
6
7
8
9
10
11
12#ifndef _LINUX_ETHTOOL_H
13#define _LINUX_ETHTOOL_H
14
15#include <linux/types.h>
16
17
18struct ethtool_cmd {
19 __u32 cmd;
20 __u32 supported;
21 __u32 advertising;
22 __u16 speed;
23 __u8 duplex;
24 __u8 port;
25 __u8 phy_address;
26 __u8 transceiver;
27 __u8 autoneg;
28 __u32 maxtxpkt;
29 __u32 maxrxpkt;
30 __u32 reserved[4];
31};
32
33#define ETHTOOL_BUSINFO_LEN 32
34
35struct ethtool_drvinfo {
36 __u32 cmd;
37 char driver[32];
38 char version[32];
39 char fw_version[32];
40 char bus_info[ETHTOOL_BUSINFO_LEN];
41
42 char reserved1[32];
43 char reserved2[12];
44 __u32 n_priv_flags;
45 __u32 n_stats;
46 __u32 testinfo_len;
47 __u32 eedump_len;
48 __u32 regdump_len;
49};
50
51#define SOPASS_MAX 6
52
53struct ethtool_wolinfo {
54 __u32 cmd;
55 __u32 supported;
56 __u32 wolopts;
57 __u8 sopass[SOPASS_MAX];
58};
59
60
61struct ethtool_value {
62 __u32 cmd;
63 __u32 data;
64};
65
66
67struct ethtool_regs {
68 __u32 cmd;
69 __u32 version;
70 __u32 len;
71 __u8 data[0];
72};
73
74
75struct ethtool_eeprom {
76 __u32 cmd;
77 __u32 magic;
78 __u32 offset;
79 __u32 len;
80 __u8 data[0];
81};
82
83
84struct ethtool_coalesce {
85 __u32 cmd;
86
87
88
89
90
91 __u32 rx_coalesce_usecs;
92
93
94
95
96
97
98
99 __u32 rx_max_coalesced_frames;
100
101
102
103
104
105
106 __u32 rx_coalesce_usecs_irq;
107 __u32 rx_max_coalesced_frames_irq;
108
109
110
111
112
113 __u32 tx_coalesce_usecs;
114
115
116
117
118
119
120
121 __u32 tx_max_coalesced_frames;
122
123
124
125
126
127
128 __u32 tx_coalesce_usecs_irq;
129 __u32 tx_max_coalesced_frames_irq;
130
131
132
133
134
135
136 __u32 stats_block_coalesce_usecs;
137
138
139
140
141
142
143
144
145 __u32 use_adaptive_rx_coalesce;
146 __u32 use_adaptive_tx_coalesce;
147
148
149
150
151
152 __u32 pkt_rate_low;
153 __u32 rx_coalesce_usecs_low;
154 __u32 rx_max_coalesced_frames_low;
155 __u32 tx_coalesce_usecs_low;
156 __u32 tx_max_coalesced_frames_low;
157
158
159
160
161
162
163
164
165
166
167 __u32 pkt_rate_high;
168 __u32 rx_coalesce_usecs_high;
169 __u32 rx_max_coalesced_frames_high;
170 __u32 tx_coalesce_usecs_high;
171 __u32 tx_max_coalesced_frames_high;
172
173
174
175
176 __u32 rate_sample_interval;
177};
178
179
180struct ethtool_ringparam {
181 __u32 cmd;
182
183
184
185
186
187 __u32 rx_max_pending;
188 __u32 rx_mini_max_pending;
189 __u32 rx_jumbo_max_pending;
190 __u32 tx_max_pending;
191
192
193
194
195 __u32 rx_pending;
196 __u32 rx_mini_pending;
197 __u32 rx_jumbo_pending;
198 __u32 tx_pending;
199};
200
201
202struct ethtool_pauseparam {
203 __u32 cmd;
204
205
206
207
208
209
210
211
212
213
214
215 __u32 autoneg;
216 __u32 rx_pause;
217 __u32 tx_pause;
218};
219
220#define ETH_GSTRING_LEN 32
221enum ethtool_stringset {
222 ETH_SS_TEST = 0,
223 ETH_SS_STATS,
224 ETH_SS_PRIV_FLAGS,
225};
226
227
228struct ethtool_gstrings {
229 __u32 cmd;
230 __u32 string_set;
231 __u32 len;
232 __u8 data[0];
233};
234
235enum ethtool_test_flags {
236 ETH_TEST_FL_OFFLINE = (1 << 0),
237 ETH_TEST_FL_FAILED = (1 << 1),
238};
239
240
241struct ethtool_test {
242 __u32 cmd;
243 __u32 flags;
244 __u32 reserved;
245 __u32 len;
246 __u64 data[0];
247};
248
249
250struct ethtool_stats {
251 __u32 cmd;
252 __u32 n_stats;
253 __u64 data[0];
254};
255
256struct ethtool_perm_addr {
257 __u32 cmd;
258 __u32 size;
259 __u8 data[0];
260};
261
262
263
264
265
266
267
268
269
270
271enum ethtool_flags {
272 ETH_FLAG_LRO = (1 << 15),
273};
274
275#ifdef __KERNEL__
276
277struct net_device;
278
279
280u32 ethtool_op_get_link(struct net_device *dev);
281u32 ethtool_op_get_tx_csum(struct net_device *dev);
282int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
283int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
284int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data);
285u32 ethtool_op_get_sg(struct net_device *dev);
286int ethtool_op_set_sg(struct net_device *dev, u32 data);
287u32 ethtool_op_get_tso(struct net_device *dev);
288int ethtool_op_set_tso(struct net_device *dev, u32 data);
289u32 ethtool_op_get_ufo(struct net_device *dev);
290int ethtool_op_set_ufo(struct net_device *dev, u32 data);
291u32 ethtool_op_get_flags(struct net_device *dev);
292int ethtool_op_set_flags(struct net_device *dev, u32 data);
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353struct ethtool_ops {
354 int (*get_settings)(struct net_device *, struct ethtool_cmd *);
355 int (*set_settings)(struct net_device *, struct ethtool_cmd *);
356 void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
357 int (*get_regs_len)(struct net_device *);
358 void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
359 void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
360 int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
361 u32 (*get_msglevel)(struct net_device *);
362 void (*set_msglevel)(struct net_device *, u32);
363 int (*nway_reset)(struct net_device *);
364 u32 (*get_link)(struct net_device *);
365 int (*get_eeprom_len)(struct net_device *);
366 int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
367 int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
368 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
369 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
370 void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
371 int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
372 void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
373 int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
374 u32 (*get_rx_csum)(struct net_device *);
375 int (*set_rx_csum)(struct net_device *, u32);
376 u32 (*get_tx_csum)(struct net_device *);
377 int (*set_tx_csum)(struct net_device *, u32);
378 u32 (*get_sg)(struct net_device *);
379 int (*set_sg)(struct net_device *, u32);
380 u32 (*get_tso)(struct net_device *);
381 int (*set_tso)(struct net_device *, u32);
382 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
383 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
384 int (*phys_id)(struct net_device *, u32);
385 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
386 int (*begin)(struct net_device *);
387 void (*complete)(struct net_device *);
388 u32 (*get_ufo)(struct net_device *);
389 int (*set_ufo)(struct net_device *, u32);
390 u32 (*get_flags)(struct net_device *);
391 int (*set_flags)(struct net_device *, u32);
392 u32 (*get_priv_flags)(struct net_device *);
393 int (*set_priv_flags)(struct net_device *, u32);
394 int (*get_sset_count)(struct net_device *, int);
395
396
397 int (*self_test_count)(struct net_device *);
398 int (*get_stats_count)(struct net_device *);
399};
400#endif
401
402
403#define ETHTOOL_GSET 0x00000001
404#define ETHTOOL_SSET 0x00000002
405#define ETHTOOL_GDRVINFO 0x00000003
406#define ETHTOOL_GREGS 0x00000004
407#define ETHTOOL_GWOL 0x00000005
408#define ETHTOOL_SWOL 0x00000006
409#define ETHTOOL_GMSGLVL 0x00000007
410#define ETHTOOL_SMSGLVL 0x00000008
411#define ETHTOOL_NWAY_RST 0x00000009
412#define ETHTOOL_GLINK 0x0000000a
413#define ETHTOOL_GEEPROM 0x0000000b
414#define ETHTOOL_SEEPROM 0x0000000c
415#define ETHTOOL_GCOALESCE 0x0000000e
416#define ETHTOOL_SCOALESCE 0x0000000f
417#define ETHTOOL_GRINGPARAM 0x00000010
418#define ETHTOOL_SRINGPARAM 0x00000011
419#define ETHTOOL_GPAUSEPARAM 0x00000012
420#define ETHTOOL_SPAUSEPARAM 0x00000013
421#define ETHTOOL_GRXCSUM 0x00000014
422#define ETHTOOL_SRXCSUM 0x00000015
423#define ETHTOOL_GTXCSUM 0x00000016
424#define ETHTOOL_STXCSUM 0x00000017
425#define ETHTOOL_GSG 0x00000018
426
427#define ETHTOOL_SSG 0x00000019
428
429#define ETHTOOL_TEST 0x0000001a
430#define ETHTOOL_GSTRINGS 0x0000001b
431#define ETHTOOL_PHYS_ID 0x0000001c
432#define ETHTOOL_GSTATS 0x0000001d
433#define ETHTOOL_GTSO 0x0000001e
434#define ETHTOOL_STSO 0x0000001f
435#define ETHTOOL_GPERMADDR 0x00000020
436#define ETHTOOL_GUFO 0x00000021
437#define ETHTOOL_SUFO 0x00000022
438#define ETHTOOL_GGSO 0x00000023
439#define ETHTOOL_SGSO 0x00000024
440#define ETHTOOL_GFLAGS 0x00000025
441#define ETHTOOL_SFLAGS 0x00000026
442#define ETHTOOL_GPFLAGS 0x00000027
443#define ETHTOOL_SPFLAGS 0x00000028
444
445
446#define SPARC_ETH_GSET ETHTOOL_GSET
447#define SPARC_ETH_SSET ETHTOOL_SSET
448
449
450#define SUPPORTED_10baseT_Half (1 << 0)
451#define SUPPORTED_10baseT_Full (1 << 1)
452#define SUPPORTED_100baseT_Half (1 << 2)
453#define SUPPORTED_100baseT_Full (1 << 3)
454#define SUPPORTED_1000baseT_Half (1 << 4)
455#define SUPPORTED_1000baseT_Full (1 << 5)
456#define SUPPORTED_Autoneg (1 << 6)
457#define SUPPORTED_TP (1 << 7)
458#define SUPPORTED_AUI (1 << 8)
459#define SUPPORTED_MII (1 << 9)
460#define SUPPORTED_FIBRE (1 << 10)
461#define SUPPORTED_BNC (1 << 11)
462#define SUPPORTED_10000baseT_Full (1 << 12)
463#define SUPPORTED_Pause (1 << 13)
464#define SUPPORTED_Asym_Pause (1 << 14)
465#define SUPPORTED_2500baseX_Full (1 << 15)
466
467
468#define ADVERTISED_10baseT_Half (1 << 0)
469#define ADVERTISED_10baseT_Full (1 << 1)
470#define ADVERTISED_100baseT_Half (1 << 2)
471#define ADVERTISED_100baseT_Full (1 << 3)
472#define ADVERTISED_1000baseT_Half (1 << 4)
473#define ADVERTISED_1000baseT_Full (1 << 5)
474#define ADVERTISED_Autoneg (1 << 6)
475#define ADVERTISED_TP (1 << 7)
476#define ADVERTISED_AUI (1 << 8)
477#define ADVERTISED_MII (1 << 9)
478#define ADVERTISED_FIBRE (1 << 10)
479#define ADVERTISED_BNC (1 << 11)
480#define ADVERTISED_10000baseT_Full (1 << 12)
481#define ADVERTISED_Pause (1 << 13)
482#define ADVERTISED_Asym_Pause (1 << 14)
483#define ADVERTISED_2500baseX_Full (1 << 15)
484
485
486
487
488
489
490
491
492#define SPEED_10 10
493#define SPEED_100 100
494#define SPEED_1000 1000
495#define SPEED_2500 2500
496#define SPEED_10000 10000
497
498
499#define DUPLEX_HALF 0x00
500#define DUPLEX_FULL 0x01
501
502
503#define PORT_TP 0x00
504#define PORT_AUI 0x01
505#define PORT_MII 0x02
506#define PORT_FIBRE 0x03
507#define PORT_BNC 0x04
508
509
510#define XCVR_INTERNAL 0x00
511#define XCVR_EXTERNAL 0x01
512#define XCVR_DUMMY1 0x02
513#define XCVR_DUMMY2 0x03
514#define XCVR_DUMMY3 0x04
515
516
517
518
519#define AUTONEG_DISABLE 0x00
520#define AUTONEG_ENABLE 0x01
521
522
523#define WAKE_PHY (1 << 0)
524#define WAKE_UCAST (1 << 1)
525#define WAKE_MCAST (1 << 2)
526#define WAKE_BCAST (1 << 3)
527#define WAKE_ARP (1 << 4)
528#define WAKE_MAGIC (1 << 5)
529#define WAKE_MAGICSECURE (1 << 6)
530
531#endif
532