author | Florian Pose <fp@igh-essen.com> |
Thu, 15 Mar 2012 11:30:25 +0100 | |
branch | redundancy |
changeset 2364 | 41ad0b0e55b0 |
parent 2135 | f99b2249704c |
permissions | -rw-r--r-- |
2135
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
Intel PRO/1000 Linux driver |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2010 Intel Corporation. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
This program is free software; you can redistribute it and/or modify it |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
under the terms and conditions of the GNU General Public License, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
version 2, as published by the Free Software Foundation. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
This program is distributed in the hope it will be useful, but WITHOUT |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
more details. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
You should have received a copy of the GNU General Public License along with |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
this program; if not, write to the Free Software Foundation, Inc., |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
The full GNU General Public License is included in this distribution in |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
the file called "COPYING". |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
Contact Information: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Linux NICS <linux.nics@intel.com> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
*******************************************************************************/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
/* ethtool support for e1000 */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
#include <linux/netdevice.h> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
#include <linux/ethtool.h> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
#include <linux/pci.h> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
#include <linux/slab.h> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
#include <linux/delay.h> |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include "e1000.h" |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
enum {NETDEV_STATS, E1000_STATS}; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
struct e1000_stats { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
char stat_string[ETH_GSTRING_LEN]; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
int type; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
int sizeof_stat; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
int stat_offset; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
}; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
#define E1000_STAT(m) E1000_STATS, \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
sizeof(((struct e1000_adapter *)0)->m), \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
offsetof(struct e1000_adapter, m) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
#define E1000_NETDEV_STAT(m) NETDEV_STATS, \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
sizeof(((struct net_device *)0)->m), \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
offsetof(struct net_device, m) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
static const struct e1000_stats e1000_gstrings_stats[] = { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
{ "rx_packets", E1000_STAT(stats.gprc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
{ "tx_packets", E1000_STAT(stats.gptc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
{ "rx_bytes", E1000_STAT(stats.gorc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
{ "tx_bytes", E1000_STAT(stats.gotc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
{ "rx_broadcast", E1000_STAT(stats.bprc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
{ "tx_broadcast", E1000_STAT(stats.bptc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
{ "rx_multicast", E1000_STAT(stats.mprc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
{ "tx_multicast", E1000_STAT(stats.mptc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
{ "rx_errors", E1000_NETDEV_STAT(stats.rx_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
{ "tx_errors", E1000_NETDEV_STAT(stats.tx_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
{ "tx_dropped", E1000_NETDEV_STAT(stats.tx_dropped) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
{ "multicast", E1000_STAT(stats.mprc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
{ "collisions", E1000_STAT(stats.colc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
{ "rx_length_errors", E1000_NETDEV_STAT(stats.rx_length_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
{ "rx_over_errors", E1000_NETDEV_STAT(stats.rx_over_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
{ "rx_crc_errors", E1000_STAT(stats.crcerrs) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
{ "rx_frame_errors", E1000_NETDEV_STAT(stats.rx_frame_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
{ "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
{ "rx_missed_errors", E1000_STAT(stats.mpc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
{ "tx_aborted_errors", E1000_STAT(stats.ecol) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
{ "tx_carrier_errors", E1000_STAT(stats.tncrs) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
{ "tx_fifo_errors", E1000_NETDEV_STAT(stats.tx_fifo_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
{ "tx_heartbeat_errors", E1000_NETDEV_STAT(stats.tx_heartbeat_errors) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
{ "tx_window_errors", E1000_STAT(stats.latecol) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
{ "tx_abort_late_coll", E1000_STAT(stats.latecol) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
{ "tx_deferred_ok", E1000_STAT(stats.dc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
{ "tx_single_coll_ok", E1000_STAT(stats.scc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
{ "tx_multi_coll_ok", E1000_STAT(stats.mcc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
{ "tx_timeout_count", E1000_STAT(tx_timeout_count) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
{ "tx_restart_queue", E1000_STAT(restart_queue) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
{ "rx_long_length_errors", E1000_STAT(stats.roc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
{ "rx_short_length_errors", E1000_STAT(stats.ruc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
{ "rx_align_errors", E1000_STAT(stats.algnerrc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
{ "tx_tcp_seg_good", E1000_STAT(stats.tsctc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
{ "tx_tcp_seg_failed", E1000_STAT(stats.tsctfc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
{ "rx_flow_control_xon", E1000_STAT(stats.xonrxc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
{ "rx_flow_control_xoff", E1000_STAT(stats.xoffrxc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
{ "tx_flow_control_xon", E1000_STAT(stats.xontxc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
{ "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
{ "rx_long_byte_count", E1000_STAT(stats.gorc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
{ "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
{ "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
{ "rx_header_split", E1000_STAT(rx_hdr_split) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
{ "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
{ "tx_smbus", E1000_STAT(stats.mgptc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
{ "rx_smbus", E1000_STAT(stats.mgprc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
{ "dropped_smbus", E1000_STAT(stats.mgpdc) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
{ "rx_dma_failed", E1000_STAT(rx_dma_failed) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
{ "tx_dma_failed", E1000_STAT(tx_dma_failed) }, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
}; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
#define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
"Register test (offline)", "Eeprom test (offline)", |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
"Interrupt test (offline)", "Loopback test (offline)", |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
"Link test (on/offline)" |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
}; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
#define E1000_TEST_LEN ARRAY_SIZE(e1000_gstrings_test) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
static int e1000_get_settings(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
struct ethtool_cmd *ecmd) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
if (hw->phy.media_type == e1000_media_type_copper) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
ecmd->supported = (SUPPORTED_10baseT_Half | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
SUPPORTED_10baseT_Full | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
SUPPORTED_100baseT_Half | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
SUPPORTED_100baseT_Full | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
SUPPORTED_1000baseT_Full | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
SUPPORTED_Autoneg | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
SUPPORTED_TP); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
if (hw->phy.type == e1000_phy_ife) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
ecmd->supported &= ~SUPPORTED_1000baseT_Full; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
ecmd->advertising = ADVERTISED_TP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
if (hw->mac.autoneg == 1) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
ecmd->advertising |= ADVERTISED_Autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
/* the e1000 autoneg seems to match ethtool nicely */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
ecmd->advertising |= hw->phy.autoneg_advertised; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
ecmd->port = PORT_TP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
ecmd->phy_address = hw->phy.addr; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
ecmd->transceiver = XCVR_INTERNAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
ecmd->supported = (SUPPORTED_1000baseT_Full | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
SUPPORTED_FIBRE | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
SUPPORTED_Autoneg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
ecmd->advertising = (ADVERTISED_1000baseT_Full | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
ADVERTISED_FIBRE | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
ADVERTISED_Autoneg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
ecmd->port = PORT_FIBRE; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
ecmd->transceiver = XCVR_EXTERNAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
ecmd->speed = -1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
ecmd->duplex = -1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
if (netif_running(netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
if (netif_carrier_ok(netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
ecmd->speed = adapter->link_speed; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
ecmd->duplex = adapter->link_duplex - 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
u32 status = er32(STATUS); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
if (status & E1000_STATUS_LU) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
if (status & E1000_STATUS_SPEED_1000) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
ecmd->speed = 1000; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
else if (status & E1000_STATUS_SPEED_100) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
ecmd->speed = 100; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
ecmd->speed = 10; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
if (status & E1000_STATUS_FD) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
ecmd->duplex = DUPLEX_FULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
ecmd->duplex = DUPLEX_HALF; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
/* MDI-X => 2; MDI =>1; Invalid =>0 */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
if ((hw->phy.media_type == e1000_media_type_copper) && |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
netif_carrier_ok(netdev)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X : |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
ETH_TP_MDI; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
static u32 e1000_get_link(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
* Avoid touching hardware registers when possible, otherwise |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
* link negotiation can get messed up when user-level scripts |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
* are rapidly polling the driver to see if link is up. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
return netif_running(netdev) ? netif_carrier_ok(netdev) : |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
!!(er32(STATUS) & E1000_STATUS_LU); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
struct e1000_mac_info *mac = &adapter->hw.mac; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
mac->autoneg = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
/* Fiber NICs only allow 1000 gbps Full duplex */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
spddplx != (SPEED_1000 + DUPLEX_FULL)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
e_err("Unsupported Speed/Duplex configuration\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
switch (spddplx) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
case SPEED_10 + DUPLEX_HALF: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
mac->forced_speed_duplex = ADVERTISE_10_HALF; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
case SPEED_10 + DUPLEX_FULL: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
mac->forced_speed_duplex = ADVERTISE_10_FULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
case SPEED_100 + DUPLEX_HALF: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
mac->forced_speed_duplex = ADVERTISE_100_HALF; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
case SPEED_100 + DUPLEX_FULL: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
mac->forced_speed_duplex = ADVERTISE_100_FULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
case SPEED_1000 + DUPLEX_FULL: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
mac->autoneg = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
case SPEED_1000 + DUPLEX_HALF: /* not supported */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
e_err("Unsupported Speed/Duplex configuration\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
static int e1000_set_settings(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
struct ethtool_cmd *ecmd) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
* When SoL/IDER sessions are active, autoneg/speed/duplex |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
* cannot be changed |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
if (e1000_check_reset_block(hw)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
e_err("Cannot change link characteristics when SoL/IDER is " |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
"active.\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
msleep(1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
hw->mac.autoneg = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
if (hw->phy.media_type == e1000_media_type_fiber) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
ADVERTISED_FIBRE | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
ADVERTISED_Autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
hw->phy.autoneg_advertised = ecmd->advertising | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
ADVERTISED_TP | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
ADVERTISED_Autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
ecmd->advertising = hw->phy.autoneg_advertised; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
if (adapter->fc_autoneg) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
hw->fc.requested_mode = e1000_fc_default; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
clear_bit(__E1000_RESETTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
/* reset the link */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
if (netif_running(adapter->netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
e1000e_down(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
e1000e_up(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
clear_bit(__E1000_RESETTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
static void e1000_get_pauseparam(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
struct ethtool_pauseparam *pause) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
pause->autoneg = |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
(adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
if (hw->fc.current_mode == e1000_fc_rx_pause) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
pause->rx_pause = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
} else if (hw->fc.current_mode == e1000_fc_tx_pause) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
pause->tx_pause = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
} else if (hw->fc.current_mode == e1000_fc_full) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
pause->rx_pause = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
pause->tx_pause = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
static int e1000_set_pauseparam(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
struct ethtool_pauseparam *pause) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
int retval = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
adapter->fc_autoneg = pause->autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
msleep(1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
if (adapter->fc_autoneg == AUTONEG_ENABLE) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
hw->fc.requested_mode = e1000_fc_default; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
if (netif_running(adapter->netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
e1000e_down(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
e1000e_up(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
if (pause->rx_pause && pause->tx_pause) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
hw->fc.requested_mode = e1000_fc_full; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
else if (pause->rx_pause && !pause->tx_pause) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
hw->fc.requested_mode = e1000_fc_rx_pause; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
else if (!pause->rx_pause && pause->tx_pause) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
hw->fc.requested_mode = e1000_fc_tx_pause; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
else if (!pause->rx_pause && !pause->tx_pause) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
hw->fc.requested_mode = e1000_fc_none; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
hw->fc.current_mode = hw->fc.requested_mode; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
if (hw->phy.media_type == e1000_media_type_fiber) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
retval = hw->mac.ops.setup_link(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
/* implicit goto out */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
retval = e1000e_force_mac_fc(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
if (retval) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
goto out; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
e1000e_set_fc_watermarks(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
out: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
clear_bit(__E1000_RESETTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
return retval; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
static u32 e1000_get_rx_csum(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
return adapter->flags & FLAG_RX_CSUM_ENABLED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
static int e1000_set_rx_csum(struct net_device *netdev, u32 data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
if (data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
adapter->flags |= FLAG_RX_CSUM_ENABLED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
adapter->flags &= ~FLAG_RX_CSUM_ENABLED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
if (netif_running(netdev)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
e1000e_reinit_locked(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
static u32 e1000_get_tx_csum(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
return (netdev->features & NETIF_F_HW_CSUM) != 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
static int e1000_set_tx_csum(struct net_device *netdev, u32 data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
if (data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
netdev->features |= NETIF_F_HW_CSUM; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
netdev->features &= ~NETIF_F_HW_CSUM; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
static int e1000_set_tso(struct net_device *netdev, u32 data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
if (data) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
netdev->features |= NETIF_F_TSO; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
netdev->features |= NETIF_F_TSO6; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
netdev->features &= ~NETIF_F_TSO; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
netdev->features &= ~NETIF_F_TSO6; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
adapter->flags |= FLAG_TSO_FORCE; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
static u32 e1000_get_msglevel(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
return adapter->msg_enable; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
static void e1000_set_msglevel(struct net_device *netdev, u32 data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
adapter->msg_enable = data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
static int e1000_get_regs_len(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
#define E1000_REGS_LEN 32 /* overestimate */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
return E1000_REGS_LEN * sizeof(u32); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
static void e1000_get_regs(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
struct ethtool_regs *regs, void *p) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
u32 *regs_buff = p; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
u16 phy_data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
u8 revision_id; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
memset(p, 0, E1000_REGS_LEN * sizeof(u32)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
pci_read_config_byte(adapter->pdev, PCI_REVISION_ID, &revision_id); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
regs->version = (1 << 24) | (revision_id << 16) | adapter->pdev->device; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
regs_buff[0] = er32(CTRL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
regs_buff[1] = er32(STATUS); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
regs_buff[2] = er32(RCTL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
regs_buff[3] = er32(RDLEN); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
regs_buff[4] = er32(RDH); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
regs_buff[5] = er32(RDT); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
regs_buff[6] = er32(RDTR); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
regs_buff[7] = er32(TCTL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
regs_buff[8] = er32(TDLEN); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
regs_buff[9] = er32(TDH); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
regs_buff[10] = er32(TDT); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
regs_buff[11] = er32(TIDV); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
/* ethtool doesn't use anything past this point, so all this |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
* code is likely legacy junk for apps that may or may not |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
* exist */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
if (hw->phy.type == e1000_phy_m88) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
regs_buff[13] = (u32)phy_data; /* cable length */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
regs_buff[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
regs_buff[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
regs_buff[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
e1e_rphy(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
regs_buff[17] = (u32)phy_data; /* extended 10bt distance */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
regs_buff[18] = regs_buff[13]; /* cable polarity */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
regs_buff[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
regs_buff[20] = regs_buff[17]; /* polarity correction */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
/* phy receive errors */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
regs_buff[22] = adapter->phy_stats.receive_errors; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
regs_buff[23] = regs_buff[13]; /* mdix mode */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
regs_buff[21] = 0; /* was idle_errors */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
e1e_rphy(hw, PHY_1000T_STATUS, &phy_data); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
regs_buff[24] = (u32)phy_data; /* phy local receiver status */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
static int e1000_get_eeprom_len(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
return adapter->hw.nvm.word_size * 2; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
static int e1000_get_eeprom(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
struct ethtool_eeprom *eeprom, u8 *bytes) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
u16 *eeprom_buff; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
int first_word; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
int last_word; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
int ret_val = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
u16 i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
if (eeprom->len == 0) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
eeprom->magic = adapter->pdev->vendor | (adapter->pdev->device << 16); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
first_word = eeprom->offset >> 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
last_word = (eeprom->offset + eeprom->len - 1) >> 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
eeprom_buff = kmalloc(sizeof(u16) * |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
(last_word - first_word + 1), GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
if (!eeprom_buff) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
return -ENOMEM; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
if (hw->nvm.type == e1000_nvm_eeprom_spi) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
ret_val = e1000_read_nvm(hw, first_word, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
last_word - first_word + 1, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
eeprom_buff); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
for (i = 0; i < last_word - first_word + 1; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
ret_val = e1000_read_nvm(hw, first_word + i, 1, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
&eeprom_buff[i]); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
if (ret_val) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
if (ret_val) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
/* a read error occurred, throw away the result */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
memset(eeprom_buff, 0xff, sizeof(u16) * |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
(last_word - first_word + 1)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
/* Device's eeprom is always little-endian, word addressable */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
for (i = 0; i < last_word - first_word + 1; i++) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
le16_to_cpus(&eeprom_buff[i]); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
kfree(eeprom_buff); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
return ret_val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
static int e1000_set_eeprom(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
struct ethtool_eeprom *eeprom, u8 *bytes) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
u16 *eeprom_buff; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
void *ptr; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
int max_len; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
int first_word; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
int last_word; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
int ret_val = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
u16 i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
if (eeprom->len == 0) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
return -EOPNOTSUPP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16))) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
return -EFAULT; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
if (adapter->flags & FLAG_READ_ONLY_NVM) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
max_len = hw->nvm.word_size * 2; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
first_word = eeprom->offset >> 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
last_word = (eeprom->offset + eeprom->len - 1) >> 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
eeprom_buff = kmalloc(max_len, GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
if (!eeprom_buff) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
return -ENOMEM; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
ptr = (void *)eeprom_buff; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
if (eeprom->offset & 1) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
/* need read/modify/write of first changed EEPROM word */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
/* only the second byte of the word is being modified */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
ret_val = e1000_read_nvm(hw, first_word, 1, &eeprom_buff[0]); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
ptr++; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
/* need read/modify/write of last changed EEPROM word */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
/* only the first byte of the word is being modified */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
ret_val = e1000_read_nvm(hw, last_word, 1, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
&eeprom_buff[last_word - first_word]); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
if (ret_val) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
goto out; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
/* Device's eeprom is always little-endian, word addressable */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
for (i = 0; i < last_word - first_word + 1; i++) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
le16_to_cpus(&eeprom_buff[i]); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
memcpy(ptr, bytes, eeprom->len); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
for (i = 0; i < last_word - first_word + 1; i++) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
ret_val = e1000_write_nvm(hw, first_word, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
last_word - first_word + 1, eeprom_buff); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
if (ret_val) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
goto out; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
* Update the checksum over the first part of the EEPROM if needed |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
* and flush shadow RAM for applicable controllers |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
if ((first_word <= NVM_CHECKSUM_REG) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
(hw->mac.type == e1000_82583) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
(hw->mac.type == e1000_82574) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
(hw->mac.type == e1000_82573)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
ret_val = e1000e_update_nvm_checksum(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
out: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
kfree(eeprom_buff); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
return ret_val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
static void e1000_get_drvinfo(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
struct ethtool_drvinfo *drvinfo) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
char firmware_version[32]; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
strncpy(drvinfo->driver, e1000e_driver_name, 32); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
strncpy(drvinfo->version, e1000e_driver_version, 32); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
* EEPROM image version # is reported as firmware version # for |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
* PCI-E controllers |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
sprintf(firmware_version, "%d.%d-%d", |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
(adapter->eeprom_vers & 0xF000) >> 12, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
(adapter->eeprom_vers & 0x0FF0) >> 4, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
(adapter->eeprom_vers & 0x000F)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
strncpy(drvinfo->fw_version, firmware_version, 32); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
drvinfo->regdump_len = e1000_get_regs_len(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
drvinfo->eedump_len = e1000_get_eeprom_len(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
static void e1000_get_ringparam(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
struct ethtool_ringparam *ring) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
ring->rx_max_pending = E1000_MAX_RXD; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
ring->tx_max_pending = E1000_MAX_TXD; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
ring->rx_mini_max_pending = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
ring->rx_jumbo_max_pending = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
ring->rx_pending = rx_ring->count; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
ring->tx_pending = tx_ring->count; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
ring->rx_mini_pending = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
ring->rx_jumbo_pending = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
static int e1000_set_ringparam(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
struct ethtool_ringparam *ring) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
struct e1000_ring *tx_ring, *tx_old; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
struct e1000_ring *rx_ring, *rx_old; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
int err; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
msleep(1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
if (netif_running(adapter->netdev)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
e1000e_down(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
tx_old = adapter->tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
rx_old = adapter->rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
err = -ENOMEM; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
if (!tx_ring) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
goto err_alloc_tx; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
* use a memcpy to save any previously configured |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
* items like napi structs from having to be |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
* reinitialized |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
memcpy(tx_ring, tx_old, sizeof(struct e1000_ring)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
if (!rx_ring) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
goto err_alloc_rx; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
memcpy(rx_ring, rx_old, sizeof(struct e1000_ring)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
adapter->tx_ring = tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
adapter->rx_ring = rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
rx_ring->count = max(ring->rx_pending, (u32)E1000_MIN_RXD); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
rx_ring->count = min(rx_ring->count, (u32)(E1000_MAX_RXD)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
rx_ring->count = ALIGN(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
tx_ring->count = max(ring->tx_pending, (u32)E1000_MIN_TXD); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
tx_ring->count = min(tx_ring->count, (u32)(E1000_MAX_TXD)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
tx_ring->count = ALIGN(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
if (netif_running(adapter->netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
/* Try to get new resources before deleting old */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
err = e1000e_setup_rx_resources(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
if (err) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
goto err_setup_rx; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
err = e1000e_setup_tx_resources(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
if (err) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
goto err_setup_tx; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
* restore the old in order to free it, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
* then add in the new |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
adapter->rx_ring = rx_old; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
adapter->tx_ring = tx_old; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
e1000e_free_rx_resources(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
e1000e_free_tx_resources(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
kfree(tx_old); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
kfree(rx_old); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
adapter->rx_ring = rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
adapter->tx_ring = tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
err = e1000e_up(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
if (err) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
goto err_setup; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
clear_bit(__E1000_RESETTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
err_setup_tx: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
e1000e_free_rx_resources(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
err_setup_rx: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
adapter->rx_ring = rx_old; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
adapter->tx_ring = tx_old; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
kfree(rx_ring); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
err_alloc_rx: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
kfree(tx_ring); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
err_alloc_tx: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
e1000e_up(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
err_setup: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
clear_bit(__E1000_RESETTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
return err; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
int reg, int offset, u32 mask, u32 write) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
u32 pat, val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
static const u32 test[] = |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
{0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
for (pat = 0; pat < ARRAY_SIZE(test); pat++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
E1000_WRITE_REG_ARRAY(&adapter->hw, reg, offset, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
(test[pat] & write)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
val = E1000_READ_REG_ARRAY(&adapter->hw, reg, offset); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
if (val != (test[pat] & write & mask)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
e_err("pattern test reg %04X failed: got 0x%08X " |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
"expected 0x%08X\n", reg + offset, val, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
(test[pat] & write & mask)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
*data = reg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
return 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
int reg, u32 mask, u32 write) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
u32 val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
__ew32(&adapter->hw, reg, write & mask); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
val = __er32(&adapter->hw, reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
if ((write & mask) != (val & mask)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
e_err("set/check reg %04X test failed: got 0x%08X " |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
"expected 0x%08X\n", reg, (val & mask), (write & mask)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
*data = reg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
return 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
#define REG_PATTERN_TEST_ARRAY(reg, offset, mask, write) \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
do { \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
if (reg_pattern_test(adapter, data, reg, offset, mask, write)) \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
return 1; \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
} while (0) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
#define REG_PATTERN_TEST(reg, mask, write) \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
REG_PATTERN_TEST_ARRAY(reg, 0, mask, write) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
#define REG_SET_AND_CHECK(reg, mask, write) \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
do { \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
if (reg_set_and_check(adapter, data, reg, mask, write)) \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
return 1; \ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
} while (0) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
struct e1000_mac_info *mac = &adapter->hw.mac; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
u32 value; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
u32 before; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
u32 after; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
u32 i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
u32 toggle; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
u32 mask; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
* The status register is Read Only, so a write should fail. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
* Some bits that get toggled are ignored. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
switch (mac->type) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
/* there are several bits on newer hardware that are r/w */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
case e1000_82571: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
case e1000_82572: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
case e1000_80003es2lan: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
toggle = 0x7FFFF3FF; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
toggle = 0x7FFFF033; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
before = er32(STATUS); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
value = (er32(STATUS) & toggle); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
ew32(STATUS, toggle); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
after = er32(STATUS) & toggle; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
if (value != after) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
e_err("failed STATUS register test got: 0x%08X expected: " |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
"0x%08X\n", after, value); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
*data = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
return 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
/* restore previous status */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
ew32(STATUS, before); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
if (!(adapter->flags & FLAG_IS_ICH)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
REG_PATTERN_TEST(E1000_FCAL, 0xFFFFFFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
REG_PATTERN_TEST(E1000_FCAH, 0x0000FFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
REG_PATTERN_TEST(E1000_FCT, 0x0000FFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
REG_PATTERN_TEST(E1000_VET, 0x0000FFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
REG_PATTERN_TEST(E1000_RDTR, 0x0000FFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
REG_PATTERN_TEST(E1000_RDBAH, 0xFFFFFFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
REG_PATTERN_TEST(E1000_RDLEN, 0x000FFF80, 0x000FFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
REG_PATTERN_TEST(E1000_RDH, 0x0000FFFF, 0x0000FFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
REG_PATTERN_TEST(E1000_RDT, 0x0000FFFF, 0x0000FFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
REG_PATTERN_TEST(E1000_FCRTH, 0x0000FFF8, 0x0000FFF8); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
REG_PATTERN_TEST(E1000_FCTTV, 0x0000FFFF, 0x0000FFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
REG_PATTERN_TEST(E1000_TIPG, 0x3FFFFFFF, 0x3FFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
REG_PATTERN_TEST(E1000_TDBAH, 0xFFFFFFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
REG_PATTERN_TEST(E1000_TDLEN, 0x000FFF80, 0x000FFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
REG_SET_AND_CHECK(E1000_RCTL, 0xFFFFFFFF, 0x00000000); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
before = ((adapter->flags & FLAG_IS_ICH) ? 0x06C3B33E : 0x06DFB3FE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
REG_SET_AND_CHECK(E1000_RCTL, before, 0x003FFFFB); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
REG_SET_AND_CHECK(E1000_TCTL, 0xFFFFFFFF, 0x00000000); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
REG_SET_AND_CHECK(E1000_RCTL, before, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
REG_PATTERN_TEST(E1000_RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
if (!(adapter->flags & FLAG_IS_ICH)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
REG_PATTERN_TEST(E1000_TXCW, 0xC000FFFF, 0x0000FFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
REG_PATTERN_TEST(E1000_TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
REG_PATTERN_TEST(E1000_TIDV, 0x0000FFFF, 0x0000FFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
mask = 0x8003FFFF; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
switch (mac->type) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
case e1000_ich10lan: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
case e1000_pchlan: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
case e1000_pch2lan: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
mask |= (1 << 18); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
for (i = 0; i < mac->rar_entry_count; i++) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1), |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
mask, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
for (i = 0; i < mac->mta_reg_count; i++) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
REG_PATTERN_TEST_ARRAY(E1000_MTA, i, 0xFFFFFFFF, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
*data = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
static int e1000_eeprom_test(struct e1000_adapter *adapter, u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
u16 temp; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
u16 checksum = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
u16 i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
*data = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
/* Read and add up the contents of the EEPROM */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
if ((e1000_read_nvm(&adapter->hw, i, 1, &temp)) < 0) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
*data = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
return *data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
checksum += temp; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
/* If Checksum is not Correct return error else test passed */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
if ((checksum != (u16) NVM_SUM) && !(*data)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
*data = 2; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
return *data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
static irqreturn_t e1000_test_intr(int irq, void *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
struct net_device *netdev = (struct net_device *) data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
adapter->test_icr |= er32(ICR); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
return IRQ_HANDLED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
struct net_device *netdev = adapter->netdev; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
u32 mask; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
u32 shared_int = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
u32 irq = adapter->pdev->irq; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
int i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
int ret_val = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
int int_mode = E1000E_INT_MODE_LEGACY; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
*data = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
/* NOTE: we don't test MSI/MSI-X interrupts here, yet */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
if (adapter->int_mode == E1000E_INT_MODE_MSIX) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
int_mode = adapter->int_mode; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
e1000e_reset_interrupt_capability(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
adapter->int_mode = E1000E_INT_MODE_LEGACY; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
e1000e_set_interrupt_capability(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
/* Hook up test interrupt handler just for this test */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
if (!request_irq(irq, e1000_test_intr, IRQF_PROBE_SHARED, netdev->name, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
shared_int = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
} else if (request_irq(irq, e1000_test_intr, IRQF_SHARED, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
netdev->name, netdev)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
*data = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
ret_val = -1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
goto out; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared")); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
/* Disable all the interrupts */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
ew32(IMC, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
/* Test each interrupt */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
for (i = 0; i < 10; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
/* Interrupt to test */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
mask = 1 << i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
if (adapter->flags & FLAG_IS_ICH) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
switch (mask) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
case E1000_ICR_RXSEQ: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
continue; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
case 0x00000100: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
if (adapter->hw.mac.type == e1000_ich8lan || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
adapter->hw.mac.type == e1000_ich9lan) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
continue; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
if (!shared_int) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
* Disable the interrupt to be reported in |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
* the cause register and then force the same |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
* interrupt and see if one gets posted. If |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
* an interrupt was posted to the bus, the |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
* test failed. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
adapter->test_icr = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
ew32(IMC, mask); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
ew32(ICS, mask); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
if (adapter->test_icr & mask) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
*data = 3; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
* Enable the interrupt to be reported in |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
* the cause register and then force the same |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
* interrupt and see if one gets posted. If |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
* an interrupt was not posted to the bus, the |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
* test failed. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
adapter->test_icr = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
ew32(IMS, mask); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
ew32(ICS, mask); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
if (!(adapter->test_icr & mask)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
*data = 4; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
if (!shared_int) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
* Disable the other interrupts to be reported in |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
* the cause register and then force the other |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
* interrupts and see if any get posted. If |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
* an interrupt was posted to the bus, the |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
* test failed. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
adapter->test_icr = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
ew32(IMC, ~mask & 0x00007FFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
ew32(ICS, ~mask & 0x00007FFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
if (adapter->test_icr) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
*data = 5; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
/* Disable all the interrupts */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
ew32(IMC, 0xFFFFFFFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
/* Unhook test interrupt handler */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
free_irq(irq, netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
out: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
if (int_mode == E1000E_INT_MODE_MSIX) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
e1000e_reset_interrupt_capability(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
adapter->int_mode = int_mode; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
e1000e_set_interrupt_capability(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
return ret_val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
static void e1000_free_desc_rings(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
struct e1000_ring *tx_ring = &adapter->test_tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
struct e1000_ring *rx_ring = &adapter->test_rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
struct pci_dev *pdev = adapter->pdev; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
int i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
if (tx_ring->desc && tx_ring->buffer_info) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
for (i = 0; i < tx_ring->count; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
if (tx_ring->buffer_info[i].dma) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
dma_unmap_single(&pdev->dev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
tx_ring->buffer_info[i].dma, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
tx_ring->buffer_info[i].length, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
DMA_TO_DEVICE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
if (tx_ring->buffer_info[i].skb) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
dev_kfree_skb(tx_ring->buffer_info[i].skb); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
if (rx_ring->desc && rx_ring->buffer_info) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
for (i = 0; i < rx_ring->count; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
if (rx_ring->buffer_info[i].dma) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
dma_unmap_single(&pdev->dev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
rx_ring->buffer_info[i].dma, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
2048, DMA_FROM_DEVICE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
if (rx_ring->buffer_info[i].skb) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
dev_kfree_skb(rx_ring->buffer_info[i].skb); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
if (tx_ring->desc) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
tx_ring->dma); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
tx_ring->desc = NULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
if (rx_ring->desc) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
rx_ring->dma); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
rx_ring->desc = NULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
kfree(tx_ring->buffer_info); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
tx_ring->buffer_info = NULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
kfree(rx_ring->buffer_info); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
rx_ring->buffer_info = NULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
static int e1000_setup_desc_rings(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
struct e1000_ring *tx_ring = &adapter->test_tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
struct e1000_ring *rx_ring = &adapter->test_rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
struct pci_dev *pdev = adapter->pdev; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
u32 rctl; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
int i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
int ret_val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
/* Setup Tx descriptor ring and Tx buffers */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
if (!tx_ring->count) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
tx_ring->count = E1000_DEFAULT_TXD; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
tx_ring->buffer_info = kcalloc(tx_ring->count, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
sizeof(struct e1000_buffer), |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
if (!(tx_ring->buffer_info)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
ret_val = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
tx_ring->size = ALIGN(tx_ring->size, 4096); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
&tx_ring->dma, GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
if (!tx_ring->desc) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
ret_val = 2; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
tx_ring->next_to_use = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
tx_ring->next_to_clean = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
ew32(TDBAL, ((u64) tx_ring->dma & 0x00000000FFFFFFFF)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
ew32(TDBAH, ((u64) tx_ring->dma >> 32)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
ew32(TDLEN, tx_ring->count * sizeof(struct e1000_tx_desc)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
ew32(TDH, 0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
ew32(TDT, 0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
ew32(TCTL, E1000_TCTL_PSP | E1000_TCTL_EN | E1000_TCTL_MULR | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
for (i = 0; i < tx_ring->count; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
struct sk_buff *skb; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
unsigned int skb_size = 1024; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
skb = alloc_skb(skb_size, GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
if (!skb) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
ret_val = 3; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
skb_put(skb, skb_size); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
tx_ring->buffer_info[i].skb = skb; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
tx_ring->buffer_info[i].length = skb->len; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
tx_ring->buffer_info[i].dma = |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
dma_map_single(&pdev->dev, skb->data, skb->len, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
DMA_TO_DEVICE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
if (dma_mapping_error(&pdev->dev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
tx_ring->buffer_info[i].dma)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
ret_val = 4; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
tx_desc->buffer_addr = cpu_to_le64(tx_ring->buffer_info[i].dma); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
tx_desc->lower.data = cpu_to_le32(skb->len); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
E1000_TXD_CMD_IFCS | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
E1000_TXD_CMD_RS); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
tx_desc->upper.data = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
/* Setup Rx descriptor ring and Rx buffers */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
if (!rx_ring->count) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
rx_ring->count = E1000_DEFAULT_RXD; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
rx_ring->buffer_info = kcalloc(rx_ring->count, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
sizeof(struct e1000_buffer), |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
if (!(rx_ring->buffer_info)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
ret_val = 5; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
rx_ring->size = rx_ring->count * sizeof(struct e1000_rx_desc); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
&rx_ring->dma, GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
if (!rx_ring->desc) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
ret_val = 6; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
rx_ring->next_to_use = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
rx_ring->next_to_clean = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
rctl = er32(RCTL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
ew32(RCTL, rctl & ~E1000_RCTL_EN); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
ew32(RDBAL, ((u64) rx_ring->dma & 0xFFFFFFFF)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
ew32(RDBAH, ((u64) rx_ring->dma >> 32)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
ew32(RDLEN, rx_ring->size); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
ew32(RDH, 0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
ew32(RDT, 0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_LPE | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
E1000_RCTL_SBP | E1000_RCTL_SECRC | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
(adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
ew32(RCTL, rctl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
for (i = 0; i < rx_ring->count; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
struct sk_buff *skb; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
skb = alloc_skb(2048 + NET_IP_ALIGN, GFP_KERNEL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
if (!skb) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
ret_val = 7; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
skb_reserve(skb, NET_IP_ALIGN); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
rx_ring->buffer_info[i].skb = skb; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
rx_ring->buffer_info[i].dma = |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
dma_map_single(&pdev->dev, skb->data, 2048, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
DMA_FROM_DEVICE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
if (dma_mapping_error(&pdev->dev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
rx_ring->buffer_info[i].dma)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
ret_val = 8; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
goto err_nomem; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
rx_desc->buffer_addr = |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
cpu_to_le64(rx_ring->buffer_info[i].dma); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
memset(skb->data, 0x00, skb->len); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
err_nomem: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
e1000_free_desc_rings(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
return ret_val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
static void e1000_phy_disable_receiver(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
/* Write out to PHY registers 29 and 30 to disable the Receiver. */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
e1e_wphy(&adapter->hw, 29, 0x001F); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
e1e_wphy(&adapter->hw, 30, 0x8FFC); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
e1e_wphy(&adapter->hw, 29, 0x001A); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
e1e_wphy(&adapter->hw, 30, 0x8FF0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
u32 ctrl_reg = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
u32 stat_reg = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
u16 phy_reg = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
hw->mac.autoneg = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
if (hw->phy.type == e1000_phy_ife) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
/* force 100, set loopback */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
e1e_wphy(hw, PHY_CONTROL, 0x6100); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
/* Now set up the MAC to the same speed/duplex as the PHY. */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
ctrl_reg = er32(CTRL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
E1000_CTRL_SPD_100 |/* Force Speed to 100 */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
E1000_CTRL_FD); /* Force Duplex to FULL */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
ew32(CTRL, ctrl_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
udelay(500); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
/* Specific PHY configuration for loopback */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
switch (hw->phy.type) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
case e1000_phy_m88: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
/* Auto-MDI/MDIX Off */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
/* reset to update Auto-MDI/MDIX */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
e1e_wphy(hw, PHY_CONTROL, 0x9140); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
/* autoneg off */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
e1e_wphy(hw, PHY_CONTROL, 0x8140); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
case e1000_phy_gg82563: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
case e1000_phy_bm: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
/* Set Default MAC Interface speed to 1GB */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
e1e_rphy(hw, PHY_REG(2, 21), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
phy_reg &= ~0x0007; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
phy_reg |= 0x006; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
e1e_wphy(hw, PHY_REG(2, 21), phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
/* Assert SW reset for above settings to take effect */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
e1000e_commit_phy(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
mdelay(1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
/* Force Full Duplex */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
e1e_rphy(hw, PHY_REG(769, 16), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
e1e_wphy(hw, PHY_REG(769, 16), phy_reg | 0x000C); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
/* Set Link Up (in force link) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
e1e_rphy(hw, PHY_REG(776, 16), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
e1e_wphy(hw, PHY_REG(776, 16), phy_reg | 0x0040); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
/* Force Link */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
e1e_rphy(hw, PHY_REG(769, 16), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
e1e_wphy(hw, PHY_REG(769, 16), phy_reg | 0x0040); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
/* Set Early Link Enable */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
e1e_rphy(hw, PHY_REG(769, 20), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
e1e_wphy(hw, PHY_REG(769, 20), phy_reg | 0x0400); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
case e1000_phy_82577: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
case e1000_phy_82578: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
/* Workaround: K1 must be disabled for stable 1Gbps operation */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
e1000_configure_k1_ich8lan(hw, false); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
case e1000_phy_82579: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
/* Disable PHY energy detect power down */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
e1e_rphy(hw, PHY_REG(0, 21), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
e1e_wphy(hw, PHY_REG(0, 21), phy_reg & ~(1 << 3)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
/* Disable full chip energy detect */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
e1e_rphy(hw, PHY_REG(776, 18), &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
e1e_wphy(hw, PHY_REG(776, 18), phy_reg | 1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
/* Enable loopback on the PHY */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
#define I82577_PHY_LBK_CTRL 19 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
e1e_wphy(hw, I82577_PHY_LBK_CTRL, 0x8001); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
/* force 1000, set loopback */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
e1e_wphy(hw, PHY_CONTROL, 0x4140); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
mdelay(250); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
/* Now set up the MAC to the same speed/duplex as the PHY. */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
ctrl_reg = er32(CTRL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
E1000_CTRL_FD); /* Force Duplex to FULL */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
if (adapter->flags & FLAG_IS_ICH) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
ctrl_reg |= E1000_CTRL_SLU; /* Set Link Up */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
if (hw->phy.media_type == e1000_media_type_copper && |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
hw->phy.type == e1000_phy_m88) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
* Set the ILOS bit on the fiber Nic if half duplex link is |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
* detected. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
stat_reg = er32(STATUS); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
if ((stat_reg & E1000_STATUS_FD) == 0) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
ew32(CTRL, ctrl_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
* Disable the receiver on the PHY so when a cable is plugged in, the |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
* PHY does not begin to autoneg when a cable is reconnected to the NIC. |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
if (hw->phy.type == e1000_phy_m88) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
e1000_phy_disable_receiver(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
udelay(500); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
u32 ctrl = er32(CTRL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
int link = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
/* special requirements for 82571/82572 fiber adapters */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
* jump through hoops to make sure link is up because serdes |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
* link is hardwired up |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
ctrl |= E1000_CTRL_SLU; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
ew32(CTRL, ctrl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
/* disable autoneg */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
ctrl = er32(TXCW); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
ctrl &= ~(1 << 31); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
ew32(TXCW, ctrl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
link = (er32(STATUS) & E1000_STATUS_LU); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
if (!link) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
/* set invert loss of signal */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
ctrl = er32(CTRL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
ctrl |= E1000_CTRL_ILOS; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
ew32(CTRL, ctrl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
* special write to serdes control register to enable SerDes analog |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
* loopback |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
#define E1000_SERDES_LB_ON 0x410 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
ew32(SCTL, E1000_SERDES_LB_ON); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
/* only call this for fiber/serdes connections to es2lan */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
static int e1000_set_es2lan_mac_loopback(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
u32 ctrlext = er32(CTRL_EXT); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
u32 ctrl = er32(CTRL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
* save CTRL_EXT to restore later, reuse an empty variable (unused |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
* on mac_type 80003es2lan) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
adapter->tx_fifo_head = ctrlext; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
/* clear the serdes mode bits, putting the device into mac loopback */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
ctrlext &= ~E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
ew32(CTRL_EXT, ctrlext); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
/* force speed to 1000/FD, link up */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
E1000_CTRL_SPD_1000 | E1000_CTRL_FD); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
ew32(CTRL, ctrl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
/* set mac loopback */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
ctrl = er32(RCTL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
ctrl |= E1000_RCTL_LBM_MAC; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
ew32(RCTL, ctrl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
/* set testing mode parameters (no need to reset later) */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
#define KMRNCTRLSTA_OPMODE (0x1F << 16) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
#define KMRNCTRLSTA_OPMODE_1GB_FD_GMII 0x0582 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
ew32(KMRNCTRLSTA, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
(KMRNCTRLSTA_OPMODE | KMRNCTRLSTA_OPMODE_1GB_FD_GMII)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
static int e1000_setup_loopback_test(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
u32 rctl; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
if (hw->phy.media_type == e1000_media_type_fiber || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
hw->phy.media_type == e1000_media_type_internal_serdes) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
switch (hw->mac.type) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
case e1000_80003es2lan: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
return e1000_set_es2lan_mac_loopback(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
case e1000_82571: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
case e1000_82572: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
return e1000_set_82571_fiber_loopback(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
rctl = er32(RCTL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
rctl |= E1000_RCTL_LBM_TCVR; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
ew32(RCTL, rctl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
} else if (hw->phy.media_type == e1000_media_type_copper) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
return e1000_integrated_phy_loopback(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
return 7; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
static void e1000_loopback_cleanup(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
u32 rctl; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
u16 phy_reg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
rctl = er32(RCTL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
ew32(RCTL, rctl); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
switch (hw->mac.type) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
case e1000_80003es2lan: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
if (hw->phy.media_type == e1000_media_type_fiber || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
hw->phy.media_type == e1000_media_type_internal_serdes) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
/* restore CTRL_EXT, stealing space from tx_fifo_head */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
ew32(CTRL_EXT, adapter->tx_fifo_head); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
adapter->tx_fifo_head = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
/* fall through */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
case e1000_82571: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
case e1000_82572: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
if (hw->phy.media_type == e1000_media_type_fiber || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
hw->phy.media_type == e1000_media_type_internal_serdes) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
#define E1000_SERDES_LB_OFF 0x400 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
ew32(SCTL, E1000_SERDES_LB_OFF); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
msleep(10); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
/* Fall Through */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
hw->mac.autoneg = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
if (hw->phy.type == e1000_phy_gg82563) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x180); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
e1e_rphy(hw, PHY_CONTROL, &phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
if (phy_reg & MII_CR_LOOPBACK) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
phy_reg &= ~MII_CR_LOOPBACK; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
e1e_wphy(hw, PHY_CONTROL, phy_reg); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
e1000e_commit_phy(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
static void e1000_create_lbtest_frame(struct sk_buff *skb, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
unsigned int frame_size) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
memset(skb->data, 0xFF, frame_size); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
frame_size &= ~1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
memset(&skb->data[frame_size / 2 + 10], 0xBE, 1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
memset(&skb->data[frame_size / 2 + 12], 0xAF, 1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
static int e1000_check_lbtest_frame(struct sk_buff *skb, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
unsigned int frame_size) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
frame_size &= ~1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
if (*(skb->data + 3) == 0xFF) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
if ((*(skb->data + frame_size / 2 + 10) == 0xBE) && |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
(*(skb->data + frame_size / 2 + 12) == 0xAF)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
return 13; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
static int e1000_run_loopback_test(struct e1000_adapter *adapter) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
struct e1000_ring *tx_ring = &adapter->test_tx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
struct e1000_ring *rx_ring = &adapter->test_rx_ring; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
struct pci_dev *pdev = adapter->pdev; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
int i, j, k, l; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
int lc; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
int good_cnt; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
int ret_val = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
unsigned long time; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
ew32(RDT, rx_ring->count - 1); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
* Calculate the loop count based on the largest descriptor ring |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
* The idea is to wrap the largest ring a number of times using 64 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
* send/receive pairs during each loop |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
if (rx_ring->count <= tx_ring->count) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
lc = ((tx_ring->count / 64) * 2) + 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
lc = ((rx_ring->count / 64) * 2) + 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
k = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
l = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
for (j = 0; j <= lc; j++) { /* loop count loop */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
for (i = 0; i < 64; i++) { /* send the packets */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
e1000_create_lbtest_frame(tx_ring->buffer_info[k].skb, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
1024); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
dma_sync_single_for_device(&pdev->dev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
tx_ring->buffer_info[k].dma, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
tx_ring->buffer_info[k].length, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
DMA_TO_DEVICE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
k++; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
if (k == tx_ring->count) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
k = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
ew32(TDT, k); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
msleep(200); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
time = jiffies; /* set the start time for the receive */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
good_cnt = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
do { /* receive the sent packets */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
dma_sync_single_for_cpu(&pdev->dev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
rx_ring->buffer_info[l].dma, 2048, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
DMA_FROM_DEVICE); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
ret_val = e1000_check_lbtest_frame( |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
rx_ring->buffer_info[l].skb, 1024); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
if (!ret_val) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
good_cnt++; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
l++; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
if (l == rx_ring->count) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
l = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
* time + 20 msecs (200 msecs on 2.4) is more than |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
* enough time to complete the receives, if it's |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
* exceeded, break and error off |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
} while ((good_cnt < 64) && !time_after(jiffies, time + 20)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
if (good_cnt != 64) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
ret_val = 13; /* ret_val is the same as mis-compare */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
if (jiffies >= (time + 20)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
ret_val = 14; /* error code for time out error */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
} /* end loop count loop */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
return ret_val; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
* PHY loopback cannot be performed if SoL/IDER |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
* sessions are active |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
if (e1000_check_reset_block(&adapter->hw)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
e_err("Cannot do PHY loopback test when SoL/IDER is active.\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
*data = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
goto out; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
*data = e1000_setup_desc_rings(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
if (*data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
goto out; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
*data = e1000_setup_loopback_test(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
if (*data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
goto err_loopback; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
*data = e1000_run_loopback_test(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
e1000_loopback_cleanup(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
err_loopback: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
e1000_free_desc_rings(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
out: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
return *data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
static int e1000_link_test(struct e1000_adapter *adapter, u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
*data = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
if (hw->phy.media_type == e1000_media_type_internal_serdes) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
int i = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
hw->mac.serdes_has_link = false; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
/* |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
* On some blade server designs, link establishment |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
* could take as long as 2-3 minutes |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
*/ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
do { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
hw->mac.ops.check_for_link(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
if (hw->mac.serdes_has_link) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
return *data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
msleep(20); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
} while (i++ < 3750); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
*data = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
hw->mac.ops.check_for_link(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
if (hw->mac.autoneg) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
msleep(4000); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
if (!(er32(STATUS) & |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
E1000_STATUS_LU)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
*data = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
return *data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
static int e1000e_get_sset_count(struct net_device *netdev, int sset) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
switch (sset) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
case ETH_SS_TEST: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
return E1000_TEST_LEN; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
case ETH_SS_STATS: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
return E1000_STATS_LEN; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
default: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
return -EOPNOTSUPP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
static void e1000_diag_test(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
struct ethtool_test *eth_test, u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
u16 autoneg_advertised; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
u8 forced_speed_duplex; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
u8 autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
bool if_running = netif_running(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
set_bit(__E1000_TESTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
if (eth_test->flags == ETH_TEST_FL_OFFLINE) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
/* Offline tests */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
/* save speed, duplex, autoneg settings */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
autoneg_advertised = adapter->hw.phy.autoneg_advertised; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
forced_speed_duplex = adapter->hw.mac.forced_speed_duplex; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
autoneg = adapter->hw.mac.autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
e_info("offline testing starting\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
if (if_running) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
/* indicate we're in test mode */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
dev_close(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
if (e1000_reg_test(adapter, &data[0])) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
if (e1000_eeprom_test(adapter, &data[1])) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
if (e1000_intr_test(adapter, &data[2])) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
/* make sure the phy is powered up */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
e1000e_power_up_phy(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
if (e1000_loopback_test(adapter, &data[3])) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
/* force this routine to wait until autoneg complete/timeout */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
adapter->hw.phy.autoneg_wait_to_complete = 1; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
adapter->hw.phy.autoneg_wait_to_complete = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
if (e1000_link_test(adapter, &data[4])) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
/* restore speed, duplex, autoneg settings */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
adapter->hw.phy.autoneg_advertised = autoneg_advertised; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
adapter->hw.mac.forced_speed_duplex = forced_speed_duplex; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
adapter->hw.mac.autoneg = autoneg; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
e1000e_reset(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
clear_bit(__E1000_TESTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
if (if_running) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
dev_open(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
if (!if_running && (adapter->flags & FLAG_HAS_AMT)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
clear_bit(__E1000_TESTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
dev_open(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
set_bit(__E1000_TESTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
e_info("online testing starting\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
/* Online tests */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
if (e1000_link_test(adapter, &data[4])) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
/* Online tests aren't run; pass by default */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
data[0] = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
data[1] = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
data[2] = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
data[3] = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
if (!if_running && (adapter->flags & FLAG_HAS_AMT)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
dev_close(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
clear_bit(__E1000_TESTING, &adapter->state); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
msleep_interruptible(4 * 1000); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
static void e1000_get_wol(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
struct ethtool_wolinfo *wol) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
wol->supported = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
wol->wolopts = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
if (!(adapter->flags & FLAG_HAS_WOL) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
!device_can_wakeup(&adapter->pdev->dev)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
return; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
wol->supported = WAKE_UCAST | WAKE_MCAST | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
WAKE_BCAST | WAKE_MAGIC | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
WAKE_PHY | WAKE_ARP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
/* apply any specific unsupported masks here */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
if (adapter->flags & FLAG_NO_WAKE_UCAST) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
wol->supported &= ~WAKE_UCAST; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
if (adapter->wol & E1000_WUFC_EX) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
e_err("Interface does not support directed (unicast) " |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
"frame wake-up packets\n"); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
if (adapter->wol & E1000_WUFC_EX) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
wol->wolopts |= WAKE_UCAST; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
if (adapter->wol & E1000_WUFC_MC) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
wol->wolopts |= WAKE_MCAST; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
if (adapter->wol & E1000_WUFC_BC) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
wol->wolopts |= WAKE_BCAST; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
if (adapter->wol & E1000_WUFC_MAG) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
wol->wolopts |= WAKE_MAGIC; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
if (adapter->wol & E1000_WUFC_LNKC) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
wol->wolopts |= WAKE_PHY; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
if (adapter->wol & E1000_WUFC_ARP) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
wol->wolopts |= WAKE_ARP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
static int e1000_set_wol(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
struct ethtool_wolinfo *wol) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
if (!(adapter->flags & FLAG_HAS_WOL) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
!device_can_wakeup(&adapter->pdev->dev) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
(wol->wolopts & ~(WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
WAKE_MAGIC | WAKE_PHY | WAKE_ARP))) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
return -EOPNOTSUPP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
/* these settings will always override what we currently have */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
adapter->wol = 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
if (wol->wolopts & WAKE_UCAST) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
adapter->wol |= E1000_WUFC_EX; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
if (wol->wolopts & WAKE_MCAST) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
adapter->wol |= E1000_WUFC_MC; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
if (wol->wolopts & WAKE_BCAST) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
adapter->wol |= E1000_WUFC_BC; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
if (wol->wolopts & WAKE_MAGIC) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
adapter->wol |= E1000_WUFC_MAG; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
if (wol->wolopts & WAKE_PHY) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
adapter->wol |= E1000_WUFC_LNKC; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
if (wol->wolopts & WAKE_ARP) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
adapter->wol |= E1000_WUFC_ARP; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
/* toggle LED 4 times per second = 2 "blinks" per second */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
#define E1000_ID_INTERVAL (HZ/4) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
/* bit defines for adapter->led_status */ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
#define E1000_LED_ON 0 |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
static void e1000e_led_blink_task(struct work_struct *work) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
struct e1000_adapter *adapter = container_of(work, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
struct e1000_adapter, led_blink_task); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
if (test_and_change_bit(E1000_LED_ON, &adapter->led_status)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
adapter->hw.mac.ops.led_off(&adapter->hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
adapter->hw.mac.ops.led_on(&adapter->hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
static void e1000_led_blink_callback(unsigned long data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
schedule_work(&adapter->led_blink_task); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
static int e1000_phys_id(struct net_device *netdev, u32 data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
if (!data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
data = INT_MAX; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
if ((hw->phy.type == e1000_phy_ife) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
(hw->mac.type == e1000_pchlan) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
(hw->mac.type == e1000_pch2lan) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
(hw->mac.type == e1000_82583) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
(hw->mac.type == e1000_82574)) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
if (!adapter->blink_timer.function) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
init_timer(&adapter->blink_timer); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
adapter->blink_timer.function = |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
e1000_led_blink_callback; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
adapter->blink_timer.data = (unsigned long) adapter; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
mod_timer(&adapter->blink_timer, jiffies); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
msleep_interruptible(data * 1000); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
del_timer_sync(&adapter->blink_timer); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
if (hw->phy.type == e1000_phy_ife) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
e1000e_blink_led(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
msleep_interruptible(data * 1000); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
hw->mac.ops.led_off(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
clear_bit(E1000_LED_ON, &adapter->led_status); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
hw->mac.ops.cleanup_led(hw); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
static int e1000_get_coalesce(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
struct ethtool_coalesce *ec) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
if (adapter->itr_setting <= 4) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
ec->rx_coalesce_usecs = adapter->itr_setting; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
static int e1000_set_coalesce(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
struct ethtool_coalesce *ec) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
struct e1000_hw *hw = &adapter->hw; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
((ec->rx_coalesce_usecs > 4) && |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
(ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) || |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
(ec->rx_coalesce_usecs == 2)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
return -EINVAL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
if (ec->rx_coalesce_usecs == 4) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
adapter->itr = adapter->itr_setting = 4; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
} else if (ec->rx_coalesce_usecs <= 3) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
adapter->itr = 20000; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
adapter->itr_setting = ec->rx_coalesce_usecs; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
} else { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
adapter->itr = (1000000 / ec->rx_coalesce_usecs); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
adapter->itr_setting = adapter->itr & ~3; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
if (adapter->itr_setting != 0) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
ew32(ITR, 1000000000 / (adapter->itr * 256)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
else |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
ew32(ITR, 0); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
static int e1000_nway_reset(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
if (netif_running(netdev)) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
e1000e_reinit_locked(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
return 0; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
static void e1000_get_ethtool_stats(struct net_device *netdev, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
struct ethtool_stats *stats, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
u64 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
int i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
char *p = NULL; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
e1000e_update_stats(adapter); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
switch (e1000_gstrings_stats[i].type) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
case NETDEV_STATS: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
p = (char *) netdev + |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
e1000_gstrings_stats[i].stat_offset; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
case E1000_STATS: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
p = (char *) adapter + |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
e1000_gstrings_stats[i].stat_offset; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
data[i] = (e1000_gstrings_stats[i].sizeof_stat == |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
static void e1000_get_strings(struct net_device *netdev, u32 stringset, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
u8 *data) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
u8 *p = data; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
int i; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
switch (stringset) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
case ETH_SS_TEST: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
memcpy(data, *e1000_gstrings_test, sizeof(e1000_gstrings_test)); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
case ETH_SS_STATS: |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
memcpy(p, e1000_gstrings_stats[i].stat_string, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
ETH_GSTRING_LEN); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
p += ETH_GSTRING_LEN; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
break; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
} |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
static const struct ethtool_ops e1000_ethtool_ops = { |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
.get_settings = e1000_get_settings, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
.set_settings = e1000_set_settings, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
.get_drvinfo = e1000_get_drvinfo, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
.get_regs_len = e1000_get_regs_len, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
.get_regs = e1000_get_regs, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
.get_wol = e1000_get_wol, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
.set_wol = e1000_set_wol, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
.get_msglevel = e1000_get_msglevel, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
.set_msglevel = e1000_set_msglevel, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
.nway_reset = e1000_nway_reset, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
.get_link = e1000_get_link, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
.get_eeprom_len = e1000_get_eeprom_len, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
.get_eeprom = e1000_get_eeprom, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
.set_eeprom = e1000_set_eeprom, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
.get_ringparam = e1000_get_ringparam, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
.set_ringparam = e1000_set_ringparam, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
.get_pauseparam = e1000_get_pauseparam, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
.set_pauseparam = e1000_set_pauseparam, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
.get_rx_csum = e1000_get_rx_csum, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
.set_rx_csum = e1000_set_rx_csum, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
.get_tx_csum = e1000_get_tx_csum, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
.set_tx_csum = e1000_set_tx_csum, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
.get_sg = ethtool_op_get_sg, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
.set_sg = ethtool_op_set_sg, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
.get_tso = ethtool_op_get_tso, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
.set_tso = e1000_set_tso, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
.self_test = e1000_diag_test, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
.get_strings = e1000_get_strings, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
.phys_id = e1000_phys_id, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
.get_ethtool_stats = e1000_get_ethtool_stats, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
.get_sset_count = e1000e_get_sset_count, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
.get_coalesce = e1000_get_coalesce, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
.set_coalesce = e1000_set_coalesce, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
.get_flags = ethtool_op_get_flags, |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
}; |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
|
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
void e1000e_set_ethtool_ops(struct net_device *netdev) |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
{ |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops); |
f99b2249704c
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
} |