Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Kirill A. Shutemov | e621e69 | 2008-03-07 11:11:13 -0800 | [diff] [blame] | 15 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | /* This should work for both 32 and 64 bit userland. */ |
| 18 | struct ethtool_cmd { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 19 | __u32 cmd; |
| 20 | __u32 supported; /* Features this interface supports */ |
| 21 | __u32 advertising; /* Features this interface advertises */ |
| 22 | __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ |
| 23 | __u8 duplex; /* Duplex, half or full */ |
| 24 | __u8 port; /* Which connector port */ |
| 25 | __u8 phy_address; |
| 26 | __u8 transceiver; /* Which transceiver to use */ |
| 27 | __u8 autoneg; /* Enable or disable autonegotiation */ |
| 28 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ |
| 29 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ |
Brandon Philips | b11f8d8 | 2008-07-15 02:18:41 -0700 | [diff] [blame] | 30 | __u16 speed_hi; |
| 31 | __u16 reserved2; |
| 32 | __u32 reserved[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | }; |
| 34 | |
Brandon Philips | b11f8d8 | 2008-07-15 02:18:41 -0700 | [diff] [blame] | 35 | static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, |
| 36 | __u32 speed) |
| 37 | { |
| 38 | |
| 39 | ep->speed = (__u16)speed; |
| 40 | ep->speed_hi = (__u16)(speed >> 16); |
| 41 | } |
| 42 | |
| 43 | static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) |
| 44 | { |
| 45 | return (ep->speed_hi << 16) | ep->speed; |
| 46 | } |
| 47 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #define ETHTOOL_BUSINFO_LEN 32 |
| 49 | /* these strings are set to whatever the driver author decides... */ |
| 50 | struct ethtool_drvinfo { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 51 | __u32 cmd; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | char driver[32]; /* driver short name, "tulip", "eepro100" */ |
| 53 | char version[32]; /* driver version string */ |
| 54 | char fw_version[32]; /* firmware version string, if applicable */ |
| 55 | char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ |
| 56 | /* For PCI devices, use pci_name(pci_dev). */ |
| 57 | char reserved1[32]; |
Jeff Garzik | 339bf02 | 2007-08-15 16:01:32 -0700 | [diff] [blame] | 58 | char reserved2[12]; |
| 59 | __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 60 | __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ |
| 61 | __u32 testinfo_len; |
| 62 | __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ |
| 63 | __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | #define SOPASS_MAX 6 |
| 67 | /* wake-on-lan settings */ |
| 68 | struct ethtool_wolinfo { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 69 | __u32 cmd; |
| 70 | __u32 supported; |
| 71 | __u32 wolopts; |
| 72 | __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | /* for passing single values */ |
| 76 | struct ethtool_value { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 77 | __u32 cmd; |
| 78 | __u32 data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | /* for passing big chunks of data */ |
| 82 | struct ethtool_regs { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 83 | __u32 cmd; |
| 84 | __u32 version; /* driver-specific, indicates different chips/revs */ |
| 85 | __u32 len; /* bytes */ |
| 86 | __u8 data[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | /* for passing EEPROM chunks */ |
| 90 | struct ethtool_eeprom { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 91 | __u32 cmd; |
| 92 | __u32 magic; |
| 93 | __u32 offset; /* in bytes */ |
| 94 | __u32 len; /* in bytes */ |
| 95 | __u8 data[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | /* for configuring coalescing parameters of chip */ |
| 99 | struct ethtool_coalesce { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 100 | __u32 cmd; /* ETHTOOL_{G,S}COALESCE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | /* How many usecs to delay an RX interrupt after |
| 103 | * a packet arrives. If 0, only rx_max_coalesced_frames |
| 104 | * is used. |
| 105 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 106 | __u32 rx_coalesce_usecs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | |
| 108 | /* How many packets to delay an RX interrupt after |
| 109 | * a packet arrives. If 0, only rx_coalesce_usecs is |
| 110 | * used. It is illegal to set both usecs and max frames |
| 111 | * to zero as this would cause RX interrupts to never be |
| 112 | * generated. |
| 113 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 114 | __u32 rx_max_coalesced_frames; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | /* Same as above two parameters, except that these values |
| 117 | * apply while an IRQ is being serviced by the host. Not |
| 118 | * all cards support this feature and the values are ignored |
| 119 | * in that case. |
| 120 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 121 | __u32 rx_coalesce_usecs_irq; |
| 122 | __u32 rx_max_coalesced_frames_irq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
| 124 | /* How many usecs to delay a TX interrupt after |
| 125 | * a packet is sent. If 0, only tx_max_coalesced_frames |
| 126 | * is used. |
| 127 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 128 | __u32 tx_coalesce_usecs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | |
| 130 | /* How many packets to delay a TX interrupt after |
| 131 | * a packet is sent. If 0, only tx_coalesce_usecs is |
| 132 | * used. It is illegal to set both usecs and max frames |
| 133 | * to zero as this would cause TX interrupts to never be |
| 134 | * generated. |
| 135 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 136 | __u32 tx_max_coalesced_frames; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | |
| 138 | /* Same as above two parameters, except that these values |
| 139 | * apply while an IRQ is being serviced by the host. Not |
| 140 | * all cards support this feature and the values are ignored |
| 141 | * in that case. |
| 142 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 143 | __u32 tx_coalesce_usecs_irq; |
| 144 | __u32 tx_max_coalesced_frames_irq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
| 146 | /* How many usecs to delay in-memory statistics |
| 147 | * block updates. Some drivers do not have an in-memory |
| 148 | * statistic block, and in such cases this value is ignored. |
| 149 | * This value must not be zero. |
| 150 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 151 | __u32 stats_block_coalesce_usecs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | |
| 153 | /* Adaptive RX/TX coalescing is an algorithm implemented by |
| 154 | * some drivers to improve latency under low packet rates and |
| 155 | * improve throughput under high packet rates. Some drivers |
| 156 | * only implement one of RX or TX adaptive coalescing. Anything |
| 157 | * not implemented by the driver causes these values to be |
| 158 | * silently ignored. |
| 159 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 160 | __u32 use_adaptive_rx_coalesce; |
| 161 | __u32 use_adaptive_tx_coalesce; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
| 163 | /* When the packet rate (measured in packets per second) |
| 164 | * is below pkt_rate_low, the {rx,tx}_*_low parameters are |
| 165 | * used. |
| 166 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 167 | __u32 pkt_rate_low; |
| 168 | __u32 rx_coalesce_usecs_low; |
| 169 | __u32 rx_max_coalesced_frames_low; |
| 170 | __u32 tx_coalesce_usecs_low; |
| 171 | __u32 tx_max_coalesced_frames_low; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | |
| 173 | /* When the packet rate is below pkt_rate_high but above |
| 174 | * pkt_rate_low (both measured in packets per second) the |
| 175 | * normal {rx,tx}_* coalescing parameters are used. |
| 176 | */ |
| 177 | |
| 178 | /* When the packet rate is (measured in packets per second) |
| 179 | * is above pkt_rate_high, the {rx,tx}_*_high parameters are |
| 180 | * used. |
| 181 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 182 | __u32 pkt_rate_high; |
| 183 | __u32 rx_coalesce_usecs_high; |
| 184 | __u32 rx_max_coalesced_frames_high; |
| 185 | __u32 tx_coalesce_usecs_high; |
| 186 | __u32 tx_max_coalesced_frames_high; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | |
| 188 | /* How often to do adaptive coalescing packet rate sampling, |
| 189 | * measured in seconds. Must not be zero. |
| 190 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 191 | __u32 rate_sample_interval; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | }; |
| 193 | |
| 194 | /* for configuring RX/TX ring parameters */ |
| 195 | struct ethtool_ringparam { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 196 | __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | /* Read only attributes. These indicate the maximum number |
| 199 | * of pending RX/TX ring entries the driver will allow the |
| 200 | * user to set. |
| 201 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 202 | __u32 rx_max_pending; |
| 203 | __u32 rx_mini_max_pending; |
| 204 | __u32 rx_jumbo_max_pending; |
| 205 | __u32 tx_max_pending; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | |
| 207 | /* Values changeable by the user. The valid values are |
| 208 | * in the range 1 to the "*_max_pending" counterpart above. |
| 209 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 210 | __u32 rx_pending; |
| 211 | __u32 rx_mini_pending; |
| 212 | __u32 rx_jumbo_pending; |
| 213 | __u32 tx_pending; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | }; |
| 215 | |
| 216 | /* for configuring link flow control parameters */ |
| 217 | struct ethtool_pauseparam { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 218 | __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | |
| 220 | /* If the link is being auto-negotiated (via ethtool_cmd.autoneg |
| 221 | * being true) the user may set 'autonet' here non-zero to have the |
| 222 | * pause parameters be auto-negotiated too. In such a case, the |
| 223 | * {rx,tx}_pause values below determine what capabilities are |
| 224 | * advertised. |
| 225 | * |
| 226 | * If 'autoneg' is zero or the link is not being auto-negotiated, |
| 227 | * then {rx,tx}_pause force the driver to use/not-use pause |
| 228 | * flow control. |
| 229 | */ |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 230 | __u32 autoneg; |
| 231 | __u32 rx_pause; |
| 232 | __u32 tx_pause; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | }; |
| 234 | |
| 235 | #define ETH_GSTRING_LEN 32 |
| 236 | enum ethtool_stringset { |
| 237 | ETH_SS_TEST = 0, |
| 238 | ETH_SS_STATS, |
Jeff Garzik | 339bf02 | 2007-08-15 16:01:32 -0700 | [diff] [blame] | 239 | ETH_SS_PRIV_FLAGS, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | }; |
| 241 | |
| 242 | /* for passing string sets for data tagging */ |
| 243 | struct ethtool_gstrings { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 244 | __u32 cmd; /* ETHTOOL_GSTRINGS */ |
| 245 | __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ |
| 246 | __u32 len; /* number of strings in the string set */ |
| 247 | __u8 data[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | }; |
| 249 | |
| 250 | enum ethtool_test_flags { |
| 251 | ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ |
| 252 | ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ |
| 253 | }; |
| 254 | |
| 255 | /* for requesting NIC test and getting results*/ |
| 256 | struct ethtool_test { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 257 | __u32 cmd; /* ETHTOOL_TEST */ |
| 258 | __u32 flags; /* ETH_TEST_FL_xxx */ |
| 259 | __u32 reserved; |
| 260 | __u32 len; /* result length, in number of u64 elements */ |
| 261 | __u64 data[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | }; |
| 263 | |
| 264 | /* for dumping NIC-specific statistics */ |
| 265 | struct ethtool_stats { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 266 | __u32 cmd; /* ETHTOOL_GSTATS */ |
| 267 | __u32 n_stats; /* number of u64's being returned */ |
| 268 | __u64 data[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | }; |
| 270 | |
Jon Wetzel | a6f9a70 | 2005-08-20 17:15:54 -0700 | [diff] [blame] | 271 | struct ethtool_perm_addr { |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 272 | __u32 cmd; /* ETHTOOL_GPERMADDR */ |
| 273 | __u32 size; |
| 274 | __u8 data[0]; |
Jon Wetzel | a6f9a70 | 2005-08-20 17:15:54 -0700 | [diff] [blame] | 275 | }; |
| 276 | |
Jeff Garzik | 3ae7c0b | 2007-08-15 16:00:51 -0700 | [diff] [blame] | 277 | /* boolean flags controlling per-interface behavior characteristics. |
| 278 | * When reading, the flag indicates whether or not a certain behavior |
| 279 | * is enabled/present. When writing, the flag indicates whether |
| 280 | * or not the driver should turn on (set) or off (clear) a behavior. |
| 281 | * |
| 282 | * Some behaviors may read-only (unconditionally absent or present). |
| 283 | * If such is the case, return EINVAL in the set-flags operation if the |
| 284 | * flag differs from the read-only value. |
| 285 | */ |
| 286 | enum ethtool_flags { |
| 287 | ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ |
| 288 | }; |
| 289 | |
Santwona Behera | 0853ad6 | 2008-07-02 03:47:41 -0700 | [diff] [blame] | 290 | struct ethtool_rxnfc { |
| 291 | __u32 cmd; |
| 292 | __u32 flow_type; |
| 293 | __u64 data; |
| 294 | }; |
| 295 | |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 296 | #ifdef __KERNEL__ |
| 297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | struct net_device; |
| 299 | |
| 300 | /* Some generic methods drivers may use in their ethtool_ops */ |
| 301 | u32 ethtool_op_get_link(struct net_device *dev); |
| 302 | u32 ethtool_op_get_tx_csum(struct net_device *dev); |
| 303 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); |
Jon Mason | 69f6a0f | 2005-05-29 20:27:24 -0700 | [diff] [blame] | 304 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); |
Michael Chan | 6460d94 | 2007-07-14 19:07:52 -0700 | [diff] [blame] | 305 | int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | u32 ethtool_op_get_sg(struct net_device *dev); |
| 307 | int ethtool_op_set_sg(struct net_device *dev, u32 data); |
| 308 | u32 ethtool_op_get_tso(struct net_device *dev); |
| 309 | int ethtool_op_set_tso(struct net_device *dev, u32 data); |
Ananda Raju | e89e9cf | 2005-10-18 15:46:41 -0700 | [diff] [blame] | 310 | u32 ethtool_op_get_ufo(struct net_device *dev); |
| 311 | int ethtool_op_set_ufo(struct net_device *dev, u32 data); |
Jeff Garzik | 3ae7c0b | 2007-08-15 16:00:51 -0700 | [diff] [blame] | 312 | u32 ethtool_op_get_flags(struct net_device *dev); |
| 313 | int ethtool_op_set_flags(struct net_device *dev, u32 data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
| 315 | /** |
| 316 | * ðtool_ops - Alter and report network device settings |
| 317 | * get_settings: Get device-specific settings |
| 318 | * set_settings: Set device-specific settings |
| 319 | * get_drvinfo: Report driver information |
| 320 | * get_regs: Get device registers |
| 321 | * get_wol: Report whether Wake-on-Lan is enabled |
| 322 | * set_wol: Turn Wake-on-Lan on or off |
| 323 | * get_msglevel: Report driver message level |
| 324 | * set_msglevel: Set driver message level |
| 325 | * nway_reset: Restart autonegotiation |
| 326 | * get_link: Get link status |
| 327 | * get_eeprom: Read data from the device EEPROM |
| 328 | * set_eeprom: Write data to the device EEPROM |
| 329 | * get_coalesce: Get interrupt coalescing parameters |
| 330 | * set_coalesce: Set interrupt coalescing parameters |
| 331 | * get_ringparam: Report ring sizes |
| 332 | * set_ringparam: Set ring sizes |
| 333 | * get_pauseparam: Report pause parameters |
Joe Perches | fd3f898 | 2008-02-03 17:45:46 +0200 | [diff] [blame] | 334 | * set_pauseparam: Set pause parameters |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | * get_rx_csum: Report whether receive checksums are turned on or off |
| 336 | * set_rx_csum: Turn receive checksum on or off |
| 337 | * get_tx_csum: Report whether transmit checksums are turned on or off |
| 338 | * set_tx_csum: Turn transmit checksums on or off |
| 339 | * get_sg: Report whether scatter-gather is enabled |
| 340 | * set_sg: Turn scatter-gather on or off |
| 341 | * get_tso: Report whether TCP segmentation offload is enabled |
| 342 | * set_tso: Turn TCP segmentation offload on or off |
Ananda Raju | e89e9cf | 2005-10-18 15:46:41 -0700 | [diff] [blame] | 343 | * get_ufo: Report whether UDP fragmentation offload is enabled |
| 344 | * set_ufo: Turn UDP fragmentation offload on or off |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | * self_test: Run specified self-tests |
| 346 | * get_strings: Return a set of strings that describe the requested objects |
| 347 | * phys_id: Identify the device |
| 348 | * get_stats: Return statistics about the device |
Jeff Garzik | 3ae7c0b | 2007-08-15 16:00:51 -0700 | [diff] [blame] | 349 | * get_flags: get 32-bit flags bitmap |
| 350 | * set_flags: set 32-bit flags bitmap |
Jon Wetzel | a6f9a70 | 2005-08-20 17:15:54 -0700 | [diff] [blame] | 351 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | * Description: |
| 353 | * |
| 354 | * get_settings: |
| 355 | * @get_settings is passed an ðtool_cmd to fill in. It returns |
| 356 | * an negative errno or zero. |
| 357 | * |
| 358 | * set_settings: |
| 359 | * @set_settings is passed an ðtool_cmd and should attempt to set |
| 360 | * all the settings this device supports. It may return an error value |
| 361 | * if something goes wrong (otherwise 0). |
| 362 | * |
| 363 | * get_eeprom: |
| 364 | * Should fill in the magic field. Don't need to check len for zero |
| 365 | * or wraparound. Fill in the data argument with the eeprom values |
| 366 | * from offset to offset + len. Update len to the amount read. |
| 367 | * Returns an error or zero. |
| 368 | * |
| 369 | * set_eeprom: |
| 370 | * Should validate the magic field. Don't need to check len for zero |
| 371 | * or wraparound. Update len to the amount written. Returns an error |
| 372 | * or zero. |
| 373 | */ |
| 374 | struct ethtool_ops { |
| 375 | int (*get_settings)(struct net_device *, struct ethtool_cmd *); |
| 376 | int (*set_settings)(struct net_device *, struct ethtool_cmd *); |
| 377 | void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); |
| 378 | int (*get_regs_len)(struct net_device *); |
| 379 | void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); |
| 380 | void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); |
| 381 | int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); |
| 382 | u32 (*get_msglevel)(struct net_device *); |
| 383 | void (*set_msglevel)(struct net_device *, u32); |
| 384 | int (*nway_reset)(struct net_device *); |
| 385 | u32 (*get_link)(struct net_device *); |
| 386 | int (*get_eeprom_len)(struct net_device *); |
| 387 | int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); |
| 388 | int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); |
| 389 | int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); |
| 390 | int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); |
| 391 | void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); |
| 392 | int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); |
| 393 | void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); |
| 394 | int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); |
| 395 | u32 (*get_rx_csum)(struct net_device *); |
| 396 | int (*set_rx_csum)(struct net_device *, u32); |
| 397 | u32 (*get_tx_csum)(struct net_device *); |
| 398 | int (*set_tx_csum)(struct net_device *, u32); |
| 399 | u32 (*get_sg)(struct net_device *); |
| 400 | int (*set_sg)(struct net_device *, u32); |
| 401 | u32 (*get_tso)(struct net_device *); |
| 402 | int (*set_tso)(struct net_device *, u32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); |
| 404 | void (*get_strings)(struct net_device *, u32 stringset, u8 *); |
| 405 | int (*phys_id)(struct net_device *, u32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); |
| 407 | int (*begin)(struct net_device *); |
| 408 | void (*complete)(struct net_device *); |
Ananda Raju | e89e9cf | 2005-10-18 15:46:41 -0700 | [diff] [blame] | 409 | u32 (*get_ufo)(struct net_device *); |
| 410 | int (*set_ufo)(struct net_device *, u32); |
Jeff Garzik | 3ae7c0b | 2007-08-15 16:00:51 -0700 | [diff] [blame] | 411 | u32 (*get_flags)(struct net_device *); |
| 412 | int (*set_flags)(struct net_device *, u32); |
Jeff Garzik | 339bf02 | 2007-08-15 16:01:32 -0700 | [diff] [blame] | 413 | u32 (*get_priv_flags)(struct net_device *); |
| 414 | int (*set_priv_flags)(struct net_device *, u32); |
Jeff Garzik | ff03d49 | 2007-08-15 16:01:08 -0700 | [diff] [blame] | 415 | int (*get_sset_count)(struct net_device *, int); |
| 416 | |
| 417 | /* the following hooks are obsolete */ |
| 418 | int (*self_test_count)(struct net_device *);/* use get_sset_count */ |
| 419 | int (*get_stats_count)(struct net_device *);/* use get_sset_count */ |
Santwona Behera | 0853ad6 | 2008-07-02 03:47:41 -0700 | [diff] [blame] | 420 | int (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *); |
| 421 | int (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | }; |
David Woodhouse | c3ce7e2 | 2006-04-29 01:53:47 +0100 | [diff] [blame] | 423 | #endif /* __KERNEL__ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | |
| 425 | /* CMDs currently supported */ |
| 426 | #define ETHTOOL_GSET 0x00000001 /* Get settings. */ |
| 427 | #define ETHTOOL_SSET 0x00000002 /* Set settings. */ |
| 428 | #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ |
| 429 | #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ |
| 430 | #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ |
| 431 | #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ |
| 432 | #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ |
| 433 | #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ |
| 434 | #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ |
| 435 | #define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ |
| 436 | #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ |
| 437 | #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ |
| 438 | #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ |
| 439 | #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ |
| 440 | #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ |
| 441 | #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ |
| 442 | #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ |
| 443 | #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ |
| 444 | #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ |
| 445 | #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ |
| 446 | #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ |
| 447 | #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ |
| 448 | #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable |
| 449 | * (ethtool_value) */ |
| 450 | #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable |
| 451 | * (ethtool_value). */ |
| 452 | #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ |
| 453 | #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ |
| 454 | #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ |
| 455 | #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ |
| 456 | #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ |
| 457 | #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ |
Jon Wetzel | a6f9a70 | 2005-08-20 17:15:54 -0700 | [diff] [blame] | 458 | #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */ |
Ananda Raju | e89e9cf | 2005-10-18 15:46:41 -0700 | [diff] [blame] | 459 | #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */ |
| 460 | #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ |
Herbert Xu | 37c3185 | 2006-06-22 03:07:29 -0700 | [diff] [blame] | 461 | #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ |
| 462 | #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ |
Jeff Garzik | 3ae7c0b | 2007-08-15 16:00:51 -0700 | [diff] [blame] | 463 | #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ |
| 464 | #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ |
Jeff Garzik | 339bf02 | 2007-08-15 16:01:32 -0700 | [diff] [blame] | 465 | #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ |
| 466 | #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | |
Santwona Behera | 0853ad6 | 2008-07-02 03:47:41 -0700 | [diff] [blame] | 468 | #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ |
| 469 | #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ |
Herbert Xu | b240a0e | 2008-12-15 23:44:31 -0800 | [diff] [blame] | 470 | #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ |
| 471 | #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ |
Santwona Behera | 0853ad6 | 2008-07-02 03:47:41 -0700 | [diff] [blame] | 472 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | /* compatibility with older code */ |
| 474 | #define SPARC_ETH_GSET ETHTOOL_GSET |
| 475 | #define SPARC_ETH_SSET ETHTOOL_SSET |
| 476 | |
| 477 | /* Indicates what features are supported by the interface. */ |
| 478 | #define SUPPORTED_10baseT_Half (1 << 0) |
| 479 | #define SUPPORTED_10baseT_Full (1 << 1) |
| 480 | #define SUPPORTED_100baseT_Half (1 << 2) |
| 481 | #define SUPPORTED_100baseT_Full (1 << 3) |
| 482 | #define SUPPORTED_1000baseT_Half (1 << 4) |
| 483 | #define SUPPORTED_1000baseT_Full (1 << 5) |
| 484 | #define SUPPORTED_Autoneg (1 << 6) |
| 485 | #define SUPPORTED_TP (1 << 7) |
| 486 | #define SUPPORTED_AUI (1 << 8) |
| 487 | #define SUPPORTED_MII (1 << 9) |
| 488 | #define SUPPORTED_FIBRE (1 << 10) |
| 489 | #define SUPPORTED_BNC (1 << 11) |
| 490 | #define SUPPORTED_10000baseT_Full (1 << 12) |
Andy Fleming | 00db818 | 2005-07-30 19:31:23 -0400 | [diff] [blame] | 491 | #define SUPPORTED_Pause (1 << 13) |
| 492 | #define SUPPORTED_Asym_Pause (1 << 14) |
Michael Chan | 427c219 | 2007-05-03 13:17:25 -0700 | [diff] [blame] | 493 | #define SUPPORTED_2500baseX_Full (1 << 15) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | |
| 495 | /* Indicates what features are advertised by the interface. */ |
| 496 | #define ADVERTISED_10baseT_Half (1 << 0) |
| 497 | #define ADVERTISED_10baseT_Full (1 << 1) |
| 498 | #define ADVERTISED_100baseT_Half (1 << 2) |
| 499 | #define ADVERTISED_100baseT_Full (1 << 3) |
| 500 | #define ADVERTISED_1000baseT_Half (1 << 4) |
| 501 | #define ADVERTISED_1000baseT_Full (1 << 5) |
| 502 | #define ADVERTISED_Autoneg (1 << 6) |
| 503 | #define ADVERTISED_TP (1 << 7) |
| 504 | #define ADVERTISED_AUI (1 << 8) |
| 505 | #define ADVERTISED_MII (1 << 9) |
| 506 | #define ADVERTISED_FIBRE (1 << 10) |
| 507 | #define ADVERTISED_BNC (1 << 11) |
| 508 | #define ADVERTISED_10000baseT_Full (1 << 12) |
Andy Fleming | 00db818 | 2005-07-30 19:31:23 -0400 | [diff] [blame] | 509 | #define ADVERTISED_Pause (1 << 13) |
| 510 | #define ADVERTISED_Asym_Pause (1 << 14) |
Michael Chan | 427c219 | 2007-05-03 13:17:25 -0700 | [diff] [blame] | 511 | #define ADVERTISED_2500baseX_Full (1 << 15) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | |
| 513 | /* The following are all involved in forcing a particular link |
| 514 | * mode for the device for setting things. When getting the |
| 515 | * devices settings, these indicate the current mode and whether |
| 516 | * it was foced up into this mode or autonegotiated. |
| 517 | */ |
| 518 | |
Michael Chan | 5b0c76a | 2005-11-04 08:45:49 -0800 | [diff] [blame] | 519 | /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | #define SPEED_10 10 |
| 521 | #define SPEED_100 100 |
| 522 | #define SPEED_1000 1000 |
Michael Chan | 5b0c76a | 2005-11-04 08:45:49 -0800 | [diff] [blame] | 523 | #define SPEED_2500 2500 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | #define SPEED_10000 10000 |
| 525 | |
| 526 | /* Duplex, half or full. */ |
| 527 | #define DUPLEX_HALF 0x00 |
| 528 | #define DUPLEX_FULL 0x01 |
| 529 | |
| 530 | /* Which connector port. */ |
| 531 | #define PORT_TP 0x00 |
| 532 | #define PORT_AUI 0x01 |
| 533 | #define PORT_MII 0x02 |
| 534 | #define PORT_FIBRE 0x03 |
| 535 | #define PORT_BNC 0x04 |
| 536 | |
| 537 | /* Which transceiver to use. */ |
| 538 | #define XCVR_INTERNAL 0x00 |
| 539 | #define XCVR_EXTERNAL 0x01 |
| 540 | #define XCVR_DUMMY1 0x02 |
| 541 | #define XCVR_DUMMY2 0x03 |
| 542 | #define XCVR_DUMMY3 0x04 |
| 543 | |
| 544 | /* Enable or disable autonegotiation. If this is set to enable, |
| 545 | * the forced link modes above are completely ignored. |
| 546 | */ |
| 547 | #define AUTONEG_DISABLE 0x00 |
| 548 | #define AUTONEG_ENABLE 0x01 |
| 549 | |
| 550 | /* Wake-On-Lan options. */ |
| 551 | #define WAKE_PHY (1 << 0) |
| 552 | #define WAKE_UCAST (1 << 1) |
| 553 | #define WAKE_MCAST (1 << 2) |
| 554 | #define WAKE_BCAST (1 << 3) |
| 555 | #define WAKE_ARP (1 << 4) |
| 556 | #define WAKE_MAGIC (1 << 5) |
| 557 | #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ |
| 558 | |
Santwona Behera | 0853ad6 | 2008-07-02 03:47:41 -0700 | [diff] [blame] | 559 | /* L3-L4 network traffic flow types */ |
| 560 | #define TCP_V4_FLOW 0x01 |
| 561 | #define UDP_V4_FLOW 0x02 |
| 562 | #define SCTP_V4_FLOW 0x03 |
| 563 | #define AH_ESP_V4_FLOW 0x04 |
| 564 | #define TCP_V6_FLOW 0x05 |
| 565 | #define UDP_V6_FLOW 0x06 |
| 566 | #define SCTP_V6_FLOW 0x07 |
| 567 | #define AH_ESP_V6_FLOW 0x08 |
| 568 | |
| 569 | /* L3-L4 network traffic flow hash options */ |
| 570 | #define RXH_DEV_PORT (1 << 0) |
| 571 | #define RXH_L2DA (1 << 1) |
| 572 | #define RXH_VLAN (1 << 2) |
| 573 | #define RXH_L3_PROTO (1 << 3) |
| 574 | #define RXH_IP_SRC (1 << 4) |
| 575 | #define RXH_IP_DST (1 << 5) |
| 576 | #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */ |
| 577 | #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ |
| 578 | #define RXH_DISCARD (1 << 31) |
| 579 | |
| 580 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | #endif /* _LINUX_ETHTOOL_H */ |