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
, PORTSTAT
, MISCSTAT
, 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 MISCSTAT_INFO(field) #field, MISCSTAT,\
41 FIELDINFO(struct be_rxf_stats, field)
42 #define PORTSTAT_INFO(field) #field, PORTSTAT,\
43 FIELDINFO(struct be_port_rxf_stats, \
45 #define ERXSTAT_INFO(field) #field, ERXSTAT,\
46 FIELDINFO(struct be_erx_stats, field)
47 #define PMEMSTAT_INFO(field) #field, PMEMSTAT,\
48 FIELDINFO(struct be_pmem_stats, field)
49 #define DRVSTAT_INFO(field) #field, DRVSTAT,\
50 FIELDINFO(struct be_drv_stats, \
53 static const struct be_ethtool_stat et_stats
[] = {
54 {NETSTAT_INFO(rx_packets
)},
55 {NETSTAT_INFO(tx_packets
)},
56 {NETSTAT_INFO(rx_bytes
)},
57 {NETSTAT_INFO(tx_bytes
)},
58 {NETSTAT_INFO(rx_errors
)},
59 {NETSTAT_INFO(tx_errors
)},
60 {NETSTAT_INFO(rx_dropped
)},
61 {NETSTAT_INFO(tx_dropped
)},
62 {DRVSTAT_TX_INFO(be_tx_rate
)},
63 {DRVSTAT_TX_INFO(be_tx_reqs
)},
64 {DRVSTAT_TX_INFO(be_tx_wrbs
)},
65 {DRVSTAT_TX_INFO(be_tx_stops
)},
66 {DRVSTAT_TX_INFO(be_tx_events
)},
67 {DRVSTAT_TX_INFO(be_tx_compl
)},
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(rx_switched_unicast_packets
)},
94 {PORTSTAT_INFO(rx_switched_multicast_packets
)},
95 {PORTSTAT_INFO(rx_switched_broadcast_packets
)},
96 {PORTSTAT_INFO(tx_unicastframes
)},
97 {PORTSTAT_INFO(tx_multicastframes
)},
98 {PORTSTAT_INFO(tx_broadcastframes
)},
99 {PORTSTAT_INFO(tx_pauseframes
)},
100 {PORTSTAT_INFO(tx_controlframes
)},
101 {MISCSTAT_INFO(rx_drops_no_pbuf
)},
102 {MISCSTAT_INFO(rx_drops_no_txpb
)},
103 {MISCSTAT_INFO(rx_drops_no_erx_descr
)},
104 {MISCSTAT_INFO(rx_drops_no_tpre_descr
)},
105 {MISCSTAT_INFO(rx_drops_too_many_frags
)},
106 {MISCSTAT_INFO(rx_drops_invalid_ring
)},
107 {MISCSTAT_INFO(forwarded_packets
)},
108 {MISCSTAT_INFO(rx_drops_mtu
)},
109 {MISCSTAT_INFO(port0_jabber_events
)},
110 {MISCSTAT_INFO(port1_jabber_events
)},
111 {PMEMSTAT_INFO(eth_red_drops
)},
112 {DRVSTAT_INFO(be_on_die_temperature
)}
114 #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
116 /* Stats related to multi RX queues */
117 static const struct be_ethtool_stat et_rx_stats
[] = {
118 {DRVSTAT_RX_INFO(rx_bytes
)},
119 {DRVSTAT_RX_INFO(rx_pkts
)},
120 {DRVSTAT_RX_INFO(rx_rate
)},
121 {DRVSTAT_RX_INFO(rx_polls
)},
122 {DRVSTAT_RX_INFO(rx_events
)},
123 {DRVSTAT_RX_INFO(rx_compl
)},
124 {DRVSTAT_RX_INFO(rx_mcast_pkts
)},
125 {DRVSTAT_RX_INFO(rx_post_fail
)},
126 {ERXSTAT_INFO(rx_drops_no_fragments
)}
128 #define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
130 static const char et_self_tests
[][ETH_GSTRING_LEN
] = {
133 "External Loopback test",
138 #define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
139 #define BE_MAC_LOOPBACK 0x0
140 #define BE_PHY_LOOPBACK 0x1
141 #define BE_ONE_PORT_EXT_LOOPBACK 0x2
142 #define BE_NO_LOOPBACK 0xff
145 be_get_drvinfo(struct net_device
*netdev
, struct ethtool_drvinfo
*drvinfo
)
147 struct be_adapter
*adapter
= netdev_priv(netdev
);
149 strcpy(drvinfo
->driver
, DRV_NAME
);
150 strcpy(drvinfo
->version
, DRV_VER
);
151 strncpy(drvinfo
->fw_version
, adapter
->fw_ver
, FW_VER_LEN
);
152 strcpy(drvinfo
->bus_info
, pci_name(adapter
->pdev
));
153 drvinfo
->testinfo_len
= 0;
154 drvinfo
->regdump_len
= 0;
155 drvinfo
->eedump_len
= 0;
159 be_get_reg_len(struct net_device
*netdev
)
161 struct be_adapter
*adapter
= netdev_priv(netdev
);
164 be_cmd_get_reg_len(adapter
, &log_size
);
169 be_get_regs(struct net_device
*netdev
, struct ethtool_regs
*regs
, void *buf
)
171 struct be_adapter
*adapter
= netdev_priv(netdev
);
173 memset(buf
, 0, regs
->len
);
174 be_cmd_get_regs(adapter
, regs
->len
, buf
);
178 be_get_coalesce(struct net_device
*netdev
, struct ethtool_coalesce
*coalesce
)
180 struct be_adapter
*adapter
= netdev_priv(netdev
);
181 struct be_eq_obj
*rx_eq
= &adapter
->rx_obj
[0].rx_eq
;
182 struct be_eq_obj
*tx_eq
= &adapter
->tx_eq
;
184 coalesce
->rx_coalesce_usecs
= rx_eq
->cur_eqd
;
185 coalesce
->rx_coalesce_usecs_high
= rx_eq
->max_eqd
;
186 coalesce
->rx_coalesce_usecs_low
= rx_eq
->min_eqd
;
188 coalesce
->tx_coalesce_usecs
= tx_eq
->cur_eqd
;
189 coalesce
->tx_coalesce_usecs_high
= tx_eq
->max_eqd
;
190 coalesce
->tx_coalesce_usecs_low
= tx_eq
->min_eqd
;
192 coalesce
->use_adaptive_rx_coalesce
= rx_eq
->enable_aic
;
193 coalesce
->use_adaptive_tx_coalesce
= tx_eq
->enable_aic
;
199 * This routine is used to set interrup coalescing delay
202 be_set_coalesce(struct net_device
*netdev
, struct ethtool_coalesce
*coalesce
)
204 struct be_adapter
*adapter
= netdev_priv(netdev
);
205 struct be_rx_obj
*rxo
;
206 struct be_eq_obj
*rx_eq
;
207 struct be_eq_obj
*tx_eq
= &adapter
->tx_eq
;
208 u32 tx_max
, tx_min
, tx_cur
;
209 u32 rx_max
, rx_min
, rx_cur
;
212 if (coalesce
->use_adaptive_tx_coalesce
== 1)
215 for_all_rx_queues(adapter
, rxo
, i
) {
218 if (!rx_eq
->enable_aic
&& coalesce
->use_adaptive_rx_coalesce
)
220 rx_eq
->enable_aic
= coalesce
->use_adaptive_rx_coalesce
;
222 rx_max
= coalesce
->rx_coalesce_usecs_high
;
223 rx_min
= coalesce
->rx_coalesce_usecs_low
;
224 rx_cur
= coalesce
->rx_coalesce_usecs
;
226 if (rx_eq
->enable_aic
) {
227 if (rx_max
> BE_MAX_EQD
)
231 rx_eq
->max_eqd
= rx_max
;
232 rx_eq
->min_eqd
= rx_min
;
233 if (rx_eq
->cur_eqd
> rx_max
)
234 rx_eq
->cur_eqd
= rx_max
;
235 if (rx_eq
->cur_eqd
< rx_min
)
236 rx_eq
->cur_eqd
= rx_min
;
238 if (rx_cur
> BE_MAX_EQD
)
240 if (rx_eq
->cur_eqd
!= rx_cur
) {
241 status
= be_cmd_modify_eqd(adapter
, rx_eq
->q
.id
,
244 rx_eq
->cur_eqd
= rx_cur
;
249 tx_max
= coalesce
->tx_coalesce_usecs_high
;
250 tx_min
= coalesce
->tx_coalesce_usecs_low
;
251 tx_cur
= coalesce
->tx_coalesce_usecs
;
253 if (tx_cur
> BE_MAX_EQD
)
255 if (tx_eq
->cur_eqd
!= tx_cur
) {
256 status
= be_cmd_modify_eqd(adapter
, tx_eq
->q
.id
, tx_cur
);
258 tx_eq
->cur_eqd
= tx_cur
;
264 static u32
be_get_rx_csum(struct net_device
*netdev
)
266 struct be_adapter
*adapter
= netdev_priv(netdev
);
268 return adapter
->rx_csum
;
271 static int be_set_rx_csum(struct net_device
*netdev
, uint32_t data
)
273 struct be_adapter
*adapter
= netdev_priv(netdev
);
276 adapter
->rx_csum
= true;
278 adapter
->rx_csum
= false;
284 be_get_ethtool_stats(struct net_device
*netdev
,
285 struct ethtool_stats
*stats
, uint64_t *data
)
287 struct be_adapter
*adapter
= netdev_priv(netdev
);
288 struct be_hw_stats
*hw_stats
= hw_stats_from_cmd(adapter
->stats_cmd
.va
);
289 struct be_erx_stats
*erx_stats
= &hw_stats
->erx
;
290 struct be_rx_obj
*rxo
;
294 for (i
= 0; i
< ETHTOOL_STATS_NUM
; i
++) {
295 switch (et_stats
[i
].type
) {
300 p
= &adapter
->tx_stats
;
303 p
= &hw_stats
->rxf
.port
[adapter
->port_num
];
312 p
= &adapter
->drv_stats
;
316 p
= (u8
*)p
+ et_stats
[i
].offset
;
317 data
[i
] = (et_stats
[i
].size
== sizeof(u64
)) ?
318 *(u64
*)p
: *(u32
*)p
;
321 for_all_rx_queues(adapter
, rxo
, j
) {
322 for (i
= 0; i
< ETHTOOL_RXSTATS_NUM
; i
++) {
323 switch (et_rx_stats
[i
].type
) {
325 p
= (u8
*)&rxo
->stats
+ et_rx_stats
[i
].offset
;
328 p
= (u32
*)erx_stats
+ rxo
->q
.id
;
331 data
[ETHTOOL_STATS_NUM
+ j
* ETHTOOL_RXSTATS_NUM
+ i
] =
332 (et_rx_stats
[i
].size
== sizeof(u64
)) ?
333 *(u64
*)p
: *(u32
*)p
;
339 be_get_stat_strings(struct net_device
*netdev
, uint32_t stringset
,
342 struct be_adapter
*adapter
= netdev_priv(netdev
);
347 for (i
= 0; i
< ETHTOOL_STATS_NUM
; i
++) {
348 memcpy(data
, et_stats
[i
].desc
, ETH_GSTRING_LEN
);
349 data
+= ETH_GSTRING_LEN
;
351 for (i
= 0; i
< adapter
->num_rx_qs
; i
++) {
352 for (j
= 0; j
< ETHTOOL_RXSTATS_NUM
; j
++) {
353 sprintf(data
, "rxq%d: %s", i
,
354 et_rx_stats
[j
].desc
);
355 data
+= ETH_GSTRING_LEN
;
360 for (i
= 0; i
< ETHTOOL_TESTS_NUM
; i
++) {
361 memcpy(data
, et_self_tests
[i
], ETH_GSTRING_LEN
);
362 data
+= ETH_GSTRING_LEN
;
368 static int be_get_sset_count(struct net_device
*netdev
, int stringset
)
370 struct be_adapter
*adapter
= netdev_priv(netdev
);
374 return ETHTOOL_TESTS_NUM
;
376 return ETHTOOL_STATS_NUM
+
377 adapter
->num_rx_qs
* ETHTOOL_RXSTATS_NUM
;
383 static int be_get_settings(struct net_device
*netdev
, struct ethtool_cmd
*ecmd
)
385 struct be_adapter
*adapter
= netdev_priv(netdev
);
386 struct be_dma_mem phy_cmd
;
387 struct be_cmd_resp_get_phy_info
*resp
;
390 bool link_up
= false;
394 if ((adapter
->link_speed
< 0) || (!(netdev
->flags
& IFF_UP
))) {
395 status
= be_cmd_link_status_query(adapter
, &link_up
,
396 &mac_speed
, &link_speed
);
398 be_link_status_update(adapter
, link_up
);
399 /* link_speed is in units of 10 Mbps */
401 ecmd
->speed
= link_speed
*10;
404 case PHY_LINK_SPEED_1GBPS
:
405 ecmd
->speed
= SPEED_1000
;
407 case PHY_LINK_SPEED_10GBPS
:
408 ecmd
->speed
= SPEED_10000
;
413 phy_cmd
.size
= sizeof(struct be_cmd_req_get_phy_info
);
414 phy_cmd
.va
= dma_alloc_coherent(&adapter
->pdev
->dev
,
415 phy_cmd
.size
, &phy_cmd
.dma
,
418 dev_err(&adapter
->pdev
->dev
, "Memory alloc failure\n");
421 status
= be_cmd_get_phy_info(adapter
, &phy_cmd
);
423 resp
= (struct be_cmd_resp_get_phy_info
*) phy_cmd
.va
;
424 intf_type
= le16_to_cpu(resp
->interface_type
);
427 case PHY_TYPE_XFP_10GB
:
428 case PHY_TYPE_SFP_1GB
:
429 case PHY_TYPE_SFP_PLUS_10GB
:
430 ecmd
->port
= PORT_FIBRE
;
433 ecmd
->port
= PORT_TP
;
438 case PHY_TYPE_KR_10GB
:
439 case PHY_TYPE_KX4_10GB
:
440 ecmd
->autoneg
= AUTONEG_ENABLE
;
441 ecmd
->transceiver
= XCVR_INTERNAL
;
444 ecmd
->autoneg
= AUTONEG_DISABLE
;
445 ecmd
->transceiver
= XCVR_EXTERNAL
;
450 /* Save for future use */
451 adapter
->link_speed
= ecmd
->speed
;
452 adapter
->port_type
= ecmd
->port
;
453 adapter
->transceiver
= ecmd
->transceiver
;
454 adapter
->autoneg
= ecmd
->autoneg
;
455 dma_free_coherent(&adapter
->pdev
->dev
, phy_cmd
.size
, phy_cmd
.va
,
458 ecmd
->speed
= adapter
->link_speed
;
459 ecmd
->port
= adapter
->port_type
;
460 ecmd
->transceiver
= adapter
->transceiver
;
461 ecmd
->autoneg
= adapter
->autoneg
;
464 ecmd
->duplex
= DUPLEX_FULL
;
465 ecmd
->phy_address
= adapter
->port_num
;
466 switch (ecmd
->port
) {
468 ecmd
->supported
= (SUPPORTED_10000baseT_Full
| SUPPORTED_FIBRE
);
471 ecmd
->supported
= (SUPPORTED_10000baseT_Full
| SUPPORTED_TP
);
474 ecmd
->supported
= (SUPPORTED_10000baseT_Full
| SUPPORTED_AUI
);
479 ecmd
->supported
|= SUPPORTED_1000baseT_Full
;
480 ecmd
->supported
|= SUPPORTED_Autoneg
;
481 ecmd
->advertising
|= (ADVERTISED_10000baseT_Full
|
482 ADVERTISED_1000baseT_Full
);
489 be_get_ringparam(struct net_device
*netdev
, struct ethtool_ringparam
*ring
)
491 struct be_adapter
*adapter
= netdev_priv(netdev
);
493 ring
->rx_max_pending
= adapter
->rx_obj
[0].q
.len
;
494 ring
->tx_max_pending
= adapter
->tx_obj
.q
.len
;
496 ring
->rx_pending
= atomic_read(&adapter
->rx_obj
[0].q
.used
);
497 ring
->tx_pending
= atomic_read(&adapter
->tx_obj
.q
.used
);
501 be_get_pauseparam(struct net_device
*netdev
, struct ethtool_pauseparam
*ecmd
)
503 struct be_adapter
*adapter
= netdev_priv(netdev
);
505 be_cmd_get_flow_control(adapter
, &ecmd
->tx_pause
, &ecmd
->rx_pause
);
510 be_set_pauseparam(struct net_device
*netdev
, struct ethtool_pauseparam
*ecmd
)
512 struct be_adapter
*adapter
= netdev_priv(netdev
);
515 if (ecmd
->autoneg
!= 0)
517 adapter
->tx_fc
= ecmd
->tx_pause
;
518 adapter
->rx_fc
= ecmd
->rx_pause
;
520 status
= be_cmd_set_flow_control(adapter
,
521 adapter
->tx_fc
, adapter
->rx_fc
);
523 dev_warn(&adapter
->pdev
->dev
, "Pause param set failed.\n");
529 be_set_phys_id(struct net_device
*netdev
,
530 enum ethtool_phys_id_state state
)
532 struct be_adapter
*adapter
= netdev_priv(netdev
);
535 case ETHTOOL_ID_ACTIVE
:
536 be_cmd_get_beacon_state(adapter
, adapter
->hba_port_num
,
537 &adapter
->beacon_state
);
541 be_cmd_set_beacon_state(adapter
, adapter
->hba_port_num
, 0, 0,
542 BEACON_STATE_ENABLED
);
546 be_cmd_set_beacon_state(adapter
, adapter
->hba_port_num
, 0, 0,
547 BEACON_STATE_DISABLED
);
550 case ETHTOOL_ID_INACTIVE
:
551 be_cmd_set_beacon_state(adapter
, adapter
->hba_port_num
, 0, 0,
552 adapter
->beacon_state
);
559 be_is_wol_supported(struct be_adapter
*adapter
)
561 if (!be_physfn(adapter
))
568 be_get_wol(struct net_device
*netdev
, struct ethtool_wolinfo
*wol
)
570 struct be_adapter
*adapter
= netdev_priv(netdev
);
572 if (be_is_wol_supported(adapter
))
573 wol
->supported
= WAKE_MAGIC
;
576 wol
->wolopts
= WAKE_MAGIC
;
579 memset(&wol
->sopass
, 0, sizeof(wol
->sopass
));
583 be_set_wol(struct net_device
*netdev
, struct ethtool_wolinfo
*wol
)
585 struct be_adapter
*adapter
= netdev_priv(netdev
);
587 if (wol
->wolopts
& ~WAKE_MAGIC
)
590 if ((wol
->wolopts
& WAKE_MAGIC
) && be_is_wol_supported(adapter
))
593 adapter
->wol
= false;
599 be_test_ddr_dma(struct be_adapter
*adapter
)
602 struct be_dma_mem ddrdma_cmd
;
603 static const u64 pattern
[2] = {
604 0x5a5a5a5a5a5a5a5aULL
, 0xa5a5a5a5a5a5a5a5ULL
607 ddrdma_cmd
.size
= sizeof(struct be_cmd_req_ddrdma_test
);
608 ddrdma_cmd
.va
= dma_alloc_coherent(&adapter
->pdev
->dev
, ddrdma_cmd
.size
,
609 &ddrdma_cmd
.dma
, GFP_KERNEL
);
610 if (!ddrdma_cmd
.va
) {
611 dev_err(&adapter
->pdev
->dev
, "Memory allocation failure\n");
615 for (i
= 0; i
< 2; i
++) {
616 ret
= be_cmd_ddr_dma_test(adapter
, pattern
[i
],
623 dma_free_coherent(&adapter
->pdev
->dev
, ddrdma_cmd
.size
, ddrdma_cmd
.va
,
628 static u64
be_loopback_test(struct be_adapter
*adapter
, u8 loopback_type
,
631 be_cmd_set_loopback(adapter
, adapter
->hba_port_num
,
633 *status
= be_cmd_loopback_test(adapter
, adapter
->hba_port_num
,
636 be_cmd_set_loopback(adapter
, adapter
->hba_port_num
,
642 be_self_test(struct net_device
*netdev
, struct ethtool_test
*test
, u64
*data
)
644 struct be_adapter
*adapter
= netdev_priv(netdev
);
647 u16 qos_link_speed
= 0;
649 memset(data
, 0, sizeof(u64
) * ETHTOOL_TESTS_NUM
);
651 if (test
->flags
& ETH_TEST_FL_OFFLINE
) {
652 if (be_loopback_test(adapter
, BE_MAC_LOOPBACK
,
654 test
->flags
|= ETH_TEST_FL_FAILED
;
656 if (be_loopback_test(adapter
, BE_PHY_LOOPBACK
,
658 test
->flags
|= ETH_TEST_FL_FAILED
;
660 if (be_loopback_test(adapter
, BE_ONE_PORT_EXT_LOOPBACK
,
662 test
->flags
|= ETH_TEST_FL_FAILED
;
666 if (be_test_ddr_dma(adapter
) != 0) {
668 test
->flags
|= ETH_TEST_FL_FAILED
;
671 if (be_cmd_link_status_query(adapter
, &link_up
, &mac_speed
,
672 &qos_link_speed
) != 0) {
673 test
->flags
|= ETH_TEST_FL_FAILED
;
675 } else if (!mac_speed
) {
676 test
->flags
|= ETH_TEST_FL_FAILED
;
682 be_do_flash(struct net_device
*netdev
, struct ethtool_flash
*efl
)
684 struct be_adapter
*adapter
= netdev_priv(netdev
);
685 char file_name
[ETHTOOL_FLASH_MAX_FILENAME
];
688 file_name
[ETHTOOL_FLASH_MAX_FILENAME
- 1] = 0;
689 strcpy(file_name
, efl
->data
);
690 region
= efl
->region
;
692 return be_load_fw(adapter
, file_name
);
696 be_get_eeprom_len(struct net_device
*netdev
)
698 return BE_READ_SEEPROM_LEN
;
702 be_read_eeprom(struct net_device
*netdev
, struct ethtool_eeprom
*eeprom
,
705 struct be_adapter
*adapter
= netdev_priv(netdev
);
706 struct be_dma_mem eeprom_cmd
;
707 struct be_cmd_resp_seeprom_read
*resp
;
713 eeprom
->magic
= BE_VENDOR_ID
| (adapter
->pdev
->device
<<16);
715 memset(&eeprom_cmd
, 0, sizeof(struct be_dma_mem
));
716 eeprom_cmd
.size
= sizeof(struct be_cmd_req_seeprom_read
);
717 eeprom_cmd
.va
= dma_alloc_coherent(&adapter
->pdev
->dev
, eeprom_cmd
.size
,
718 &eeprom_cmd
.dma
, GFP_KERNEL
);
720 if (!eeprom_cmd
.va
) {
721 dev_err(&adapter
->pdev
->dev
,
722 "Memory allocation failure. Could not read eeprom\n");
726 status
= be_cmd_get_seeprom_data(adapter
, &eeprom_cmd
);
729 resp
= (struct be_cmd_resp_seeprom_read
*) eeprom_cmd
.va
;
730 memcpy(data
, resp
->seeprom_data
+ eeprom
->offset
, eeprom
->len
);
732 dma_free_coherent(&adapter
->pdev
->dev
, eeprom_cmd
.size
, eeprom_cmd
.va
,
738 const struct ethtool_ops be_ethtool_ops
= {
739 .get_settings
= be_get_settings
,
740 .get_drvinfo
= be_get_drvinfo
,
741 .get_wol
= be_get_wol
,
742 .set_wol
= be_set_wol
,
743 .get_link
= ethtool_op_get_link
,
744 .get_eeprom_len
= be_get_eeprom_len
,
745 .get_eeprom
= be_read_eeprom
,
746 .get_coalesce
= be_get_coalesce
,
747 .set_coalesce
= be_set_coalesce
,
748 .get_ringparam
= be_get_ringparam
,
749 .get_pauseparam
= be_get_pauseparam
,
750 .set_pauseparam
= be_set_pauseparam
,
751 .get_rx_csum
= be_get_rx_csum
,
752 .set_rx_csum
= be_set_rx_csum
,
753 .get_tx_csum
= ethtool_op_get_tx_csum
,
754 .set_tx_csum
= ethtool_op_set_tx_hw_csum
,
755 .get_sg
= ethtool_op_get_sg
,
756 .set_sg
= ethtool_op_set_sg
,
757 .get_tso
= ethtool_op_get_tso
,
758 .set_tso
= ethtool_op_set_tso
,
759 .get_strings
= be_get_stat_strings
,
760 .set_phys_id
= be_set_phys_id
,
761 .get_sset_count
= be_get_sset_count
,
762 .get_ethtool_stats
= be_get_ethtool_stats
,
763 .get_regs_len
= be_get_reg_len
,
764 .get_regs
= be_get_regs
,
765 .flash_device
= be_do_flash
,
766 .self_test
= be_self_test
,