author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Mon, 10 Sep 2018 22:40:27 +0200 | |
branch | stable-1.5 |
changeset 2705 | c6e3c6d66af0 |
parent 2685 | 740291442c05 |
permissions | -rw-r--r-- |
2685
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1 |
/* Intel(R) Gigabit Ethernet Linux driver |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2 |
* Copyright(c) 2007-2014 Intel Corporation. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
4 |
* This program is free software; you can redistribute it and/or modify it |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
5 |
* under the terms and conditions of the GNU General Public License, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
6 |
* version 2, as published by the Free Software Foundation. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
7 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
8 |
* This program is distributed in the hope it will be useful, but WITHOUT |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
11 |
* more details. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
12 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
13 |
* You should have received a copy of the GNU General Public License along with |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
14 |
* this program; if not, see <http://www.gnu.org/licenses/>. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
15 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
16 |
* The full GNU General Public License is included in this distribution in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
17 |
* the file called "COPYING". |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
18 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
19 |
* Contact Information: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
20 |
* e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
21 |
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
22 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
23 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
24 |
/* ethtool support for igb */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
25 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
26 |
#include <linux/vmalloc.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
27 |
#include <linux/netdevice.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
28 |
#include <linux/pci.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
29 |
#include <linux/delay.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
30 |
#include <linux/interrupt.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
31 |
#include <linux/if_ether.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
32 |
#include <linux/ethtool.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
33 |
#include <linux/sched.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
34 |
#include <linux/slab.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
35 |
#include <linux/pm_runtime.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
36 |
#include <linux/highmem.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
37 |
#include <linux/mdio.h> |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
38 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
39 |
#include "igb.h" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
40 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
41 |
struct igb_stats { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
42 |
char stat_string[ETH_GSTRING_LEN]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
43 |
int sizeof_stat; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
44 |
int stat_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
45 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
46 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
47 |
#define IGB_STAT(_name, _stat) { \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
48 |
.stat_string = _name, \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
49 |
.sizeof_stat = FIELD_SIZEOF(struct igb_adapter, _stat), \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
50 |
.stat_offset = offsetof(struct igb_adapter, _stat) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
51 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
52 |
static const struct igb_stats igb_gstrings_stats[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
53 |
IGB_STAT("rx_packets", stats.gprc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
54 |
IGB_STAT("tx_packets", stats.gptc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
55 |
IGB_STAT("rx_bytes", stats.gorc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
56 |
IGB_STAT("tx_bytes", stats.gotc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
57 |
IGB_STAT("rx_broadcast", stats.bprc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
58 |
IGB_STAT("tx_broadcast", stats.bptc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
59 |
IGB_STAT("rx_multicast", stats.mprc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
60 |
IGB_STAT("tx_multicast", stats.mptc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
61 |
IGB_STAT("multicast", stats.mprc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
62 |
IGB_STAT("collisions", stats.colc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
63 |
IGB_STAT("rx_crc_errors", stats.crcerrs), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
64 |
IGB_STAT("rx_no_buffer_count", stats.rnbc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
65 |
IGB_STAT("rx_missed_errors", stats.mpc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
66 |
IGB_STAT("tx_aborted_errors", stats.ecol), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
67 |
IGB_STAT("tx_carrier_errors", stats.tncrs), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
68 |
IGB_STAT("tx_window_errors", stats.latecol), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
69 |
IGB_STAT("tx_abort_late_coll", stats.latecol), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
70 |
IGB_STAT("tx_deferred_ok", stats.dc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
71 |
IGB_STAT("tx_single_coll_ok", stats.scc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
72 |
IGB_STAT("tx_multi_coll_ok", stats.mcc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
73 |
IGB_STAT("tx_timeout_count", tx_timeout_count), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
74 |
IGB_STAT("rx_long_length_errors", stats.roc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
75 |
IGB_STAT("rx_short_length_errors", stats.ruc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
76 |
IGB_STAT("rx_align_errors", stats.algnerrc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
77 |
IGB_STAT("tx_tcp_seg_good", stats.tsctc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
78 |
IGB_STAT("tx_tcp_seg_failed", stats.tsctfc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
79 |
IGB_STAT("rx_flow_control_xon", stats.xonrxc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
80 |
IGB_STAT("rx_flow_control_xoff", stats.xoffrxc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
81 |
IGB_STAT("tx_flow_control_xon", stats.xontxc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
82 |
IGB_STAT("tx_flow_control_xoff", stats.xofftxc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
83 |
IGB_STAT("rx_long_byte_count", stats.gorc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
84 |
IGB_STAT("tx_dma_out_of_sync", stats.doosync), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
85 |
IGB_STAT("tx_smbus", stats.mgptc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
86 |
IGB_STAT("rx_smbus", stats.mgprc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
87 |
IGB_STAT("dropped_smbus", stats.mgpdc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
88 |
IGB_STAT("os2bmc_rx_by_bmc", stats.o2bgptc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
89 |
IGB_STAT("os2bmc_tx_by_bmc", stats.b2ospc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
90 |
IGB_STAT("os2bmc_tx_by_host", stats.o2bspc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
91 |
IGB_STAT("os2bmc_rx_by_host", stats.b2ogprc), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
92 |
IGB_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
93 |
IGB_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
94 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
95 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
96 |
#define IGB_NETDEV_STAT(_net_stat) { \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
97 |
.stat_string = __stringify(_net_stat), \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
98 |
.sizeof_stat = FIELD_SIZEOF(struct rtnl_link_stats64, _net_stat), \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
99 |
.stat_offset = offsetof(struct rtnl_link_stats64, _net_stat) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
100 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
101 |
static const struct igb_stats igb_gstrings_net_stats[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
102 |
IGB_NETDEV_STAT(rx_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
103 |
IGB_NETDEV_STAT(tx_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
104 |
IGB_NETDEV_STAT(tx_dropped), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
105 |
IGB_NETDEV_STAT(rx_length_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
106 |
IGB_NETDEV_STAT(rx_over_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
107 |
IGB_NETDEV_STAT(rx_frame_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
108 |
IGB_NETDEV_STAT(rx_fifo_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
109 |
IGB_NETDEV_STAT(tx_fifo_errors), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
110 |
IGB_NETDEV_STAT(tx_heartbeat_errors) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
111 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
112 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
113 |
#define IGB_GLOBAL_STATS_LEN \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
114 |
(sizeof(igb_gstrings_stats) / sizeof(struct igb_stats)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
115 |
#define IGB_NETDEV_STATS_LEN \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
116 |
(sizeof(igb_gstrings_net_stats) / sizeof(struct igb_stats)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
117 |
#define IGB_RX_QUEUE_STATS_LEN \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
118 |
(sizeof(struct igb_rx_queue_stats) / sizeof(u64)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
119 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
120 |
#define IGB_TX_QUEUE_STATS_LEN 3 /* packets, bytes, restart_queue */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
121 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
122 |
#define IGB_QUEUE_STATS_LEN \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
123 |
((((struct igb_adapter *)netdev_priv(netdev))->num_rx_queues * \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
124 |
IGB_RX_QUEUE_STATS_LEN) + \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
125 |
(((struct igb_adapter *)netdev_priv(netdev))->num_tx_queues * \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
126 |
IGB_TX_QUEUE_STATS_LEN)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
127 |
#define IGB_STATS_LEN \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
128 |
(IGB_GLOBAL_STATS_LEN + IGB_NETDEV_STATS_LEN + IGB_QUEUE_STATS_LEN) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
129 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
130 |
static const char igb_gstrings_test[][ETH_GSTRING_LEN] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
131 |
"Register test (offline)", "Eeprom test (offline)", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
132 |
"Interrupt test (offline)", "Loopback test (offline)", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
133 |
"Link test (on/offline)" |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
134 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
135 |
#define IGB_TEST_LEN (sizeof(igb_gstrings_test) / ETH_GSTRING_LEN) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
136 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
137 |
static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
138 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
139 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
140 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
141 |
struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
142 |
struct e1000_sfp_flags *eth_flags = &dev_spec->eth_flags; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
143 |
u32 status; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
144 |
u32 speed; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
145 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
146 |
status = rd32(E1000_STATUS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
147 |
if (hw->phy.media_type == e1000_media_type_copper) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
148 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
149 |
ecmd->supported = (SUPPORTED_10baseT_Half | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
150 |
SUPPORTED_10baseT_Full | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
151 |
SUPPORTED_100baseT_Half | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
152 |
SUPPORTED_100baseT_Full | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
153 |
SUPPORTED_1000baseT_Full| |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
154 |
SUPPORTED_Autoneg | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
155 |
SUPPORTED_TP | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
156 |
SUPPORTED_Pause); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
157 |
ecmd->advertising = ADVERTISED_TP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
158 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
159 |
if (hw->mac.autoneg == 1) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
160 |
ecmd->advertising |= ADVERTISED_Autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
161 |
/* the e1000 autoneg seems to match ethtool nicely */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
162 |
ecmd->advertising |= hw->phy.autoneg_advertised; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
163 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
164 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
165 |
ecmd->port = PORT_TP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
166 |
ecmd->phy_address = hw->phy.addr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
167 |
ecmd->transceiver = XCVR_INTERNAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
168 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
169 |
ecmd->supported = (SUPPORTED_FIBRE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
170 |
SUPPORTED_1000baseKX_Full | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
171 |
SUPPORTED_Autoneg | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
172 |
SUPPORTED_Pause); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
173 |
ecmd->advertising = (ADVERTISED_FIBRE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
174 |
ADVERTISED_1000baseKX_Full); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
175 |
if (hw->mac.type == e1000_i354) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
176 |
if ((hw->device_id == |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
177 |
E1000_DEV_ID_I354_BACKPLANE_2_5GBPS) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
178 |
!(status & E1000_STATUS_2P5_SKU_OVER)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
179 |
ecmd->supported |= SUPPORTED_2500baseX_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
180 |
ecmd->supported &= |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
181 |
~SUPPORTED_1000baseKX_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
182 |
ecmd->advertising |= ADVERTISED_2500baseX_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
183 |
ecmd->advertising &= |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
184 |
~ADVERTISED_1000baseKX_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
185 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
186 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
187 |
if (eth_flags->e100_base_fx) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
188 |
ecmd->supported |= SUPPORTED_100baseT_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
189 |
ecmd->advertising |= ADVERTISED_100baseT_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
190 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
191 |
if (hw->mac.autoneg == 1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
192 |
ecmd->advertising |= ADVERTISED_Autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
193 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
194 |
ecmd->port = PORT_FIBRE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
195 |
ecmd->transceiver = XCVR_EXTERNAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
196 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
197 |
if (hw->mac.autoneg != 1) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
198 |
ecmd->advertising &= ~(ADVERTISED_Pause | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
199 |
ADVERTISED_Asym_Pause); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
200 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
201 |
switch (hw->fc.requested_mode) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
202 |
case e1000_fc_full: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
203 |
ecmd->advertising |= ADVERTISED_Pause; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
204 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
205 |
case e1000_fc_rx_pause: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
206 |
ecmd->advertising |= (ADVERTISED_Pause | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
207 |
ADVERTISED_Asym_Pause); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
208 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
209 |
case e1000_fc_tx_pause: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
210 |
ecmd->advertising |= ADVERTISED_Asym_Pause; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
211 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
212 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
213 |
ecmd->advertising &= ~(ADVERTISED_Pause | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
214 |
ADVERTISED_Asym_Pause); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
215 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
216 |
if (status & E1000_STATUS_LU) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
217 |
if ((status & E1000_STATUS_2P5_SKU) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
218 |
!(status & E1000_STATUS_2P5_SKU_OVER)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
219 |
speed = SPEED_2500; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
220 |
} else if (status & E1000_STATUS_SPEED_1000) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
221 |
speed = SPEED_1000; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
222 |
} else if (status & E1000_STATUS_SPEED_100) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
223 |
speed = SPEED_100; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
224 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
225 |
speed = SPEED_10; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
226 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
227 |
if ((status & E1000_STATUS_FD) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
228 |
hw->phy.media_type != e1000_media_type_copper) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
229 |
ecmd->duplex = DUPLEX_FULL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
230 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
231 |
ecmd->duplex = DUPLEX_HALF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
232 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
233 |
speed = SPEED_UNKNOWN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
234 |
ecmd->duplex = DUPLEX_UNKNOWN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
235 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
236 |
ethtool_cmd_speed_set(ecmd, speed); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
237 |
if ((hw->phy.media_type == e1000_media_type_fiber) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
238 |
hw->mac.autoneg) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
239 |
ecmd->autoneg = AUTONEG_ENABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
240 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
241 |
ecmd->autoneg = AUTONEG_DISABLE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
242 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
243 |
/* MDI-X => 2; MDI =>1; Invalid =>0 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
244 |
if (hw->phy.media_type == e1000_media_type_copper) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
245 |
ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X : |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
246 |
ETH_TP_MDI; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
247 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
248 |
ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
249 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
250 |
if (hw->phy.mdix == AUTO_ALL_MODES) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
251 |
ecmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
252 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
253 |
ecmd->eth_tp_mdix_ctrl = hw->phy.mdix; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
254 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
255 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
256 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
257 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
258 |
static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
259 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
260 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
261 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
262 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
263 |
/* When SoL/IDER sessions are active, autoneg/speed/duplex |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
264 |
* cannot be changed |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
265 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
266 |
if (igb_check_reset_block(hw)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
267 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
268 |
"Cannot change link characteristics when SoL/IDER is active.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
269 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
270 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
271 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
272 |
/* MDI setting is only allowed when autoneg enabled because |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
273 |
* some hardware doesn't allow MDI setting when speed or |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
274 |
* duplex is forced. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
275 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
276 |
if (ecmd->eth_tp_mdix_ctrl) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
277 |
if (hw->phy.media_type != e1000_media_type_copper) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
278 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
279 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
280 |
if ((ecmd->eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
281 |
(ecmd->autoneg != AUTONEG_ENABLE)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
282 |
dev_err(&adapter->pdev->dev, "forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
283 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
284 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
285 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
286 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
287 |
while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
288 |
usleep_range(1000, 2000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
289 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
290 |
if (ecmd->autoneg == AUTONEG_ENABLE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
291 |
hw->mac.autoneg = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
292 |
if (hw->phy.media_type == e1000_media_type_fiber) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
293 |
hw->phy.autoneg_advertised = ecmd->advertising | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
294 |
ADVERTISED_FIBRE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
295 |
ADVERTISED_Autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
296 |
switch (adapter->link_speed) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
297 |
case SPEED_2500: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
298 |
hw->phy.autoneg_advertised = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
299 |
ADVERTISED_2500baseX_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
300 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
301 |
case SPEED_1000: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
302 |
hw->phy.autoneg_advertised = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
303 |
ADVERTISED_1000baseT_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
304 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
305 |
case SPEED_100: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
306 |
hw->phy.autoneg_advertised = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
307 |
ADVERTISED_100baseT_Full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
308 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
309 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
310 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
311 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
312 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
313 |
hw->phy.autoneg_advertised = ecmd->advertising | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
314 |
ADVERTISED_TP | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
315 |
ADVERTISED_Autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
316 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
317 |
ecmd->advertising = hw->phy.autoneg_advertised; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
318 |
if (adapter->fc_autoneg) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
319 |
hw->fc.requested_mode = e1000_fc_default; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
320 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
321 |
u32 speed = ethtool_cmd_speed(ecmd); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
322 |
/* calling this overrides forced MDI setting */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
323 |
if (igb_set_spd_dplx(adapter, speed, ecmd->duplex)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
324 |
clear_bit(__IGB_RESETTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
325 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
326 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
327 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
328 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
329 |
/* MDI-X => 2; MDI => 1; Auto => 3 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
330 |
if (ecmd->eth_tp_mdix_ctrl) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
331 |
/* fix up the value for auto (3 => 0) as zero is mapped |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
332 |
* internally to auto |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
333 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
334 |
if (ecmd->eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
335 |
hw->phy.mdix = AUTO_ALL_MODES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
336 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
337 |
hw->phy.mdix = ecmd->eth_tp_mdix_ctrl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
338 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
339 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
340 |
/* reset the link */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
341 |
if (netif_running(adapter->netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
342 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
343 |
igb_up(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
344 |
} else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
345 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
346 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
347 |
clear_bit(__IGB_RESETTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
348 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
349 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
350 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
351 |
static u32 igb_get_link(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
352 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
353 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
354 |
struct e1000_mac_info *mac = &adapter->hw.mac; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
355 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
356 |
/* If the link is not reported up to netdev, interrupts are disabled, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
357 |
* and so the physical link state may have changed since we last |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
358 |
* looked. Set get_link_status to make sure that the true link |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
359 |
* state is interrogated, rather than pulling a cached and possibly |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
360 |
* stale link state from the driver. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
361 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
362 |
if (!netif_carrier_ok(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
363 |
mac->get_link_status = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
364 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
365 |
return igb_has_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
366 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
367 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
368 |
static void igb_get_pauseparam(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
369 |
struct ethtool_pauseparam *pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
370 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
371 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
372 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
373 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
374 |
pause->autoneg = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
375 |
(adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
376 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
377 |
if (hw->fc.current_mode == e1000_fc_rx_pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
378 |
pause->rx_pause = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
379 |
else if (hw->fc.current_mode == e1000_fc_tx_pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
380 |
pause->tx_pause = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
381 |
else if (hw->fc.current_mode == e1000_fc_full) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
382 |
pause->rx_pause = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
383 |
pause->tx_pause = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
384 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
385 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
386 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
387 |
static int igb_set_pauseparam(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
388 |
struct ethtool_pauseparam *pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
389 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
390 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
391 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
392 |
int retval = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
393 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
394 |
/* 100basefx does not support setting link flow control */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
395 |
if (hw->dev_spec._82575.eth_flags.e100_base_fx) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
396 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
397 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
398 |
adapter->fc_autoneg = pause->autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
399 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
400 |
while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
401 |
usleep_range(1000, 2000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
402 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
403 |
if (adapter->fc_autoneg == AUTONEG_ENABLE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
404 |
hw->fc.requested_mode = e1000_fc_default; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
405 |
if (netif_running(adapter->netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
406 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
407 |
igb_up(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
408 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
409 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
410 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
411 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
412 |
if (pause->rx_pause && pause->tx_pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
413 |
hw->fc.requested_mode = e1000_fc_full; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
414 |
else if (pause->rx_pause && !pause->tx_pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
415 |
hw->fc.requested_mode = e1000_fc_rx_pause; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
416 |
else if (!pause->rx_pause && pause->tx_pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
417 |
hw->fc.requested_mode = e1000_fc_tx_pause; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
418 |
else if (!pause->rx_pause && !pause->tx_pause) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
419 |
hw->fc.requested_mode = e1000_fc_none; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
420 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
421 |
hw->fc.current_mode = hw->fc.requested_mode; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
422 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
423 |
retval = ((hw->phy.media_type == e1000_media_type_copper) ? |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
424 |
igb_force_mac_fc(hw) : igb_setup_link(hw)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
425 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
426 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
427 |
clear_bit(__IGB_RESETTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
428 |
return retval; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
429 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
430 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
431 |
static u32 igb_get_msglevel(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
432 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
433 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
434 |
return adapter->msg_enable; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
435 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
436 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
437 |
static void igb_set_msglevel(struct net_device *netdev, u32 data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
438 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
439 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
440 |
adapter->msg_enable = data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
441 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
442 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
443 |
static int igb_get_regs_len(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
444 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
445 |
#define IGB_REGS_LEN 739 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
446 |
return IGB_REGS_LEN * sizeof(u32); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
447 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
448 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
449 |
static void igb_get_regs(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
450 |
struct ethtool_regs *regs, void *p) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
451 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
452 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
453 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
454 |
u32 *regs_buff = p; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
455 |
u8 i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
456 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
457 |
memset(p, 0, IGB_REGS_LEN * sizeof(u32)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
458 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
459 |
regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
460 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
461 |
/* General Registers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
462 |
regs_buff[0] = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
463 |
regs_buff[1] = rd32(E1000_STATUS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
464 |
regs_buff[2] = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
465 |
regs_buff[3] = rd32(E1000_MDIC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
466 |
regs_buff[4] = rd32(E1000_SCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
467 |
regs_buff[5] = rd32(E1000_CONNSW); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
468 |
regs_buff[6] = rd32(E1000_VET); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
469 |
regs_buff[7] = rd32(E1000_LEDCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
470 |
regs_buff[8] = rd32(E1000_PBA); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
471 |
regs_buff[9] = rd32(E1000_PBS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
472 |
regs_buff[10] = rd32(E1000_FRTIMER); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
473 |
regs_buff[11] = rd32(E1000_TCPTIMER); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
474 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
475 |
/* NVM Register */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
476 |
regs_buff[12] = rd32(E1000_EECD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
477 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
478 |
/* Interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
479 |
/* Reading EICS for EICR because they read the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
480 |
* same but EICS does not clear on read |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
481 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
482 |
regs_buff[13] = rd32(E1000_EICS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
483 |
regs_buff[14] = rd32(E1000_EICS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
484 |
regs_buff[15] = rd32(E1000_EIMS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
485 |
regs_buff[16] = rd32(E1000_EIMC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
486 |
regs_buff[17] = rd32(E1000_EIAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
487 |
regs_buff[18] = rd32(E1000_EIAM); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
488 |
/* Reading ICS for ICR because they read the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
489 |
* same but ICS does not clear on read |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
490 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
491 |
regs_buff[19] = rd32(E1000_ICS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
492 |
regs_buff[20] = rd32(E1000_ICS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
493 |
regs_buff[21] = rd32(E1000_IMS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
494 |
regs_buff[22] = rd32(E1000_IMC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
495 |
regs_buff[23] = rd32(E1000_IAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
496 |
regs_buff[24] = rd32(E1000_IAM); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
497 |
regs_buff[25] = rd32(E1000_IMIRVP); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
498 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
499 |
/* Flow Control */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
500 |
regs_buff[26] = rd32(E1000_FCAL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
501 |
regs_buff[27] = rd32(E1000_FCAH); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
502 |
regs_buff[28] = rd32(E1000_FCTTV); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
503 |
regs_buff[29] = rd32(E1000_FCRTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
504 |
regs_buff[30] = rd32(E1000_FCRTH); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
505 |
regs_buff[31] = rd32(E1000_FCRTV); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
506 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
507 |
/* Receive */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
508 |
regs_buff[32] = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
509 |
regs_buff[33] = rd32(E1000_RXCSUM); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
510 |
regs_buff[34] = rd32(E1000_RLPML); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
511 |
regs_buff[35] = rd32(E1000_RFCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
512 |
regs_buff[36] = rd32(E1000_MRQC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
513 |
regs_buff[37] = rd32(E1000_VT_CTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
514 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
515 |
/* Transmit */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
516 |
regs_buff[38] = rd32(E1000_TCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
517 |
regs_buff[39] = rd32(E1000_TCTL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
518 |
regs_buff[40] = rd32(E1000_TIPG); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
519 |
regs_buff[41] = rd32(E1000_DTXCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
520 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
521 |
/* Wake Up */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
522 |
regs_buff[42] = rd32(E1000_WUC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
523 |
regs_buff[43] = rd32(E1000_WUFC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
524 |
regs_buff[44] = rd32(E1000_WUS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
525 |
regs_buff[45] = rd32(E1000_IPAV); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
526 |
regs_buff[46] = rd32(E1000_WUPL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
527 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
528 |
/* MAC */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
529 |
regs_buff[47] = rd32(E1000_PCS_CFG0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
530 |
regs_buff[48] = rd32(E1000_PCS_LCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
531 |
regs_buff[49] = rd32(E1000_PCS_LSTAT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
532 |
regs_buff[50] = rd32(E1000_PCS_ANADV); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
533 |
regs_buff[51] = rd32(E1000_PCS_LPAB); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
534 |
regs_buff[52] = rd32(E1000_PCS_NPTX); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
535 |
regs_buff[53] = rd32(E1000_PCS_LPABNP); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
536 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
537 |
/* Statistics */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
538 |
regs_buff[54] = adapter->stats.crcerrs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
539 |
regs_buff[55] = adapter->stats.algnerrc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
540 |
regs_buff[56] = adapter->stats.symerrs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
541 |
regs_buff[57] = adapter->stats.rxerrc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
542 |
regs_buff[58] = adapter->stats.mpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
543 |
regs_buff[59] = adapter->stats.scc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
544 |
regs_buff[60] = adapter->stats.ecol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
545 |
regs_buff[61] = adapter->stats.mcc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
546 |
regs_buff[62] = adapter->stats.latecol; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
547 |
regs_buff[63] = adapter->stats.colc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
548 |
regs_buff[64] = adapter->stats.dc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
549 |
regs_buff[65] = adapter->stats.tncrs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
550 |
regs_buff[66] = adapter->stats.sec; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
551 |
regs_buff[67] = adapter->stats.htdpmc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
552 |
regs_buff[68] = adapter->stats.rlec; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
553 |
regs_buff[69] = adapter->stats.xonrxc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
554 |
regs_buff[70] = adapter->stats.xontxc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
555 |
regs_buff[71] = adapter->stats.xoffrxc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
556 |
regs_buff[72] = adapter->stats.xofftxc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
557 |
regs_buff[73] = adapter->stats.fcruc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
558 |
regs_buff[74] = adapter->stats.prc64; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
559 |
regs_buff[75] = adapter->stats.prc127; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
560 |
regs_buff[76] = adapter->stats.prc255; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
561 |
regs_buff[77] = adapter->stats.prc511; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
562 |
regs_buff[78] = adapter->stats.prc1023; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
563 |
regs_buff[79] = adapter->stats.prc1522; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
564 |
regs_buff[80] = adapter->stats.gprc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
565 |
regs_buff[81] = adapter->stats.bprc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
566 |
regs_buff[82] = adapter->stats.mprc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
567 |
regs_buff[83] = adapter->stats.gptc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
568 |
regs_buff[84] = adapter->stats.gorc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
569 |
regs_buff[86] = adapter->stats.gotc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
570 |
regs_buff[88] = adapter->stats.rnbc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
571 |
regs_buff[89] = adapter->stats.ruc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
572 |
regs_buff[90] = adapter->stats.rfc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
573 |
regs_buff[91] = adapter->stats.roc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
574 |
regs_buff[92] = adapter->stats.rjc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
575 |
regs_buff[93] = adapter->stats.mgprc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
576 |
regs_buff[94] = adapter->stats.mgpdc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
577 |
regs_buff[95] = adapter->stats.mgptc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
578 |
regs_buff[96] = adapter->stats.tor; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
579 |
regs_buff[98] = adapter->stats.tot; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
580 |
regs_buff[100] = adapter->stats.tpr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
581 |
regs_buff[101] = adapter->stats.tpt; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
582 |
regs_buff[102] = adapter->stats.ptc64; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
583 |
regs_buff[103] = adapter->stats.ptc127; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
584 |
regs_buff[104] = adapter->stats.ptc255; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
585 |
regs_buff[105] = adapter->stats.ptc511; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
586 |
regs_buff[106] = adapter->stats.ptc1023; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
587 |
regs_buff[107] = adapter->stats.ptc1522; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
588 |
regs_buff[108] = adapter->stats.mptc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
589 |
regs_buff[109] = adapter->stats.bptc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
590 |
regs_buff[110] = adapter->stats.tsctc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
591 |
regs_buff[111] = adapter->stats.iac; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
592 |
regs_buff[112] = adapter->stats.rpthc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
593 |
regs_buff[113] = adapter->stats.hgptc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
594 |
regs_buff[114] = adapter->stats.hgorc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
595 |
regs_buff[116] = adapter->stats.hgotc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
596 |
regs_buff[118] = adapter->stats.lenerrs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
597 |
regs_buff[119] = adapter->stats.scvpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
598 |
regs_buff[120] = adapter->stats.hrmpc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
599 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
600 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
601 |
regs_buff[121 + i] = rd32(E1000_SRRCTL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
602 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
603 |
regs_buff[125 + i] = rd32(E1000_PSRTYPE(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
604 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
605 |
regs_buff[129 + i] = rd32(E1000_RDBAL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
606 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
607 |
regs_buff[133 + i] = rd32(E1000_RDBAH(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
608 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
609 |
regs_buff[137 + i] = rd32(E1000_RDLEN(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
610 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
611 |
regs_buff[141 + i] = rd32(E1000_RDH(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
612 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
613 |
regs_buff[145 + i] = rd32(E1000_RDT(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
614 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
615 |
regs_buff[149 + i] = rd32(E1000_RXDCTL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
616 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
617 |
for (i = 0; i < 10; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
618 |
regs_buff[153 + i] = rd32(E1000_EITR(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
619 |
for (i = 0; i < 8; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
620 |
regs_buff[163 + i] = rd32(E1000_IMIR(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
621 |
for (i = 0; i < 8; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
622 |
regs_buff[171 + i] = rd32(E1000_IMIREXT(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
623 |
for (i = 0; i < 16; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
624 |
regs_buff[179 + i] = rd32(E1000_RAL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
625 |
for (i = 0; i < 16; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
626 |
regs_buff[195 + i] = rd32(E1000_RAH(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
627 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
628 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
629 |
regs_buff[211 + i] = rd32(E1000_TDBAL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
630 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
631 |
regs_buff[215 + i] = rd32(E1000_TDBAH(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
632 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
633 |
regs_buff[219 + i] = rd32(E1000_TDLEN(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
634 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
635 |
regs_buff[223 + i] = rd32(E1000_TDH(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
636 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
637 |
regs_buff[227 + i] = rd32(E1000_TDT(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
638 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
639 |
regs_buff[231 + i] = rd32(E1000_TXDCTL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
640 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
641 |
regs_buff[235 + i] = rd32(E1000_TDWBAL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
642 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
643 |
regs_buff[239 + i] = rd32(E1000_TDWBAH(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
644 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
645 |
regs_buff[243 + i] = rd32(E1000_DCA_TXCTRL(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
646 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
647 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
648 |
regs_buff[247 + i] = rd32(E1000_IP4AT_REG(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
649 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
650 |
regs_buff[251 + i] = rd32(E1000_IP6AT_REG(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
651 |
for (i = 0; i < 32; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
652 |
regs_buff[255 + i] = rd32(E1000_WUPM_REG(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
653 |
for (i = 0; i < 128; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
654 |
regs_buff[287 + i] = rd32(E1000_FFMT_REG(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
655 |
for (i = 0; i < 128; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
656 |
regs_buff[415 + i] = rd32(E1000_FFVT_REG(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
657 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
658 |
regs_buff[543 + i] = rd32(E1000_FFLT_REG(i)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
659 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
660 |
regs_buff[547] = rd32(E1000_TDFH); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
661 |
regs_buff[548] = rd32(E1000_TDFT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
662 |
regs_buff[549] = rd32(E1000_TDFHS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
663 |
regs_buff[550] = rd32(E1000_TDFPC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
664 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
665 |
if (hw->mac.type > e1000_82580) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
666 |
regs_buff[551] = adapter->stats.o2bgptc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
667 |
regs_buff[552] = adapter->stats.b2ospc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
668 |
regs_buff[553] = adapter->stats.o2bspc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
669 |
regs_buff[554] = adapter->stats.b2ogprc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
670 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
671 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
672 |
if (hw->mac.type != e1000_82576) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
673 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
674 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
675 |
regs_buff[555 + i] = rd32(E1000_SRRCTL(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
676 |
for (i = 0; i < 4; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
677 |
regs_buff[567 + i] = rd32(E1000_PSRTYPE(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
678 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
679 |
regs_buff[571 + i] = rd32(E1000_RDBAL(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
680 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
681 |
regs_buff[583 + i] = rd32(E1000_RDBAH(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
682 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
683 |
regs_buff[595 + i] = rd32(E1000_RDLEN(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
684 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
685 |
regs_buff[607 + i] = rd32(E1000_RDH(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
686 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
687 |
regs_buff[619 + i] = rd32(E1000_RDT(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
688 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
689 |
regs_buff[631 + i] = rd32(E1000_RXDCTL(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
690 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
691 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
692 |
regs_buff[643 + i] = rd32(E1000_TDBAL(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
693 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
694 |
regs_buff[655 + i] = rd32(E1000_TDBAH(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
695 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
696 |
regs_buff[667 + i] = rd32(E1000_TDLEN(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
697 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
698 |
regs_buff[679 + i] = rd32(E1000_TDH(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
699 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
700 |
regs_buff[691 + i] = rd32(E1000_TDT(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
701 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
702 |
regs_buff[703 + i] = rd32(E1000_TXDCTL(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
703 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
704 |
regs_buff[715 + i] = rd32(E1000_TDWBAL(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
705 |
for (i = 0; i < 12; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
706 |
regs_buff[727 + i] = rd32(E1000_TDWBAH(i + 4)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
707 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
708 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
709 |
static int igb_get_eeprom_len(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
710 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
711 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
712 |
return adapter->hw.nvm.word_size * 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
713 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
714 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
715 |
static int igb_get_eeprom(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
716 |
struct ethtool_eeprom *eeprom, u8 *bytes) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
717 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
718 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
719 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
720 |
u16 *eeprom_buff; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
721 |
int first_word, last_word; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
722 |
int ret_val = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
723 |
u16 i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
724 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
725 |
if (eeprom->len == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
726 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
727 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
728 |
eeprom->magic = hw->vendor_id | (hw->device_id << 16); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
729 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
730 |
first_word = eeprom->offset >> 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
731 |
last_word = (eeprom->offset + eeprom->len - 1) >> 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
732 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
733 |
eeprom_buff = kmalloc(sizeof(u16) * |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
734 |
(last_word - first_word + 1), GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
735 |
if (!eeprom_buff) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
736 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
737 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
738 |
if (hw->nvm.type == e1000_nvm_eeprom_spi) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
739 |
ret_val = hw->nvm.ops.read(hw, first_word, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
740 |
last_word - first_word + 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
741 |
eeprom_buff); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
742 |
else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
743 |
for (i = 0; i < last_word - first_word + 1; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
744 |
ret_val = hw->nvm.ops.read(hw, first_word + i, 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
745 |
&eeprom_buff[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
746 |
if (ret_val) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
747 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
748 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
749 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
750 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
751 |
/* Device's eeprom is always little-endian, word addressable */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
752 |
for (i = 0; i < last_word - first_word + 1; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
753 |
le16_to_cpus(&eeprom_buff[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
754 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
755 |
memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
756 |
eeprom->len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
757 |
kfree(eeprom_buff); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
758 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
759 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
760 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
761 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
762 |
static int igb_set_eeprom(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
763 |
struct ethtool_eeprom *eeprom, u8 *bytes) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
764 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
765 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
766 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
767 |
u16 *eeprom_buff; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
768 |
void *ptr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
769 |
int max_len, first_word, last_word, ret_val = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
770 |
u16 i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
771 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
772 |
if (eeprom->len == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
773 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
774 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
775 |
if ((hw->mac.type >= e1000_i210) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
776 |
!igb_get_flash_presence_i210(hw)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
777 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
778 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
779 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
780 |
if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
781 |
return -EFAULT; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
782 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
783 |
max_len = hw->nvm.word_size * 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
784 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
785 |
first_word = eeprom->offset >> 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
786 |
last_word = (eeprom->offset + eeprom->len - 1) >> 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
787 |
eeprom_buff = kmalloc(max_len, GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
788 |
if (!eeprom_buff) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
789 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
790 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
791 |
ptr = (void *)eeprom_buff; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
792 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
793 |
if (eeprom->offset & 1) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
794 |
/* need read/modify/write of first changed EEPROM word |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
795 |
* only the second byte of the word is being modified |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
796 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
797 |
ret_val = hw->nvm.ops.read(hw, first_word, 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
798 |
&eeprom_buff[0]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
799 |
ptr++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
800 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
801 |
if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
802 |
/* need read/modify/write of last changed EEPROM word |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
803 |
* only the first byte of the word is being modified |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
804 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
805 |
ret_val = hw->nvm.ops.read(hw, last_word, 1, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
806 |
&eeprom_buff[last_word - first_word]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
807 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
808 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
809 |
/* Device's eeprom is always little-endian, word addressable */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
810 |
for (i = 0; i < last_word - first_word + 1; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
811 |
le16_to_cpus(&eeprom_buff[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
812 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
813 |
memcpy(ptr, bytes, eeprom->len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
814 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
815 |
for (i = 0; i < last_word - first_word + 1; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
816 |
eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
817 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
818 |
ret_val = hw->nvm.ops.write(hw, first_word, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
819 |
last_word - first_word + 1, eeprom_buff); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
820 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
821 |
/* Update the checksum if nvm write succeeded */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
822 |
if (ret_val == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
823 |
hw->nvm.ops.update(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
824 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
825 |
igb_set_fw_version(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
826 |
kfree(eeprom_buff); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
827 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
828 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
829 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
830 |
static void igb_get_drvinfo(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
831 |
struct ethtool_drvinfo *drvinfo) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
832 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
833 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
834 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
835 |
strlcpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
836 |
strlcpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
837 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
838 |
/* EEPROM image version # is reported as firmware version # for |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
839 |
* 82575 controllers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
840 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
841 |
strlcpy(drvinfo->fw_version, adapter->fw_version, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
842 |
sizeof(drvinfo->fw_version)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
843 |
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
844 |
sizeof(drvinfo->bus_info)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
845 |
drvinfo->n_stats = IGB_STATS_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
846 |
drvinfo->testinfo_len = IGB_TEST_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
847 |
drvinfo->regdump_len = igb_get_regs_len(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
848 |
drvinfo->eedump_len = igb_get_eeprom_len(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
849 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
850 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
851 |
static void igb_get_ringparam(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
852 |
struct ethtool_ringparam *ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
853 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
854 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
855 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
856 |
ring->rx_max_pending = IGB_MAX_RXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
857 |
ring->tx_max_pending = IGB_MAX_TXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
858 |
ring->rx_pending = adapter->rx_ring_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
859 |
ring->tx_pending = adapter->tx_ring_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
860 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
861 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
862 |
static int igb_set_ringparam(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
863 |
struct ethtool_ringparam *ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
864 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
865 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
866 |
struct igb_ring *temp_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
867 |
int i, err = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
868 |
u16 new_rx_count, new_tx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
869 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
870 |
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
871 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
872 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
873 |
new_rx_count = min_t(u32, ring->rx_pending, IGB_MAX_RXD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
874 |
new_rx_count = max_t(u16, new_rx_count, IGB_MIN_RXD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
875 |
new_rx_count = ALIGN(new_rx_count, REQ_RX_DESCRIPTOR_MULTIPLE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
876 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
877 |
new_tx_count = min_t(u32, ring->tx_pending, IGB_MAX_TXD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
878 |
new_tx_count = max_t(u16, new_tx_count, IGB_MIN_TXD); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
879 |
new_tx_count = ALIGN(new_tx_count, REQ_TX_DESCRIPTOR_MULTIPLE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
880 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
881 |
if ((new_tx_count == adapter->tx_ring_count) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
882 |
(new_rx_count == adapter->rx_ring_count)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
883 |
/* nothing to do */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
884 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
885 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
886 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
887 |
while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
888 |
usleep_range(1000, 2000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
889 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
890 |
if (!netif_running(adapter->netdev)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
891 |
for (i = 0; i < adapter->num_tx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
892 |
adapter->tx_ring[i]->count = new_tx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
893 |
for (i = 0; i < adapter->num_rx_queues; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
894 |
adapter->rx_ring[i]->count = new_rx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
895 |
adapter->tx_ring_count = new_tx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
896 |
adapter->rx_ring_count = new_rx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
897 |
goto clear_reset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
898 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
899 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
900 |
if (adapter->num_tx_queues > adapter->num_rx_queues) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
901 |
temp_ring = vmalloc(adapter->num_tx_queues * |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
902 |
sizeof(struct igb_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
903 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
904 |
temp_ring = vmalloc(adapter->num_rx_queues * |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
905 |
sizeof(struct igb_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
906 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
907 |
if (!temp_ring) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
908 |
err = -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
909 |
goto clear_reset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
910 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
911 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
912 |
igb_down(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
913 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
914 |
/* We can't just free everything and then setup again, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
915 |
* because the ISRs in MSI-X mode get passed pointers |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
916 |
* to the Tx and Rx ring structs. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
917 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
918 |
if (new_tx_count != adapter->tx_ring_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
919 |
for (i = 0; i < adapter->num_tx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
920 |
memcpy(&temp_ring[i], adapter->tx_ring[i], |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
921 |
sizeof(struct igb_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
922 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
923 |
temp_ring[i].count = new_tx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
924 |
err = igb_setup_tx_resources(&temp_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
925 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
926 |
while (i) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
927 |
i--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
928 |
igb_free_tx_resources(&temp_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
929 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
930 |
goto err_setup; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
931 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
932 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
933 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
934 |
for (i = 0; i < adapter->num_tx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
935 |
igb_free_tx_resources(adapter->tx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
936 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
937 |
memcpy(adapter->tx_ring[i], &temp_ring[i], |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
938 |
sizeof(struct igb_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
939 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
940 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
941 |
adapter->tx_ring_count = new_tx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
942 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
943 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
944 |
if (new_rx_count != adapter->rx_ring_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
945 |
for (i = 0; i < adapter->num_rx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
946 |
memcpy(&temp_ring[i], adapter->rx_ring[i], |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
947 |
sizeof(struct igb_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
948 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
949 |
temp_ring[i].count = new_rx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
950 |
err = igb_setup_rx_resources(&temp_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
951 |
if (err) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
952 |
while (i) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
953 |
i--; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
954 |
igb_free_rx_resources(&temp_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
955 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
956 |
goto err_setup; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
957 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
958 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
959 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
960 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
961 |
for (i = 0; i < adapter->num_rx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
962 |
igb_free_rx_resources(adapter->rx_ring[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
963 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
964 |
memcpy(adapter->rx_ring[i], &temp_ring[i], |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
965 |
sizeof(struct igb_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
966 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
967 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
968 |
adapter->rx_ring_count = new_rx_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
969 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
970 |
err_setup: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
971 |
igb_up(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
972 |
vfree(temp_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
973 |
clear_reset: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
974 |
clear_bit(__IGB_RESETTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
975 |
return err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
976 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
977 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
978 |
/* ethtool register test data */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
979 |
struct igb_reg_test { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
980 |
u16 reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
981 |
u16 reg_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
982 |
u16 array_len; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
983 |
u16 test_type; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
984 |
u32 mask; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
985 |
u32 write; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
986 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
987 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
988 |
/* In the hardware, registers are laid out either singly, in arrays |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
989 |
* spaced 0x100 bytes apart, or in contiguous tables. We assume |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
990 |
* most tests take place on arrays or single registers (handled |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
991 |
* as a single-element array) and special-case the tables. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
992 |
* Table tests are always pattern tests. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
993 |
* |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
994 |
* We also make provision for some required setup steps by specifying |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
995 |
* registers to be written without any read-back testing. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
996 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
997 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
998 |
#define PATTERN_TEST 1 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
999 |
#define SET_READ_TEST 2 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1000 |
#define WRITE_NO_TEST 3 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1001 |
#define TABLE32_TEST 4 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1002 |
#define TABLE64_TEST_LO 5 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1003 |
#define TABLE64_TEST_HI 6 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1004 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1005 |
/* i210 reg test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1006 |
static struct igb_reg_test reg_test_i210[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1007 |
{ E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1008 |
{ E1000_FCAH, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1009 |
{ E1000_FCT, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1010 |
{ E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1011 |
{ E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1012 |
{ E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1013 |
/* RDH is read-only for i210, only test RDT. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1014 |
{ E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1015 |
{ E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1016 |
{ E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1017 |
{ E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1018 |
{ E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1019 |
{ E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1020 |
{ E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1021 |
{ E1000_TDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1022 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1023 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1024 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1025 |
{ E1000_TCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1026 |
{ E1000_RA, 0, 16, TABLE64_TEST_LO, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1027 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1028 |
{ E1000_RA, 0, 16, TABLE64_TEST_HI, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1029 |
0x900FFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1030 |
{ E1000_MTA, 0, 128, TABLE32_TEST, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1031 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1032 |
{ 0, 0, 0, 0, 0 } |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1033 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1034 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1035 |
/* i350 reg test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1036 |
static struct igb_reg_test reg_test_i350[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1037 |
{ E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1038 |
{ E1000_FCAH, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1039 |
{ E1000_FCT, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1040 |
{ E1000_VET, 0x100, 1, PATTERN_TEST, 0xFFFF0000, 0xFFFF0000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1041 |
{ E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1042 |
{ E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1043 |
{ E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1044 |
{ E1000_RDBAL(4), 0x40, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1045 |
{ E1000_RDBAH(4), 0x40, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1046 |
{ E1000_RDLEN(4), 0x40, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1047 |
/* RDH is read-only for i350, only test RDT. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1048 |
{ E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1049 |
{ E1000_RDT(4), 0x40, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1050 |
{ E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1051 |
{ E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1052 |
{ E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1053 |
{ E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1054 |
{ E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1055 |
{ E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1056 |
{ E1000_TDBAL(4), 0x40, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1057 |
{ E1000_TDBAH(4), 0x40, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1058 |
{ E1000_TDLEN(4), 0x40, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1059 |
{ E1000_TDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1060 |
{ E1000_TDT(4), 0x40, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1061 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1062 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1063 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1064 |
{ E1000_TCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1065 |
{ E1000_RA, 0, 16, TABLE64_TEST_LO, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1066 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1067 |
{ E1000_RA, 0, 16, TABLE64_TEST_HI, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1068 |
0xC3FFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1069 |
{ E1000_RA2, 0, 16, TABLE64_TEST_LO, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1070 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1071 |
{ E1000_RA2, 0, 16, TABLE64_TEST_HI, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1072 |
0xC3FFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1073 |
{ E1000_MTA, 0, 128, TABLE32_TEST, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1074 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1075 |
{ 0, 0, 0, 0 } |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1076 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1077 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1078 |
/* 82580 reg test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1079 |
static struct igb_reg_test reg_test_82580[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1080 |
{ E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1081 |
{ E1000_FCAH, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1082 |
{ E1000_FCT, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1083 |
{ E1000_VET, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1084 |
{ E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1085 |
{ E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1086 |
{ E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1087 |
{ E1000_RDBAL(4), 0x40, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1088 |
{ E1000_RDBAH(4), 0x40, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1089 |
{ E1000_RDLEN(4), 0x40, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1090 |
/* RDH is read-only for 82580, only test RDT. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1091 |
{ E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1092 |
{ E1000_RDT(4), 0x40, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1093 |
{ E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1094 |
{ E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1095 |
{ E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1096 |
{ E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1097 |
{ E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1098 |
{ E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1099 |
{ E1000_TDBAL(4), 0x40, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1100 |
{ E1000_TDBAH(4), 0x40, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1101 |
{ E1000_TDLEN(4), 0x40, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1102 |
{ E1000_TDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1103 |
{ E1000_TDT(4), 0x40, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1104 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1105 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1106 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1107 |
{ E1000_TCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1108 |
{ E1000_RA, 0, 16, TABLE64_TEST_LO, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1109 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1110 |
{ E1000_RA, 0, 16, TABLE64_TEST_HI, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1111 |
0x83FFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1112 |
{ E1000_RA2, 0, 8, TABLE64_TEST_LO, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1113 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1114 |
{ E1000_RA2, 0, 8, TABLE64_TEST_HI, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1115 |
0x83FFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1116 |
{ E1000_MTA, 0, 128, TABLE32_TEST, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1117 |
0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1118 |
{ 0, 0, 0, 0 } |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1119 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1120 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1121 |
/* 82576 reg test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1122 |
static struct igb_reg_test reg_test_82576[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1123 |
{ E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1124 |
{ E1000_FCAH, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1125 |
{ E1000_FCT, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1126 |
{ E1000_VET, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1127 |
{ E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1128 |
{ E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1129 |
{ E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1130 |
{ E1000_RDBAL(4), 0x40, 12, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1131 |
{ E1000_RDBAH(4), 0x40, 12, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1132 |
{ E1000_RDLEN(4), 0x40, 12, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1133 |
/* Enable all RX queues before testing. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1134 |
{ E1000_RXDCTL(0), 0x100, 4, WRITE_NO_TEST, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1135 |
E1000_RXDCTL_QUEUE_ENABLE }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1136 |
{ E1000_RXDCTL(4), 0x40, 12, WRITE_NO_TEST, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1137 |
E1000_RXDCTL_QUEUE_ENABLE }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1138 |
/* RDH is read-only for 82576, only test RDT. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1139 |
{ E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1140 |
{ E1000_RDT(4), 0x40, 12, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1141 |
{ E1000_RXDCTL(0), 0x100, 4, WRITE_NO_TEST, 0, 0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1142 |
{ E1000_RXDCTL(4), 0x40, 12, WRITE_NO_TEST, 0, 0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1143 |
{ E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1144 |
{ E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1145 |
{ E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1146 |
{ E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1147 |
{ E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1148 |
{ E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1149 |
{ E1000_TDBAL(4), 0x40, 12, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1150 |
{ E1000_TDBAH(4), 0x40, 12, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1151 |
{ E1000_TDLEN(4), 0x40, 12, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1152 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1153 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1154 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1155 |
{ E1000_TCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1156 |
{ E1000_RA, 0, 16, TABLE64_TEST_LO, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1157 |
{ E1000_RA, 0, 16, TABLE64_TEST_HI, 0x83FFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1158 |
{ E1000_RA2, 0, 8, TABLE64_TEST_LO, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1159 |
{ E1000_RA2, 0, 8, TABLE64_TEST_HI, 0x83FFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1160 |
{ E1000_MTA, 0, 128, TABLE32_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1161 |
{ 0, 0, 0, 0 } |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1162 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1163 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1164 |
/* 82575 register test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1165 |
static struct igb_reg_test reg_test_82575[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1166 |
{ E1000_FCAL, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1167 |
{ E1000_FCAH, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1168 |
{ E1000_FCT, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1169 |
{ E1000_VET, 0x100, 1, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1170 |
{ E1000_RDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1171 |
{ E1000_RDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1172 |
{ E1000_RDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1173 |
/* Enable all four RX queues before testing. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1174 |
{ E1000_RXDCTL(0), 0x100, 4, WRITE_NO_TEST, 0, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1175 |
E1000_RXDCTL_QUEUE_ENABLE }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1176 |
/* RDH is read-only for 82575, only test RDT. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1177 |
{ E1000_RDT(0), 0x100, 4, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1178 |
{ E1000_RXDCTL(0), 0x100, 4, WRITE_NO_TEST, 0, 0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1179 |
{ E1000_FCRTH, 0x100, 1, PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1180 |
{ E1000_FCTTV, 0x100, 1, PATTERN_TEST, 0x0000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1181 |
{ E1000_TIPG, 0x100, 1, PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1182 |
{ E1000_TDBAL(0), 0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1183 |
{ E1000_TDBAH(0), 0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1184 |
{ E1000_TDLEN(0), 0x100, 4, PATTERN_TEST, 0x000FFF80, 0x000FFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1185 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1186 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB3FE, 0x003FFFFB }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1187 |
{ E1000_RCTL, 0x100, 1, SET_READ_TEST, 0x04CFB3FE, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1188 |
{ E1000_TCTL, 0x100, 1, SET_READ_TEST, 0xFFFFFFFF, 0x00000000 }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1189 |
{ E1000_TXCW, 0x100, 1, PATTERN_TEST, 0xC000FFFF, 0x0000FFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1190 |
{ E1000_RA, 0, 16, TABLE64_TEST_LO, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1191 |
{ E1000_RA, 0, 16, TABLE64_TEST_HI, 0x800FFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1192 |
{ E1000_MTA, 0, 128, TABLE32_TEST, 0xFFFFFFFF, 0xFFFFFFFF }, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1193 |
{ 0, 0, 0, 0 } |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1194 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1195 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1196 |
static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1197 |
int reg, u32 mask, u32 write) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1198 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1199 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1200 |
u32 pat, val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1201 |
static const u32 _test[] = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1202 |
0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1203 |
for (pat = 0; pat < ARRAY_SIZE(_test); pat++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1204 |
wr32(reg, (_test[pat] & write)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1205 |
val = rd32(reg) & mask; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1206 |
if (val != (_test[pat] & write & mask)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1207 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1208 |
"pattern test reg %04X failed: got 0x%08X expected 0x%08X\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1209 |
reg, val, (_test[pat] & write & mask)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1210 |
*data = reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1211 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1212 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1213 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1214 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1215 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1216 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1217 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1218 |
static bool reg_set_and_check(struct igb_adapter *adapter, u64 *data, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1219 |
int reg, u32 mask, u32 write) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1220 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1221 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1222 |
u32 val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1223 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1224 |
wr32(reg, write & mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1225 |
val = rd32(reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1226 |
if ((write & mask) != (val & mask)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1227 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1228 |
"set/check reg %04X test failed: got 0x%08X expected 0x%08X\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1229 |
reg, (val & mask), (write & mask)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1230 |
*data = reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1231 |
return true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1232 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1233 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1234 |
return false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1235 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1236 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1237 |
#define REG_PATTERN_TEST(reg, mask, write) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1238 |
do { \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1239 |
if (reg_pattern_test(adapter, data, reg, mask, write)) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1240 |
return 1; \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1241 |
} while (0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1242 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1243 |
#define REG_SET_AND_CHECK(reg, mask, write) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1244 |
do { \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1245 |
if (reg_set_and_check(adapter, data, reg, mask, write)) \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1246 |
return 1; \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1247 |
} while (0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1248 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1249 |
static int igb_reg_test(struct igb_adapter *adapter, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1250 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1251 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1252 |
struct igb_reg_test *test; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1253 |
u32 value, before, after; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1254 |
u32 i, toggle; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1255 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1256 |
switch (adapter->hw.mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1257 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1258 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1259 |
test = reg_test_i350; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1260 |
toggle = 0x7FEFF3FF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1261 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1262 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1263 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1264 |
test = reg_test_i210; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1265 |
toggle = 0x7FEFF3FF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1266 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1267 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1268 |
test = reg_test_82580; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1269 |
toggle = 0x7FEFF3FF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1270 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1271 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1272 |
test = reg_test_82576; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1273 |
toggle = 0x7FFFF3FF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1274 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1275 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1276 |
test = reg_test_82575; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1277 |
toggle = 0x7FFFF3FF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1278 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1279 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1280 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1281 |
/* Because the status register is such a special case, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1282 |
* we handle it separately from the rest of the register |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1283 |
* tests. Some bits are read-only, some toggle, and some |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1284 |
* are writable on newer MACs. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1285 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1286 |
before = rd32(E1000_STATUS); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1287 |
value = (rd32(E1000_STATUS) & toggle); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1288 |
wr32(E1000_STATUS, toggle); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1289 |
after = rd32(E1000_STATUS) & toggle; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1290 |
if (value != after) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1291 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1292 |
"failed STATUS register test got: 0x%08X expected: 0x%08X\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1293 |
after, value); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1294 |
*data = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1295 |
return 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1296 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1297 |
/* restore previous status */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1298 |
wr32(E1000_STATUS, before); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1299 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1300 |
/* Perform the remainder of the register test, looping through |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1301 |
* the test table until we either fail or reach the null entry. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1302 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1303 |
while (test->reg) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1304 |
for (i = 0; i < test->array_len; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1305 |
switch (test->test_type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1306 |
case PATTERN_TEST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1307 |
REG_PATTERN_TEST(test->reg + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1308 |
(i * test->reg_offset), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1309 |
test->mask, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1310 |
test->write); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1311 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1312 |
case SET_READ_TEST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1313 |
REG_SET_AND_CHECK(test->reg + |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1314 |
(i * test->reg_offset), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1315 |
test->mask, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1316 |
test->write); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1317 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1318 |
case WRITE_NO_TEST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1319 |
writel(test->write, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1320 |
(adapter->hw.hw_addr + test->reg) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1321 |
+ (i * test->reg_offset)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1322 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1323 |
case TABLE32_TEST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1324 |
REG_PATTERN_TEST(test->reg + (i * 4), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1325 |
test->mask, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1326 |
test->write); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1327 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1328 |
case TABLE64_TEST_LO: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1329 |
REG_PATTERN_TEST(test->reg + (i * 8), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1330 |
test->mask, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1331 |
test->write); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1332 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1333 |
case TABLE64_TEST_HI: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1334 |
REG_PATTERN_TEST((test->reg + 4) + (i * 8), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1335 |
test->mask, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1336 |
test->write); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1337 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1338 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1339 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1340 |
test++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1341 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1342 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1343 |
*data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1344 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1345 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1346 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1347 |
static int igb_eeprom_test(struct igb_adapter *adapter, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1348 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1349 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1350 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1351 |
*data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1352 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1353 |
/* Validate eeprom on all parts but flashless */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1354 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1355 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1356 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1357 |
if (igb_get_flash_presence_i210(hw)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1358 |
if (adapter->hw.nvm.ops.validate(&adapter->hw) < 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1359 |
*data = 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1360 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1361 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1362 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1363 |
if (adapter->hw.nvm.ops.validate(&adapter->hw) < 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1364 |
*data = 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1365 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1366 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1367 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1368 |
return *data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1369 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1370 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1371 |
static irqreturn_t igb_test_intr(int irq, void *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1372 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1373 |
struct igb_adapter *adapter = (struct igb_adapter *) data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1374 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1375 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1376 |
adapter->test_icr |= rd32(E1000_ICR); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1377 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1378 |
return IRQ_HANDLED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1379 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1380 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1381 |
static int igb_intr_test(struct igb_adapter *adapter, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1382 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1383 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1384 |
struct net_device *netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1385 |
u32 mask, ics_mask, i = 0, shared_int = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1386 |
u32 irq = adapter->pdev->irq; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1387 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1388 |
*data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1389 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1390 |
/* Hook up test interrupt handler just for this test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1391 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1392 |
if (request_irq(adapter->msix_entries[0].vector, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1393 |
igb_test_intr, 0, netdev->name, adapter)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1394 |
*data = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1395 |
return -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1396 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1397 |
} else if (adapter->flags & IGB_FLAG_HAS_MSI) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1398 |
shared_int = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1399 |
if (request_irq(irq, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1400 |
igb_test_intr, 0, netdev->name, adapter)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1401 |
*data = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1402 |
return -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1403 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1404 |
} else if (!request_irq(irq, igb_test_intr, IRQF_PROBE_SHARED, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1405 |
netdev->name, adapter)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1406 |
shared_int = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1407 |
} else if (request_irq(irq, igb_test_intr, IRQF_SHARED, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1408 |
netdev->name, adapter)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1409 |
*data = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1410 |
return -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1411 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1412 |
dev_info(&adapter->pdev->dev, "testing %s interrupt\n", |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1413 |
(shared_int ? "shared" : "unshared")); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1414 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1415 |
/* Disable all the interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1416 |
wr32(E1000_IMC, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1417 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1418 |
usleep_range(10000, 11000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1419 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1420 |
/* Define all writable bits for ICS */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1421 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1422 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1423 |
ics_mask = 0x37F47EDD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1424 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1425 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1426 |
ics_mask = 0x77D4FBFD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1427 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1428 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1429 |
ics_mask = 0x77DCFED5; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1430 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1431 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1432 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1433 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1434 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1435 |
ics_mask = 0x77DCFED5; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1436 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1437 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1438 |
ics_mask = 0x7FFFFFFF; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1439 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1440 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1441 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1442 |
/* Test each interrupt */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1443 |
for (; i < 31; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1444 |
/* Interrupt to test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1445 |
mask = 1 << i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1446 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1447 |
if (!(mask & ics_mask)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1448 |
continue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1449 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1450 |
if (!shared_int) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1451 |
/* Disable the interrupt to be reported in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1452 |
* the cause register and then force the same |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1453 |
* interrupt and see if one gets posted. If |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1454 |
* an interrupt was posted to the bus, the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1455 |
* test failed. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1456 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1457 |
adapter->test_icr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1458 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1459 |
/* Flush any pending interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1460 |
wr32(E1000_ICR, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1461 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1462 |
wr32(E1000_IMC, mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1463 |
wr32(E1000_ICS, mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1464 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1465 |
usleep_range(10000, 11000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1466 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1467 |
if (adapter->test_icr & mask) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1468 |
*data = 3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1469 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1470 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1471 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1472 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1473 |
/* Enable the interrupt to be reported in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1474 |
* the cause register and then force the same |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1475 |
* interrupt and see if one gets posted. If |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1476 |
* an interrupt was not posted to the bus, the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1477 |
* test failed. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1478 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1479 |
adapter->test_icr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1480 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1481 |
/* Flush any pending interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1482 |
wr32(E1000_ICR, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1483 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1484 |
wr32(E1000_IMS, mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1485 |
wr32(E1000_ICS, mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1486 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1487 |
usleep_range(10000, 11000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1488 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1489 |
if (!(adapter->test_icr & mask)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1490 |
*data = 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1491 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1492 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1493 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1494 |
if (!shared_int) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1495 |
/* Disable the other interrupts to be reported in |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1496 |
* the cause register and then force the other |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1497 |
* interrupts and see if any get posted. If |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1498 |
* an interrupt was posted to the bus, the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1499 |
* test failed. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1500 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1501 |
adapter->test_icr = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1502 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1503 |
/* Flush any pending interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1504 |
wr32(E1000_ICR, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1505 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1506 |
wr32(E1000_IMC, ~mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1507 |
wr32(E1000_ICS, ~mask); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1508 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1509 |
usleep_range(10000, 11000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1510 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1511 |
if (adapter->test_icr & mask) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1512 |
*data = 5; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1513 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1514 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1515 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1516 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1517 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1518 |
/* Disable all the interrupts */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1519 |
wr32(E1000_IMC, ~0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1520 |
wrfl(); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1521 |
usleep_range(10000, 11000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1522 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1523 |
/* Unhook test interrupt handler */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1524 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1525 |
free_irq(adapter->msix_entries[0].vector, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1526 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1527 |
free_irq(irq, adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1528 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1529 |
return *data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1530 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1531 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1532 |
static void igb_free_desc_rings(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1533 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1534 |
igb_free_tx_resources(&adapter->test_tx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1535 |
igb_free_rx_resources(&adapter->test_rx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1536 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1537 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1538 |
static int igb_setup_desc_rings(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1539 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1540 |
struct igb_ring *tx_ring = &adapter->test_tx_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1541 |
struct igb_ring *rx_ring = &adapter->test_rx_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1542 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1543 |
int ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1544 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1545 |
/* Setup Tx descriptor ring and Tx buffers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1546 |
tx_ring->count = IGB_DEFAULT_TXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1547 |
tx_ring->dev = &adapter->pdev->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1548 |
tx_ring->netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1549 |
tx_ring->reg_idx = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1550 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1551 |
if (igb_setup_tx_resources(tx_ring)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1552 |
ret_val = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1553 |
goto err_nomem; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1554 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1555 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1556 |
igb_setup_tctl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1557 |
igb_configure_tx_ring(adapter, tx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1558 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1559 |
/* Setup Rx descriptor ring and Rx buffers */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1560 |
rx_ring->count = IGB_DEFAULT_RXD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1561 |
rx_ring->dev = &adapter->pdev->dev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1562 |
rx_ring->netdev = adapter->netdev; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1563 |
rx_ring->reg_idx = adapter->vfs_allocated_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1564 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1565 |
if (igb_setup_rx_resources(rx_ring)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1566 |
ret_val = 3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1567 |
goto err_nomem; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1568 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1569 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1570 |
/* set the default queue to queue 0 of PF */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1571 |
wr32(E1000_MRQC, adapter->vfs_allocated_count << 3); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1572 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1573 |
/* enable receive ring */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1574 |
igb_setup_rctl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1575 |
igb_configure_rx_ring(adapter, rx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1576 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1577 |
igb_alloc_rx_buffers(rx_ring, igb_desc_unused(rx_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1578 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1579 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1580 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1581 |
err_nomem: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1582 |
igb_free_desc_rings(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1583 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1584 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1585 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1586 |
static void igb_phy_disable_receiver(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1587 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1588 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1589 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1590 |
/* Write out to PHY registers 29 and 30 to disable the Receiver. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1591 |
igb_write_phy_reg(hw, 29, 0x001F); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1592 |
igb_write_phy_reg(hw, 30, 0x8FFC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1593 |
igb_write_phy_reg(hw, 29, 0x001A); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1594 |
igb_write_phy_reg(hw, 30, 0x8FF0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1595 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1596 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1597 |
static int igb_integrated_phy_loopback(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1598 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1599 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1600 |
u32 ctrl_reg = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1601 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1602 |
hw->mac.autoneg = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1603 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1604 |
if (hw->phy.type == e1000_phy_m88) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1605 |
if (hw->phy.id != I210_I_PHY_ID) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1606 |
/* Auto-MDI/MDIX Off */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1607 |
igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1608 |
/* reset to update Auto-MDI/MDIX */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1609 |
igb_write_phy_reg(hw, PHY_CONTROL, 0x9140); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1610 |
/* autoneg off */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1611 |
igb_write_phy_reg(hw, PHY_CONTROL, 0x8140); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1612 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1613 |
/* force 1000, set loopback */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1614 |
igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1615 |
igb_write_phy_reg(hw, PHY_CONTROL, 0x4140); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1616 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1617 |
} else if (hw->phy.type == e1000_phy_82580) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1618 |
/* enable MII loopback */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1619 |
igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1620 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1621 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1622 |
/* add small delay to avoid loopback test failure */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1623 |
msleep(50); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1624 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1625 |
/* force 1000, set loopback */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1626 |
igb_write_phy_reg(hw, PHY_CONTROL, 0x4140); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1627 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1628 |
/* Now set up the MAC to the same speed/duplex as the PHY. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1629 |
ctrl_reg = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1630 |
ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1631 |
ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1632 |
E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1633 |
E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1634 |
E1000_CTRL_FD | /* Force Duplex to FULL */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1635 |
E1000_CTRL_SLU); /* Set link up enable bit */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1636 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1637 |
if (hw->phy.type == e1000_phy_m88) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1638 |
ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1639 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1640 |
wr32(E1000_CTRL, ctrl_reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1641 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1642 |
/* Disable the receiver on the PHY so when a cable is plugged in, the |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1643 |
* PHY does not begin to autoneg when a cable is reconnected to the NIC. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1644 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1645 |
if (hw->phy.type == e1000_phy_m88) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1646 |
igb_phy_disable_receiver(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1647 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1648 |
mdelay(500); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1649 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1650 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1651 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1652 |
static int igb_set_phy_loopback(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1653 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1654 |
return igb_integrated_phy_loopback(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1655 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1656 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1657 |
static int igb_setup_loopback_test(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1658 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1659 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1660 |
u32 reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1661 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1662 |
reg = rd32(E1000_CTRL_EXT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1663 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1664 |
/* use CTRL_EXT to identify link type as SGMII can appear as copper */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1665 |
if (reg & E1000_CTRL_EXT_LINK_MODE_MASK) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1666 |
if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1667 |
(hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1668 |
(hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1669 |
(hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1670 |
(hw->device_id == E1000_DEV_ID_I354_SGMII) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1671 |
(hw->device_id == E1000_DEV_ID_I354_BACKPLANE_2_5GBPS)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1672 |
/* Enable DH89xxCC MPHY for near end loopback */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1673 |
reg = rd32(E1000_MPHY_ADDR_CTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1674 |
reg = (reg & E1000_MPHY_ADDR_CTL_OFFSET_MASK) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1675 |
E1000_MPHY_PCS_CLK_REG_OFFSET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1676 |
wr32(E1000_MPHY_ADDR_CTL, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1677 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1678 |
reg = rd32(E1000_MPHY_DATA); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1679 |
reg |= E1000_MPHY_PCS_CLK_REG_DIGINELBEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1680 |
wr32(E1000_MPHY_DATA, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1681 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1682 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1683 |
reg = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1684 |
reg |= E1000_RCTL_LBM_TCVR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1685 |
wr32(E1000_RCTL, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1686 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1687 |
wr32(E1000_SCTL, E1000_ENABLE_SERDES_LOOPBACK); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1688 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1689 |
reg = rd32(E1000_CTRL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1690 |
reg &= ~(E1000_CTRL_RFCE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1691 |
E1000_CTRL_TFCE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1692 |
E1000_CTRL_LRST); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1693 |
reg |= E1000_CTRL_SLU | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1694 |
E1000_CTRL_FD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1695 |
wr32(E1000_CTRL, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1696 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1697 |
/* Unset switch control to serdes energy detect */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1698 |
reg = rd32(E1000_CONNSW); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1699 |
reg &= ~E1000_CONNSW_ENRGSRC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1700 |
wr32(E1000_CONNSW, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1701 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1702 |
/* Unset sigdetect for SERDES loopback on |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1703 |
* 82580 and newer devices. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1704 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1705 |
if (hw->mac.type >= e1000_82580) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1706 |
reg = rd32(E1000_PCS_CFG0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1707 |
reg |= E1000_PCS_CFG_IGN_SD; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1708 |
wr32(E1000_PCS_CFG0, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1709 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1710 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1711 |
/* Set PCS register for forced speed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1712 |
reg = rd32(E1000_PCS_LCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1713 |
reg &= ~E1000_PCS_LCTL_AN_ENABLE; /* Disable Autoneg*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1714 |
reg |= E1000_PCS_LCTL_FLV_LINK_UP | /* Force link up */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1715 |
E1000_PCS_LCTL_FSV_1000 | /* Force 1000 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1716 |
E1000_PCS_LCTL_FDV_FULL | /* SerDes Full duplex */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1717 |
E1000_PCS_LCTL_FSD | /* Force Speed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1718 |
E1000_PCS_LCTL_FORCE_LINK; /* Force Link */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1719 |
wr32(E1000_PCS_LCTL, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1720 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1721 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1722 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1723 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1724 |
return igb_set_phy_loopback(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1725 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1726 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1727 |
static void igb_loopback_cleanup(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1728 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1729 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1730 |
u32 rctl; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1731 |
u16 phy_reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1732 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1733 |
if ((hw->device_id == E1000_DEV_ID_DH89XXCC_SGMII) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1734 |
(hw->device_id == E1000_DEV_ID_DH89XXCC_SERDES) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1735 |
(hw->device_id == E1000_DEV_ID_DH89XXCC_BACKPLANE) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1736 |
(hw->device_id == E1000_DEV_ID_DH89XXCC_SFP) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1737 |
(hw->device_id == E1000_DEV_ID_I354_SGMII)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1738 |
u32 reg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1739 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1740 |
/* Disable near end loopback on DH89xxCC */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1741 |
reg = rd32(E1000_MPHY_ADDR_CTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1742 |
reg = (reg & E1000_MPHY_ADDR_CTL_OFFSET_MASK) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1743 |
E1000_MPHY_PCS_CLK_REG_OFFSET; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1744 |
wr32(E1000_MPHY_ADDR_CTL, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1745 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1746 |
reg = rd32(E1000_MPHY_DATA); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1747 |
reg &= ~E1000_MPHY_PCS_CLK_REG_DIGINELBEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1748 |
wr32(E1000_MPHY_DATA, reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1749 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1750 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1751 |
rctl = rd32(E1000_RCTL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1752 |
rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1753 |
wr32(E1000_RCTL, rctl); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1754 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1755 |
hw->mac.autoneg = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1756 |
igb_read_phy_reg(hw, PHY_CONTROL, &phy_reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1757 |
if (phy_reg & MII_CR_LOOPBACK) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1758 |
phy_reg &= ~MII_CR_LOOPBACK; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1759 |
igb_write_phy_reg(hw, PHY_CONTROL, phy_reg); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1760 |
igb_phy_sw_reset(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1761 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1762 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1763 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1764 |
static void igb_create_lbtest_frame(struct sk_buff *skb, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1765 |
unsigned int frame_size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1766 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1767 |
memset(skb->data, 0xFF, frame_size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1768 |
frame_size /= 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1769 |
memset(&skb->data[frame_size], 0xAA, frame_size - 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1770 |
memset(&skb->data[frame_size + 10], 0xBE, 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1771 |
memset(&skb->data[frame_size + 12], 0xAF, 1); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1772 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1773 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1774 |
static int igb_check_lbtest_frame(struct igb_rx_buffer *rx_buffer, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1775 |
unsigned int frame_size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1776 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1777 |
unsigned char *data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1778 |
bool match = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1779 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1780 |
frame_size >>= 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1781 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1782 |
data = kmap(rx_buffer->page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1783 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1784 |
if (data[3] != 0xFF || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1785 |
data[frame_size + 10] != 0xBE || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1786 |
data[frame_size + 12] != 0xAF) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1787 |
match = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1788 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1789 |
kunmap(rx_buffer->page); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1790 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1791 |
return match; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1792 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1793 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1794 |
static int igb_clean_test_rings(struct igb_ring *rx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1795 |
struct igb_ring *tx_ring, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1796 |
unsigned int size) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1797 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1798 |
union e1000_adv_rx_desc *rx_desc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1799 |
struct igb_rx_buffer *rx_buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1800 |
struct igb_tx_buffer *tx_buffer_info; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1801 |
u16 rx_ntc, tx_ntc, count = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1802 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1803 |
/* initialize next to clean and descriptor values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1804 |
rx_ntc = rx_ring->next_to_clean; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1805 |
tx_ntc = tx_ring->next_to_clean; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1806 |
rx_desc = IGB_RX_DESC(rx_ring, rx_ntc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1807 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1808 |
while (igb_test_staterr(rx_desc, E1000_RXD_STAT_DD)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1809 |
/* check Rx buffer */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1810 |
rx_buffer_info = &rx_ring->rx_buffer_info[rx_ntc]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1811 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1812 |
/* sync Rx buffer for CPU read */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1813 |
dma_sync_single_for_cpu(rx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1814 |
rx_buffer_info->dma, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1815 |
IGB_RX_BUFSZ, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1816 |
DMA_FROM_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1817 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1818 |
/* verify contents of skb */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1819 |
if (igb_check_lbtest_frame(rx_buffer_info, size)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1820 |
count++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1821 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1822 |
/* sync Rx buffer for device write */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1823 |
dma_sync_single_for_device(rx_ring->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1824 |
rx_buffer_info->dma, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1825 |
IGB_RX_BUFSZ, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1826 |
DMA_FROM_DEVICE); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1827 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1828 |
/* unmap buffer on Tx side */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1829 |
tx_buffer_info = &tx_ring->tx_buffer_info[tx_ntc]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1830 |
igb_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1831 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1832 |
/* increment Rx/Tx next to clean counters */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1833 |
rx_ntc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1834 |
if (rx_ntc == rx_ring->count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1835 |
rx_ntc = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1836 |
tx_ntc++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1837 |
if (tx_ntc == tx_ring->count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1838 |
tx_ntc = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1839 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1840 |
/* fetch next descriptor */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1841 |
rx_desc = IGB_RX_DESC(rx_ring, rx_ntc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1842 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1843 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1844 |
netdev_tx_reset_queue(txring_txq(tx_ring)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1845 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1846 |
/* re-map buffers to ring, store next to clean values */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1847 |
igb_alloc_rx_buffers(rx_ring, count); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1848 |
rx_ring->next_to_clean = rx_ntc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1849 |
tx_ring->next_to_clean = tx_ntc; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1850 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1851 |
return count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1852 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1853 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1854 |
static int igb_run_loopback_test(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1855 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1856 |
struct igb_ring *tx_ring = &adapter->test_tx_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1857 |
struct igb_ring *rx_ring = &adapter->test_rx_ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1858 |
u16 i, j, lc, good_cnt; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1859 |
int ret_val = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1860 |
unsigned int size = IGB_RX_HDR_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1861 |
netdev_tx_t tx_ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1862 |
struct sk_buff *skb; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1863 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1864 |
/* allocate test skb */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1865 |
skb = alloc_skb(size, GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1866 |
if (!skb) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1867 |
return 11; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1868 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1869 |
/* place data into test skb */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1870 |
igb_create_lbtest_frame(skb, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1871 |
skb_put(skb, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1872 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1873 |
/* Calculate the loop count based on the largest descriptor ring |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1874 |
* The idea is to wrap the largest ring a number of times using 64 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1875 |
* send/receive pairs during each loop |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1876 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1877 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1878 |
if (rx_ring->count <= tx_ring->count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1879 |
lc = ((tx_ring->count / 64) * 2) + 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1880 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1881 |
lc = ((rx_ring->count / 64) * 2) + 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1882 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1883 |
for (j = 0; j <= lc; j++) { /* loop count loop */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1884 |
/* reset count of good packets */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1885 |
good_cnt = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1886 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1887 |
/* place 64 packets on the transmit queue*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1888 |
for (i = 0; i < 64; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1889 |
skb_get(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1890 |
tx_ret_val = igb_xmit_frame_ring(skb, tx_ring); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1891 |
if (tx_ret_val == NETDEV_TX_OK) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1892 |
good_cnt++; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1893 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1894 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1895 |
if (good_cnt != 64) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1896 |
ret_val = 12; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1897 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1898 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1899 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1900 |
/* allow 200 milliseconds for packets to go from Tx to Rx */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1901 |
msleep(200); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1902 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1903 |
good_cnt = igb_clean_test_rings(rx_ring, tx_ring, size); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1904 |
if (good_cnt != 64) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1905 |
ret_val = 13; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1906 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1907 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1908 |
} /* end loop count loop */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1909 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1910 |
/* free the original skb */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1911 |
kfree_skb(skb); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1912 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1913 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1914 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1915 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1916 |
static int igb_loopback_test(struct igb_adapter *adapter, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1917 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1918 |
/* PHY loopback cannot be performed if SoL/IDER |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1919 |
* sessions are active |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1920 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1921 |
if (igb_check_reset_block(&adapter->hw)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1922 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1923 |
"Cannot do PHY loopback test when SoL/IDER is active.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1924 |
*data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1925 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1926 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1927 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1928 |
if (adapter->hw.mac.type == e1000_i354) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1929 |
dev_info(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1930 |
"Loopback test not supported on i354.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1931 |
*data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1932 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1933 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1934 |
*data = igb_setup_desc_rings(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1935 |
if (*data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1936 |
goto out; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1937 |
*data = igb_setup_loopback_test(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1938 |
if (*data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1939 |
goto err_loopback; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1940 |
*data = igb_run_loopback_test(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1941 |
igb_loopback_cleanup(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1942 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1943 |
err_loopback: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1944 |
igb_free_desc_rings(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1945 |
out: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1946 |
return *data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1947 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1948 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1949 |
static int igb_link_test(struct igb_adapter *adapter, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1950 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1951 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1952 |
*data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1953 |
if (hw->phy.media_type == e1000_media_type_internal_serdes) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1954 |
int i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1955 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1956 |
hw->mac.serdes_has_link = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1957 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1958 |
/* On some blade server designs, link establishment |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1959 |
* could take as long as 2-3 minutes |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1960 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1961 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1962 |
hw->mac.ops.check_for_link(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1963 |
if (hw->mac.serdes_has_link) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1964 |
return *data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1965 |
msleep(20); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1966 |
} while (i++ < 3750); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1967 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1968 |
*data = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1969 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1970 |
hw->mac.ops.check_for_link(&adapter->hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1971 |
if (hw->mac.autoneg) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1972 |
msleep(5000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1973 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1974 |
if (!(rd32(E1000_STATUS) & E1000_STATUS_LU)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1975 |
*data = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1976 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1977 |
return *data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1978 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1979 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1980 |
static void igb_diag_test(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1981 |
struct ethtool_test *eth_test, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1982 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1983 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1984 |
u16 autoneg_advertised; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1985 |
u8 forced_speed_duplex, autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1986 |
bool if_running = netif_running(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1987 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1988 |
set_bit(__IGB_TESTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1989 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1990 |
/* can't do offline tests on media switching devices */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1991 |
if (adapter->hw.dev_spec._82575.mas_capable) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1992 |
eth_test->flags &= ~ETH_TEST_FL_OFFLINE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1993 |
if (eth_test->flags == ETH_TEST_FL_OFFLINE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1994 |
/* Offline tests */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1995 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1996 |
/* save speed, duplex, autoneg settings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1997 |
autoneg_advertised = adapter->hw.phy.autoneg_advertised; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1998 |
forced_speed_duplex = adapter->hw.mac.forced_speed_duplex; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
1999 |
autoneg = adapter->hw.mac.autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2000 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2001 |
dev_info(&adapter->pdev->dev, "offline testing starting\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2002 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2003 |
/* power up link for link test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2004 |
igb_power_up_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2005 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2006 |
/* Link test performed before hardware reset so autoneg doesn't |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2007 |
* interfere with test result |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2008 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2009 |
if (igb_link_test(adapter, &data[4])) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2010 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2011 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2012 |
if (if_running) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2013 |
/* indicate we're in test mode */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2014 |
dev_close(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2015 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2016 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2017 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2018 |
if (igb_reg_test(adapter, &data[0])) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2019 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2020 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2021 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2022 |
if (igb_eeprom_test(adapter, &data[1])) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2023 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2024 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2025 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2026 |
if (igb_intr_test(adapter, &data[2])) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2027 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2028 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2029 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2030 |
/* power up link for loopback test */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2031 |
igb_power_up_link(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2032 |
if (igb_loopback_test(adapter, &data[3])) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2033 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2034 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2035 |
/* restore speed, duplex, autoneg settings */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2036 |
adapter->hw.phy.autoneg_advertised = autoneg_advertised; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2037 |
adapter->hw.mac.forced_speed_duplex = forced_speed_duplex; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2038 |
adapter->hw.mac.autoneg = autoneg; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2039 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2040 |
/* force this routine to wait until autoneg complete/timeout */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2041 |
adapter->hw.phy.autoneg_wait_to_complete = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2042 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2043 |
adapter->hw.phy.autoneg_wait_to_complete = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2044 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2045 |
clear_bit(__IGB_TESTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2046 |
if (if_running) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2047 |
dev_open(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2048 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2049 |
dev_info(&adapter->pdev->dev, "online testing starting\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2050 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2051 |
/* PHY is powered down when interface is down */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2052 |
if (if_running && igb_link_test(adapter, &data[4])) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2053 |
eth_test->flags |= ETH_TEST_FL_FAILED; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2054 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2055 |
data[4] = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2056 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2057 |
/* Online tests aren't run; pass by default */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2058 |
data[0] = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2059 |
data[1] = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2060 |
data[2] = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2061 |
data[3] = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2062 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2063 |
clear_bit(__IGB_TESTING, &adapter->state); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2064 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2065 |
msleep_interruptible(4 * 1000); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2066 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2067 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2068 |
static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2069 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2070 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2071 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2072 |
wol->wolopts = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2073 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2074 |
if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2075 |
return; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2076 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2077 |
wol->supported = WAKE_UCAST | WAKE_MCAST | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2078 |
WAKE_BCAST | WAKE_MAGIC | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2079 |
WAKE_PHY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2080 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2081 |
/* apply any specific unsupported masks here */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2082 |
switch (adapter->hw.device_id) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2083 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2084 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2085 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2086 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2087 |
if (adapter->wol & E1000_WUFC_EX) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2088 |
wol->wolopts |= WAKE_UCAST; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2089 |
if (adapter->wol & E1000_WUFC_MC) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2090 |
wol->wolopts |= WAKE_MCAST; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2091 |
if (adapter->wol & E1000_WUFC_BC) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2092 |
wol->wolopts |= WAKE_BCAST; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2093 |
if (adapter->wol & E1000_WUFC_MAG) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2094 |
wol->wolopts |= WAKE_MAGIC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2095 |
if (adapter->wol & E1000_WUFC_LNKC) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2096 |
wol->wolopts |= WAKE_PHY; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2097 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2098 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2099 |
static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2100 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2101 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2102 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2103 |
if (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2104 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2105 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2106 |
if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2107 |
return wol->wolopts ? -EOPNOTSUPP : 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2108 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2109 |
/* these settings will always override what we currently have */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2110 |
adapter->wol = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2111 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2112 |
if (wol->wolopts & WAKE_UCAST) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2113 |
adapter->wol |= E1000_WUFC_EX; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2114 |
if (wol->wolopts & WAKE_MCAST) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2115 |
adapter->wol |= E1000_WUFC_MC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2116 |
if (wol->wolopts & WAKE_BCAST) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2117 |
adapter->wol |= E1000_WUFC_BC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2118 |
if (wol->wolopts & WAKE_MAGIC) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2119 |
adapter->wol |= E1000_WUFC_MAG; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2120 |
if (wol->wolopts & WAKE_PHY) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2121 |
adapter->wol |= E1000_WUFC_LNKC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2122 |
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2123 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2124 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2125 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2126 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2127 |
/* bit defines for adapter->led_status */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2128 |
#define IGB_LED_ON 0 |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2129 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2130 |
static int igb_set_phys_id(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2131 |
enum ethtool_phys_id_state state) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2132 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2133 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2134 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2135 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2136 |
switch (state) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2137 |
case ETHTOOL_ID_ACTIVE: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2138 |
igb_blink_led(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2139 |
return 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2140 |
case ETHTOOL_ID_ON: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2141 |
igb_blink_led(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2142 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2143 |
case ETHTOOL_ID_OFF: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2144 |
igb_led_off(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2145 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2146 |
case ETHTOOL_ID_INACTIVE: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2147 |
igb_led_off(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2148 |
clear_bit(IGB_LED_ON, &adapter->led_status); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2149 |
igb_cleanup_led(hw); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2150 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2151 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2152 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2153 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2154 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2155 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2156 |
static int igb_set_coalesce(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2157 |
struct ethtool_coalesce *ec) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2158 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2159 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2160 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2161 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2162 |
if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2163 |
((ec->rx_coalesce_usecs > 3) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2164 |
(ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2165 |
(ec->rx_coalesce_usecs == 2)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2166 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2167 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2168 |
if ((ec->tx_coalesce_usecs > IGB_MAX_ITR_USECS) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2169 |
((ec->tx_coalesce_usecs > 3) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2170 |
(ec->tx_coalesce_usecs < IGB_MIN_ITR_USECS)) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2171 |
(ec->tx_coalesce_usecs == 2)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2172 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2173 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2174 |
if ((adapter->flags & IGB_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2175 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2176 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2177 |
/* If ITR is disabled, disable DMAC */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2178 |
if (ec->rx_coalesce_usecs == 0) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2179 |
if (adapter->flags & IGB_FLAG_DMAC) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2180 |
adapter->flags &= ~IGB_FLAG_DMAC; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2181 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2182 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2183 |
/* convert to rate of irq's per second */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2184 |
if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2185 |
adapter->rx_itr_setting = ec->rx_coalesce_usecs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2186 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2187 |
adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2188 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2189 |
/* convert to rate of irq's per second */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2190 |
if (adapter->flags & IGB_FLAG_QUEUE_PAIRS) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2191 |
adapter->tx_itr_setting = adapter->rx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2192 |
else if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2193 |
adapter->tx_itr_setting = ec->tx_coalesce_usecs; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2194 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2195 |
adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2196 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2197 |
for (i = 0; i < adapter->num_q_vectors; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2198 |
struct igb_q_vector *q_vector = adapter->q_vector[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2199 |
q_vector->tx.work_limit = adapter->tx_work_limit; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2200 |
if (q_vector->rx.ring) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2201 |
q_vector->itr_val = adapter->rx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2202 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2203 |
q_vector->itr_val = adapter->tx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2204 |
if (q_vector->itr_val && q_vector->itr_val <= 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2205 |
q_vector->itr_val = IGB_START_ITR; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2206 |
q_vector->set_itr = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2207 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2208 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2209 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2210 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2211 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2212 |
static int igb_get_coalesce(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2213 |
struct ethtool_coalesce *ec) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2214 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2215 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2216 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2217 |
if (adapter->rx_itr_setting <= 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2218 |
ec->rx_coalesce_usecs = adapter->rx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2219 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2220 |
ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2221 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2222 |
if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2223 |
if (adapter->tx_itr_setting <= 3) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2224 |
ec->tx_coalesce_usecs = adapter->tx_itr_setting; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2225 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2226 |
ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2227 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2228 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2229 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2230 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2231 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2232 |
static int igb_nway_reset(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2233 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2234 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2235 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2236 |
igb_reinit_locked(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2237 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2238 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2239 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2240 |
static int igb_get_sset_count(struct net_device *netdev, int sset) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2241 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2242 |
switch (sset) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2243 |
case ETH_SS_STATS: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2244 |
return IGB_STATS_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2245 |
case ETH_SS_TEST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2246 |
return IGB_TEST_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2247 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2248 |
return -ENOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2249 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2250 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2251 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2252 |
static void igb_get_ethtool_stats(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2253 |
struct ethtool_stats *stats, u64 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2254 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2255 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2256 |
struct rtnl_link_stats64 *net_stats = &adapter->stats64; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2257 |
unsigned int start; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2258 |
struct igb_ring *ring; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2259 |
int i, j; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2260 |
char *p; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2261 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2262 |
spin_lock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2263 |
igb_update_stats(adapter, net_stats); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2264 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2265 |
for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2266 |
p = (char *)adapter + igb_gstrings_stats[i].stat_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2267 |
data[i] = (igb_gstrings_stats[i].sizeof_stat == |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2268 |
sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2269 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2270 |
for (j = 0; j < IGB_NETDEV_STATS_LEN; j++, i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2271 |
p = (char *)net_stats + igb_gstrings_net_stats[j].stat_offset; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2272 |
data[i] = (igb_gstrings_net_stats[j].sizeof_stat == |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2273 |
sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2274 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2275 |
for (j = 0; j < adapter->num_tx_queues; j++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2276 |
u64 restart2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2277 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2278 |
ring = adapter->tx_ring[j]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2279 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2280 |
start = u64_stats_fetch_begin_irq(&ring->tx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2281 |
data[i] = ring->tx_stats.packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2282 |
data[i+1] = ring->tx_stats.bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2283 |
data[i+2] = ring->tx_stats.restart_queue; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2284 |
} while (u64_stats_fetch_retry_irq(&ring->tx_syncp, start)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2285 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2286 |
start = u64_stats_fetch_begin_irq(&ring->tx_syncp2); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2287 |
restart2 = ring->tx_stats.restart_queue2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2288 |
} while (u64_stats_fetch_retry_irq(&ring->tx_syncp2, start)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2289 |
data[i+2] += restart2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2290 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2291 |
i += IGB_TX_QUEUE_STATS_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2292 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2293 |
for (j = 0; j < adapter->num_rx_queues; j++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2294 |
ring = adapter->rx_ring[j]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2295 |
do { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2296 |
start = u64_stats_fetch_begin_irq(&ring->rx_syncp); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2297 |
data[i] = ring->rx_stats.packets; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2298 |
data[i+1] = ring->rx_stats.bytes; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2299 |
data[i+2] = ring->rx_stats.drops; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2300 |
data[i+3] = ring->rx_stats.csum_err; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2301 |
data[i+4] = ring->rx_stats.alloc_failed; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2302 |
} while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2303 |
i += IGB_RX_QUEUE_STATS_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2304 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2305 |
spin_unlock(&adapter->stats64_lock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2306 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2307 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2308 |
static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2309 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2310 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2311 |
u8 *p = data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2312 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2313 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2314 |
switch (stringset) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2315 |
case ETH_SS_TEST: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2316 |
memcpy(data, *igb_gstrings_test, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2317 |
IGB_TEST_LEN*ETH_GSTRING_LEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2318 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2319 |
case ETH_SS_STATS: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2320 |
for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2321 |
memcpy(p, igb_gstrings_stats[i].stat_string, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2322 |
ETH_GSTRING_LEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2323 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2324 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2325 |
for (i = 0; i < IGB_NETDEV_STATS_LEN; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2326 |
memcpy(p, igb_gstrings_net_stats[i].stat_string, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2327 |
ETH_GSTRING_LEN); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2328 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2329 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2330 |
for (i = 0; i < adapter->num_tx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2331 |
sprintf(p, "tx_queue_%u_packets", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2332 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2333 |
sprintf(p, "tx_queue_%u_bytes", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2334 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2335 |
sprintf(p, "tx_queue_%u_restart", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2336 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2337 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2338 |
for (i = 0; i < adapter->num_rx_queues; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2339 |
sprintf(p, "rx_queue_%u_packets", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2340 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2341 |
sprintf(p, "rx_queue_%u_bytes", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2342 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2343 |
sprintf(p, "rx_queue_%u_drops", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2344 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2345 |
sprintf(p, "rx_queue_%u_csum_err", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2346 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2347 |
sprintf(p, "rx_queue_%u_alloc_failed", i); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2348 |
p += ETH_GSTRING_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2349 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2350 |
/* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2351 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2352 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2353 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2354 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2355 |
static int igb_get_ts_info(struct net_device *dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2356 |
struct ethtool_ts_info *info) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2357 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2358 |
struct igb_adapter *adapter = netdev_priv(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2359 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2360 |
if (adapter->ptp_clock) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2361 |
info->phc_index = ptp_clock_index(adapter->ptp_clock); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2362 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2363 |
info->phc_index = -1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2364 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2365 |
switch (adapter->hw.mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2366 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2367 |
info->so_timestamping = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2368 |
SOF_TIMESTAMPING_TX_SOFTWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2369 |
SOF_TIMESTAMPING_RX_SOFTWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2370 |
SOF_TIMESTAMPING_SOFTWARE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2371 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2372 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2373 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2374 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2375 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2376 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2377 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2378 |
info->so_timestamping = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2379 |
SOF_TIMESTAMPING_TX_SOFTWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2380 |
SOF_TIMESTAMPING_RX_SOFTWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2381 |
SOF_TIMESTAMPING_SOFTWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2382 |
SOF_TIMESTAMPING_TX_HARDWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2383 |
SOF_TIMESTAMPING_RX_HARDWARE | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2384 |
SOF_TIMESTAMPING_RAW_HARDWARE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2385 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2386 |
info->tx_types = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2387 |
(1 << HWTSTAMP_TX_OFF) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2388 |
(1 << HWTSTAMP_TX_ON); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2389 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2390 |
info->rx_filters = 1 << HWTSTAMP_FILTER_NONE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2391 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2392 |
/* 82576 does not support timestamping all packets. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2393 |
if (adapter->hw.mac.type >= e1000_82580) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2394 |
info->rx_filters |= 1 << HWTSTAMP_FILTER_ALL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2395 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2396 |
info->rx_filters |= |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2397 |
(1 << HWTSTAMP_FILTER_PTP_V1_L4_SYNC) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2398 |
(1 << HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2399 |
(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2400 |
(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2401 |
(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2402 |
(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2403 |
(1 << HWTSTAMP_FILTER_PTP_V2_EVENT); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2404 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2405 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2406 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2407 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2408 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2409 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2410 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2411 |
static int igb_get_rss_hash_opts(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2412 |
struct ethtool_rxnfc *cmd) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2413 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2414 |
cmd->data = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2415 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2416 |
/* Report default options for RSS on igb */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2417 |
switch (cmd->flow_type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2418 |
case TCP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2419 |
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2420 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2421 |
case UDP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2422 |
if (adapter->flags & IGB_FLAG_RSS_FIELD_IPV4_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2423 |
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2424 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2425 |
case SCTP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2426 |
case AH_ESP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2427 |
case AH_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2428 |
case ESP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2429 |
case IPV4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2430 |
cmd->data |= RXH_IP_SRC | RXH_IP_DST; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2431 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2432 |
case TCP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2433 |
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2434 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2435 |
case UDP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2436 |
if (adapter->flags & IGB_FLAG_RSS_FIELD_IPV6_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2437 |
cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2438 |
/* Fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2439 |
case SCTP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2440 |
case AH_ESP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2441 |
case AH_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2442 |
case ESP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2443 |
case IPV6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2444 |
cmd->data |= RXH_IP_SRC | RXH_IP_DST; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2445 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2446 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2447 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2448 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2449 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2450 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2451 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2452 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2453 |
static int igb_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2454 |
u32 *rule_locs) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2455 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2456 |
struct igb_adapter *adapter = netdev_priv(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2457 |
int ret = -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2458 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2459 |
switch (cmd->cmd) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2460 |
case ETHTOOL_GRXRINGS: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2461 |
cmd->data = adapter->num_rx_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2462 |
ret = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2463 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2464 |
case ETHTOOL_GRXFH: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2465 |
ret = igb_get_rss_hash_opts(adapter, cmd); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2466 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2467 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2468 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2469 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2470 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2471 |
return ret; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2472 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2473 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2474 |
#define UDP_RSS_FLAGS (IGB_FLAG_RSS_FIELD_IPV4_UDP | \ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2475 |
IGB_FLAG_RSS_FIELD_IPV6_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2476 |
static int igb_set_rss_hash_opt(struct igb_adapter *adapter, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2477 |
struct ethtool_rxnfc *nfc) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2478 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2479 |
u32 flags = adapter->flags; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2480 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2481 |
/* RSS does not support anything other than hashing |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2482 |
* to queues on src and dst IPs and ports |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2483 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2484 |
if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2485 |
RXH_L4_B_0_1 | RXH_L4_B_2_3)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2486 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2487 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2488 |
switch (nfc->flow_type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2489 |
case TCP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2490 |
case TCP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2491 |
if (!(nfc->data & RXH_IP_SRC) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2492 |
!(nfc->data & RXH_IP_DST) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2493 |
!(nfc->data & RXH_L4_B_0_1) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2494 |
!(nfc->data & RXH_L4_B_2_3)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2495 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2496 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2497 |
case UDP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2498 |
if (!(nfc->data & RXH_IP_SRC) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2499 |
!(nfc->data & RXH_IP_DST)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2500 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2501 |
switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2502 |
case 0: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2503 |
flags &= ~IGB_FLAG_RSS_FIELD_IPV4_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2504 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2505 |
case (RXH_L4_B_0_1 | RXH_L4_B_2_3): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2506 |
flags |= IGB_FLAG_RSS_FIELD_IPV4_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2507 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2508 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2509 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2510 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2511 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2512 |
case UDP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2513 |
if (!(nfc->data & RXH_IP_SRC) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2514 |
!(nfc->data & RXH_IP_DST)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2515 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2516 |
switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2517 |
case 0: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2518 |
flags &= ~IGB_FLAG_RSS_FIELD_IPV6_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2519 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2520 |
case (RXH_L4_B_0_1 | RXH_L4_B_2_3): |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2521 |
flags |= IGB_FLAG_RSS_FIELD_IPV6_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2522 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2523 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2524 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2525 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2526 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2527 |
case AH_ESP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2528 |
case AH_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2529 |
case ESP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2530 |
case SCTP_V4_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2531 |
case AH_ESP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2532 |
case AH_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2533 |
case ESP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2534 |
case SCTP_V6_FLOW: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2535 |
if (!(nfc->data & RXH_IP_SRC) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2536 |
!(nfc->data & RXH_IP_DST) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2537 |
(nfc->data & RXH_L4_B_0_1) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2538 |
(nfc->data & RXH_L4_B_2_3)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2539 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2540 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2541 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2542 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2543 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2544 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2545 |
/* if we changed something we need to update flags */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2546 |
if (flags != adapter->flags) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2547 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2548 |
u32 mrqc = rd32(E1000_MRQC); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2549 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2550 |
if ((flags & UDP_RSS_FLAGS) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2551 |
!(adapter->flags & UDP_RSS_FLAGS)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2552 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2553 |
"enabling UDP RSS: fragmented packets may arrive out of order to the stack above\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2554 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2555 |
adapter->flags = flags; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2556 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2557 |
/* Perform hash on these packet types */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2558 |
mrqc |= E1000_MRQC_RSS_FIELD_IPV4 | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2559 |
E1000_MRQC_RSS_FIELD_IPV4_TCP | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2560 |
E1000_MRQC_RSS_FIELD_IPV6 | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2561 |
E1000_MRQC_RSS_FIELD_IPV6_TCP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2562 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2563 |
mrqc &= ~(E1000_MRQC_RSS_FIELD_IPV4_UDP | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2564 |
E1000_MRQC_RSS_FIELD_IPV6_UDP); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2565 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2566 |
if (flags & IGB_FLAG_RSS_FIELD_IPV4_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2567 |
mrqc |= E1000_MRQC_RSS_FIELD_IPV4_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2568 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2569 |
if (flags & IGB_FLAG_RSS_FIELD_IPV6_UDP) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2570 |
mrqc |= E1000_MRQC_RSS_FIELD_IPV6_UDP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2571 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2572 |
wr32(E1000_MRQC, mrqc); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2573 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2574 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2575 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2576 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2577 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2578 |
static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2579 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2580 |
struct igb_adapter *adapter = netdev_priv(dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2581 |
int ret = -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2582 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2583 |
switch (cmd->cmd) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2584 |
case ETHTOOL_SRXFH: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2585 |
ret = igb_set_rss_hash_opt(adapter, cmd); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2586 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2587 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2588 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2589 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2590 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2591 |
return ret; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2592 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2593 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2594 |
static int igb_get_eee(struct net_device *netdev, struct ethtool_eee *edata) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2595 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2596 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2597 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2598 |
u32 ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2599 |
u16 phy_data; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2600 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2601 |
if ((hw->mac.type < e1000_i350) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2602 |
(hw->phy.media_type != e1000_media_type_copper)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2603 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2604 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2605 |
edata->supported = (SUPPORTED_1000baseT_Full | |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2606 |
SUPPORTED_100baseT_Full); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2607 |
if (!hw->dev_spec._82575.eee_disable) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2608 |
edata->advertised = |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2609 |
mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2610 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2611 |
/* The IPCNFG and EEER registers are not supported on I354. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2612 |
if (hw->mac.type == e1000_i354) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2613 |
igb_get_eee_status_i354(hw, (bool *)&edata->eee_active); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2614 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2615 |
u32 eeer; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2616 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2617 |
eeer = rd32(E1000_EEER); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2618 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2619 |
/* EEE status on negotiated link */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2620 |
if (eeer & E1000_EEER_EEE_NEG) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2621 |
edata->eee_active = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2622 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2623 |
if (eeer & E1000_EEER_TX_LPI_EN) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2624 |
edata->tx_lpi_enabled = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2625 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2626 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2627 |
/* EEE Link Partner Advertised */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2628 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2629 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2630 |
ret_val = igb_read_emi_reg(hw, E1000_EEE_LP_ADV_ADDR_I350, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2631 |
&phy_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2632 |
if (ret_val) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2633 |
return -ENODATA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2634 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2635 |
edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2636 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2637 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2638 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2639 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2640 |
ret_val = igb_read_xmdio_reg(hw, E1000_EEE_LP_ADV_ADDR_I210, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2641 |
E1000_EEE_LP_ADV_DEV_I210, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2642 |
&phy_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2643 |
if (ret_val) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2644 |
return -ENODATA; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2645 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2646 |
edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2647 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2648 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2649 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2650 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2651 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2652 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2653 |
edata->eee_enabled = !hw->dev_spec._82575.eee_disable; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2654 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2655 |
if ((hw->mac.type == e1000_i354) && |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2656 |
(edata->eee_enabled)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2657 |
edata->tx_lpi_enabled = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2658 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2659 |
/* Report correct negotiated EEE status for devices that |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2660 |
* wrongly report EEE at half-duplex |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2661 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2662 |
if (adapter->link_duplex == HALF_DUPLEX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2663 |
edata->eee_enabled = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2664 |
edata->eee_active = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2665 |
edata->tx_lpi_enabled = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2666 |
edata->advertised &= ~edata->advertised; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2667 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2668 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2669 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2670 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2671 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2672 |
static int igb_set_eee(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2673 |
struct ethtool_eee *edata) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2674 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2675 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2676 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2677 |
struct ethtool_eee eee_curr; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2678 |
bool adv1g_eee = true, adv100m_eee = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2679 |
s32 ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2680 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2681 |
if ((hw->mac.type < e1000_i350) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2682 |
(hw->phy.media_type != e1000_media_type_copper)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2683 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2684 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2685 |
memset(&eee_curr, 0, sizeof(struct ethtool_eee)); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2686 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2687 |
ret_val = igb_get_eee(netdev, &eee_curr); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2688 |
if (ret_val) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2689 |
return ret_val; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2690 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2691 |
if (eee_curr.eee_enabled) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2692 |
if (eee_curr.tx_lpi_enabled != edata->tx_lpi_enabled) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2693 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2694 |
"Setting EEE tx-lpi is not supported\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2695 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2696 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2697 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2698 |
/* Tx LPI timer is not implemented currently */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2699 |
if (edata->tx_lpi_timer) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2700 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2701 |
"Setting EEE Tx LPI timer is not supported\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2702 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2703 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2704 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2705 |
if (!edata->advertised || (edata->advertised & |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2706 |
~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL))) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2707 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2708 |
"EEE Advertisement supports only 100Tx and/or 100T full duplex\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2709 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2710 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2711 |
adv100m_eee = !!(edata->advertised & ADVERTISE_100_FULL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2712 |
adv1g_eee = !!(edata->advertised & ADVERTISE_1000_FULL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2713 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2714 |
} else if (!edata->eee_enabled) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2715 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2716 |
"Setting EEE options are not supported with EEE disabled\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2717 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2718 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2719 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2720 |
adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2721 |
if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2722 |
hw->dev_spec._82575.eee_disable = !edata->eee_enabled; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2723 |
adapter->flags |= IGB_FLAG_EEE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2724 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2725 |
/* reset link */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2726 |
if (netif_running(netdev)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2727 |
igb_reinit_locked(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2728 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2729 |
igb_reset(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2730 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2731 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2732 |
if (hw->mac.type == e1000_i354) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2733 |
ret_val = igb_set_eee_i354(hw, adv1g_eee, adv100m_eee); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2734 |
else |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2735 |
ret_val = igb_set_eee_i350(hw, adv1g_eee, adv100m_eee); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2736 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2737 |
if (ret_val) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2738 |
dev_err(&adapter->pdev->dev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2739 |
"Problem setting EEE advertisement options\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2740 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2741 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2742 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2743 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2744 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2745 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2746 |
static int igb_get_module_info(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2747 |
struct ethtool_modinfo *modinfo) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2748 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2749 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2750 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2751 |
u32 status = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2752 |
u16 sff8472_rev, addr_mode; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2753 |
bool page_swap = false; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2754 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2755 |
if ((hw->phy.media_type == e1000_media_type_copper) || |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2756 |
(hw->phy.media_type == e1000_media_type_unknown)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2757 |
return -EOPNOTSUPP; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2758 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2759 |
/* Check whether we support SFF-8472 or not */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2760 |
status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_COMP, &sff8472_rev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2761 |
if (status) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2762 |
return -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2763 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2764 |
/* addressing mode is not supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2765 |
status = igb_read_phy_reg_i2c(hw, IGB_SFF_8472_SWAP, &addr_mode); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2766 |
if (status) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2767 |
return -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2768 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2769 |
/* addressing mode is not supported */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2770 |
if ((addr_mode & 0xFF) & IGB_SFF_ADDRESSING_MODE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2771 |
hw_dbg("Address change required to access page 0xA2, but not supported. Please report the module type to the driver maintainers.\n"); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2772 |
page_swap = true; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2773 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2774 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2775 |
if ((sff8472_rev & 0xFF) == IGB_SFF_8472_UNSUP || page_swap) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2776 |
/* We have an SFP, but it does not support SFF-8472 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2777 |
modinfo->type = ETH_MODULE_SFF_8079; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2778 |
modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2779 |
} else { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2780 |
/* We have an SFP which supports a revision of SFF-8472 */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2781 |
modinfo->type = ETH_MODULE_SFF_8472; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2782 |
modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2783 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2784 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2785 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2786 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2787 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2788 |
static int igb_get_module_eeprom(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2789 |
struct ethtool_eeprom *ee, u8 *data) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2790 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2791 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2792 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2793 |
u32 status = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2794 |
u16 *dataword; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2795 |
u16 first_word, last_word; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2796 |
int i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2797 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2798 |
if (ee->len == 0) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2799 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2800 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2801 |
first_word = ee->offset >> 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2802 |
last_word = (ee->offset + ee->len - 1) >> 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2803 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2804 |
dataword = kmalloc(sizeof(u16) * (last_word - first_word + 1), |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2805 |
GFP_KERNEL); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2806 |
if (!dataword) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2807 |
return -ENOMEM; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2808 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2809 |
/* Read EEPROM block, SFF-8079/SFF-8472, word at a time */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2810 |
for (i = 0; i < last_word - first_word + 1; i++) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2811 |
status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2812 |
if (status) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2813 |
/* Error occurred while reading module */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2814 |
kfree(dataword); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2815 |
return -EIO; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2816 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2817 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2818 |
be16_to_cpus(&dataword[i]); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2819 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2820 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2821 |
memcpy(data, (u8 *)dataword + (ee->offset & 1), ee->len); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2822 |
kfree(dataword); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2823 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2824 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2825 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2826 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2827 |
static int igb_ethtool_begin(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2828 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2829 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2830 |
pm_runtime_get_sync(&adapter->pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2831 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2832 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2833 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2834 |
static void igb_ethtool_complete(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2835 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2836 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2837 |
pm_runtime_put(&adapter->pdev->dev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2838 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2839 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2840 |
static u32 igb_get_rxfh_indir_size(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2841 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2842 |
return IGB_RETA_SIZE; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2843 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2844 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2845 |
static int igb_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2846 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2847 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2848 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2849 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2850 |
for (i = 0; i < IGB_RETA_SIZE; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2851 |
indir[i] = adapter->rss_indir_tbl[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2852 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2853 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2854 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2855 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2856 |
void igb_write_rss_indir_tbl(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2857 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2858 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2859 |
u32 reg = E1000_RETA(0); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2860 |
u32 shift = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2861 |
int i = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2862 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2863 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2864 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2865 |
shift = 6; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2866 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2867 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2868 |
/* 82576 supports 2 RSS queues for SR-IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2869 |
if (adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2870 |
shift = 3; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2871 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2872 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2873 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2874 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2875 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2876 |
while (i < IGB_RETA_SIZE) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2877 |
u32 val = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2878 |
int j; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2879 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2880 |
for (j = 3; j >= 0; j--) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2881 |
val <<= 8; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2882 |
val |= adapter->rss_indir_tbl[i + j]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2883 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2884 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2885 |
wr32(reg, val << shift); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2886 |
reg += 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2887 |
i += 4; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2888 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2889 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2890 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2891 |
static int igb_set_rxfh(struct net_device *netdev, const u32 *indir, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2892 |
const u8 *key) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2893 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2894 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2895 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2896 |
int i; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2897 |
u32 num_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2898 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2899 |
num_queues = adapter->rss_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2900 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2901 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2902 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2903 |
/* 82576 supports 2 RSS queues for SR-IOV */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2904 |
if (adapter->vfs_allocated_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2905 |
num_queues = 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2906 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2907 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2908 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2909 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2910 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2911 |
/* Verify user input. */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2912 |
for (i = 0; i < IGB_RETA_SIZE; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2913 |
if (indir[i] >= num_queues) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2914 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2915 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2916 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2917 |
for (i = 0; i < IGB_RETA_SIZE; i++) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2918 |
adapter->rss_indir_tbl[i] = indir[i]; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2919 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2920 |
igb_write_rss_indir_tbl(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2921 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2922 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2923 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2924 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2925 |
static unsigned int igb_max_channels(struct igb_adapter *adapter) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2926 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2927 |
struct e1000_hw *hw = &adapter->hw; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2928 |
unsigned int max_combined = 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2929 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2930 |
switch (hw->mac.type) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2931 |
case e1000_i211: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2932 |
max_combined = IGB_MAX_RX_QUEUES_I211; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2933 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2934 |
case e1000_82575: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2935 |
case e1000_i210: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2936 |
max_combined = IGB_MAX_RX_QUEUES_82575; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2937 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2938 |
case e1000_i350: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2939 |
if (!!adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2940 |
max_combined = 1; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2941 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2942 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2943 |
/* fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2944 |
case e1000_82576: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2945 |
if (!!adapter->vfs_allocated_count) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2946 |
max_combined = 2; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2947 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2948 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2949 |
/* fall through */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2950 |
case e1000_82580: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2951 |
case e1000_i354: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2952 |
default: |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2953 |
max_combined = IGB_MAX_RX_QUEUES; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2954 |
break; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2955 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2956 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2957 |
return max_combined; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2958 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2959 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2960 |
static void igb_get_channels(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2961 |
struct ethtool_channels *ch) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2962 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2963 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2964 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2965 |
/* Report maximum channels */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2966 |
ch->max_combined = igb_max_channels(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2967 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2968 |
/* Report info for other vector */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2969 |
if (adapter->flags & IGB_FLAG_HAS_MSIX) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2970 |
ch->max_other = NON_Q_VECTORS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2971 |
ch->other_count = NON_Q_VECTORS; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2972 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2973 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2974 |
ch->combined_count = adapter->rss_queues; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2975 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2976 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2977 |
static int igb_set_channels(struct net_device *netdev, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2978 |
struct ethtool_channels *ch) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2979 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2980 |
struct igb_adapter *adapter = netdev_priv(netdev); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2981 |
unsigned int count = ch->combined_count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2982 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2983 |
/* Verify they are not requesting separate vectors */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2984 |
if (!count || ch->rx_count || ch->tx_count) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2985 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2986 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2987 |
/* Verify other_count is valid and has not been changed */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2988 |
if (ch->other_count != NON_Q_VECTORS) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2989 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2990 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2991 |
/* Verify the number of channels doesn't exceed hw limits */ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2992 |
if (count > igb_max_channels(adapter)) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2993 |
return -EINVAL; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2994 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2995 |
if (count != adapter->rss_queues) { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2996 |
adapter->rss_queues = count; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2997 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2998 |
/* Hardware has to reinitialize queues and interrupts to |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
2999 |
* match the new configuration. |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3000 |
*/ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3001 |
return igb_reinit_queues(adapter); |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3002 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3003 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3004 |
return 0; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3005 |
} |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3006 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3007 |
static const struct ethtool_ops igb_ethtool_ops = { |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3008 |
.get_settings = igb_get_settings, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3009 |
.set_settings = igb_set_settings, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3010 |
.get_drvinfo = igb_get_drvinfo, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3011 |
.get_regs_len = igb_get_regs_len, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3012 |
.get_regs = igb_get_regs, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3013 |
.get_wol = igb_get_wol, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3014 |
.set_wol = igb_set_wol, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3015 |
.get_msglevel = igb_get_msglevel, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3016 |
.set_msglevel = igb_set_msglevel, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3017 |
.nway_reset = igb_nway_reset, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3018 |
.get_link = igb_get_link, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3019 |
.get_eeprom_len = igb_get_eeprom_len, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3020 |
.get_eeprom = igb_get_eeprom, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3021 |
.set_eeprom = igb_set_eeprom, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3022 |
.get_ringparam = igb_get_ringparam, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3023 |
.set_ringparam = igb_set_ringparam, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3024 |
.get_pauseparam = igb_get_pauseparam, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3025 |
.set_pauseparam = igb_set_pauseparam, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3026 |
.self_test = igb_diag_test, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3027 |
.get_strings = igb_get_strings, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3028 |
.set_phys_id = igb_set_phys_id, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3029 |
.get_sset_count = igb_get_sset_count, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3030 |
.get_ethtool_stats = igb_get_ethtool_stats, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3031 |
.get_coalesce = igb_get_coalesce, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3032 |
.set_coalesce = igb_set_coalesce, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3033 |
.get_ts_info = igb_get_ts_info, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3034 |
.get_rxnfc = igb_get_rxnfc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3035 |
.set_rxnfc = igb_set_rxnfc, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3036 |
.get_eee = igb_get_eee, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3037 |
.set_eee = igb_set_eee, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3038 |
.get_module_info = igb_get_module_info, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3039 |
.get_module_eeprom = igb_get_module_eeprom, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3040 |
.get_rxfh_indir_size = igb_get_rxfh_indir_size, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3041 |
.get_rxfh = igb_get_rxfh, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3042 |
.set_rxfh = igb_set_rxfh, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3043 |
.get_channels = igb_get_channels, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3044 |
.set_channels = igb_set_channels, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3045 |
.begin = igb_ethtool_begin, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3046 |
.complete = igb_ethtool_complete, |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3047 |
}; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3048 |
|
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3049 |
void igb_set_ethtool_ops(struct net_device *netdev) |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3050 |
{ |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3051 |
netdev->ethtool_ops = &igb_ethtool_ops; |
740291442c05
Added clean igb driver from kernel 3.18 (no EtherCAT yet).
Florian Pose <fp@igh.de>
parents:
diff
changeset
|
3052 |
} |