1 /*******************************************************************************
3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2011 Intel Corporation.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *******************************************************************************/
29 /* ethtool support for e1000 */
31 #include <linux/netdevice.h>
32 #include <linux/ethtool.h>
33 #include <linux/pci.h>
34 #include <linux/slab.h>
35 #include <linux/delay.h>
39 enum {NETDEV_STATS
, E1000_STATS
};
42 char stat_string
[ETH_GSTRING_LEN
];
48 #define E1000_STAT(str, m) { \
50 .type = E1000_STATS, \
51 .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \
52 .stat_offset = offsetof(struct e1000_adapter, m) }
53 #define E1000_NETDEV_STAT(str, m) { \
55 .type = NETDEV_STATS, \
56 .sizeof_stat = sizeof(((struct rtnl_link_stats64 *)0)->m), \
57 .stat_offset = offsetof(struct rtnl_link_stats64, m) }
59 static const struct e1000_stats e1000_gstrings_stats
[] = {
60 E1000_STAT("rx_packets", stats
.gprc
),
61 E1000_STAT("tx_packets", stats
.gptc
),
62 E1000_STAT("rx_bytes", stats
.gorc
),
63 E1000_STAT("tx_bytes", stats
.gotc
),
64 E1000_STAT("rx_broadcast", stats
.bprc
),
65 E1000_STAT("tx_broadcast", stats
.bptc
),
66 E1000_STAT("rx_multicast", stats
.mprc
),
67 E1000_STAT("tx_multicast", stats
.mptc
),
68 E1000_NETDEV_STAT("rx_errors", rx_errors
),
69 E1000_NETDEV_STAT("tx_errors", tx_errors
),
70 E1000_NETDEV_STAT("tx_dropped", tx_dropped
),
71 E1000_STAT("multicast", stats
.mprc
),
72 E1000_STAT("collisions", stats
.colc
),
73 E1000_NETDEV_STAT("rx_length_errors", rx_length_errors
),
74 E1000_NETDEV_STAT("rx_over_errors", rx_over_errors
),
75 E1000_STAT("rx_crc_errors", stats
.crcerrs
),
76 E1000_NETDEV_STAT("rx_frame_errors", rx_frame_errors
),
77 E1000_STAT("rx_no_buffer_count", stats
.rnbc
),
78 E1000_STAT("rx_missed_errors", stats
.mpc
),
79 E1000_STAT("tx_aborted_errors", stats
.ecol
),
80 E1000_STAT("tx_carrier_errors", stats
.tncrs
),
81 E1000_NETDEV_STAT("tx_fifo_errors", tx_fifo_errors
),
82 E1000_NETDEV_STAT("tx_heartbeat_errors", tx_heartbeat_errors
),
83 E1000_STAT("tx_window_errors", stats
.latecol
),
84 E1000_STAT("tx_abort_late_coll", stats
.latecol
),
85 E1000_STAT("tx_deferred_ok", stats
.dc
),
86 E1000_STAT("tx_single_coll_ok", stats
.scc
),
87 E1000_STAT("tx_multi_coll_ok", stats
.mcc
),
88 E1000_STAT("tx_timeout_count", tx_timeout_count
),
89 E1000_STAT("tx_restart_queue", restart_queue
),
90 E1000_STAT("rx_long_length_errors", stats
.roc
),
91 E1000_STAT("rx_short_length_errors", stats
.ruc
),
92 E1000_STAT("rx_align_errors", stats
.algnerrc
),
93 E1000_STAT("tx_tcp_seg_good", stats
.tsctc
),
94 E1000_STAT("tx_tcp_seg_failed", stats
.tsctfc
),
95 E1000_STAT("rx_flow_control_xon", stats
.xonrxc
),
96 E1000_STAT("rx_flow_control_xoff", stats
.xoffrxc
),
97 E1000_STAT("tx_flow_control_xon", stats
.xontxc
),
98 E1000_STAT("tx_flow_control_xoff", stats
.xofftxc
),
99 E1000_STAT("rx_long_byte_count", stats
.gorc
),
100 E1000_STAT("rx_csum_offload_good", hw_csum_good
),
101 E1000_STAT("rx_csum_offload_errors", hw_csum_err
),
102 E1000_STAT("rx_header_split", rx_hdr_split
),
103 E1000_STAT("alloc_rx_buff_failed", alloc_rx_buff_failed
),
104 E1000_STAT("tx_smbus", stats
.mgptc
),
105 E1000_STAT("rx_smbus", stats
.mgprc
),
106 E1000_STAT("dropped_smbus", stats
.mgpdc
),
107 E1000_STAT("rx_dma_failed", rx_dma_failed
),
108 E1000_STAT("tx_dma_failed", tx_dma_failed
),
111 #define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats)
112 #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN)
113 static const char e1000_gstrings_test
[][ETH_GSTRING_LEN
] = {
114 "Register test (offline)", "Eeprom test (offline)",
115 "Interrupt test (offline)", "Loopback test (offline)",
116 "Link test (on/offline)"
118 #define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test)
120 static int e1000_get_settings(struct net_device
*netdev
,
121 struct ethtool_cmd
*ecmd
)
123 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
124 struct e1000_hw
*hw
= &adapter
->hw
;
127 if (hw
->phy
.media_type
== e1000_media_type_copper
) {
129 ecmd
->supported
= (SUPPORTED_10baseT_Half
|
130 SUPPORTED_10baseT_Full
|
131 SUPPORTED_100baseT_Half
|
132 SUPPORTED_100baseT_Full
|
133 SUPPORTED_1000baseT_Full
|
136 if (hw
->phy
.type
== e1000_phy_ife
)
137 ecmd
->supported
&= ~SUPPORTED_1000baseT_Full
;
138 ecmd
->advertising
= ADVERTISED_TP
;
140 if (hw
->mac
.autoneg
== 1) {
141 ecmd
->advertising
|= ADVERTISED_Autoneg
;
142 /* the e1000 autoneg seems to match ethtool nicely */
143 ecmd
->advertising
|= hw
->phy
.autoneg_advertised
;
146 ecmd
->port
= PORT_TP
;
147 ecmd
->phy_address
= hw
->phy
.addr
;
148 ecmd
->transceiver
= XCVR_INTERNAL
;
151 ecmd
->supported
= (SUPPORTED_1000baseT_Full
|
155 ecmd
->advertising
= (ADVERTISED_1000baseT_Full
|
159 ecmd
->port
= PORT_FIBRE
;
160 ecmd
->transceiver
= XCVR_EXTERNAL
;
166 if (netif_running(netdev
)) {
167 if (netif_carrier_ok(netdev
)) {
168 speed
= adapter
->link_speed
;
169 ecmd
->duplex
= adapter
->link_duplex
- 1;
172 u32 status
= er32(STATUS
);
173 if (status
& E1000_STATUS_LU
) {
174 if (status
& E1000_STATUS_SPEED_1000
)
176 else if (status
& E1000_STATUS_SPEED_100
)
181 if (status
& E1000_STATUS_FD
)
182 ecmd
->duplex
= DUPLEX_FULL
;
184 ecmd
->duplex
= DUPLEX_HALF
;
188 ethtool_cmd_speed_set(ecmd
, speed
);
189 ecmd
->autoneg
= ((hw
->phy
.media_type
== e1000_media_type_fiber
) ||
190 hw
->mac
.autoneg
) ? AUTONEG_ENABLE
: AUTONEG_DISABLE
;
192 /* MDI-X => 2; MDI =>1; Invalid =>0 */
193 if ((hw
->phy
.media_type
== e1000_media_type_copper
) &&
194 netif_carrier_ok(netdev
))
195 ecmd
->eth_tp_mdix
= hw
->phy
.is_mdix
? ETH_TP_MDI_X
:
198 ecmd
->eth_tp_mdix
= ETH_TP_MDI_INVALID
;
203 static int e1000_set_spd_dplx(struct e1000_adapter
*adapter
, u32 spd
, u8 dplx
)
205 struct e1000_mac_info
*mac
= &adapter
->hw
.mac
;
209 /* Make sure dplx is at most 1 bit and lsb of speed is not set
210 * for the switch() below to work */
211 if ((spd
& 1) || (dplx
& ~1))
214 /* Fiber NICs only allow 1000 gbps Full duplex */
215 if ((adapter
->hw
.phy
.media_type
== e1000_media_type_fiber
) &&
217 dplx
!= DUPLEX_FULL
) {
221 switch (spd
+ dplx
) {
222 case SPEED_10
+ DUPLEX_HALF
:
223 mac
->forced_speed_duplex
= ADVERTISE_10_HALF
;
225 case SPEED_10
+ DUPLEX_FULL
:
226 mac
->forced_speed_duplex
= ADVERTISE_10_FULL
;
228 case SPEED_100
+ DUPLEX_HALF
:
229 mac
->forced_speed_duplex
= ADVERTISE_100_HALF
;
231 case SPEED_100
+ DUPLEX_FULL
:
232 mac
->forced_speed_duplex
= ADVERTISE_100_FULL
;
234 case SPEED_1000
+ DUPLEX_FULL
:
236 adapter
->hw
.phy
.autoneg_advertised
= ADVERTISE_1000_FULL
;
238 case SPEED_1000
+ DUPLEX_HALF
: /* not supported */
245 e_err("Unsupported Speed/Duplex configuration\n");
249 static int e1000_set_settings(struct net_device
*netdev
,
250 struct ethtool_cmd
*ecmd
)
252 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
253 struct e1000_hw
*hw
= &adapter
->hw
;
256 * When SoL/IDER sessions are active, autoneg/speed/duplex
259 if (e1000_check_reset_block(hw
)) {
260 e_err("Cannot change link characteristics when SoL/IDER is "
265 while (test_and_set_bit(__E1000_RESETTING
, &adapter
->state
))
266 usleep_range(1000, 2000);
268 if (ecmd
->autoneg
== AUTONEG_ENABLE
) {
270 if (hw
->phy
.media_type
== e1000_media_type_fiber
)
271 hw
->phy
.autoneg_advertised
= ADVERTISED_1000baseT_Full
|
275 hw
->phy
.autoneg_advertised
= ecmd
->advertising
|
278 ecmd
->advertising
= hw
->phy
.autoneg_advertised
;
279 if (adapter
->fc_autoneg
)
280 hw
->fc
.requested_mode
= e1000_fc_default
;
282 u32 speed
= ethtool_cmd_speed(ecmd
);
283 if (e1000_set_spd_dplx(adapter
, speed
, ecmd
->duplex
)) {
284 clear_bit(__E1000_RESETTING
, &adapter
->state
);
291 if (netif_running(adapter
->netdev
)) {
292 e1000e_down(adapter
);
295 e1000e_reset(adapter
);
298 clear_bit(__E1000_RESETTING
, &adapter
->state
);
302 static void e1000_get_pauseparam(struct net_device
*netdev
,
303 struct ethtool_pauseparam
*pause
)
305 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
306 struct e1000_hw
*hw
= &adapter
->hw
;
309 (adapter
->fc_autoneg
? AUTONEG_ENABLE
: AUTONEG_DISABLE
);
311 if (hw
->fc
.current_mode
== e1000_fc_rx_pause
) {
313 } else if (hw
->fc
.current_mode
== e1000_fc_tx_pause
) {
315 } else if (hw
->fc
.current_mode
== e1000_fc_full
) {
321 static int e1000_set_pauseparam(struct net_device
*netdev
,
322 struct ethtool_pauseparam
*pause
)
324 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
325 struct e1000_hw
*hw
= &adapter
->hw
;
328 adapter
->fc_autoneg
= pause
->autoneg
;
330 while (test_and_set_bit(__E1000_RESETTING
, &adapter
->state
))
331 usleep_range(1000, 2000);
333 if (adapter
->fc_autoneg
== AUTONEG_ENABLE
) {
334 hw
->fc
.requested_mode
= e1000_fc_default
;
335 if (netif_running(adapter
->netdev
)) {
336 e1000e_down(adapter
);
339 e1000e_reset(adapter
);
342 if (pause
->rx_pause
&& pause
->tx_pause
)
343 hw
->fc
.requested_mode
= e1000_fc_full
;
344 else if (pause
->rx_pause
&& !pause
->tx_pause
)
345 hw
->fc
.requested_mode
= e1000_fc_rx_pause
;
346 else if (!pause
->rx_pause
&& pause
->tx_pause
)
347 hw
->fc
.requested_mode
= e1000_fc_tx_pause
;
348 else if (!pause
->rx_pause
&& !pause
->tx_pause
)
349 hw
->fc
.requested_mode
= e1000_fc_none
;
351 hw
->fc
.current_mode
= hw
->fc
.requested_mode
;
353 if (hw
->phy
.media_type
== e1000_media_type_fiber
) {
354 retval
= hw
->mac
.ops
.setup_link(hw
);
355 /* implicit goto out */
357 retval
= e1000e_force_mac_fc(hw
);
360 e1000e_set_fc_watermarks(hw
);
365 clear_bit(__E1000_RESETTING
, &adapter
->state
);
369 static u32
e1000_get_rx_csum(struct net_device
*netdev
)
371 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
372 return adapter
->flags
& FLAG_RX_CSUM_ENABLED
;
375 static int e1000_set_rx_csum(struct net_device
*netdev
, u32 data
)
377 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
380 adapter
->flags
|= FLAG_RX_CSUM_ENABLED
;
382 adapter
->flags
&= ~FLAG_RX_CSUM_ENABLED
;
384 if (netif_running(netdev
))
385 e1000e_reinit_locked(adapter
);
387 e1000e_reset(adapter
);
391 static u32
e1000_get_tx_csum(struct net_device
*netdev
)
393 return (netdev
->features
& NETIF_F_HW_CSUM
) != 0;
396 static int e1000_set_tx_csum(struct net_device
*netdev
, u32 data
)
399 netdev
->features
|= NETIF_F_HW_CSUM
;
401 netdev
->features
&= ~NETIF_F_HW_CSUM
;
406 static int e1000_set_tso(struct net_device
*netdev
, u32 data
)
408 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
411 netdev
->features
|= NETIF_F_TSO
;
412 netdev
->features
|= NETIF_F_TSO6
;
414 netdev
->features
&= ~NETIF_F_TSO
;
415 netdev
->features
&= ~NETIF_F_TSO6
;
418 adapter
->flags
|= FLAG_TSO_FORCE
;
422 static u32
e1000_get_msglevel(struct net_device
*netdev
)
424 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
425 return adapter
->msg_enable
;
428 static void e1000_set_msglevel(struct net_device
*netdev
, u32 data
)
430 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
431 adapter
->msg_enable
= data
;
434 static int e1000_get_regs_len(struct net_device
*netdev
)
436 #define E1000_REGS_LEN 32 /* overestimate */
437 return E1000_REGS_LEN
* sizeof(u32
);
440 static void e1000_get_regs(struct net_device
*netdev
,
441 struct ethtool_regs
*regs
, void *p
)
443 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
444 struct e1000_hw
*hw
= &adapter
->hw
;
448 memset(p
, 0, E1000_REGS_LEN
* sizeof(u32
));
450 regs
->version
= (1 << 24) | (adapter
->pdev
->revision
<< 16) |
451 adapter
->pdev
->device
;
453 regs_buff
[0] = er32(CTRL
);
454 regs_buff
[1] = er32(STATUS
);
456 regs_buff
[2] = er32(RCTL
);
457 regs_buff
[3] = er32(RDLEN
);
458 regs_buff
[4] = er32(RDH
);
459 regs_buff
[5] = er32(RDT
);
460 regs_buff
[6] = er32(RDTR
);
462 regs_buff
[7] = er32(TCTL
);
463 regs_buff
[8] = er32(TDLEN
);
464 regs_buff
[9] = er32(TDH
);
465 regs_buff
[10] = er32(TDT
);
466 regs_buff
[11] = er32(TIDV
);
468 regs_buff
[12] = adapter
->hw
.phy
.type
; /* PHY type (IGP=1, M88=0) */
470 /* ethtool doesn't use anything past this point, so all this
471 * code is likely legacy junk for apps that may or may not
473 if (hw
->phy
.type
== e1000_phy_m88
) {
474 e1e_rphy(hw
, M88E1000_PHY_SPEC_STATUS
, &phy_data
);
475 regs_buff
[13] = (u32
)phy_data
; /* cable length */
476 regs_buff
[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */
477 regs_buff
[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */
478 regs_buff
[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */
479 e1e_rphy(hw
, M88E1000_PHY_SPEC_CTRL
, &phy_data
);
480 regs_buff
[17] = (u32
)phy_data
; /* extended 10bt distance */
481 regs_buff
[18] = regs_buff
[13]; /* cable polarity */
482 regs_buff
[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */
483 regs_buff
[20] = regs_buff
[17]; /* polarity correction */
484 /* phy receive errors */
485 regs_buff
[22] = adapter
->phy_stats
.receive_errors
;
486 regs_buff
[23] = regs_buff
[13]; /* mdix mode */
488 regs_buff
[21] = 0; /* was idle_errors */
489 e1e_rphy(hw
, PHY_1000T_STATUS
, &phy_data
);
490 regs_buff
[24] = (u32
)phy_data
; /* phy local receiver status */
491 regs_buff
[25] = regs_buff
[24]; /* phy remote receiver status */
494 static int e1000_get_eeprom_len(struct net_device
*netdev
)
496 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
497 return adapter
->hw
.nvm
.word_size
* 2;
500 static int e1000_get_eeprom(struct net_device
*netdev
,
501 struct ethtool_eeprom
*eeprom
, u8
*bytes
)
503 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
504 struct e1000_hw
*hw
= &adapter
->hw
;
511 if (eeprom
->len
== 0)
514 eeprom
->magic
= adapter
->pdev
->vendor
| (adapter
->pdev
->device
<< 16);
516 first_word
= eeprom
->offset
>> 1;
517 last_word
= (eeprom
->offset
+ eeprom
->len
- 1) >> 1;
519 eeprom_buff
= kmalloc(sizeof(u16
) *
520 (last_word
- first_word
+ 1), GFP_KERNEL
);
524 if (hw
->nvm
.type
== e1000_nvm_eeprom_spi
) {
525 ret_val
= e1000_read_nvm(hw
, first_word
,
526 last_word
- first_word
+ 1,
529 for (i
= 0; i
< last_word
- first_word
+ 1; i
++) {
530 ret_val
= e1000_read_nvm(hw
, first_word
+ i
, 1,
538 /* a read error occurred, throw away the result */
539 memset(eeprom_buff
, 0xff, sizeof(u16
) *
540 (last_word
- first_word
+ 1));
542 /* Device's eeprom is always little-endian, word addressable */
543 for (i
= 0; i
< last_word
- first_word
+ 1; i
++)
544 le16_to_cpus(&eeprom_buff
[i
]);
547 memcpy(bytes
, (u8
*)eeprom_buff
+ (eeprom
->offset
& 1), eeprom
->len
);
553 static int e1000_set_eeprom(struct net_device
*netdev
,
554 struct ethtool_eeprom
*eeprom
, u8
*bytes
)
556 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
557 struct e1000_hw
*hw
= &adapter
->hw
;
566 if (eeprom
->len
== 0)
569 if (eeprom
->magic
!= (adapter
->pdev
->vendor
| (adapter
->pdev
->device
<< 16)))
572 if (adapter
->flags
& FLAG_READ_ONLY_NVM
)
575 max_len
= hw
->nvm
.word_size
* 2;
577 first_word
= eeprom
->offset
>> 1;
578 last_word
= (eeprom
->offset
+ eeprom
->len
- 1) >> 1;
579 eeprom_buff
= kmalloc(max_len
, GFP_KERNEL
);
583 ptr
= (void *)eeprom_buff
;
585 if (eeprom
->offset
& 1) {
586 /* need read/modify/write of first changed EEPROM word */
587 /* only the second byte of the word is being modified */
588 ret_val
= e1000_read_nvm(hw
, first_word
, 1, &eeprom_buff
[0]);
591 if (((eeprom
->offset
+ eeprom
->len
) & 1) && (ret_val
== 0))
592 /* need read/modify/write of last changed EEPROM word */
593 /* only the first byte of the word is being modified */
594 ret_val
= e1000_read_nvm(hw
, last_word
, 1,
595 &eeprom_buff
[last_word
- first_word
]);
600 /* Device's eeprom is always little-endian, word addressable */
601 for (i
= 0; i
< last_word
- first_word
+ 1; i
++)
602 le16_to_cpus(&eeprom_buff
[i
]);
604 memcpy(ptr
, bytes
, eeprom
->len
);
606 for (i
= 0; i
< last_word
- first_word
+ 1; i
++)
607 eeprom_buff
[i
] = cpu_to_le16(eeprom_buff
[i
]);
609 ret_val
= e1000_write_nvm(hw
, first_word
,
610 last_word
- first_word
+ 1, eeprom_buff
);
616 * Update the checksum over the first part of the EEPROM if needed
617 * and flush shadow RAM for applicable controllers
619 if ((first_word
<= NVM_CHECKSUM_REG
) ||
620 (hw
->mac
.type
== e1000_82583
) ||
621 (hw
->mac
.type
== e1000_82574
) ||
622 (hw
->mac
.type
== e1000_82573
))
623 ret_val
= e1000e_update_nvm_checksum(hw
);
630 static void e1000_get_drvinfo(struct net_device
*netdev
,
631 struct ethtool_drvinfo
*drvinfo
)
633 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
634 char firmware_version
[32];
636 strncpy(drvinfo
->driver
, e1000e_driver_name
,
637 sizeof(drvinfo
->driver
) - 1);
638 strncpy(drvinfo
->version
, e1000e_driver_version
,
639 sizeof(drvinfo
->version
) - 1);
642 * EEPROM image version # is reported as firmware version # for
645 snprintf(firmware_version
, sizeof(firmware_version
), "%d.%d-%d",
646 (adapter
->eeprom_vers
& 0xF000) >> 12,
647 (adapter
->eeprom_vers
& 0x0FF0) >> 4,
648 (adapter
->eeprom_vers
& 0x000F));
650 strncpy(drvinfo
->fw_version
, firmware_version
,
651 sizeof(drvinfo
->fw_version
) - 1);
652 strncpy(drvinfo
->bus_info
, pci_name(adapter
->pdev
),
653 sizeof(drvinfo
->bus_info
) - 1);
654 drvinfo
->regdump_len
= e1000_get_regs_len(netdev
);
655 drvinfo
->eedump_len
= e1000_get_eeprom_len(netdev
);
658 static void e1000_get_ringparam(struct net_device
*netdev
,
659 struct ethtool_ringparam
*ring
)
661 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
662 struct e1000_ring
*tx_ring
= adapter
->tx_ring
;
663 struct e1000_ring
*rx_ring
= adapter
->rx_ring
;
665 ring
->rx_max_pending
= E1000_MAX_RXD
;
666 ring
->tx_max_pending
= E1000_MAX_TXD
;
667 ring
->rx_mini_max_pending
= 0;
668 ring
->rx_jumbo_max_pending
= 0;
669 ring
->rx_pending
= rx_ring
->count
;
670 ring
->tx_pending
= tx_ring
->count
;
671 ring
->rx_mini_pending
= 0;
672 ring
->rx_jumbo_pending
= 0;
675 static int e1000_set_ringparam(struct net_device
*netdev
,
676 struct ethtool_ringparam
*ring
)
678 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
679 struct e1000_ring
*tx_ring
, *tx_old
;
680 struct e1000_ring
*rx_ring
, *rx_old
;
683 if ((ring
->rx_mini_pending
) || (ring
->rx_jumbo_pending
))
686 while (test_and_set_bit(__E1000_RESETTING
, &adapter
->state
))
687 usleep_range(1000, 2000);
689 if (netif_running(adapter
->netdev
))
690 e1000e_down(adapter
);
692 tx_old
= adapter
->tx_ring
;
693 rx_old
= adapter
->rx_ring
;
696 tx_ring
= kmemdup(tx_old
, sizeof(struct e1000_ring
), GFP_KERNEL
);
700 rx_ring
= kmemdup(rx_old
, sizeof(struct e1000_ring
), GFP_KERNEL
);
704 adapter
->tx_ring
= tx_ring
;
705 adapter
->rx_ring
= rx_ring
;
707 rx_ring
->count
= max(ring
->rx_pending
, (u32
)E1000_MIN_RXD
);
708 rx_ring
->count
= min(rx_ring
->count
, (u32
)(E1000_MAX_RXD
));
709 rx_ring
->count
= ALIGN(rx_ring
->count
, REQ_RX_DESCRIPTOR_MULTIPLE
);
711 tx_ring
->count
= max(ring
->tx_pending
, (u32
)E1000_MIN_TXD
);
712 tx_ring
->count
= min(tx_ring
->count
, (u32
)(E1000_MAX_TXD
));
713 tx_ring
->count
= ALIGN(tx_ring
->count
, REQ_TX_DESCRIPTOR_MULTIPLE
);
715 if (netif_running(adapter
->netdev
)) {
716 /* Try to get new resources before deleting old */
717 err
= e1000e_setup_rx_resources(adapter
);
720 err
= e1000e_setup_tx_resources(adapter
);
725 * restore the old in order to free it,
726 * then add in the new
728 adapter
->rx_ring
= rx_old
;
729 adapter
->tx_ring
= tx_old
;
730 e1000e_free_rx_resources(adapter
);
731 e1000e_free_tx_resources(adapter
);
734 adapter
->rx_ring
= rx_ring
;
735 adapter
->tx_ring
= tx_ring
;
736 err
= e1000e_up(adapter
);
741 clear_bit(__E1000_RESETTING
, &adapter
->state
);
744 e1000e_free_rx_resources(adapter
);
746 adapter
->rx_ring
= rx_old
;
747 adapter
->tx_ring
= tx_old
;
754 clear_bit(__E1000_RESETTING
, &adapter
->state
);
758 static bool reg_pattern_test(struct e1000_adapter
*adapter
, u64
*data
,
759 int reg
, int offset
, u32 mask
, u32 write
)
762 static const u32 test
[] = {
763 0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
764 for (pat
= 0; pat
< ARRAY_SIZE(test
); pat
++) {
765 E1000_WRITE_REG_ARRAY(&adapter
->hw
, reg
, offset
,
766 (test
[pat
] & write
));
767 val
= E1000_READ_REG_ARRAY(&adapter
->hw
, reg
, offset
);
768 if (val
!= (test
[pat
] & write
& mask
)) {
769 e_err("pattern test reg %04X failed: got 0x%08X "
770 "expected 0x%08X\n", reg
+ offset
, val
,
771 (test
[pat
] & write
& mask
));
779 static bool reg_set_and_check(struct e1000_adapter
*adapter
, u64
*data
,
780 int reg
, u32 mask
, u32 write
)
783 __ew32(&adapter
->hw
, reg
, write
& mask
);
784 val
= __er32(&adapter
->hw
, reg
);
785 if ((write
& mask
) != (val
& mask
)) {
786 e_err("set/check reg %04X test failed: got 0x%08X "
787 "expected 0x%08X\n", reg
, (val
& mask
), (write
& mask
));
793 #define REG_PATTERN_TEST_ARRAY(reg, offset, mask, write) \
795 if (reg_pattern_test(adapter, data, reg, offset, mask, write)) \
798 #define REG_PATTERN_TEST(reg, mask, write) \
799 REG_PATTERN_TEST_ARRAY(reg, 0, mask, write)
801 #define REG_SET_AND_CHECK(reg, mask, write) \
803 if (reg_set_and_check(adapter, data, reg, mask, write)) \
807 static int e1000_reg_test(struct e1000_adapter
*adapter
, u64
*data
)
809 struct e1000_hw
*hw
= &adapter
->hw
;
810 struct e1000_mac_info
*mac
= &adapter
->hw
.mac
;
819 * The status register is Read Only, so a write should fail.
820 * Some bits that get toggled are ignored.
823 /* there are several bits on newer hardware that are r/w */
826 case e1000_80003es2lan
:
834 before
= er32(STATUS
);
835 value
= (er32(STATUS
) & toggle
);
836 ew32(STATUS
, toggle
);
837 after
= er32(STATUS
) & toggle
;
838 if (value
!= after
) {
839 e_err("failed STATUS register test got: 0x%08X expected: "
840 "0x%08X\n", after
, value
);
844 /* restore previous status */
845 ew32(STATUS
, before
);
847 if (!(adapter
->flags
& FLAG_IS_ICH
)) {
848 REG_PATTERN_TEST(E1000_FCAL
, 0xFFFFFFFF, 0xFFFFFFFF);
849 REG_PATTERN_TEST(E1000_FCAH
, 0x0000FFFF, 0xFFFFFFFF);
850 REG_PATTERN_TEST(E1000_FCT
, 0x0000FFFF, 0xFFFFFFFF);
851 REG_PATTERN_TEST(E1000_VET
, 0x0000FFFF, 0xFFFFFFFF);
854 REG_PATTERN_TEST(E1000_RDTR
, 0x0000FFFF, 0xFFFFFFFF);
855 REG_PATTERN_TEST(E1000_RDBAH
, 0xFFFFFFFF, 0xFFFFFFFF);
856 REG_PATTERN_TEST(E1000_RDLEN
, 0x000FFF80, 0x000FFFFF);
857 REG_PATTERN_TEST(E1000_RDH
, 0x0000FFFF, 0x0000FFFF);
858 REG_PATTERN_TEST(E1000_RDT
, 0x0000FFFF, 0x0000FFFF);
859 REG_PATTERN_TEST(E1000_FCRTH
, 0x0000FFF8, 0x0000FFF8);
860 REG_PATTERN_TEST(E1000_FCTTV
, 0x0000FFFF, 0x0000FFFF);
861 REG_PATTERN_TEST(E1000_TIPG
, 0x3FFFFFFF, 0x3FFFFFFF);
862 REG_PATTERN_TEST(E1000_TDBAH
, 0xFFFFFFFF, 0xFFFFFFFF);
863 REG_PATTERN_TEST(E1000_TDLEN
, 0x000FFF80, 0x000FFFFF);
865 REG_SET_AND_CHECK(E1000_RCTL
, 0xFFFFFFFF, 0x00000000);
867 before
= ((adapter
->flags
& FLAG_IS_ICH
) ? 0x06C3B33E : 0x06DFB3FE);
868 REG_SET_AND_CHECK(E1000_RCTL
, before
, 0x003FFFFB);
869 REG_SET_AND_CHECK(E1000_TCTL
, 0xFFFFFFFF, 0x00000000);
871 REG_SET_AND_CHECK(E1000_RCTL
, before
, 0xFFFFFFFF);
872 REG_PATTERN_TEST(E1000_RDBAL
, 0xFFFFFFF0, 0xFFFFFFFF);
873 if (!(adapter
->flags
& FLAG_IS_ICH
))
874 REG_PATTERN_TEST(E1000_TXCW
, 0xC000FFFF, 0x0000FFFF);
875 REG_PATTERN_TEST(E1000_TDBAL
, 0xFFFFFFF0, 0xFFFFFFFF);
876 REG_PATTERN_TEST(E1000_TIDV
, 0x0000FFFF, 0x0000FFFF);
887 for (i
= 0; i
< mac
->rar_entry_count
; i
++)
888 REG_PATTERN_TEST_ARRAY(E1000_RA
, ((i
<< 1) + 1),
891 for (i
= 0; i
< mac
->mta_reg_count
; i
++)
892 REG_PATTERN_TEST_ARRAY(E1000_MTA
, i
, 0xFFFFFFFF, 0xFFFFFFFF);
898 static int e1000_eeprom_test(struct e1000_adapter
*adapter
, u64
*data
)
905 /* Read and add up the contents of the EEPROM */
906 for (i
= 0; i
< (NVM_CHECKSUM_REG
+ 1); i
++) {
907 if ((e1000_read_nvm(&adapter
->hw
, i
, 1, &temp
)) < 0) {
914 /* If Checksum is not Correct return error else test passed */
915 if ((checksum
!= (u16
) NVM_SUM
) && !(*data
))
921 static irqreturn_t
e1000_test_intr(int irq
, void *data
)
923 struct net_device
*netdev
= (struct net_device
*) data
;
924 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
925 struct e1000_hw
*hw
= &adapter
->hw
;
927 adapter
->test_icr
|= er32(ICR
);
932 static int e1000_intr_test(struct e1000_adapter
*adapter
, u64
*data
)
934 struct net_device
*netdev
= adapter
->netdev
;
935 struct e1000_hw
*hw
= &adapter
->hw
;
938 u32 irq
= adapter
->pdev
->irq
;
941 int int_mode
= E1000E_INT_MODE_LEGACY
;
945 /* NOTE: we don't test MSI/MSI-X interrupts here, yet */
946 if (adapter
->int_mode
== E1000E_INT_MODE_MSIX
) {
947 int_mode
= adapter
->int_mode
;
948 e1000e_reset_interrupt_capability(adapter
);
949 adapter
->int_mode
= E1000E_INT_MODE_LEGACY
;
950 e1000e_set_interrupt_capability(adapter
);
952 /* Hook up test interrupt handler just for this test */
953 if (!request_irq(irq
, e1000_test_intr
, IRQF_PROBE_SHARED
, netdev
->name
,
956 } else if (request_irq(irq
, e1000_test_intr
, IRQF_SHARED
,
957 netdev
->name
, netdev
)) {
962 e_info("testing %s interrupt\n", (shared_int
? "shared" : "unshared"));
964 /* Disable all the interrupts */
965 ew32(IMC
, 0xFFFFFFFF);
966 usleep_range(10000, 20000);
968 /* Test each interrupt */
969 for (i
= 0; i
< 10; i
++) {
970 /* Interrupt to test */
973 if (adapter
->flags
& FLAG_IS_ICH
) {
975 case E1000_ICR_RXSEQ
:
978 if (adapter
->hw
.mac
.type
== e1000_ich8lan
||
979 adapter
->hw
.mac
.type
== e1000_ich9lan
)
989 * Disable the interrupt to be reported in
990 * the cause register and then force the same
991 * interrupt and see if one gets posted. If
992 * an interrupt was posted to the bus, the
995 adapter
->test_icr
= 0;
998 usleep_range(10000, 20000);
1000 if (adapter
->test_icr
& mask
) {
1007 * Enable the interrupt to be reported in
1008 * the cause register and then force the same
1009 * interrupt and see if one gets posted. If
1010 * an interrupt was not posted to the bus, the
1013 adapter
->test_icr
= 0;
1016 usleep_range(10000, 20000);
1018 if (!(adapter
->test_icr
& mask
)) {
1025 * Disable the other interrupts to be reported in
1026 * the cause register and then force the other
1027 * interrupts and see if any get posted. If
1028 * an interrupt was posted to the bus, the
1031 adapter
->test_icr
= 0;
1032 ew32(IMC
, ~mask
& 0x00007FFF);
1033 ew32(ICS
, ~mask
& 0x00007FFF);
1034 usleep_range(10000, 20000);
1036 if (adapter
->test_icr
) {
1043 /* Disable all the interrupts */
1044 ew32(IMC
, 0xFFFFFFFF);
1045 usleep_range(10000, 20000);
1047 /* Unhook test interrupt handler */
1048 free_irq(irq
, netdev
);
1051 if (int_mode
== E1000E_INT_MODE_MSIX
) {
1052 e1000e_reset_interrupt_capability(adapter
);
1053 adapter
->int_mode
= int_mode
;
1054 e1000e_set_interrupt_capability(adapter
);
1060 static void e1000_free_desc_rings(struct e1000_adapter
*adapter
)
1062 struct e1000_ring
*tx_ring
= &adapter
->test_tx_ring
;
1063 struct e1000_ring
*rx_ring
= &adapter
->test_rx_ring
;
1064 struct pci_dev
*pdev
= adapter
->pdev
;
1067 if (tx_ring
->desc
&& tx_ring
->buffer_info
) {
1068 for (i
= 0; i
< tx_ring
->count
; i
++) {
1069 if (tx_ring
->buffer_info
[i
].dma
)
1070 dma_unmap_single(&pdev
->dev
,
1071 tx_ring
->buffer_info
[i
].dma
,
1072 tx_ring
->buffer_info
[i
].length
,
1074 if (tx_ring
->buffer_info
[i
].skb
)
1075 dev_kfree_skb(tx_ring
->buffer_info
[i
].skb
);
1079 if (rx_ring
->desc
&& rx_ring
->buffer_info
) {
1080 for (i
= 0; i
< rx_ring
->count
; i
++) {
1081 if (rx_ring
->buffer_info
[i
].dma
)
1082 dma_unmap_single(&pdev
->dev
,
1083 rx_ring
->buffer_info
[i
].dma
,
1084 2048, DMA_FROM_DEVICE
);
1085 if (rx_ring
->buffer_info
[i
].skb
)
1086 dev_kfree_skb(rx_ring
->buffer_info
[i
].skb
);
1090 if (tx_ring
->desc
) {
1091 dma_free_coherent(&pdev
->dev
, tx_ring
->size
, tx_ring
->desc
,
1093 tx_ring
->desc
= NULL
;
1095 if (rx_ring
->desc
) {
1096 dma_free_coherent(&pdev
->dev
, rx_ring
->size
, rx_ring
->desc
,
1098 rx_ring
->desc
= NULL
;
1101 kfree(tx_ring
->buffer_info
);
1102 tx_ring
->buffer_info
= NULL
;
1103 kfree(rx_ring
->buffer_info
);
1104 rx_ring
->buffer_info
= NULL
;
1107 static int e1000_setup_desc_rings(struct e1000_adapter
*adapter
)
1109 struct e1000_ring
*tx_ring
= &adapter
->test_tx_ring
;
1110 struct e1000_ring
*rx_ring
= &adapter
->test_rx_ring
;
1111 struct pci_dev
*pdev
= adapter
->pdev
;
1112 struct e1000_hw
*hw
= &adapter
->hw
;
1117 /* Setup Tx descriptor ring and Tx buffers */
1119 if (!tx_ring
->count
)
1120 tx_ring
->count
= E1000_DEFAULT_TXD
;
1122 tx_ring
->buffer_info
= kcalloc(tx_ring
->count
,
1123 sizeof(struct e1000_buffer
),
1125 if (!(tx_ring
->buffer_info
)) {
1130 tx_ring
->size
= tx_ring
->count
* sizeof(struct e1000_tx_desc
);
1131 tx_ring
->size
= ALIGN(tx_ring
->size
, 4096);
1132 tx_ring
->desc
= dma_alloc_coherent(&pdev
->dev
, tx_ring
->size
,
1133 &tx_ring
->dma
, GFP_KERNEL
);
1134 if (!tx_ring
->desc
) {
1138 tx_ring
->next_to_use
= 0;
1139 tx_ring
->next_to_clean
= 0;
1141 ew32(TDBAL
, ((u64
) tx_ring
->dma
& 0x00000000FFFFFFFF));
1142 ew32(TDBAH
, ((u64
) tx_ring
->dma
>> 32));
1143 ew32(TDLEN
, tx_ring
->count
* sizeof(struct e1000_tx_desc
));
1146 ew32(TCTL
, E1000_TCTL_PSP
| E1000_TCTL_EN
| E1000_TCTL_MULR
|
1147 E1000_COLLISION_THRESHOLD
<< E1000_CT_SHIFT
|
1148 E1000_COLLISION_DISTANCE
<< E1000_COLD_SHIFT
);
1150 for (i
= 0; i
< tx_ring
->count
; i
++) {
1151 struct e1000_tx_desc
*tx_desc
= E1000_TX_DESC(*tx_ring
, i
);
1152 struct sk_buff
*skb
;
1153 unsigned int skb_size
= 1024;
1155 skb
= alloc_skb(skb_size
, GFP_KERNEL
);
1160 skb_put(skb
, skb_size
);
1161 tx_ring
->buffer_info
[i
].skb
= skb
;
1162 tx_ring
->buffer_info
[i
].length
= skb
->len
;
1163 tx_ring
->buffer_info
[i
].dma
=
1164 dma_map_single(&pdev
->dev
, skb
->data
, skb
->len
,
1166 if (dma_mapping_error(&pdev
->dev
,
1167 tx_ring
->buffer_info
[i
].dma
)) {
1171 tx_desc
->buffer_addr
= cpu_to_le64(tx_ring
->buffer_info
[i
].dma
);
1172 tx_desc
->lower
.data
= cpu_to_le32(skb
->len
);
1173 tx_desc
->lower
.data
|= cpu_to_le32(E1000_TXD_CMD_EOP
|
1174 E1000_TXD_CMD_IFCS
|
1176 tx_desc
->upper
.data
= 0;
1179 /* Setup Rx descriptor ring and Rx buffers */
1181 if (!rx_ring
->count
)
1182 rx_ring
->count
= E1000_DEFAULT_RXD
;
1184 rx_ring
->buffer_info
= kcalloc(rx_ring
->count
,
1185 sizeof(struct e1000_buffer
),
1187 if (!(rx_ring
->buffer_info
)) {
1192 rx_ring
->size
= rx_ring
->count
* sizeof(struct e1000_rx_desc
);
1193 rx_ring
->desc
= dma_alloc_coherent(&pdev
->dev
, rx_ring
->size
,
1194 &rx_ring
->dma
, GFP_KERNEL
);
1195 if (!rx_ring
->desc
) {
1199 rx_ring
->next_to_use
= 0;
1200 rx_ring
->next_to_clean
= 0;
1203 ew32(RCTL
, rctl
& ~E1000_RCTL_EN
);
1204 ew32(RDBAL
, ((u64
) rx_ring
->dma
& 0xFFFFFFFF));
1205 ew32(RDBAH
, ((u64
) rx_ring
->dma
>> 32));
1206 ew32(RDLEN
, rx_ring
->size
);
1209 rctl
= E1000_RCTL_EN
| E1000_RCTL_BAM
| E1000_RCTL_SZ_2048
|
1210 E1000_RCTL_UPE
| E1000_RCTL_MPE
| E1000_RCTL_LPE
|
1211 E1000_RCTL_SBP
| E1000_RCTL_SECRC
|
1212 E1000_RCTL_LBM_NO
| E1000_RCTL_RDMTS_HALF
|
1213 (adapter
->hw
.mac
.mc_filter_type
<< E1000_RCTL_MO_SHIFT
);
1216 for (i
= 0; i
< rx_ring
->count
; i
++) {
1217 struct e1000_rx_desc
*rx_desc
= E1000_RX_DESC(*rx_ring
, i
);
1218 struct sk_buff
*skb
;
1220 skb
= alloc_skb(2048 + NET_IP_ALIGN
, GFP_KERNEL
);
1225 skb_reserve(skb
, NET_IP_ALIGN
);
1226 rx_ring
->buffer_info
[i
].skb
= skb
;
1227 rx_ring
->buffer_info
[i
].dma
=
1228 dma_map_single(&pdev
->dev
, skb
->data
, 2048,
1230 if (dma_mapping_error(&pdev
->dev
,
1231 rx_ring
->buffer_info
[i
].dma
)) {
1235 rx_desc
->buffer_addr
=
1236 cpu_to_le64(rx_ring
->buffer_info
[i
].dma
);
1237 memset(skb
->data
, 0x00, skb
->len
);
1243 e1000_free_desc_rings(adapter
);
1247 static void e1000_phy_disable_receiver(struct e1000_adapter
*adapter
)
1249 /* Write out to PHY registers 29 and 30 to disable the Receiver. */
1250 e1e_wphy(&adapter
->hw
, 29, 0x001F);
1251 e1e_wphy(&adapter
->hw
, 30, 0x8FFC);
1252 e1e_wphy(&adapter
->hw
, 29, 0x001A);
1253 e1e_wphy(&adapter
->hw
, 30, 0x8FF0);
1256 static int e1000_integrated_phy_loopback(struct e1000_adapter
*adapter
)
1258 struct e1000_hw
*hw
= &adapter
->hw
;
1263 hw
->mac
.autoneg
= 0;
1265 if (hw
->phy
.type
== e1000_phy_ife
) {
1266 /* force 100, set loopback */
1267 e1e_wphy(hw
, PHY_CONTROL
, 0x6100);
1269 /* Now set up the MAC to the same speed/duplex as the PHY. */
1270 ctrl_reg
= er32(CTRL
);
1271 ctrl_reg
&= ~E1000_CTRL_SPD_SEL
; /* Clear the speed sel bits */
1272 ctrl_reg
|= (E1000_CTRL_FRCSPD
| /* Set the Force Speed Bit */
1273 E1000_CTRL_FRCDPX
| /* Set the Force Duplex Bit */
1274 E1000_CTRL_SPD_100
|/* Force Speed to 100 */
1275 E1000_CTRL_FD
); /* Force Duplex to FULL */
1277 ew32(CTRL
, ctrl_reg
);
1283 /* Specific PHY configuration for loopback */
1284 switch (hw
->phy
.type
) {
1286 /* Auto-MDI/MDIX Off */
1287 e1e_wphy(hw
, M88E1000_PHY_SPEC_CTRL
, 0x0808);
1288 /* reset to update Auto-MDI/MDIX */
1289 e1e_wphy(hw
, PHY_CONTROL
, 0x9140);
1291 e1e_wphy(hw
, PHY_CONTROL
, 0x8140);
1293 case e1000_phy_gg82563
:
1294 e1e_wphy(hw
, GG82563_PHY_KMRN_MODE_CTRL
, 0x1CC);
1297 /* Set Default MAC Interface speed to 1GB */
1298 e1e_rphy(hw
, PHY_REG(2, 21), &phy_reg
);
1301 e1e_wphy(hw
, PHY_REG(2, 21), phy_reg
);
1302 /* Assert SW reset for above settings to take effect */
1303 e1000e_commit_phy(hw
);
1305 /* Force Full Duplex */
1306 e1e_rphy(hw
, PHY_REG(769, 16), &phy_reg
);
1307 e1e_wphy(hw
, PHY_REG(769, 16), phy_reg
| 0x000C);
1308 /* Set Link Up (in force link) */
1309 e1e_rphy(hw
, PHY_REG(776, 16), &phy_reg
);
1310 e1e_wphy(hw
, PHY_REG(776, 16), phy_reg
| 0x0040);
1312 e1e_rphy(hw
, PHY_REG(769, 16), &phy_reg
);
1313 e1e_wphy(hw
, PHY_REG(769, 16), phy_reg
| 0x0040);
1314 /* Set Early Link Enable */
1315 e1e_rphy(hw
, PHY_REG(769, 20), &phy_reg
);
1316 e1e_wphy(hw
, PHY_REG(769, 20), phy_reg
| 0x0400);
1318 case e1000_phy_82577
:
1319 case e1000_phy_82578
:
1320 /* Workaround: K1 must be disabled for stable 1Gbps operation */
1321 ret_val
= hw
->phy
.ops
.acquire(hw
);
1323 e_err("Cannot setup 1Gbps loopback.\n");
1326 e1000_configure_k1_ich8lan(hw
, false);
1327 hw
->phy
.ops
.release(hw
);
1329 case e1000_phy_82579
:
1330 /* Disable PHY energy detect power down */
1331 e1e_rphy(hw
, PHY_REG(0, 21), &phy_reg
);
1332 e1e_wphy(hw
, PHY_REG(0, 21), phy_reg
& ~(1 << 3));
1333 /* Disable full chip energy detect */
1334 e1e_rphy(hw
, PHY_REG(776, 18), &phy_reg
);
1335 e1e_wphy(hw
, PHY_REG(776, 18), phy_reg
| 1);
1336 /* Enable loopback on the PHY */
1337 #define I82577_PHY_LBK_CTRL 19
1338 e1e_wphy(hw
, I82577_PHY_LBK_CTRL
, 0x8001);
1344 /* force 1000, set loopback */
1345 e1e_wphy(hw
, PHY_CONTROL
, 0x4140);
1348 /* Now set up the MAC to the same speed/duplex as the PHY. */
1349 ctrl_reg
= er32(CTRL
);
1350 ctrl_reg
&= ~E1000_CTRL_SPD_SEL
; /* Clear the speed sel bits */
1351 ctrl_reg
|= (E1000_CTRL_FRCSPD
| /* Set the Force Speed Bit */
1352 E1000_CTRL_FRCDPX
| /* Set the Force Duplex Bit */
1353 E1000_CTRL_SPD_1000
|/* Force Speed to 1000 */
1354 E1000_CTRL_FD
); /* Force Duplex to FULL */
1356 if (adapter
->flags
& FLAG_IS_ICH
)
1357 ctrl_reg
|= E1000_CTRL_SLU
; /* Set Link Up */
1359 if (hw
->phy
.media_type
== e1000_media_type_copper
&&
1360 hw
->phy
.type
== e1000_phy_m88
) {
1361 ctrl_reg
|= E1000_CTRL_ILOS
; /* Invert Loss of Signal */
1364 * Set the ILOS bit on the fiber Nic if half duplex link is
1367 if ((er32(STATUS
) & E1000_STATUS_FD
) == 0)
1368 ctrl_reg
|= (E1000_CTRL_ILOS
| E1000_CTRL_SLU
);
1371 ew32(CTRL
, ctrl_reg
);
1374 * Disable the receiver on the PHY so when a cable is plugged in, the
1375 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
1377 if (hw
->phy
.type
== e1000_phy_m88
)
1378 e1000_phy_disable_receiver(adapter
);
1385 static int e1000_set_82571_fiber_loopback(struct e1000_adapter
*adapter
)
1387 struct e1000_hw
*hw
= &adapter
->hw
;
1388 u32 ctrl
= er32(CTRL
);
1391 /* special requirements for 82571/82572 fiber adapters */
1394 * jump through hoops to make sure link is up because serdes
1395 * link is hardwired up
1397 ctrl
|= E1000_CTRL_SLU
;
1400 /* disable autoneg */
1405 link
= (er32(STATUS
) & E1000_STATUS_LU
);
1408 /* set invert loss of signal */
1410 ctrl
|= E1000_CTRL_ILOS
;
1415 * special write to serdes control register to enable SerDes analog
1418 #define E1000_SERDES_LB_ON 0x410
1419 ew32(SCTL
, E1000_SERDES_LB_ON
);
1420 usleep_range(10000, 20000);
1425 /* only call this for fiber/serdes connections to es2lan */
1426 static int e1000_set_es2lan_mac_loopback(struct e1000_adapter
*adapter
)
1428 struct e1000_hw
*hw
= &adapter
->hw
;
1429 u32 ctrlext
= er32(CTRL_EXT
);
1430 u32 ctrl
= er32(CTRL
);
1433 * save CTRL_EXT to restore later, reuse an empty variable (unused
1434 * on mac_type 80003es2lan)
1436 adapter
->tx_fifo_head
= ctrlext
;
1438 /* clear the serdes mode bits, putting the device into mac loopback */
1439 ctrlext
&= ~E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES
;
1440 ew32(CTRL_EXT
, ctrlext
);
1442 /* force speed to 1000/FD, link up */
1443 ctrl
&= ~(E1000_CTRL_SPD_1000
| E1000_CTRL_SPD_100
);
1444 ctrl
|= (E1000_CTRL_SLU
| E1000_CTRL_FRCSPD
| E1000_CTRL_FRCDPX
|
1445 E1000_CTRL_SPD_1000
| E1000_CTRL_FD
);
1448 /* set mac loopback */
1450 ctrl
|= E1000_RCTL_LBM_MAC
;
1453 /* set testing mode parameters (no need to reset later) */
1454 #define KMRNCTRLSTA_OPMODE (0x1F << 16)
1455 #define KMRNCTRLSTA_OPMODE_1GB_FD_GMII 0x0582
1457 (KMRNCTRLSTA_OPMODE
| KMRNCTRLSTA_OPMODE_1GB_FD_GMII
));
1462 static int e1000_setup_loopback_test(struct e1000_adapter
*adapter
)
1464 struct e1000_hw
*hw
= &adapter
->hw
;
1467 if (hw
->phy
.media_type
== e1000_media_type_fiber
||
1468 hw
->phy
.media_type
== e1000_media_type_internal_serdes
) {
1469 switch (hw
->mac
.type
) {
1470 case e1000_80003es2lan
:
1471 return e1000_set_es2lan_mac_loopback(adapter
);
1475 return e1000_set_82571_fiber_loopback(adapter
);
1479 rctl
|= E1000_RCTL_LBM_TCVR
;
1483 } else if (hw
->phy
.media_type
== e1000_media_type_copper
) {
1484 return e1000_integrated_phy_loopback(adapter
);
1490 static void e1000_loopback_cleanup(struct e1000_adapter
*adapter
)
1492 struct e1000_hw
*hw
= &adapter
->hw
;
1497 rctl
&= ~(E1000_RCTL_LBM_TCVR
| E1000_RCTL_LBM_MAC
);
1500 switch (hw
->mac
.type
) {
1501 case e1000_80003es2lan
:
1502 if (hw
->phy
.media_type
== e1000_media_type_fiber
||
1503 hw
->phy
.media_type
== e1000_media_type_internal_serdes
) {
1504 /* restore CTRL_EXT, stealing space from tx_fifo_head */
1505 ew32(CTRL_EXT
, adapter
->tx_fifo_head
);
1506 adapter
->tx_fifo_head
= 0;
1511 if (hw
->phy
.media_type
== e1000_media_type_fiber
||
1512 hw
->phy
.media_type
== e1000_media_type_internal_serdes
) {
1513 #define E1000_SERDES_LB_OFF 0x400
1514 ew32(SCTL
, E1000_SERDES_LB_OFF
);
1515 usleep_range(10000, 20000);
1520 hw
->mac
.autoneg
= 1;
1521 if (hw
->phy
.type
== e1000_phy_gg82563
)
1522 e1e_wphy(hw
, GG82563_PHY_KMRN_MODE_CTRL
, 0x180);
1523 e1e_rphy(hw
, PHY_CONTROL
, &phy_reg
);
1524 if (phy_reg
& MII_CR_LOOPBACK
) {
1525 phy_reg
&= ~MII_CR_LOOPBACK
;
1526 e1e_wphy(hw
, PHY_CONTROL
, phy_reg
);
1527 e1000e_commit_phy(hw
);
1533 static void e1000_create_lbtest_frame(struct sk_buff
*skb
,
1534 unsigned int frame_size
)
1536 memset(skb
->data
, 0xFF, frame_size
);
1538 memset(&skb
->data
[frame_size
/ 2], 0xAA, frame_size
/ 2 - 1);
1539 memset(&skb
->data
[frame_size
/ 2 + 10], 0xBE, 1);
1540 memset(&skb
->data
[frame_size
/ 2 + 12], 0xAF, 1);
1543 static int e1000_check_lbtest_frame(struct sk_buff
*skb
,
1544 unsigned int frame_size
)
1547 if (*(skb
->data
+ 3) == 0xFF)
1548 if ((*(skb
->data
+ frame_size
/ 2 + 10) == 0xBE) &&
1549 (*(skb
->data
+ frame_size
/ 2 + 12) == 0xAF))
1554 static int e1000_run_loopback_test(struct e1000_adapter
*adapter
)
1556 struct e1000_ring
*tx_ring
= &adapter
->test_tx_ring
;
1557 struct e1000_ring
*rx_ring
= &adapter
->test_rx_ring
;
1558 struct pci_dev
*pdev
= adapter
->pdev
;
1559 struct e1000_hw
*hw
= &adapter
->hw
;
1566 ew32(RDT
, rx_ring
->count
- 1);
1569 * Calculate the loop count based on the largest descriptor ring
1570 * The idea is to wrap the largest ring a number of times using 64
1571 * send/receive pairs during each loop
1574 if (rx_ring
->count
<= tx_ring
->count
)
1575 lc
= ((tx_ring
->count
/ 64) * 2) + 1;
1577 lc
= ((rx_ring
->count
/ 64) * 2) + 1;
1581 for (j
= 0; j
<= lc
; j
++) { /* loop count loop */
1582 for (i
= 0; i
< 64; i
++) { /* send the packets */
1583 e1000_create_lbtest_frame(tx_ring
->buffer_info
[k
].skb
,
1585 dma_sync_single_for_device(&pdev
->dev
,
1586 tx_ring
->buffer_info
[k
].dma
,
1587 tx_ring
->buffer_info
[k
].length
,
1590 if (k
== tx_ring
->count
)
1595 time
= jiffies
; /* set the start time for the receive */
1597 do { /* receive the sent packets */
1598 dma_sync_single_for_cpu(&pdev
->dev
,
1599 rx_ring
->buffer_info
[l
].dma
, 2048,
1602 ret_val
= e1000_check_lbtest_frame(
1603 rx_ring
->buffer_info
[l
].skb
, 1024);
1607 if (l
== rx_ring
->count
)
1610 * time + 20 msecs (200 msecs on 2.4) is more than
1611 * enough time to complete the receives, if it's
1612 * exceeded, break and error off
1614 } while ((good_cnt
< 64) && !time_after(jiffies
, time
+ 20));
1615 if (good_cnt
!= 64) {
1616 ret_val
= 13; /* ret_val is the same as mis-compare */
1619 if (jiffies
>= (time
+ 20)) {
1620 ret_val
= 14; /* error code for time out error */
1623 } /* end loop count loop */
1627 static int e1000_loopback_test(struct e1000_adapter
*adapter
, u64
*data
)
1630 * PHY loopback cannot be performed if SoL/IDER
1631 * sessions are active
1633 if (e1000_check_reset_block(&adapter
->hw
)) {
1634 e_err("Cannot do PHY loopback test when SoL/IDER is active.\n");
1639 *data
= e1000_setup_desc_rings(adapter
);
1643 *data
= e1000_setup_loopback_test(adapter
);
1647 *data
= e1000_run_loopback_test(adapter
);
1648 e1000_loopback_cleanup(adapter
);
1651 e1000_free_desc_rings(adapter
);
1656 static int e1000_link_test(struct e1000_adapter
*adapter
, u64
*data
)
1658 struct e1000_hw
*hw
= &adapter
->hw
;
1661 if (hw
->phy
.media_type
== e1000_media_type_internal_serdes
) {
1663 hw
->mac
.serdes_has_link
= false;
1666 * On some blade server designs, link establishment
1667 * could take as long as 2-3 minutes
1670 hw
->mac
.ops
.check_for_link(hw
);
1671 if (hw
->mac
.serdes_has_link
)
1674 } while (i
++ < 3750);
1678 hw
->mac
.ops
.check_for_link(hw
);
1679 if (hw
->mac
.autoneg
)
1681 * On some Phy/switch combinations, link establishment
1682 * can take a few seconds more than expected.
1686 if (!(er32(STATUS
) & E1000_STATUS_LU
))
1692 static int e1000e_get_sset_count(struct net_device
*netdev
, int sset
)
1696 return E1000_TEST_LEN
;
1698 return E1000_STATS_LEN
;
1704 static void e1000_diag_test(struct net_device
*netdev
,
1705 struct ethtool_test
*eth_test
, u64
*data
)
1707 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1708 u16 autoneg_advertised
;
1709 u8 forced_speed_duplex
;
1711 bool if_running
= netif_running(netdev
);
1713 set_bit(__E1000_TESTING
, &adapter
->state
);
1716 /* Get control of and reset hardware */
1717 if (adapter
->flags
& FLAG_HAS_AMT
)
1718 e1000e_get_hw_control(adapter
);
1720 e1000e_power_up_phy(adapter
);
1722 adapter
->hw
.phy
.autoneg_wait_to_complete
= 1;
1723 e1000e_reset(adapter
);
1724 adapter
->hw
.phy
.autoneg_wait_to_complete
= 0;
1727 if (eth_test
->flags
== ETH_TEST_FL_OFFLINE
) {
1730 /* save speed, duplex, autoneg settings */
1731 autoneg_advertised
= adapter
->hw
.phy
.autoneg_advertised
;
1732 forced_speed_duplex
= adapter
->hw
.mac
.forced_speed_duplex
;
1733 autoneg
= adapter
->hw
.mac
.autoneg
;
1735 e_info("offline testing starting\n");
1738 /* indicate we're in test mode */
1741 if (e1000_reg_test(adapter
, &data
[0]))
1742 eth_test
->flags
|= ETH_TEST_FL_FAILED
;
1744 e1000e_reset(adapter
);
1745 if (e1000_eeprom_test(adapter
, &data
[1]))
1746 eth_test
->flags
|= ETH_TEST_FL_FAILED
;
1748 e1000e_reset(adapter
);
1749 if (e1000_intr_test(adapter
, &data
[2]))
1750 eth_test
->flags
|= ETH_TEST_FL_FAILED
;
1752 e1000e_reset(adapter
);
1753 if (e1000_loopback_test(adapter
, &data
[3]))
1754 eth_test
->flags
|= ETH_TEST_FL_FAILED
;
1756 /* force this routine to wait until autoneg complete/timeout */
1757 adapter
->hw
.phy
.autoneg_wait_to_complete
= 1;
1758 e1000e_reset(adapter
);
1759 adapter
->hw
.phy
.autoneg_wait_to_complete
= 0;
1761 if (e1000_link_test(adapter
, &data
[4]))
1762 eth_test
->flags
|= ETH_TEST_FL_FAILED
;
1764 /* restore speed, duplex, autoneg settings */
1765 adapter
->hw
.phy
.autoneg_advertised
= autoneg_advertised
;
1766 adapter
->hw
.mac
.forced_speed_duplex
= forced_speed_duplex
;
1767 adapter
->hw
.mac
.autoneg
= autoneg
;
1768 e1000e_reset(adapter
);
1770 clear_bit(__E1000_TESTING
, &adapter
->state
);
1776 e_info("online testing starting\n");
1778 /* register, eeprom, intr and loopback tests not run online */
1784 if (e1000_link_test(adapter
, &data
[4]))
1785 eth_test
->flags
|= ETH_TEST_FL_FAILED
;
1787 clear_bit(__E1000_TESTING
, &adapter
->state
);
1791 e1000e_reset(adapter
);
1793 if (adapter
->flags
& FLAG_HAS_AMT
)
1794 e1000e_release_hw_control(adapter
);
1797 msleep_interruptible(4 * 1000);
1800 static void e1000_get_wol(struct net_device
*netdev
,
1801 struct ethtool_wolinfo
*wol
)
1803 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1808 if (!(adapter
->flags
& FLAG_HAS_WOL
) ||
1809 !device_can_wakeup(&adapter
->pdev
->dev
))
1812 wol
->supported
= WAKE_UCAST
| WAKE_MCAST
|
1813 WAKE_BCAST
| WAKE_MAGIC
| WAKE_PHY
;
1815 /* apply any specific unsupported masks here */
1816 if (adapter
->flags
& FLAG_NO_WAKE_UCAST
) {
1817 wol
->supported
&= ~WAKE_UCAST
;
1819 if (adapter
->wol
& E1000_WUFC_EX
)
1820 e_err("Interface does not support directed (unicast) "
1821 "frame wake-up packets\n");
1824 if (adapter
->wol
& E1000_WUFC_EX
)
1825 wol
->wolopts
|= WAKE_UCAST
;
1826 if (adapter
->wol
& E1000_WUFC_MC
)
1827 wol
->wolopts
|= WAKE_MCAST
;
1828 if (adapter
->wol
& E1000_WUFC_BC
)
1829 wol
->wolopts
|= WAKE_BCAST
;
1830 if (adapter
->wol
& E1000_WUFC_MAG
)
1831 wol
->wolopts
|= WAKE_MAGIC
;
1832 if (adapter
->wol
& E1000_WUFC_LNKC
)
1833 wol
->wolopts
|= WAKE_PHY
;
1836 static int e1000_set_wol(struct net_device
*netdev
, struct ethtool_wolinfo
*wol
)
1838 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1840 if (!(adapter
->flags
& FLAG_HAS_WOL
) ||
1841 !device_can_wakeup(&adapter
->pdev
->dev
) ||
1842 (wol
->wolopts
& ~(WAKE_UCAST
| WAKE_MCAST
| WAKE_BCAST
|
1843 WAKE_MAGIC
| WAKE_PHY
)))
1846 /* these settings will always override what we currently have */
1849 if (wol
->wolopts
& WAKE_UCAST
)
1850 adapter
->wol
|= E1000_WUFC_EX
;
1851 if (wol
->wolopts
& WAKE_MCAST
)
1852 adapter
->wol
|= E1000_WUFC_MC
;
1853 if (wol
->wolopts
& WAKE_BCAST
)
1854 adapter
->wol
|= E1000_WUFC_BC
;
1855 if (wol
->wolopts
& WAKE_MAGIC
)
1856 adapter
->wol
|= E1000_WUFC_MAG
;
1857 if (wol
->wolopts
& WAKE_PHY
)
1858 adapter
->wol
|= E1000_WUFC_LNKC
;
1860 device_set_wakeup_enable(&adapter
->pdev
->dev
, adapter
->wol
);
1865 static int e1000_set_phys_id(struct net_device
*netdev
,
1866 enum ethtool_phys_id_state state
)
1868 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1869 struct e1000_hw
*hw
= &adapter
->hw
;
1872 case ETHTOOL_ID_ACTIVE
:
1873 if (!hw
->mac
.ops
.blink_led
)
1874 return 2; /* cycle on/off twice per second */
1876 hw
->mac
.ops
.blink_led(hw
);
1879 case ETHTOOL_ID_INACTIVE
:
1880 if (hw
->phy
.type
== e1000_phy_ife
)
1881 e1e_wphy(hw
, IFE_PHY_SPECIAL_CONTROL_LED
, 0);
1882 hw
->mac
.ops
.led_off(hw
);
1883 hw
->mac
.ops
.cleanup_led(hw
);
1887 adapter
->hw
.mac
.ops
.led_on(&adapter
->hw
);
1890 case ETHTOOL_ID_OFF
:
1891 adapter
->hw
.mac
.ops
.led_off(&adapter
->hw
);
1897 static int e1000_get_coalesce(struct net_device
*netdev
,
1898 struct ethtool_coalesce
*ec
)
1900 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1902 if (adapter
->itr_setting
<= 4)
1903 ec
->rx_coalesce_usecs
= adapter
->itr_setting
;
1905 ec
->rx_coalesce_usecs
= 1000000 / adapter
->itr_setting
;
1910 static int e1000_set_coalesce(struct net_device
*netdev
,
1911 struct ethtool_coalesce
*ec
)
1913 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1914 struct e1000_hw
*hw
= &adapter
->hw
;
1916 if ((ec
->rx_coalesce_usecs
> E1000_MAX_ITR_USECS
) ||
1917 ((ec
->rx_coalesce_usecs
> 4) &&
1918 (ec
->rx_coalesce_usecs
< E1000_MIN_ITR_USECS
)) ||
1919 (ec
->rx_coalesce_usecs
== 2))
1922 if (ec
->rx_coalesce_usecs
== 4) {
1923 adapter
->itr
= adapter
->itr_setting
= 4;
1924 } else if (ec
->rx_coalesce_usecs
<= 3) {
1925 adapter
->itr
= 20000;
1926 adapter
->itr_setting
= ec
->rx_coalesce_usecs
;
1928 adapter
->itr
= (1000000 / ec
->rx_coalesce_usecs
);
1929 adapter
->itr_setting
= adapter
->itr
& ~3;
1932 if (adapter
->itr_setting
!= 0)
1933 ew32(ITR
, 1000000000 / (adapter
->itr
* 256));
1940 static int e1000_nway_reset(struct net_device
*netdev
)
1942 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1944 if (!netif_running(netdev
))
1947 if (!adapter
->hw
.mac
.autoneg
)
1950 e1000e_reinit_locked(adapter
);
1955 static void e1000_get_ethtool_stats(struct net_device
*netdev
,
1956 struct ethtool_stats
*stats
,
1959 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
1960 struct rtnl_link_stats64 net_stats
;
1964 e1000e_get_stats64(netdev
, &net_stats
);
1965 for (i
= 0; i
< E1000_GLOBAL_STATS_LEN
; i
++) {
1966 switch (e1000_gstrings_stats
[i
].type
) {
1968 p
= (char *) &net_stats
+
1969 e1000_gstrings_stats
[i
].stat_offset
;
1972 p
= (char *) adapter
+
1973 e1000_gstrings_stats
[i
].stat_offset
;
1980 data
[i
] = (e1000_gstrings_stats
[i
].sizeof_stat
==
1981 sizeof(u64
)) ? *(u64
*)p
: *(u32
*)p
;
1985 static void e1000_get_strings(struct net_device
*netdev
, u32 stringset
,
1991 switch (stringset
) {
1993 memcpy(data
, e1000_gstrings_test
, sizeof(e1000_gstrings_test
));
1996 for (i
= 0; i
< E1000_GLOBAL_STATS_LEN
; i
++) {
1997 memcpy(p
, e1000_gstrings_stats
[i
].stat_string
,
1999 p
+= ETH_GSTRING_LEN
;
2005 static int e1000e_set_flags(struct net_device
*netdev
, u32 data
)
2007 struct e1000_adapter
*adapter
= netdev_priv(netdev
);
2008 bool need_reset
= false;
2011 need_reset
= (data
& ETH_FLAG_RXVLAN
) !=
2012 (netdev
->features
& NETIF_F_HW_VLAN_RX
);
2014 rc
= ethtool_op_set_flags(netdev
, data
, ETH_FLAG_RXVLAN
|
2021 if (netif_running(netdev
))
2022 e1000e_reinit_locked(adapter
);
2024 e1000e_reset(adapter
);
2030 static const struct ethtool_ops e1000_ethtool_ops
= {
2031 .get_settings
= e1000_get_settings
,
2032 .set_settings
= e1000_set_settings
,
2033 .get_drvinfo
= e1000_get_drvinfo
,
2034 .get_regs_len
= e1000_get_regs_len
,
2035 .get_regs
= e1000_get_regs
,
2036 .get_wol
= e1000_get_wol
,
2037 .set_wol
= e1000_set_wol
,
2038 .get_msglevel
= e1000_get_msglevel
,
2039 .set_msglevel
= e1000_set_msglevel
,
2040 .nway_reset
= e1000_nway_reset
,
2041 .get_link
= ethtool_op_get_link
,
2042 .get_eeprom_len
= e1000_get_eeprom_len
,
2043 .get_eeprom
= e1000_get_eeprom
,
2044 .set_eeprom
= e1000_set_eeprom
,
2045 .get_ringparam
= e1000_get_ringparam
,
2046 .set_ringparam
= e1000_set_ringparam
,
2047 .get_pauseparam
= e1000_get_pauseparam
,
2048 .set_pauseparam
= e1000_set_pauseparam
,
2049 .get_rx_csum
= e1000_get_rx_csum
,
2050 .set_rx_csum
= e1000_set_rx_csum
,
2051 .get_tx_csum
= e1000_get_tx_csum
,
2052 .set_tx_csum
= e1000_set_tx_csum
,
2053 .get_sg
= ethtool_op_get_sg
,
2054 .set_sg
= ethtool_op_set_sg
,
2055 .get_tso
= ethtool_op_get_tso
,
2056 .set_tso
= e1000_set_tso
,
2057 .self_test
= e1000_diag_test
,
2058 .get_strings
= e1000_get_strings
,
2059 .set_phys_id
= e1000_set_phys_id
,
2060 .get_ethtool_stats
= e1000_get_ethtool_stats
,
2061 .get_sset_count
= e1000e_get_sset_count
,
2062 .get_coalesce
= e1000_get_coalesce
,
2063 .set_coalesce
= e1000_set_coalesce
,
2064 .get_flags
= ethtool_op_get_flags
,
2065 .set_flags
= e1000e_set_flags
,
2068 void e1000e_set_ethtool_ops(struct net_device
*netdev
)
2070 SET_ETHTOOL_OPS(netdev
, &e1000_ethtool_ops
);