aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ethtool.h169
-rw-r--r--include/linux/mii.h30
2 files changed, 101 insertions, 98 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 93535f093216..cf2abeca92a0 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -15,24 +15,24 @@
15 15
16/* This should work for both 32 and 64 bit userland. */ 16/* This should work for both 32 and 64 bit userland. */
17struct ethtool_cmd { 17struct ethtool_cmd {
18 u32 cmd; 18 __u32 cmd;
19 u32 supported; /* Features this interface supports */ 19 __u32 supported; /* Features this interface supports */
20 u32 advertising; /* Features this interface advertises */ 20 __u32 advertising; /* Features this interface advertises */
21 u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ 21 __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */
22 u8 duplex; /* Duplex, half or full */ 22 __u8 duplex; /* Duplex, half or full */
23 u8 port; /* Which connector port */ 23 __u8 port; /* Which connector port */
24 u8 phy_address; 24 __u8 phy_address;
25 u8 transceiver; /* Which transceiver to use */ 25 __u8 transceiver; /* Which transceiver to use */
26 u8 autoneg; /* Enable or disable autonegotiation */ 26 __u8 autoneg; /* Enable or disable autonegotiation */
27 u32 maxtxpkt; /* Tx pkts before generating tx int */ 27 __u32 maxtxpkt; /* Tx pkts before generating tx int */
28 u32 maxrxpkt; /* Rx pkts before generating rx int */ 28 __u32 maxrxpkt; /* Rx pkts before generating rx int */
29 u32 reserved[4]; 29 __u32 reserved[4];
30}; 30};
31 31
32#define ETHTOOL_BUSINFO_LEN 32 32#define ETHTOOL_BUSINFO_LEN 32
33/* these strings are set to whatever the driver author decides... */ 33/* these strings are set to whatever the driver author decides... */
34struct ethtool_drvinfo { 34struct ethtool_drvinfo {
35 u32 cmd; 35 __u32 cmd;
36 char driver[32]; /* driver short name, "tulip", "eepro100" */ 36 char driver[32]; /* driver short name, "tulip", "eepro100" */
37 char version[32]; /* driver version string */ 37 char version[32]; /* driver version string */
38 char fw_version[32]; /* firmware version string, if applicable */ 38 char fw_version[32]; /* firmware version string, if applicable */
@@ -40,53 +40,53 @@ struct ethtool_drvinfo {
40 /* For PCI devices, use pci_name(pci_dev). */ 40 /* For PCI devices, use pci_name(pci_dev). */
41 char reserved1[32]; 41 char reserved1[32];
42 char reserved2[16]; 42 char reserved2[16];
43 u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ 43 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
44 u32 testinfo_len; 44 __u32 testinfo_len;
45 u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ 45 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
46 u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ 46 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
47}; 47};
48 48
49#define SOPASS_MAX 6 49#define SOPASS_MAX 6
50/* wake-on-lan settings */ 50/* wake-on-lan settings */
51struct ethtool_wolinfo { 51struct ethtool_wolinfo {
52 u32 cmd; 52 __u32 cmd;
53 u32 supported; 53 __u32 supported;
54 u32 wolopts; 54 __u32 wolopts;
55 u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ 55 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */
56}; 56};
57 57
58/* for passing single values */ 58/* for passing single values */
59struct ethtool_value { 59struct ethtool_value {
60 u32 cmd; 60 __u32 cmd;
61 u32 data; 61 __u32 data;
62}; 62};
63 63
64/* for passing big chunks of data */ 64/* for passing big chunks of data */
65struct ethtool_regs { 65struct ethtool_regs {
66 u32 cmd; 66 __u32 cmd;
67 u32 version; /* driver-specific, indicates different chips/revs */ 67 __u32 version; /* driver-specific, indicates different chips/revs */
68 u32 len; /* bytes */ 68 __u32 len; /* bytes */
69 u8 data[0]; 69 __u8 data[0];
70}; 70};
71 71
72/* for passing EEPROM chunks */ 72/* for passing EEPROM chunks */
73struct ethtool_eeprom { 73struct ethtool_eeprom {
74 u32 cmd; 74 __u32 cmd;
75 u32 magic; 75 __u32 magic;
76 u32 offset; /* in bytes */ 76 __u32 offset; /* in bytes */
77 u32 len; /* in bytes */ 77 __u32 len; /* in bytes */
78 u8 data[0]; 78 __u8 data[0];
79}; 79};
80 80
81/* for configuring coalescing parameters of chip */ 81/* for configuring coalescing parameters of chip */
82struct ethtool_coalesce { 82struct ethtool_coalesce {
83 u32 cmd; /* ETHTOOL_{G,S}COALESCE */ 83 __u32 cmd; /* ETHTOOL_{G,S}COALESCE */
84 84
85 /* How many usecs to delay an RX interrupt after 85 /* How many usecs to delay an RX interrupt after
86 * a packet arrives. If 0, only rx_max_coalesced_frames 86 * a packet arrives. If 0, only rx_max_coalesced_frames
87 * is used. 87 * is used.
88 */ 88 */
89 u32 rx_coalesce_usecs; 89 __u32 rx_coalesce_usecs;
90 90
91 /* How many packets to delay an RX interrupt after 91 /* How many packets to delay an RX interrupt after
92 * a packet arrives. If 0, only rx_coalesce_usecs is 92 * a packet arrives. If 0, only rx_coalesce_usecs is
@@ -94,21 +94,21 @@ struct ethtool_coalesce {
94 * to zero as this would cause RX interrupts to never be 94 * to zero as this would cause RX interrupts to never be
95 * generated. 95 * generated.
96 */ 96 */
97 u32 rx_max_coalesced_frames; 97 __u32 rx_max_coalesced_frames;
98 98
99 /* Same as above two parameters, except that these values 99 /* Same as above two parameters, except that these values
100 * apply while an IRQ is being serviced by the host. Not 100 * apply while an IRQ is being serviced by the host. Not
101 * all cards support this feature and the values are ignored 101 * all cards support this feature and the values are ignored
102 * in that case. 102 * in that case.
103 */ 103 */
104 u32 rx_coalesce_usecs_irq; 104 __u32 rx_coalesce_usecs_irq;
105 u32 rx_max_coalesced_frames_irq; 105 __u32 rx_max_coalesced_frames_irq;
106 106
107 /* How many usecs to delay a TX interrupt after 107 /* How many usecs to delay a TX interrupt after
108 * a packet is sent. If 0, only tx_max_coalesced_frames 108 * a packet is sent. If 0, only tx_max_coalesced_frames
109 * is used. 109 * is used.
110 */ 110 */
111 u32 tx_coalesce_usecs; 111 __u32 tx_coalesce_usecs;
112 112
113 /* How many packets to delay a TX interrupt after 113 /* How many packets to delay a TX interrupt after
114 * a packet is sent. If 0, only tx_coalesce_usecs is 114 * a packet is sent. If 0, only tx_coalesce_usecs is
@@ -116,22 +116,22 @@ struct ethtool_coalesce {
116 * to zero as this would cause TX interrupts to never be 116 * to zero as this would cause TX interrupts to never be
117 * generated. 117 * generated.
118 */ 118 */
119 u32 tx_max_coalesced_frames; 119 __u32 tx_max_coalesced_frames;
120 120
121 /* Same as above two parameters, except that these values 121 /* Same as above two parameters, except that these values
122 * apply while an IRQ is being serviced by the host. Not 122 * apply while an IRQ is being serviced by the host. Not
123 * all cards support this feature and the values are ignored 123 * all cards support this feature and the values are ignored
124 * in that case. 124 * in that case.
125 */ 125 */
126 u32 tx_coalesce_usecs_irq; 126 __u32 tx_coalesce_usecs_irq;
127 u32 tx_max_coalesced_frames_irq; 127 __u32 tx_max_coalesced_frames_irq;
128 128
129 /* How many usecs to delay in-memory statistics 129 /* How many usecs to delay in-memory statistics
130 * block updates. Some drivers do not have an in-memory 130 * block updates. Some drivers do not have an in-memory
131 * statistic block, and in such cases this value is ignored. 131 * statistic block, and in such cases this value is ignored.
132 * This value must not be zero. 132 * This value must not be zero.
133 */ 133 */
134 u32 stats_block_coalesce_usecs; 134 __u32 stats_block_coalesce_usecs;
135 135
136 /* Adaptive RX/TX coalescing is an algorithm implemented by 136 /* Adaptive RX/TX coalescing is an algorithm implemented by
137 * some drivers to improve latency under low packet rates and 137 * some drivers to improve latency under low packet rates and
@@ -140,18 +140,18 @@ struct ethtool_coalesce {
140 * not implemented by the driver causes these values to be 140 * not implemented by the driver causes these values to be
141 * silently ignored. 141 * silently ignored.
142 */ 142 */
143 u32 use_adaptive_rx_coalesce; 143 __u32 use_adaptive_rx_coalesce;
144 u32 use_adaptive_tx_coalesce; 144 __u32 use_adaptive_tx_coalesce;
145 145
146 /* When the packet rate (measured in packets per second) 146 /* When the packet rate (measured in packets per second)
147 * is below pkt_rate_low, the {rx,tx}_*_low parameters are 147 * is below pkt_rate_low, the {rx,tx}_*_low parameters are
148 * used. 148 * used.
149 */ 149 */
150 u32 pkt_rate_low; 150 __u32 pkt_rate_low;
151 u32 rx_coalesce_usecs_low; 151 __u32 rx_coalesce_usecs_low;
152 u32 rx_max_coalesced_frames_low; 152 __u32 rx_max_coalesced_frames_low;
153 u32 tx_coalesce_usecs_low; 153 __u32 tx_coalesce_usecs_low;
154 u32 tx_max_coalesced_frames_low; 154 __u32 tx_max_coalesced_frames_low;
155 155
156 /* When the packet rate is below pkt_rate_high but above 156 /* When the packet rate is below pkt_rate_high but above
157 * pkt_rate_low (both measured in packets per second) the 157 * pkt_rate_low (both measured in packets per second) the
@@ -162,43 +162,43 @@ struct ethtool_coalesce {
162 * is above pkt_rate_high, the {rx,tx}_*_high parameters are 162 * is above pkt_rate_high, the {rx,tx}_*_high parameters are
163 * used. 163 * used.
164 */ 164 */
165 u32 pkt_rate_high; 165 __u32 pkt_rate_high;
166 u32 rx_coalesce_usecs_high; 166 __u32 rx_coalesce_usecs_high;
167 u32 rx_max_coalesced_frames_high; 167 __u32 rx_max_coalesced_frames_high;
168 u32 tx_coalesce_usecs_high; 168 __u32 tx_coalesce_usecs_high;
169 u32 tx_max_coalesced_frames_high; 169 __u32 tx_max_coalesced_frames_high;
170 170
171 /* How often to do adaptive coalescing packet rate sampling, 171 /* How often to do adaptive coalescing packet rate sampling,
172 * measured in seconds. Must not be zero. 172 * measured in seconds. Must not be zero.
173 */ 173 */
174 u32 rate_sample_interval; 174 __u32 rate_sample_interval;
175}; 175};
176 176
177/* for configuring RX/TX ring parameters */ 177/* for configuring RX/TX ring parameters */
178struct ethtool_ringparam { 178struct ethtool_ringparam {
179 u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ 179 __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */
180 180
181 /* Read only attributes. These indicate the maximum number 181 /* Read only attributes. These indicate the maximum number
182 * of pending RX/TX ring entries the driver will allow the 182 * of pending RX/TX ring entries the driver will allow the
183 * user to set. 183 * user to set.
184 */ 184 */
185 u32 rx_max_pending; 185 __u32 rx_max_pending;
186 u32 rx_mini_max_pending; 186 __u32 rx_mini_max_pending;
187 u32 rx_jumbo_max_pending; 187 __u32 rx_jumbo_max_pending;
188 u32 tx_max_pending; 188 __u32 tx_max_pending;
189 189
190 /* Values changeable by the user. The valid values are 190 /* Values changeable by the user. The valid values are
191 * in the range 1 to the "*_max_pending" counterpart above. 191 * in the range 1 to the "*_max_pending" counterpart above.
192 */ 192 */
193 u32 rx_pending; 193 __u32 rx_pending;
194 u32 rx_mini_pending; 194 __u32 rx_mini_pending;
195 u32 rx_jumbo_pending; 195 __u32 rx_jumbo_pending;
196 u32 tx_pending; 196 __u32 tx_pending;
197}; 197};
198 198
199/* for configuring link flow control parameters */ 199/* for configuring link flow control parameters */
200struct ethtool_pauseparam { 200struct ethtool_pauseparam {
201 u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ 201 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
202 202
203 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg 203 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
204 * being true) the user may set 'autonet' here non-zero to have the 204 * being true) the user may set 'autonet' here non-zero to have the
@@ -210,9 +210,9 @@ struct ethtool_pauseparam {
210 * then {rx,tx}_pause force the driver to use/not-use pause 210 * then {rx,tx}_pause force the driver to use/not-use pause
211 * flow control. 211 * flow control.
212 */ 212 */
213 u32 autoneg; 213 __u32 autoneg;
214 u32 rx_pause; 214 __u32 rx_pause;
215 u32 tx_pause; 215 __u32 tx_pause;
216}; 216};
217 217
218#define ETH_GSTRING_LEN 32 218#define ETH_GSTRING_LEN 32
@@ -223,10 +223,10 @@ enum ethtool_stringset {
223 223
224/* for passing string sets for data tagging */ 224/* for passing string sets for data tagging */
225struct ethtool_gstrings { 225struct ethtool_gstrings {
226 u32 cmd; /* ETHTOOL_GSTRINGS */ 226 __u32 cmd; /* ETHTOOL_GSTRINGS */
227 u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ 227 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
228 u32 len; /* number of strings in the string set */ 228 __u32 len; /* number of strings in the string set */
229 u8 data[0]; 229 __u8 data[0];
230}; 230};
231 231
232enum ethtool_test_flags { 232enum ethtool_test_flags {
@@ -236,26 +236,28 @@ enum ethtool_test_flags {
236 236
237/* for requesting NIC test and getting results*/ 237/* for requesting NIC test and getting results*/
238struct ethtool_test { 238struct ethtool_test {
239 u32 cmd; /* ETHTOOL_TEST */ 239 __u32 cmd; /* ETHTOOL_TEST */
240 u32 flags; /* ETH_TEST_FL_xxx */ 240 __u32 flags; /* ETH_TEST_FL_xxx */
241 u32 reserved; 241 __u32 reserved;
242 u32 len; /* result length, in number of u64 elements */ 242 __u32 len; /* result length, in number of u64 elements */
243 u64 data[0]; 243 __u64 data[0];
244}; 244};
245 245
246/* for dumping NIC-specific statistics */ 246/* for dumping NIC-specific statistics */
247struct ethtool_stats { 247struct ethtool_stats {
248 u32 cmd; /* ETHTOOL_GSTATS */ 248 __u32 cmd; /* ETHTOOL_GSTATS */
249 u32 n_stats; /* number of u64's being returned */ 249 __u32 n_stats; /* number of u64's being returned */
250 u64 data[0]; 250 __u64 data[0];
251}; 251};
252 252
253struct ethtool_perm_addr { 253struct ethtool_perm_addr {
254 u32 cmd; /* ETHTOOL_GPERMADDR */ 254 __u32 cmd; /* ETHTOOL_GPERMADDR */
255 u32 size; 255 __u32 size;
256 u8 data[0]; 256 __u8 data[0];
257}; 257};
258 258
259#ifdef __KERNEL__
260
259struct net_device; 261struct net_device;
260 262
261/* Some generic methods drivers may use in their ethtool_ops */ 263/* Some generic methods drivers may use in their ethtool_ops */
@@ -371,6 +373,7 @@ struct ethtool_ops {
371 u32 (*get_ufo)(struct net_device *); 373 u32 (*get_ufo)(struct net_device *);
372 int (*set_ufo)(struct net_device *, u32); 374 int (*set_ufo)(struct net_device *, u32);
373}; 375};
376#endif /* __KERNEL__ */
374 377
375/* CMDs currently supported */ 378/* CMDs currently supported */
376#define ETHTOOL_GSET 0x00000001 /* Get settings. */ 379#define ETHTOOL_GSET 0x00000001 /* Get settings. */
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 68f5a0f392dd..beddc6d3b0f6 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -9,7 +9,6 @@
9#define __LINUX_MII_H__ 9#define __LINUX_MII_H__
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/if.h>
13 12
14/* Generic MII registers. */ 13/* Generic MII registers. */
15 14
@@ -136,6 +135,20 @@
136#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ 135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
137#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ 136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
138 137
138/* This structure is used in all SIOCxMIIxxx ioctl calls */
139struct mii_ioctl_data {
140 __u16 phy_id;
141 __u16 reg_num;
142 __u16 val_in;
143 __u16 val_out;
144};
145
146#ifdef __KERNEL__
147
148#include <linux/if.h>
149
150struct ethtool_cmd;
151
139struct mii_if_info { 152struct mii_if_info {
140 int phy_id; 153 int phy_id;
141 int advertising; 154 int advertising;
@@ -151,9 +164,6 @@ struct mii_if_info {
151 void (*mdio_write) (struct net_device *dev, int phy_id, int location, int val); 164 void (*mdio_write) (struct net_device *dev, int phy_id, int location, int val);
152}; 165};
153 166
154struct ethtool_cmd;
155struct mii_ioctl_data;
156
157extern int mii_link_ok (struct mii_if_info *mii); 167extern int mii_link_ok (struct mii_if_info *mii);
158extern int mii_nway_restart (struct mii_if_info *mii); 168extern int mii_nway_restart (struct mii_if_info *mii);
159extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); 169extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
@@ -168,16 +178,6 @@ extern int generic_mii_ioctl(struct mii_if_info *mii_if,
168 unsigned int *duplex_changed); 178 unsigned int *duplex_changed);
169 179
170 180
171
172/* This structure is used in all SIOCxMIIxxx ioctl calls */
173struct mii_ioctl_data {
174 u16 phy_id;
175 u16 reg_num;
176 u16 val_in;
177 u16 val_out;
178};
179
180
181static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) 181static inline struct mii_ioctl_data *if_mii(struct ifreq *rq)
182{ 182{
183 return (struct mii_ioctl_data *) &rq->ifr_ifru; 183 return (struct mii_ioctl_data *) &rq->ifr_ifru;
@@ -235,5 +235,5 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
235 return 0; 235 return 0;
236} 236}
237 237
238 238#endif /* __KERNEL__ */
239#endif /* __LINUX_MII_H__ */ 239#endif /* __LINUX_MII_H__ */