author | Florian Pose <fp@igh-essen.com> |
Tue, 05 Feb 2013 16:45:34 +0100 | |
branch | stable-1.5 |
changeset 2505 | 5ef3197e5e1f |
parent 2219 | d52848f0be04 |
permissions | -rw-r--r-- |
2219
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
Intel PRO/1000 Linux driver |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2010 Intel Corporation. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
d52848f0be04
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 |
d52848f0be04
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, |
d52848f0be04
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. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
|
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
more details. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
d52848f0be04
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 |
d52848f0be04
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., |
d52848f0be04
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. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
|
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
the file called "COPYING". |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
Contact Information: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Linux NICS <linux.nics@intel.com> |
d52848f0be04
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> |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
*******************************************************************************/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
/* ethtool support for e1000 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
#include <linux/netdevice.h> |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
#include <linux/ethtool.h> |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
#include <linux/pci.h> |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
#include <linux/slab.h> |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
#include <linux/delay.h> |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include "e1000.h" |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
enum {NETDEV_STATS, E1000_STATS}; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
struct e1000_stats { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
char stat_string[ETH_GSTRING_LEN]; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
int type; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
int sizeof_stat; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
int stat_offset; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
}; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
#define E1000_STAT(m) E1000_STATS, \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
sizeof(((struct e1000_adapter *)0)->m), \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
offsetof(struct e1000_adapter, m) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
#define E1000_NETDEV_STAT(m) NETDEV_STATS, \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
sizeof(((struct net_device *)0)->m), \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
offsetof(struct net_device, m) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
|
d52848f0be04
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[] = { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
{ "rx_packets", E1000_STAT(stats.gprc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
{ "tx_packets", E1000_STAT(stats.gptc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
{ "rx_bytes", E1000_STAT(stats.gorc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
{ "tx_bytes", E1000_STAT(stats.gotc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
{ "rx_broadcast", E1000_STAT(stats.bprc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
{ "tx_broadcast", E1000_STAT(stats.bptc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
{ "rx_multicast", E1000_STAT(stats.mprc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
{ "tx_multicast", E1000_STAT(stats.mptc) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
{ "multicast", E1000_STAT(stats.mprc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
{ "collisions", E1000_STAT(stats.colc) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
{ "rx_crc_errors", E1000_STAT(stats.crcerrs) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
{ "rx_missed_errors", E1000_STAT(stats.mpc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
{ "tx_aborted_errors", E1000_STAT(stats.ecol) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
{ "tx_carrier_errors", E1000_STAT(stats.tncrs) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
{ "tx_window_errors", E1000_STAT(stats.latecol) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
{ "tx_deferred_ok", E1000_STAT(stats.dc) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
{ "tx_restart_queue", E1000_STAT(restart_queue) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
{ "rx_align_errors", E1000_STAT(stats.algnerrc) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
{ "tx_smbus", E1000_STAT(stats.mgptc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
{ "rx_smbus", E1000_STAT(stats.mgprc) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
{ "dropped_smbus", E1000_STAT(stats.mgpdc) }, |
d52848f0be04
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) }, |
d52848f0be04
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) }, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
}; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
|
d52848f0be04
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) |
d52848f0be04
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) |
d52848f0be04
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] = { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
"Register test (offline)", "Eeprom test (offline)", |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
"Interrupt test (offline)", "Loopback test (offline)", |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
"Link test (on/offline)" |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
}; |
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
struct ethtool_cmd *ecmd) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
|
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
ecmd->supported = (SUPPORTED_10baseT_Half | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
SUPPORTED_10baseT_Full | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
SUPPORTED_100baseT_Half | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
SUPPORTED_100baseT_Full | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
SUPPORTED_1000baseT_Full | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
SUPPORTED_Autoneg | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
SUPPORTED_TP); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
if (hw->phy.type == e1000_phy_ife) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
ecmd->supported &= ~SUPPORTED_1000baseT_Full; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
ecmd->advertising = ADVERTISED_TP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
if (hw->mac.autoneg == 1) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
ecmd->advertising |= ADVERTISED_Autoneg; |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
ecmd->advertising |= hw->phy.autoneg_advertised; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
ecmd->port = PORT_TP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
ecmd->phy_address = hw->phy.addr; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
ecmd->transceiver = XCVR_INTERNAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
ecmd->supported = (SUPPORTED_1000baseT_Full | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
SUPPORTED_FIBRE | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
SUPPORTED_Autoneg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
ecmd->advertising = (ADVERTISED_1000baseT_Full | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
ADVERTISED_FIBRE | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
ADVERTISED_Autoneg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
ecmd->port = PORT_FIBRE; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
ecmd->transceiver = XCVR_EXTERNAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
ecmd->speed = -1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
ecmd->duplex = -1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
if (netif_running(netdev)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
if (netif_carrier_ok(netdev)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
ecmd->speed = adapter->link_speed; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
ecmd->duplex = adapter->link_duplex - 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
u32 status = er32(STATUS); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
if (status & E1000_STATUS_LU) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
if (status & E1000_STATUS_SPEED_1000) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
ecmd->speed = 1000; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
else if (status & E1000_STATUS_SPEED_100) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
ecmd->speed = 100; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
ecmd->speed = 10; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
if (status & E1000_STATUS_FD) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
ecmd->duplex = DUPLEX_FULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
ecmd->duplex = DUPLEX_HALF; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
|
d52848f0be04
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) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
/* MDI-X => 2; MDI =>1; Invalid =>0 */ |
d52848f0be04
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) && |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
netif_carrier_ok(netdev)) |
d52848f0be04
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 : |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
ETH_TP_MDI; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
else |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
/* |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
* Avoid touching hardware registers when possible, otherwise |
d52848f0be04
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 |
d52848f0be04
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. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
*/ |
d52848f0be04
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) : |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
!!(er32(STATUS) & E1000_STATUS_LU); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
{ |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
mac->autoneg = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
|
d52848f0be04
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 */ |
d52848f0be04
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) && |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
spddplx != (SPEED_1000 + DUPLEX_FULL)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
e_err("Unsupported Speed/Duplex configuration\n"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
switch (spddplx) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
case SPEED_10 + DUPLEX_HALF: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
mac->forced_speed_duplex = ADVERTISE_10_HALF; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
case SPEED_10 + DUPLEX_FULL: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
mac->forced_speed_duplex = ADVERTISE_10_FULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
case SPEED_100 + DUPLEX_HALF: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
mac->forced_speed_duplex = ADVERTISE_100_HALF; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
case SPEED_100 + DUPLEX_FULL: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
mac->forced_speed_duplex = ADVERTISE_100_FULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
case SPEED_1000 + DUPLEX_FULL: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
mac->autoneg = 1; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
case SPEED_1000 + DUPLEX_HALF: /* not supported */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
e_err("Unsupported Speed/Duplex configuration\n"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
struct ethtool_cmd *ecmd) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
* cannot be changed |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
if (e1000_check_reset_block(hw)) { |
d52848f0be04
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 " |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
"active.\n"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
|
d52848f0be04
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)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
msleep(1); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
hw->mac.autoneg = 1; |
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
ADVERTISED_FIBRE | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
ADVERTISED_Autoneg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
hw->phy.autoneg_advertised = ecmd->advertising | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
ADVERTISED_TP | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
ADVERTISED_Autoneg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
ecmd->advertising = hw->phy.autoneg_advertised; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
if (adapter->fc_autoneg) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
hw->fc.requested_mode = e1000_fc_default; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
} else { |
d52848f0be04
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)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
clear_bit(__E1000_RESETTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
/* reset the link */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
if (netif_running(adapter->netdev)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
e1000e_down(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
e1000e_up(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
clear_bit(__E1000_RESETTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
struct ethtool_pauseparam *pause) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
pause->autoneg = |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
(adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
|
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
pause->rx_pause = 1; |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
pause->tx_pause = 1; |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
pause->rx_pause = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
pause->tx_pause = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
struct ethtool_pauseparam *pause) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
int retval = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
adapter->fc_autoneg = pause->autoneg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
|
d52848f0be04
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)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
msleep(1); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
if (adapter->fc_autoneg == AUTONEG_ENABLE) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
hw->fc.requested_mode = e1000_fc_default; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
if (netif_running(adapter->netdev)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
e1000e_down(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
e1000e_up(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
if (pause->rx_pause && pause->tx_pause) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
hw->fc.requested_mode = e1000_fc_full; |
d52848f0be04
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) |
d52848f0be04
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; |
d52848f0be04
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) |
d52848f0be04
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; |
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
hw->fc.requested_mode = e1000_fc_none; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
|
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
|
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
retval = hw->mac.ops.setup_link(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
/* implicit goto out */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
retval = e1000e_force_mac_fc(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
if (retval) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
goto out; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
e1000e_set_fc_watermarks(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
out: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
clear_bit(__E1000_RESETTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
return retval; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
return adapter->flags & FLAG_RX_CSUM_ENABLED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
if (data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
adapter->flags |= FLAG_RX_CSUM_ENABLED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
adapter->flags &= ~FLAG_RX_CSUM_ENABLED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
if (netif_running(netdev)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
e1000e_reinit_locked(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
{ |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
if (data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
netdev->features |= NETIF_F_HW_CSUM; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
netdev->features &= ~NETIF_F_HW_CSUM; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
if (data) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
netdev->features |= NETIF_F_TSO; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
netdev->features |= NETIF_F_TSO6; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
netdev->features &= ~NETIF_F_TSO; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
netdev->features &= ~NETIF_F_TSO6; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
adapter->flags |= FLAG_TSO_FORCE; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
return adapter->msg_enable; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
adapter->msg_enable = data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
#define E1000_REGS_LEN 32 /* overestimate */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
return E1000_REGS_LEN * sizeof(u32); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
struct ethtool_regs *regs, void *p) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
u32 *regs_buff = p; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
u16 phy_data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
u8 revision_id; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
|
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
regs_buff[0] = er32(CTRL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
regs_buff[1] = er32(STATUS); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
regs_buff[2] = er32(RCTL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
regs_buff[3] = er32(RDLEN); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
regs_buff[4] = er32(RDH); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
regs_buff[5] = er32(RDT); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
regs_buff[6] = er32(RDTR); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
regs_buff[7] = er32(TCTL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
regs_buff[8] = er32(TDLEN); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
regs_buff[9] = er32(TDH); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
regs_buff[10] = er32(TDT); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
regs_buff[11] = er32(TIDV); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
|
d52848f0be04
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) */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
|
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
* exist */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
if (hw->phy.type == e1000_phy_m88) { |
d52848f0be04
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); |
d52848f0be04
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 */ |
d52848f0be04
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) */ |
d52848f0be04
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) */ |
d52848f0be04
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) */ |
d52848f0be04
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); |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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) */ |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
/* phy receive errors */ |
d52848f0be04
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; |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
regs_buff[21] = 0; /* was idle_errors */ |
d52848f0be04
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); |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
return adapter->hw.nvm.word_size * 2; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
struct ethtool_eeprom *eeprom, u8 *bytes) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
u16 *eeprom_buff; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
int first_word; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
int last_word; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
int ret_val = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
u16 i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
if (eeprom->len == 0) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
first_word = eeprom->offset >> 1; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
eeprom_buff = kmalloc(sizeof(u16) * |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
(last_word - first_word + 1), GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
if (!eeprom_buff) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
return -ENOMEM; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
|
d52848f0be04
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) { |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
last_word - first_word + 1, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
eeprom_buff); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
} else { |
d52848f0be04
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++) { |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
&eeprom_buff[i]); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
if (ret_val) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
if (ret_val) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
memset(eeprom_buff, 0xff, sizeof(u16) * |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
(last_word - first_word + 1)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
} else { |
d52848f0be04
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 */ |
d52848f0be04
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++) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
le16_to_cpus(&eeprom_buff[i]); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
kfree(eeprom_buff); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
return ret_val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
struct ethtool_eeprom *eeprom, u8 *bytes) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
u16 *eeprom_buff; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
void *ptr; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
int max_len; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
int first_word; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
int last_word; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
int ret_val = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
u16 i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
if (eeprom->len == 0) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
return -EOPNOTSUPP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
|
d52848f0be04
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))) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
return -EFAULT; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
if (adapter->flags & FLAG_READ_ONLY_NVM) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
max_len = hw->nvm.word_size * 2; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
first_word = eeprom->offset >> 1; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
eeprom_buff = kmalloc(max_len, GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
if (!eeprom_buff) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
return -ENOMEM; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
ptr = (void *)eeprom_buff; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
if (eeprom->offset & 1) { |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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]); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
ptr++; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
} |
d52848f0be04
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)) |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
&eeprom_buff[last_word - first_word]); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
if (ret_val) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
goto out; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
|
d52848f0be04
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 */ |
d52848f0be04
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++) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
le16_to_cpus(&eeprom_buff[i]); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
memcpy(ptr, bytes, eeprom->len); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
|
d52848f0be04
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++) |
d52848f0be04
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]); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
last_word - first_word + 1, eeprom_buff); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
if (ret_val) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
goto out; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
* and flush shadow RAM for applicable controllers |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
if ((first_word <= NVM_CHECKSUM_REG) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
(hw->mac.type == e1000_82583) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
(hw->mac.type == e1000_82574) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
(hw->mac.type == e1000_82573)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
ret_val = e1000e_update_nvm_checksum(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
out: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
kfree(eeprom_buff); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
return ret_val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
struct ethtool_drvinfo *drvinfo) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
char firmware_version[32]; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
strncpy(drvinfo->driver, e1000e_driver_name, 32); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
strncpy(drvinfo->version, e1000e_driver_version, 32); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
* PCI-E controllers |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
sprintf(firmware_version, "%d.%d-%d", |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
(adapter->eeprom_vers & 0xF000) >> 12, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
(adapter->eeprom_vers & 0x0FF0) >> 4, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
(adapter->eeprom_vers & 0x000F)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
strncpy(drvinfo->fw_version, firmware_version, 32); |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
struct ethtool_ringparam *ring) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
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; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
ring->rx_max_pending = E1000_MAX_RXD; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
ring->tx_max_pending = E1000_MAX_TXD; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
ring->rx_mini_max_pending = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
ring->rx_jumbo_max_pending = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
ring->rx_pending = rx_ring->count; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
ring->tx_pending = tx_ring->count; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
ring->rx_mini_pending = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
ring->rx_jumbo_pending = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
struct ethtool_ringparam *ring) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
struct e1000_ring *tx_ring, *tx_old; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
struct e1000_ring *rx_ring, *rx_old; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
int err; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
|
d52848f0be04
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)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
|
d52848f0be04
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)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
msleep(1); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
if (netif_running(adapter->netdev)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
e1000e_down(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
tx_old = adapter->tx_ring; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
rx_old = adapter->rx_ring; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
err = -ENOMEM; |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
if (!tx_ring) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
goto err_alloc_tx; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
/* |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
* reinitialized |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
*/ |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
if (!rx_ring) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
goto err_alloc_rx; |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
adapter->tx_ring = tx_ring; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
adapter->rx_ring = rx_ring; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
|
d52848f0be04
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); |
d52848f0be04
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)); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
|
d52848f0be04
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); |
d52848f0be04
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)); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
if (netif_running(adapter->netdev)) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
err = e1000e_setup_rx_resources(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
if (err) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
goto err_setup_rx; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
err = e1000e_setup_tx_resources(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
if (err) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
goto err_setup_tx; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
/* |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
* then add in the new |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
adapter->rx_ring = rx_old; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
adapter->tx_ring = tx_old; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
e1000e_free_rx_resources(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
e1000e_free_tx_resources(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
kfree(tx_old); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
kfree(rx_old); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
adapter->rx_ring = rx_ring; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
adapter->tx_ring = tx_ring; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
err = e1000e_up(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
if (err) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
goto err_setup; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
clear_bit(__E1000_RESETTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
err_setup_tx: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
e1000e_free_rx_resources(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
err_setup_rx: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
adapter->rx_ring = rx_old; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
adapter->tx_ring = tx_old; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
kfree(rx_ring); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
err_alloc_rx: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
kfree(tx_ring); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
err_alloc_tx: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
e1000e_up(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
err_setup: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
clear_bit(__E1000_RESETTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
return err; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
|
d52848f0be04
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, |
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
u32 pat, val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
static const u32 test[] = |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
{0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; |
d52848f0be04
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++) { |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
(test[pat] & write)); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
if (val != (test[pat] & write & mask)) { |
d52848f0be04
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 " |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
"expected 0x%08X\n", reg + offset, val, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
(test[pat] & write & mask)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
*data = reg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
return 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
int reg, u32 mask, u32 write) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
u32 val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
__ew32(&adapter->hw, reg, write & mask); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
val = __er32(&adapter->hw, reg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
if ((write & mask) != (val & mask)) { |
d52848f0be04
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 " |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
*data = reg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
return 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
} |
d52848f0be04
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) \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
do { \ |
d52848f0be04
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)) \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
return 1; \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
} while (0) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
#define REG_PATTERN_TEST(reg, mask, write) \ |
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
|
d52848f0be04
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) \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
do { \ |
d52848f0be04
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)) \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
return 1; \ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
} while (0) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
u32 value; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
u32 before; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
u32 after; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
u32 i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
u32 toggle; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
u32 mask; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
/* |
d52848f0be04
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. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
* Some bits that get toggled are ignored. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
switch (mac->type) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
case e1000_82571: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
case e1000_82572: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
case e1000_80003es2lan: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
toggle = 0x7FFFF3FF; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
toggle = 0x7FFFF033; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
before = er32(STATUS); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
value = (er32(STATUS) & toggle); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
ew32(STATUS, toggle); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
after = er32(STATUS) & toggle; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
if (value != after) { |
d52848f0be04
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: " |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
"0x%08X\n", after, value); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
*data = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
return 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
/* restore previous status */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
ew32(STATUS, before); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
if (!(adapter->flags & FLAG_IS_ICH)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
REG_PATTERN_TEST(E1000_FCAL, 0xFFFFFFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
REG_PATTERN_TEST(E1000_FCAH, 0x0000FFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
REG_PATTERN_TEST(E1000_FCT, 0x0000FFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
REG_PATTERN_TEST(E1000_VET, 0x0000FFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
REG_PATTERN_TEST(E1000_RDTR, 0x0000FFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
REG_PATTERN_TEST(E1000_RDBAH, 0xFFFFFFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
REG_PATTERN_TEST(E1000_RDLEN, 0x000FFF80, 0x000FFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
REG_PATTERN_TEST(E1000_RDH, 0x0000FFFF, 0x0000FFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
REG_PATTERN_TEST(E1000_RDT, 0x0000FFFF, 0x0000FFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
REG_PATTERN_TEST(E1000_FCRTH, 0x0000FFF8, 0x0000FFF8); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
REG_PATTERN_TEST(E1000_FCTTV, 0x0000FFFF, 0x0000FFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
REG_PATTERN_TEST(E1000_TIPG, 0x3FFFFFFF, 0x3FFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
REG_PATTERN_TEST(E1000_TDBAH, 0xFFFFFFFF, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
REG_PATTERN_TEST(E1000_TDLEN, 0x000FFF80, 0x000FFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
|
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
REG_PATTERN_TEST(E1000_RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
if (!(adapter->flags & FLAG_IS_ICH)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
REG_PATTERN_TEST(E1000_TXCW, 0xC000FFFF, 0x0000FFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
REG_PATTERN_TEST(E1000_TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
REG_PATTERN_TEST(E1000_TIDV, 0x0000FFFF, 0x0000FFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
mask = 0x8003FFFF; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
switch (mac->type) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
case e1000_ich10lan: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
case e1000_pchlan: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
case e1000_pch2lan: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
mask |= (1 << 18); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
} |
d52848f0be04
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++) |
d52848f0be04
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), |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
mask, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
|
d52848f0be04
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++) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
*data = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
u16 temp; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
u16 checksum = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
u16 i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
*data = 0; |
d52848f0be04
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 */ |
d52848f0be04
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++) { |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
*data = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
return *data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
checksum += temp; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
|
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
if ((checksum != (u16) NVM_SUM) && !(*data)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
*data = 2; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
return *data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
{ |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
adapter->test_icr |= er32(ICR); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
return IRQ_HANDLED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
struct net_device *netdev = adapter->netdev; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
u32 mask; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
u32 shared_int = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
u32 irq = adapter->pdev->irq; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
int i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
int ret_val = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
int int_mode = E1000E_INT_MODE_LEGACY; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
*data = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
|
d52848f0be04
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 */ |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
int_mode = adapter->int_mode; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
e1000e_reset_interrupt_capability(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
adapter->int_mode = E1000E_INT_MODE_LEGACY; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
e1000e_set_interrupt_capability(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
} |
d52848f0be04
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 */ |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
netdev)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
shared_int = 0; |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
netdev->name, netdev)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
*data = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
ret_val = -1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
goto out; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
} |
d52848f0be04
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")); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
/* Disable all the interrupts */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
ew32(IMC, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
/* Test each interrupt */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
for (i = 0; i < 10; i++) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
/* Interrupt to test */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
mask = 1 << i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
if (adapter->flags & FLAG_IS_ICH) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
switch (mask) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
case E1000_ICR_RXSEQ: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
continue; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
case 0x00000100: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
if (adapter->hw.mac.type == e1000_ich8lan || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
adapter->hw.mac.type == e1000_ich9lan) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
continue; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
if (!shared_int) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
/* |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
* Disable the interrupt to be reported in |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
* test failed. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
adapter->test_icr = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
ew32(IMC, mask); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
ew32(ICS, mask); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
if (adapter->test_icr & mask) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
*data = 3; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
/* |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
* Enable the interrupt to be reported in |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
* test failed. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
adapter->test_icr = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
ew32(IMS, mask); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
ew32(ICS, mask); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
if (!(adapter->test_icr & mask)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
*data = 4; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
if (!shared_int) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
/* |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
* test failed. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
adapter->test_icr = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
ew32(IMC, ~mask & 0x00007FFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
ew32(ICS, ~mask & 0x00007FFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
if (adapter->test_icr) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
*data = 5; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
/* Disable all the interrupts */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
ew32(IMC, 0xFFFFFFFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
/* Unhook test interrupt handler */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
free_irq(irq, netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
out: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
if (int_mode == E1000E_INT_MODE_MSIX) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
e1000e_reset_interrupt_capability(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
adapter->int_mode = int_mode; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
e1000e_set_interrupt_capability(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
return ret_val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
{ |
d52848f0be04
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; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
struct pci_dev *pdev = adapter->pdev; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
int i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
|
d52848f0be04
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) { |
d52848f0be04
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++) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
if (tx_ring->buffer_info[i].dma) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
dma_unmap_single(&pdev->dev, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
tx_ring->buffer_info[i].dma, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
tx_ring->buffer_info[i].length, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
DMA_TO_DEVICE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
if (tx_ring->buffer_info[i].skb) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
|
d52848f0be04
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) { |
d52848f0be04
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++) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
if (rx_ring->buffer_info[i].dma) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
dma_unmap_single(&pdev->dev, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
rx_ring->buffer_info[i].dma, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
2048, DMA_FROM_DEVICE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
if (rx_ring->buffer_info[i].skb) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
if (tx_ring->desc) { |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
tx_ring->dma); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
tx_ring->desc = NULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
if (rx_ring->desc) { |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
rx_ring->dma); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
rx_ring->desc = NULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
kfree(tx_ring->buffer_info); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
tx_ring->buffer_info = NULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
kfree(rx_ring->buffer_info); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
rx_ring->buffer_info = NULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
{ |
d52848f0be04
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; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
struct pci_dev *pdev = adapter->pdev; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
u32 rctl; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
int i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
int ret_val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
/* Setup Tx descriptor ring and Tx buffers */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
if (!tx_ring->count) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
tx_ring->count = E1000_DEFAULT_TXD; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
sizeof(struct e1000_buffer), |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
if (!(tx_ring->buffer_info)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
ret_val = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
|
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
&tx_ring->dma, GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
if (!tx_ring->desc) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
ret_val = 2; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
tx_ring->next_to_use = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
tx_ring->next_to_clean = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
ew32(TDBAL, ((u64) tx_ring->dma & 0x00000000FFFFFFFF)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
ew32(TDBAH, ((u64) tx_ring->dma >> 32)); |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
ew32(TDH, 0); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
ew32(TDT, 0); |
d52848f0be04
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 | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
|
d52848f0be04
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++) { |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
struct sk_buff *skb; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
unsigned int skb_size = 1024; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
skb = alloc_skb(skb_size, GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
if (!skb) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
ret_val = 3; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
skb_put(skb, skb_size); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
tx_ring->buffer_info[i].skb = skb; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
tx_ring->buffer_info[i].dma = |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
DMA_TO_DEVICE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
if (dma_mapping_error(&pdev->dev, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
tx_ring->buffer_info[i].dma)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
ret_val = 4; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
} |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
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 | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
E1000_TXD_CMD_IFCS | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
E1000_TXD_CMD_RS); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
tx_desc->upper.data = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
/* Setup Rx descriptor ring and Rx buffers */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
if (!rx_ring->count) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
rx_ring->count = E1000_DEFAULT_RXD; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
sizeof(struct e1000_buffer), |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
if (!(rx_ring->buffer_info)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
ret_val = 5; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
|
d52848f0be04
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); |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
&rx_ring->dma, GFP_KERNEL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
if (!rx_ring->desc) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
ret_val = 6; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
rx_ring->next_to_use = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
rx_ring->next_to_clean = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
rctl = er32(RCTL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
ew32(RCTL, rctl & ~E1000_RCTL_EN); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
ew32(RDBAL, ((u64) rx_ring->dma & 0xFFFFFFFF)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
ew32(RDBAH, ((u64) rx_ring->dma >> 32)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
ew32(RDLEN, rx_ring->size); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
ew32(RDH, 0); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
ew32(RDT, 0); |
d52848f0be04
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 | |
d52848f0be04
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 | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
E1000_RCTL_SBP | E1000_RCTL_SECRC | |
d52848f0be04
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 | |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
ew32(RCTL, rctl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
|
d52848f0be04
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++) { |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
struct sk_buff *skb; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
if (!skb) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
ret_val = 7; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
skb_reserve(skb, NET_IP_ALIGN); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
rx_ring->buffer_info[i].skb = skb; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
rx_ring->buffer_info[i].dma = |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
DMA_FROM_DEVICE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
if (dma_mapping_error(&pdev->dev, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
rx_ring->buffer_info[i].dma)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
ret_val = 8; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
goto err_nomem; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
rx_desc->buffer_addr = |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
memset(skb->data, 0x00, skb->len); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
err_nomem: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
e1000_free_desc_rings(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
return ret_val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
{ |
d52848f0be04
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. */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
e1e_wphy(&adapter->hw, 29, 0x001F); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
e1e_wphy(&adapter->hw, 30, 0x8FFC); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
e1e_wphy(&adapter->hw, 29, 0x001A); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
e1e_wphy(&adapter->hw, 30, 0x8FF0); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
u32 ctrl_reg = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
u32 stat_reg = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
u16 phy_reg = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
hw->mac.autoneg = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
if (hw->phy.type == e1000_phy_ife) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
/* force 100, set loopback */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
e1e_wphy(hw, PHY_CONTROL, 0x6100); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
|
d52848f0be04
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. */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
ctrl_reg = er32(CTRL); |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
E1000_CTRL_FD); /* Force Duplex to FULL */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
ew32(CTRL, ctrl_reg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
udelay(500); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
/* Specific PHY configuration for loopback */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
switch (hw->phy.type) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
case e1000_phy_m88: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
/* Auto-MDI/MDIX Off */ |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
/* reset to update Auto-MDI/MDIX */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
e1e_wphy(hw, PHY_CONTROL, 0x9140); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
/* autoneg off */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
e1e_wphy(hw, PHY_CONTROL, 0x8140); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
case e1000_phy_gg82563: |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
case e1000_phy_bm: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
/* Set Default MAC Interface speed to 1GB */ |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
phy_reg &= ~0x0007; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
phy_reg |= 0x006; |
d52848f0be04
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); |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
e1000e_commit_phy(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
mdelay(1); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
/* Force Full Duplex */ |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
/* Set Link Up (in force link) */ |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
/* Force Link */ |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
/* Set Early Link Enable */ |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
case e1000_phy_82577: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
case e1000_phy_82578: |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
e1000_configure_k1_ich8lan(hw, false); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
case e1000_phy_82579: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
/* Disable PHY energy detect power down */ |
d52848f0be04
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); |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
/* Disable full chip energy detect */ |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
/* Enable loopback on the PHY */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
#define I82577_PHY_LBK_CTRL 19 |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
/* force 1000, set loopback */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
e1e_wphy(hw, PHY_CONTROL, 0x4140); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
mdelay(250); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
|
d52848f0be04
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. */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
ctrl_reg = er32(CTRL); |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
E1000_CTRL_FD); /* Force Duplex to FULL */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
if (adapter->flags & FLAG_IS_ICH) |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
|
d52848f0be04
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 && |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
hw->phy.type == e1000_phy_m88) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
* detected. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
stat_reg = er32(STATUS); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
if ((stat_reg & E1000_STATUS_FD) == 0) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
ew32(CTRL, ctrl_reg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
/* |
d52848f0be04
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 |
d52848f0be04
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. |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
if (hw->phy.type == e1000_phy_m88) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
e1000_phy_disable_receiver(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
udelay(500); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
u32 ctrl = er32(CTRL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
int link = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
/* special requirements for 82571/82572 fiber adapters */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
* link is hardwired up |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
ctrl |= E1000_CTRL_SLU; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
ew32(CTRL, ctrl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
/* disable autoneg */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
ctrl = er32(TXCW); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
ctrl &= ~(1 << 31); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
ew32(TXCW, ctrl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
link = (er32(STATUS) & E1000_STATUS_LU); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
if (!link) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
/* set invert loss of signal */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
ctrl = er32(CTRL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
ctrl |= E1000_CTRL_ILOS; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
ew32(CTRL, ctrl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
* loopback |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
#define E1000_SERDES_LB_ON 0x410 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
ew32(SCTL, E1000_SERDES_LB_ON); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
|
d52848f0be04
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 */ |
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
u32 ctrlext = er32(CTRL_EXT); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
u32 ctrl = er32(CTRL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
* on mac_type 80003es2lan) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
adapter->tx_fifo_head = ctrlext; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
|
d52848f0be04
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 */ |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
ew32(CTRL_EXT, ctrlext); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
/* force speed to 1000/FD, link up */ |
d52848f0be04
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); |
d52848f0be04
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 | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
E1000_CTRL_SPD_1000 | E1000_CTRL_FD); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
ew32(CTRL, ctrl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
/* set mac loopback */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
ctrl = er32(RCTL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
ctrl |= E1000_RCTL_LBM_MAC; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
ew32(RCTL, ctrl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
|
d52848f0be04
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) */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
#define KMRNCTRLSTA_OPMODE (0x1F << 16) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
#define KMRNCTRLSTA_OPMODE_1GB_FD_GMII 0x0582 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
ew32(KMRNCTRLSTA, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
(KMRNCTRLSTA_OPMODE | KMRNCTRLSTA_OPMODE_1GB_FD_GMII)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
u32 rctl; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
|
d52848f0be04
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 || |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
switch (hw->mac.type) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
case e1000_80003es2lan: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
return e1000_set_es2lan_mac_loopback(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
case e1000_82571: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
case e1000_82572: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
return e1000_set_82571_fiber_loopback(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
rctl = er32(RCTL); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
rctl |= E1000_RCTL_LBM_TCVR; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
ew32(RCTL, rctl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
} |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
return e1000_integrated_phy_loopback(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
return 7; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
u32 rctl; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
u16 phy_reg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
rctl = er32(RCTL); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
ew32(RCTL, rctl); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
switch (hw->mac.type) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
case e1000_80003es2lan: |
d52848f0be04
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 || |
d52848f0be04
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) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
ew32(CTRL_EXT, adapter->tx_fifo_head); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
adapter->tx_fifo_head = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
/* fall through */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
case e1000_82571: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
case e1000_82572: |
d52848f0be04
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 || |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
#define E1000_SERDES_LB_OFF 0x400 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
ew32(SCTL, E1000_SERDES_LB_OFF); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
msleep(10); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
/* Fall Through */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
hw->mac.autoneg = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
if (hw->phy.type == e1000_phy_gg82563) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
e1e_rphy(hw, PHY_CONTROL, &phy_reg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
if (phy_reg & MII_CR_LOOPBACK) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
phy_reg &= ~MII_CR_LOOPBACK; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
e1e_wphy(hw, PHY_CONTROL, phy_reg); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
e1000e_commit_phy(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
unsigned int frame_size) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
memset(skb->data, 0xFF, frame_size); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
frame_size &= ~1; |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
unsigned int frame_size) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
frame_size &= ~1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
if (*(skb->data + 3) == 0xFF) |
d52848f0be04
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) && |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
(*(skb->data + frame_size / 2 + 12) == 0xAF)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
return 13; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
{ |
d52848f0be04
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; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
struct pci_dev *pdev = adapter->pdev; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
int i, j, k, l; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
int lc; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
int good_cnt; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
int ret_val = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
unsigned long time; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
ew32(RDT, rx_ring->count - 1); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
/* |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
* send/receive pairs during each loop |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
if (rx_ring->count <= tx_ring->count) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
lc = ((tx_ring->count / 64) * 2) + 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
lc = ((rx_ring->count / 64) * 2) + 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
k = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
l = 0; |
d52848f0be04
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 */ |
d52848f0be04
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 */ |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
1024); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
dma_sync_single_for_device(&pdev->dev, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
tx_ring->buffer_info[k].dma, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
tx_ring->buffer_info[k].length, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
DMA_TO_DEVICE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
k++; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
if (k == tx_ring->count) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
k = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
ew32(TDT, k); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
msleep(200); |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
good_cnt = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
do { /* receive the sent packets */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
dma_sync_single_for_cpu(&pdev->dev, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
rx_ring->buffer_info[l].dma, 2048, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
DMA_FROM_DEVICE); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
ret_val = e1000_check_lbtest_frame( |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
rx_ring->buffer_info[l].skb, 1024); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
if (!ret_val) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
good_cnt++; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
l++; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
if (l == rx_ring->count) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
l = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
/* |
d52848f0be04
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 |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
* exceeded, break and error off |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
*/ |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
if (good_cnt != 64) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
if (jiffies >= (time + 20)) { |
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
} /* end loop count loop */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
return ret_val; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
/* |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
* sessions are active |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
if (e1000_check_reset_block(&adapter->hw)) { |
d52848f0be04
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"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
*data = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
goto out; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
*data = e1000_setup_desc_rings(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
if (*data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
goto out; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
*data = e1000_setup_loopback_test(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
if (*data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
goto err_loopback; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
*data = e1000_run_loopback_test(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
e1000_loopback_cleanup(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
err_loopback: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
e1000_free_desc_rings(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
out: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
return *data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
*data = 0; |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
int i = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
hw->mac.serdes_has_link = false; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
/* |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
* On some blade server designs, link establishment |
d52848f0be04
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 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
*/ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
do { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
hw->mac.ops.check_for_link(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
if (hw->mac.serdes_has_link) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
return *data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
msleep(20); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
} while (i++ < 3750); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
*data = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
hw->mac.ops.check_for_link(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
if (hw->mac.autoneg) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
msleep(4000); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
if (!(er32(STATUS) & |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
E1000_STATUS_LU)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
*data = 1; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
return *data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
switch (sset) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
case ETH_SS_TEST: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
return E1000_TEST_LEN; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
case ETH_SS_STATS: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
return E1000_STATS_LEN; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
default: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
return -EOPNOTSUPP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
struct ethtool_test *eth_test, u64 *data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
u16 autoneg_advertised; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
u8 forced_speed_duplex; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
u8 autoneg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
bool if_running = netif_running(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
set_bit(__E1000_TESTING, &adapter->state); |
d52848f0be04
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) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
/* Offline tests */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
/* save speed, duplex, autoneg settings */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
autoneg_advertised = adapter->hw.phy.autoneg_advertised; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
autoneg = adapter->hw.mac.autoneg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
e_info("offline testing starting\n"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
if (if_running) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
/* indicate we're in test mode */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
dev_close(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
if (e1000_reg_test(adapter, &data[0])) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
if (e1000_eeprom_test(adapter, &data[1])) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
if (e1000_intr_test(adapter, &data[2])) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
/* make sure the phy is powered up */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
e1000e_power_up_phy(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
if (e1000_loopback_test(adapter, &data[3])) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
|
d52848f0be04
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 */ |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
e1000e_reset(adapter); |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
if (e1000_link_test(adapter, &data[4])) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
/* restore speed, duplex, autoneg settings */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
adapter->hw.phy.autoneg_advertised = autoneg_advertised; |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
adapter->hw.mac.autoneg = autoneg; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
e1000e_reset(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
clear_bit(__E1000_TESTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
if (if_running) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
dev_open(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
} else { |
d52848f0be04
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)) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
clear_bit(__E1000_TESTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
dev_open(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
set_bit(__E1000_TESTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
e_info("online testing starting\n"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
/* Online tests */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
if (e1000_link_test(adapter, &data[4])) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
|
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
data[0] = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
data[1] = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
data[2] = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
data[3] = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
|
d52848f0be04
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)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
dev_close(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
clear_bit(__E1000_TESTING, &adapter->state); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
msleep_interruptible(4 * 1000); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
struct ethtool_wolinfo *wol) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
wol->supported = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
wol->wolopts = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
if (!(adapter->flags & FLAG_HAS_WOL) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
!device_can_wakeup(&adapter->pdev->dev)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
return; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
wol->supported = WAKE_UCAST | WAKE_MCAST | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
WAKE_BCAST | WAKE_MAGIC | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
WAKE_PHY | WAKE_ARP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
/* apply any specific unsupported masks here */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
if (adapter->flags & FLAG_NO_WAKE_UCAST) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
wol->supported &= ~WAKE_UCAST; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
if (adapter->wol & E1000_WUFC_EX) |
d52848f0be04
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) " |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
"frame wake-up packets\n"); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
if (adapter->wol & E1000_WUFC_EX) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
wol->wolopts |= WAKE_UCAST; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
if (adapter->wol & E1000_WUFC_MC) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
wol->wolopts |= WAKE_MCAST; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
if (adapter->wol & E1000_WUFC_BC) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
wol->wolopts |= WAKE_BCAST; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
if (adapter->wol & E1000_WUFC_MAG) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
wol->wolopts |= WAKE_MAGIC; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
if (adapter->wol & E1000_WUFC_LNKC) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
wol->wolopts |= WAKE_PHY; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
if (adapter->wol & E1000_WUFC_ARP) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
wol->wolopts |= WAKE_ARP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
struct ethtool_wolinfo *wol) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
if (!(adapter->flags & FLAG_HAS_WOL) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
!device_can_wakeup(&adapter->pdev->dev) || |
d52848f0be04
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 | |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
WAKE_MAGIC | WAKE_PHY | WAKE_ARP))) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
return -EOPNOTSUPP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
|
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
adapter->wol = 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
if (wol->wolopts & WAKE_UCAST) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
adapter->wol |= E1000_WUFC_EX; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
if (wol->wolopts & WAKE_MCAST) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
adapter->wol |= E1000_WUFC_MC; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
if (wol->wolopts & WAKE_BCAST) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
adapter->wol |= E1000_WUFC_BC; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
if (wol->wolopts & WAKE_MAGIC) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
adapter->wol |= E1000_WUFC_MAG; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
if (wol->wolopts & WAKE_PHY) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
adapter->wol |= E1000_WUFC_LNKC; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
if (wol->wolopts & WAKE_ARP) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
adapter->wol |= E1000_WUFC_ARP; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
|
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
|
d52848f0be04
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 */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
#define E1000_ID_INTERVAL (HZ/4) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
/* bit defines for adapter->led_status */ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
#define E1000_LED_ON 0 |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
struct e1000_adapter *adapter = container_of(work, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
struct e1000_adapter, led_blink_task); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
|
d52848f0be04
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)) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
else |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
{ |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
schedule_work(&adapter->led_blink_task); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
if (!data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
data = INT_MAX; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
if ((hw->phy.type == e1000_phy_ife) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
(hw->mac.type == e1000_pchlan) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
(hw->mac.type == e1000_pch2lan) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
(hw->mac.type == e1000_82583) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
(hw->mac.type == e1000_82574)) { |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
if (!adapter->blink_timer.function) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
init_timer(&adapter->blink_timer); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
adapter->blink_timer.function = |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
e1000_led_blink_callback; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
adapter->blink_timer.data = (unsigned long) adapter; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
mod_timer(&adapter->blink_timer, jiffies); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
msleep_interruptible(data * 1000); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
del_timer_sync(&adapter->blink_timer); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
if (hw->phy.type == e1000_phy_ife) |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
e1000e_blink_led(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
msleep_interruptible(data * 1000); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
hw->mac.ops.led_off(hw); |
d52848f0be04
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); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
hw->mac.ops.cleanup_led(hw); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
struct ethtool_coalesce *ec) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
if (adapter->itr_setting <= 4) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
ec->rx_coalesce_usecs = adapter->itr_setting; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
else |
d52848f0be04
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; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
struct ethtool_coalesce *ec) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
struct e1000_hw *hw = &adapter->hw; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
|
d52848f0be04
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) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
((ec->rx_coalesce_usecs > 4) && |
d52848f0be04
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)) || |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
(ec->rx_coalesce_usecs == 2)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
return -EINVAL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
if (ec->rx_coalesce_usecs == 4) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
adapter->itr = adapter->itr_setting = 4; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
} else if (ec->rx_coalesce_usecs <= 3) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
adapter->itr = 20000; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
adapter->itr_setting = ec->rx_coalesce_usecs; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
} else { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
adapter->itr = (1000000 / ec->rx_coalesce_usecs); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
adapter->itr_setting = adapter->itr & ~3; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
if (adapter->itr_setting != 0) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
ew32(ITR, 1000000000 / (adapter->itr * 256)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
else |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
ew32(ITR, 0); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
if (netif_running(netdev)) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
e1000e_reinit_locked(adapter); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
return 0; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
struct ethtool_stats *stats, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
u64 *data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
int i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
char *p = NULL; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
e1000e_update_stats(adapter); |
d52848f0be04
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++) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
switch (e1000_gstrings_stats[i].type) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
case NETDEV_STATS: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
p = (char *) netdev + |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
e1000_gstrings_stats[i].stat_offset; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
case E1000_STATS: |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
p = (char *) adapter + |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
e1000_gstrings_stats[i].stat_offset; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
|
d52848f0be04
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 == |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
|
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
u8 *data) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
u8 *p = data; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
int i; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
|
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
switch (stringset) { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
case ETH_SS_TEST: |
d52848f0be04
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)); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
case ETH_SS_STATS: |
d52848f0be04
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++) { |
d52848f0be04
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, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
ETH_GSTRING_LEN); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
p += ETH_GSTRING_LEN; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
break; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
} |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
|
d52848f0be04
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 = { |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
.get_settings = e1000_get_settings, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
.set_settings = e1000_set_settings, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
.get_drvinfo = e1000_get_drvinfo, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
.get_regs_len = e1000_get_regs_len, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
.get_regs = e1000_get_regs, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
.get_wol = e1000_get_wol, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
.set_wol = e1000_set_wol, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
.get_msglevel = e1000_get_msglevel, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
.set_msglevel = e1000_set_msglevel, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
.nway_reset = e1000_nway_reset, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
.get_link = e1000_get_link, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
.get_eeprom_len = e1000_get_eeprom_len, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
.get_eeprom = e1000_get_eeprom, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
.set_eeprom = e1000_set_eeprom, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
.get_ringparam = e1000_get_ringparam, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
.set_ringparam = e1000_set_ringparam, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
.get_pauseparam = e1000_get_pauseparam, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
.set_pauseparam = e1000_set_pauseparam, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
.get_rx_csum = e1000_get_rx_csum, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
.set_rx_csum = e1000_set_rx_csum, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
.get_tx_csum = e1000_get_tx_csum, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
.set_tx_csum = e1000_set_tx_csum, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
.get_sg = ethtool_op_get_sg, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
.set_sg = ethtool_op_set_sg, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
.get_tso = ethtool_op_get_tso, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
.set_tso = e1000_set_tso, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
.self_test = e1000_diag_test, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
.get_strings = e1000_get_strings, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
.phys_id = e1000_phys_id, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
.get_ethtool_stats = e1000_get_ethtool_stats, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
.get_sset_count = e1000e_get_sset_count, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
.get_coalesce = e1000_get_coalesce, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
.set_coalesce = e1000_set_coalesce, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
.get_flags = ethtool_op_get_flags, |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
}; |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
|
d52848f0be04
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) |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
{ |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops); |
d52848f0be04
Added e1000e driver for 2.6.37.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
} |