GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / net / benet / be_ethtool.c
blob13f0abbc520550b0b22ef48d0ed2a4da56d69187
1 /*
2 * Copyright (C) 2005 - 2010 ServerEngines
3 * All rights reserved.
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.
10 * Contact Information:
11 * linux-drivers@serverengines.com
13 * ServerEngines
14 * 209 N. Fair Oaks Ave
15 * Sunnyvale, CA 94085
18 #include "be.h"
19 #include "be_cmds.h"
20 #include <linux/ethtool.h>
22 struct be_ethtool_stat {
23 char desc[ETH_GSTRING_LEN];
24 int type;
25 int size;
26 int offset;
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)
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_rx_mcast_pkt)},
64 {DRVSTAT_INFO(be_ethrx_post_fail)},
65 {DRVSTAT_INFO(be_802_3_dropped_frames)},
66 {DRVSTAT_INFO(be_802_3_malformed_frames)},
67 {DRVSTAT_INFO(be_tx_rate)},
68 {DRVSTAT_INFO(be_rx_rate)},
69 {PORTSTAT_INFO(rx_unicast_frames)},
70 {PORTSTAT_INFO(rx_multicast_frames)},
71 {PORTSTAT_INFO(rx_broadcast_frames)},
72 {PORTSTAT_INFO(rx_crc_errors)},
73 {PORTSTAT_INFO(rx_alignment_symbol_errors)},
74 {PORTSTAT_INFO(rx_pause_frames)},
75 {PORTSTAT_INFO(rx_control_frames)},
76 {PORTSTAT_INFO(rx_in_range_errors)},
77 {PORTSTAT_INFO(rx_out_range_errors)},
78 {PORTSTAT_INFO(rx_frame_too_long)},
79 {PORTSTAT_INFO(rx_address_match_errors)},
80 {PORTSTAT_INFO(rx_vlan_mismatch)},
81 {PORTSTAT_INFO(rx_dropped_too_small)},
82 {PORTSTAT_INFO(rx_dropped_too_short)},
83 {PORTSTAT_INFO(rx_dropped_header_too_small)},
84 {PORTSTAT_INFO(rx_dropped_tcp_length)},
85 {PORTSTAT_INFO(rx_dropped_runt)},
86 {PORTSTAT_INFO(rx_fifo_overflow)},
87 {PORTSTAT_INFO(rx_input_fifo_overflow)},
88 {PORTSTAT_INFO(rx_ip_checksum_errs)},
89 {PORTSTAT_INFO(rx_tcp_checksum_errs)},
90 {PORTSTAT_INFO(rx_udp_checksum_errs)},
91 {PORTSTAT_INFO(rx_non_rss_packets)},
92 {PORTSTAT_INFO(rx_ipv4_packets)},
93 {PORTSTAT_INFO(rx_ipv6_packets)},
94 {PORTSTAT_INFO(tx_unicastframes)},
95 {PORTSTAT_INFO(tx_multicastframes)},
96 {PORTSTAT_INFO(tx_broadcastframes)},
97 {PORTSTAT_INFO(tx_pauseframes)},
98 {PORTSTAT_INFO(tx_controlframes)},
99 {MISCSTAT_INFO(rx_drops_no_pbuf)},
100 {MISCSTAT_INFO(rx_drops_no_txpb)},
101 {MISCSTAT_INFO(rx_drops_no_erx_descr)},
102 {MISCSTAT_INFO(rx_drops_no_tpre_descr)},
103 {MISCSTAT_INFO(rx_drops_too_many_frags)},
104 {MISCSTAT_INFO(rx_drops_invalid_ring)},
105 {MISCSTAT_INFO(forwarded_packets)},
106 {MISCSTAT_INFO(rx_drops_mtu)},
107 {ERXSTAT_INFO(rx_drops_no_fragments)},
109 #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
111 static const char et_self_tests[][ETH_GSTRING_LEN] = {
112 "MAC Loopback test",
113 "PHY Loopback test",
114 "External Loopback test",
115 "DDR DMA test"
116 "Link test"
119 #define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
120 #define BE_MAC_LOOPBACK 0x0
121 #define BE_PHY_LOOPBACK 0x1
122 #define BE_ONE_PORT_EXT_LOOPBACK 0x2
123 #define BE_NO_LOOPBACK 0xff
125 static void
126 be_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
128 struct be_adapter *adapter = netdev_priv(netdev);
130 strcpy(drvinfo->driver, DRV_NAME);
131 strcpy(drvinfo->version, DRV_VER);
132 strncpy(drvinfo->fw_version, adapter->fw_ver, FW_VER_LEN);
133 strcpy(drvinfo->bus_info, pci_name(adapter->pdev));
134 drvinfo->testinfo_len = 0;
135 drvinfo->regdump_len = 0;
136 drvinfo->eedump_len = 0;
139 static int
140 be_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
142 struct be_adapter *adapter = netdev_priv(netdev);
143 struct be_eq_obj *rx_eq = &adapter->rx_eq;
144 struct be_eq_obj *tx_eq = &adapter->tx_eq;
146 coalesce->rx_coalesce_usecs = rx_eq->cur_eqd;
147 coalesce->rx_coalesce_usecs_high = rx_eq->max_eqd;
148 coalesce->rx_coalesce_usecs_low = rx_eq->min_eqd;
150 coalesce->tx_coalesce_usecs = tx_eq->cur_eqd;
151 coalesce->tx_coalesce_usecs_high = tx_eq->max_eqd;
152 coalesce->tx_coalesce_usecs_low = tx_eq->min_eqd;
154 coalesce->use_adaptive_rx_coalesce = rx_eq->enable_aic;
155 coalesce->use_adaptive_tx_coalesce = tx_eq->enable_aic;
157 return 0;
161 * This routine is used to set interrup coalescing delay
163 static int
164 be_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
166 struct be_adapter *adapter = netdev_priv(netdev);
167 struct be_eq_obj *rx_eq = &adapter->rx_eq;
168 struct be_eq_obj *tx_eq = &adapter->tx_eq;
169 u32 tx_max, tx_min, tx_cur;
170 u32 rx_max, rx_min, rx_cur;
171 int status = 0;
173 if (coalesce->use_adaptive_tx_coalesce == 1)
174 return -EINVAL;
176 /* if AIC is being turned on now, start with an EQD of 0 */
177 if (rx_eq->enable_aic == 0 &&
178 coalesce->use_adaptive_rx_coalesce == 1) {
179 rx_eq->cur_eqd = 0;
181 rx_eq->enable_aic = coalesce->use_adaptive_rx_coalesce;
183 rx_max = coalesce->rx_coalesce_usecs_high;
184 rx_min = coalesce->rx_coalesce_usecs_low;
185 rx_cur = coalesce->rx_coalesce_usecs;
187 tx_max = coalesce->tx_coalesce_usecs_high;
188 tx_min = coalesce->tx_coalesce_usecs_low;
189 tx_cur = coalesce->tx_coalesce_usecs;
191 if (tx_cur > BE_MAX_EQD)
192 tx_cur = BE_MAX_EQD;
193 if (tx_eq->cur_eqd != tx_cur) {
194 status = be_cmd_modify_eqd(adapter, tx_eq->q.id, tx_cur);
195 if (!status)
196 tx_eq->cur_eqd = tx_cur;
199 if (rx_eq->enable_aic) {
200 if (rx_max > BE_MAX_EQD)
201 rx_max = BE_MAX_EQD;
202 if (rx_min > rx_max)
203 rx_min = rx_max;
204 rx_eq->max_eqd = rx_max;
205 rx_eq->min_eqd = rx_min;
206 if (rx_eq->cur_eqd > rx_max)
207 rx_eq->cur_eqd = rx_max;
208 if (rx_eq->cur_eqd < rx_min)
209 rx_eq->cur_eqd = rx_min;
210 } else {
211 if (rx_cur > BE_MAX_EQD)
212 rx_cur = BE_MAX_EQD;
213 if (rx_eq->cur_eqd != rx_cur) {
214 status = be_cmd_modify_eqd(adapter, rx_eq->q.id,
215 rx_cur);
216 if (!status)
217 rx_eq->cur_eqd = rx_cur;
220 return 0;
223 static u32 be_get_rx_csum(struct net_device *netdev)
225 struct be_adapter *adapter = netdev_priv(netdev);
227 return adapter->rx_csum;
230 static int be_set_rx_csum(struct net_device *netdev, uint32_t data)
232 struct be_adapter *adapter = netdev_priv(netdev);
234 if (data)
235 adapter->rx_csum = true;
236 else
237 adapter->rx_csum = false;
239 return 0;
242 static void
243 be_get_ethtool_stats(struct net_device *netdev,
244 struct ethtool_stats *stats, uint64_t *data)
246 struct be_adapter *adapter = netdev_priv(netdev);
247 struct be_drvr_stats *drvr_stats = &adapter->stats.drvr_stats;
248 struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats.cmd.va);
249 struct be_rxf_stats *rxf_stats = &hw_stats->rxf;
250 struct be_port_rxf_stats *port_stats =
251 &rxf_stats->port[adapter->port_num];
252 struct net_device_stats *net_stats = &netdev->stats;
253 struct be_erx_stats *erx_stats = &hw_stats->erx;
254 void *p = NULL;
255 int i;
257 for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
258 switch (et_stats[i].type) {
259 case NETSTAT:
260 p = net_stats;
261 break;
262 case DRVSTAT:
263 p = drvr_stats;
264 break;
265 case PORTSTAT:
266 p = port_stats;
267 break;
268 case MISCSTAT:
269 p = rxf_stats;
270 break;
271 case ERXSTAT: /* Currently only one ERX stat is provided */
272 p = (u32 *)erx_stats + adapter->rx_obj.q.id;
273 break;
276 p = (u8 *)p + et_stats[i].offset;
277 data[i] = (et_stats[i].size == sizeof(u64)) ?
278 *(u64 *)p: *(u32 *)p;
282 static void
283 be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
284 uint8_t *data)
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;
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;
299 break;
303 static int be_get_sset_count(struct net_device *netdev, int stringset)
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;
315 static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
317 struct be_adapter *adapter = netdev_priv(netdev);
318 struct be_dma_mem phy_cmd;
319 struct be_cmd_resp_get_phy_info *resp;
320 u8 mac_speed = 0;
321 u16 link_speed = 0;
322 bool link_up = false;
323 int status;
324 u16 intf_type;
326 if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) {
327 status = be_cmd_link_status_query(adapter, &link_up,
328 &mac_speed, &link_speed);
330 be_link_status_update(adapter, link_up);
331 /* link_speed is in units of 10 Mbps */
332 if (link_speed) {
333 ecmd->speed = link_speed*10;
334 } else {
335 switch (mac_speed) {
336 case PHY_LINK_SPEED_1GBPS:
337 ecmd->speed = SPEED_1000;
338 break;
339 case PHY_LINK_SPEED_10GBPS:
340 ecmd->speed = SPEED_10000;
341 break;
345 phy_cmd.size = sizeof(struct be_cmd_req_get_phy_info);
346 phy_cmd.va = pci_alloc_consistent(adapter->pdev, phy_cmd.size,
347 &phy_cmd.dma);
348 if (!phy_cmd.va) {
349 dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
350 return -ENOMEM;
352 status = be_cmd_get_phy_info(adapter, &phy_cmd);
353 if (!status) {
354 resp = (struct be_cmd_resp_get_phy_info *) phy_cmd.va;
355 intf_type = le16_to_cpu(resp->interface_type);
357 switch (intf_type) {
358 case PHY_TYPE_XFP_10GB:
359 case PHY_TYPE_SFP_1GB:
360 case PHY_TYPE_SFP_PLUS_10GB:
361 ecmd->port = PORT_FIBRE;
362 break;
363 default:
364 ecmd->port = PORT_TP;
365 break;
368 switch (intf_type) {
369 case PHY_TYPE_KR_10GB:
370 case PHY_TYPE_KX4_10GB:
371 ecmd->autoneg = AUTONEG_ENABLE;
372 ecmd->transceiver = XCVR_INTERNAL;
373 break;
374 default:
375 ecmd->autoneg = AUTONEG_DISABLE;
376 ecmd->transceiver = XCVR_EXTERNAL;
377 break;
381 /* Save for future use */
382 adapter->link_speed = ecmd->speed;
383 adapter->port_type = ecmd->port;
384 adapter->transceiver = ecmd->transceiver;
385 adapter->autoneg = ecmd->autoneg;
386 pci_free_consistent(adapter->pdev, phy_cmd.size,
387 phy_cmd.va, phy_cmd.dma);
388 } else {
389 ecmd->speed = adapter->link_speed;
390 ecmd->port = adapter->port_type;
391 ecmd->transceiver = adapter->transceiver;
392 ecmd->autoneg = adapter->autoneg;
395 ecmd->duplex = DUPLEX_FULL;
396 ecmd->phy_address = adapter->port_num;
397 switch (ecmd->port) {
398 case PORT_FIBRE:
399 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
400 break;
401 case PORT_TP:
402 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP);
403 break;
404 case PORT_AUI:
405 ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_AUI);
406 break;
409 if (ecmd->autoneg) {
410 ecmd->supported |= SUPPORTED_1000baseT_Full;
411 ecmd->supported |= SUPPORTED_Autoneg;
412 ecmd->advertising |= (ADVERTISED_10000baseT_Full |
413 ADVERTISED_1000baseT_Full);
416 return 0;
419 static void
420 be_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
422 struct be_adapter *adapter = netdev_priv(netdev);
424 ring->rx_max_pending = adapter->rx_obj.q.len;
425 ring->tx_max_pending = adapter->tx_obj.q.len;
427 ring->rx_pending = atomic_read(&adapter->rx_obj.q.used);
428 ring->tx_pending = atomic_read(&adapter->tx_obj.q.used);
431 static void
432 be_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
434 struct be_adapter *adapter = netdev_priv(netdev);
436 be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause);
437 ecmd->autoneg = 0;
440 static int
441 be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
443 struct be_adapter *adapter = netdev_priv(netdev);
444 int status;
446 if (ecmd->autoneg != 0)
447 return -EINVAL;
448 adapter->tx_fc = ecmd->tx_pause;
449 adapter->rx_fc = ecmd->rx_pause;
451 status = be_cmd_set_flow_control(adapter,
452 adapter->tx_fc, adapter->rx_fc);
453 if (status)
454 dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
456 return status;
459 static int
460 be_phys_id(struct net_device *netdev, u32 data)
462 struct be_adapter *adapter = netdev_priv(netdev);
463 int status;
464 u32 cur;
466 be_cmd_get_beacon_state(adapter, adapter->port_num, &cur);
468 if (cur == BEACON_STATE_ENABLED)
469 return 0;
471 if (data < 2)
472 data = 2;
474 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
475 BEACON_STATE_ENABLED);
476 set_current_state(TASK_INTERRUPTIBLE);
477 schedule_timeout(data*HZ);
479 status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
480 BEACON_STATE_DISABLED);
482 return status;
485 static void
486 be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
488 struct be_adapter *adapter = netdev_priv(netdev);
490 wol->supported = WAKE_MAGIC;
491 if (adapter->wol)
492 wol->wolopts = WAKE_MAGIC;
493 else
494 wol->wolopts = 0;
495 memset(&wol->sopass, 0, sizeof(wol->sopass));
498 static int
499 be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
501 struct be_adapter *adapter = netdev_priv(netdev);
503 if (wol->wolopts & ~WAKE_MAGIC)
504 return -EINVAL;
506 if (wol->wolopts & WAKE_MAGIC)
507 adapter->wol = true;
508 else
509 adapter->wol = false;
511 return 0;
514 static int
515 be_test_ddr_dma(struct be_adapter *adapter)
517 int ret, i;
518 struct be_dma_mem ddrdma_cmd;
519 u64 pattern[2] = {0x5a5a5a5a5a5a5a5aULL, 0xa5a5a5a5a5a5a5a5ULL};
521 ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test);
522 ddrdma_cmd.va = pci_alloc_consistent(adapter->pdev, ddrdma_cmd.size,
523 &ddrdma_cmd.dma);
524 if (!ddrdma_cmd.va) {
525 dev_err(&adapter->pdev->dev, "Memory allocation failure\n");
526 return -ENOMEM;
529 for (i = 0; i < 2; i++) {
530 ret = be_cmd_ddr_dma_test(adapter, pattern[i],
531 4096, &ddrdma_cmd);
532 if (ret != 0)
533 goto err;
536 err:
537 pci_free_consistent(adapter->pdev, ddrdma_cmd.size,
538 ddrdma_cmd.va, ddrdma_cmd.dma);
539 return ret;
542 static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
543 u64 *status)
545 be_cmd_set_loopback(adapter, adapter->port_num,
546 loopback_type, 1);
547 *status = be_cmd_loopback_test(adapter, adapter->port_num,
548 loopback_type, 1500,
549 2, 0xabc);
550 be_cmd_set_loopback(adapter, adapter->port_num,
551 BE_NO_LOOPBACK, 1);
552 return *status;
555 static void
556 be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
558 struct be_adapter *adapter = netdev_priv(netdev);
559 bool link_up;
560 u8 mac_speed = 0;
561 u16 qos_link_speed = 0;
563 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
565 if (test->flags & ETH_TEST_FL_OFFLINE) {
566 if (be_loopback_test(adapter, BE_MAC_LOOPBACK,
567 &data[0]) != 0) {
568 test->flags |= ETH_TEST_FL_FAILED;
570 if (be_loopback_test(adapter, BE_PHY_LOOPBACK,
571 &data[1]) != 0) {
572 test->flags |= ETH_TEST_FL_FAILED;
574 if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
575 &data[2]) != 0) {
576 test->flags |= ETH_TEST_FL_FAILED;
580 if (be_test_ddr_dma(adapter) != 0) {
581 data[3] = 1;
582 test->flags |= ETH_TEST_FL_FAILED;
585 if (be_cmd_link_status_query(adapter, &link_up, &mac_speed,
586 &qos_link_speed) != 0) {
587 test->flags |= ETH_TEST_FL_FAILED;
588 data[4] = -1;
589 } else if (mac_speed) {
590 data[4] = 1;
594 static int
595 be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
597 struct be_adapter *adapter = netdev_priv(netdev);
598 char file_name[ETHTOOL_FLASH_MAX_FILENAME];
599 u32 region;
601 file_name[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0;
602 strcpy(file_name, efl->data);
603 region = efl->region;
605 return be_load_fw(adapter, file_name);
608 static int
609 be_get_eeprom_len(struct net_device *netdev)
611 return BE_READ_SEEPROM_LEN;
614 static int
615 be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
616 uint8_t *data)
618 struct be_adapter *adapter = netdev_priv(netdev);
619 struct be_dma_mem eeprom_cmd;
620 struct be_cmd_resp_seeprom_read *resp;
621 int status;
623 if (!eeprom->len)
624 return -EINVAL;
626 eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16);
628 memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem));
629 eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read);
630 eeprom_cmd.va = pci_alloc_consistent(adapter->pdev, eeprom_cmd.size,
631 &eeprom_cmd.dma);
633 if (!eeprom_cmd.va) {
634 dev_err(&adapter->pdev->dev,
635 "Memory allocation failure. Could not read eeprom\n");
636 return -ENOMEM;
639 status = be_cmd_get_seeprom_data(adapter, &eeprom_cmd);
641 if (!status) {
642 resp = (struct be_cmd_resp_seeprom_read *) eeprom_cmd.va;
643 memcpy(data, resp->seeprom_data + eeprom->offset, eeprom->len);
645 pci_free_consistent(adapter->pdev, eeprom_cmd.size, eeprom_cmd.va,
646 eeprom_cmd.dma);
648 return status;
651 const struct ethtool_ops be_ethtool_ops = {
652 .get_settings = be_get_settings,
653 .get_drvinfo = be_get_drvinfo,
654 .get_wol = be_get_wol,
655 .set_wol = be_set_wol,
656 .get_link = ethtool_op_get_link,
657 .get_eeprom_len = be_get_eeprom_len,
658 .get_eeprom = be_read_eeprom,
659 .get_coalesce = be_get_coalesce,
660 .set_coalesce = be_set_coalesce,
661 .get_ringparam = be_get_ringparam,
662 .get_pauseparam = be_get_pauseparam,
663 .set_pauseparam = be_set_pauseparam,
664 .get_rx_csum = be_get_rx_csum,
665 .set_rx_csum = be_set_rx_csum,
666 .get_tx_csum = ethtool_op_get_tx_csum,
667 .set_tx_csum = ethtool_op_set_tx_hw_csum,
668 .get_sg = ethtool_op_get_sg,
669 .set_sg = ethtool_op_set_sg,
670 .get_tso = ethtool_op_get_tso,
671 .set_tso = ethtool_op_set_tso,
672 .get_strings = be_get_stat_strings,
673 .phys_id = be_phys_id,
674 .get_sset_count = be_get_sset_count,
675 .get_ethtool_stats = be_get_ethtool_stats,
676 .flash_device = be_do_flash,
677 .self_test = be_self_test,