author | Florian Pose <fp@igh-essen.com> |
Fri, 06 Apr 2012 23:30:35 +0200 | |
branch | redundancy |
changeset 2373 | 593272e5a169 |
parent 2359 | dce13f854817 |
permissions | -rw-r--r-- |
2359
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
Intel PRO/1000 Linux driver |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2009 Intel Corporation. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
This program is free software; you can redistribute it and/or modify it |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
under the terms and conditions of the GNU General Public License, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
version 2, as published by the Free Software Foundation. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
This program is distributed in the hope it will be useful, but WITHOUT |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
more details. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
You should have received a copy of the GNU General Public License along with |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
this program; if not, write to the Free Software Foundation, Inc., |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
The full GNU General Public License is included in this distribution in |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
the file called "COPYING". |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
Contact Information: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Linux NICS <linux.nics@intel.com> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
*******************************************************************************/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
#include <linux/module.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
#include <linux/types.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
#include <linux/init.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
#include <linux/pci.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
#include <linux/vmalloc.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
#include <linux/pagemap.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include <linux/delay.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include <linux/netdevice.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
#include <linux/tcp.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
#include <linux/ipv6.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include <linux/slab.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
#include <net/checksum.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#include <net/ip6_checksum.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#include <linux/mii.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
#include <linux/ethtool.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#include <linux/if_vlan.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
#include <linux/cpu.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
#include <linux/smp.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
#include <linux/pm_qos_params.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
#include <linux/pm_runtime.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
#include <linux/aer.h> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
#include "e1000.h" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
#define DRV_VERSION "1.0.2-k4" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
char e1000e_driver_name[] = "e1000e"; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
const char e1000e_driver_version[] = DRV_VERSION; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
static const struct e1000_info *e1000_info_tbl[] = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
[board_82571] = &e1000_82571_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
[board_82572] = &e1000_82572_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
[board_82573] = &e1000_82573_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
[board_82574] = &e1000_82574_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
[board_82583] = &e1000_82583_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
[board_80003es2lan] = &e1000_es2_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
[board_ich8lan] = &e1000_ich8_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
[board_ich9lan] = &e1000_ich9_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
[board_ich10lan] = &e1000_ich10_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
[board_pchlan] = &e1000_pch_info, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
struct e1000_reg_info { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
u32 ofs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
char *name; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
#define E1000_RDFH 0x02410 /* Rx Data FIFO Head - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
#define E1000_RDFT 0x02418 /* Rx Data FIFO Tail - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
#define E1000_RDFHS 0x02420 /* Rx Data FIFO Head Saved - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
#define E1000_RDFTS 0x02428 /* Rx Data FIFO Tail Saved - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
#define E1000_RDFPC 0x02430 /* Rx Data FIFO Packet Count - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
#define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
#define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
#define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
#define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
#define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
static const struct e1000_reg_info e1000_reg_info_tbl[] = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
/* General Registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
{E1000_CTRL, "CTRL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
{E1000_STATUS, "STATUS"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
{E1000_CTRL_EXT, "CTRL_EXT"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
/* Interrupt Registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
{E1000_ICR, "ICR"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
/* RX Registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
{E1000_RCTL, "RCTL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
{E1000_RDLEN, "RDLEN"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
{E1000_RDH, "RDH"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
{E1000_RDT, "RDT"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
{E1000_RDTR, "RDTR"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
{E1000_RXDCTL(0), "RXDCTL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
{E1000_ERT, "ERT"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
{E1000_RDBAL, "RDBAL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
{E1000_RDBAH, "RDBAH"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
{E1000_RDFH, "RDFH"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
{E1000_RDFT, "RDFT"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
{E1000_RDFHS, "RDFHS"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
{E1000_RDFTS, "RDFTS"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
{E1000_RDFPC, "RDFPC"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
/* TX Registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
{E1000_TCTL, "TCTL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
{E1000_TDBAL, "TDBAL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
{E1000_TDBAH, "TDBAH"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
{E1000_TDLEN, "TDLEN"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
{E1000_TDH, "TDH"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
{E1000_TDT, "TDT"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
{E1000_TIDV, "TIDV"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
{E1000_TXDCTL(0), "TXDCTL"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
{E1000_TADV, "TADV"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
{E1000_TARC(0), "TARC"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
{E1000_TDFH, "TDFH"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
{E1000_TDFT, "TDFT"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
{E1000_TDFHS, "TDFHS"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
{E1000_TDFTS, "TDFTS"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
{E1000_TDFPC, "TDFPC"}, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
/* List Terminator */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
{} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
* e1000_regdump - register printout routine |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
int n = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
char rname[16]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
u32 regs[8]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
switch (reginfo->ofs) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
case E1000_RXDCTL(0): |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
for (n = 0; n < 2; n++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
regs[n] = __er32(hw, E1000_RXDCTL(n)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
case E1000_TXDCTL(0): |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
for (n = 0; n < 2; n++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
regs[n] = __er32(hw, E1000_TXDCTL(n)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
case E1000_TARC(0): |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
for (n = 0; n < 2; n++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
regs[n] = __er32(hw, E1000_TARC(n)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
printk(KERN_INFO "%-15s %08x\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
reginfo->name, __er32(hw, reginfo->ofs)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
snprintf(rname, 16, "%s%s", reginfo->name, "[0-1]"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
printk(KERN_INFO "%-15s ", rname); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
for (n = 0; n < 2; n++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
printk(KERN_CONT "%08x ", regs[n]); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
printk(KERN_CONT "\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
* e1000e_dump - Print registers, tx-ring and rx-ring |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
static void e1000e_dump(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
struct e1000_reg_info *reginfo; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
struct e1000_tx_desc *tx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
struct my_u0 { u64 a; u64 b; } *u0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
union e1000_rx_desc_packet_split *rx_desc_ps; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
struct e1000_rx_desc *rx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
struct my_u1 { u64 a; u64 b; u64 c; u64 d; } *u1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
u32 staterr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
int i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
if (!netif_msg_hw(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
/* Print netdevice Info */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
if (netdev) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
dev_info(&adapter->pdev->dev, "Net device Info\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
printk(KERN_INFO "Device Name state " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
"trans_start last_rx\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
printk(KERN_INFO "%-15s %016lX %016lX %016lX\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
netdev->name, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
netdev->state, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
netdev->trans_start, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
netdev->last_rx); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
/* Print Registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
dev_info(&adapter->pdev->dev, "Register Dump\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
printk(KERN_INFO " Register Name Value\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
for (reginfo = (struct e1000_reg_info *)e1000_reg_info_tbl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
reginfo->name; reginfo++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
e1000_regdump(hw, reginfo); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
/* Print TX Ring Summary */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
if (!netdev || !netif_running(netdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
goto exit; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma ]" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
" leng ntw timestamp\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
0, tx_ring->next_to_use, tx_ring->next_to_clean, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
(u64)buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
buffer_info->length, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
buffer_info->next_to_watch, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
(u64)buffer_info->time_stamp); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
/* Print TX Rings */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
if (!netif_msg_tx_done(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
goto rx_ring_summary; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
/* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
* Legacy Transmit Descriptor |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
* +--------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
* 0 | Buffer Address [63:0] (Reserved on Write Back) | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
* +--------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
* 8 | Special | CSS | Status | CMD | CSO | Length | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
* +--------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
* 63 48 47 36 35 32 31 24 23 16 15 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
* Extended Context Descriptor (DTYP=0x0) for TSO or checksum offload |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
* 63 48 47 40 39 32 31 16 15 8 7 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
* +----------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
* 0 | TUCSE | TUCS0 | TUCSS | IPCSE | IPCS0 | IPCSS | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
* +----------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
* 8 | MSS | HDRLEN | RSV | STA | TUCMD | DTYP | PAYLEN | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
* +----------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
* 63 48 47 40 39 36 35 32 31 24 23 20 19 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
* Extended Data Descriptor (DTYP=0x1) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
* +----------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
* 0 | Buffer Address [63:0] | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
* +----------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
* 8 | VLAN tag | POPTS | Rsvd | Status | Command | DTYP | DTALEN | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
* +----------------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
* 63 48 47 40 39 36 35 32 31 24 23 20 19 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
printk(KERN_INFO "Tl[desc] [address 63:0 ] [SpeCssSCmCsLen]" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
" [bi->dma ] leng ntw timestamp bi->skb " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
"<-- Legacy format\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
printk(KERN_INFO "Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen]" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
" [bi->dma ] leng ntw timestamp bi->skb " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
"<-- Ext Context format\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
printk(KERN_INFO "Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen]" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
" [bi->dma ] leng ntw timestamp bi->skb " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
"<-- Ext Data format\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
tx_desc = E1000_TX_DESC(*tx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
u0 = (struct my_u0 *)tx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
printk(KERN_INFO "T%c[0x%03X] %016llX %016llX %016llX " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
"%04X %3X %016llX %p", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
(!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
le64_to_cpu(u0->a), le64_to_cpu(u0->b), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
(u64)buffer_info->dma, buffer_info->length, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
buffer_info->next_to_watch, (u64)buffer_info->time_stamp, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
buffer_info->skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
if (i == tx_ring->next_to_use && i == tx_ring->next_to_clean) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
printk(KERN_CONT " NTC/U\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
else if (i == tx_ring->next_to_use) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
printk(KERN_CONT " NTU\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
else if (i == tx_ring->next_to_clean) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
printk(KERN_CONT " NTC\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
printk(KERN_CONT "\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
16, 1, phys_to_virt(buffer_info->dma), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
buffer_info->length, true); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
/* Print RX Rings Summary */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
rx_ring_summary: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
printk(KERN_INFO "Queue [NTU] [NTC]\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
printk(KERN_INFO " %5d %5X %5X\n", 0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
rx_ring->next_to_use, rx_ring->next_to_clean); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
/* Print RX Rings */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
if (!netif_msg_rx_status(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
goto exit; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
switch (adapter->rx_ps_pages) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
case 1: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
case 2: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
case 3: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
/* [Extended] Packet Split Receive Descriptor Format |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
* 0 | Buffer Address 0 [63:0] | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
* 8 | Buffer Address 1 [63:0] | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
* 16 | Buffer Address 2 [63:0] | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
* 24 | Buffer Address 3 [63:0] | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
printk(KERN_INFO "R [desc] [buffer 0 63:0 ] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
"[buffer 1 63:0 ] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
"[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
"[bi->skb] <-- Ext Pkt Split format\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
/* [Extended] Receive Descriptor (Write-Back) Format |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
331 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
332 |
* 63 48 47 32 31 13 12 8 7 4 3 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
333 |
* +------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
334 |
* 0 | Packet | IP | Rsvd | MRQ | Rsvd | MRQ RSS | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
335 |
* | Checksum | Ident | | Queue | | Type | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
336 |
* +------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
337 |
* 8 | VLAN Tag | Length | Extended Error | Extended Status | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
338 |
* +------------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
339 |
* 63 48 47 32 31 20 19 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
340 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
printk(KERN_INFO "RWB[desc] [ck ipid mrqhsh] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
"[vl l0 ee es] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
343 |
"[ l3 l2 l1 hs] [reserved ] ---------------- " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
"[bi->skb] <-- Ext Rx Write-Back format\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
345 |
for (i = 0; i < rx_ring->count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
346 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
u1 = (struct my_u1 *)rx_desc_ps; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
staterr = |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
le32_to_cpu(rx_desc_ps->wb.middle.status_error); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
if (staterr & E1000_RXD_STAT_DD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
/* Descriptor Done */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
printk(KERN_INFO "RWB[0x%03X] %016llX " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
"%016llX %016llX %016llX " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
"---------------- %p", i, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
356 |
le64_to_cpu(u1->a), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
357 |
le64_to_cpu(u1->b), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
358 |
le64_to_cpu(u1->c), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
359 |
le64_to_cpu(u1->d), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
buffer_info->skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
printk(KERN_INFO "R [0x%03X] %016llX " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
"%016llX %016llX %016llX %016llX %p", i, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
le64_to_cpu(u1->a), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
365 |
le64_to_cpu(u1->b), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
366 |
le64_to_cpu(u1->c), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
367 |
le64_to_cpu(u1->d), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
368 |
(u64)buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
buffer_info->skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
371 |
if (netif_msg_pktdata(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
print_hex_dump(KERN_INFO, "", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
373 |
DUMP_PREFIX_ADDRESS, 16, 1, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
phys_to_virt(buffer_info->dma), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
adapter->rx_ps_bsize0, true); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
if (i == rx_ring->next_to_use) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
printk(KERN_CONT " NTU\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
else if (i == rx_ring->next_to_clean) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
printk(KERN_CONT " NTC\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
printk(KERN_CONT "\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
case 0: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
/* Legacy Receive Descriptor Format |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
* | Buffer Address [63:0] | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
* | VLAN Tag | Errors | Status 0 | Packet csum | Length | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
* +-----------------------------------------------------+ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
* 63 48 47 40 39 32 31 16 15 0 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
printk(KERN_INFO "Rl[desc] [address 63:0 ] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
"[vl er S cks ln] [bi->dma ] [bi->skb] " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
"<-- Legacy format\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
u0 = (struct my_u0 *)rx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
printk(KERN_INFO "Rl[0x%03X] %016llX %016llX " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
"%016llX %p", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
i, le64_to_cpu(u0->a), le64_to_cpu(u0->b), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
(u64)buffer_info->dma, buffer_info->skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
if (i == rx_ring->next_to_use) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
printk(KERN_CONT " NTU\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
else if (i == rx_ring->next_to_clean) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
printk(KERN_CONT " NTC\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
printk(KERN_CONT "\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
if (netif_msg_pktdata(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
print_hex_dump(KERN_INFO, "", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
DUMP_PREFIX_ADDRESS, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
16, 1, phys_to_virt(buffer_info->dma), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
adapter->rx_buffer_len, true); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
exit: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
* e1000_desc_unused - calculate if we have unused descriptors |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
static int e1000_desc_unused(struct e1000_ring *ring) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
if (ring->next_to_clean > ring->next_to_use) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
return ring->next_to_clean - ring->next_to_use - 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
return ring->count + ring->next_to_clean - ring->next_to_use - 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
* e1000_receive_skb - helper function to handle Rx indications |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
* @status: descriptor status field as written by hardware |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
* @vlan: descriptor vlan field as written by hardware (no le/be conversion) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
* @skb: pointer to sk_buff to be indicated to stack |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
static void e1000_receive_skb(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
struct net_device *netdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
struct sk_buff *skb, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
u8 status, __le16 vlan) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
skb->protocol = eth_type_trans(skb, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
if (adapter->vlgrp && (status & E1000_RXD_STAT_VP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
vlan_gro_receive(&adapter->napi, adapter->vlgrp, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
le16_to_cpu(vlan), skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
napi_gro_receive(&adapter->napi, skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
* e1000_rx_checksum - Receive Checksum Offload for 82543 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
* @status_err: receive descriptor status and error fields |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
* @csum: receive descriptor csum field |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
* @sk_buff: socket buffer with received data |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
u32 csum, struct sk_buff *skb) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
u16 status = (u16)status_err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
u8 errors = (u8)(status_err >> 24); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
skb->ip_summed = CHECKSUM_NONE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
/* Ignore Checksum bit is set */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
if (status & E1000_RXD_STAT_IXSM) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
/* TCP/UDP checksum error bit is set */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
if (errors & E1000_RXD_ERR_TCPE) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
/* let the stack verify checksum errors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
adapter->hw_csum_err++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
/* TCP/UDP Checksum has not been calculated */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
if (!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
/* It must be a TCP or UDP packet with a valid checksum */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
if (status & E1000_RXD_STAT_TCPCS) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
/* TCP checksum is good */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
skb->ip_summed = CHECKSUM_UNNECESSARY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
* IP fragment with UDP payload |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
* Hardware complements the payload checksum, so we undo it |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
* and then put the value in host order for further stack use. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
__sum16 sum = (__force __sum16)htons(csum); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
skb->csum = csum_unfold(~sum); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
skb->ip_summed = CHECKSUM_COMPLETE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
adapter->hw_csum_good++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
* e1000_alloc_rx_buffers - Replace used receive buffers; legacy & extended |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
* @adapter: address of board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
int cleaned_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
struct e1000_rx_desc *rx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
struct sk_buff *skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
unsigned int bufsz = adapter->rx_buffer_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
i = rx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
while (cleaned_count--) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
skb = buffer_info->skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
if (skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
skb_trim(skb, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
goto map_skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
skb = netdev_alloc_skb_ip_align(netdev, bufsz); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
if (!skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
/* Better luck next round */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
adapter->alloc_rx_buff_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
map_skb: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
buffer_info->dma = dma_map_single(&pdev->dev, skb->data, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
adapter->rx_buffer_len, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
dev_err(&pdev->dev, "RX DMA map failed\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
adapter->rx_dma_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
* Force memory writes to complete before letting h/w |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
* know there are new descriptors to fetch. (Only |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
* applicable for weak-ordered memory model archs, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
* such as IA-64). |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
wmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
writel(i, adapter->hw.hw_addr + rx_ring->tail); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
if (i == rx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
rx_ring->next_to_use = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
* e1000_alloc_rx_buffers_ps - Replace used receive buffers; packet split |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
* @adapter: address of board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
int cleaned_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
union e1000_rx_desc_packet_split *rx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
struct e1000_ps_page *ps_page; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
struct sk_buff *skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
unsigned int i, j; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
i = rx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
while (cleaned_count--) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
for (j = 0; j < PS_PAGE_BUFFERS; j++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
ps_page = &buffer_info->ps_pages[j]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
if (j >= adapter->rx_ps_pages) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
/* all unused desc entries get hw null ptr */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
rx_desc->read.buffer_addr[j+1] = ~cpu_to_le64(0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
continue; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
if (!ps_page->page) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
ps_page->page = alloc_page(GFP_ATOMIC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
if (!ps_page->page) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
adapter->alloc_rx_buff_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
goto no_buffers; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
ps_page->dma = dma_map_page(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
ps_page->page, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
0, PAGE_SIZE, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
if (dma_mapping_error(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
ps_page->dma)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
dev_err(&adapter->pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
"RX DMA page map failed\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
adapter->rx_dma_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
goto no_buffers; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
* Refresh the desc even if buffer_addrs |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
* didn't change because each write-back |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
* erases this info. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
rx_desc->read.buffer_addr[j+1] = |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
cpu_to_le64(ps_page->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
skb = netdev_alloc_skb_ip_align(netdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
adapter->rx_ps_bsize0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
if (!skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
adapter->alloc_rx_buff_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
buffer_info->dma = dma_map_single(&pdev->dev, skb->data, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
adapter->rx_ps_bsize0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
dev_err(&pdev->dev, "RX DMA map failed\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
adapter->rx_dma_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
/* cleanup skb */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
dev_kfree_skb_any(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
buffer_info->skb = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
* Force memory writes to complete before letting h/w |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
* know there are new descriptors to fetch. (Only |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
* applicable for weak-ordered memory model archs, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
* such as IA-64). |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
wmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
writel(i<<1, adapter->hw.hw_addr + rx_ring->tail); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
if (i == rx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
no_buffers: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
rx_ring->next_to_use = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
* e1000_alloc_jumbo_rx_buffers - Replace used jumbo receive buffers |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
* @adapter: address of board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
* @cleaned_count: number of buffers to allocate this pass |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
static void e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
int cleaned_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
struct e1000_rx_desc *rx_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
struct sk_buff *skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
unsigned int bufsz = 256 - 16 /* for skb_reserve */; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
i = rx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
while (cleaned_count--) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
skb = buffer_info->skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
if (skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
skb_trim(skb, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
goto check_page; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
skb = netdev_alloc_skb_ip_align(netdev, bufsz); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
if (unlikely(!skb)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
/* Better luck next round */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
adapter->alloc_rx_buff_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
check_page: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
/* allocate a new page if necessary */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
if (!buffer_info->page) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
buffer_info->page = alloc_page(GFP_ATOMIC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
if (unlikely(!buffer_info->page)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
adapter->alloc_rx_buff_failed++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
if (!buffer_info->dma) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
buffer_info->dma = dma_map_page(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
718 |
buffer_info->page, 0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
PAGE_SIZE, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
if (unlikely(++i == rx_ring->count)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
if (likely(rx_ring->next_to_use != i)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
rx_ring->next_to_use = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
if (unlikely(i-- == 0)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
i = (rx_ring->count - 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
/* Force memory writes to complete before letting h/w |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
* know there are new descriptors to fetch. (Only |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
* applicable for weak-ordered memory model archs, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
* such as IA-64). */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
wmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
writel(i, adapter->hw.hw_addr + rx_ring->tail); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
* e1000_clean_rx_irq - Send received data up the network stack; legacy |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
* the return value indicates whether actual cleaning was done, there |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
* is no guarantee that everything was cleaned |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
int *work_done, int work_to_do) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
struct e1000_rx_desc *rx_desc, *next_rxd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
struct e1000_buffer *buffer_info, *next_buffer; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
u32 length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
int cleaned_count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
bool cleaned = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
unsigned int total_rx_bytes = 0, total_rx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
i = rx_ring->next_to_clean; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
while (rx_desc->status & E1000_RXD_STAT_DD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
struct sk_buff *skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
u8 status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
if (*work_done >= work_to_do) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
(*work_done)++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
rmb(); /* read descriptor and rx_buffer_info after status DD */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
status = rx_desc->status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
skb = buffer_info->skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
buffer_info->skb = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
prefetch(skb->data - NET_IP_ALIGN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
if (i == rx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
next_rxd = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
prefetch(next_rxd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
next_buffer = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
cleaned = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
cleaned_count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
dma_unmap_single(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
adapter->rx_buffer_len, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
buffer_info->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
length = le16_to_cpu(rx_desc->length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
* !EOP means multiple descriptors were used to store a single |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
* packet, if that's the case we need to toss it. In fact, we |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
* need to toss every packet with the EOP bit clear and the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
* next frame that _does_ have the EOP bit set, as it is by |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
* definition only a frame fragment |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
if (unlikely(!(status & E1000_RXD_STAT_EOP))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
adapter->flags2 |= FLAG2_IS_DISCARDING; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
if (adapter->flags2 & FLAG2_IS_DISCARDING) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
/* All receives must fit into a single buffer */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
e_dbg("Receive packet consumed multiple buffers\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
/* recycle */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
if (status & E1000_RXD_STAT_EOP) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
adapter->flags2 &= ~FLAG2_IS_DISCARDING; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
if (rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
/* recycle */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
/* adjust length to remove Ethernet CRC */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
length -= 4; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
total_rx_bytes += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
total_rx_packets++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
* code added for copybreak, this should improve |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
* performance for small packets with large amounts |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
* of reassembly being done in the stack |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
if (length < copybreak) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
struct sk_buff *new_skb = |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
netdev_alloc_skb_ip_align(netdev, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
if (new_skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
skb_copy_to_linear_data_offset(new_skb, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
-NET_IP_ALIGN, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
(skb->data - |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
NET_IP_ALIGN), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
(length + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
NET_IP_ALIGN)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
/* save the skb in buffer_info as good */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
skb = new_skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
/* else just continue with the old one */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
/* end copybreak code */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
skb_put(skb, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
/* Receive Checksum Offload */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
e1000_rx_checksum(adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
(u32)(status) | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
((u32)(rx_desc->errors) << 24), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
le16_to_cpu(rx_desc->csum), skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
e1000_receive_skb(adapter, netdev, skb,status,rx_desc->special); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
next_desc: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
rx_desc->status = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
/* return some buffers to hardware, one at a time is too slow */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
if (cleaned_count >= E1000_RX_BUFFER_WRITE) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
adapter->alloc_rx_buf(adapter, cleaned_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
cleaned_count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
/* use prefetched values */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
rx_desc = next_rxd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
buffer_info = next_buffer; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
rx_ring->next_to_clean = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
cleaned_count = e1000_desc_unused(rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
if (cleaned_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
adapter->alloc_rx_buf(adapter, cleaned_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
adapter->total_rx_bytes += total_rx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
adapter->total_rx_packets += total_rx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
netdev->stats.rx_bytes += total_rx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
netdev->stats.rx_packets += total_rx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
return cleaned; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
static void e1000_put_txbuf(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
struct e1000_buffer *buffer_info) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
if (buffer_info->dma) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
if (buffer_info->mapped_as_page) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
dma_unmap_page(&adapter->pdev->dev, buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
buffer_info->length, DMA_TO_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
dma_unmap_single(&adapter->pdev->dev, buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
buffer_info->length, DMA_TO_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
buffer_info->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
if (buffer_info->skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
dev_kfree_skb_any(buffer_info->skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
buffer_info->skb = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
buffer_info->time_stamp = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
static void e1000_print_hw_hang(struct work_struct *work) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
struct e1000_adapter *adapter = container_of(work, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
struct e1000_adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
print_hang_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
unsigned int i = tx_ring->next_to_clean; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
unsigned int eop = tx_ring->buffer_info[i].next_to_watch; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
struct e1000_tx_desc *eop_desc = E1000_TX_DESC(*tx_ring, eop); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
u16 phy_status, phy_1000t_status, phy_ext_status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
u16 pci_status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
e1e_rphy(hw, PHY_STATUS, &phy_status); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
pci_read_config_word(adapter->pdev, PCI_STATUS, &pci_status); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
/* detected Hardware unit hang */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
e_err("Detected Hardware Unit Hang:\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
" TDH <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
" TDT <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
" next_to_use <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
" next_to_clean <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
"buffer_info[next_to_clean]:\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
" time_stamp <%lx>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
" next_to_watch <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
" jiffies <%lx>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
" next_to_watch.status <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
"MAC Status <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
"PHY Status <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
"PHY 1000BASE-T Status <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
"PHY Extended Status <%x>\n" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
"PCI Status <%x>\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
readl(adapter->hw.hw_addr + tx_ring->head), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
readl(adapter->hw.hw_addr + tx_ring->tail), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
tx_ring->next_to_use, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
tx_ring->next_to_clean, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
tx_ring->buffer_info[eop].time_stamp, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
eop, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
jiffies, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
eop_desc->upper.fields.status, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
er32(STATUS), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
phy_status, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
phy_1000t_status, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
phy_ext_status, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
pci_status); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
* e1000_clean_tx_irq - Reclaim resources after transmit completes |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
* the return value indicates whether actual cleaning was done, there |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
* is no guarantee that everything was cleaned |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
struct e1000_tx_desc *tx_desc, *eop_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
unsigned int i, eop; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
unsigned int count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
unsigned int total_tx_bytes = 0, total_tx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
i = tx_ring->next_to_clean; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
eop = tx_ring->buffer_info[i].next_to_watch; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
eop_desc = E1000_TX_DESC(*tx_ring, eop); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
(count < tx_ring->count)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
bool cleaned = false; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
rmb(); /* read buffer_info after eop_desc */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
for (; !cleaned; count++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
tx_desc = E1000_TX_DESC(*tx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
cleaned = (i == eop); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
if (cleaned) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
total_tx_packets += buffer_info->segs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
total_tx_bytes += buffer_info->bytecount; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
e1000_put_txbuf(adapter, buffer_info); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
tx_desc->upper.data = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
if (i == tx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
if (i == tx_ring->next_to_use) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
eop = tx_ring->buffer_info[i].next_to_watch; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
eop_desc = E1000_TX_DESC(*tx_ring, eop); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
tx_ring->next_to_clean = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
#define TX_WAKE_THRESHOLD 32 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
if (count && netif_carrier_ok(netdev) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
/* Make sure that anybody stopping the queue after this |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
* sees the new next_to_clean. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
smp_mb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
if (netif_queue_stopped(netdev) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
!(test_bit(__E1000_DOWN, &adapter->state))) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
netif_wake_queue(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
++adapter->restart_queue; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
if (adapter->detect_tx_hung) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
* Detect a transmit hang in hardware, this serializes the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
* check with the clearing of time_stamp and movement of i |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
adapter->detect_tx_hung = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
if (tx_ring->buffer_info[i].time_stamp && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
time_after(jiffies, tx_ring->buffer_info[i].time_stamp |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
+ (adapter->tx_timeout_factor * HZ)) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
!(er32(STATUS) & E1000_STATUS_TXOFF)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
schedule_work(&adapter->print_hang_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
netif_stop_queue(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
adapter->total_tx_bytes += total_tx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
adapter->total_tx_packets += total_tx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
netdev->stats.tx_bytes += total_tx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
netdev->stats.tx_packets += total_tx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
return (count < tx_ring->count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
* e1000_clean_rx_irq_ps - Send received data up the network stack; packet split |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
* the return value indicates whether actual cleaning was done, there |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
* is no guarantee that everything was cleaned |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
int *work_done, int work_to_do) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
union e1000_rx_desc_packet_split *rx_desc, *next_rxd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
struct e1000_buffer *buffer_info, *next_buffer; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
struct e1000_ps_page *ps_page; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
struct sk_buff *skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
unsigned int i, j; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
u32 length, staterr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
int cleaned_count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
bool cleaned = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
unsigned int total_rx_bytes = 0, total_rx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
i = rx_ring->next_to_clean; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
while (staterr & E1000_RXD_STAT_DD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
if (*work_done >= work_to_do) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
(*work_done)++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
skb = buffer_info->skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
rmb(); /* read descriptor and rx_buffer_info after status DD */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
/* in the packet split case this is header only */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
prefetch(skb->data - NET_IP_ALIGN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
if (i == rx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
next_rxd = E1000_RX_DESC_PS(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
prefetch(next_rxd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
next_buffer = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
cleaned = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
cleaned_count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
dma_unmap_single(&pdev->dev, buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
adapter->rx_ps_bsize0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
buffer_info->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
/* see !EOP comment in other rx routine */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
if (!(staterr & E1000_RXD_STAT_EOP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
adapter->flags2 |= FLAG2_IS_DISCARDING; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
if (adapter->flags2 & FLAG2_IS_DISCARDING) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
e_dbg("Packet Split buffers didn't pick up the full " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
"packet\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
dev_kfree_skb_irq(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
if (staterr & E1000_RXD_STAT_EOP) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
adapter->flags2 &= ~FLAG2_IS_DISCARDING; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
dev_kfree_skb_irq(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
length = le16_to_cpu(rx_desc->wb.middle.length0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
if (!length) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
e_dbg("Last part of the packet spanning multiple " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
"descriptors\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
dev_kfree_skb_irq(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
/* Good Receive */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
skb_put(skb, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
* this looks ugly, but it seems compiler issues make it |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
* more efficient than reusing j |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
int l1 = le16_to_cpu(rx_desc->wb.upper.length[0]); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
* page alloc/put takes too long and effects small packet |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
* throughput, so unsplit small packets and save the alloc/put |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
* only valid in softirq (napi) context to call kmap_* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
if (l1 && (l1 <= copybreak) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
((length + l1) <= adapter->rx_ps_bsize0)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
u8 *vaddr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
ps_page = &buffer_info->ps_pages[0]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
* there is no documentation about how to call |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
* kmap_atomic, so we can't hold the mapping |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
* very long |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
dma_sync_single_for_cpu(&pdev->dev, ps_page->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
PAGE_SIZE, DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
vaddr = kmap_atomic(ps_page->page, KM_SKB_DATA_SOFTIRQ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
memcpy(skb_tail_pointer(skb), vaddr, l1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
dma_sync_single_for_device(&pdev->dev, ps_page->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
PAGE_SIZE, DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
/* remove the CRC */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
l1 -= 4; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
skb_put(skb, l1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
goto copydone; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
} /* if */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
for (j = 0; j < PS_PAGE_BUFFERS; j++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
length = le16_to_cpu(rx_desc->wb.upper.length[j]); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
if (!length) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
ps_page = &buffer_info->ps_pages[j]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
ps_page->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
skb_fill_page_desc(skb, j, ps_page->page, 0, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
ps_page->page = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
skb->len += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
skb->data_len += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
skb->truesize += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
/* strip the ethernet crc, problem is we're using pages now so |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
* this whole operation can get a little cpu intensive |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
if (!(adapter->flags2 & FLAG2_CRC_STRIPPING)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
pskb_trim(skb, skb->len - 4); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
copydone: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
total_rx_bytes += skb->len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
total_rx_packets++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
e1000_rx_checksum(adapter, staterr, le16_to_cpu( |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
rx_desc->wb.lower.hi_dword.csum_ip.csum), skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
if (rx_desc->wb.upper.header_status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
adapter->rx_hdr_split++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
e1000_receive_skb(adapter, netdev, skb, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
staterr, rx_desc->wb.middle.vlan); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
next_desc: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
rx_desc->wb.middle.status_error &= cpu_to_le32(~0xFF); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
buffer_info->skb = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
/* return some buffers to hardware, one at a time is too slow */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
if (cleaned_count >= E1000_RX_BUFFER_WRITE) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
adapter->alloc_rx_buf(adapter, cleaned_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
cleaned_count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
/* use prefetched values */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
rx_desc = next_rxd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
buffer_info = next_buffer; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
rx_ring->next_to_clean = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
cleaned_count = e1000_desc_unused(rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
if (cleaned_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
adapter->alloc_rx_buf(adapter, cleaned_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
adapter->total_rx_bytes += total_rx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
adapter->total_rx_packets += total_rx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
netdev->stats.rx_bytes += total_rx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
netdev->stats.rx_packets += total_rx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
return cleaned; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
* e1000_consume_page - helper function |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
u16 length) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
bi->page = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
skb->len += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
skb->data_len += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
skb->truesize += length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
* e1000_clean_jumbo_rx_irq - Send received data up the network stack; legacy |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
* the return value indicates whether actual cleaning was done, there |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
* is no guarantee that everything was cleaned |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
int *work_done, int work_to_do) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
struct e1000_rx_desc *rx_desc, *next_rxd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
struct e1000_buffer *buffer_info, *next_buffer; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
u32 length; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
int cleaned_count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
bool cleaned = false; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
unsigned int total_rx_bytes=0, total_rx_packets=0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
i = rx_ring->next_to_clean; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
while (rx_desc->status & E1000_RXD_STAT_DD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
struct sk_buff *skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
u8 status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
if (*work_done >= work_to_do) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
(*work_done)++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
rmb(); /* read descriptor and rx_buffer_info after status DD */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
status = rx_desc->status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
skb = buffer_info->skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
buffer_info->skb = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
++i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
if (i == rx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
next_rxd = E1000_RX_DESC(*rx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
prefetch(next_rxd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
next_buffer = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
cleaned = true; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
cleaned_count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
dma_unmap_page(&pdev->dev, buffer_info->dma, PAGE_SIZE, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
buffer_info->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
length = le16_to_cpu(rx_desc->length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
/* errors is only valid for DD + EOP descriptors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
if (unlikely((status & E1000_RXD_STAT_EOP) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK))) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
/* recycle both page and skb */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
/* an error means any chain goes out the window |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
* too */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
if (rx_ring->rx_skb_top) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
dev_kfree_skb(rx_ring->rx_skb_top); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
rx_ring->rx_skb_top = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
#define rxtop rx_ring->rx_skb_top |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
if (!(status & E1000_RXD_STAT_EOP)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
/* this descriptor is only the beginning (or middle) */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
if (!rxtop) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
/* this is the beginning of a chain */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
rxtop = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
skb_fill_page_desc(rxtop, 0, buffer_info->page, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
0, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
/* this is the middle of a chain */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
skb_fill_page_desc(rxtop, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
skb_shinfo(rxtop)->nr_frags, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
buffer_info->page, 0, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
/* re-use the skb, only consumed the page */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
e1000_consume_page(buffer_info, rxtop, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
if (rxtop) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
/* end of the chain */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
skb_fill_page_desc(rxtop, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
skb_shinfo(rxtop)->nr_frags, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
buffer_info->page, 0, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
/* re-use the current skb, we only consumed the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
* page */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
buffer_info->skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
skb = rxtop; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
rxtop = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
e1000_consume_page(buffer_info, skb, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
/* no chain, got EOP, this buf is the packet |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
* copybreak to save the put_page/alloc_page */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
if (length <= copybreak && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
skb_tailroom(skb) >= length) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
u8 *vaddr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
vaddr = kmap_atomic(buffer_info->page, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
KM_SKB_DATA_SOFTIRQ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
memcpy(skb_tail_pointer(skb), vaddr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
kunmap_atomic(vaddr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
KM_SKB_DATA_SOFTIRQ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
/* re-use the page, so don't erase |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
* buffer_info->page */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
skb_put(skb, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
skb_fill_page_desc(skb, 0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
buffer_info->page, 0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
e1000_consume_page(buffer_info, skb, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
/* Receive Checksum Offload XXX recompute due to CRC strip? */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
e1000_rx_checksum(adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
(u32)(status) | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
((u32)(rx_desc->errors) << 24), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
le16_to_cpu(rx_desc->csum), skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
/* probably a little skewed due to removing CRC */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
total_rx_bytes += skb->len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
total_rx_packets++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
/* eth type trans needs skb->data to point to something */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
if (!pskb_may_pull(skb, ETH_HLEN)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
e_err("pskb_may_pull failed.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
dev_kfree_skb(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
goto next_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
e1000_receive_skb(adapter, netdev, skb, status, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
rx_desc->special); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
next_desc: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
rx_desc->status = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
/* return some buffers to hardware, one at a time is too slow */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
adapter->alloc_rx_buf(adapter, cleaned_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
cleaned_count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
/* use prefetched values */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
rx_desc = next_rxd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
buffer_info = next_buffer; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
rx_ring->next_to_clean = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
cleaned_count = e1000_desc_unused(rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
if (cleaned_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
adapter->alloc_rx_buf(adapter, cleaned_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
adapter->total_rx_bytes += total_rx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
adapter->total_rx_packets += total_rx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
netdev->stats.rx_bytes += total_rx_bytes; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
netdev->stats.rx_packets += total_rx_packets; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
return cleaned; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
* e1000_clean_rx_ring - Free Rx Buffers per Queue |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
static void e1000_clean_rx_ring(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
struct e1000_ps_page *ps_page; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
unsigned int i, j; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1433 |
/* Free all the Rx ring sk_buffs */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1434 |
for (i = 0; i < rx_ring->count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1435 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
if (buffer_info->dma) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
if (adapter->clean_rx == e1000_clean_rx_irq) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
dma_unmap_single(&pdev->dev, buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
adapter->rx_buffer_len, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
else if (adapter->clean_rx == e1000_clean_jumbo_rx_irq) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
dma_unmap_page(&pdev->dev, buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
PAGE_SIZE, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
else if (adapter->clean_rx == e1000_clean_rx_irq_ps) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
dma_unmap_single(&pdev->dev, buffer_info->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
adapter->rx_ps_bsize0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
buffer_info->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
if (buffer_info->page) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
put_page(buffer_info->page); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
buffer_info->page = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
if (buffer_info->skb) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
dev_kfree_skb(buffer_info->skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
buffer_info->skb = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
for (j = 0; j < PS_PAGE_BUFFERS; j++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
ps_page = &buffer_info->ps_pages[j]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
if (!ps_page->page) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
DMA_FROM_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
ps_page->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
put_page(ps_page->page); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
ps_page->page = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
/* there also may be some cached data from a chained receive */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
if (rx_ring->rx_skb_top) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
dev_kfree_skb(rx_ring->rx_skb_top); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
rx_ring->rx_skb_top = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
/* Zero out the descriptor ring */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
memset(rx_ring->desc, 0, rx_ring->size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
rx_ring->next_to_clean = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
rx_ring->next_to_use = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
adapter->flags2 &= ~FLAG2_IS_DISCARDING; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
writel(0, adapter->hw.hw_addr + rx_ring->head); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
writel(0, adapter->hw.hw_addr + rx_ring->tail); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
static void e1000e_downshift_workaround(struct work_struct *work) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
struct e1000_adapter *adapter = container_of(work, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
struct e1000_adapter, downshift_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
e1000e_gig_downshift_workaround_ich8lan(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
* e1000_intr_msi - Interrupt Handler |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
* @irq: interrupt number |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
* @data: pointer to a network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
static irqreturn_t e1000_intr_msi(int irq, void *data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
struct net_device *netdev = data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
u32 icr = er32(ICR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
* read ICR disables interrupts using IAM |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
if (icr & E1000_ICR_LSC) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
hw->mac.get_link_status = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
* ICH8 workaround-- Call gig speed drop workaround on cable |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
* disconnect (LSC) before accessing any PHY registers |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
(!(er32(STATUS) & E1000_STATUS_LU))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
schedule_work(&adapter->downshift_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
* 80003ES2LAN workaround-- For packet buffer work-around on |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
* link down event; disable receives here in the ISR and reset |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
* adapter in watchdog |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
if (netif_carrier_ok(netdev) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
adapter->flags & FLAG_RX_NEEDS_RESTART) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
/* disable receives */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
u32 rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
ew32(RCTL, rctl & ~E1000_RCTL_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
adapter->flags |= FLAG_RX_RESTART_NOW; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
/* guard against interrupt when we're going down */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
mod_timer(&adapter->watchdog_timer, jiffies + 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
if (napi_schedule_prep(&adapter->napi)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
adapter->total_tx_bytes = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
adapter->total_tx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
adapter->total_rx_bytes = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
adapter->total_rx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
__napi_schedule(&adapter->napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
return IRQ_HANDLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
* e1000_intr - Interrupt Handler |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
* @irq: interrupt number |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
* @data: pointer to a network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
static irqreturn_t e1000_intr(int irq, void *data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
struct net_device *netdev = data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
u32 rctl, icr = er32(ICR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
if (!icr || test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
return IRQ_NONE; /* Not our interrupt */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
* IMS will not auto-mask if INT_ASSERTED is not set, and if it is |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
* not set, then the adapter didn't send an interrupt |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
if (!(icr & E1000_ICR_INT_ASSERTED)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
return IRQ_NONE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
* Interrupt Auto-Mask...upon reading ICR, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
* interrupts are masked. No need for the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
* IMC write |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
if (icr & E1000_ICR_LSC) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
hw->mac.get_link_status = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
* ICH8 workaround-- Call gig speed drop workaround on cable |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
* disconnect (LSC) before accessing any PHY registers |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
(!(er32(STATUS) & E1000_STATUS_LU))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
schedule_work(&adapter->downshift_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
* 80003ES2LAN workaround-- |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
* For packet buffer work-around on link down event; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
* disable receives here in the ISR and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
* reset adapter in watchdog |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
if (netif_carrier_ok(netdev) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
(adapter->flags & FLAG_RX_NEEDS_RESTART)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
/* disable receives */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
ew32(RCTL, rctl & ~E1000_RCTL_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
adapter->flags |= FLAG_RX_RESTART_NOW; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
/* guard against interrupt when we're going down */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
mod_timer(&adapter->watchdog_timer, jiffies + 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
if (napi_schedule_prep(&adapter->napi)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
adapter->total_tx_bytes = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
adapter->total_tx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
adapter->total_rx_bytes = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
adapter->total_rx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
__napi_schedule(&adapter->napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
return IRQ_HANDLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
static irqreturn_t e1000_msix_other(int irq, void *data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
struct net_device *netdev = data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
u32 icr = er32(ICR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
if (!(icr & E1000_ICR_INT_ASSERTED)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
ew32(IMS, E1000_IMS_OTHER); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
return IRQ_NONE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
if (icr & adapter->eiac_mask) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
ew32(ICS, (icr & adapter->eiac_mask)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
if (icr & E1000_ICR_OTHER) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
if (!(icr & E1000_ICR_LSC)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
goto no_link_interrupt; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
hw->mac.get_link_status = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
/* guard against interrupt when we're going down */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
mod_timer(&adapter->watchdog_timer, jiffies + 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
no_link_interrupt: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
ew32(IMS, E1000_IMS_LSC | E1000_IMS_OTHER); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
return IRQ_HANDLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
static irqreturn_t e1000_intr_msix_tx(int irq, void *data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
struct net_device *netdev = data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
adapter->total_tx_bytes = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
adapter->total_tx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
if (!e1000_clean_tx_irq(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
/* Ring was not completely cleaned, so fire another interrupt */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
ew32(ICS, tx_ring->ims_val); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1667 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
return IRQ_HANDLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
static irqreturn_t e1000_intr_msix_rx(int irq, void *data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1672 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1673 |
struct net_device *netdev = data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
/* Write the ITR value calculated at the end of the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
* previous interrupt. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
if (adapter->rx_ring->set_itr) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
writel(1000000000 / (adapter->rx_ring->itr_val * 256), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
adapter->hw.hw_addr + adapter->rx_ring->itr_register); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
adapter->rx_ring->set_itr = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
if (napi_schedule_prep(&adapter->napi)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
adapter->total_rx_bytes = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
adapter->total_rx_packets = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
__napi_schedule(&adapter->napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
return IRQ_HANDLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
* e1000_configure_msix - Configure MSI-X hardware |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
* e1000_configure_msix sets up the hardware to properly |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
* generate MSI-X interrupts. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
static void e1000_configure_msix(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
int vector = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
u32 ctrl_ext, ivar = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
adapter->eiac_mask = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
/* Workaround issue with spurious interrupts on 82574 in MSI-X mode */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
if (hw->mac.type == e1000_82574) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
u32 rfctl = er32(RFCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
rfctl |= E1000_RFCTL_ACK_DIS; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
ew32(RFCTL, rfctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
#define E1000_IVAR_INT_ALLOC_VALID 0x8 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
/* Configure Rx vector */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
rx_ring->ims_val = E1000_IMS_RXQ0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
adapter->eiac_mask |= rx_ring->ims_val; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
if (rx_ring->itr_val) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
writel(1000000000 / (rx_ring->itr_val * 256), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
hw->hw_addr + rx_ring->itr_register); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
writel(1, hw->hw_addr + rx_ring->itr_register); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
ivar = E1000_IVAR_INT_ALLOC_VALID | vector; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1726 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1727 |
/* Configure Tx vector */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
tx_ring->ims_val = E1000_IMS_TXQ0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
vector++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
if (tx_ring->itr_val) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
writel(1000000000 / (tx_ring->itr_val * 256), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
hw->hw_addr + tx_ring->itr_register); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
writel(1, hw->hw_addr + tx_ring->itr_register); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
adapter->eiac_mask |= tx_ring->ims_val; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
ivar |= ((E1000_IVAR_INT_ALLOC_VALID | vector) << 8); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
/* set vector for Other Causes, e.g. link changes */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
vector++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
ivar |= ((E1000_IVAR_INT_ALLOC_VALID | vector) << 16); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
if (rx_ring->itr_val) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
writel(1000000000 / (rx_ring->itr_val * 256), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
hw->hw_addr + E1000_EITR_82574(vector)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
writel(1, hw->hw_addr + E1000_EITR_82574(vector)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
/* Cause Tx interrupts on every write back */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
ivar |= (1 << 31); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
ew32(IVAR, ivar); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
/* enable MSI-X PBA support */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
ctrl_ext = er32(CTRL_EXT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
ctrl_ext |= E1000_CTRL_EXT_PBA_CLR; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
/* Auto-Mask Other interrupts upon ICR read */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
#define E1000_EIAC_MASK_82574 0x01F00000 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
ew32(IAM, ~E1000_EIAC_MASK_82574 | E1000_IMS_OTHER); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
ctrl_ext |= E1000_CTRL_EXT_EIAME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
ew32(CTRL_EXT, ctrl_ext); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
if (adapter->msix_entries) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
pci_disable_msix(adapter->pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
kfree(adapter->msix_entries); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
adapter->msix_entries = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
} else if (adapter->flags & FLAG_MSI_ENABLED) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
pci_disable_msi(adapter->pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
adapter->flags &= ~FLAG_MSI_ENABLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
* e1000e_set_interrupt_capability - set MSI or MSI-X if supported |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
* Attempt to configure interrupts using the best available |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
* capabilities of the hardware and kernel. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
void e1000e_set_interrupt_capability(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
int numvecs, i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
switch (adapter->int_mode) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
case E1000E_INT_MODE_MSIX: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
if (adapter->flags & FLAG_HAS_MSIX) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
numvecs = 3; /* RxQ0, TxQ0 and other */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
adapter->msix_entries = kcalloc(numvecs, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
sizeof(struct msix_entry), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
GFP_KERNEL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
if (adapter->msix_entries) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
for (i = 0; i < numvecs; i++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
adapter->msix_entries[i].entry = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
err = pci_enable_msix(adapter->pdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
adapter->msix_entries, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
numvecs); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
if (err == 0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
/* MSI-X failed, so fall through and try MSI */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
e_err("Failed to initialize MSI-X interrupts. " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
"Falling back to MSI interrupts.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
adapter->int_mode = E1000E_INT_MODE_MSI; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
/* Fall through */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
case E1000E_INT_MODE_MSI: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
if (!pci_enable_msi(adapter->pdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
adapter->flags |= FLAG_MSI_ENABLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
adapter->int_mode = E1000E_INT_MODE_LEGACY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
e_err("Failed to initialize MSI interrupts. Falling " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
"back to legacy interrupts.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
/* Fall through */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
case E1000E_INT_MODE_LEGACY: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
/* Don't do anything; this is the system default */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
* e1000_request_msix - Initialize MSI-X interrupts |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
* e1000_request_msix allocates MSI-X vectors and requests interrupts from the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
* kernel. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1832 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
static int e1000_request_msix(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
int err = 0, vector = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
if (strlen(netdev->name) < (IFNAMSIZ - 5)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
sprintf(adapter->rx_ring->name, "%s-rx-0", netdev->name); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
err = request_irq(adapter->msix_entries[vector].vector, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
e1000_intr_msix_rx, 0, adapter->rx_ring->name, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
goto out; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1847 |
adapter->rx_ring->itr_register = E1000_EITR_82574(vector); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
adapter->rx_ring->itr_val = adapter->itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
vector++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
if (strlen(netdev->name) < (IFNAMSIZ - 5)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
err = request_irq(adapter->msix_entries[vector].vector, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
e1000_intr_msix_tx, 0, adapter->tx_ring->name, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
goto out; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
adapter->tx_ring->itr_register = E1000_EITR_82574(vector); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
adapter->tx_ring->itr_val = adapter->itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
vector++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
err = request_irq(adapter->msix_entries[vector].vector, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
e1000_msix_other, 0, netdev->name, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
goto out; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1868 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1869 |
e1000_configure_msix(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
out: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
* e1000_request_irq - initialize interrupts |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
* Attempts to configure interrupts using the best available |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
* capabilities of the hardware and kernel. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
static int e1000_request_irq(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
if (adapter->msix_entries) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
err = e1000_request_msix(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
if (!err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
/* fall back to MSI */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
adapter->int_mode = E1000E_INT_MODE_MSI; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
e1000e_set_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1895 |
if (adapter->flags & FLAG_MSI_ENABLED) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
err = request_irq(adapter->pdev->irq, e1000_intr_msi, 0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
netdev->name, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1898 |
if (!err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1899 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
/* fall back to legacy interrupt */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
adapter->int_mode = E1000E_INT_MODE_LEGACY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
err = request_irq(adapter->pdev->irq, e1000_intr, IRQF_SHARED, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
netdev->name, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
e_err("Unable to allocate interrupt, Error: %d\n", err); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
static void e1000_free_irq(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
if (adapter->msix_entries) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
int vector = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
free_irq(adapter->msix_entries[vector].vector, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
vector++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
free_irq(adapter->msix_entries[vector].vector, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
vector++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
/* Other Causes interrupt vector */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
free_irq(adapter->msix_entries[vector].vector, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
free_irq(adapter->pdev->irq, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
* e1000_irq_disable - Mask off interrupt generation on the NIC |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
static void e1000_irq_disable(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
ew32(IMC, ~0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
ew32(EIAC_82574, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
synchronize_irq(adapter->pdev->irq); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
* e1000_irq_enable - Enable default interrupt generation settings |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
static void e1000_irq_enable(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
if (adapter->msix_entries) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
ew32(IMS, IMS_ENABLE_MASK); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
* e1000_get_hw_control - get control of the h/w from f/w |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
* @adapter: address of board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
* e1000_get_hw_control sets {CTRL_EXT|SWSM}:DRV_LOAD bit. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
* For ASF and Pass Through versions of f/w this means that |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
* the driver is loaded. For AMT version (only with 82573) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
* of the f/w this means that the network i/f is open. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
static void e1000_get_hw_control(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
u32 ctrl_ext; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
u32 swsm; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
/* Let firmware know the driver has taken over */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
if (adapter->flags & FLAG_HAS_SWSM_ON_LOAD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
swsm = er32(SWSM); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
ew32(SWSM, swsm | E1000_SWSM_DRV_LOAD); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
} else if (adapter->flags & FLAG_HAS_CTRLEXT_ON_LOAD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
ctrl_ext = er32(CTRL_EXT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
* e1000_release_hw_control - release control of the h/w to f/w |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
* @adapter: address of board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
* e1000_release_hw_control resets {CTRL_EXT|SWSM}:DRV_LOAD bit. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
* For ASF and Pass Through versions of f/w this means that the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
* driver is no longer loaded. For AMT version (only with 82573) i |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
* of the f/w this means that the network i/f is closed. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
static void e1000_release_hw_control(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
u32 ctrl_ext; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
u32 swsm; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
/* Let firmware taken over control of h/w */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
if (adapter->flags & FLAG_HAS_SWSM_ON_LOAD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
swsm = er32(SWSM); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
ew32(SWSM, swsm & ~E1000_SWSM_DRV_LOAD); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
} else if (adapter->flags & FLAG_HAS_CTRLEXT_ON_LOAD) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
ctrl_ext = er32(CTRL_EXT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
ew32(CTRL_EXT, ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
* @e1000_alloc_ring - allocate memory for a ring structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
static int e1000_alloc_ring_dma(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
struct e1000_ring *ring) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
GFP_KERNEL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
if (!ring->desc) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
return -ENOMEM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
* e1000e_setup_tx_resources - allocate Tx resources (Descriptors) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
* Return 0 on success, negative on failure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
int e1000e_setup_tx_resources(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
int err = -ENOMEM, size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
size = sizeof(struct e1000_buffer) * tx_ring->count; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
tx_ring->buffer_info = vmalloc(size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
if (!tx_ring->buffer_info) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
goto err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
memset(tx_ring->buffer_info, 0, size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
/* round up to nearest 4K */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
tx_ring->size = ALIGN(tx_ring->size, 4096); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
err = e1000_alloc_ring_dma(adapter, tx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
goto err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
tx_ring->next_to_use = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
tx_ring->next_to_clean = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
err: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
vfree(tx_ring->buffer_info); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
e_err("Unable to allocate memory for the transmit descriptor ring\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
* e1000e_setup_rx_resources - allocate Rx resources (Descriptors) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
* Returns 0 on success, negative on failure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
int e1000e_setup_rx_resources(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
int i, size, desc_len, err = -ENOMEM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
size = sizeof(struct e1000_buffer) * rx_ring->count; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
rx_ring->buffer_info = vmalloc(size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
if (!rx_ring->buffer_info) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
goto err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
memset(rx_ring->buffer_info, 0, size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
for (i = 0; i < rx_ring->count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
buffer_info->ps_pages = kcalloc(PS_PAGE_BUFFERS, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
sizeof(struct e1000_ps_page), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
GFP_KERNEL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
if (!buffer_info->ps_pages) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
goto err_pages; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
desc_len = sizeof(union e1000_rx_desc_packet_split); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
/* Round up to nearest 4K */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
rx_ring->size = rx_ring->count * desc_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
rx_ring->size = ALIGN(rx_ring->size, 4096); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
err = e1000_alloc_ring_dma(adapter, rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
goto err_pages; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
rx_ring->next_to_clean = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
rx_ring->next_to_use = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
rx_ring->rx_skb_top = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
err_pages: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
for (i = 0; i < rx_ring->count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
buffer_info = &rx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
kfree(buffer_info->ps_pages); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
err: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
vfree(rx_ring->buffer_info); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
e_err("Unable to allocate memory for the transmit descriptor ring\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
* e1000_clean_tx_ring - Free Tx Buffers |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
static void e1000_clean_tx_ring(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
unsigned long size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
for (i = 0; i < tx_ring->count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
e1000_put_txbuf(adapter, buffer_info); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
size = sizeof(struct e1000_buffer) * tx_ring->count; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
memset(tx_ring->buffer_info, 0, size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
memset(tx_ring->desc, 0, tx_ring->size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
tx_ring->next_to_use = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
tx_ring->next_to_clean = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
writel(0, adapter->hw.hw_addr + tx_ring->head); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
writel(0, adapter->hw.hw_addr + tx_ring->tail); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
* e1000e_free_tx_resources - Free Tx Resources per Queue |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
* Free all transmit software resources |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
void e1000e_free_tx_resources(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
e1000_clean_tx_ring(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
vfree(tx_ring->buffer_info); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
tx_ring->buffer_info = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
tx_ring->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
tx_ring->desc = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
* e1000e_free_rx_resources - Free Rx Resources |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
* Free all receive software resources |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
void e1000e_free_rx_resources(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
e1000_clean_rx_ring(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
for (i = 0; i < rx_ring->count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
kfree(rx_ring->buffer_info[i].ps_pages); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
vfree(rx_ring->buffer_info); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
rx_ring->buffer_info = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
rx_ring->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
rx_ring->desc = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
* e1000_update_itr - update the dynamic ITR value based on statistics |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
* @adapter: pointer to adapter |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
* @itr_setting: current adapter->itr |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
* @packets: the number of packets during this measurement interval |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
* @bytes: the number of bytes during this measurement interval |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
* Stores a new ITR value based on packets and byte |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
* counts during the last interrupt. The advantage of per interrupt |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
* computation is faster updates and more accurate ITR for the current |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
* traffic pattern. Constants in this function were computed |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
* based on theoretical maximum wire speed and thresholds were set based |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
* on testing data as well as attempting to minimize response time |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
* while increasing bulk throughput. This functionality is controlled |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
* by the InterruptThrottleRate module parameter. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
static unsigned int e1000_update_itr(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
u16 itr_setting, int packets, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
int bytes) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
unsigned int retval = itr_setting; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
if (packets == 0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
goto update_itr_done; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
switch (itr_setting) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
case lowest_latency: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
/* handle TSO and jumbo frames */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
if (bytes/packets > 8000) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
retval = bulk_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
else if ((packets < 5) && (bytes > 512)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
retval = low_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
case low_latency: /* 50 usec aka 20000 ints/s */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
if (bytes > 10000) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
/* this if handles the TSO accounting */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
if (bytes/packets > 8000) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
retval = bulk_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
} else if ((packets < 10) || ((bytes/packets) > 1200)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
retval = bulk_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
} else if ((packets > 35)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
retval = lowest_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
} else if (bytes/packets > 2000) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
retval = bulk_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
} else if (packets <= 2 && bytes < 512) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
retval = lowest_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
case bulk_latency: /* 250 usec aka 4000 ints/s */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
if (bytes > 25000) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
if (packets > 35) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
retval = low_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
} else if (bytes < 6000) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
retval = low_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
update_itr_done: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
return retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
static void e1000_set_itr(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
u16 current_itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
u32 new_itr = adapter->itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
/* for non-gigabit speeds, just fix the interrupt rate at 4000 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
if (adapter->link_speed != SPEED_1000) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
current_itr = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
new_itr = 4000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
goto set_itr_now; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
adapter->tx_itr = e1000_update_itr(adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
adapter->tx_itr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
adapter->total_tx_packets, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
adapter->total_tx_bytes); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
/* conservative mode (itr 3) eliminates the lowest_latency setting */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
if (adapter->itr_setting == 3 && adapter->tx_itr == lowest_latency) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
adapter->tx_itr = low_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
adapter->rx_itr = e1000_update_itr(adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
adapter->rx_itr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
adapter->total_rx_packets, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
adapter->total_rx_bytes); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
/* conservative mode (itr 3) eliminates the lowest_latency setting */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
if (adapter->itr_setting == 3 && adapter->rx_itr == lowest_latency) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
adapter->rx_itr = low_latency; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
current_itr = max(adapter->rx_itr, adapter->tx_itr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
switch (current_itr) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
/* counts and packets in update_itr are dependent on these numbers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
case lowest_latency: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
new_itr = 70000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
case low_latency: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
new_itr = 20000; /* aka hwitr = ~200 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
case bulk_latency: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
new_itr = 4000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
set_itr_now: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
if (new_itr != adapter->itr) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
* this attempts to bias the interrupt rate towards Bulk |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
* by adding intermediate steps when interrupt rate is |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
* increasing |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2314 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2315 |
new_itr = new_itr > adapter->itr ? |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2316 |
min(adapter->itr + (new_itr >> 2), new_itr) : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2317 |
new_itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2318 |
adapter->itr = new_itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2319 |
adapter->rx_ring->itr_val = new_itr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2320 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2321 |
adapter->rx_ring->set_itr = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2322 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2323 |
ew32(ITR, 1000000000 / (new_itr * 256)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
* e1000_alloc_queues - Allocate memory for all rings |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
* @adapter: board private structure to initialize |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
static int __devinit e1000_alloc_queues(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
adapter->tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
if (!adapter->tx_ring) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
goto err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
adapter->rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2338 |
if (!adapter->rx_ring) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
goto err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2340 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2342 |
err: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
e_err("Unable to allocate memory for queues\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
kfree(adapter->rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
kfree(adapter->tx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
return -ENOMEM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
* e1000_clean - NAPI Rx polling callback |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
* @napi: struct associated with this polling callback |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
* @budget: amount of packets driver is allowed to process this poll |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
static int e1000_clean(struct napi_struct *napi, int budget) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
struct net_device *poll_dev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
int tx_cleaned = 1, work_done = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
adapter = netdev_priv(poll_dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
if (adapter->msix_entries && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
!(adapter->rx_ring->ims_val & adapter->tx_ring->ims_val)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
goto clean_rx; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
tx_cleaned = e1000_clean_tx_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
clean_rx: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
adapter->clean_rx(adapter, &work_done, budget); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
if (!tx_cleaned) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
work_done = budget; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
/* If budget not fully consumed, exit the polling mode */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
if (work_done < budget) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
if (adapter->itr_setting & 3) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
e1000_set_itr(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
napi_complete(napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
if (!test_bit(__E1000_DOWN, &adapter->state)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
ew32(IMS, adapter->rx_ring->ims_val); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
e1000_irq_enable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
return work_done; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
u32 vfta, index; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
/* don't update vlan cookie if already programmed */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
if ((adapter->hw.mng_cookie.status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
(vid == adapter->mng_vlan_id)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
/* add VID to filter table */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
index = (vid >> 5) & 0x7F; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
vfta |= (1 << (vid & 0x1F)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
hw->mac.ops.write_vfta(hw, index, vfta); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
u32 vfta, index; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
e1000_irq_disable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
vlan_group_set_device(adapter->vlgrp, vid, NULL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
e1000_irq_enable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
if ((adapter->hw.mng_cookie.status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
(vid == adapter->mng_vlan_id)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
/* release control to f/w */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
e1000_release_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
/* remove VID from filter table */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
index = (vid >> 5) & 0x7F; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
vfta = E1000_READ_REG_ARRAY(hw, E1000_VFTA, index); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
vfta &= ~(1 << (vid & 0x1F)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
hw->mac.ops.write_vfta(hw, index, vfta); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
static void e1000_update_mng_vlan(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
u16 vid = adapter->hw.mng_cookie.vlan_id; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
u16 old_vid = adapter->mng_vlan_id; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
if (!adapter->vlgrp) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
if (!vlan_group_get_device(adapter->vlgrp, vid)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
if (adapter->hw.mng_cookie.status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
e1000_vlan_rx_add_vid(netdev, vid); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
adapter->mng_vlan_id = vid; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
if ((old_vid != (u16)E1000_MNG_VLAN_NONE) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
(vid != old_vid) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
!vlan_group_get_device(adapter->vlgrp, old_vid)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
e1000_vlan_rx_kill_vid(netdev, old_vid); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
adapter->mng_vlan_id = vid; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
static void e1000_vlan_rx_register(struct net_device *netdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
struct vlan_group *grp) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
u32 ctrl, rctl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
e1000_irq_disable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
adapter->vlgrp = grp; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
if (grp) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
/* enable VLAN tag insert/strip */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
ctrl = er32(CTRL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
ctrl |= E1000_CTRL_VME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
ew32(CTRL, ctrl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
/* enable VLAN receive filtering */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
rctl &= ~E1000_RCTL_CFIEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
ew32(RCTL, rctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
e1000_update_mng_vlan(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
/* disable VLAN tag insert/strip */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
ctrl = er32(CTRL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
ctrl &= ~E1000_CTRL_VME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
ew32(CTRL, ctrl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
if (adapter->mng_vlan_id != |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
(u16)E1000_MNG_VLAN_NONE) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
e1000_vlan_rx_kill_vid(netdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
adapter->mng_vlan_id); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
e1000_irq_enable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
static void e1000_restore_vlan(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
u16 vid; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
e1000_vlan_rx_register(adapter->netdev, adapter->vlgrp); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
if (!adapter->vlgrp) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
if (!vlan_group_get_device(adapter->vlgrp, vid)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
continue; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
e1000_vlan_rx_add_vid(adapter->netdev, vid); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
static void e1000_init_manageability_pt(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
u32 manc, manc2h, mdef, i, j; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
if (!(adapter->flags & FLAG_MNG_PT_ENABLED)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
manc = er32(MANC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
* enable receiving management packets to the host. this will probably |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
* generate destination unreachable messages from the host OS, but |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
* the packets will be handled on SMBUS |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
manc |= E1000_MANC_EN_MNG2HOST; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
manc2h = er32(MANC2H); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
switch (hw->mac.type) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
manc2h |= (E1000_MANC2H_PORT_623 | E1000_MANC2H_PORT_664); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
case e1000_82574: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
case e1000_82583: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
* Check if IPMI pass-through decision filter already exists; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
* if so, enable it. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
for (i = 0, j = 0; i < 8; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
mdef = er32(MDEF(i)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
/* Ignore filters with anything other than IPMI ports */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
if (mdef & ~(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
continue; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
/* Enable this decision filter in MANC2H */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
if (mdef) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
manc2h |= (1 << i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
j |= mdef; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
if (j == (E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
/* Create new decision filter in an empty filter */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
for (i = 0, j = 0; i < 8; i++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
if (er32(MDEF(i)) == 0) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
ew32(MDEF(i), (E1000_MDEF_PORT_623 | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
E1000_MDEF_PORT_664)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
manc2h |= (1 << 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
j++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
if (!j) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
e_warn("Unable to create IPMI pass-through filter\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
ew32(MANC2H, manc2h); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
ew32(MANC, manc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
* e1000_configure_tx - Configure 8254x Transmit Unit after Reset |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
* Configure the Tx unit of the MAC after a reset. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
static void e1000_configure_tx(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
u64 tdba; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
u32 tdlen, tctl, tipg, tarc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
u32 ipgr1, ipgr2; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
/* Setup the HW Tx Head and Tail descriptor pointers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
tdba = tx_ring->dma; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
tdlen = tx_ring->count * sizeof(struct e1000_tx_desc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
ew32(TDBAL, (tdba & DMA_BIT_MASK(32))); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
ew32(TDBAH, (tdba >> 32)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
ew32(TDLEN, tdlen); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
ew32(TDH, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
ew32(TDT, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
tx_ring->head = E1000_TDH; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
tx_ring->tail = E1000_TDT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
/* Set the default values for the Tx Inter Packet Gap timer */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
tipg = DEFAULT_82543_TIPG_IPGT_COPPER; /* 8 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
ipgr1 = DEFAULT_82543_TIPG_IPGR1; /* 8 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
ipgr2 = DEFAULT_82543_TIPG_IPGR2; /* 6 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
if (adapter->flags & FLAG_TIPG_MEDIUM_FOR_80003ESLAN) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
ipgr2 = DEFAULT_80003ES2LAN_TIPG_IPGR2; /* 7 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
tipg |= ipgr1 << E1000_TIPG_IPGR1_SHIFT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
tipg |= ipgr2 << E1000_TIPG_IPGR2_SHIFT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
ew32(TIPG, tipg); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
/* Set the Tx Interrupt Delay register */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
ew32(TIDV, adapter->tx_int_delay); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
/* Tx irq moderation */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
ew32(TADV, adapter->tx_abs_int_delay); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
/* Program the Transmit Control Register */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
tctl = er32(TCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
tctl &= ~E1000_TCTL_CT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
(E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
if (adapter->flags & FLAG_TARC_SPEED_MODE_BIT) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2642 |
tarc = er32(TARC(0)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2643 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2644 |
* set the speed mode bit, we'll clear it if we're not at |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2645 |
* gigabit link later |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2646 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2647 |
#define SPEED_MODE_BIT (1 << 21) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2648 |
tarc |= SPEED_MODE_BIT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2649 |
ew32(TARC(0), tarc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2650 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2651 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
/* errata: program both queues to unweighted RR */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
if (adapter->flags & FLAG_TARC_SET_BIT_ZERO) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
tarc = er32(TARC(0)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
tarc |= 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
ew32(TARC(0), tarc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
tarc = er32(TARC(1)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
tarc |= 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
ew32(TARC(1), tarc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
/* Setup Transmit Descriptor Settings for eop descriptor */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
adapter->txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
/* only set IDE if we are delaying interrupts using the timers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
if (adapter->tx_int_delay) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
adapter->txd_cmd |= E1000_TXD_CMD_IDE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2669 |
/* enable Report Status bit */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2670 |
adapter->txd_cmd |= E1000_TXD_CMD_RS; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
ew32(TCTL, tctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
e1000e_config_collision_dist(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2678 |
* e1000_setup_rctl - configure the receive control registers |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2679 |
* @adapter: Board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
#define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
(((S) & (PAGE_SIZE - 1)) ? 1 : 0)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2683 |
static void e1000_setup_rctl(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2684 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2685 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2686 |
u32 rctl, rfctl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2687 |
u32 psrctl = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2688 |
u32 pages = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2689 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2690 |
/* Program MC offset vector base */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2691 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2692 |
rctl &= ~(3 << E1000_RCTL_MO_SHIFT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2693 |
rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2694 |
E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2695 |
(adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2696 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2697 |
/* Do not Store bad packets */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2698 |
rctl &= ~E1000_RCTL_SBP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
/* Enable Long Packet receive */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
if (adapter->netdev->mtu <= ETH_DATA_LEN) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
rctl &= ~E1000_RCTL_LPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
rctl |= E1000_RCTL_LPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
/* Some systems expect that the CRC is included in SMBUS traffic. The |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
* hardware strips the CRC before sending to both SMBUS (BMC) and to |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
* host memory when this is enabled |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
if (adapter->flags2 & FLAG2_CRC_STRIPPING) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2711 |
rctl |= E1000_RCTL_SECRC; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2712 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
/* Workaround Si errata on 82577 PHY - configure IPG for jumbos */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
if ((hw->phy.type == e1000_phy_82577) && (rctl & E1000_RCTL_LPE)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
u16 phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
e1e_rphy(hw, PHY_REG(770, 26), &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
phy_data &= 0xfff8; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
phy_data |= (1 << 2); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
e1e_wphy(hw, PHY_REG(770, 26), phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
e1e_rphy(hw, 22, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
phy_data &= 0x0fff; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
phy_data |= (1 << 14); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
e1e_wphy(hw, 0x10, 0x2823); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
e1e_wphy(hw, 0x11, 0x0003); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
e1e_wphy(hw, 22, phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
/* Setup buffer sizes */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
rctl &= ~E1000_RCTL_SZ_4096; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
rctl |= E1000_RCTL_BSEX; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
switch (adapter->rx_buffer_len) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
case 2048: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
rctl |= E1000_RCTL_SZ_2048; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
rctl &= ~E1000_RCTL_BSEX; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
case 4096: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
rctl |= E1000_RCTL_SZ_4096; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
case 8192: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
rctl |= E1000_RCTL_SZ_8192; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
case 16384: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
rctl |= E1000_RCTL_SZ_16384; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
* 82571 and greater support packet-split where the protocol |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
* header is placed in skb->data and the packet data is |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
* placed in pages hanging off of skb_shinfo(skb)->nr_frags. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
* In the case of a non-split, skb->data is linearly filled, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
* followed by the page buffers. Therefore, skb->data is |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
* sized to hold the largest protocol header. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
* allocations using alloc_page take too long for regular MTU |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
* so only enable packet split for jumbo frames |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
* Using pages when the page size is greater than 16k wastes |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
* a lot of memory, since we allocate 3 pages at all times |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
* per packet. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
pages = PAGE_USE_COUNT(adapter->netdev->mtu); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
if (!(adapter->flags & FLAG_IS_ICH) && (pages <= 3) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
(PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
adapter->rx_ps_pages = pages; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
adapter->rx_ps_pages = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
if (adapter->rx_ps_pages) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
/* Configure extra packet-split registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
rfctl = er32(RFCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
rfctl |= E1000_RFCTL_EXTEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
* disable packet split support for IPv6 extension headers, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
* because some malformed IPv6 headers can hang the Rx |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
rfctl |= (E1000_RFCTL_IPV6_EX_DIS | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
E1000_RFCTL_NEW_IPV6_EXT_DIS); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
ew32(RFCTL, rfctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
/* Enable Packet split descriptors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
rctl |= E1000_RCTL_DTYP_PS; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
psrctl |= adapter->rx_ps_bsize0 >> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
E1000_PSRCTL_BSIZE0_SHIFT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
switch (adapter->rx_ps_pages) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
case 3: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
psrctl |= PAGE_SIZE << |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
E1000_PSRCTL_BSIZE3_SHIFT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
case 2: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
psrctl |= PAGE_SIZE << |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
E1000_PSRCTL_BSIZE2_SHIFT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
case 1: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
psrctl |= PAGE_SIZE >> |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
E1000_PSRCTL_BSIZE1_SHIFT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
ew32(PSRCTL, psrctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
ew32(RCTL, rctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
/* just started the receive unit, no need to restart */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
adapter->flags &= ~FLAG_RX_RESTART_NOW; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
* e1000_configure_rx - Configure Receive Unit after Reset |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
* Configure the Rx unit of the MAC after a reset. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
static void e1000_configure_rx(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
struct e1000_ring *rx_ring = adapter->rx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
u64 rdba; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
u32 rdlen, rctl, rxcsum, ctrl_ext; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
if (adapter->rx_ps_pages) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
/* this is a 32 byte descriptor */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
rdlen = rx_ring->count * |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
sizeof(union e1000_rx_desc_packet_split); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
adapter->clean_rx = e1000_clean_rx_irq_ps; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
} else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
rdlen = rx_ring->count * sizeof(struct e1000_rx_desc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
adapter->clean_rx = e1000_clean_jumbo_rx_irq; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
adapter->alloc_rx_buf = e1000_alloc_jumbo_rx_buffers; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2835 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
rdlen = rx_ring->count * sizeof(struct e1000_rx_desc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
adapter->clean_rx = e1000_clean_rx_irq; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
adapter->alloc_rx_buf = e1000_alloc_rx_buffers; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
/* disable receives while setting up the descriptors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
ew32(RCTL, rctl & ~E1000_RCTL_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
msleep(10); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
/* set the Receive Delay Timer Register */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
ew32(RDTR, adapter->rx_int_delay); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
/* irq moderation */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
ew32(RADV, adapter->rx_abs_int_delay); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
if (adapter->itr_setting != 0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
ew32(ITR, 1000000000 / (adapter->itr * 256)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
ctrl_ext = er32(CTRL_EXT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
/* Auto-Mask interrupts upon ICR access */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
ctrl_ext |= E1000_CTRL_EXT_IAME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
ew32(IAM, 0xffffffff); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
ew32(CTRL_EXT, ctrl_ext); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
* Setup the HW Rx Head and Tail Descriptor Pointers and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
* the Base and Length of the Rx Descriptor Ring |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
rdba = rx_ring->dma; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
ew32(RDBAL, (rdba & DMA_BIT_MASK(32))); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
ew32(RDBAH, (rdba >> 32)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2869 |
ew32(RDLEN, rdlen); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
ew32(RDH, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
ew32(RDT, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
rx_ring->head = E1000_RDH; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
rx_ring->tail = E1000_RDT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
/* Enable Receive Checksum Offload for TCP and UDP */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
rxcsum = er32(RXCSUM); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
if (adapter->flags & FLAG_RX_CSUM_ENABLED) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
rxcsum |= E1000_RXCSUM_TUOFL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
* IPv4 payload checksum for UDP fragments must be |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
* used in conjunction with packet-split. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
if (adapter->rx_ps_pages) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
rxcsum |= E1000_RXCSUM_IPPCSE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
rxcsum &= ~E1000_RXCSUM_TUOFL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
/* no need to clear IPPCSE as it defaults to 0 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
ew32(RXCSUM, rxcsum); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
* Enable early receives on supported devices, only takes effect when |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
* packet size is equal or larger than the specified value (in 8 byte |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
* units), e.g. using jumbo frames when setting to E1000_ERT_2048 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
if (adapter->flags & FLAG_HAS_ERT) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
if (adapter->netdev->mtu > ETH_DATA_LEN) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
u32 rxdctl = er32(RXDCTL(0)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
ew32(RXDCTL(0), rxdctl | 0x3); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
ew32(ERT, E1000_ERT_2048 | (1 << 13)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
* With jumbo frames and early-receive enabled, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
* excessive C-state transition latencies result in |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
* dropped transactions. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
pm_qos_update_request( |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
adapter->netdev->pm_qos_req, 55); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
pm_qos_update_request( |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
adapter->netdev->pm_qos_req, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
PM_QOS_DEFAULT_VALUE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
/* Enable Receives */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
ew32(RCTL, rctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
* e1000_update_mc_addr_list - Update Multicast addresses |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
* @hw: pointer to the HW structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
* @mc_addr_list: array of multicast addresses to program |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
* @mc_addr_count: number of multicast addresses to program |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
* Updates the Multicast Table Array. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
* The caller must have a packed mc_addr_list of multicast addresses. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
static void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
u32 mc_addr_count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
hw->mac.ops.update_mc_addr_list(hw, mc_addr_list, mc_addr_count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
* e1000_set_multi - Multicast and Promiscuous mode set |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
* The set_multi entry point is called whenever the multicast address |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
* list or the network interface flags are updated. This routine is |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
* responsible for configuring the hardware for proper multicast, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
* promiscuous mode, and all-multi behavior. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
static void e1000_set_multi(struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
struct netdev_hw_addr *ha; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
u8 *mta_list; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
u32 rctl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
/* Check for Promiscuous and All Multicast modes */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
if (netdev->flags & IFF_PROMISC) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
rctl &= ~E1000_RCTL_VFE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
if (netdev->flags & IFF_ALLMULTI) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
rctl |= E1000_RCTL_MPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
rctl &= ~E1000_RCTL_UPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
rctl |= E1000_RCTL_VFE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
ew32(RCTL, rctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
if (!netdev_mc_empty(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
if (!mta_list) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
/* prepare a packed array of only addresses. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
netdev_for_each_mc_addr(ha, netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
e1000_update_mc_addr_list(hw, mta_list, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
kfree(mta_list); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
* if we're called from probe, we might not have |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
* anything to do here, so clear out the list |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
e1000_update_mc_addr_list(hw, NULL, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
* e1000_configure - configure the hardware for Rx and Tx |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
* @adapter: private board structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
static void e1000_configure(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
e1000_set_multi(adapter->netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
e1000_restore_vlan(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
e1000_init_manageability_pt(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
e1000_configure_tx(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
e1000_setup_rctl(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
e1000_configure_rx(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
adapter->alloc_rx_buf(adapter, e1000_desc_unused(adapter->rx_ring)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
* e1000e_power_up_phy - restore link in case the phy was powered down |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
* @adapter: address of board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3014 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3015 |
* The phy may be powered down to save power and turn off link when the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3016 |
* driver is unloaded and wake on lan is not enabled (among others) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3017 |
* *** this routine MUST be followed by a call to e1000e_reset *** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3018 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3019 |
void e1000e_power_up_phy(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3020 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3021 |
if (adapter->hw.phy.ops.power_up) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3022 |
adapter->hw.phy.ops.power_up(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3023 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3024 |
adapter->hw.mac.ops.setup_link(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3025 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3026 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3027 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3028 |
* e1000_power_down_phy - Power down the PHY |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
* Power down the PHY so no link is implied when interface is down. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
* The PHY cannot be powered down if management or WoL is active. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
static void e1000_power_down_phy(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
/* WoL is enabled */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
if (adapter->wol) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
if (adapter->hw.phy.ops.power_down) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
adapter->hw.phy.ops.power_down(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
* e1000e_reset - bring the hardware into a known good state |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
* This function boots the hardware and enables some settings that |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
* require a configuration cycle of the hardware - those cannot be |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
* set/changed during runtime. After reset the device needs to be |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
* properly configured for Rx, Tx etc. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
void e1000e_reset(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
struct e1000_mac_info *mac = &adapter->hw.mac; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
struct e1000_fc_info *fc = &adapter->hw.fc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3055 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
u32 tx_space, min_tx_space, min_rx_space; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
u32 pba = adapter->pba; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
u16 hwm; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
/* reset Packet Buffer Allocation to default */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3061 |
ew32(PBA, pba); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3062 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3063 |
if (adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3064 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3065 |
* To maintain wire speed transmits, the Tx FIFO should be |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
* large enough to accommodate two full transmit packets, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
* rounded up to the next 1KB and expressed in KB. Likewise, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
* the Rx FIFO should be large enough to accommodate at least |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
* one full receive packet and is similarly rounded up and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
* expressed in KB. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
pba = er32(PBA); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
/* upper 16 bits has Tx packet buffer allocation size in KB */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
tx_space = pba >> 16; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
/* lower 16 bits has Rx packet buffer allocation size in KB */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
pba &= 0xffff; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
* the Tx fifo also stores 16 bytes of information about the tx |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
* but don't include ethernet FCS because hardware appends it |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
min_tx_space = (adapter->max_frame_size + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
sizeof(struct e1000_tx_desc) - |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
ETH_FCS_LEN) * 2; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
min_tx_space = ALIGN(min_tx_space, 1024); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
min_tx_space >>= 10; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
/* software strips receive CRC, so leave room for it */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
min_rx_space = adapter->max_frame_size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
min_rx_space = ALIGN(min_rx_space, 1024); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
min_rx_space >>= 10; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
* If current Tx allocation is less than the min Tx FIFO size, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
* and the min Tx FIFO size is less than the current Rx FIFO |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
* allocation, take space away from current Rx allocation |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
if ((tx_space < min_tx_space) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
((min_tx_space - tx_space) < pba)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
pba -= min_tx_space - tx_space; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
* if short on Rx space, Rx wins and must trump tx |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
* adjustment or use Early Receive if available |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
if ((pba < min_rx_space) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
(!(adapter->flags & FLAG_HAS_ERT))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
/* ERT enabled in e1000_configure_rx */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
pba = min_rx_space; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
ew32(PBA, pba); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
* flow control settings |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
* The high water mark must be low enough to fit one full frame |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
* (or the size used for early receive) above it in the Rx FIFO. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
* Set it to the lower of: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
* - 90% of the Rx FIFO size, and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
* - the full Rx FIFO size minus the early receive size (for parts |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
* with ERT support assuming ERT set to E1000_ERT_2048), or |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
* - the full Rx FIFO size minus one full frame |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
if (hw->mac.type == e1000_pchlan) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
* Workaround PCH LOM adapter hangs with certain network |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
* loads. If hangs persist, try disabling Tx flow control. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
if (adapter->netdev->mtu > ETH_DATA_LEN) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
fc->high_water = 0x3500; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
fc->low_water = 0x1500; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
fc->high_water = 0x5000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
fc->low_water = 0x3000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
fc->refresh_time = 0x1000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
if ((adapter->flags & FLAG_HAS_ERT) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
(adapter->netdev->mtu > ETH_DATA_LEN)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
hwm = min(((pba << 10) * 9 / 10), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
((pba << 10) - (E1000_ERT_2048 << 3))); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
hwm = min(((pba << 10) * 9 / 10), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
((pba << 10) - adapter->max_frame_size)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
fc->low_water = fc->high_water - 8; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
fc->pause_time = 0xFFFF; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
fc->pause_time = E1000_FC_PAUSE_TIME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
fc->send_xon = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
fc->current_mode = fc->requested_mode; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
/* Allow time for pending master requests to run */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
mac->ops.reset_hw(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
* For parts with AMT enabled, let the firmware know |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
* that the network interface is in control |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
if (adapter->flags & FLAG_HAS_AMT) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3166 |
e1000_get_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3167 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3168 |
ew32(WUC, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3169 |
if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3170 |
e1e_wphy(&adapter->hw, BM_WUC, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3171 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3172 |
if (mac->ops.init_hw(hw)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3173 |
e_err("Hardware Error\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3174 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3175 |
e1000_update_mng_vlan(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3176 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3177 |
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3178 |
ew32(VET, ETH_P_8021Q); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3179 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
e1000e_reset_adaptive(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
e1000_get_phy_info(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
!(adapter->flags & FLAG_SMART_POWER_DOWN)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
u16 phy_data = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
* speed up time to link by disabling smart power down, ignore |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
* the return value of this function because there is nothing |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
* different we would do if it failed |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
phy_data &= ~IGP02E1000_PM_SPD; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
int e1000e_up(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
/* DMA latency requirement to workaround early-receive/jumbo issue */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
if (adapter->flags & FLAG_HAS_ERT) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
adapter->netdev->pm_qos_req = |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
PM_QOS_DEFAULT_VALUE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
/* hardware has been reset, we need to reload some things */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
e1000_configure(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
clear_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3211 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3212 |
napi_enable(&adapter->napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3213 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3214 |
e1000_configure_msix(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3215 |
e1000_irq_enable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
netif_wake_queue(adapter->netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
/* fire a link change interrupt to start the watchdog */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
ew32(ICS, E1000_ICS_LSC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
void e1000e_down(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
u32 tctl, rctl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
* signal that we're down so the interrupt handler does not |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
* reschedule our watchdog timer |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
set_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
/* disable receives in the hardware */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
ew32(RCTL, rctl & ~E1000_RCTL_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
/* flush and sleep below */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
netif_stop_queue(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
/* disable transmits in the hardware */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
tctl = er32(TCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
tctl &= ~E1000_TCTL_EN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
ew32(TCTL, tctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
/* flush both disables and wait for them to finish */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
msleep(10); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
napi_disable(&adapter->napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
e1000_irq_disable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
del_timer_sync(&adapter->watchdog_timer); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
del_timer_sync(&adapter->phy_info_timer); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
netif_carrier_off(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
adapter->link_speed = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
adapter->link_duplex = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
if (!pci_channel_offline(adapter->pdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
e1000_clean_tx_ring(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
e1000_clean_rx_ring(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
if (adapter->flags & FLAG_HAS_ERT) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
pm_qos_remove_request( |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
adapter->netdev->pm_qos_req); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
adapter->netdev->pm_qos_req = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
* TODO: for power management, we could drop the link and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
* pci_disable_device here. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
void e1000e_reinit_locked(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
might_sleep(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
msleep(1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
e1000e_down(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
e1000e_up(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
clear_bit(__E1000_RESETTING, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
* e1000_sw_init - Initialize general software structures (struct e1000_adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
* @adapter: board private structure to initialize |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
* e1000_sw_init initializes the Adapter private data structure. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
* Fields are initialized based on PCI device information and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
* OS network device settings (MTU size). |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
static int __devinit e1000_sw_init(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
adapter->rx_ps_bsize0 = 128; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
e1000e_set_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
if (e1000_alloc_queues(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
return -ENOMEM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
/* Explicitly disable IRQ since the NIC can be in any state. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
e1000_irq_disable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
set_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
* e1000_intr_msi_test - Interrupt Handler |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
* @irq: interrupt number |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
* @data: pointer to a network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
static irqreturn_t e1000_intr_msi_test(int irq, void *data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
struct net_device *netdev = data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
u32 icr = er32(ICR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
e_dbg("icr is %08X\n", icr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
if (icr & E1000_ICR_RXSEQ) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
adapter->flags &= ~FLAG_MSI_TEST_FAILED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
wmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
return IRQ_HANDLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
* e1000_test_msi_interrupt - Returns 0 for successful test |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
* @adapter: board private struct |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
* code flow taken from tg3.c |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3349 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3350 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
/* poll_enable hasn't been called yet, so don't need disable */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
/* clear any pending events */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
er32(ICR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
/* free the real vector and request a test handler */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
e1000_free_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
/* Assume that the test fails, if it succeeds then the test |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
* MSI irq handler will unset this flag */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
adapter->flags |= FLAG_MSI_TEST_FAILED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
err = pci_enable_msi(adapter->pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
goto msi_test_failed; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
err = request_irq(adapter->pdev->irq, e1000_intr_msi_test, 0, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
netdev->name, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
if (err) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
pci_disable_msi(adapter->pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
goto msi_test_failed; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
wmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
e1000_irq_enable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
/* fire an unusual interrupt on the test handler */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
ew32(ICS, E1000_ICS_RXSEQ); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
e1e_flush(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
msleep(50); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
e1000_irq_disable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
rmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
if (adapter->flags & FLAG_MSI_TEST_FAILED) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
adapter->int_mode = E1000E_INT_MODE_LEGACY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
err = -EIO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
e_info("MSI interrupt test failed!\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
free_irq(adapter->pdev->irq, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
pci_disable_msi(adapter->pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
if (err == -EIO) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
goto msi_test_failed; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
/* okay so the test worked, restore settings */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
e_dbg("MSI interrupt test succeeded!\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
msi_test_failed: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
e1000e_set_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
e1000_request_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
* e1000_test_msi - Returns 0 if MSI test succeeds or INTx mode is restored |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
* @adapter: board private struct |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
* code flow taken from tg3.c, called with e1000 interrupts disabled. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
static int e1000_test_msi(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
u16 pci_cmd; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
if (!(adapter->flags & FLAG_MSI_ENABLED)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
/* disable SERR in case the MSI write causes a master abort */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
if (pci_cmd & PCI_COMMAND_SERR) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
pci_write_config_word(adapter->pdev, PCI_COMMAND, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
pci_cmd & ~PCI_COMMAND_SERR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
err = e1000_test_msi_interrupt(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
/* re-enable SERR */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
if (pci_cmd & PCI_COMMAND_SERR) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
pci_cmd |= PCI_COMMAND_SERR; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
/* success ! */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
if (!err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
/* EIO means MSI test failed */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
if (err != -EIO) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
/* back to INTx mode */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
e_warn("MSI interrupt test failed, using legacy interrupt.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
e1000_free_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
err = e1000_request_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
* e1000_open - Called when a network interface is made active |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
* Returns 0 on success, negative value on failure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
* The open entry point is called when a network interface is made |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
* active by the system (IFF_UP). At this point all resources needed |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
* for transmit and receive operations are allocated, the interrupt |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
* handler is registered with the OS, the watchdog timer is started, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
* and the stack is notified that the interface is ready. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
static int e1000_open(struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
/* disallow open during test */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
if (test_bit(__E1000_TESTING, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
return -EBUSY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
pm_runtime_get_sync(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
netif_carrier_off(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
/* allocate transmit descriptors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
err = e1000e_setup_tx_resources(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
goto err_setup_tx; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
/* allocate receive descriptors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
err = e1000e_setup_rx_resources(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
goto err_setup_rx; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
* If AMT is enabled, let the firmware know that the network |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
* interface is now open and reset the part to a known state. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
if (adapter->flags & FLAG_HAS_AMT) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
e1000_get_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
e1000e_power_up_phy(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
if ((adapter->hw.mng_cookie.status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
e1000_update_mng_vlan(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3511 |
* before we allocate an interrupt, we must be ready to handle it. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
* Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
* as soon as we call pci_request_irq, so we have to setup our |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
* clean_rx handler before we do so. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
e1000_configure(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
err = e1000_request_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
goto err_req_irq; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3521 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3522 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
* Work around PCIe errata with MSI interrupts causing some chipsets to |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
* ignore e1000e MSI messages, which means we need to test our MSI |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3525 |
* interrupt now |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
if (adapter->int_mode != E1000E_INT_MODE_LEGACY) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3528 |
err = e1000_test_msi(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
if (err) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
e_err("Interrupt allocation failed\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
goto err_req_irq; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3533 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
/* From here on the code is the same as e1000e_up() */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
clear_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
napi_enable(&adapter->napi); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
e1000_irq_enable(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3541 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
netif_start_queue(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3544 |
adapter->idle_check = true; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
pm_runtime_put(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
/* fire a link status change interrupt to start the watchdog */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3548 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
ew32(ICS, E1000_ICS_LSC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3553 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
err_req_irq: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
e1000_release_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3557 |
e1000_power_down_phy(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
e1000e_free_rx_resources(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
err_setup_rx: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3560 |
e1000e_free_tx_resources(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
err_setup_tx: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
pm_runtime_put_sync(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
* e1000_close - Disables a network interface |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
* Returns 0, this is not allowed to fail |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
* The close entry point is called when an interface is de-activated |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
* by the OS. The hardware is still under the drivers control, but |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
* needs to be disabled. A global MAC reset is issued to stop the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
* hardware, and all transmit and receive resources are freed. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
static int e1000_close(struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
pm_runtime_get_sync(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
if (!test_bit(__E1000_DOWN, &adapter->state)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
e1000e_down(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
e1000_free_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
e1000_power_down_phy(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
e1000e_free_tx_resources(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
e1000e_free_rx_resources(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
* kill manageability vlan ID if supported, but not if a vlan with |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
* the same ID is registered on the host OS (let 8021q kill it) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
if ((adapter->hw.mng_cookie.status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
!(adapter->vlgrp && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3605 |
e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3606 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3607 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3608 |
* If AMT is enabled, let the firmware know that the network |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3609 |
* interface is now closed |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
if (adapter->flags & FLAG_HAS_AMT) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
e1000_release_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
pm_runtime_put_sync(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
* e1000_set_mac - Change the Ethernet Address of the NIC |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
* @p: pointer to an address structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
* Returns 0 on success, negative on failure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
static int e1000_set_mac(struct net_device *netdev, void *p) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
struct sockaddr *addr = p; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
if (!is_valid_ether_addr(addr->sa_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3631 |
return -EADDRNOTAVAIL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3632 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3633 |
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3634 |
memcpy(adapter->hw.mac.addr, addr->sa_data, netdev->addr_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3635 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3636 |
e1000e_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3637 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3638 |
if (adapter->flags & FLAG_RESET_OVERWRITES_LAA) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3639 |
/* activate the work around */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
e1000e_set_laa_state_82571(&adapter->hw, 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
* Hold a copy of the LAA in RAR[14] This is done so that |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
* between the time RAR[0] gets clobbered and the time it |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
* gets fixed (in e1000_watchdog), the actual LAA is in one |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
* of the RARs and no incoming packets directed to this port |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
* are dropped. Eventually the LAA will be in RAR[0] and |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
* RAR[14] |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
e1000e_rar_set(&adapter->hw, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
adapter->hw.mac.addr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
adapter->hw.mac.rar_entry_count - 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3654 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3658 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
* e1000e_update_phy_task - work thread to update phy |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
* @work: pointer to our work struct |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
* this worker thread exists because we must acquire a |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3663 |
* semaphore to read the phy, which we could msleep while |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
* waiting for it, and we can't msleep in a timer. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3665 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
static void e1000e_update_phy_task(struct work_struct *work) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
struct e1000_adapter *adapter = container_of(work, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3669 |
struct e1000_adapter, update_phy_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
e1000_get_phy_info(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3674 |
* Need to wait a few seconds after link up to get diagnostic information from |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
* the phy |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3677 |
static void e1000_update_phy_info(unsigned long data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
schedule_work(&adapter->update_phy_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
* e1000e_update_stats - Update the board statistics counters |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
void e1000e_update_stats(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
u16 phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
* Prevent stats update while adapter is being reset, or if the pci |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
* connection is down. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
if (adapter->link_speed == 0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
if (pci_channel_offline(pdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
adapter->stats.crcerrs += er32(CRCERRS); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
adapter->stats.gprc += er32(GPRC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
adapter->stats.gorc += er32(GORCL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
er32(GORCH); /* Clear gorc */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
adapter->stats.bprc += er32(BPRC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
adapter->stats.mprc += er32(MPRC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
adapter->stats.roc += er32(ROC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
adapter->stats.mpc += er32(MPC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
if ((hw->phy.type == e1000_phy_82578) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
(hw->phy.type == e1000_phy_82577)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
e1e_rphy(hw, HV_SCC_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
if (!e1e_rphy(hw, HV_SCC_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
adapter->stats.scc += phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
e1e_rphy(hw, HV_ECOL_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
if (!e1e_rphy(hw, HV_ECOL_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
adapter->stats.ecol += phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
e1e_rphy(hw, HV_MCC_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
if (!e1e_rphy(hw, HV_MCC_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
adapter->stats.mcc += phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
e1e_rphy(hw, HV_LATECOL_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
if (!e1e_rphy(hw, HV_LATECOL_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
adapter->stats.latecol += phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
e1e_rphy(hw, HV_DC_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
if (!e1e_rphy(hw, HV_DC_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
adapter->stats.dc += phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
adapter->stats.scc += er32(SCC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
adapter->stats.ecol += er32(ECOL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
adapter->stats.mcc += er32(MCC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
adapter->stats.latecol += er32(LATECOL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
adapter->stats.dc += er32(DC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
adapter->stats.xonrxc += er32(XONRXC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
adapter->stats.xontxc += er32(XONTXC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
adapter->stats.xoffrxc += er32(XOFFRXC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
adapter->stats.xofftxc += er32(XOFFTXC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
adapter->stats.gptc += er32(GPTC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
adapter->stats.gotc += er32(GOTCL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
er32(GOTCH); /* Clear gotc */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
adapter->stats.rnbc += er32(RNBC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
adapter->stats.ruc += er32(RUC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
adapter->stats.mptc += er32(MPTC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
adapter->stats.bptc += er32(BPTC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
/* used for adaptive IFS */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
hw->mac.tx_packet_delta = er32(TPT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
adapter->stats.tpt += hw->mac.tx_packet_delta; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
if ((hw->phy.type == e1000_phy_82578) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
(hw->phy.type == e1000_phy_82577)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3759 |
e1e_rphy(hw, HV_COLC_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
if (!e1e_rphy(hw, HV_COLC_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
hw->mac.collision_delta = phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
hw->mac.collision_delta = er32(COLC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
adapter->stats.colc += hw->mac.collision_delta; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
adapter->stats.algnerrc += er32(ALGNERRC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
adapter->stats.rxerrc += er32(RXERRC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
if ((hw->phy.type == e1000_phy_82578) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
(hw->phy.type == e1000_phy_82577)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
e1e_rphy(hw, HV_TNCRS_UPPER, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
if (!e1e_rphy(hw, HV_TNCRS_LOWER, &phy_data)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
adapter->stats.tncrs += phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3774 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3775 |
if ((hw->mac.type != e1000_82574) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
(hw->mac.type != e1000_82583)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
adapter->stats.tncrs += er32(TNCRS); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
adapter->stats.cexterr += er32(CEXTERR); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
adapter->stats.tsctc += er32(TSCTC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
adapter->stats.tsctfc += er32(TSCTFC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
/* Fill out the OS statistics structure */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
netdev->stats.multicast = adapter->stats.mprc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
netdev->stats.collisions = adapter->stats.colc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
/* Rx Errors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
* RLEC on some newer hardware can be incorrect so build |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3791 |
* our own version based on RUC and ROC |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
netdev->stats.rx_errors = adapter->stats.rxerrc + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
adapter->stats.crcerrs + adapter->stats.algnerrc + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
adapter->stats.ruc + adapter->stats.roc + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
adapter->stats.cexterr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
netdev->stats.rx_length_errors = adapter->stats.ruc + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
adapter->stats.roc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
netdev->stats.rx_crc_errors = adapter->stats.crcerrs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
netdev->stats.rx_frame_errors = adapter->stats.algnerrc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
netdev->stats.rx_missed_errors = adapter->stats.mpc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
/* Tx Errors */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
netdev->stats.tx_errors = adapter->stats.ecol + |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
adapter->stats.latecol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
netdev->stats.tx_aborted_errors = adapter->stats.ecol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
netdev->stats.tx_window_errors = adapter->stats.latecol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
netdev->stats.tx_carrier_errors = adapter->stats.tncrs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
/* Tx Dropped needs to be maintained elsewhere */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
/* Management Stats */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
adapter->stats.mgptc += er32(MGTPTC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
adapter->stats.mgprc += er32(MGTPRC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
adapter->stats.mgpdc += er32(MGTPDC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3817 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
* e1000_phy_read_status - Update the PHY register status snapshot |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
* @adapter: board private structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
static void e1000_phy_read_status(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
struct e1000_phy_regs *phy = &adapter->phy_regs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
int ret_val; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
if ((er32(STATUS) & E1000_STATUS_LU) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
(adapter->hw.phy.media_type == e1000_media_type_copper)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3833 |
ret_val |= e1e_rphy(hw, PHY_LP_ABILITY, &phy->lpa); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
ret_val |= e1e_rphy(hw, PHY_AUTONEG_EXP, &phy->expansion); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
ret_val |= e1e_rphy(hw, PHY_1000T_CTRL, &phy->ctrl1000); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
ret_val |= e1e_rphy(hw, PHY_1000T_STATUS, &phy->stat1000); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
ret_val |= e1e_rphy(hw, PHY_EXT_STATUS, &phy->estatus); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
if (ret_val) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
e_warn("Error reading PHY register\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
* Do not read PHY registers if link is not up |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
* Set values to typical power-on defaults |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3845 |
phy->bmcr = (BMCR_SPEED1000 | BMCR_ANENABLE | BMCR_FULLDPLX); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
phy->bmsr = (BMSR_100FULL | BMSR_100HALF | BMSR_10FULL | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
BMSR_10HALF | BMSR_ESTATEN | BMSR_ANEGCAPABLE | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
BMSR_ERCAP); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
phy->advertise = (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
ADVERTISE_ALL | ADVERTISE_CSMA); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
phy->lpa = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
phy->expansion = EXPANSION_ENABLENPAGE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
phy->ctrl1000 = ADVERTISE_1000FULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
phy->stat1000 = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
static void e1000_print_link_info(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
u32 ctrl = er32(CTRL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
/* Link status message must follow this format for user tools */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
printk(KERN_INFO "e1000e: %s NIC Link is Up %d Mbps %s, " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
"Flow Control: %s\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
adapter->netdev->name, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
adapter->link_speed, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
(adapter->link_duplex == FULL_DUPLEX) ? |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
"Full Duplex" : "Half Duplex", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
"RX/TX" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
((ctrl & E1000_CTRL_RFCE) ? "RX" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
bool e1000e_has_link(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
bool link_active = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
s32 ret_val = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
* get_link_status is set on LSC (link status) interrupt or |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
* Rx sequence error interrupt. get_link_status will stay |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
* false until the check_for_link establishes link |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
* for copper adapters ONLY |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
switch (hw->phy.media_type) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
case e1000_media_type_copper: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3891 |
if (hw->mac.get_link_status) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
ret_val = hw->mac.ops.check_for_link(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3893 |
link_active = !hw->mac.get_link_status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
link_active = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
case e1000_media_type_fiber: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
ret_val = hw->mac.ops.check_for_link(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
link_active = !!(er32(STATUS) & E1000_STATUS_LU); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
case e1000_media_type_internal_serdes: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
ret_val = hw->mac.ops.check_for_link(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
link_active = adapter->hw.mac.serdes_has_link; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
case e1000_media_type_unknown: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
if ((ret_val == E1000_ERR_PHY) && (hw->phy.type == e1000_phy_igp_3) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
(er32(CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
/* See e1000_kmrn_lock_loss_workaround_ich8lan() */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
e_info("Gigabit has been disabled, downgrading speed\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
return link_active; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
static void e1000e_enable_receives(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
/* make sure the receive unit is started */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
if ((adapter->flags & FLAG_RX_NEEDS_RESTART) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
(adapter->flags & FLAG_RX_RESTART_NOW)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
u32 rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
ew32(RCTL, rctl | E1000_RCTL_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
adapter->flags &= ~FLAG_RX_RESTART_NOW; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3929 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3930 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3931 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3932 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3933 |
* e1000_watchdog - Timer Call-back |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3934 |
* @data: pointer to adapter cast into an unsigned long |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3935 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3936 |
static void e1000_watchdog(unsigned long data) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3937 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3938 |
struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3939 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3940 |
/* Do the rest outside of interrupt context */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3941 |
schedule_work(&adapter->watchdog_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3942 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3943 |
/* TODO: make this use queue_delayed_work() */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3944 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3945 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3946 |
static void e1000_watchdog_task(struct work_struct *work) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3947 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3948 |
struct e1000_adapter *adapter = container_of(work, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3949 |
struct e1000_adapter, watchdog_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3950 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3951 |
struct e1000_mac_info *mac = &adapter->hw.mac; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3952 |
struct e1000_phy_info *phy = &adapter->hw.phy; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3953 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3954 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3955 |
u32 link, tctl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3956 |
int tx_pending = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3957 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3958 |
link = e1000e_has_link(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3959 |
if ((netif_carrier_ok(netdev)) && link) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3960 |
/* Cancel scheduled suspend requests. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3961 |
pm_runtime_resume(netdev->dev.parent); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3962 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3963 |
e1000e_enable_receives(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3964 |
goto link_up; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3965 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3966 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3967 |
if ((e1000e_enable_tx_pkt_filtering(hw)) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3968 |
(adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3969 |
e1000_update_mng_vlan(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3970 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3971 |
if (link) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3972 |
if (!netif_carrier_ok(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3973 |
bool txb2b = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3974 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3975 |
/* Cancel scheduled suspend requests. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3976 |
pm_runtime_resume(netdev->dev.parent); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3977 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3978 |
/* update snapshot of PHY registers on LSC */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3979 |
e1000_phy_read_status(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3980 |
mac->ops.get_link_up_info(&adapter->hw, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3981 |
&adapter->link_speed, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3982 |
&adapter->link_duplex); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3983 |
e1000_print_link_info(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3984 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3985 |
* On supported PHYs, check for duplex mismatch only |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3986 |
* if link has autonegotiated at 10/100 half |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3987 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3988 |
if ((hw->phy.type == e1000_phy_igp_3 || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3989 |
hw->phy.type == e1000_phy_bm) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3990 |
(hw->mac.autoneg == true) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3991 |
(adapter->link_speed == SPEED_10 || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3992 |
adapter->link_speed == SPEED_100) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3993 |
(adapter->link_duplex == HALF_DUPLEX)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3994 |
u16 autoneg_exp; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3995 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3996 |
e1e_rphy(hw, PHY_AUTONEG_EXP, &autoneg_exp); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3997 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3998 |
if (!(autoneg_exp & NWAY_ER_LP_NWAY_CAPS)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3999 |
e_info("Autonegotiated half duplex but" |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4000 |
" link partner cannot autoneg. " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4001 |
" Try forcing full duplex if " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4002 |
"link gets many collisions.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4003 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4004 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4005 |
/* adjust timeout factor according to speed/duplex */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4006 |
adapter->tx_timeout_factor = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4007 |
switch (adapter->link_speed) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4008 |
case SPEED_10: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4009 |
txb2b = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4010 |
adapter->tx_timeout_factor = 16; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4011 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4012 |
case SPEED_100: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4013 |
txb2b = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4014 |
adapter->tx_timeout_factor = 10; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4015 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4016 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4017 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4018 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4019 |
* workaround: re-program speed mode bit after |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4020 |
* link-up event |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4021 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4022 |
if ((adapter->flags & FLAG_TARC_SPEED_MODE_BIT) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4023 |
!txb2b) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4024 |
u32 tarc0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4025 |
tarc0 = er32(TARC(0)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4026 |
tarc0 &= ~SPEED_MODE_BIT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4027 |
ew32(TARC(0), tarc0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4028 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4029 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4030 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4031 |
* disable TSO for pcie and 10/100 speeds, to avoid |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4032 |
* some hardware issues |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4033 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4034 |
if (!(adapter->flags & FLAG_TSO_FORCE)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4035 |
switch (adapter->link_speed) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4036 |
case SPEED_10: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4037 |
case SPEED_100: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4038 |
e_info("10/100 speed: disabling TSO\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4039 |
netdev->features &= ~NETIF_F_TSO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4040 |
netdev->features &= ~NETIF_F_TSO6; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4041 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4042 |
case SPEED_1000: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4043 |
netdev->features |= NETIF_F_TSO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4044 |
netdev->features |= NETIF_F_TSO6; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4045 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4046 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4047 |
/* oops */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4048 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4049 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4050 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4051 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4052 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4053 |
* enable transmits in the hardware, need to do this |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4054 |
* after setting TARC(0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4055 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4056 |
tctl = er32(TCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4057 |
tctl |= E1000_TCTL_EN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4058 |
ew32(TCTL, tctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4059 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4060 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4061 |
* Perform any post-link-up configuration before |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4062 |
* reporting link up. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4063 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4064 |
if (phy->ops.cfg_on_link_up) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4065 |
phy->ops.cfg_on_link_up(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4066 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4067 |
netif_carrier_on(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4068 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4069 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4070 |
mod_timer(&adapter->phy_info_timer, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4071 |
round_jiffies(jiffies + 2 * HZ)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4072 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4073 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4074 |
if (netif_carrier_ok(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4075 |
adapter->link_speed = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4076 |
adapter->link_duplex = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4077 |
/* Link status message must follow this format */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4078 |
printk(KERN_INFO "e1000e: %s NIC Link is Down\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4079 |
adapter->netdev->name); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4080 |
netif_carrier_off(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4081 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4082 |
mod_timer(&adapter->phy_info_timer, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4083 |
round_jiffies(jiffies + 2 * HZ)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4084 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4085 |
if (adapter->flags & FLAG_RX_NEEDS_RESTART) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4086 |
schedule_work(&adapter->reset_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4087 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4088 |
pm_schedule_suspend(netdev->dev.parent, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4089 |
LINK_TIMEOUT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4090 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4091 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4092 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4093 |
link_up: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4094 |
e1000e_update_stats(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4095 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4096 |
mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4097 |
adapter->tpt_old = adapter->stats.tpt; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4098 |
mac->collision_delta = adapter->stats.colc - adapter->colc_old; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4099 |
adapter->colc_old = adapter->stats.colc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4100 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4101 |
adapter->gorc = adapter->stats.gorc - adapter->gorc_old; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4102 |
adapter->gorc_old = adapter->stats.gorc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4103 |
adapter->gotc = adapter->stats.gotc - adapter->gotc_old; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4104 |
adapter->gotc_old = adapter->stats.gotc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4105 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4106 |
e1000e_update_adaptive(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4107 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4108 |
if (!netif_carrier_ok(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4109 |
tx_pending = (e1000_desc_unused(tx_ring) + 1 < |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4110 |
tx_ring->count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4111 |
if (tx_pending) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4112 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4113 |
* We've lost link, so the controller stops DMA, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4114 |
* but we've got queued Tx work that's never going |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4115 |
* to get done, so reset controller to flush Tx. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4116 |
* (Do the reset outside of interrupt context). |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4117 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4118 |
adapter->tx_timeout_count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4119 |
schedule_work(&adapter->reset_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4120 |
/* return immediately since reset is imminent */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4121 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4122 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4123 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4124 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4125 |
/* Simple mode for Interrupt Throttle Rate (ITR) */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4126 |
if (adapter->itr_setting == 4) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4127 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4128 |
* Symmetric Tx/Rx gets a reduced ITR=2000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4129 |
* Total asymmetrical Tx or Rx gets ITR=8000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4130 |
* everyone else is between 2000-8000. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4131 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4132 |
u32 goc = (adapter->gotc + adapter->gorc) / 10000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4133 |
u32 dif = (adapter->gotc > adapter->gorc ? |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4134 |
adapter->gotc - adapter->gorc : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4135 |
adapter->gorc - adapter->gotc) / 10000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4136 |
u32 itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4137 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4138 |
ew32(ITR, 1000000000 / (itr * 256)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4139 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4140 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4141 |
/* Cause software interrupt to ensure Rx ring is cleaned */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4142 |
if (adapter->msix_entries) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4143 |
ew32(ICS, adapter->rx_ring->ims_val); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4144 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4145 |
ew32(ICS, E1000_ICS_RXDMT0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4146 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4147 |
/* Force detection of hung controller every watchdog period */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4148 |
adapter->detect_tx_hung = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4149 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4150 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4151 |
* With 82571 controllers, LAA may be overwritten due to controller |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4152 |
* reset from the other port. Set the appropriate LAA in RAR[0] |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4153 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4154 |
if (e1000e_get_laa_state_82571(hw)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4155 |
e1000e_rar_set(hw, adapter->hw.mac.addr, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4156 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4157 |
/* Reset the timer */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4158 |
if (!test_bit(__E1000_DOWN, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4159 |
mod_timer(&adapter->watchdog_timer, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4160 |
round_jiffies(jiffies + 2 * HZ)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4161 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4162 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4163 |
#define E1000_TX_FLAGS_CSUM 0x00000001 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4164 |
#define E1000_TX_FLAGS_VLAN 0x00000002 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4165 |
#define E1000_TX_FLAGS_TSO 0x00000004 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4166 |
#define E1000_TX_FLAGS_IPV4 0x00000008 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4167 |
#define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4168 |
#define E1000_TX_FLAGS_VLAN_SHIFT 16 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4169 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4170 |
static int e1000_tso(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4171 |
struct sk_buff *skb) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4172 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4173 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4174 |
struct e1000_context_desc *context_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4175 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4176 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4177 |
u32 cmd_length = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4178 |
u16 ipcse = 0, tucse, mss; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4179 |
u8 ipcss, ipcso, tucss, tucso, hdr_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4180 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4181 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4182 |
if (!skb_is_gso(skb)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4183 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4184 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4185 |
if (skb_header_cloned(skb)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4186 |
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4187 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4188 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4189 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4190 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4191 |
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4192 |
mss = skb_shinfo(skb)->gso_size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4193 |
if (skb->protocol == htons(ETH_P_IP)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4194 |
struct iphdr *iph = ip_hdr(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4195 |
iph->tot_len = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4196 |
iph->check = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4197 |
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4198 |
0, IPPROTO_TCP, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4199 |
cmd_length = E1000_TXD_CMD_IP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4200 |
ipcse = skb_transport_offset(skb) - 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4201 |
} else if (skb_is_gso_v6(skb)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4202 |
ipv6_hdr(skb)->payload_len = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4203 |
tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4204 |
&ipv6_hdr(skb)->daddr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4205 |
0, IPPROTO_TCP, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4206 |
ipcse = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4207 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4208 |
ipcss = skb_network_offset(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4209 |
ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4210 |
tucss = skb_transport_offset(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4211 |
tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4212 |
tucse = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4213 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4214 |
cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4215 |
E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4216 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4217 |
i = tx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4218 |
context_desc = E1000_CONTEXT_DESC(*tx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4219 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4220 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4221 |
context_desc->lower_setup.ip_fields.ipcss = ipcss; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4222 |
context_desc->lower_setup.ip_fields.ipcso = ipcso; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4223 |
context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4224 |
context_desc->upper_setup.tcp_fields.tucss = tucss; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4225 |
context_desc->upper_setup.tcp_fields.tucso = tucso; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4226 |
context_desc->upper_setup.tcp_fields.tucse = cpu_to_le16(tucse); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4227 |
context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4228 |
context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4229 |
context_desc->cmd_and_length = cpu_to_le32(cmd_length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4230 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4231 |
buffer_info->time_stamp = jiffies; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4232 |
buffer_info->next_to_watch = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4233 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4234 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4235 |
if (i == tx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4236 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4237 |
tx_ring->next_to_use = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4238 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4239 |
return 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4240 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4241 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4242 |
static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4243 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4244 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4245 |
struct e1000_context_desc *context_desc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4246 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4247 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4248 |
u8 css; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4249 |
u32 cmd_len = E1000_TXD_CMD_DEXT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4250 |
__be16 protocol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4251 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4252 |
if (skb->ip_summed != CHECKSUM_PARTIAL) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4253 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4254 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4255 |
if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4256 |
protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4257 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4258 |
protocol = skb->protocol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4259 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4260 |
switch (protocol) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4261 |
case cpu_to_be16(ETH_P_IP): |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4262 |
if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4263 |
cmd_len |= E1000_TXD_CMD_TCP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4264 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4265 |
case cpu_to_be16(ETH_P_IPV6): |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4266 |
/* XXX not handling all IPV6 headers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4267 |
if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4268 |
cmd_len |= E1000_TXD_CMD_TCP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4269 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4270 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4271 |
if (unlikely(net_ratelimit())) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4272 |
e_warn("checksum_partial proto=%x!\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4273 |
be16_to_cpu(protocol)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4274 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4275 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4276 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4277 |
css = skb_transport_offset(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4278 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4279 |
i = tx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4280 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4281 |
context_desc = E1000_CONTEXT_DESC(*tx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4282 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4283 |
context_desc->lower_setup.ip_config = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4284 |
context_desc->upper_setup.tcp_fields.tucss = css; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4285 |
context_desc->upper_setup.tcp_fields.tucso = |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4286 |
css + skb->csum_offset; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4287 |
context_desc->upper_setup.tcp_fields.tucse = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4288 |
context_desc->tcp_seg_setup.data = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4289 |
context_desc->cmd_and_length = cpu_to_le32(cmd_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4290 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4291 |
buffer_info->time_stamp = jiffies; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4292 |
buffer_info->next_to_watch = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4293 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4294 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4295 |
if (i == tx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4296 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4297 |
tx_ring->next_to_use = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4298 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4299 |
return 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4300 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4301 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4302 |
#define E1000_MAX_PER_TXD 8192 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4303 |
#define E1000_MAX_TXD_PWR 12 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4304 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4305 |
static int e1000_tx_map(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4306 |
struct sk_buff *skb, unsigned int first, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4307 |
unsigned int max_per_txd, unsigned int nr_frags, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4308 |
unsigned int mss) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4309 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4310 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4311 |
struct pci_dev *pdev = adapter->pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4312 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4313 |
unsigned int len = skb_headlen(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4314 |
unsigned int offset = 0, size, count = 0, i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4315 |
unsigned int f, bytecount, segs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4316 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4317 |
i = tx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4318 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4319 |
while (len) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4320 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4321 |
size = min(len, max_per_txd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4322 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4323 |
buffer_info->length = size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4324 |
buffer_info->time_stamp = jiffies; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4325 |
buffer_info->next_to_watch = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4326 |
buffer_info->dma = dma_map_single(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4327 |
skb->data + offset, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4328 |
size, DMA_TO_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4329 |
buffer_info->mapped_as_page = false; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4330 |
if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4331 |
goto dma_error; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4332 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4333 |
len -= size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4334 |
offset += size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4335 |
count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4336 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4337 |
if (len) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4338 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4339 |
if (i == tx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4340 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4341 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4342 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4343 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4344 |
for (f = 0; f < nr_frags; f++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4345 |
struct skb_frag_struct *frag; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4346 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4347 |
frag = &skb_shinfo(skb)->frags[f]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4348 |
len = frag->size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4349 |
offset = frag->page_offset; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4350 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4351 |
while (len) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4352 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4353 |
if (i == tx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4354 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4355 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4356 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4357 |
size = min(len, max_per_txd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4358 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4359 |
buffer_info->length = size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4360 |
buffer_info->time_stamp = jiffies; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4361 |
buffer_info->next_to_watch = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4362 |
buffer_info->dma = dma_map_page(&pdev->dev, frag->page, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4363 |
offset, size, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4364 |
DMA_TO_DEVICE); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4365 |
buffer_info->mapped_as_page = true; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4366 |
if (dma_mapping_error(&pdev->dev, buffer_info->dma)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4367 |
goto dma_error; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4368 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4369 |
len -= size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4370 |
offset += size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4371 |
count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4372 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4373 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4374 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4375 |
segs = skb_shinfo(skb)->gso_segs ?: 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4376 |
/* multiply data chunks by size of headers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4377 |
bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4378 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4379 |
tx_ring->buffer_info[i].skb = skb; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4380 |
tx_ring->buffer_info[i].segs = segs; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4381 |
tx_ring->buffer_info[i].bytecount = bytecount; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4382 |
tx_ring->buffer_info[first].next_to_watch = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4383 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4384 |
return count; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4385 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4386 |
dma_error: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4387 |
dev_err(&pdev->dev, "TX DMA map failed\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4388 |
buffer_info->dma = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4389 |
if (count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4390 |
count--; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4391 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4392 |
while (count--) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4393 |
if (i==0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4394 |
i += tx_ring->count; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4395 |
i--; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4396 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4397 |
e1000_put_txbuf(adapter, buffer_info);; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4398 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4399 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4400 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4401 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4402 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4403 |
static void e1000_tx_queue(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4404 |
int tx_flags, int count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4405 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4406 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4407 |
struct e1000_tx_desc *tx_desc = NULL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4408 |
struct e1000_buffer *buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4409 |
u32 txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4410 |
unsigned int i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4411 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4412 |
if (tx_flags & E1000_TX_FLAGS_TSO) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4413 |
txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4414 |
E1000_TXD_CMD_TSE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4415 |
txd_upper |= E1000_TXD_POPTS_TXSM << 8; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4416 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4417 |
if (tx_flags & E1000_TX_FLAGS_IPV4) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4418 |
txd_upper |= E1000_TXD_POPTS_IXSM << 8; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4419 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4420 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4421 |
if (tx_flags & E1000_TX_FLAGS_CSUM) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4422 |
txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4423 |
txd_upper |= E1000_TXD_POPTS_TXSM << 8; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4424 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4425 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4426 |
if (tx_flags & E1000_TX_FLAGS_VLAN) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4427 |
txd_lower |= E1000_TXD_CMD_VLE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4428 |
txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4429 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4430 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4431 |
i = tx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4432 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4433 |
while (count--) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4434 |
buffer_info = &tx_ring->buffer_info[i]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4435 |
tx_desc = E1000_TX_DESC(*tx_ring, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4436 |
tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4437 |
tx_desc->lower.data = |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4438 |
cpu_to_le32(txd_lower | buffer_info->length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4439 |
tx_desc->upper.data = cpu_to_le32(txd_upper); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4440 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4441 |
i++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4442 |
if (i == tx_ring->count) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4443 |
i = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4444 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4445 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4446 |
tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4447 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4448 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4449 |
* Force memory writes to complete before letting h/w |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4450 |
* know there are new descriptors to fetch. (Only |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4451 |
* applicable for weak-ordered memory model archs, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4452 |
* such as IA-64). |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4453 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4454 |
wmb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4455 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4456 |
tx_ring->next_to_use = i; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4457 |
writel(i, adapter->hw.hw_addr + tx_ring->tail); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4458 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4459 |
* we need this if more than one processor can write to our tail |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4460 |
* at a time, it synchronizes IO on IA64/Altix systems |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4461 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4462 |
mmiowb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4463 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4464 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4465 |
#define MINIMUM_DHCP_PACKET_SIZE 282 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4466 |
static int e1000_transfer_dhcp_info(struct e1000_adapter *adapter, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4467 |
struct sk_buff *skb) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4468 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4469 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4470 |
u16 length, offset; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4471 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4472 |
if (vlan_tx_tag_present(skb)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4473 |
if (!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4474 |
(adapter->hw.mng_cookie.status & |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4475 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4476 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4477 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4478 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4479 |
if (skb->len <= MINIMUM_DHCP_PACKET_SIZE) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4480 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4481 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4482 |
if (((struct ethhdr *) skb->data)->h_proto != htons(ETH_P_IP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4483 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4484 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4485 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4486 |
const struct iphdr *ip = (struct iphdr *)((u8 *)skb->data+14); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4487 |
struct udphdr *udp; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4488 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4489 |
if (ip->protocol != IPPROTO_UDP) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4490 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4491 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4492 |
udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4493 |
if (ntohs(udp->dest) != 67) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4494 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4495 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4496 |
offset = (u8 *)udp + 8 - skb->data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4497 |
length = skb->len - offset; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4498 |
return e1000e_mng_write_dhcp_info(hw, (u8 *)udp + 8, length); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4499 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4500 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4501 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4502 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4503 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4504 |
static int __e1000_maybe_stop_tx(struct net_device *netdev, int size) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4505 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4506 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4507 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4508 |
netif_stop_queue(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4509 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4510 |
* Herbert's original patch had: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4511 |
* smp_mb__after_netif_stop_queue(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4512 |
* but since that doesn't exist yet, just open code it. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4513 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4514 |
smp_mb(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4515 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4516 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4517 |
* We need to check again in a case another CPU has just |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4518 |
* made room available. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4519 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4520 |
if (e1000_desc_unused(adapter->tx_ring) < size) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4521 |
return -EBUSY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4522 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4523 |
/* A reprieve! */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4524 |
netif_start_queue(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4525 |
++adapter->restart_queue; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4526 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4527 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4528 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4529 |
static int e1000_maybe_stop_tx(struct net_device *netdev, int size) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4530 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4531 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4532 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4533 |
if (e1000_desc_unused(adapter->tx_ring) >= size) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4534 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4535 |
return __e1000_maybe_stop_tx(netdev, size); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4536 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4537 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4538 |
#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 ) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4539 |
static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4540 |
struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4541 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4542 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4543 |
struct e1000_ring *tx_ring = adapter->tx_ring; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4544 |
unsigned int first; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4545 |
unsigned int max_per_txd = E1000_MAX_PER_TXD; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4546 |
unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4547 |
unsigned int tx_flags = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4548 |
unsigned int len = skb_headlen(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4549 |
unsigned int nr_frags; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4550 |
unsigned int mss; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4551 |
int count = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4552 |
int tso; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4553 |
unsigned int f; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4554 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4555 |
if (test_bit(__E1000_DOWN, &adapter->state)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4556 |
dev_kfree_skb_any(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4557 |
return NETDEV_TX_OK; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4558 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4559 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4560 |
if (skb->len <= 0) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4561 |
dev_kfree_skb_any(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4562 |
return NETDEV_TX_OK; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4563 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4564 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4565 |
mss = skb_shinfo(skb)->gso_size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4566 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4567 |
* The controller does a simple calculation to |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4568 |
* make sure there is enough room in the FIFO before |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4569 |
* initiating the DMA for each buffer. The calc is: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4570 |
* 4 = ceil(buffer len/mss). To make sure we don't |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4571 |
* overrun the FIFO, adjust the max buffer len if mss |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4572 |
* drops. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4573 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4574 |
if (mss) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4575 |
u8 hdr_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4576 |
max_per_txd = min(mss << 2, max_per_txd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4577 |
max_txd_pwr = fls(max_per_txd) - 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4578 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4579 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4580 |
* TSO Workaround for 82571/2/3 Controllers -- if skb->data |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4581 |
* points to just header, pull a few bytes of payload from |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4582 |
* frags into skb->data |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4583 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4584 |
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4585 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4586 |
* we do this workaround for ES2LAN, but it is un-necessary, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4587 |
* avoiding it could save a lot of cycles |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4588 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4589 |
if (skb->data_len && (hdr_len == len)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4590 |
unsigned int pull_size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4591 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4592 |
pull_size = min((unsigned int)4, skb->data_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4593 |
if (!__pskb_pull_tail(skb, pull_size)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4594 |
e_err("__pskb_pull_tail failed.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4595 |
dev_kfree_skb_any(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4596 |
return NETDEV_TX_OK; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4597 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4598 |
len = skb_headlen(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4599 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4600 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4601 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4602 |
/* reserve a descriptor for the offload context */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4603 |
if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4604 |
count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4605 |
count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4606 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4607 |
count += TXD_USE_COUNT(len, max_txd_pwr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4608 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4609 |
nr_frags = skb_shinfo(skb)->nr_frags; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4610 |
for (f = 0; f < nr_frags; f++) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4611 |
count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4612 |
max_txd_pwr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4613 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4614 |
if (adapter->hw.mac.tx_pkt_filtering) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4615 |
e1000_transfer_dhcp_info(adapter, skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4616 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4617 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4618 |
* need: count + 2 desc gap to keep tail from touching |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4619 |
* head, otherwise try next time |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4620 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4621 |
if (e1000_maybe_stop_tx(netdev, count + 2)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4622 |
return NETDEV_TX_BUSY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4623 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4624 |
if (adapter->vlgrp && vlan_tx_tag_present(skb)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4625 |
tx_flags |= E1000_TX_FLAGS_VLAN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4626 |
tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4627 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4628 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4629 |
first = tx_ring->next_to_use; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4630 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4631 |
tso = e1000_tso(adapter, skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4632 |
if (tso < 0) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4633 |
dev_kfree_skb_any(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4634 |
return NETDEV_TX_OK; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4635 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4636 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4637 |
if (tso) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4638 |
tx_flags |= E1000_TX_FLAGS_TSO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4639 |
else if (e1000_tx_csum(adapter, skb)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4640 |
tx_flags |= E1000_TX_FLAGS_CSUM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4641 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4642 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4643 |
* Old method was to assume IPv4 packet by default if TSO was enabled. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4644 |
* 82571 hardware supports TSO capabilities for IPv6 as well... |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4645 |
* no longer assume, we must. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4646 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4647 |
if (skb->protocol == htons(ETH_P_IP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4648 |
tx_flags |= E1000_TX_FLAGS_IPV4; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4649 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4650 |
/* if count is 0 then mapping error has occured */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4651 |
count = e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4652 |
if (count) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4653 |
e1000_tx_queue(adapter, tx_flags, count); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4654 |
/* Make sure there is space in the ring for the next send. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4655 |
e1000_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 2); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4656 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4657 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4658 |
dev_kfree_skb_any(skb); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4659 |
tx_ring->buffer_info[first].time_stamp = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4660 |
tx_ring->next_to_use = first; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4661 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4662 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4663 |
return NETDEV_TX_OK; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4664 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4665 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4666 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4667 |
* e1000_tx_timeout - Respond to a Tx Hang |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4668 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4669 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4670 |
static void e1000_tx_timeout(struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4671 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4672 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4673 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4674 |
/* Do the reset outside of interrupt context */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4675 |
adapter->tx_timeout_count++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4676 |
schedule_work(&adapter->reset_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4677 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4678 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4679 |
static void e1000_reset_task(struct work_struct *work) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4680 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4681 |
struct e1000_adapter *adapter; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4682 |
adapter = container_of(work, struct e1000_adapter, reset_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4683 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4684 |
e1000e_dump(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4685 |
e_err("Reset adapter\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4686 |
e1000e_reinit_locked(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4687 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4688 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4689 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4690 |
* e1000_get_stats - Get System Network Statistics |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4691 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4692 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4693 |
* Returns the address of the device statistics structure. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4694 |
* The statistics are actually updated from the timer callback. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4695 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4696 |
static struct net_device_stats *e1000_get_stats(struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4697 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4698 |
/* only return the current stats */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4699 |
return &netdev->stats; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4700 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4701 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4702 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4703 |
* e1000_change_mtu - Change the Maximum Transfer Unit |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4704 |
* @netdev: network interface device structure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4705 |
* @new_mtu: new value for maximum frame size |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4706 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4707 |
* Returns 0 on success, negative on failure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4708 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4709 |
static int e1000_change_mtu(struct net_device *netdev, int new_mtu) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4710 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4711 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4712 |
int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4713 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4714 |
/* Jumbo frame support */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4715 |
if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4716 |
!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4717 |
e_err("Jumbo Frames not supported.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4718 |
return -EINVAL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4719 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4720 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4721 |
/* Supported frame sizes */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4722 |
if ((new_mtu < ETH_ZLEN + ETH_FCS_LEN + VLAN_HLEN) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4723 |
(max_frame > adapter->max_hw_frame_size)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4724 |
e_err("Unsupported MTU setting\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4725 |
return -EINVAL; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4726 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4727 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4728 |
/* 82573 Errata 17 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4729 |
if (((adapter->hw.mac.type == e1000_82573) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4730 |
(adapter->hw.mac.type == e1000_82574)) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4731 |
(max_frame > ETH_FRAME_LEN + ETH_FCS_LEN)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4732 |
adapter->flags2 |= FLAG2_DISABLE_ASPM_L1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4733 |
e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4734 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4735 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4736 |
while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4737 |
msleep(1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4738 |
/* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4739 |
adapter->max_frame_size = max_frame; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4740 |
e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4741 |
netdev->mtu = new_mtu; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4742 |
if (netif_running(netdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4743 |
e1000e_down(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4744 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4745 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4746 |
* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4747 |
* means we reserve 2 more, this pushes us to allocate from the next |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4748 |
* larger slab size. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4749 |
* i.e. RXBUFFER_2048 --> size-4096 slab |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4750 |
* However with the new *_jumbo_rx* routines, jumbo receives will use |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4751 |
* fragmented skbs |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4752 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4753 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4754 |
if (max_frame <= 2048) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4755 |
adapter->rx_buffer_len = 2048; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4756 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4757 |
adapter->rx_buffer_len = 4096; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4758 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4759 |
/* adjust allocation if LPE protects us, and we aren't using SBP */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4760 |
if ((max_frame == ETH_FRAME_LEN + ETH_FCS_LEN) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4761 |
(max_frame == ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4762 |
adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4763 |
+ ETH_FCS_LEN; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4764 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4765 |
if (netif_running(netdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4766 |
e1000e_up(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4767 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4768 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4769 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4770 |
clear_bit(__E1000_RESETTING, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4771 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4772 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4773 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4774 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4775 |
static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4776 |
int cmd) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4777 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4778 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4779 |
struct mii_ioctl_data *data = if_mii(ifr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4780 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4781 |
if (adapter->hw.phy.media_type != e1000_media_type_copper) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4782 |
return -EOPNOTSUPP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4783 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4784 |
switch (cmd) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4785 |
case SIOCGMIIPHY: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4786 |
data->phy_id = adapter->hw.phy.addr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4787 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4788 |
case SIOCGMIIREG: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4789 |
e1000_phy_read_status(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4790 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4791 |
switch (data->reg_num & 0x1F) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4792 |
case MII_BMCR: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4793 |
data->val_out = adapter->phy_regs.bmcr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4794 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4795 |
case MII_BMSR: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4796 |
data->val_out = adapter->phy_regs.bmsr; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4797 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4798 |
case MII_PHYSID1: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4799 |
data->val_out = (adapter->hw.phy.id >> 16); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4800 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4801 |
case MII_PHYSID2: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4802 |
data->val_out = (adapter->hw.phy.id & 0xFFFF); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4803 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4804 |
case MII_ADVERTISE: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4805 |
data->val_out = adapter->phy_regs.advertise; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4806 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4807 |
case MII_LPA: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4808 |
data->val_out = adapter->phy_regs.lpa; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4809 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4810 |
case MII_EXPANSION: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4811 |
data->val_out = adapter->phy_regs.expansion; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4812 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4813 |
case MII_CTRL1000: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4814 |
data->val_out = adapter->phy_regs.ctrl1000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4815 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4816 |
case MII_STAT1000: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4817 |
data->val_out = adapter->phy_regs.stat1000; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4818 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4819 |
case MII_ESTATUS: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4820 |
data->val_out = adapter->phy_regs.estatus; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4821 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4822 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4823 |
return -EIO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4824 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4825 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4826 |
case SIOCSMIIREG: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4827 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4828 |
return -EOPNOTSUPP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4829 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4830 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4831 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4832 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4833 |
static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4834 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4835 |
switch (cmd) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4836 |
case SIOCGMIIPHY: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4837 |
case SIOCGMIIREG: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4838 |
case SIOCSMIIREG: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4839 |
return e1000_mii_ioctl(netdev, ifr, cmd); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4840 |
default: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4841 |
return -EOPNOTSUPP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4842 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4843 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4844 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4845 |
static int e1000_init_phy_wakeup(struct e1000_adapter *adapter, u32 wufc) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4846 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4847 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4848 |
u32 i, mac_reg; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4849 |
u16 phy_reg; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4850 |
int retval = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4851 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4852 |
/* copy MAC RARs to PHY RARs */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4853 |
for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4854 |
mac_reg = er32(RAL(i)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4855 |
e1e_wphy(hw, BM_RAR_L(i), (u16)(mac_reg & 0xFFFF)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4856 |
e1e_wphy(hw, BM_RAR_M(i), (u16)((mac_reg >> 16) & 0xFFFF)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4857 |
mac_reg = er32(RAH(i)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4858 |
e1e_wphy(hw, BM_RAR_H(i), (u16)(mac_reg & 0xFFFF)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4859 |
e1e_wphy(hw, BM_RAR_CTRL(i), (u16)((mac_reg >> 16) & 0xFFFF)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4860 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4861 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4862 |
/* copy MAC MTA to PHY MTA */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4863 |
for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4864 |
mac_reg = E1000_READ_REG_ARRAY(hw, E1000_MTA, i); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4865 |
e1e_wphy(hw, BM_MTA(i), (u16)(mac_reg & 0xFFFF)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4866 |
e1e_wphy(hw, BM_MTA(i) + 1, (u16)((mac_reg >> 16) & 0xFFFF)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4867 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4868 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4869 |
/* configure PHY Rx Control register */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4870 |
e1e_rphy(&adapter->hw, BM_RCTL, &phy_reg); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4871 |
mac_reg = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4872 |
if (mac_reg & E1000_RCTL_UPE) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4873 |
phy_reg |= BM_RCTL_UPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4874 |
if (mac_reg & E1000_RCTL_MPE) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4875 |
phy_reg |= BM_RCTL_MPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4876 |
phy_reg &= ~(BM_RCTL_MO_MASK); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4877 |
if (mac_reg & E1000_RCTL_MO_3) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4878 |
phy_reg |= (((mac_reg & E1000_RCTL_MO_3) >> E1000_RCTL_MO_SHIFT) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4879 |
<< BM_RCTL_MO_SHIFT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4880 |
if (mac_reg & E1000_RCTL_BAM) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4881 |
phy_reg |= BM_RCTL_BAM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4882 |
if (mac_reg & E1000_RCTL_PMCF) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4883 |
phy_reg |= BM_RCTL_PMCF; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4884 |
mac_reg = er32(CTRL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4885 |
if (mac_reg & E1000_CTRL_RFCE) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4886 |
phy_reg |= BM_RCTL_RFCE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4887 |
e1e_wphy(&adapter->hw, BM_RCTL, phy_reg); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4888 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4889 |
/* enable PHY wakeup in MAC register */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4890 |
ew32(WUFC, wufc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4891 |
ew32(WUC, E1000_WUC_PHY_WAKE | E1000_WUC_PME_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4892 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4893 |
/* configure and enable PHY wakeup in PHY registers */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4894 |
e1e_wphy(&adapter->hw, BM_WUFC, wufc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4895 |
e1e_wphy(&adapter->hw, BM_WUC, E1000_WUC_PME_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4896 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4897 |
/* activate PHY wakeup */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4898 |
retval = hw->phy.ops.acquire(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4899 |
if (retval) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4900 |
e_err("Could not acquire PHY\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4901 |
return retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4902 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4903 |
e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4904 |
(BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4905 |
retval = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &phy_reg); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4906 |
if (retval) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4907 |
e_err("Could not read PHY page 769\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4908 |
goto out; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4909 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4910 |
phy_reg |= BM_WUC_ENABLE_BIT | BM_WUC_HOST_WU_BIT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4911 |
retval = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4912 |
if (retval) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4913 |
e_err("Could not set PHY Host Wakeup bit\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4914 |
out: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4915 |
hw->phy.ops.release(hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4916 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4917 |
return retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4918 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4919 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4920 |
static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4921 |
bool runtime) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4922 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4923 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4924 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4925 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4926 |
u32 ctrl, ctrl_ext, rctl, status; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4927 |
/* Runtime suspend should only enable wakeup for link changes */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4928 |
u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4929 |
int retval = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4930 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4931 |
netif_device_detach(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4932 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4933 |
if (netif_running(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4934 |
WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4935 |
e1000e_down(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4936 |
e1000_free_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4937 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4938 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4939 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4940 |
retval = pci_save_state(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4941 |
if (retval) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4942 |
return retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4943 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4944 |
status = er32(STATUS); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4945 |
if (status & E1000_STATUS_LU) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4946 |
wufc &= ~E1000_WUFC_LNKC; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4947 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4948 |
if (wufc) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4949 |
e1000_setup_rctl(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4950 |
e1000_set_multi(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4951 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4952 |
/* turn on all-multi mode if wake on multicast is enabled */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4953 |
if (wufc & E1000_WUFC_MC) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4954 |
rctl = er32(RCTL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4955 |
rctl |= E1000_RCTL_MPE; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4956 |
ew32(RCTL, rctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4957 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4958 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4959 |
ctrl = er32(CTRL); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4960 |
/* advertise wake from D3Cold */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4961 |
#define E1000_CTRL_ADVD3WUC 0x00100000 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4962 |
/* phy power management enable */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4963 |
#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4964 |
ctrl |= E1000_CTRL_ADVD3WUC; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4965 |
if (!(adapter->flags2 & FLAG2_HAS_PHY_WAKEUP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4966 |
ctrl |= E1000_CTRL_EN_PHY_PWR_MGMT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4967 |
ew32(CTRL, ctrl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4968 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4969 |
if (adapter->hw.phy.media_type == e1000_media_type_fiber || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4970 |
adapter->hw.phy.media_type == |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4971 |
e1000_media_type_internal_serdes) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4972 |
/* keep the laser running in D3 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4973 |
ctrl_ext = er32(CTRL_EXT); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4974 |
ctrl_ext |= E1000_CTRL_EXT_SDP3_DATA; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4975 |
ew32(CTRL_EXT, ctrl_ext); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4976 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4977 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4978 |
if (adapter->flags & FLAG_IS_ICH) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4979 |
e1000e_disable_gig_wol_ich8lan(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4980 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4981 |
/* Allow time for pending master requests to run */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4982 |
e1000e_disable_pcie_master(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4983 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4984 |
if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4985 |
/* enable wakeup by the PHY */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4986 |
retval = e1000_init_phy_wakeup(adapter, wufc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4987 |
if (retval) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4988 |
return retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4989 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4990 |
/* enable wakeup by the MAC */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4991 |
ew32(WUFC, wufc); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4992 |
ew32(WUC, E1000_WUC_PME_EN); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4993 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4994 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4995 |
ew32(WUC, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4996 |
ew32(WUFC, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4997 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4998 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4999 |
*enable_wake = !!wufc; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5000 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5001 |
/* make sure adapter isn't asleep if manageability is enabled */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5002 |
if ((adapter->flags & FLAG_MNG_PT_ENABLED) || |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5003 |
(hw->mac.ops.check_mng_mode(hw))) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5004 |
*enable_wake = true; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5005 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5006 |
if (adapter->hw.phy.type == e1000_phy_igp_3) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5007 |
e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5008 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5009 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5010 |
* Release control of h/w to f/w. If f/w is AMT enabled, this |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5011 |
* would have already happened in close and is redundant. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5012 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5013 |
e1000_release_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5014 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5015 |
pci_disable_device(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5016 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5017 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5018 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5019 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5020 |
static void e1000_power_off(struct pci_dev *pdev, bool sleep, bool wake) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5021 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5022 |
if (sleep && wake) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5023 |
pci_prepare_to_sleep(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5024 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5025 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5026 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5027 |
pci_wake_from_d3(pdev, wake); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5028 |
pci_set_power_state(pdev, PCI_D3hot); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5029 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5030 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5031 |
static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5032 |
bool wake) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5033 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5034 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5035 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5036 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5037 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5038 |
* The pci-e switch on some quad port adapters will report a |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5039 |
* correctable error when the MAC transitions from D0 to D3. To |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5040 |
* prevent this we need to mask off the correctable errors on the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5041 |
* downstream port of the pci-e switch. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5042 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5043 |
if (adapter->flags & FLAG_IS_QUAD_PORT) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5044 |
struct pci_dev *us_dev = pdev->bus->self; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5045 |
int pos = pci_find_capability(us_dev, PCI_CAP_ID_EXP); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5046 |
u16 devctl; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5047 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5048 |
pci_read_config_word(us_dev, pos + PCI_EXP_DEVCTL, &devctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5049 |
pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5050 |
(devctl & ~PCI_EXP_DEVCTL_CERE)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5051 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5052 |
e1000_power_off(pdev, sleep, wake); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5053 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5054 |
pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5055 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5056 |
e1000_power_off(pdev, sleep, wake); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5057 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5058 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5059 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5060 |
#ifdef CONFIG_PCIEASPM |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5061 |
static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5062 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5063 |
pci_disable_link_state(pdev, state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5064 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5065 |
#else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5066 |
static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5067 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5068 |
int pos; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5069 |
u16 reg16; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5070 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5071 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5072 |
* Both device and parent should have the same ASPM setting. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5073 |
* Disable ASPM in downstream component first and then upstream. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5074 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5075 |
pos = pci_pcie_cap(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5076 |
pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5077 |
reg16 &= ~state; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5078 |
pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5079 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5080 |
if (!pdev->bus->self) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5081 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5082 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5083 |
pos = pci_pcie_cap(pdev->bus->self); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5084 |
pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, ®16); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5085 |
reg16 &= ~state; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5086 |
pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5087 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5088 |
#endif |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5089 |
void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5090 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5091 |
dev_info(&pdev->dev, "Disabling ASPM %s %s\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5092 |
(state & PCIE_LINK_STATE_L0S) ? "L0s" : "", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5093 |
(state & PCIE_LINK_STATE_L1) ? "L1" : ""); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5094 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5095 |
__e1000e_disable_aspm(pdev, state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5096 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5097 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5098 |
#ifdef CONFIG_PM_OPS |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5099 |
static bool e1000e_pm_ready(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5100 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5101 |
return !!adapter->tx_ring->buffer_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5102 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5103 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5104 |
static int __e1000_resume(struct pci_dev *pdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5105 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5106 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5107 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5108 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5109 |
u32 err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5110 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5111 |
pci_set_power_state(pdev, PCI_D0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5112 |
pci_restore_state(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5113 |
pci_save_state(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5114 |
if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5115 |
e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5116 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5117 |
e1000e_set_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5118 |
if (netif_running(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5119 |
err = e1000_request_irq(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5120 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5121 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5122 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5123 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5124 |
e1000e_power_up_phy(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5125 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5126 |
/* report the system wakeup cause from S3/S4 */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5127 |
if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5128 |
u16 phy_data; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5129 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5130 |
e1e_rphy(&adapter->hw, BM_WUS, &phy_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5131 |
if (phy_data) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5132 |
e_info("PHY Wakeup cause - %s\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5133 |
phy_data & E1000_WUS_EX ? "Unicast Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5134 |
phy_data & E1000_WUS_MC ? "Multicast Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5135 |
phy_data & E1000_WUS_BC ? "Broadcast Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5136 |
phy_data & E1000_WUS_MAG ? "Magic Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5137 |
phy_data & E1000_WUS_LNKC ? "Link Status " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5138 |
" Change" : "other"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5139 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5140 |
e1e_wphy(&adapter->hw, BM_WUS, ~0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5141 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5142 |
u32 wus = er32(WUS); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5143 |
if (wus) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5144 |
e_info("MAC Wakeup cause - %s\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5145 |
wus & E1000_WUS_EX ? "Unicast Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5146 |
wus & E1000_WUS_MC ? "Multicast Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5147 |
wus & E1000_WUS_BC ? "Broadcast Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5148 |
wus & E1000_WUS_MAG ? "Magic Packet" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5149 |
wus & E1000_WUS_LNKC ? "Link Status Change" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5150 |
"other"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5151 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5152 |
ew32(WUS, ~0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5153 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5154 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5155 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5156 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5157 |
e1000_init_manageability_pt(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5158 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5159 |
if (netif_running(netdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5160 |
e1000e_up(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5161 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5162 |
netif_device_attach(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5163 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5164 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5165 |
* If the controller has AMT, do not set DRV_LOAD until the interface |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5166 |
* is up. For all other cases, let the f/w know that the h/w is now |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5167 |
* under the control of the driver. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5168 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5169 |
if (!(adapter->flags & FLAG_HAS_AMT)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5170 |
e1000_get_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5171 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5172 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5173 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5174 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5175 |
#ifdef CONFIG_PM_SLEEP |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5176 |
static int e1000_suspend(struct device *dev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5177 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5178 |
struct pci_dev *pdev = to_pci_dev(dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5179 |
int retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5180 |
bool wake; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5181 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5182 |
retval = __e1000_shutdown(pdev, &wake, false); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5183 |
if (!retval) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5184 |
e1000_complete_shutdown(pdev, true, wake); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5185 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5186 |
return retval; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5187 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5188 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5189 |
static int e1000_resume(struct device *dev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5190 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5191 |
struct pci_dev *pdev = to_pci_dev(dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5192 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5193 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5194 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5195 |
if (e1000e_pm_ready(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5196 |
adapter->idle_check = true; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5197 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5198 |
return __e1000_resume(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5199 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5200 |
#endif /* CONFIG_PM_SLEEP */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5201 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5202 |
#ifdef CONFIG_PM_RUNTIME |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5203 |
static int e1000_runtime_suspend(struct device *dev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5204 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5205 |
struct pci_dev *pdev = to_pci_dev(dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5206 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5207 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5208 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5209 |
if (e1000e_pm_ready(adapter)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5210 |
bool wake; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5211 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5212 |
__e1000_shutdown(pdev, &wake, true); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5213 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5214 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5215 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5216 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5217 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5218 |
static int e1000_idle(struct device *dev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5219 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5220 |
struct pci_dev *pdev = to_pci_dev(dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5221 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5222 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5223 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5224 |
if (!e1000e_pm_ready(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5225 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5226 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5227 |
if (adapter->idle_check) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5228 |
adapter->idle_check = false; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5229 |
if (!e1000e_has_link(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5230 |
pm_schedule_suspend(dev, MSEC_PER_SEC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5231 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5232 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5233 |
return -EBUSY; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5234 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5235 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5236 |
static int e1000_runtime_resume(struct device *dev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5237 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5238 |
struct pci_dev *pdev = to_pci_dev(dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5239 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5240 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5241 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5242 |
if (!e1000e_pm_ready(adapter)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5243 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5244 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5245 |
adapter->idle_check = !dev->power.runtime_auto; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5246 |
return __e1000_resume(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5247 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5248 |
#endif /* CONFIG_PM_RUNTIME */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5249 |
#endif /* CONFIG_PM_OPS */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5250 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5251 |
static void e1000_shutdown(struct pci_dev *pdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5252 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5253 |
bool wake = false; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5254 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5255 |
__e1000_shutdown(pdev, &wake, false); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5256 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5257 |
if (system_state == SYSTEM_POWER_OFF) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5258 |
e1000_complete_shutdown(pdev, false, wake); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5259 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5260 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5261 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5262 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5263 |
* Polling 'interrupt' - used by things like netconsole to send skbs |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5264 |
* without having to re-enable interrupts. It's not called while |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5265 |
* the interrupt routine is executing. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5266 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5267 |
static void e1000_netpoll(struct net_device *netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5268 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5269 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5270 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5271 |
disable_irq(adapter->pdev->irq); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5272 |
e1000_intr(adapter->pdev->irq, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5273 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5274 |
enable_irq(adapter->pdev->irq); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5275 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5276 |
#endif |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5277 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5278 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5279 |
* e1000_io_error_detected - called when PCI error is detected |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5280 |
* @pdev: Pointer to PCI device |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5281 |
* @state: The current pci connection state |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5282 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5283 |
* This function is called after a PCI bus error affecting |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5284 |
* this device has been detected. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5285 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5286 |
static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5287 |
pci_channel_state_t state) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5288 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5289 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5290 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5291 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5292 |
netif_device_detach(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5293 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5294 |
if (state == pci_channel_io_perm_failure) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5295 |
return PCI_ERS_RESULT_DISCONNECT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5296 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5297 |
if (netif_running(netdev)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5298 |
e1000e_down(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5299 |
pci_disable_device(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5300 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5301 |
/* Request a slot slot reset. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5302 |
return PCI_ERS_RESULT_NEED_RESET; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5303 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5304 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5305 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5306 |
* e1000_io_slot_reset - called after the pci bus has been reset. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5307 |
* @pdev: Pointer to PCI device |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5308 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5309 |
* Restart the card from scratch, as if from a cold-boot. Implementation |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5310 |
* resembles the first-half of the e1000_resume routine. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5311 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5312 |
static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5313 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5314 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5315 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5316 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5317 |
int err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5318 |
pci_ers_result_t result; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5319 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5320 |
if (adapter->flags2 & FLAG2_DISABLE_ASPM_L1) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5321 |
e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5322 |
err = pci_enable_device_mem(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5323 |
if (err) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5324 |
dev_err(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5325 |
"Cannot re-enable PCI device after reset.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5326 |
result = PCI_ERS_RESULT_DISCONNECT; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5327 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5328 |
pci_set_master(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5329 |
pdev->state_saved = true; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5330 |
pci_restore_state(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5331 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5332 |
pci_enable_wake(pdev, PCI_D3hot, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5333 |
pci_enable_wake(pdev, PCI_D3cold, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5334 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5335 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5336 |
ew32(WUS, ~0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5337 |
result = PCI_ERS_RESULT_RECOVERED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5338 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5339 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5340 |
pci_cleanup_aer_uncorrect_error_status(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5341 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5342 |
return result; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5343 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5344 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5345 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5346 |
* e1000_io_resume - called when traffic can start flowing again. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5347 |
* @pdev: Pointer to PCI device |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5348 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5349 |
* This callback is called when the error recovery driver tells us that |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5350 |
* its OK to resume normal operation. Implementation resembles the |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5351 |
* second-half of the e1000_resume routine. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5352 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5353 |
static void e1000_io_resume(struct pci_dev *pdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5354 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5355 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5356 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5357 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5358 |
e1000_init_manageability_pt(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5359 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5360 |
if (netif_running(netdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5361 |
if (e1000e_up(adapter)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5362 |
dev_err(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5363 |
"can't bring device back up after reset\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5364 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5365 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5366 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5367 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5368 |
netif_device_attach(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5369 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5370 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5371 |
* If the controller has AMT, do not set DRV_LOAD until the interface |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5372 |
* is up. For all other cases, let the f/w know that the h/w is now |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5373 |
* under the control of the driver. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5374 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5375 |
if (!(adapter->flags & FLAG_HAS_AMT)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5376 |
e1000_get_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5377 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5378 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5379 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5380 |
static void e1000_print_device_info(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5381 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5382 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5383 |
struct net_device *netdev = adapter->netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5384 |
u32 pba_num; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5385 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5386 |
/* print bus type/speed/width info */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5387 |
e_info("(PCI Express:2.5GB/s:%s) %pM\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5388 |
/* bus width */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5389 |
((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" : |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5390 |
"Width x1"), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5391 |
/* MAC address */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5392 |
netdev->dev_addr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5393 |
e_info("Intel(R) PRO/%s Network Connection\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5394 |
(hw->phy.type == e1000_phy_ife) ? "10/100" : "1000"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5395 |
e1000e_read_pba_num(hw, &pba_num); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5396 |
e_info("MAC: %d, PHY: %d, PBA No: %06x-%03x\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5397 |
hw->mac.type, hw->phy.type, (pba_num >> 8), (pba_num & 0xff)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5398 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5399 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5400 |
static void e1000_eeprom_checks(struct e1000_adapter *adapter) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5401 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5402 |
struct e1000_hw *hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5403 |
int ret_val; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5404 |
u16 buf = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5405 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5406 |
if (hw->mac.type != e1000_82573) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5407 |
return; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5408 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5409 |
ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &buf); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5410 |
if (!ret_val && (!(le16_to_cpu(buf) & (1 << 0)))) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5411 |
/* Deep Smart Power Down (DSPD) */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5412 |
dev_warn(&adapter->pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5413 |
"Warning: detected DSPD enabled in EEPROM\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5414 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5415 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5416 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5417 |
static const struct net_device_ops e1000e_netdev_ops = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5418 |
.ndo_open = e1000_open, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5419 |
.ndo_stop = e1000_close, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5420 |
.ndo_start_xmit = e1000_xmit_frame, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5421 |
.ndo_get_stats = e1000_get_stats, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5422 |
.ndo_set_multicast_list = e1000_set_multi, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5423 |
.ndo_set_mac_address = e1000_set_mac, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5424 |
.ndo_change_mtu = e1000_change_mtu, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5425 |
.ndo_do_ioctl = e1000_ioctl, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5426 |
.ndo_tx_timeout = e1000_tx_timeout, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5427 |
.ndo_validate_addr = eth_validate_addr, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5428 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5429 |
.ndo_vlan_rx_register = e1000_vlan_rx_register, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5430 |
.ndo_vlan_rx_add_vid = e1000_vlan_rx_add_vid, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5431 |
.ndo_vlan_rx_kill_vid = e1000_vlan_rx_kill_vid, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5432 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5433 |
.ndo_poll_controller = e1000_netpoll, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5434 |
#endif |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5435 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5436 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5437 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5438 |
* e1000_probe - Device Initialization Routine |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5439 |
* @pdev: PCI device information struct |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5440 |
* @ent: entry in e1000_pci_tbl |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5441 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5442 |
* Returns 0 on success, negative on failure |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5443 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5444 |
* e1000_probe initializes an adapter identified by a pci_dev structure. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5445 |
* The OS initialization, configuring of the adapter private structure, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5446 |
* and a hardware reset occur. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5447 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5448 |
static int __devinit e1000_probe(struct pci_dev *pdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5449 |
const struct pci_device_id *ent) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5450 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5451 |
struct net_device *netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5452 |
struct e1000_adapter *adapter; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5453 |
struct e1000_hw *hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5454 |
const struct e1000_info *ei = e1000_info_tbl[ent->driver_data]; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5455 |
resource_size_t mmio_start, mmio_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5456 |
resource_size_t flash_start, flash_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5457 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5458 |
static int cards_found; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5459 |
int i, err, pci_using_dac; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5460 |
u16 eeprom_data = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5461 |
u16 eeprom_apme_mask = E1000_EEPROM_APME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5462 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5463 |
if (ei->flags2 & FLAG2_DISABLE_ASPM_L1) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5464 |
e1000e_disable_aspm(pdev, PCIE_LINK_STATE_L1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5465 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5466 |
err = pci_enable_device_mem(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5467 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5468 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5469 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5470 |
pci_using_dac = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5471 |
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5472 |
if (!err) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5473 |
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5474 |
if (!err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5475 |
pci_using_dac = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5476 |
} else { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5477 |
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5478 |
if (err) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5479 |
err = dma_set_coherent_mask(&pdev->dev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5480 |
DMA_BIT_MASK(32)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5481 |
if (err) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5482 |
dev_err(&pdev->dev, "No usable DMA " |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5483 |
"configuration, aborting\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5484 |
goto err_dma; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5485 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5486 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5487 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5488 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5489 |
err = pci_request_selected_regions_exclusive(pdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5490 |
pci_select_bars(pdev, IORESOURCE_MEM), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5491 |
e1000e_driver_name); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5492 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5493 |
goto err_pci_reg; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5494 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5495 |
/* AER (Advanced Error Reporting) hooks */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5496 |
pci_enable_pcie_error_reporting(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5497 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5498 |
pci_set_master(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5499 |
/* PCI config space info */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5500 |
err = pci_save_state(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5501 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5502 |
goto err_alloc_etherdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5503 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5504 |
err = -ENOMEM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5505 |
netdev = alloc_etherdev(sizeof(struct e1000_adapter)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5506 |
if (!netdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5507 |
goto err_alloc_etherdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5508 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5509 |
SET_NETDEV_DEV(netdev, &pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5510 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5511 |
netdev->irq = pdev->irq; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5512 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5513 |
pci_set_drvdata(pdev, netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5514 |
adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5515 |
hw = &adapter->hw; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5516 |
adapter->netdev = netdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5517 |
adapter->pdev = pdev; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5518 |
adapter->ei = ei; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5519 |
adapter->pba = ei->pba; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5520 |
adapter->flags = ei->flags; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5521 |
adapter->flags2 = ei->flags2; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5522 |
adapter->hw.adapter = adapter; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5523 |
adapter->hw.mac.type = ei->mac; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5524 |
adapter->max_hw_frame_size = ei->max_hw_frame_size; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5525 |
adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5526 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5527 |
mmio_start = pci_resource_start(pdev, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5528 |
mmio_len = pci_resource_len(pdev, 0); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5529 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5530 |
err = -EIO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5531 |
adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5532 |
if (!adapter->hw.hw_addr) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5533 |
goto err_ioremap; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5534 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5535 |
if ((adapter->flags & FLAG_HAS_FLASH) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5536 |
(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5537 |
flash_start = pci_resource_start(pdev, 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5538 |
flash_len = pci_resource_len(pdev, 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5539 |
adapter->hw.flash_address = ioremap(flash_start, flash_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5540 |
if (!adapter->hw.flash_address) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5541 |
goto err_flashmap; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5542 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5543 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5544 |
/* construct the net_device struct */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5545 |
netdev->netdev_ops = &e1000e_netdev_ops; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5546 |
e1000e_set_ethtool_ops(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5547 |
netdev->watchdog_timeo = 5 * HZ; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5548 |
netif_napi_add(netdev, &adapter->napi, e1000_clean, 64); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5549 |
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5550 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5551 |
netdev->mem_start = mmio_start; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5552 |
netdev->mem_end = mmio_start + mmio_len; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5553 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5554 |
adapter->bd_number = cards_found++; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5555 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5556 |
e1000e_check_options(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5557 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5558 |
/* setup adapter struct */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5559 |
err = e1000_sw_init(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5560 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5561 |
goto err_sw_init; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5562 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5563 |
err = -EIO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5564 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5565 |
memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5566 |
memcpy(&hw->nvm.ops, ei->nvm_ops, sizeof(hw->nvm.ops)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5567 |
memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5568 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5569 |
err = ei->get_variants(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5570 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5571 |
goto err_hw_init; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5572 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5573 |
if ((adapter->flags & FLAG_IS_ICH) && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5574 |
(adapter->flags & FLAG_READ_ONLY_NVM)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5575 |
e1000e_write_protect_nvm_ich8lan(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5576 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5577 |
hw->mac.ops.get_bus_info(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5578 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5579 |
adapter->hw.phy.autoneg_wait_to_complete = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5580 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5581 |
/* Copper options */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5582 |
if (adapter->hw.phy.media_type == e1000_media_type_copper) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5583 |
adapter->hw.phy.mdix = AUTO_ALL_MODES; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5584 |
adapter->hw.phy.disable_polarity_correction = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5585 |
adapter->hw.phy.ms_type = e1000_ms_hw_default; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5586 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5587 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5588 |
if (e1000_check_reset_block(&adapter->hw)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5589 |
e_info("PHY reset is blocked due to SOL/IDER session.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5590 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5591 |
netdev->features = NETIF_F_SG | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5592 |
NETIF_F_HW_CSUM | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5593 |
NETIF_F_HW_VLAN_TX | |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5594 |
NETIF_F_HW_VLAN_RX; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5595 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5596 |
if (adapter->flags & FLAG_HAS_HW_VLAN_FILTER) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5597 |
netdev->features |= NETIF_F_HW_VLAN_FILTER; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5598 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5599 |
netdev->features |= NETIF_F_TSO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5600 |
netdev->features |= NETIF_F_TSO6; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5601 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5602 |
netdev->vlan_features |= NETIF_F_TSO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5603 |
netdev->vlan_features |= NETIF_F_TSO6; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5604 |
netdev->vlan_features |= NETIF_F_HW_CSUM; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5605 |
netdev->vlan_features |= NETIF_F_SG; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5606 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5607 |
if (pci_using_dac) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5608 |
netdev->features |= NETIF_F_HIGHDMA; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5609 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5610 |
if (e1000e_enable_mng_pass_thru(&adapter->hw)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5611 |
adapter->flags |= FLAG_MNG_PT_ENABLED; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5612 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5613 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5614 |
* before reading the NVM, reset the controller to |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5615 |
* put the device in a known good starting state |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5616 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5617 |
adapter->hw.mac.ops.reset_hw(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5618 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5619 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5620 |
* systems with ASPM and others may see the checksum fail on the first |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5621 |
* attempt. Let's give it a few tries |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5622 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5623 |
for (i = 0;; i++) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5624 |
if (e1000_validate_nvm_checksum(&adapter->hw) >= 0) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5625 |
break; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5626 |
if (i == 2) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5627 |
e_err("The NVM Checksum Is Not Valid\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5628 |
err = -EIO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5629 |
goto err_eeprom; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5630 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5631 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5632 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5633 |
e1000_eeprom_checks(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5634 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5635 |
/* copy the MAC address */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5636 |
if (e1000e_read_mac_addr(&adapter->hw)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5637 |
e_err("NVM Read Error while reading MAC address\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5638 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5639 |
memcpy(netdev->dev_addr, adapter->hw.mac.addr, netdev->addr_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5640 |
memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5641 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5642 |
if (!is_valid_ether_addr(netdev->perm_addr)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5643 |
e_err("Invalid MAC Address: %pM\n", netdev->perm_addr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5644 |
err = -EIO; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5645 |
goto err_eeprom; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5646 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5647 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5648 |
init_timer(&adapter->watchdog_timer); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5649 |
adapter->watchdog_timer.function = &e1000_watchdog; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5650 |
adapter->watchdog_timer.data = (unsigned long) adapter; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5651 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5652 |
init_timer(&adapter->phy_info_timer); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5653 |
adapter->phy_info_timer.function = &e1000_update_phy_info; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5654 |
adapter->phy_info_timer.data = (unsigned long) adapter; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5655 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5656 |
INIT_WORK(&adapter->reset_task, e1000_reset_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5657 |
INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5658 |
INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5659 |
INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5660 |
INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5661 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5662 |
/* Initialize link parameters. User can change them with ethtool */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5663 |
adapter->hw.mac.autoneg = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5664 |
adapter->fc_autoneg = 1; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5665 |
adapter->hw.fc.requested_mode = e1000_fc_default; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5666 |
adapter->hw.fc.current_mode = e1000_fc_default; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5667 |
adapter->hw.phy.autoneg_advertised = 0x2f; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5668 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5669 |
/* ring size defaults */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5670 |
adapter->rx_ring->count = 256; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5671 |
adapter->tx_ring->count = 256; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5672 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5673 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5674 |
* Initial Wake on LAN setting - If APM wake is enabled in |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5675 |
* the EEPROM, enable the ACPI Magic Packet filter |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5676 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5677 |
if (adapter->flags & FLAG_APME_IN_WUC) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5678 |
/* APME bit in EEPROM is mapped to WUC.APME */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5679 |
eeprom_data = er32(WUC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5680 |
eeprom_apme_mask = E1000_WUC_APME; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5681 |
if (eeprom_data & E1000_WUC_PHY_WAKE) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5682 |
adapter->flags2 |= FLAG2_HAS_PHY_WAKEUP; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5683 |
} else if (adapter->flags & FLAG_APME_IN_CTRL3) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5684 |
if (adapter->flags & FLAG_APME_CHECK_PORT_B && |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5685 |
(adapter->hw.bus.func == 1)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5686 |
e1000_read_nvm(&adapter->hw, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5687 |
NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5688 |
else |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5689 |
e1000_read_nvm(&adapter->hw, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5690 |
NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5691 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5692 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5693 |
/* fetch WoL from EEPROM */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5694 |
if (eeprom_data & eeprom_apme_mask) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5695 |
adapter->eeprom_wol |= E1000_WUFC_MAG; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5696 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5697 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5698 |
* now that we have the eeprom settings, apply the special cases |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5699 |
* where the eeprom may be wrong or the board simply won't support |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5700 |
* wake on lan on a particular port |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5701 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5702 |
if (!(adapter->flags & FLAG_HAS_WOL)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5703 |
adapter->eeprom_wol = 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5704 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5705 |
/* initialize the wol settings based on the eeprom settings */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5706 |
adapter->wol = adapter->eeprom_wol; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5707 |
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5708 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5709 |
/* save off EEPROM version number */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5710 |
e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5711 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5712 |
/* reset the hardware with the new settings */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5713 |
e1000e_reset(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5714 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5715 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5716 |
* If the controller has AMT, do not set DRV_LOAD until the interface |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5717 |
* is up. For all other cases, let the f/w know that the h/w is now |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5718 |
* under the control of the driver. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5719 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5720 |
if (!(adapter->flags & FLAG_HAS_AMT)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5721 |
e1000_get_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5722 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5723 |
strcpy(netdev->name, "eth%d"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5724 |
err = register_netdev(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5725 |
if (err) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5726 |
goto err_register; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5727 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5728 |
/* carrier off reporting is important to ethtool even BEFORE open */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5729 |
netif_carrier_off(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5730 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5731 |
e1000_print_device_info(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5732 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5733 |
if (pci_dev_run_wake(pdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5734 |
pm_runtime_set_active(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5735 |
pm_runtime_enable(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5736 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5737 |
pm_schedule_suspend(&pdev->dev, MSEC_PER_SEC); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5738 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5739 |
return 0; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5740 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5741 |
err_register: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5742 |
if (!(adapter->flags & FLAG_HAS_AMT)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5743 |
e1000_release_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5744 |
err_eeprom: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5745 |
if (!e1000_check_reset_block(&adapter->hw)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5746 |
e1000_phy_hw_reset(&adapter->hw); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5747 |
err_hw_init: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5748 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5749 |
kfree(adapter->tx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5750 |
kfree(adapter->rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5751 |
err_sw_init: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5752 |
if (adapter->hw.flash_address) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5753 |
iounmap(adapter->hw.flash_address); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5754 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5755 |
err_flashmap: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5756 |
iounmap(adapter->hw.hw_addr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5757 |
err_ioremap: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5758 |
free_netdev(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5759 |
err_alloc_etherdev: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5760 |
pci_release_selected_regions(pdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5761 |
pci_select_bars(pdev, IORESOURCE_MEM)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5762 |
err_pci_reg: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5763 |
err_dma: |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5764 |
pci_disable_device(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5765 |
return err; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5766 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5767 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5768 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5769 |
* e1000_remove - Device Removal Routine |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5770 |
* @pdev: PCI device information struct |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5771 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5772 |
* e1000_remove is called by the PCI subsystem to alert the driver |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5773 |
* that it should release a PCI device. The could be caused by a |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5774 |
* Hot-Plug event, or because the driver is going to be removed from |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5775 |
* memory. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5776 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5777 |
static void __devexit e1000_remove(struct pci_dev *pdev) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5778 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5779 |
struct net_device *netdev = pci_get_drvdata(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5780 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5781 |
bool down = test_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5782 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5783 |
pm_runtime_get_sync(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5784 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5785 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5786 |
* flush_scheduled work may reschedule our watchdog task, so |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5787 |
* explicitly disable watchdog tasks from being rescheduled |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5788 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5789 |
if (!down) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5790 |
set_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5791 |
del_timer_sync(&adapter->watchdog_timer); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5792 |
del_timer_sync(&adapter->phy_info_timer); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5793 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5794 |
cancel_work_sync(&adapter->reset_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5795 |
cancel_work_sync(&adapter->watchdog_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5796 |
cancel_work_sync(&adapter->downshift_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5797 |
cancel_work_sync(&adapter->update_phy_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5798 |
cancel_work_sync(&adapter->print_hang_task); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5799 |
flush_scheduled_work(); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5800 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5801 |
if (!(netdev->flags & IFF_UP)) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5802 |
e1000_power_down_phy(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5803 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5804 |
/* Don't lie to e1000_close() down the road. */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5805 |
if (!down) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5806 |
clear_bit(__E1000_DOWN, &adapter->state); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5807 |
unregister_netdev(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5808 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5809 |
if (pci_dev_run_wake(pdev)) { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5810 |
pm_runtime_disable(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5811 |
pm_runtime_set_suspended(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5812 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5813 |
pm_runtime_put_noidle(&pdev->dev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5814 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5815 |
/* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5816 |
* Release control of h/w to f/w. If f/w is AMT enabled, this |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5817 |
* would have already happened in close and is redundant. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5818 |
*/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5819 |
e1000_release_hw_control(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5820 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5821 |
e1000e_reset_interrupt_capability(adapter); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5822 |
kfree(adapter->tx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5823 |
kfree(adapter->rx_ring); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5824 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5825 |
iounmap(adapter->hw.hw_addr); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5826 |
if (adapter->hw.flash_address) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5827 |
iounmap(adapter->hw.flash_address); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5828 |
pci_release_selected_regions(pdev, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5829 |
pci_select_bars(pdev, IORESOURCE_MEM)); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5830 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5831 |
free_netdev(netdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5832 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5833 |
/* AER disable */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5834 |
pci_disable_pcie_error_reporting(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5835 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5836 |
pci_disable_device(pdev); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5837 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5838 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5839 |
/* PCI Error Recovery (ERS) */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5840 |
static struct pci_error_handlers e1000_err_handler = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5841 |
.error_detected = e1000_io_error_detected, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5842 |
.slot_reset = e1000_io_slot_reset, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5843 |
.resume = e1000_io_resume, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5844 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5845 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5846 |
static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5847 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_COPPER), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5848 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_FIBER), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5849 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_QUAD_COPPER), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5850 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_QUAD_COPPER_LP), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5851 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_QUAD_FIBER), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5852 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_SERDES), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5853 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_SERDES_DUAL), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5854 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571EB_SERDES_QUAD), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5855 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82571PT_QUAD_COPPER), board_82571 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5856 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5857 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82572EI), board_82572 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5858 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82572EI_COPPER), board_82572 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5859 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82572EI_FIBER), board_82572 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5860 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82572EI_SERDES), board_82572 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5861 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5862 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82573E), board_82573 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5863 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82573E_IAMT), board_82573 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5864 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82573L), board_82573 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5865 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5866 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82574L), board_82574 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5867 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82574LA), board_82574 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5868 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82583V), board_82583 }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5869 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5870 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_DPT), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5871 |
board_80003es2lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5872 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_COPPER_SPT), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5873 |
board_80003es2lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5874 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_SERDES_DPT), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5875 |
board_80003es2lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5876 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_80003ES2LAN_SERDES_SPT), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5877 |
board_80003es2lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5878 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5879 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IFE), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5880 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IFE_G), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5881 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IFE_GT), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5882 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_AMT), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5883 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_C), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5884 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_M), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5885 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_IGP_M_AMT), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5886 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH8_82567V_3), board_ich8lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5887 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5888 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5889 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_G), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5890 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_GT), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5891 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_AMT), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5892 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_C), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5893 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_BM), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5894 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_M), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5895 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_M_AMT), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5896 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_M_V), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5897 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5898 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_R_BM_LM), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5899 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_R_BM_LF), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5900 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_R_BM_V), board_ich9lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5901 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5902 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LM), board_ich10lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5903 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_LF), board_ich10lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5904 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_D_BM_V), board_ich10lan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5905 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5906 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LM), board_pchlan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5907 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_M_HV_LC), board_pchlan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5908 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DM), board_pchlan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5909 |
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_D_HV_DC), board_pchlan }, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5910 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5911 |
{ } /* terminate list */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5912 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5913 |
MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5914 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5915 |
#ifdef CONFIG_PM_OPS |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5916 |
static const struct dev_pm_ops e1000_pm_ops = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5917 |
SET_SYSTEM_SLEEP_PM_OPS(e1000_suspend, e1000_resume) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5918 |
SET_RUNTIME_PM_OPS(e1000_runtime_suspend, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5919 |
e1000_runtime_resume, e1000_idle) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5920 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5921 |
#endif |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5922 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5923 |
/* PCI Device API Driver */ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5924 |
static struct pci_driver e1000_driver = { |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5925 |
.name = e1000e_driver_name, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5926 |
.id_table = e1000_pci_tbl, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5927 |
.probe = e1000_probe, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5928 |
.remove = __devexit_p(e1000_remove), |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5929 |
#ifdef CONFIG_PM_OPS |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5930 |
.driver.pm = &e1000_pm_ops, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5931 |
#endif |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5932 |
.shutdown = e1000_shutdown, |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5933 |
.err_handler = &e1000_err_handler |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5934 |
}; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5935 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5936 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5937 |
* e1000_init_module - Driver Registration Routine |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5938 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5939 |
* e1000_init_module is the first routine called when the driver is |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5940 |
* loaded. All it does is register with the PCI subsystem. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5941 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5942 |
static int __init e1000_init_module(void) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5943 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5944 |
int ret; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5945 |
pr_info("Intel(R) PRO/1000 Network Driver - %s\n", |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5946 |
e1000e_driver_version); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5947 |
pr_info("Copyright (c) 1999 - 2009 Intel Corporation.\n"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5948 |
ret = pci_register_driver(&e1000_driver); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5949 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5950 |
return ret; |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5951 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5952 |
module_init(e1000_init_module); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5953 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5954 |
/** |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5955 |
* e1000_exit_module - Driver Exit Cleanup Routine |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5956 |
* |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5957 |
* e1000_exit_module is called just before the driver is removed |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5958 |
* from memory. |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5959 |
**/ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5960 |
static void __exit e1000_exit_module(void) |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5961 |
{ |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5962 |
pci_unregister_driver(&e1000_driver); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5963 |
} |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5964 |
module_exit(e1000_exit_module); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5965 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5966 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5967 |
MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5968 |
MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5969 |
MODULE_LICENSE("GPL"); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5970 |
MODULE_VERSION(DRV_VERSION); |
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5971 |
|
dce13f854817
Added e1000e driver for 2.6.35.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5972 |
/* e1000_main.c */ |