]> bbs.cooldavid.org Git - net-next-2.6.git/blob - drivers/net/benet/be_ethtool.c
be2net: ethtool self test reorganization.
[net-next-2.6.git] / drivers / net / benet / be_ethtool.c
1 /*
2  * Copyright (C) 2005 - 2009 ServerEngines
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License version 2
7  * as published by the Free Software Foundation.  The full GNU General
8  * Public License is included in this distribution in the file called COPYING.
9  *
10  * Contact Information:
11  * linux-drivers@serverengines.com
12  *
13  * ServerEngines
14  * 209 N. Fair Oaks Ave
15  * Sunnyvale, CA 94085
16  */
17
18 #include "be.h"
19 #include "be_cmds.h"
20 #include <linux/ethtool.h>
21
22 struct be_ethtool_stat {
23         char desc[ETH_GSTRING_LEN];
24         int type;
25         int size;
26         int offset;
27 };
28
29 enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT, ERXSTAT};
30 #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \
31                                         offsetof(_struct, field)
32 #define NETSTAT_INFO(field)     #field, NETSTAT,\
33                                         FIELDINFO(struct net_device_stats,\
34                                                 field)
35 #define DRVSTAT_INFO(field)     #field, DRVSTAT,\
36                                         FIELDINFO(struct be_drvr_stats, field)
37 #define MISCSTAT_INFO(field)    #field, MISCSTAT,\
38                                         FIELDINFO(struct be_rxf_stats, field)
39 #define PORTSTAT_INFO(field)    #field, PORTSTAT,\
40                                         FIELDINFO(struct be_port_rxf_stats, \
41                                                 field)
42 #define ERXSTAT_INFO(field)     #field, ERXSTAT,\
43                                         FIELDINFO(struct be_erx_stats, field)
44
45 static const struct be_ethtool_stat et_stats[] = {
46         {NETSTAT_INFO(rx_packets)},
47         {NETSTAT_INFO(tx_packets)},
48         {NETSTAT_INFO(rx_bytes)},
49         {NETSTAT_INFO(tx_bytes)},
50         {NETSTAT_INFO(rx_errors)},
51         {NETSTAT_INFO(tx_errors)},
52         {NETSTAT_INFO(rx_dropped)},
53         {NETSTAT_INFO(tx_dropped)},
54         {DRVSTAT_INFO(be_tx_reqs)},
55         {DRVSTAT_INFO(be_tx_stops)},
56         {DRVSTAT_INFO(be_fwd_reqs)},
57         {DRVSTAT_INFO(be_tx_wrbs)},
58         {DRVSTAT_INFO(be_rx_polls)},
59         {DRVSTAT_INFO(be_tx_events)},
60         {DRVSTAT_INFO(be_rx_events)},
61         {DRVSTAT_INFO(be_tx_compl)},
62         {DRVSTAT_INFO(be_rx_compl)},
63         {DRVSTAT_INFO(be_ethrx_post_fail)},
64         {DRVSTAT_INFO(be_802_3_dropped_frames)},
65         {DRVSTAT_INFO(be_802_3_malformed_frames)},
66         {DRVSTAT_INFO(be_tx_rate)},
67         {DRVSTAT_INFO(be_rx_rate)},
68         {PORTSTAT_INFO(rx_unicast_frames)},
69         {PORTSTAT_INFO(rx_multicast_frames)},
70         {PORTSTAT_INFO(rx_broadcast_frames)},
71         {PORTSTAT_INFO(rx_crc_errors)},
72         {PORTSTAT_INFO(rx_alignment_symbol_errors)},
73         {PORTSTAT_INFO(rx_pause_frames)},
74         {PORTSTAT_INFO(rx_control_frames)},
75         {PORTSTAT_INFO(rx_in_range_errors)},
76         {PORTSTAT_INFO(rx_out_range_errors)},
77         {PORTSTAT_INFO(rx_frame_too_long)},
78         {PORTSTAT_INFO(rx_address_match_errors)},
79         {PORTSTAT_INFO(rx_vlan_mismatch)},
80         {PORTSTAT_INFO(rx_dropped_too_small)},
81         {PORTSTAT_INFO(rx_dropped_too_short)},
82         {PORTSTAT_INFO(rx_dropped_header_too_small)},
83         {PORTSTAT_INFO(rx_dropped_tcp_length)},
84         {PORTSTAT_INFO(rx_dropped_runt)},
85         {PORTSTAT_INFO(rx_fifo_overflow)},
86         {PORTSTAT_INFO(rx_input_fifo_overflow)},
87         {PORTSTAT_INFO(rx_ip_checksum_errs)},
88         {PORTSTAT_INFO(rx_tcp_checksum_errs)},
89         {PORTSTAT_INFO(rx_udp_checksum_errs)},
90         {PORTSTAT_INFO(rx_non_rss_packets)},
91         {PORTSTAT_INFO(rx_ipv4_packets)},
92         {PORTSTAT_INFO(rx_ipv6_packets)},
93         {PORTSTAT_INFO(tx_unicastframes)},
94         {PORTSTAT_INFO(tx_multicastframes)},
95         {PORTSTAT_INFO(tx_broadcastframes)},
96         {PORTSTAT_INFO(tx_pauseframes)},
97         {PORTSTAT_INFO(tx_controlframes)},
98         {MISCSTAT_INFO(rx_drops_no_pbuf)},
99         {MISCSTAT_INFO(rx_drops_no_txpb)},
100         {MISCSTAT_INFO(rx_drops_no_erx_descr)},
101         {MISCSTAT_INFO(rx_drops_no_tpre_descr)},
102         {MISCSTAT_INFO(rx_drops_too_many_frags)},
103         {MISCSTAT_INFO(rx_drops_invalid_ring)},
104         {MISCSTAT_INFO(forwarded_packets)},
105         {MISCSTAT_INFO(rx_drops_mtu)},
106         {ERXSTAT_INFO(rx_drops_no_fragments)},
107 };
108 #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
109
110 static const char et_self_tests[][ETH_GSTRING_LEN] = {
111         "MAC Loopback test",
112         "PHY Loopback test",
113         "External Loopback test",
114         "DDR DMA test"
115 };
116
117 #define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
118 #define BE_MAC_LOOPBACK 0x0
119 #define BE_PHY_LOOPBACK 0x1
120 #define BE_ONE_PORT_EXT_LOOPBACK 0x2
121 #define BE_NO_LOOPBACK 0xff
122
123 static void
124 be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
125 {
126         struct be_adapter *adapter = netdev_priv(netdev);
127
128         strcpy(drvinfo->driver, DRV_NAME);
129         strcpy(drvinfo->version, DRV_VER);
130         strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN);
131         strcpy(drvinfo->bus_info, pci_name(adapter->pdev));
132         drvinfo->testinfo_len = 0;
133         drvinfo->regdump_len = 0;
134         drvinfo->eedump_len = 0;
135 }
136
137 static int
138 be_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
139 {
140         struct be_adapter *adapter = netdev_priv(netdev);
141         struct be_eq_obj *rx_eq = &adapter->rx_eq;
142         struct be_eq_obj *tx_eq = &adapter->tx_eq;
143
144         coalesce->rx_coalesce_usecs = rx_eq->cur_eqd;
145         coalesce->rx_coalesce_usecs_high = rx_eq->max_eqd;
146         coalesce->rx_coalesce_usecs_low = rx_eq->min_eqd;
147
148         coalesce->tx_coalesce_usecs = tx_eq->cur_eqd;
149         coalesce->tx_coalesce_usecs_high = tx_eq->max_eqd;
150         coalesce->tx_coalesce_usecs_low = tx_eq->min_eqd;
151
152         coalesce->use_adaptive_rx_coalesce = rx_eq->enable_aic;
153         coalesce->use_adaptive_tx_coalesce = tx_eq->enable_aic;
154
155         return 0;
156 }
157
158 /*
159  * This routine is used to set interrup coalescing delay
160  */
161 static int
162 be_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
163 {
164         struct be_adapter *adapter = netdev_priv(netdev);
165         struct be_eq_obj *rx_eq = &adapter->rx_eq;
166         struct be_eq_obj *tx_eq = &adapter->tx_eq;
167         u32 tx_max, tx_min, tx_cur;
168         u32 rx_max, rx_min, rx_cur;
169         int status = 0;
170
171         if (coalesce->use_adaptive_tx_coalesce == 1)
172                 return -EINVAL;
173
174         /* if AIC is being turned on now, start with an EQD of 0 */
175         if (rx_eq->enable_aic == 0 &&
176                 coalesce->use_adaptive_rx_coalesce == 1) {
177                 rx_eq->cur_eqd = 0;
178         }
179         rx_eq->enable_aic = coalesce->use_adaptive_rx_coalesce;
180
181         rx_max = coalesce->rx_coalesce_usecs_high;
182         rx_min = coalesce->rx_coalesce_usecs_low;
183         rx_cur = coalesce->rx_coalesce_usecs;
184
185         tx_max = coalesce->tx_coalesce_usecs_high;
186         tx_min = coalesce->tx_coalesce_usecs_low;
187         tx_cur = coalesce->tx_coalesce_usecs;
188
189         if (tx_cur > BE_MAX_EQD)
190                 tx_cur = BE_MAX_EQD;
191         if (tx_eq->cur_eqd != tx_cur) {
192                 status = be_cmd_modify_eqd(adapter, tx_eq->q.id, tx_cur);
193                 if (!status)
194                         tx_eq->cur_eqd = tx_cur;
195         }
196
197         if (rx_eq->enable_aic) {
198                 if (rx_max > BE_MAX_EQD)
199                         rx_max = BE_MAX_EQD;
200                 if (rx_min > rx_max)
201                         rx_min = rx_max;
202                 rx_eq->max_eqd = rx_max;
203                 rx_eq->min_eqd = rx_min;
204                 if (rx_eq->cur_eqd > rx_max)
205                         rx_eq->cur_eqd = rx_max;
206                 if (rx_eq->cur_eqd < rx_min)
207                         rx_eq->cur_eqd = rx_min;
208         } else {
209                 if (rx_cur > BE_MAX_EQD)
210                         rx_cur = BE_MAX_EQD;
211                 if (rx_eq->cur_eqd != rx_cur) {
212                         status = be_cmd_modify_eqd(adapter, rx_eq->q.id,
213                                         rx_cur);
214                         if (!status)
215                                 rx_eq->cur_eqd = rx_cur;
216                 }
217         }
218         return 0;
219 }
220
221 static u32 be_get_rx_csum(struct net_device *netdev)
222 {
223         struct be_adapter *adapter = netdev_priv(netdev);
224
225         return adapter->rx_csum;
226 }
227
228 static int be_set_rx_csum(struct net_device *netdev, uint32_t data)
229 {
230         struct be_adapter *adapter = netdev_priv(netdev);
231
232         if (data)
233                 adapter->rx_csum = true;
234         else
235                 adapter->rx_csum = false;
236
237         return 0;
238 }
239
240 static void
241 be_get_ethtool_stats(struct net_device *netdev,
242                 struct ethtool_stats *stats, uint64_t *data)
243 {
244         struct be_adapter *adapter = netdev_priv(netdev);
245         struct be_drvr_stats *drvr_stats = &adapter->stats.drvr_stats;
246         struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats.cmd.va);
247         struct be_rxf_stats *rxf_stats = &hw_stats->rxf;
248         struct be_port_rxf_stats *port_stats =
249                         &rxf_stats->port[adapter->port_num];
250         struct net_device_stats *net_stats = &netdev->stats;
251         struct be_erx_stats *erx_stats = &hw_stats->erx;
252         void *p = NULL;
253         int i;
254
255         for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
256                 switch (et_stats[i].type) {
257                 case NETSTAT:
258                         p = net_stats;
259                         break;
260                 case DRVSTAT:
261                         p = drvr_stats;
262                         break;
263                 case PORTSTAT:
264                         p = port_stats;
265                         break;
266                 case MISCSTAT:
267                         p = rxf_stats;
268                         break;
269                 case ERXSTAT: /* Currently only one ERX stat is provided */
270                         p = (u32 *)erx_stats + adapter->rx_obj.q.id;
271                         break;
272                 }
273
274                 p = (u8 *)p + et_stats[i].offset;
275                 data[i] = (et_stats[i].size == sizeof(u64)) ?
276                                 *(u64 *)p: *(u32 *)p;
277         }
278
279         return;
280 }
281
282 static void
283 be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
284                 uint8_t *data)
285 {
286         int i;
287         switch (stringset) {
288         case ETH_SS_STATS:
289                 for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
290                         memcpy(data, et_stats[i].desc, ETH_GSTRING_LEN);
291                         data += ETH_GSTRING_LEN;
292                 }
293                 break;
294         case ETH_SS_TEST:
295                 for (i = 0; i < ETHTOOL_TESTS_NUM; i++) {
296                         memcpy(data, et_self_tests[i], ETH_GSTRING_LEN);
297                         data += ETH_GSTRING_LEN;
298                 }
299                 break;
300         }
301 }
302
303 static int be_get_sset_count(struct net_device *netdev, int stringset)
304 {
305         switch (stringset) {
306         case ETH_SS_TEST:
307                 return ETHTOOL_TESTS_NUM;
308         case ETH_SS_STATS:
309                 return ETHTOOL_STATS_NUM;
310         default:
311                 return -EINVAL;
312         }
313 }
314
315 static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
316 {
317         struct be_adapter *adapter = netdev_priv(netdev);
318         u8 mac_speed = 0, connector = 0;
319         u16 link_speed = 0;
320         bool link_up = false;
321         int status;
322
323         if (adapter->link_speed < 0) {
324                 status = be_cmd_link_status_query(adapter, &link_up,
325                                                 &mac_speed, &link_speed);
326
327                 /* link_speed is in units of 10 Mbps */
328                 if (link_speed) {
329                         ecmd->speed = link_speed*10;
330                 } else {
331                         switch (mac_speed) {
332                         case PHY_LINK_SPEED_1GBPS:
333                                 ecmd->speed = SPEED_1000;
334                                 break;
335                         case PHY_LINK_SPEED_10GBPS:
336                                 ecmd->speed = SPEED_10000;
337                                 break;
338                         }
339                 }
340
341                 status = be_cmd_read_port_type(adapter, adapter->port_num,
342                                                 &connector);
343                 if (!status) {
344                         switch (connector) {
345                         case 7:
346                                 ecmd->port = PORT_FIBRE;
347                                 ecmd->transceiver = XCVR_EXTERNAL;
348                                 break;
349                         case 0:
350                                 ecmd->port = PORT_TP;
351                                 ecmd->transceiver = XCVR_EXTERNAL;
352                                 break;
353                         default:
354                                 ecmd->port = PORT_TP;
355                                 ecmd->transceiver = XCVR_INTERNAL;
356                                 break;
357                         }
358                 } else {
359                         ecmd->port = PORT_AUI;
360                         ecmd->transceiver = XCVR_INTERNAL;
361                 }
362
363                 /* Save for future use */
364                 adapter->link_speed = ecmd->speed;
365                 adapter->port_type = ecmd->port;
366                 adapter->transceiver = ecmd->transceiver;
367         } else {
368                 ecmd->speed = adapter->link_speed;
369                 ecmd->port = adapter->port_type;
370                 ecmd->transceiver = adapter->transceiver;
371         }
372
373         ecmd->duplex = DUPLEX_FULL;
374         ecmd->autoneg = AUTONEG_DISABLE;
375         ecmd->phy_address = adapter->port_num;
376         switch (ecmd->port) {
377         case PORT_FIBRE:
378                 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
379                 break;
380         case PORT_TP:
381                 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP);
382                 break;
383         case PORT_AUI:
384                 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_AUI);
385                 break;
386         }
387
388         return 0;
389 }
390
391 static void
392 be_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
393 {
394         struct be_adapter *adapter = netdev_priv(netdev);
395
396         ring->rx_max_pending = adapter->rx_obj.q.len;
397         ring->tx_max_pending = adapter->tx_obj.q.len;
398
399         ring->rx_pending = atomic_read(&adapter->rx_obj.q.used);
400         ring->tx_pending = atomic_read(&adapter->tx_obj.q.used);
401 }
402
403 static void
404 be_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
405 {
406         struct be_adapter *adapter = netdev_priv(netdev);
407
408         be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause);
409         ecmd->autoneg = 0;
410 }
411
412 static int
413 be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
414 {
415         struct be_adapter *adapter = netdev_priv(netdev);
416         int status;
417
418         if (ecmd->autoneg != 0)
419                 return -EINVAL;
420         adapter->tx_fc = ecmd->tx_pause;
421         adapter->rx_fc = ecmd->rx_pause;
422
423         status = be_cmd_set_flow_control(adapter,
424                                         adapter->tx_fc, adapter->rx_fc);
425         if (status)
426                 dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
427
428         return status;
429 }
430
431 static int
432 be_phys_id(struct net_device *netdev, u32 data)
433 {
434         struct be_adapter *adapter = netdev_priv(netdev);
435         int status;
436         u32 cur;
437
438         be_cmd_get_beacon_state(adapter, adapter->port_num, &cur);
439
440         if (cur == BEACON_STATE_ENABLED)
441                 return 0;
442
443         if (data < 2)
444                 data = 2;
445
446         status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
447                         BEACON_STATE_ENABLED);
448         set_current_state(TASK_INTERRUPTIBLE);
449         schedule_timeout(data*HZ);
450
451         status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
452                         BEACON_STATE_DISABLED);
453
454         return status;
455 }
456
457 static void
458 be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
459 {
460         struct be_adapter *adapter = netdev_priv(netdev);
461
462         wol->supported = WAKE_MAGIC;
463         if (adapter->wol)
464                 wol->wolopts = WAKE_MAGIC;
465         else
466                 wol->wolopts = 0;
467         memset(&wol->sopass, 0, sizeof(wol->sopass));
468         return;
469 }
470
471 static int
472 be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
473 {
474         struct be_adapter *adapter = netdev_priv(netdev);
475
476         if (wol->wolopts & ~WAKE_MAGIC)
477                 return -EINVAL;
478
479         if (wol->wolopts & WAKE_MAGIC)
480                 adapter->wol = true;
481         else
482                 adapter->wol = false;
483
484         return 0;
485 }
486
487 static int
488 be_test_ddr_dma(struct be_adapter *adapter)
489 {
490         int ret, i;
491         struct be_dma_mem ddrdma_cmd;
492         u64 pattern[2] = {0x5a5a5a5a5a5a5a5a, 0xa5a5a5a5a5a5a5a5};
493
494         ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test);
495         ddrdma_cmd.va = pci_alloc_consistent(adapter->pdev, ddrdma_cmd.size,
496                                         &ddrdma_cmd.dma);
497         if (!ddrdma_cmd.va) {
498                 dev_err(&adapter->pdev->dev, "Memory allocation failure \n");
499                 return -ENOMEM;
500         }
501
502         for (i = 0; i < 2; i++) {
503                 ret = be_cmd_ddr_dma_test(adapter, pattern[i],
504                                         4096, &ddrdma_cmd);
505                 if (ret != 0)
506                         goto err;
507         }
508
509 err:
510         pci_free_consistent(adapter->pdev, ddrdma_cmd.size,
511                         ddrdma_cmd.va, ddrdma_cmd.dma);
512         return ret;
513 }
514
515 static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
516                                 u64 *status)
517 {
518         be_cmd_set_loopback(adapter, adapter->port_num,
519                                 loopback_type, 1);
520         *status = be_cmd_loopback_test(adapter, adapter->port_num,
521                                 loopback_type, 1500,
522                                 2, 0xabc);
523         be_cmd_set_loopback(adapter, adapter->port_num,
524                                 BE_NO_LOOPBACK, 1);
525         return *status;
526 }
527
528 static void
529 be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
530 {
531         struct be_adapter *adapter = netdev_priv(netdev);
532
533         memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
534
535         if (test->flags & ETH_TEST_FL_OFFLINE) {
536                 if (be_loopback_test(adapter, BE_MAC_LOOPBACK,
537                                                 &data[0]) != 0) {
538                         test->flags |= ETH_TEST_FL_FAILED;
539                 }
540                 if (be_loopback_test(adapter, BE_PHY_LOOPBACK,
541                                                 &data[1]) != 0) {
542                         test->flags |= ETH_TEST_FL_FAILED;
543                 }
544                 if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
545                                                 &data[2]) != 0) {
546                         test->flags |= ETH_TEST_FL_FAILED;
547                 }
548         }
549
550         if (be_test_ddr_dma(adapter) != 0) {
551                 data[3] = 1;
552                 test->flags |= ETH_TEST_FL_FAILED;
553         }
554
555 }
556
557 static int
558 be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
559 {
560         struct be_adapter *adapter = netdev_priv(netdev);
561         char file_name[ETHTOOL_FLASH_MAX_FILENAME];
562         u32 region;
563
564         file_name[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0;
565         strcpy(file_name, efl->data);
566         region = efl->region;
567
568         return be_load_fw(adapter, file_name);
569 }
570
571 static int
572 be_get_eeprom_len(struct net_device *netdev)
573 {
574         return BE_READ_SEEPROM_LEN;
575 }
576
577 static int
578 be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
579                         uint8_t *data)
580 {
581         struct be_adapter *adapter = netdev_priv(netdev);
582         struct be_dma_mem eeprom_cmd;
583         struct be_cmd_resp_seeprom_read *resp;
584         int status;
585
586         if (!eeprom->len)
587                 return -EINVAL;
588
589         eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16);
590
591         memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem));
592         eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read);
593         eeprom_cmd.va = pci_alloc_consistent(adapter->pdev, eeprom_cmd.size,
594                                 &eeprom_cmd.dma);
595
596         if (!eeprom_cmd.va) {
597                 dev_err(&adapter->pdev->dev,
598                         "Memory allocation failure. Could not read eeprom\n");
599                 return -ENOMEM;
600         }
601
602         status = be_cmd_get_seeprom_data(adapter, &eeprom_cmd);
603
604         if (!status) {
605                 resp = (struct be_cmd_resp_seeprom_read *) eeprom_cmd.va;
606                 memcpy(data, resp->seeprom_data, eeprom->len);
607         }
608         pci_free_consistent(adapter->pdev, eeprom_cmd.size, eeprom_cmd.va,
609                         eeprom_cmd.dma);
610
611         return status;
612 }
613
614 const struct ethtool_ops be_ethtool_ops = {
615         .get_settings = be_get_settings,
616         .get_drvinfo = be_get_drvinfo,
617         .get_wol = be_get_wol,
618         .set_wol = be_set_wol,
619         .get_link = ethtool_op_get_link,
620         .get_eeprom_len = be_get_eeprom_len,
621         .get_eeprom = be_read_eeprom,
622         .get_coalesce = be_get_coalesce,
623         .set_coalesce = be_set_coalesce,
624         .get_ringparam = be_get_ringparam,
625         .get_pauseparam = be_get_pauseparam,
626         .set_pauseparam = be_set_pauseparam,
627         .get_rx_csum = be_get_rx_csum,
628         .set_rx_csum = be_set_rx_csum,
629         .get_tx_csum = ethtool_op_get_tx_csum,
630         .set_tx_csum = ethtool_op_set_tx_hw_csum,
631         .get_sg = ethtool_op_get_sg,
632         .set_sg = ethtool_op_set_sg,
633         .get_tso = ethtool_op_get_tso,
634         .set_tso = ethtool_op_set_tso,
635         .get_strings = be_get_stat_strings,
636         .phys_id = be_phys_id,
637         .get_sset_count = be_get_sset_count,
638         .get_ethtool_stats = be_get_ethtool_stats,
639         .flash_device = be_do_flash,
640         .self_test = be_self_test,
641 };