2 * Copyright (C) 2005 - 2011 Emulex
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@emulex.com
15 * Costa Mesa, CA 92626
20 #include <linux/ethtool.h>
22 struct be_ethtool_stat
{
23 char desc
[ETH_GSTRING_LEN
];
29 enum {NETSTAT
, DRVSTAT_TX
, DRVSTAT_RX
, ERXSTAT
,
31 #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \
32 offsetof(_struct, field)
33 #define NETSTAT_INFO(field) #field, NETSTAT,\
34 FIELDINFO(struct net_device_stats,\
36 #define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\
37 FIELDINFO(struct be_tx_stats, field)
38 #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\
39 FIELDINFO(struct be_rx_stats, field)
40 #define ERXSTAT_INFO(field) #field, ERXSTAT,\
41 FIELDINFO(struct be_erx_stats_v1, field)
42 #define DRVSTAT_INFO(field) #field, DRVSTAT,\
43 FIELDINFO(struct be_drv_stats, \
46 static const struct be_ethtool_stat et_stats
[] = {
47 {NETSTAT_INFO(rx_packets
)},
48 {NETSTAT_INFO(tx_packets
)},
49 {NETSTAT_INFO(rx_bytes
)},
50 {NETSTAT_INFO(tx_bytes
)},
51 {NETSTAT_INFO(rx_errors
)},
52 {NETSTAT_INFO(tx_errors
)},
53 {NETSTAT_INFO(rx_dropped
)},
54 {NETSTAT_INFO(tx_dropped
)},
55 {DRVSTAT_INFO(be_tx_events
)},
56 {DRVSTAT_INFO(rx_crc_errors
)},
57 {DRVSTAT_INFO(rx_alignment_symbol_errors
)},
58 {DRVSTAT_INFO(rx_pause_frames
)},
59 {DRVSTAT_INFO(rx_control_frames
)},
60 {DRVSTAT_INFO(rx_in_range_errors
)},
61 {DRVSTAT_INFO(rx_out_range_errors
)},
62 {DRVSTAT_INFO(rx_frame_too_long
)},
63 {DRVSTAT_INFO(rx_address_match_errors
)},
64 {DRVSTAT_INFO(rx_dropped_too_small
)},
65 {DRVSTAT_INFO(rx_dropped_too_short
)},
66 {DRVSTAT_INFO(rx_dropped_header_too_small
)},
67 {DRVSTAT_INFO(rx_dropped_tcp_length
)},
68 {DRVSTAT_INFO(rx_dropped_runt
)},
69 {DRVSTAT_INFO(rxpp_fifo_overflow_drop
)},
70 {DRVSTAT_INFO(rx_input_fifo_overflow_drop
)},
71 {DRVSTAT_INFO(rx_ip_checksum_errs
)},
72 {DRVSTAT_INFO(rx_tcp_checksum_errs
)},
73 {DRVSTAT_INFO(rx_udp_checksum_errs
)},
74 {DRVSTAT_INFO(rx_switched_unicast_packets
)},
75 {DRVSTAT_INFO(rx_switched_multicast_packets
)},
76 {DRVSTAT_INFO(rx_switched_broadcast_packets
)},
77 {DRVSTAT_INFO(tx_pauseframes
)},
78 {DRVSTAT_INFO(tx_controlframes
)},
79 {DRVSTAT_INFO(rx_priority_pause_frames
)},
80 {DRVSTAT_INFO(pmem_fifo_overflow_drop
)},
81 {DRVSTAT_INFO(jabber_events
)},
82 {DRVSTAT_INFO(rx_drops_no_pbuf
)},
83 {DRVSTAT_INFO(rx_drops_no_txpb
)},
84 {DRVSTAT_INFO(rx_drops_no_erx_descr
)},
85 {DRVSTAT_INFO(rx_drops_no_tpre_descr
)},
86 {DRVSTAT_INFO(rx_drops_too_many_frags
)},
87 {DRVSTAT_INFO(rx_drops_invalid_ring
)},
88 {DRVSTAT_INFO(forwarded_packets
)},
89 {DRVSTAT_INFO(rx_drops_mtu
)},
90 {DRVSTAT_INFO(eth_red_drops
)},
91 {DRVSTAT_INFO(be_on_die_temperature
)}
93 #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
95 /* Stats related to multi RX queues */
96 static const struct be_ethtool_stat et_rx_stats
[] = {
97 {DRVSTAT_RX_INFO(rx_bytes
)},
98 {DRVSTAT_RX_INFO(rx_pkts
)},
99 {DRVSTAT_RX_INFO(rx_rate
)},
100 {DRVSTAT_RX_INFO(rx_polls
)},
101 {DRVSTAT_RX_INFO(rx_events
)},
102 {DRVSTAT_RX_INFO(rx_compl
)},
103 {DRVSTAT_RX_INFO(rx_mcast_pkts
)},
104 {DRVSTAT_RX_INFO(rx_post_fail
)},
105 {DRVSTAT_RX_INFO(rx_dropped
)},
106 {ERXSTAT_INFO(rx_drops_no_fragments
)}
108 #define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
110 /* Stats related to multi TX queues */
111 static const struct be_ethtool_stat et_tx_stats
[] = {
112 {DRVSTAT_TX_INFO(be_tx_rate
)},
113 {DRVSTAT_TX_INFO(be_tx_reqs
)},
114 {DRVSTAT_TX_INFO(be_tx_wrbs
)},
115 {DRVSTAT_TX_INFO(be_tx_stops
)},
116 {DRVSTAT_TX_INFO(be_tx_compl
)}
118 #define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats))
120 static const char et_self_tests
[][ETH_GSTRING_LEN
] = {
123 "External Loopback test",
128 #define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
129 #define BE_MAC_LOOPBACK 0x0
130 #define BE_PHY_LOOPBACK 0x1
131 #define BE_ONE_PORT_EXT_LOOPBACK 0x2
132 #define BE_NO_LOOPBACK 0xff
135 be_get_drvinfo(struct net_device
*netdev
, struct ethtool_drvinfo
*drvinfo
)
137 struct be_adapter
*adapter
= netdev_priv(netdev
);
139 strcpy(drvinfo
->driver
, DRV_NAME
);
140 strcpy(drvinfo
->version
, DRV_VER
);
141 strncpy(drvinfo
->fw_version
, adapter
->fw_ver
, FW_VER_LEN
);
142 strcpy(drvinfo
->bus_info
, pci_name(adapter
->pdev
));
143 drvinfo
->testinfo_len
= 0;
144 drvinfo
->regdump_len
= 0;
145 drvinfo
->eedump_len
= 0;
149 be_get_reg_len(struct net_device
*netdev
)
151 struct be_adapter
*adapter
= netdev_priv(netdev
);
154 if (be_physfn(adapter
))
155 be_cmd_get_reg_len(adapter
, &log_size
);
161 be_get_regs(struct net_device
*netdev
, struct ethtool_regs
*regs
, void *buf
)
163 struct be_adapter
*adapter
= netdev_priv(netdev
);
165 if (be_physfn(adapter
)) {
166 memset(buf
, 0, regs
->len
);
167 be_cmd_get_regs(adapter
, regs
->len
, buf
);
172 be_get_coalesce(struct net_device
*netdev
, struct ethtool_coalesce
*coalesce
)
174 struct be_adapter
*adapter
= netdev_priv(netdev
);
175 struct be_eq_obj
*rx_eq
= &adapter
->rx_obj
[0].rx_eq
;
176 struct be_eq_obj
*tx_eq
= &adapter
->tx_eq
;
178 coalesce
->rx_coalesce_usecs
= rx_eq
->cur_eqd
;
179 coalesce
->rx_coalesce_usecs_high
= rx_eq
->max_eqd
;
180 coalesce
->rx_coalesce_usecs_low
= rx_eq
->min_eqd
;
182 coalesce
->tx_coalesce_usecs
= tx_eq
->cur_eqd
;
183 coalesce
->tx_coalesce_usecs_high
= tx_eq
->max_eqd
;
184 coalesce
->tx_coalesce_usecs_low
= tx_eq
->min_eqd
;
186 coalesce
->use_adaptive_rx_coalesce
= rx_eq
->enable_aic
;
187 coalesce
->use_adaptive_tx_coalesce
= tx_eq
->enable_aic
;
193 * This routine is used to set interrup coalescing delay
196 be_set_coalesce(struct net_device
*netdev
, struct ethtool_coalesce
*coalesce
)
198 struct be_adapter
*adapter
= netdev_priv(netdev
);
199 struct be_rx_obj
*rxo
;
200 struct be_eq_obj
*rx_eq
;
201 struct be_eq_obj
*tx_eq
= &adapter
->tx_eq
;
202 u32 rx_max
, rx_min
, rx_cur
;
206 if (coalesce
->use_adaptive_tx_coalesce
== 1)
209 for_all_rx_queues(adapter
, rxo
, i
) {
212 if (!rx_eq
->enable_aic
&& coalesce
->use_adaptive_rx_coalesce
)
214 rx_eq
->enable_aic
= coalesce
->use_adaptive_rx_coalesce
;
216 rx_max
= coalesce
->rx_coalesce_usecs_high
;
217 rx_min
= coalesce
->rx_coalesce_usecs_low
;
218 rx_cur
= coalesce
->rx_coalesce_usecs
;
220 if (rx_eq
->enable_aic
) {
221 if (rx_max
> BE_MAX_EQD
)
225 rx_eq
->max_eqd
= rx_max
;
226 rx_eq
->min_eqd
= rx_min
;
227 if (rx_eq
->cur_eqd
> rx_max
)
228 rx_eq
->cur_eqd
= rx_max
;
229 if (rx_eq
->cur_eqd
< rx_min
)
230 rx_eq
->cur_eqd
= rx_min
;
232 if (rx_cur
> BE_MAX_EQD
)
234 if (rx_eq
->cur_eqd
!= rx_cur
) {
235 status
= be_cmd_modify_eqd(adapter
, rx_eq
->q
.id
,
238 rx_eq
->cur_eqd
= rx_cur
;
243 tx_cur
= coalesce
->tx_coalesce_usecs
;
245 if (tx_cur
> BE_MAX_EQD
)
247 if (tx_eq
->cur_eqd
!= tx_cur
) {
248 status
= be_cmd_modify_eqd(adapter
, tx_eq
->q
.id
, tx_cur
);
250 tx_eq
->cur_eqd
= tx_cur
;
257 be_get_ethtool_stats(struct net_device
*netdev
,
258 struct ethtool_stats
*stats
, uint64_t *data
)
260 struct be_adapter
*adapter
= netdev_priv(netdev
);
261 struct be_rx_obj
*rxo
;
262 struct be_tx_obj
*txo
;
266 for (i
= 0; i
< ETHTOOL_STATS_NUM
; i
++) {
267 switch (et_stats
[i
].type
) {
272 p
= &adapter
->drv_stats
;
276 p
= (u8
*)p
+ et_stats
[i
].offset
;
277 data
[i
] = (et_stats
[i
].size
== sizeof(u64
)) ?
278 *(u64
*)p
: *(u32
*)p
;
281 base
= ETHTOOL_STATS_NUM
;
282 for_all_rx_queues(adapter
, rxo
, j
) {
283 for (i
= 0; i
< ETHTOOL_RXSTATS_NUM
; i
++) {
284 switch (et_rx_stats
[i
].type
) {
286 p
= (u8
*)&rxo
->stats
+ et_rx_stats
[i
].offset
;
289 p
= (u32
*)be_erx_stats_from_cmd(adapter
) +
293 data
[base
+ j
* ETHTOOL_RXSTATS_NUM
+ i
] =
294 (et_rx_stats
[i
].size
== sizeof(u64
)) ?
295 *(u64
*)p
: *(u32
*)p
;
299 base
= ETHTOOL_STATS_NUM
+ adapter
->num_rx_qs
* ETHTOOL_RXSTATS_NUM
;
300 for_all_tx_queues(adapter
, txo
, j
) {
301 for (i
= 0; i
< ETHTOOL_TXSTATS_NUM
; i
++) {
302 p
= (u8
*)&txo
->stats
+ et_tx_stats
[i
].offset
;
303 data
[base
+ j
* ETHTOOL_TXSTATS_NUM
+ i
] =
304 (et_tx_stats
[i
].size
== sizeof(u64
)) ?
305 *(u64
*)p
: *(u32
*)p
;
311 be_get_stat_strings(struct net_device
*netdev
, uint32_t stringset
,
314 struct be_adapter
*adapter
= netdev_priv(netdev
);
319 for (i
= 0; i
< ETHTOOL_STATS_NUM
; i
++) {
320 memcpy(data
, et_stats
[i
].desc
, ETH_GSTRING_LEN
);
321 data
+= ETH_GSTRING_LEN
;
323 for (i
= 0; i
< adapter
->num_rx_qs
; i
++) {
324 for (j
= 0; j
< ETHTOOL_RXSTATS_NUM
; j
++) {
325 sprintf(data
, "rxq%d: %s", i
,
326 et_rx_stats
[j
].desc
);
327 data
+= ETH_GSTRING_LEN
;
330 for (i
= 0; i
< adapter
->num_tx_qs
; i
++) {
331 for (j
= 0; j
< ETHTOOL_TXSTATS_NUM
; j
++) {
332 sprintf(data
, "txq%d: %s", i
,
333 et_tx_stats
[j
].desc
);
334 data
+= ETH_GSTRING_LEN
;
339 for (i
= 0; i
< ETHTOOL_TESTS_NUM
; i
++) {
340 memcpy(data
, et_self_tests
[i
], ETH_GSTRING_LEN
);
341 data
+= ETH_GSTRING_LEN
;
347 static int be_get_sset_count(struct net_device
*netdev
, int stringset
)
349 struct be_adapter
*adapter
= netdev_priv(netdev
);
353 return ETHTOOL_TESTS_NUM
;
355 return ETHTOOL_STATS_NUM
+
356 adapter
->num_rx_qs
* ETHTOOL_RXSTATS_NUM
+
357 adapter
->num_tx_qs
* ETHTOOL_TXSTATS_NUM
;
363 static int be_get_settings(struct net_device
*netdev
, struct ethtool_cmd
*ecmd
)
365 struct be_adapter
*adapter
= netdev_priv(netdev
);
366 struct be_dma_mem phy_cmd
;
367 struct be_cmd_resp_get_phy_info
*resp
;
370 bool link_up
= false;
374 if ((adapter
->link_speed
< 0) || (!(netdev
->flags
& IFF_UP
))) {
375 status
= be_cmd_link_status_query(adapter
, &link_up
,
376 &mac_speed
, &link_speed
, 0);
378 be_link_status_update(adapter
, link_up
);
379 /* link_speed is in units of 10 Mbps */
381 ethtool_cmd_speed_set(ecmd
, link_speed
*10);
384 case PHY_LINK_SPEED_10MBPS
:
385 ethtool_cmd_speed_set(ecmd
, SPEED_10
);
387 case PHY_LINK_SPEED_100MBPS
:
388 ethtool_cmd_speed_set(ecmd
, SPEED_100
);
390 case PHY_LINK_SPEED_1GBPS
:
391 ethtool_cmd_speed_set(ecmd
, SPEED_1000
);
393 case PHY_LINK_SPEED_10GBPS
:
394 ethtool_cmd_speed_set(ecmd
, SPEED_10000
);
396 case PHY_LINK_SPEED_ZERO
:
397 ethtool_cmd_speed_set(ecmd
, 0);
402 phy_cmd
.size
= sizeof(struct be_cmd_req_get_phy_info
);
403 phy_cmd
.va
= dma_alloc_coherent(&adapter
->pdev
->dev
,
404 phy_cmd
.size
, &phy_cmd
.dma
,
407 dev_err(&adapter
->pdev
->dev
, "Memory alloc failure\n");
410 status
= be_cmd_get_phy_info(adapter
, &phy_cmd
);
413 intf_type
= le16_to_cpu(resp
->interface_type
);
416 case PHY_TYPE_XFP_10GB
:
417 case PHY_TYPE_SFP_1GB
:
418 case PHY_TYPE_SFP_PLUS_10GB
:
419 ecmd
->port
= PORT_FIBRE
;
422 ecmd
->port
= PORT_TP
;
427 case PHY_TYPE_KR_10GB
:
428 case PHY_TYPE_KX4_10GB
:
429 ecmd
->autoneg
= AUTONEG_ENABLE
;
430 ecmd
->transceiver
= XCVR_INTERNAL
;
433 ecmd
->autoneg
= AUTONEG_DISABLE
;
434 ecmd
->transceiver
= XCVR_EXTERNAL
;
439 /* Save for future use */
440 adapter
->link_speed
= ethtool_cmd_speed(ecmd
);
441 adapter
->port_type
= ecmd
->port
;
442 adapter
->transceiver
= ecmd
->transceiver
;
443 adapter
->autoneg
= ecmd
->autoneg
;
444 dma_free_coherent(&adapter
->pdev
->dev
, phy_cmd
.size
, phy_cmd
.va
,
447 ethtool_cmd_speed_set(ecmd
, adapter
->link_speed
);
448 ecmd
->port
= adapter
->port_type
;
449 ecmd
->transceiver
= adapter
->transceiver
;
450 ecmd
->autoneg
= adapter
->autoneg
;
453 ecmd
->duplex
= DUPLEX_FULL
;
454 ecmd
->phy_address
= adapter
->port_num
;
455 switch (ecmd
->port
) {
457 ecmd
->supported
= (SUPPORTED_10000baseT_Full
| SUPPORTED_FIBRE
);
460 ecmd
->supported
= (SUPPORTED_10000baseT_Full
| SUPPORTED_TP
);
463 ecmd
->supported
= (SUPPORTED_10000baseT_Full
| SUPPORTED_AUI
);
468 ecmd
->supported
|= SUPPORTED_1000baseT_Full
;
469 ecmd
->supported
|= SUPPORTED_Autoneg
;
470 ecmd
->advertising
|= (ADVERTISED_10000baseT_Full
|
471 ADVERTISED_1000baseT_Full
);
478 be_get_ringparam(struct net_device
*netdev
, struct ethtool_ringparam
*ring
)
480 struct be_adapter
*adapter
= netdev_priv(netdev
);
482 ring
->rx_max_pending
= adapter
->rx_obj
[0].q
.len
;
483 ring
->tx_max_pending
= adapter
->tx_obj
[0].q
.len
;
485 ring
->rx_pending
= atomic_read(&adapter
->rx_obj
[0].q
.used
);
486 ring
->tx_pending
= atomic_read(&adapter
->tx_obj
[0].q
.used
);
490 be_get_pauseparam(struct net_device
*netdev
, struct ethtool_pauseparam
*ecmd
)
492 struct be_adapter
*adapter
= netdev_priv(netdev
);
494 be_cmd_get_flow_control(adapter
, &ecmd
->tx_pause
, &ecmd
->rx_pause
);
499 be_set_pauseparam(struct net_device
*netdev
, struct ethtool_pauseparam
*ecmd
)
501 struct be_adapter
*adapter
= netdev_priv(netdev
);
504 if (ecmd
->autoneg
!= 0)
506 adapter
->tx_fc
= ecmd
->tx_pause
;
507 adapter
->rx_fc
= ecmd
->rx_pause
;
509 status
= be_cmd_set_flow_control(adapter
,
510 adapter
->tx_fc
, adapter
->rx_fc
);
512 dev_warn(&adapter
->pdev
->dev
, "Pause param set failed.\n");
518 be_set_phys_id(struct net_device
*netdev
,
519 enum ethtool_phys_id_state state
)
521 struct be_adapter
*adapter
= netdev_priv(netdev
);
524 case ETHTOOL_ID_ACTIVE
:
525 be_cmd_get_beacon_state(adapter
, adapter
->hba_port_num
,
526 &adapter
->beacon_state
);
527 return 1; /* cycle on/off once per second */
530 be_cmd_set_beacon_state(adapter
, adapter
->hba_port_num
, 0, 0,
531 BEACON_STATE_ENABLED
);
535 be_cmd_set_beacon_state(adapter
, adapter
->hba_port_num
, 0, 0,
536 BEACON_STATE_DISABLED
);
539 case ETHTOOL_ID_INACTIVE
:
540 be_cmd_set_beacon_state(adapter
, adapter
->hba_port_num
, 0, 0,
541 adapter
->beacon_state
);
548 be_is_wol_supported(struct be_adapter
*adapter
)
550 if (!be_physfn(adapter
))
557 be_get_wol(struct net_device
*netdev
, struct ethtool_wolinfo
*wol
)
559 struct be_adapter
*adapter
= netdev_priv(netdev
);
561 if (be_is_wol_supported(adapter
))
562 wol
->supported
= WAKE_MAGIC
;
565 wol
->wolopts
= WAKE_MAGIC
;
568 memset(&wol
->sopass
, 0, sizeof(wol
->sopass
));
572 be_set_wol(struct net_device
*netdev
, struct ethtool_wolinfo
*wol
)
574 struct be_adapter
*adapter
= netdev_priv(netdev
);
576 if (wol
->wolopts
& ~WAKE_MAGIC
)
579 if ((wol
->wolopts
& WAKE_MAGIC
) && be_is_wol_supported(adapter
))
582 adapter
->wol
= false;
588 be_test_ddr_dma(struct be_adapter
*adapter
)
591 struct be_dma_mem ddrdma_cmd
;
592 static const u64 pattern
[2] = {
593 0x5a5a5a5a5a5a5a5aULL
, 0xa5a5a5a5a5a5a5a5ULL
596 ddrdma_cmd
.size
= sizeof(struct be_cmd_req_ddrdma_test
);
597 ddrdma_cmd
.va
= dma_alloc_coherent(&adapter
->pdev
->dev
, ddrdma_cmd
.size
,
598 &ddrdma_cmd
.dma
, GFP_KERNEL
);
599 if (!ddrdma_cmd
.va
) {
600 dev_err(&adapter
->pdev
->dev
, "Memory allocation failure\n");
604 for (i
= 0; i
< 2; i
++) {
605 ret
= be_cmd_ddr_dma_test(adapter
, pattern
[i
],
612 dma_free_coherent(&adapter
->pdev
->dev
, ddrdma_cmd
.size
, ddrdma_cmd
.va
,
617 static u64
be_loopback_test(struct be_adapter
*adapter
, u8 loopback_type
,
620 be_cmd_set_loopback(adapter
, adapter
->hba_port_num
,
622 *status
= be_cmd_loopback_test(adapter
, adapter
->hba_port_num
,
625 be_cmd_set_loopback(adapter
, adapter
->hba_port_num
,
631 be_self_test(struct net_device
*netdev
, struct ethtool_test
*test
, u64
*data
)
633 struct be_adapter
*adapter
= netdev_priv(netdev
);
636 u16 qos_link_speed
= 0;
638 memset(data
, 0, sizeof(u64
) * ETHTOOL_TESTS_NUM
);
640 if (test
->flags
& ETH_TEST_FL_OFFLINE
) {
641 if (be_loopback_test(adapter
, BE_MAC_LOOPBACK
,
643 test
->flags
|= ETH_TEST_FL_FAILED
;
645 if (be_loopback_test(adapter
, BE_PHY_LOOPBACK
,
647 test
->flags
|= ETH_TEST_FL_FAILED
;
649 if (be_loopback_test(adapter
, BE_ONE_PORT_EXT_LOOPBACK
,
651 test
->flags
|= ETH_TEST_FL_FAILED
;
655 if (be_test_ddr_dma(adapter
) != 0) {
657 test
->flags
|= ETH_TEST_FL_FAILED
;
660 if (be_cmd_link_status_query(adapter
, &link_up
, &mac_speed
,
661 &qos_link_speed
, 0) != 0) {
662 test
->flags
|= ETH_TEST_FL_FAILED
;
664 } else if (!mac_speed
) {
665 test
->flags
|= ETH_TEST_FL_FAILED
;
671 be_do_flash(struct net_device
*netdev
, struct ethtool_flash
*efl
)
673 struct be_adapter
*adapter
= netdev_priv(netdev
);
674 char file_name
[ETHTOOL_FLASH_MAX_FILENAME
];
676 file_name
[ETHTOOL_FLASH_MAX_FILENAME
- 1] = 0;
677 strcpy(file_name
, efl
->data
);
679 return be_load_fw(adapter
, file_name
);
683 be_get_eeprom_len(struct net_device
*netdev
)
685 return BE_READ_SEEPROM_LEN
;
689 be_read_eeprom(struct net_device
*netdev
, struct ethtool_eeprom
*eeprom
,
692 struct be_adapter
*adapter
= netdev_priv(netdev
);
693 struct be_dma_mem eeprom_cmd
;
694 struct be_cmd_resp_seeprom_read
*resp
;
700 eeprom
->magic
= BE_VENDOR_ID
| (adapter
->pdev
->device
<<16);
702 memset(&eeprom_cmd
, 0, sizeof(struct be_dma_mem
));
703 eeprom_cmd
.size
= sizeof(struct be_cmd_req_seeprom_read
);
704 eeprom_cmd
.va
= dma_alloc_coherent(&adapter
->pdev
->dev
, eeprom_cmd
.size
,
705 &eeprom_cmd
.dma
, GFP_KERNEL
);
707 if (!eeprom_cmd
.va
) {
708 dev_err(&adapter
->pdev
->dev
,
709 "Memory allocation failure. Could not read eeprom\n");
713 status
= be_cmd_get_seeprom_data(adapter
, &eeprom_cmd
);
716 resp
= eeprom_cmd
.va
;
717 memcpy(data
, resp
->seeprom_data
+ eeprom
->offset
, eeprom
->len
);
719 dma_free_coherent(&adapter
->pdev
->dev
, eeprom_cmd
.size
, eeprom_cmd
.va
,
725 const struct ethtool_ops be_ethtool_ops
= {
726 .get_settings
= be_get_settings
,
727 .get_drvinfo
= be_get_drvinfo
,
728 .get_wol
= be_get_wol
,
729 .set_wol
= be_set_wol
,
730 .get_link
= ethtool_op_get_link
,
731 .get_eeprom_len
= be_get_eeprom_len
,
732 .get_eeprom
= be_read_eeprom
,
733 .get_coalesce
= be_get_coalesce
,
734 .set_coalesce
= be_set_coalesce
,
735 .get_ringparam
= be_get_ringparam
,
736 .get_pauseparam
= be_get_pauseparam
,
737 .set_pauseparam
= be_set_pauseparam
,
738 .get_strings
= be_get_stat_strings
,
739 .set_phys_id
= be_set_phys_id
,
740 .get_sset_count
= be_get_sset_count
,
741 .get_ethtool_stats
= be_get_ethtool_stats
,
742 .get_regs_len
= be_get_reg_len
,
743 .get_regs
= be_get_regs
,
744 .flash_device
= be_do_flash
,
745 .self_test
= be_self_test
,