]>
Commit | Line | Data |
---|---|---|
c4e84bde RM |
1 | #include <linux/kernel.h> |
2 | #include <linux/init.h> | |
3 | #include <linux/types.h> | |
4 | #include <linux/module.h> | |
5 | #include <linux/list.h> | |
6 | #include <linux/pci.h> | |
7 | #include <linux/dma-mapping.h> | |
8 | #include <linux/pagemap.h> | |
9 | #include <linux/sched.h> | |
10 | #include <linux/slab.h> | |
11 | #include <linux/dmapool.h> | |
12 | #include <linux/mempool.h> | |
13 | #include <linux/spinlock.h> | |
14 | #include <linux/kthread.h> | |
15 | #include <linux/interrupt.h> | |
16 | #include <linux/errno.h> | |
17 | #include <linux/ioport.h> | |
18 | #include <linux/in.h> | |
19 | #include <linux/ip.h> | |
20 | #include <linux/ipv6.h> | |
21 | #include <net/ipv6.h> | |
22 | #include <linux/tcp.h> | |
23 | #include <linux/udp.h> | |
24 | #include <linux/if_arp.h> | |
25 | #include <linux/if_ether.h> | |
26 | #include <linux/netdevice.h> | |
27 | #include <linux/etherdevice.h> | |
28 | #include <linux/ethtool.h> | |
29 | #include <linux/skbuff.h> | |
30 | #include <linux/rtnetlink.h> | |
31 | #include <linux/if_vlan.h> | |
c4e84bde RM |
32 | #include <linux/delay.h> |
33 | #include <linux/mm.h> | |
34 | #include <linux/vmalloc.h> | |
35 | ||
c4e84bde RM |
36 | |
37 | #include "qlge.h" | |
38 | ||
39 | static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |
40 | { | |
41 | int i, status = 0; | |
42 | struct rx_ring *rx_ring; | |
43 | struct cqicb *cqicb; | |
44 | ||
45 | if (!netif_running(qdev->ndev)) | |
46 | return status; | |
47 | ||
c4e84bde RM |
48 | /* Skip the default queue, and update the outbound handler |
49 | * queues if they changed. | |
50 | */ | |
b2014ff8 | 51 | cqicb = (struct cqicb *)&qdev->rx_ring[qdev->rss_ring_count]; |
c4e84bde | 52 | if (le16_to_cpu(cqicb->irq_delay) != qdev->tx_coalesce_usecs || |
b2014ff8 RM |
53 | le16_to_cpu(cqicb->pkt_delay) != |
54 | qdev->tx_max_coalesced_frames) { | |
55 | for (i = qdev->rss_ring_count; i < qdev->rx_ring_count; i++) { | |
c4e84bde RM |
56 | rx_ring = &qdev->rx_ring[i]; |
57 | cqicb = (struct cqicb *)rx_ring; | |
8306c952 | 58 | cqicb->irq_delay = cpu_to_le16(qdev->tx_coalesce_usecs); |
c4e84bde | 59 | cqicb->pkt_delay = |
8306c952 | 60 | cpu_to_le16(qdev->tx_max_coalesced_frames); |
c4e84bde | 61 | cqicb->flags = FLAGS_LI; |
e332471c | 62 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
c4e84bde RM |
63 | CFG_LCQ, rx_ring->cq_id); |
64 | if (status) { | |
65 | QPRINTK(qdev, IFUP, ERR, | |
66 | "Failed to load CQICB.\n"); | |
67 | goto exit; | |
68 | } | |
69 | } | |
70 | } | |
71 | ||
72 | /* Update the inbound (RSS) handler queues if they changed. */ | |
b2014ff8 | 73 | cqicb = (struct cqicb *)&qdev->rx_ring[0]; |
c4e84bde | 74 | if (le16_to_cpu(cqicb->irq_delay) != qdev->rx_coalesce_usecs || |
b2014ff8 RM |
75 | le16_to_cpu(cqicb->pkt_delay) != |
76 | qdev->rx_max_coalesced_frames) { | |
77 | for (i = 0; i < qdev->rss_ring_count; i++, rx_ring++) { | |
c4e84bde RM |
78 | rx_ring = &qdev->rx_ring[i]; |
79 | cqicb = (struct cqicb *)rx_ring; | |
8306c952 | 80 | cqicb->irq_delay = cpu_to_le16(qdev->rx_coalesce_usecs); |
c4e84bde | 81 | cqicb->pkt_delay = |
8306c952 | 82 | cpu_to_le16(qdev->rx_max_coalesced_frames); |
c4e84bde | 83 | cqicb->flags = FLAGS_LI; |
e332471c | 84 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
c4e84bde RM |
85 | CFG_LCQ, rx_ring->cq_id); |
86 | if (status) { | |
87 | QPRINTK(qdev, IFUP, ERR, | |
88 | "Failed to load CQICB.\n"); | |
89 | goto exit; | |
90 | } | |
91 | } | |
92 | } | |
93 | exit: | |
c4e84bde RM |
94 | return status; |
95 | } | |
96 | ||
2f22d22e | 97 | static void ql_update_stats(struct ql_adapter *qdev) |
c4e84bde RM |
98 | { |
99 | u32 i; | |
100 | u64 data; | |
101 | u64 *iter = &qdev->nic_stats.tx_pkts; | |
102 | ||
103 | spin_lock(&qdev->stats_lock); | |
104 | if (ql_sem_spinlock(qdev, qdev->xg_sem_mask)) { | |
105 | QPRINTK(qdev, DRV, ERR, | |
106 | "Couldn't get xgmac sem.\n"); | |
107 | goto quit; | |
108 | } | |
109 | /* | |
110 | * Get TX statistics. | |
111 | */ | |
112 | for (i = 0x200; i < 0x280; i += 8) { | |
113 | if (ql_read_xgmac_reg64(qdev, i, &data)) { | |
114 | QPRINTK(qdev, DRV, ERR, | |
115 | "Error reading status register 0x%.04x.\n", i); | |
116 | goto end; | |
117 | } else | |
118 | *iter = data; | |
119 | iter++; | |
120 | } | |
121 | ||
122 | /* | |
123 | * Get RX statistics. | |
124 | */ | |
125 | for (i = 0x300; i < 0x3d0; i += 8) { | |
126 | if (ql_read_xgmac_reg64(qdev, i, &data)) { | |
127 | QPRINTK(qdev, DRV, ERR, | |
128 | "Error reading status register 0x%.04x.\n", i); | |
129 | goto end; | |
130 | } else | |
131 | *iter = data; | |
132 | iter++; | |
133 | } | |
134 | ||
6abd2346 RM |
135 | /* |
136 | * Get Per-priority TX pause frame counter statistics. | |
137 | */ | |
138 | for (i = 0x500; i < 0x540; i += 8) { | |
139 | if (ql_read_xgmac_reg64(qdev, i, &data)) { | |
140 | QPRINTK(qdev, DRV, ERR, | |
141 | "Error reading status register 0x%.04x.\n", i); | |
142 | goto end; | |
143 | } else | |
144 | *iter = data; | |
145 | iter++; | |
146 | } | |
147 | ||
148 | /* | |
149 | * Get Per-priority RX pause frame counter statistics. | |
150 | */ | |
151 | for (i = 0x568; i < 0x5a8; i += 8) { | |
152 | if (ql_read_xgmac_reg64(qdev, i, &data)) { | |
153 | QPRINTK(qdev, DRV, ERR, | |
154 | "Error reading status register 0x%.04x.\n", i); | |
155 | goto end; | |
156 | } else | |
157 | *iter = data; | |
158 | iter++; | |
159 | } | |
160 | ||
161 | /* | |
162 | * Get RX NIC FIFO DROP statistics. | |
163 | */ | |
164 | if (ql_read_xgmac_reg64(qdev, 0x5b8, &data)) { | |
165 | QPRINTK(qdev, DRV, ERR, | |
166 | "Error reading status register 0x%.04x.\n", i); | |
167 | goto end; | |
168 | } else | |
169 | *iter = data; | |
c4e84bde RM |
170 | end: |
171 | ql_sem_unlock(qdev, qdev->xg_sem_mask); | |
172 | quit: | |
173 | spin_unlock(&qdev->stats_lock); | |
174 | ||
175 | QL_DUMP_STAT(qdev); | |
176 | ||
177 | return; | |
178 | } | |
179 | ||
180 | static char ql_stats_str_arr[][ETH_GSTRING_LEN] = { | |
181 | {"tx_pkts"}, | |
182 | {"tx_bytes"}, | |
183 | {"tx_mcast_pkts"}, | |
184 | {"tx_bcast_pkts"}, | |
185 | {"tx_ucast_pkts"}, | |
186 | {"tx_ctl_pkts"}, | |
187 | {"tx_pause_pkts"}, | |
188 | {"tx_64_pkts"}, | |
189 | {"tx_65_to_127_pkts"}, | |
190 | {"tx_128_to_255_pkts"}, | |
191 | {"tx_256_511_pkts"}, | |
192 | {"tx_512_to_1023_pkts"}, | |
193 | {"tx_1024_to_1518_pkts"}, | |
194 | {"tx_1519_to_max_pkts"}, | |
195 | {"tx_undersize_pkts"}, | |
196 | {"tx_oversize_pkts"}, | |
197 | {"rx_bytes"}, | |
198 | {"rx_bytes_ok"}, | |
199 | {"rx_pkts"}, | |
200 | {"rx_pkts_ok"}, | |
201 | {"rx_bcast_pkts"}, | |
202 | {"rx_mcast_pkts"}, | |
203 | {"rx_ucast_pkts"}, | |
204 | {"rx_undersize_pkts"}, | |
205 | {"rx_oversize_pkts"}, | |
206 | {"rx_jabber_pkts"}, | |
207 | {"rx_undersize_fcerr_pkts"}, | |
208 | {"rx_drop_events"}, | |
209 | {"rx_fcerr_pkts"}, | |
210 | {"rx_align_err"}, | |
211 | {"rx_symbol_err"}, | |
212 | {"rx_mac_err"}, | |
213 | {"rx_ctl_pkts"}, | |
214 | {"rx_pause_pkts"}, | |
215 | {"rx_64_pkts"}, | |
216 | {"rx_65_to_127_pkts"}, | |
217 | {"rx_128_255_pkts"}, | |
218 | {"rx_256_511_pkts"}, | |
219 | {"rx_512_to_1023_pkts"}, | |
220 | {"rx_1024_to_1518_pkts"}, | |
221 | {"rx_1519_to_max_pkts"}, | |
222 | {"rx_len_err_pkts"}, | |
6abd2346 RM |
223 | {"tx_cbfc_pause_frames0"}, |
224 | {"tx_cbfc_pause_frames1"}, | |
225 | {"tx_cbfc_pause_frames2"}, | |
226 | {"tx_cbfc_pause_frames3"}, | |
227 | {"tx_cbfc_pause_frames4"}, | |
228 | {"tx_cbfc_pause_frames5"}, | |
229 | {"tx_cbfc_pause_frames6"}, | |
230 | {"tx_cbfc_pause_frames7"}, | |
231 | {"rx_cbfc_pause_frames0"}, | |
232 | {"rx_cbfc_pause_frames1"}, | |
233 | {"rx_cbfc_pause_frames2"}, | |
234 | {"rx_cbfc_pause_frames3"}, | |
235 | {"rx_cbfc_pause_frames4"}, | |
236 | {"rx_cbfc_pause_frames5"}, | |
237 | {"rx_cbfc_pause_frames6"}, | |
238 | {"rx_cbfc_pause_frames7"}, | |
239 | {"rx_nic_fifo_drop"}, | |
c4e84bde RM |
240 | }; |
241 | ||
242 | static void ql_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | |
243 | { | |
244 | switch (stringset) { | |
245 | case ETH_SS_STATS: | |
246 | memcpy(buf, ql_stats_str_arr, sizeof(ql_stats_str_arr)); | |
247 | break; | |
248 | } | |
249 | } | |
250 | ||
251 | static int ql_get_sset_count(struct net_device *dev, int sset) | |
252 | { | |
253 | switch (sset) { | |
254 | case ETH_SS_STATS: | |
255 | return ARRAY_SIZE(ql_stats_str_arr); | |
256 | default: | |
257 | return -EOPNOTSUPP; | |
258 | } | |
259 | } | |
260 | ||
261 | static void | |
262 | ql_get_ethtool_stats(struct net_device *ndev, | |
263 | struct ethtool_stats *stats, u64 *data) | |
264 | { | |
265 | struct ql_adapter *qdev = netdev_priv(ndev); | |
266 | struct nic_stats *s = &qdev->nic_stats; | |
267 | ||
268 | ql_update_stats(qdev); | |
269 | ||
270 | *data++ = s->tx_pkts; | |
271 | *data++ = s->tx_bytes; | |
272 | *data++ = s->tx_mcast_pkts; | |
273 | *data++ = s->tx_bcast_pkts; | |
274 | *data++ = s->tx_ucast_pkts; | |
275 | *data++ = s->tx_ctl_pkts; | |
276 | *data++ = s->tx_pause_pkts; | |
277 | *data++ = s->tx_64_pkt; | |
278 | *data++ = s->tx_65_to_127_pkt; | |
279 | *data++ = s->tx_128_to_255_pkt; | |
280 | *data++ = s->tx_256_511_pkt; | |
281 | *data++ = s->tx_512_to_1023_pkt; | |
282 | *data++ = s->tx_1024_to_1518_pkt; | |
283 | *data++ = s->tx_1519_to_max_pkt; | |
284 | *data++ = s->tx_undersize_pkt; | |
285 | *data++ = s->tx_oversize_pkt; | |
286 | *data++ = s->rx_bytes; | |
287 | *data++ = s->rx_bytes_ok; | |
288 | *data++ = s->rx_pkts; | |
289 | *data++ = s->rx_pkts_ok; | |
290 | *data++ = s->rx_bcast_pkts; | |
291 | *data++ = s->rx_mcast_pkts; | |
292 | *data++ = s->rx_ucast_pkts; | |
293 | *data++ = s->rx_undersize_pkts; | |
294 | *data++ = s->rx_oversize_pkts; | |
295 | *data++ = s->rx_jabber_pkts; | |
296 | *data++ = s->rx_undersize_fcerr_pkts; | |
297 | *data++ = s->rx_drop_events; | |
298 | *data++ = s->rx_fcerr_pkts; | |
299 | *data++ = s->rx_align_err; | |
300 | *data++ = s->rx_symbol_err; | |
301 | *data++ = s->rx_mac_err; | |
302 | *data++ = s->rx_ctl_pkts; | |
303 | *data++ = s->rx_pause_pkts; | |
304 | *data++ = s->rx_64_pkts; | |
305 | *data++ = s->rx_65_to_127_pkts; | |
306 | *data++ = s->rx_128_255_pkts; | |
307 | *data++ = s->rx_256_511_pkts; | |
308 | *data++ = s->rx_512_to_1023_pkts; | |
309 | *data++ = s->rx_1024_to_1518_pkts; | |
310 | *data++ = s->rx_1519_to_max_pkts; | |
311 | *data++ = s->rx_len_err_pkts; | |
6abd2346 RM |
312 | *data++ = s->tx_cbfc_pause_frames0; |
313 | *data++ = s->tx_cbfc_pause_frames1; | |
314 | *data++ = s->tx_cbfc_pause_frames2; | |
315 | *data++ = s->tx_cbfc_pause_frames3; | |
316 | *data++ = s->tx_cbfc_pause_frames4; | |
317 | *data++ = s->tx_cbfc_pause_frames5; | |
318 | *data++ = s->tx_cbfc_pause_frames6; | |
319 | *data++ = s->tx_cbfc_pause_frames7; | |
320 | *data++ = s->rx_cbfc_pause_frames0; | |
321 | *data++ = s->rx_cbfc_pause_frames1; | |
322 | *data++ = s->rx_cbfc_pause_frames2; | |
323 | *data++ = s->rx_cbfc_pause_frames3; | |
324 | *data++ = s->rx_cbfc_pause_frames4; | |
325 | *data++ = s->rx_cbfc_pause_frames5; | |
326 | *data++ = s->rx_cbfc_pause_frames6; | |
327 | *data++ = s->rx_cbfc_pause_frames7; | |
328 | *data++ = s->rx_nic_fifo_drop; | |
c4e84bde RM |
329 | } |
330 | ||
331 | static int ql_get_settings(struct net_device *ndev, | |
332 | struct ethtool_cmd *ecmd) | |
333 | { | |
334 | struct ql_adapter *qdev = netdev_priv(ndev); | |
335 | ||
336 | ecmd->supported = SUPPORTED_10000baseT_Full; | |
337 | ecmd->advertising = ADVERTISED_10000baseT_Full; | |
338 | ecmd->autoneg = AUTONEG_ENABLE; | |
339 | ecmd->transceiver = XCVR_EXTERNAL; | |
b82808b7 RM |
340 | if ((qdev->link_status & STS_LINK_TYPE_MASK) == |
341 | STS_LINK_TYPE_10GBASET) { | |
c4e84bde RM |
342 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); |
343 | ecmd->advertising |= (ADVERTISED_TP | ADVERTISED_Autoneg); | |
344 | ecmd->port = PORT_TP; | |
345 | } else { | |
346 | ecmd->supported |= SUPPORTED_FIBRE; | |
347 | ecmd->advertising |= ADVERTISED_FIBRE; | |
348 | ecmd->port = PORT_FIBRE; | |
349 | } | |
350 | ||
351 | ecmd->speed = SPEED_10000; | |
352 | ecmd->duplex = DUPLEX_FULL; | |
353 | ||
354 | return 0; | |
355 | } | |
356 | ||
357 | static void ql_get_drvinfo(struct net_device *ndev, | |
358 | struct ethtool_drvinfo *drvinfo) | |
359 | { | |
360 | struct ql_adapter *qdev = netdev_priv(ndev); | |
361 | strncpy(drvinfo->driver, qlge_driver_name, 32); | |
362 | strncpy(drvinfo->version, qlge_driver_version, 32); | |
cfec0cbc RM |
363 | snprintf(drvinfo->fw_version, 32, "v%d.%d.%d", |
364 | (qdev->fw_rev_id & 0x00ff0000) >> 16, | |
365 | (qdev->fw_rev_id & 0x0000ff00) >> 8, | |
366 | (qdev->fw_rev_id & 0x000000ff)); | |
c4e84bde RM |
367 | strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); |
368 | drvinfo->n_stats = 0; | |
369 | drvinfo->testinfo_len = 0; | |
370 | drvinfo->regdump_len = 0; | |
371 | drvinfo->eedump_len = 0; | |
372 | } | |
373 | ||
d8eb59dc RM |
374 | |
375 | static int ql_phys_id(struct net_device *ndev, u32 data) | |
376 | { | |
377 | struct ql_adapter *qdev = netdev_priv(ndev); | |
378 | u32 led_reg, i; | |
379 | int status; | |
380 | ||
381 | /* Save the current LED settings */ | |
382 | status = ql_mb_get_led_cfg(qdev); | |
383 | if (status) | |
384 | return status; | |
385 | led_reg = qdev->led_config; | |
386 | ||
387 | /* Start blinking the led */ | |
388 | if (!data || data > 300) | |
389 | data = 300; | |
390 | ||
391 | for (i = 0; i < (data * 10); i++) | |
392 | ql_mb_set_led_cfg(qdev, QL_LED_BLINK); | |
393 | ||
394 | /* Restore LED settings */ | |
395 | status = ql_mb_set_led_cfg(qdev, led_reg); | |
396 | if (status) | |
397 | return status; | |
398 | ||
399 | return 0; | |
400 | } | |
c4e84bde RM |
401 | static int ql_get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) |
402 | { | |
403 | struct ql_adapter *qdev = netdev_priv(dev); | |
404 | ||
405 | c->rx_coalesce_usecs = qdev->rx_coalesce_usecs; | |
406 | c->tx_coalesce_usecs = qdev->tx_coalesce_usecs; | |
407 | ||
408 | /* This chip coalesces as follows: | |
409 | * If a packet arrives, hold off interrupts until | |
410 | * cqicb->int_delay expires, but if no other packets arrive don't | |
411 | * wait longer than cqicb->pkt_int_delay. But ethtool doesn't use a | |
412 | * timer to coalesce on a frame basis. So, we have to take ethtool's | |
413 | * max_coalesced_frames value and convert it to a delay in microseconds. | |
414 | * We do this by using a basic thoughput of 1,000,000 frames per | |
415 | * second @ (1024 bytes). This means one frame per usec. So it's a | |
416 | * simple one to one ratio. | |
417 | */ | |
418 | c->rx_max_coalesced_frames = qdev->rx_max_coalesced_frames; | |
419 | c->tx_max_coalesced_frames = qdev->tx_max_coalesced_frames; | |
420 | ||
421 | return 0; | |
422 | } | |
423 | ||
424 | static int ql_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *c) | |
425 | { | |
426 | struct ql_adapter *qdev = netdev_priv(ndev); | |
427 | ||
428 | /* Validate user parameters. */ | |
429 | if (c->rx_coalesce_usecs > qdev->rx_ring_size / 2) | |
430 | return -EINVAL; | |
431 | /* Don't wait more than 10 usec. */ | |
432 | if (c->rx_max_coalesced_frames > MAX_INTER_FRAME_WAIT) | |
433 | return -EINVAL; | |
434 | if (c->tx_coalesce_usecs > qdev->tx_ring_size / 2) | |
435 | return -EINVAL; | |
436 | if (c->tx_max_coalesced_frames > MAX_INTER_FRAME_WAIT) | |
437 | return -EINVAL; | |
438 | ||
439 | /* Verify a change took place before updating the hardware. */ | |
440 | if (qdev->rx_coalesce_usecs == c->rx_coalesce_usecs && | |
441 | qdev->tx_coalesce_usecs == c->tx_coalesce_usecs && | |
442 | qdev->rx_max_coalesced_frames == c->rx_max_coalesced_frames && | |
443 | qdev->tx_max_coalesced_frames == c->tx_max_coalesced_frames) | |
444 | return 0; | |
445 | ||
446 | qdev->rx_coalesce_usecs = c->rx_coalesce_usecs; | |
447 | qdev->tx_coalesce_usecs = c->tx_coalesce_usecs; | |
448 | qdev->rx_max_coalesced_frames = c->rx_max_coalesced_frames; | |
449 | qdev->tx_max_coalesced_frames = c->tx_max_coalesced_frames; | |
450 | ||
451 | return ql_update_ring_coalescing(qdev); | |
452 | } | |
453 | ||
1d30df24 RM |
454 | static void ql_get_pauseparam(struct net_device *netdev, |
455 | struct ethtool_pauseparam *pause) | |
456 | { | |
457 | struct ql_adapter *qdev = netdev_priv(netdev); | |
458 | ||
459 | ql_mb_get_port_cfg(qdev); | |
460 | if (qdev->link_config & CFG_PAUSE_STD) { | |
461 | pause->rx_pause = 1; | |
462 | pause->tx_pause = 1; | |
463 | } | |
464 | } | |
465 | ||
466 | static int ql_set_pauseparam(struct net_device *netdev, | |
467 | struct ethtool_pauseparam *pause) | |
468 | { | |
469 | struct ql_adapter *qdev = netdev_priv(netdev); | |
470 | int status = 0; | |
471 | ||
472 | if ((pause->rx_pause) && (pause->tx_pause)) | |
473 | qdev->link_config |= CFG_PAUSE_STD; | |
474 | else if (!pause->rx_pause && !pause->tx_pause) | |
475 | qdev->link_config &= ~CFG_PAUSE_STD; | |
476 | else | |
477 | return -EINVAL; | |
478 | ||
479 | status = ql_mb_set_port_cfg(qdev); | |
480 | if (status) | |
481 | return status; | |
482 | return status; | |
483 | } | |
484 | ||
c4e84bde RM |
485 | static u32 ql_get_rx_csum(struct net_device *netdev) |
486 | { | |
487 | struct ql_adapter *qdev = netdev_priv(netdev); | |
488 | return qdev->rx_csum; | |
489 | } | |
490 | ||
491 | static int ql_set_rx_csum(struct net_device *netdev, uint32_t data) | |
492 | { | |
493 | struct ql_adapter *qdev = netdev_priv(netdev); | |
494 | qdev->rx_csum = data; | |
495 | return 0; | |
496 | } | |
497 | ||
498 | static int ql_set_tso(struct net_device *ndev, uint32_t data) | |
499 | { | |
500 | ||
501 | if (data) { | |
502 | ndev->features |= NETIF_F_TSO; | |
503 | ndev->features |= NETIF_F_TSO6; | |
504 | } else { | |
505 | ndev->features &= ~NETIF_F_TSO; | |
506 | ndev->features &= ~NETIF_F_TSO6; | |
507 | } | |
508 | return 0; | |
509 | } | |
510 | ||
511 | static u32 ql_get_msglevel(struct net_device *ndev) | |
512 | { | |
513 | struct ql_adapter *qdev = netdev_priv(ndev); | |
514 | return qdev->msg_enable; | |
515 | } | |
516 | ||
517 | static void ql_set_msglevel(struct net_device *ndev, u32 value) | |
518 | { | |
519 | struct ql_adapter *qdev = netdev_priv(ndev); | |
520 | qdev->msg_enable = value; | |
521 | } | |
522 | ||
523 | const struct ethtool_ops qlge_ethtool_ops = { | |
524 | .get_settings = ql_get_settings, | |
525 | .get_drvinfo = ql_get_drvinfo, | |
526 | .get_msglevel = ql_get_msglevel, | |
527 | .set_msglevel = ql_set_msglevel, | |
528 | .get_link = ethtool_op_get_link, | |
d8eb59dc | 529 | .phys_id = ql_phys_id, |
1d30df24 RM |
530 | .get_pauseparam = ql_get_pauseparam, |
531 | .set_pauseparam = ql_set_pauseparam, | |
c4e84bde RM |
532 | .get_rx_csum = ql_get_rx_csum, |
533 | .set_rx_csum = ql_set_rx_csum, | |
534 | .get_tx_csum = ethtool_op_get_tx_csum, | |
00acd0d2 | 535 | .set_tx_csum = ethtool_op_set_tx_csum, |
c4e84bde RM |
536 | .get_sg = ethtool_op_get_sg, |
537 | .set_sg = ethtool_op_set_sg, | |
538 | .get_tso = ethtool_op_get_tso, | |
539 | .set_tso = ql_set_tso, | |
540 | .get_coalesce = ql_get_coalesce, | |
541 | .set_coalesce = ql_set_coalesce, | |
542 | .get_sset_count = ql_get_sset_count, | |
543 | .get_strings = ql_get_strings, | |
544 | .get_ethtool_stats = ql_get_ethtool_stats, | |
545 | }; | |
546 |