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