source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/ethtool.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 16.5 KB
Line 
1/*
2 * ethtool.h: Defines for Linux ethtool.
3 *
4 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
5 * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
6 * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
8 *                                christopher.leech@intel.com,
9 *                                scott.feldman@intel.com)
10 */
11
12#ifndef _LINUX_ETHTOOL_H
13#define _LINUX_ETHTOOL_H
14
15#include <asm/types.h>
16
17
18/* This should work for both 32 and 64 bit userland. */
19struct ethtool_cmd {
20        __u32   cmd;
21        __u32   supported;      /* Features this interface supports */
22        __u32   advertising;    /* Features this interface advertises */
23        __u16   speed;          /* The forced speed, 10Mb, 100Mb, gigabit */
24        __u8    duplex;         /* Duplex, half or full */
25        __u8    port;           /* Which connector port */
26        __u8    phy_address;
27        __u8    transceiver;    /* Which transceiver to use */
28        __u8    autoneg;        /* Enable or disable autonegotiation */
29        __u32   maxtxpkt;       /* Tx pkts before generating tx int */
30        __u32   maxrxpkt;       /* Rx pkts before generating rx int */
31        __u32   reserved[4];
32};
33
34#define ETHTOOL_BUSINFO_LEN     32
35/* these strings are set to whatever the driver author decides... */
36struct ethtool_drvinfo {
37        __u32   cmd;
38        char    driver[32];     /* driver short name, "tulip", "eepro100" */
39        char    version[32];    /* driver version string */
40        char    fw_version[32]; /* firmware version string, if applicable */
41        char    bus_info[ETHTOOL_BUSINFO_LEN];  /* Bus info for this IF. */
42                                /* For PCI devices, use pci_name(pci_dev). */
43        char    reserved1[32];
44        char    reserved2[16];
45        __u32   n_stats;        /* number of __u64's from ETHTOOL_GSTATS */
46        __u32   testinfo_len;
47        __u32   eedump_len;     /* Size of data from ETHTOOL_GEEPROM (bytes) */
48        __u32   regdump_len;    /* Size of data from ETHTOOL_GREGS (bytes) */
49};
50
51#define SOPASS_MAX      6
52/* wake-on-lan settings */
53struct ethtool_wolinfo {
54        __u32   cmd;
55        __u32   supported;
56        __u32   wolopts;
57        __u8    sopass[SOPASS_MAX]; /* SecureOn(tm) password */
58};
59
60/* for passing single values */
61struct ethtool_value {
62        __u32   cmd;
63        __u32   data;
64};
65
66/* for passing big chunks of data */
67struct ethtool_regs {
68        __u32   cmd;
69        __u32   version; /* driver-specific, indicates different chips/revs */
70        __u32   len; /* bytes */
71        __u8    data[0];
72};
73
74/* for passing EEPROM chunks */
75struct ethtool_eeprom {
76        __u32   cmd;
77        __u32   magic;
78        __u32   offset; /* in bytes */
79        __u32   len; /* in bytes */
80        __u8    data[0];
81};
82
83/* for configuring coalescing parameters of chip */
84struct ethtool_coalesce {
85        __u32   cmd;    /* ETHTOOL_{G,S}COALESCE */
86
87        /* How many usecs to delay an RX interrupt after
88         * a packet arrives.  If 0, only rx_max_coalesced_frames
89         * is used.
90         */
91        __u32   rx_coalesce_usecs;
92
93        /* How many packets to delay an RX interrupt after
94         * a packet arrives.  If 0, only rx_coalesce_usecs is
95         * used.  It is illegal to set both usecs and max frames
96         * to zero as this would cause RX interrupts to never be
97         * generated.
98         */
99        __u32   rx_max_coalesced_frames;
100
101        /* Same as above two parameters, except that these values
102         * apply while an IRQ is being serviced by the host.  Not
103         * all cards support this feature and the values are ignored
104         * in that case.
105         */
106        __u32   rx_coalesce_usecs_irq;
107        __u32   rx_max_coalesced_frames_irq;
108
109        /* How many usecs to delay a TX interrupt after
110         * a packet is sent.  If 0, only tx_max_coalesced_frames
111         * is used.
112         */
113        __u32   tx_coalesce_usecs;
114
115        /* How many packets to delay a TX interrupt after
116         * a packet is sent.  If 0, only tx_coalesce_usecs is
117         * used.  It is illegal to set both usecs and max frames
118         * to zero as this would cause TX interrupts to never be
119         * generated.
120         */
121        __u32   tx_max_coalesced_frames;
122
123        /* Same as above two parameters, except that these values
124         * apply while an IRQ is being serviced by the host.  Not
125         * all cards support this feature and the values are ignored
126         * in that case.
127         */
128        __u32   tx_coalesce_usecs_irq;
129        __u32   tx_max_coalesced_frames_irq;
130
131        /* How many usecs to delay in-memory statistics
132         * block updates.  Some drivers do not have an in-memory
133         * statistic block, and in such cases this value is ignored.
134         * This value must not be zero.
135         */
136        __u32   stats_block_coalesce_usecs;
137
138        /* Adaptive RX/TX coalescing is an algorithm implemented by
139         * some drivers to improve latency under low packet rates and
140         * improve throughput under high packet rates.  Some drivers
141         * only implement one of RX or TX adaptive coalescing.  Anything
142         * not implemented by the driver causes these values to be
143         * silently ignored.
144         */
145        __u32   use_adaptive_rx_coalesce;
146        __u32   use_adaptive_tx_coalesce;
147
148        /* When the packet rate (measured in packets per second)
149         * is below pkt_rate_low, the {rx,tx}_*_low parameters are
150         * used.
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        /* When the packet rate is below pkt_rate_high but above
159         * pkt_rate_low (both measured in packets per second) the
160         * normal {rx,tx}_* coalescing parameters are used.
161         */
162
163        /* When the packet rate is (measured in packets per second)
164         * is above pkt_rate_high, the {rx,tx}_*_high parameters are
165         * used.
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        /* How often to do adaptive coalescing packet rate sampling,
174         * measured in seconds.  Must not be zero.
175         */
176        __u32   rate_sample_interval;
177};
178
179/* for configuring RX/TX ring parameters */
180struct ethtool_ringparam {
181        __u32   cmd;    /* ETHTOOL_{G,S}RINGPARAM */
182
183        /* Read only attributes.  These indicate the maximum number
184         * of pending RX/TX ring entries the driver will allow the
185         * user to set.
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        /* Values changeable by the user.  The valid values are
193         * in the range 1 to the "*_max_pending" counterpart above.
194         */
195        __u32   rx_pending;
196        __u32   rx_mini_pending;
197        __u32   rx_jumbo_pending;
198        __u32   tx_pending;
199};
200
201/* for configuring link flow control parameters */
202struct ethtool_pauseparam {
203        __u32   cmd;    /* ETHTOOL_{G,S}PAUSEPARAM */
204
205        /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
206         * being true) the user may set 'autonet' here non-zero to have the
207         * pause parameters be auto-negotiated too.  In such a case, the
208         * {rx,tx}_pause values below determine what capabilities are
209         * advertised.
210         *
211         * If 'autoneg' is zero or the link is not being auto-negotiated,
212         * then {rx,tx}_pause force the driver to use/not-use pause
213         * flow control.
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};
225
226/* for passing string sets for data tagging */
227struct ethtool_gstrings {
228        __u32   cmd;            /* ETHTOOL_GSTRINGS */
229        __u32   string_set;     /* string set id e.c. ETH_SS_TEST, etc*/
230        __u32   len;            /* number of strings in the string set */
231        __u8    data[0];
232};
233
234enum ethtool_test_flags {
235        ETH_TEST_FL_OFFLINE     = (1 << 0),     /* online / offline */
236        ETH_TEST_FL_FAILED      = (1 << 1),     /* test passed / failed */
237};
238
239/* for requesting NIC test and getting results*/
240struct ethtool_test {
241        __u32   cmd;            /* ETHTOOL_TEST */
242        __u32   flags;          /* ETH_TEST_FL_xxx */
243        __u32   reserved;
244        __u32   len;            /* result length, in number of __u64 elements */
245        __u64   data[0];
246};
247
248/* for dumping NIC-specific statistics */
249struct ethtool_stats {
250        __u32   cmd;            /* ETHTOOL_GSTATS */
251        __u32   n_stats;        /* number of __u64's being returned */
252        __u64   data[0];
253};
254
255struct net_device;
256
257/* Some generic methods drivers may use in their ethtool_ops */
258__u32 ethtool_op_get_link(struct net_device *dev);
259__u32 ethtool_op_get_tx_csum(struct net_device *dev);
260int ethtool_op_set_tx_csum(struct net_device *dev, __u32 data);
261int ethtool_op_set_tx_hw_csum(struct net_device *dev, __u32 data);
262__u32 ethtool_op_get_sg(struct net_device *dev);
263int ethtool_op_set_sg(struct net_device *dev, __u32 data);
264__u32 ethtool_op_get_tso(struct net_device *dev);
265int ethtool_op_set_tso(struct net_device *dev, __u32 data);
266
267/**
268 * &ethtool_ops - Alter and report network device settings
269 * get_settings: Get device-specific settings
270 * set_settings: Set device-specific settings
271 * get_drvinfo: Report driver information
272 * get_regs: Get device registers
273 * get_wol: Report whether Wake-on-Lan is enabled
274 * set_wol: Turn Wake-on-Lan on or off
275 * get_msglevel: Report driver message level
276 * set_msglevel: Set driver message level
277 * nway_reset: Restart autonegotiation
278 * get_link: Get link status
279 * get_eeprom: Read data from the device EEPROM
280 * set_eeprom: Write data to the device EEPROM
281 * get_coalesce: Get interrupt coalescing parameters
282 * set_coalesce: Set interrupt coalescing parameters
283 * get_ringparam: Report ring sizes
284 * set_ringparam: Set ring sizes
285 * get_pauseparam: Report pause parameters
286 * set_pauseparam: Set pause paramters
287 * get_rx_csum: Report whether receive checksums are turned on or off
288 * set_rx_csum: Turn receive checksum on or off
289 * get_tx_csum: Report whether transmit checksums are turned on or off
290 * set_tx_csum: Turn transmit checksums on or off
291 * get_sg: Report whether scatter-gather is enabled
292 * set_sg: Turn scatter-gather on or off
293 * get_tso: Report whether TCP segmentation offload is enabled
294 * set_tso: Turn TCP segmentation offload on or off
295 * self_test: Run specified self-tests
296 * get_strings: Return a set of strings that describe the requested objects
297 * phys_id: Identify the device
298 * get_stats: Return statistics about the device
299 *
300 * Description:
301 *
302 * get_settings:
303 *      @get_settings is passed an &ethtool_cmd to fill in.  It returns
304 *      an negative errno or zero.
305 *
306 * set_settings:
307 *      @set_settings is passed an &ethtool_cmd and should attempt to set
308 *      all the settings this device supports.  It may return an error value
309 *      if something goes wrong (otherwise 0).
310 *
311 * get_eeprom:
312 *      Should fill in the magic field.  Don't need to check len for zero
313 *      or wraparound.  Fill in the data argument with the eeprom values
314 *      from offset to offset + len.  Update len to the amount read.
315 *      Returns an error or zero.
316 *
317 * set_eeprom:
318 *      Should validate the magic field.  Don't need to check len for zero
319 *      or wraparound.  Update len to the amount written.  Returns an error
320 *      or zero.
321 */
322struct ethtool_ops {
323        int     (*get_settings)(struct net_device *, struct ethtool_cmd *);
324        int     (*set_settings)(struct net_device *, struct ethtool_cmd *);
325        void    (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
326        int     (*get_regs_len)(struct net_device *);
327        void    (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
328        void    (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
329        int     (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
330        __u32   (*get_msglevel)(struct net_device *);
331        void    (*set_msglevel)(struct net_device *, __u32);
332        int     (*nway_reset)(struct net_device *);
333        __u32   (*get_link)(struct net_device *);
334        int     (*get_eeprom_len)(struct net_device *);
335        int     (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, __u8 *);
336        int     (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, __u8 *);
337        int     (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
338        int     (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
339        void    (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
340        int     (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
341        void    (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
342        int     (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
343        __u32   (*get_rx_csum)(struct net_device *);
344        int     (*set_rx_csum)(struct net_device *, __u32);
345        __u32   (*get_tx_csum)(struct net_device *);
346        int     (*set_tx_csum)(struct net_device *, __u32);
347        __u32   (*get_sg)(struct net_device *);
348        int     (*set_sg)(struct net_device *, __u32);
349        __u32   (*get_tso)(struct net_device *);
350        int     (*set_tso)(struct net_device *, __u32);
351        int     (*self_test_count)(struct net_device *);
352        void    (*self_test)(struct net_device *, struct ethtool_test *, __u64 *);
353        void    (*get_strings)(struct net_device *, __u32 stringset, __u8 *);
354        int     (*phys_id)(struct net_device *, __u32);
355        int     (*get_stats_count)(struct net_device *);
356        void    (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, __u64 *);
357        int     (*begin)(struct net_device *);
358        void    (*complete)(struct net_device *);
359};
360
361/* CMDs currently supported */
362#define ETHTOOL_GSET            0x00000001 /* Get settings. */
363#define ETHTOOL_SSET            0x00000002 /* Set settings. */
364#define ETHTOOL_GDRVINFO        0x00000003 /* Get driver info. */
365#define ETHTOOL_GREGS           0x00000004 /* Get NIC registers. */
366#define ETHTOOL_GWOL            0x00000005 /* Get wake-on-lan options. */
367#define ETHTOOL_SWOL            0x00000006 /* Set wake-on-lan options. */
368#define ETHTOOL_GMSGLVL         0x00000007 /* Get driver message level */
369#define ETHTOOL_SMSGLVL         0x00000008 /* Set driver msg level. */
370#define ETHTOOL_NWAY_RST        0x00000009 /* Restart autonegotiation. */
371#define ETHTOOL_GLINK           0x0000000a /* Get link status (ethtool_value) */
372#define ETHTOOL_GEEPROM         0x0000000b /* Get EEPROM data */
373#define ETHTOOL_SEEPROM         0x0000000c /* Set EEPROM data. */
374#define ETHTOOL_GCOALESCE       0x0000000e /* Get coalesce config */
375#define ETHTOOL_SCOALESCE       0x0000000f /* Set coalesce config. */
376#define ETHTOOL_GRINGPARAM      0x00000010 /* Get ring parameters */
377#define ETHTOOL_SRINGPARAM      0x00000011 /* Set ring parameters. */
378#define ETHTOOL_GPAUSEPARAM     0x00000012 /* Get pause parameters */
379#define ETHTOOL_SPAUSEPARAM     0x00000013 /* Set pause parameters. */
380#define ETHTOOL_GRXCSUM         0x00000014 /* Get RX hw csum enable (ethtool_value) */
381#define ETHTOOL_SRXCSUM         0x00000015 /* Set RX hw csum enable (ethtool_value) */
382#define ETHTOOL_GTXCSUM         0x00000016 /* Get TX hw csum enable (ethtool_value) */
383#define ETHTOOL_STXCSUM         0x00000017 /* Set TX hw csum enable (ethtool_value) */
384#define ETHTOOL_GSG             0x00000018 /* Get scatter-gather enable
385                                            * (ethtool_value) */
386#define ETHTOOL_SSG             0x00000019 /* Set scatter-gather enable
387                                            * (ethtool_value). */
388#define ETHTOOL_TEST            0x0000001a /* execute NIC self-test. */
389#define ETHTOOL_GSTRINGS        0x0000001b /* get specified string set */
390#define ETHTOOL_PHYS_ID         0x0000001c /* identify the NIC */
391#define ETHTOOL_GSTATS          0x0000001d /* get NIC-specific statistics */
392#define ETHTOOL_GTSO            0x0000001e /* Get TSO enable (ethtool_value) */
393#define ETHTOOL_STSO            0x0000001f /* Set TSO enable (ethtool_value) */
394
395/* compatibility with older code */
396#define SPARC_ETH_GSET          ETHTOOL_GSET
397#define SPARC_ETH_SSET          ETHTOOL_SSET
398
399/* Indicates what features are supported by the interface. */
400#define SUPPORTED_10baseT_Half          (1 << 0)
401#define SUPPORTED_10baseT_Full          (1 << 1)
402#define SUPPORTED_100baseT_Half         (1 << 2)
403#define SUPPORTED_100baseT_Full         (1 << 3)
404#define SUPPORTED_1000baseT_Half        (1 << 4)
405#define SUPPORTED_1000baseT_Full        (1 << 5)
406#define SUPPORTED_Autoneg               (1 << 6)
407#define SUPPORTED_TP                    (1 << 7)
408#define SUPPORTED_AUI                   (1 << 8)
409#define SUPPORTED_MII                   (1 << 9)
410#define SUPPORTED_FIBRE                 (1 << 10)
411#define SUPPORTED_BNC                   (1 << 11)
412#define SUPPORTED_10000baseT_Full       (1 << 12)
413
414/* Indicates what features are advertised by the interface. */
415#define ADVERTISED_10baseT_Half         (1 << 0)
416#define ADVERTISED_10baseT_Full         (1 << 1)
417#define ADVERTISED_100baseT_Half        (1 << 2)
418#define ADVERTISED_100baseT_Full        (1 << 3)
419#define ADVERTISED_1000baseT_Half       (1 << 4)
420#define ADVERTISED_1000baseT_Full       (1 << 5)
421#define ADVERTISED_Autoneg              (1 << 6)
422#define ADVERTISED_TP                   (1 << 7)
423#define ADVERTISED_AUI                  (1 << 8)
424#define ADVERTISED_MII                  (1 << 9)
425#define ADVERTISED_FIBRE                (1 << 10)
426#define ADVERTISED_BNC                  (1 << 11)
427#define ADVERTISED_10000baseT_Full      (1 << 12)
428
429/* The following are all involved in forcing a particular link
430 * mode for the device for setting things.  When getting the
431 * devices settings, these indicate the current mode and whether
432 * it was foced up into this mode or autonegotiated.
433 */
434
435/* The forced speed, 10Mb, 100Mb, gigabit, 10GbE. */
436#define SPEED_10                10
437#define SPEED_100               100
438#define SPEED_1000              1000
439#define SPEED_10000             10000
440
441/* Duplex, half or full. */
442#define DUPLEX_HALF             0x00
443#define DUPLEX_FULL             0x01
444
445/* Which connector port. */
446#define PORT_TP                 0x00
447#define PORT_AUI                0x01
448#define PORT_MII                0x02
449#define PORT_FIBRE              0x03
450#define PORT_BNC                0x04
451
452/* Which transceiver to use. */
453#define XCVR_INTERNAL           0x00
454#define XCVR_EXTERNAL           0x01
455#define XCVR_DUMMY1             0x02
456#define XCVR_DUMMY2             0x03
457#define XCVR_DUMMY3             0x04
458
459/* Enable or disable autonegotiation.  If this is set to enable,
460 * the forced link modes above are completely ignored.
461 */
462#define AUTONEG_DISABLE         0x00
463#define AUTONEG_ENABLE          0x01
464
465/* Wake-On-Lan options. */
466#define WAKE_PHY                (1 << 0)
467#define WAKE_UCAST              (1 << 1)
468#define WAKE_MCAST              (1 << 2)
469#define WAKE_BCAST              (1 << 3)
470#define WAKE_ARP                (1 << 4)
471#define WAKE_MAGIC              (1 << 5)
472#define WAKE_MAGICSECURE        (1 << 6) /* only meaningful if WAKE_MAGIC */
473
474#endif /* _LINUX_ETHTOOL_H */
Note: See TracBrowser for help on using the repository browser.