author | Florian Pose <fp@igh-essen.com> |
Mon, 04 May 2009 12:11:00 +0000 | |
changeset 1436 | 08eaf72409bb |
parent 1325 | 16aacb421bd4 |
child 2050 | a3e59f2a8589 |
permissions | -rw-r--r-- |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/******************************************************************************* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
This program is free software; you can redistribute it and/or modify it |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
under the terms of the GNU General Public License as published by the Free |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
Software Foundation; either version 2 of the License, or (at your option) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
any later version. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
This program is distributed in the hope that it will be useful, but WITHOUT |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
more details. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
You should have received a copy of the GNU General Public License along with |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
this program; if not, write to the Free Software Foundation, Inc., 59 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
The full GNU General Public License is included in this distribution in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
file called LICENSE. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
Contact Information: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
Linux NICS <linux.nics@intel.com> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
|
1325
16aacb421bd4
merge -c1602 branches/stable-1.4: Fixed e1000 ring bug.
Florian Pose <fp@igh-essen.com>
parents:
1152
diff
changeset
|
27 |
vim: noexpandtab |
16aacb421bd4
merge -c1602 branches/stable-1.4: Fixed e1000 ring bug.
Florian Pose <fp@igh-essen.com>
parents:
1152
diff
changeset
|
28 |
|
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
*******************************************************************************/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
#include "e1000-2.6.13-ethercat.h" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
/* Change Log |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
* 6.0.58 4/20/05 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
* o Accepted ethtool cleanup patch from Stephen Hemminger |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
* 6.0.44+ 2/15/05 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
* o applied Anton's patch to resolve tx hang in hardware |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
* o Applied Andrew Mortons patch - e1000 stops working after resume |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
char e1000_driver_name[] = "ec_e1000"; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
static char e1000_driver_string[] = "EtherCAT Intel(R) PRO/1000 Network Driver"; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#ifndef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#define DRIVERNAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
#else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#define DRIVERNAPI "-NAPI" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
#define DRV_VERSION "6.0.60-k2"DRIVERNAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
char e1000_driver_version[] = DRV_VERSION; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation."; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
/* e1000_pci_tbl - PCI Device ID Table |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
* Last entry must be all 0s |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
* Macro expands to... |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
* {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
static struct pci_device_id e1000_pci_tbl[] = { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
INTEL_E1000_ETHERNET_DEVICE(0x1000), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
INTEL_E1000_ETHERNET_DEVICE(0x1001), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
INTEL_E1000_ETHERNET_DEVICE(0x1004), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
INTEL_E1000_ETHERNET_DEVICE(0x1008), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
INTEL_E1000_ETHERNET_DEVICE(0x1009), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
INTEL_E1000_ETHERNET_DEVICE(0x100C), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
INTEL_E1000_ETHERNET_DEVICE(0x100D), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
INTEL_E1000_ETHERNET_DEVICE(0x100E), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
INTEL_E1000_ETHERNET_DEVICE(0x100F), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
INTEL_E1000_ETHERNET_DEVICE(0x1010), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
INTEL_E1000_ETHERNET_DEVICE(0x1011), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
INTEL_E1000_ETHERNET_DEVICE(0x1012), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
INTEL_E1000_ETHERNET_DEVICE(0x1013), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
INTEL_E1000_ETHERNET_DEVICE(0x1014), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
INTEL_E1000_ETHERNET_DEVICE(0x1015), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
INTEL_E1000_ETHERNET_DEVICE(0x1016), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
INTEL_E1000_ETHERNET_DEVICE(0x1017), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
INTEL_E1000_ETHERNET_DEVICE(0x1018), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
INTEL_E1000_ETHERNET_DEVICE(0x1019), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
INTEL_E1000_ETHERNET_DEVICE(0x101A), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
INTEL_E1000_ETHERNET_DEVICE(0x101D), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
INTEL_E1000_ETHERNET_DEVICE(0x101E), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
INTEL_E1000_ETHERNET_DEVICE(0x1026), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
INTEL_E1000_ETHERNET_DEVICE(0x1027), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
INTEL_E1000_ETHERNET_DEVICE(0x1028), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
INTEL_E1000_ETHERNET_DEVICE(0x1075), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
INTEL_E1000_ETHERNET_DEVICE(0x1076), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
INTEL_E1000_ETHERNET_DEVICE(0x1077), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
INTEL_E1000_ETHERNET_DEVICE(0x1078), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
INTEL_E1000_ETHERNET_DEVICE(0x1079), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
INTEL_E1000_ETHERNET_DEVICE(0x107A), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
INTEL_E1000_ETHERNET_DEVICE(0x107B), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
INTEL_E1000_ETHERNET_DEVICE(0x107C), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
INTEL_E1000_ETHERNET_DEVICE(0x108A), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
INTEL_E1000_ETHERNET_DEVICE(0x108B), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
INTEL_E1000_ETHERNET_DEVICE(0x108C), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
INTEL_E1000_ETHERNET_DEVICE(0x1099), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
/* required last entry */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
{0,} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
}; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
// do not auto-load driver |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
// MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
int e1000_up(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
void e1000_down(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
void e1000_reset(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
int e1000_setup_tx_resources(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
int e1000_setup_rx_resources(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
void e1000_free_tx_resources(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
void e1000_free_rx_resources(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
void e1000_update_stats(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
/* Local Function Prototypes */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
static int e1000_init_module(void); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
static void e1000_exit_module(void); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
static void __devexit e1000_remove(struct pci_dev *pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
static int e1000_sw_init(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
static int e1000_open(struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
static int e1000_close(struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
static void e1000_configure_tx(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
static void e1000_configure_rx(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
static void e1000_setup_rctl(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
static void e1000_clean_tx_ring(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
static void e1000_clean_rx_ring(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
static void e1000_set_multi(struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
static void e1000_update_phy_info(unsigned long data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
static void e1000_watchdog(unsigned long data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
static void e1000_watchdog_task(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
static void e1000_82547_tx_fifo_stall(unsigned long data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
static struct net_device_stats * e1000_get_stats(struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
static int e1000_change_mtu(struct net_device *netdev, int new_mtu); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
static int e1000_set_mac(struct net_device *netdev, void *p); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
void ec_poll(struct net_device *); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
static int e1000_clean(struct net_device *netdev, int *budget); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
int *work_done, int work_to_do); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
int *work_done, int work_to_do); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
#else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
int cmd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
void e1000_set_ethtool_ops(struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
static void e1000_enter_82542_rst(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
static void e1000_leave_82542_rst(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
static void e1000_tx_timeout(struct net_device *dev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
static void e1000_tx_timeout_task(struct net_device *dev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
static void e1000_smartspeed(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
static inline int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
struct sk_buff *skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
static void e1000_restore_vlan(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
|
724
f188f8a0cafd
Include e1000_suspend() in #ifdef CONFIG_PM.
Florian Pose <fp@igh-essen.com>
parents:
677
diff
changeset
|
169 |
#ifdef CONFIG_PM |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
static int e1000_suspend(struct pci_dev *pdev, uint32_t state); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
static int e1000_resume(struct pci_dev *pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
/* for netdump / net console */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
static void e1000_netpoll (struct net_device *netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
/* Exported from other modules */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
extern void e1000_check_options(struct e1000_adapter *adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
static struct pci_driver e1000_driver = { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
.name = e1000_driver_name, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
.id_table = e1000_pci_tbl, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
.probe = e1000_probe, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
.remove = __devexit_p(e1000_remove), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
/* Power Managment Hooks */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
#ifdef CONFIG_PM |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
.suspend = e1000_suspend, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
.resume = e1000_resume |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
}; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
MODULE_DESCRIPTION("EtherCAT-capable Intel(R) PRO/1000 Network Driver"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
MODULE_LICENSE("GPL"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
MODULE_VERSION(DRV_VERSION); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
module_param(debug, int, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
* e1000_init_module - Driver Registration Routine |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
* e1000_init_module is the first routine called when the driver is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
* loaded. All it does is register with the PCI subsystem. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
static int __init |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
e1000_init_module(void) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
int ret; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
printk(KERN_INFO "%s - version %s\n", |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
e1000_driver_string, e1000_driver_version); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
printk(KERN_INFO "%s\n", e1000_copyright); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
ret = pci_module_init(&e1000_driver); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
return ret; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
module_init(e1000_init_module); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
* e1000_exit_module - Driver Exit Cleanup Routine |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
* e1000_exit_module is called just before the driver is removed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
* from memory. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
static void __exit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
e1000_exit_module(void) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
pci_unregister_driver(&e1000_driver); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
module_exit(e1000_exit_module); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
* e1000_irq_disable - Mask off interrupt generation on the NIC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
static inline void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
e1000_irq_disable(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
{ |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
250 |
if (adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
251 |
return; |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
atomic_inc(&adapter->irq_sem); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
E1000_WRITE_REG(&adapter->hw, IMC, ~0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
E1000_WRITE_FLUSH(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
synchronize_irq(adapter->pdev->irq); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
* e1000_irq_enable - Enable default interrupt generation settings |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
static inline void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
e1000_irq_enable(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
{ |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
266 |
if (adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
267 |
return; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
268 |
if(likely(atomic_dec_and_test(&adapter->irq_sem))) { |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
E1000_WRITE_FLUSH(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
e1000_update_mng_vlan(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
uint16_t vid = adapter->hw.mng_cookie.vlan_id; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
uint16_t old_vid = adapter->mng_vlan_id; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
if(adapter->vlgrp) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
if(!adapter->vlgrp->vlan_devices[vid]) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
if(adapter->hw.mng_cookie.status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
e1000_vlan_rx_add_vid(netdev, vid); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
284 |
adapter->mng_vlan_id = vid; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
} else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
if((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
(vid != old_vid) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
!adapter->vlgrp->vlan_devices[old_vid]) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
291 |
e1000_vlan_rx_kill_vid(netdev, old_vid); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
292 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
293 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
294 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
295 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
296 |
int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
297 |
e1000_up(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
298 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
299 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
300 |
int err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
301 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
302 |
/* hardware has been reset, we need to reload some things */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
303 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
304 |
/* Reset the PHY if it was previously powered down */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
305 |
if(adapter->hw.media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
306 |
uint16_t mii_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
307 |
e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
308 |
if(mii_reg & MII_CR_POWER_DOWN) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
309 |
e1000_phy_reset(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
310 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
311 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
312 |
e1000_set_multi(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
313 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
314 |
e1000_restore_vlan(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
315 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
316 |
e1000_configure_tx(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
317 |
e1000_setup_rctl(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
318 |
e1000_configure_rx(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
319 |
adapter->alloc_rx_buf(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
320 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
321 |
#ifdef CONFIG_PCI_MSI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
322 |
if(adapter->hw.mac_type > e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
323 |
adapter->have_msi = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
324 |
if((err = pci_enable_msi(adapter->pdev))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
325 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
326 |
"Unable to allocate MSI interrupt Error: %d\n", err); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
327 |
adapter->have_msi = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
328 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
329 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
330 |
#endif |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
331 |
if (!adapter->ecdev) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
332 |
if((err = request_irq(adapter->pdev->irq, &e1000_intr, |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
333 |
SA_SHIRQ | SA_SAMPLE_RANDOM, |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
334 |
netdev->name, netdev))) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
335 |
DPRINTK(PROBE, ERR, |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
336 |
"Unable to allocate interrupt Error: %d\n", err); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
337 |
return err; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
338 |
} |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
339 |
|
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
340 |
mod_timer(&adapter->watchdog_timer, jiffies); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
341 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
342 |
#ifdef CONFIG_E1000_NAPI |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
343 |
netif_poll_enable(netdev); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
344 |
#endif |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
345 |
e1000_irq_enable(adapter); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
346 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
347 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
348 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
349 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
350 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
351 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
352 |
e1000_down(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
353 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
354 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
355 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
356 |
if (!adapter->ecdev) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
357 |
e1000_irq_disable(adapter); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
358 |
free_irq(adapter->pdev->irq, netdev); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
359 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
360 |
#ifdef CONFIG_PCI_MSI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
361 |
if(adapter->hw.mac_type > e1000_82547_rev_2 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
362 |
adapter->have_msi == TRUE) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
363 |
pci_disable_msi(adapter->pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
364 |
#endif |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
365 |
if (!adapter->ecdev) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
366 |
del_timer_sync(&adapter->tx_fifo_stall_timer); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
367 |
del_timer_sync(&adapter->watchdog_timer); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
368 |
del_timer_sync(&adapter->phy_info_timer); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
369 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
370 |
#ifdef CONFIG_E1000_NAPI |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
371 |
netif_poll_disable(netdev); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
372 |
#endif |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
373 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
374 |
adapter->link_speed = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
375 |
adapter->link_duplex = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
376 |
if (!adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
377 |
netif_carrier_off(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
378 |
netif_stop_queue(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
379 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
380 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
381 |
e1000_reset(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
382 |
e1000_clean_tx_ring(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
383 |
e1000_clean_rx_ring(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
384 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
385 |
/* If WoL is not enabled |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
386 |
* and management mode is not IAMT |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
387 |
* Power down the PHY so no link is implied when interface is down */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
388 |
if(!adapter->wol && adapter->hw.mac_type >= e1000_82540 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
389 |
adapter->hw.media_type == e1000_media_type_copper && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
390 |
!e1000_check_mng_mode(&adapter->hw) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
391 |
!(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
392 |
uint16_t mii_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
393 |
e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
394 |
mii_reg |= MII_CR_POWER_DOWN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
395 |
e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
396 |
mdelay(1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
397 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
398 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
399 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
400 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
401 |
e1000_reset(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
402 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
403 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
404 |
uint32_t pba, manc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
405 |
uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
406 |
uint16_t fc_low_water_mark = E1000_FC_LOW_DIFF; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
407 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
408 |
/* Repartition Pba for greater than 9k mtu |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
409 |
* To take effect CTRL.RST is required. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
410 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
411 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
412 |
switch (adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
413 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
414 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
415 |
pba = E1000_PBA_30K; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
416 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
417 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
418 |
pba = E1000_PBA_12K; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
419 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
420 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
421 |
pba = E1000_PBA_48K; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
422 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
423 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
424 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
425 |
if((adapter->hw.mac_type != e1000_82573) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
426 |
(adapter->rx_buffer_len > E1000_RXBUFFER_8192)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
427 |
pba -= 8; /* allocate more FIFO for Tx */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
428 |
/* send an XOFF when there is enough space in the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
429 |
* Rx FIFO to hold one extra full size Rx packet |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
430 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
431 |
fc_high_water_mark = netdev->mtu + ENET_HEADER_SIZE + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
432 |
ETHERNET_FCS_SIZE + 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
433 |
fc_low_water_mark = fc_high_water_mark + 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
434 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
435 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
436 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
437 |
if(adapter->hw.mac_type == e1000_82547) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
438 |
adapter->tx_fifo_head = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
439 |
adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
440 |
adapter->tx_fifo_size = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
441 |
(E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
442 |
atomic_set(&adapter->tx_fifo_stall, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
443 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
444 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
445 |
E1000_WRITE_REG(&adapter->hw, PBA, pba); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
446 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
447 |
/* flow control settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
448 |
adapter->hw.fc_high_water = (pba << E1000_PBA_BYTES_SHIFT) - |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
449 |
fc_high_water_mark; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
450 |
adapter->hw.fc_low_water = (pba << E1000_PBA_BYTES_SHIFT) - |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
451 |
fc_low_water_mark; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
452 |
adapter->hw.fc_pause_time = E1000_FC_PAUSE_TIME; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
453 |
adapter->hw.fc_send_xon = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
454 |
adapter->hw.fc = adapter->hw.original_fc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
455 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
456 |
/* Allow time for pending master requests to run */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
457 |
e1000_reset_hw(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
458 |
if(adapter->hw.mac_type >= e1000_82544) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
459 |
E1000_WRITE_REG(&adapter->hw, WUC, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
460 |
if(e1000_init_hw(&adapter->hw)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
461 |
DPRINTK(PROBE, ERR, "Hardware Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
462 |
e1000_update_mng_vlan(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
463 |
/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
464 |
E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
465 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
466 |
e1000_reset_adaptive(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
467 |
e1000_phy_get_info(&adapter->hw, &adapter->phy_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
468 |
if (adapter->en_mng_pt) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
469 |
manc = E1000_READ_REG(&adapter->hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
470 |
manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
471 |
E1000_WRITE_REG(&adapter->hw, MANC, manc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
472 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
473 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
474 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
475 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
476 |
* e1000_probe - Device Initialization Routine |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
477 |
* @pdev: PCI device information struct |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
478 |
* @ent: entry in e1000_pci_tbl |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
479 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
480 |
* Returns 0 on success, negative on failure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
481 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
482 |
* e1000_probe initializes an adapter identified by a pci_dev structure. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
483 |
* The OS initialization, configuring of the adapter private structure, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
484 |
* and a hardware reset occur. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
485 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
486 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
487 |
static int __devinit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
488 |
e1000_probe(struct pci_dev *pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
489 |
const struct pci_device_id *ent) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
490 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
491 |
struct net_device *netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
492 |
struct e1000_adapter *adapter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
493 |
unsigned long mmio_start, mmio_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
494 |
uint32_t swsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
495 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
496 |
static int cards_found = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
497 |
int i, err, pci_using_dac; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
498 |
uint16_t eeprom_data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
499 |
uint16_t eeprom_apme_mask = E1000_EEPROM_APME; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
500 |
if((err = pci_enable_device(pdev))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
501 |
return err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
503 |
if(!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
504 |
pci_using_dac = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
505 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
506 |
if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
507 |
E1000_ERR("No usable DMA configuration, aborting\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
508 |
return err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
509 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
510 |
pci_using_dac = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
511 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
512 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
513 |
if((err = pci_request_regions(pdev, e1000_driver_name))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
514 |
return err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
515 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
516 |
pci_set_master(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
517 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
518 |
netdev = alloc_etherdev(sizeof(struct e1000_adapter)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
519 |
if(!netdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
520 |
err = -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
521 |
goto err_alloc_etherdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
522 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
523 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
524 |
SET_MODULE_OWNER(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
525 |
SET_NETDEV_DEV(netdev, &pdev->dev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
526 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
527 |
pci_set_drvdata(pdev, netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
528 |
adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
529 |
adapter->netdev = netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
530 |
adapter->pdev = pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
531 |
adapter->hw.back = adapter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
532 |
adapter->msg_enable = (1 << debug) - 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
533 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
534 |
mmio_start = pci_resource_start(pdev, BAR_0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
mmio_len = pci_resource_len(pdev, BAR_0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
536 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
537 |
adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
538 |
if(!adapter->hw.hw_addr) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
539 |
err = -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
540 |
goto err_ioremap; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
541 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
542 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
543 |
for(i = BAR_1; i <= BAR_5; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
544 |
if(pci_resource_len(pdev, i) == 0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
545 |
continue; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
546 |
if(pci_resource_flags(pdev, i) & IORESOURCE_IO) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
547 |
adapter->hw.io_base = pci_resource_start(pdev, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
549 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
550 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
551 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
552 |
netdev->open = &e1000_open; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
553 |
netdev->stop = &e1000_close; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
554 |
netdev->hard_start_xmit = &e1000_xmit_frame; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
555 |
netdev->get_stats = &e1000_get_stats; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
556 |
netdev->set_multicast_list = &e1000_set_multi; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
557 |
netdev->set_mac_address = &e1000_set_mac; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
558 |
netdev->change_mtu = &e1000_change_mtu; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
559 |
netdev->do_ioctl = &e1000_ioctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
560 |
e1000_set_ethtool_ops(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
561 |
netdev->tx_timeout = &e1000_tx_timeout; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
562 |
netdev->watchdog_timeo = 5 * HZ; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
563 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
564 |
netdev->poll = &e1000_clean; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
565 |
netdev->weight = 64; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
566 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
567 |
netdev->vlan_rx_register = e1000_vlan_rx_register; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
568 |
netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
569 |
netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
570 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
571 |
netdev->poll_controller = e1000_netpoll; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
572 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
573 |
strcpy(netdev->name, pci_name(pdev)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
574 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
575 |
netdev->mem_start = mmio_start; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
576 |
netdev->mem_end = mmio_start + mmio_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
577 |
netdev->base_addr = adapter->hw.io_base; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
adapter->bd_number = cards_found; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
580 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
581 |
/* setup the private structure */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
582 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
583 |
if((err = e1000_sw_init(adapter))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
584 |
goto err_sw_init; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
585 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
586 |
if((err = e1000_check_phy_reset_block(&adapter->hw))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
587 |
DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
588 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
589 |
if(adapter->hw.mac_type >= e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
590 |
netdev->features = NETIF_F_SG | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
591 |
NETIF_F_HW_CSUM | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
592 |
NETIF_F_HW_VLAN_TX | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
593 |
NETIF_F_HW_VLAN_RX | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
594 |
NETIF_F_HW_VLAN_FILTER; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
595 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
596 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
597 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
if((adapter->hw.mac_type >= e1000_82544) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
(adapter->hw.mac_type != e1000_82547)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
600 |
netdev->features |= NETIF_F_TSO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
601 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
602 |
#ifdef NETIF_F_TSO_IPV6 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
603 |
if(adapter->hw.mac_type > e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
604 |
netdev->features |= NETIF_F_TSO_IPV6; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
605 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
606 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
607 |
if(pci_using_dac) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
608 |
netdev->features |= NETIF_F_HIGHDMA; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
609 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
610 |
/* hard_start_xmit is safe against parallel locking */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
611 |
netdev->features |= NETIF_F_LLTX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
612 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
613 |
adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
614 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
615 |
/* before reading the EEPROM, reset the controller to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
616 |
* put the device in a known good starting state */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
617 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
618 |
e1000_reset_hw(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
619 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
620 |
/* make sure the EEPROM is good */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
621 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
622 |
if(e1000_validate_eeprom_checksum(&adapter->hw) < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
623 |
DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
624 |
err = -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
625 |
goto err_eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
626 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
627 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
628 |
/* copy the MAC address out of the EEPROM */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
629 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
630 |
if(e1000_read_mac_addr(&adapter->hw)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
631 |
DPRINTK(PROBE, ERR, "EEPROM Read Error\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
632 |
memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
633 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
634 |
if(!is_valid_ether_addr(netdev->dev_addr)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
635 |
DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
636 |
err = -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
637 |
goto err_eeprom; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
638 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
639 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
640 |
e1000_read_part_num(&adapter->hw, &(adapter->part_num)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
641 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
642 |
e1000_get_bus_info(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
643 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
644 |
init_timer(&adapter->tx_fifo_stall_timer); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
645 |
adapter->tx_fifo_stall_timer.function = &e1000_82547_tx_fifo_stall; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
646 |
adapter->tx_fifo_stall_timer.data = (unsigned long) adapter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
647 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
648 |
init_timer(&adapter->watchdog_timer); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
649 |
adapter->watchdog_timer.function = &e1000_watchdog; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
650 |
adapter->watchdog_timer.data = (unsigned long) adapter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
651 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
652 |
INIT_WORK(&adapter->watchdog_task, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
653 |
(void (*)(void *))e1000_watchdog_task, adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
654 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
655 |
init_timer(&adapter->phy_info_timer); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
656 |
adapter->phy_info_timer.function = &e1000_update_phy_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
657 |
adapter->phy_info_timer.data = (unsigned long) adapter; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
658 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
659 |
INIT_WORK(&adapter->tx_timeout_task, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
660 |
(void (*)(void *))e1000_tx_timeout_task, netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
661 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
662 |
/* we're going to reset, so assume we have no link for now */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
663 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
664 |
if (!adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
665 |
netif_carrier_off(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
666 |
netif_stop_queue(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
667 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
668 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
669 |
e1000_check_options(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
670 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
671 |
/* Initial Wake on LAN setting |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
672 |
* If APM wake is enabled in the EEPROM, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
673 |
* enable the ACPI Magic Packet filter |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
674 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
675 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
676 |
switch(adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
677 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
678 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
679 |
case e1000_82543: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
680 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
681 |
case e1000_82544: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
682 |
e1000_read_eeprom(&adapter->hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
683 |
EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
684 |
eeprom_apme_mask = E1000_EEPROM_82544_APM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
685 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
686 |
case e1000_82546: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
687 |
case e1000_82546_rev_3: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
688 |
if((E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
689 |
&& (adapter->hw.media_type == e1000_media_type_copper)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
690 |
e1000_read_eeprom(&adapter->hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
691 |
EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
692 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
693 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
694 |
/* Fall Through */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
695 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
696 |
e1000_read_eeprom(&adapter->hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
697 |
EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
698 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
699 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
700 |
if(eeprom_data & eeprom_apme_mask) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
701 |
adapter->wol |= E1000_WUFC_MAG; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
702 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
703 |
/* reset the hardware with the new settings */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
704 |
e1000_reset(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
705 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
706 |
/* Let firmware know the driver has taken over */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
707 |
switch(adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
708 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
709 |
swsm = E1000_READ_REG(&adapter->hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
710 |
E1000_WRITE_REG(&adapter->hw, SWSM, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
711 |
swsm | E1000_SWSM_DRV_LOAD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
712 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
713 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
714 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
715 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
716 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
717 |
// offer device to EtherCAT master module |
1011 | 718 |
adapter->ecdev = ecdev_offer(netdev, ec_poll, THIS_MODULE); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
719 |
if (adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
720 |
if (ecdev_open(adapter->ecdev)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
721 |
ecdev_withdraw(adapter->ecdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
722 |
goto err_register; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
723 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
724 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
725 |
strcpy(netdev->name, "eth%d"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
726 |
if ((err = register_netdev(netdev))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
727 |
goto err_register; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
728 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
729 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
730 |
DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
731 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
732 |
cards_found++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
733 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
734 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
735 |
err_register: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
736 |
err_sw_init: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
737 |
err_eeprom: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
738 |
iounmap(adapter->hw.hw_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
739 |
err_ioremap: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
740 |
free_netdev(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
741 |
err_alloc_etherdev: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
742 |
pci_release_regions(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
743 |
return err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
744 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
745 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
746 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
747 |
* e1000_remove - Device Removal Routine |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
748 |
* @pdev: PCI device information struct |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
749 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
750 |
* e1000_remove is called by the PCI subsystem to alert the driver |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
751 |
* that it should release a PCI device. The could be caused by a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
752 |
* Hot-Plug event, or because the driver is going to be removed from |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
753 |
* memory. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
754 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
755 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
756 |
static void __devexit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
757 |
e1000_remove(struct pci_dev *pdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
758 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
759 |
struct net_device *netdev = pci_get_drvdata(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
760 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
761 |
uint32_t manc, swsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
762 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
763 |
flush_scheduled_work(); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
764 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
765 |
if(adapter->hw.mac_type >= e1000_82540 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
766 |
adapter->hw.media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
767 |
manc = E1000_READ_REG(&adapter->hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
768 |
if(manc & E1000_MANC_SMBUS_EN) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
769 |
manc |= E1000_MANC_ARP_EN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
770 |
E1000_WRITE_REG(&adapter->hw, MANC, manc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
771 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
772 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
773 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
774 |
switch(adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
775 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
776 |
swsm = E1000_READ_REG(&adapter->hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
777 |
E1000_WRITE_REG(&adapter->hw, SWSM, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
778 |
swsm & ~E1000_SWSM_DRV_LOAD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
779 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
780 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
781 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
782 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
783 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
784 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
785 |
if (adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
786 |
ecdev_close(adapter->ecdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
787 |
ecdev_withdraw(adapter->ecdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
788 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
789 |
unregister_netdev(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
790 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
791 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
792 |
if(!e1000_check_phy_reset_block(&adapter->hw)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
793 |
e1000_phy_hw_reset(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
794 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
795 |
iounmap(adapter->hw.hw_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
796 |
pci_release_regions(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
797 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
798 |
free_netdev(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
799 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
800 |
pci_disable_device(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
801 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
802 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
803 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
804 |
* e1000_sw_init - Initialize general software structures (struct e1000_adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
805 |
* @adapter: board private structure to initialize |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
806 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
807 |
* e1000_sw_init initializes the Adapter private data structure. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
808 |
* Fields are initialized based on PCI device information and |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
809 |
* OS network device settings (MTU size). |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
810 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
811 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
812 |
static int __devinit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
813 |
e1000_sw_init(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
814 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
815 |
struct e1000_hw *hw = &adapter->hw; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
816 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
817 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
818 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
819 |
/* PCI config space info */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
820 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
821 |
hw->vendor_id = pdev->vendor; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
822 |
hw->device_id = pdev->device; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
823 |
hw->subsystem_vendor_id = pdev->subsystem_vendor; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
824 |
hw->subsystem_id = pdev->subsystem_device; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
825 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
826 |
pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
827 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
828 |
pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
829 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
830 |
adapter->rx_buffer_len = E1000_RXBUFFER_2048; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
831 |
adapter->rx_ps_bsize0 = E1000_RXBUFFER_256; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
832 |
hw->max_frame_size = netdev->mtu + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
833 |
ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
834 |
hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
835 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
836 |
/* identify the MAC */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
837 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
838 |
if(e1000_set_mac_type(hw)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
839 |
DPRINTK(PROBE, ERR, "Unknown MAC Type\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
840 |
return -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
841 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
842 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
843 |
/* initialize eeprom parameters */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
844 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
845 |
if(e1000_init_eeprom_params(hw)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
846 |
E1000_ERR("EEPROM initialization failed\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
847 |
return -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
848 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
849 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
850 |
switch(hw->mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
851 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
852 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
853 |
case e1000_82541: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
854 |
case e1000_82547: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
855 |
case e1000_82541_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
856 |
case e1000_82547_rev_2: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
857 |
hw->phy_init_script = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
858 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
859 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
860 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
861 |
e1000_set_media_type(hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
862 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
863 |
hw->wait_autoneg_complete = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
864 |
hw->tbi_compatibility_en = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
865 |
hw->adaptive_ifs = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
866 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
867 |
/* Copper options */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
868 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
869 |
if(hw->media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
870 |
hw->mdix = AUTO_ALL_MODES; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
871 |
hw->disable_polarity_correction = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
872 |
hw->master_slave = E1000_MASTER_SLAVE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
873 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
874 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
875 |
atomic_set(&adapter->irq_sem, 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
876 |
spin_lock_init(&adapter->stats_lock); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
877 |
spin_lock_init(&adapter->tx_lock); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
878 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
879 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
880 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
881 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
882 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
883 |
* e1000_open - Called when a network interface is made active |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
884 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
885 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
886 |
* Returns 0 on success, negative value on failure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
887 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
888 |
* The open entry point is called when a network interface is made |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
889 |
* active by the system (IFF_UP). At this point all resources needed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
890 |
* for transmit and receive operations are allocated, the interrupt |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
891 |
* handler is registered with the OS, the watchdog timer is started, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
892 |
* and the stack is notified that the interface is ready. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
893 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
894 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
895 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
896 |
e1000_open(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
897 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
898 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
899 |
int err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
900 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
901 |
/* allocate transmit descriptors */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
902 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
903 |
if((err = e1000_setup_tx_resources(adapter))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
904 |
goto err_setup_tx; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
905 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
906 |
/* allocate receive descriptors */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
907 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
908 |
if((err = e1000_setup_rx_resources(adapter))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
909 |
goto err_setup_rx; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
910 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
911 |
if((err = e1000_up(adapter))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
912 |
goto err_up; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
913 |
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
914 |
if((adapter->hw.mng_cookie.status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
915 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
916 |
e1000_update_mng_vlan(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
917 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
918 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
919 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
920 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
921 |
err_up: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
922 |
e1000_free_rx_resources(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
923 |
err_setup_rx: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
924 |
e1000_free_tx_resources(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
925 |
err_setup_tx: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
926 |
e1000_reset(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
927 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
928 |
return err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
929 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
930 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
931 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
932 |
* e1000_close - Disables a network interface |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
933 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
934 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
935 |
* Returns 0, this is not allowed to fail |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
936 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
937 |
* The close entry point is called when an interface is de-activated |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
938 |
* by the OS. The hardware is still under the drivers control, but |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
939 |
* needs to be disabled. A global MAC reset is issued to stop the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
940 |
* hardware, and all transmit and receive resources are freed. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
941 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
942 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
943 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
944 |
e1000_close(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
945 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
946 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
947 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
948 |
e1000_down(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
949 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
950 |
e1000_free_tx_resources(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
951 |
e1000_free_rx_resources(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
952 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
953 |
if((adapter->hw.mng_cookie.status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
954 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
955 |
e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
956 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
957 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
958 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
959 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
960 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
961 |
* e1000_check_64k_bound - check that memory doesn't cross 64kB boundary |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
962 |
* @adapter: address of board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
963 |
* @start: address of beginning of memory |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
964 |
* @len: length of memory |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
965 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
966 |
static inline boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
967 |
e1000_check_64k_bound(struct e1000_adapter *adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
968 |
void *start, unsigned long len) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
969 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
970 |
unsigned long begin = (unsigned long) start; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
971 |
unsigned long end = begin + len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
972 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
973 |
/* First rev 82545 and 82546 need to not allow any memory |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
974 |
* write location to cross 64k boundary due to errata 23 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
975 |
if (adapter->hw.mac_type == e1000_82545 || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
976 |
adapter->hw.mac_type == e1000_82546) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
977 |
return ((begin ^ (end - 1)) >> 16) != 0 ? FALSE : TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
978 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
979 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
980 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
981 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
982 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
983 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
984 |
* e1000_setup_tx_resources - allocate Tx resources (Descriptors) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
985 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
986 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
987 |
* Return 0 on success, negative on failure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
988 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
989 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
990 |
int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
991 |
e1000_setup_tx_resources(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
992 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
993 |
struct e1000_desc_ring *txdr = &adapter->tx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
994 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
995 |
int size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
996 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
997 |
size = sizeof(struct e1000_buffer) * txdr->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
998 |
txdr->buffer_info = vmalloc(size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
999 |
if(!txdr->buffer_info) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1000 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1001 |
"Unable to allocate memory for the transmit descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1002 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1003 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1004 |
memset(txdr->buffer_info, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1005 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1006 |
/* round up to nearest 4K */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1007 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1008 |
txdr->size = txdr->count * sizeof(struct e1000_tx_desc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1009 |
E1000_ROUNDUP(txdr->size, 4096); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1010 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1011 |
txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1012 |
if(!txdr->desc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1013 |
setup_tx_desc_die: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1014 |
vfree(txdr->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1015 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1016 |
"Unable to allocate memory for the transmit descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1017 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1018 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1019 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1020 |
/* Fix for errata 23, can't cross 64kB boundary */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1021 |
if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1022 |
void *olddesc = txdr->desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1023 |
dma_addr_t olddma = txdr->dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1024 |
DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1025 |
"at %p\n", txdr->size, txdr->desc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1026 |
/* Try again, without freeing the previous */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1027 |
txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1028 |
if(!txdr->desc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1029 |
/* Failed allocation, critical failure */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1030 |
pci_free_consistent(pdev, txdr->size, olddesc, olddma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1031 |
goto setup_tx_desc_die; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1032 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1033 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1034 |
if (!e1000_check_64k_bound(adapter, txdr->desc, txdr->size)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1035 |
/* give up */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1036 |
pci_free_consistent(pdev, txdr->size, txdr->desc, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1037 |
txdr->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1038 |
pci_free_consistent(pdev, txdr->size, olddesc, olddma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1039 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1040 |
"Unable to allocate aligned memory " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1041 |
"for the transmit descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1042 |
vfree(txdr->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1043 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1044 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1045 |
/* Free old allocation, new allocation was successful */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1046 |
pci_free_consistent(pdev, txdr->size, olddesc, olddma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1047 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1048 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1049 |
memset(txdr->desc, 0, txdr->size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1050 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1051 |
txdr->next_to_use = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1052 |
txdr->next_to_clean = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1053 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1054 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1055 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1056 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1057 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1058 |
* e1000_configure_tx - Configure 8254x Transmit Unit after Reset |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1059 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1060 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1061 |
* Configure the Tx unit of the MAC after a reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1062 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1063 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1064 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1065 |
e1000_configure_tx(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1066 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1067 |
uint64_t tdba = adapter->tx_ring.dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1068 |
uint32_t tdlen = adapter->tx_ring.count * sizeof(struct e1000_tx_desc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1069 |
uint32_t tctl, tipg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1070 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1071 |
E1000_WRITE_REG(&adapter->hw, TDBAL, (tdba & 0x00000000ffffffffULL)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1072 |
E1000_WRITE_REG(&adapter->hw, TDBAH, (tdba >> 32)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1073 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1074 |
E1000_WRITE_REG(&adapter->hw, TDLEN, tdlen); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1075 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1076 |
/* Setup the HW Tx Head and Tail descriptor pointers */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1077 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1078 |
E1000_WRITE_REG(&adapter->hw, TDH, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1079 |
E1000_WRITE_REG(&adapter->hw, TDT, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1080 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1081 |
/* Set the default values for the Tx Inter Packet Gap timer */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1082 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1083 |
switch (adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1084 |
case e1000_82542_rev2_0: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1085 |
case e1000_82542_rev2_1: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1086 |
tipg = DEFAULT_82542_TIPG_IPGT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1087 |
tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1088 |
tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1089 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1090 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1091 |
if(adapter->hw.media_type == e1000_media_type_fiber || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1092 |
adapter->hw.media_type == e1000_media_type_internal_serdes) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1093 |
tipg = DEFAULT_82543_TIPG_IPGT_FIBER; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1094 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1095 |
tipg = DEFAULT_82543_TIPG_IPGT_COPPER; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1096 |
tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1097 |
tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1098 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1099 |
E1000_WRITE_REG(&adapter->hw, TIPG, tipg); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1100 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1101 |
/* Set the Tx Interrupt Delay register */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1102 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1103 |
E1000_WRITE_REG(&adapter->hw, TIDV, adapter->tx_int_delay); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1104 |
if(adapter->hw.mac_type >= e1000_82540) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1105 |
E1000_WRITE_REG(&adapter->hw, TADV, adapter->tx_abs_int_delay); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1106 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1107 |
/* Program the Transmit Control Register */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1108 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1109 |
tctl = E1000_READ_REG(&adapter->hw, TCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1110 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1111 |
tctl &= ~E1000_TCTL_CT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1112 |
tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1113 |
(E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1114 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1115 |
E1000_WRITE_REG(&adapter->hw, TCTL, tctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1116 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1117 |
e1000_config_collision_dist(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1118 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1119 |
/* Setup Transmit Descriptor Settings for eop descriptor */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1120 |
adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1121 |
E1000_TXD_CMD_IFCS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1122 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1123 |
if(adapter->hw.mac_type < e1000_82543) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1124 |
adapter->txd_cmd |= E1000_TXD_CMD_RPS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1125 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1126 |
adapter->txd_cmd |= E1000_TXD_CMD_RS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1127 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1128 |
/* Cache if we're 82544 running in PCI-X because we'll |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1129 |
* need this to apply a workaround later in the send path. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1130 |
if(adapter->hw.mac_type == e1000_82544 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1131 |
adapter->hw.bus_type == e1000_bus_type_pcix) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1132 |
adapter->pcix_82544 = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1133 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1134 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1135 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1136 |
* e1000_setup_rx_resources - allocate Rx resources (Descriptors) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1137 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1138 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1139 |
* Returns 0 on success, negative on failure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1140 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1141 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1142 |
int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1143 |
e1000_setup_rx_resources(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1144 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1145 |
struct e1000_desc_ring *rxdr = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1146 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1147 |
int size, desc_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1148 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1149 |
size = sizeof(struct e1000_buffer) * rxdr->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1150 |
rxdr->buffer_info = vmalloc(size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1151 |
if(!rxdr->buffer_info) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1152 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1153 |
"Unable to allocate memory for the receive descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1154 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1155 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1156 |
memset(rxdr->buffer_info, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1157 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1158 |
size = sizeof(struct e1000_ps_page) * rxdr->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1159 |
rxdr->ps_page = kmalloc(size, GFP_KERNEL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1160 |
if(!rxdr->ps_page) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1161 |
vfree(rxdr->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1162 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1163 |
"Unable to allocate memory for the receive descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1164 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1165 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1166 |
memset(rxdr->ps_page, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1167 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1168 |
size = sizeof(struct e1000_ps_page_dma) * rxdr->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1169 |
rxdr->ps_page_dma = kmalloc(size, GFP_KERNEL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1170 |
if(!rxdr->ps_page_dma) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1171 |
vfree(rxdr->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1172 |
kfree(rxdr->ps_page); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1173 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1174 |
"Unable to allocate memory for the receive descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1175 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1176 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1177 |
memset(rxdr->ps_page_dma, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1178 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1179 |
if(adapter->hw.mac_type <= e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1180 |
desc_len = sizeof(struct e1000_rx_desc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1181 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1182 |
desc_len = sizeof(union e1000_rx_desc_packet_split); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1183 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1184 |
/* Round up to nearest 4K */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1185 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1186 |
rxdr->size = rxdr->count * desc_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1187 |
E1000_ROUNDUP(rxdr->size, 4096); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1188 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1189 |
rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1190 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1191 |
if(!rxdr->desc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1192 |
setup_rx_desc_die: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1193 |
vfree(rxdr->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1194 |
kfree(rxdr->ps_page); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1195 |
kfree(rxdr->ps_page_dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1196 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1197 |
"Unable to allocate memory for the receive descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1198 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1199 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1200 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1201 |
/* Fix for errata 23, can't cross 64kB boundary */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1202 |
if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1203 |
void *olddesc = rxdr->desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1204 |
dma_addr_t olddma = rxdr->dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1205 |
DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1206 |
"at %p\n", rxdr->size, rxdr->desc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1207 |
/* Try again, without freeing the previous */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1208 |
rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1209 |
if(!rxdr->desc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1210 |
/* Failed allocation, critical failure */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1211 |
pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1212 |
goto setup_rx_desc_die; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1213 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1214 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1215 |
if (!e1000_check_64k_bound(adapter, rxdr->desc, rxdr->size)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1216 |
/* give up */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1217 |
pci_free_consistent(pdev, rxdr->size, rxdr->desc, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1218 |
rxdr->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1219 |
pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1220 |
DPRINTK(PROBE, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1221 |
"Unable to allocate aligned memory " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1222 |
"for the receive descriptor ring\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1223 |
vfree(rxdr->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1224 |
kfree(rxdr->ps_page); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1225 |
kfree(rxdr->ps_page_dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1226 |
return -ENOMEM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1227 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1228 |
/* Free old allocation, new allocation was successful */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1229 |
pci_free_consistent(pdev, rxdr->size, olddesc, olddma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1230 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1231 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1232 |
memset(rxdr->desc, 0, rxdr->size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1233 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1234 |
rxdr->next_to_clean = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1235 |
rxdr->next_to_use = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1236 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1237 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1238 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1239 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1240 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1241 |
* e1000_setup_rctl - configure the receive control registers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1242 |
* @adapter: Board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1243 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1244 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1245 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1246 |
e1000_setup_rctl(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1247 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1248 |
uint32_t rctl, rfctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1249 |
uint32_t psrctl = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1250 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1251 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1252 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1253 |
rctl &= ~(3 << E1000_RCTL_MO_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1254 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1255 |
rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1256 |
E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1257 |
(adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1258 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1259 |
if(adapter->hw.tbi_compatibility_on == 1) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1260 |
rctl |= E1000_RCTL_SBP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1261 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1262 |
rctl &= ~E1000_RCTL_SBP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1263 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1264 |
if (adapter->netdev->mtu <= ETH_DATA_LEN) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1265 |
rctl &= ~E1000_RCTL_LPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1266 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1267 |
rctl |= E1000_RCTL_LPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1268 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1269 |
/* Setup buffer sizes */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1270 |
if(adapter->hw.mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1271 |
/* We can now specify buffers in 1K increments. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1272 |
* BSIZE and BSEX are ignored in this case. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1273 |
rctl |= adapter->rx_buffer_len << 0x11; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1274 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1275 |
rctl &= ~E1000_RCTL_SZ_4096; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1276 |
rctl |= E1000_RCTL_BSEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1277 |
switch (adapter->rx_buffer_len) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1278 |
case E1000_RXBUFFER_2048: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1279 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1280 |
rctl |= E1000_RCTL_SZ_2048; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1281 |
rctl &= ~E1000_RCTL_BSEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1282 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1283 |
case E1000_RXBUFFER_4096: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1284 |
rctl |= E1000_RCTL_SZ_4096; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1285 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1286 |
case E1000_RXBUFFER_8192: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1287 |
rctl |= E1000_RCTL_SZ_8192; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1288 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1289 |
case E1000_RXBUFFER_16384: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1290 |
rctl |= E1000_RCTL_SZ_16384; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1291 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1292 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1293 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1294 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1295 |
#ifdef CONFIG_E1000_PACKET_SPLIT |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1296 |
/* 82571 and greater support packet-split where the protocol |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1297 |
* header is placed in skb->data and the packet data is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1298 |
* placed in pages hanging off of skb_shinfo(skb)->nr_frags. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1299 |
* In the case of a non-split, skb->data is linearly filled, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1300 |
* followed by the page buffers. Therefore, skb->data is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1301 |
* sized to hold the largest protocol header. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1302 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1303 |
adapter->rx_ps = (adapter->hw.mac_type > e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1304 |
&& (adapter->netdev->mtu |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1305 |
< ((3 * PAGE_SIZE) + adapter->rx_ps_bsize0)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1306 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1307 |
if(adapter->rx_ps) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1308 |
/* Configure extra packet-split registers */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1309 |
rfctl = E1000_READ_REG(&adapter->hw, RFCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1310 |
rfctl |= E1000_RFCTL_EXTEN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1311 |
/* disable IPv6 packet split support */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1312 |
rfctl |= E1000_RFCTL_IPV6_DIS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1313 |
E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1314 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1315 |
rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1316 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1317 |
psrctl |= adapter->rx_ps_bsize0 >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1318 |
E1000_PSRCTL_BSIZE0_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1319 |
psrctl |= PAGE_SIZE >> |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1320 |
E1000_PSRCTL_BSIZE1_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1321 |
psrctl |= PAGE_SIZE << |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1322 |
E1000_PSRCTL_BSIZE2_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1323 |
psrctl |= PAGE_SIZE << |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1324 |
E1000_PSRCTL_BSIZE3_SHIFT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1325 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1326 |
E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1327 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1328 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1329 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1330 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1331 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1332 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1333 |
* e1000_configure_rx - Configure 8254x Receive Unit after Reset |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1334 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1335 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1336 |
* Configure the Rx unit of the MAC after a reset. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1337 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1338 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1339 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1340 |
e1000_configure_rx(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1341 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1342 |
uint64_t rdba = adapter->rx_ring.dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1343 |
uint32_t rdlen, rctl, rxcsum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1344 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1345 |
if(adapter->rx_ps) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1346 |
rdlen = adapter->rx_ring.count * |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1347 |
sizeof(union e1000_rx_desc_packet_split); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1348 |
adapter->clean_rx = e1000_clean_rx_irq_ps; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1349 |
adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1350 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1351 |
rdlen = adapter->rx_ring.count * sizeof(struct e1000_rx_desc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1352 |
adapter->clean_rx = e1000_clean_rx_irq; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1353 |
adapter->alloc_rx_buf = e1000_alloc_rx_buffers; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1354 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1355 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1356 |
/* disable receives while setting up the descriptors */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1357 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1358 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_RCTL_EN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1359 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1360 |
/* set the Receive Delay Timer Register */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1361 |
E1000_WRITE_REG(&adapter->hw, RDTR, adapter->rx_int_delay); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1362 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1363 |
if(adapter->hw.mac_type >= e1000_82540) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1364 |
E1000_WRITE_REG(&adapter->hw, RADV, adapter->rx_abs_int_delay); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1365 |
if(adapter->itr > 1) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1366 |
E1000_WRITE_REG(&adapter->hw, ITR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1367 |
1000000000 / (adapter->itr * 256)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1368 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1369 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1370 |
/* Setup the Base and Length of the Rx Descriptor Ring */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1371 |
E1000_WRITE_REG(&adapter->hw, RDBAL, (rdba & 0x00000000ffffffffULL)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1372 |
E1000_WRITE_REG(&adapter->hw, RDBAH, (rdba >> 32)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1373 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1374 |
E1000_WRITE_REG(&adapter->hw, RDLEN, rdlen); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1375 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1376 |
/* Setup the HW Rx Head and Tail Descriptor Pointers */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1377 |
E1000_WRITE_REG(&adapter->hw, RDH, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1378 |
E1000_WRITE_REG(&adapter->hw, RDT, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1379 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1380 |
/* Enable 82543 Receive Checksum Offload for TCP and UDP */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1381 |
if(adapter->hw.mac_type >= e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1382 |
rxcsum = E1000_READ_REG(&adapter->hw, RXCSUM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1383 |
if(adapter->rx_csum == TRUE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1384 |
rxcsum |= E1000_RXCSUM_TUOFL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1385 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1386 |
/* Enable 82573 IPv4 payload checksum for UDP fragments |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1387 |
* Must be used in conjunction with packet-split. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1388 |
if((adapter->hw.mac_type > e1000_82547_rev_2) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1389 |
(adapter->rx_ps)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1390 |
rxcsum |= E1000_RXCSUM_IPPCSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1391 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1392 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1393 |
rxcsum &= ~E1000_RXCSUM_TUOFL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1394 |
/* don't need to clear IPPCSE as it defaults to 0 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1395 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1396 |
E1000_WRITE_REG(&adapter->hw, RXCSUM, rxcsum); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1397 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1398 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1399 |
if (adapter->hw.mac_type == e1000_82573) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1400 |
E1000_WRITE_REG(&adapter->hw, ERT, 0x0100); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1401 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1402 |
/* Enable Receives */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1403 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1404 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1405 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1406 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1407 |
* e1000_free_tx_resources - Free Tx Resources |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1408 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1409 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1410 |
* Free all transmit software resources |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1411 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1412 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1413 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1414 |
e1000_free_tx_resources(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1415 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1416 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1417 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1418 |
e1000_clean_tx_ring(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1419 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1420 |
vfree(adapter->tx_ring.buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1421 |
adapter->tx_ring.buffer_info = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1422 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1423 |
pci_free_consistent(pdev, adapter->tx_ring.size, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1424 |
adapter->tx_ring.desc, adapter->tx_ring.dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1425 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1426 |
adapter->tx_ring.desc = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1427 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1428 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1429 |
static inline void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1430 |
e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1431 |
struct e1000_buffer *buffer_info) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1432 |
{ |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1433 |
if (adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1434 |
return; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1435 |
|
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1436 |
if(buffer_info->dma) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1437 |
pci_unmap_page(adapter->pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1438 |
buffer_info->dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1439 |
buffer_info->length, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1440 |
PCI_DMA_TODEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1441 |
buffer_info->dma = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1442 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1443 |
if(buffer_info->skb) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1444 |
dev_kfree_skb_any(buffer_info->skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1445 |
buffer_info->skb = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1446 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1447 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1448 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1449 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1450 |
* e1000_clean_tx_ring - Free Tx Buffers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1451 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1452 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1453 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1454 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1455 |
e1000_clean_tx_ring(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1456 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1457 |
struct e1000_desc_ring *tx_ring = &adapter->tx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1458 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1459 |
unsigned long size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1460 |
unsigned int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1461 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1462 |
/* Free all the Tx ring sk_buffs */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1463 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1464 |
if (likely(adapter->previous_buffer_info.skb != NULL)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1465 |
e1000_unmap_and_free_tx_resource(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1466 |
&adapter->previous_buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1467 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1468 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1469 |
for(i = 0; i < tx_ring->count; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1470 |
buffer_info = &tx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1471 |
e1000_unmap_and_free_tx_resource(adapter, buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1472 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1473 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1474 |
size = sizeof(struct e1000_buffer) * tx_ring->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1475 |
memset(tx_ring->buffer_info, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1476 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1477 |
/* Zero out the descriptor ring */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1478 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1479 |
memset(tx_ring->desc, 0, tx_ring->size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1480 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1481 |
tx_ring->next_to_use = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1482 |
tx_ring->next_to_clean = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1483 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1484 |
E1000_WRITE_REG(&adapter->hw, TDH, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1485 |
E1000_WRITE_REG(&adapter->hw, TDT, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1486 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1487 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1488 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1489 |
* e1000_free_rx_resources - Free Rx Resources |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1490 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1491 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1492 |
* Free all receive software resources |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1493 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1494 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1495 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1496 |
e1000_free_rx_resources(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1497 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1498 |
struct e1000_desc_ring *rx_ring = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1499 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1500 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1501 |
e1000_clean_rx_ring(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1503 |
vfree(rx_ring->buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1504 |
rx_ring->buffer_info = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1505 |
kfree(rx_ring->ps_page); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1506 |
rx_ring->ps_page = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1507 |
kfree(rx_ring->ps_page_dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1508 |
rx_ring->ps_page_dma = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1509 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1510 |
pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1511 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1512 |
rx_ring->desc = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1513 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1514 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1515 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1516 |
* e1000_clean_rx_ring - Free Rx Buffers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1517 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1518 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1519 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1520 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1521 |
e1000_clean_rx_ring(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1522 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1523 |
struct e1000_desc_ring *rx_ring = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1524 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1525 |
struct e1000_ps_page *ps_page; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1526 |
struct e1000_ps_page_dma *ps_page_dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1527 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1528 |
unsigned long size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1529 |
unsigned int i, j; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1530 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1531 |
/* Free all the Rx ring sk_buffs */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1532 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1533 |
for(i = 0; i < rx_ring->count; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1534 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1535 |
if(buffer_info->skb) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1536 |
ps_page = &rx_ring->ps_page[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1537 |
ps_page_dma = &rx_ring->ps_page_dma[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1538 |
pci_unmap_single(pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1539 |
buffer_info->dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1540 |
buffer_info->length, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1541 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1542 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1543 |
dev_kfree_skb(buffer_info->skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1544 |
buffer_info->skb = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1545 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1546 |
for(j = 0; j < PS_PAGE_BUFFERS; j++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1547 |
if(!ps_page->ps_page[j]) break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1548 |
pci_unmap_single(pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1549 |
ps_page_dma->ps_page_dma[j], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1550 |
PAGE_SIZE, PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1551 |
ps_page_dma->ps_page_dma[j] = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1552 |
put_page(ps_page->ps_page[j]); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1553 |
ps_page->ps_page[j] = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1554 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1555 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1556 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1557 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1558 |
size = sizeof(struct e1000_buffer) * rx_ring->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1559 |
memset(rx_ring->buffer_info, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1560 |
size = sizeof(struct e1000_ps_page) * rx_ring->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1561 |
memset(rx_ring->ps_page, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1562 |
size = sizeof(struct e1000_ps_page_dma) * rx_ring->count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1563 |
memset(rx_ring->ps_page_dma, 0, size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1564 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1565 |
/* Zero out the descriptor ring */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1566 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1567 |
memset(rx_ring->desc, 0, rx_ring->size); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1568 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1569 |
rx_ring->next_to_clean = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1570 |
rx_ring->next_to_use = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1571 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1572 |
E1000_WRITE_REG(&adapter->hw, RDH, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1573 |
E1000_WRITE_REG(&adapter->hw, RDT, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1574 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1575 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1576 |
/* The 82542 2.0 (revision 2) needs to have the receive unit in reset |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1577 |
* and memory write and invalidate disabled for certain operations |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1578 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1579 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1580 |
e1000_enter_82542_rst(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1581 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1582 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1583 |
uint32_t rctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1584 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1585 |
e1000_pci_clear_mwi(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1586 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1587 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1588 |
rctl |= E1000_RCTL_RST; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1589 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1590 |
E1000_WRITE_FLUSH(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1591 |
mdelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1592 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1593 |
if (!adapter->ecdev && netif_running(netdev)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1594 |
e1000_clean_rx_ring(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1595 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1596 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1597 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1598 |
e1000_leave_82542_rst(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1599 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1600 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1601 |
uint32_t rctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1602 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1603 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1604 |
rctl &= ~E1000_RCTL_RST; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1605 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1606 |
E1000_WRITE_FLUSH(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1607 |
mdelay(5); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1608 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1609 |
if(adapter->hw.pci_cmd_word & PCI_COMMAND_INVALIDATE) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1610 |
e1000_pci_set_mwi(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1611 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1612 |
if (!adapter->ecdev && netif_running(netdev)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1613 |
e1000_configure_rx(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1614 |
e1000_alloc_rx_buffers(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1615 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1616 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1617 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1618 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1619 |
* e1000_set_mac - Change the Ethernet Address of the NIC |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1620 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1621 |
* @p: pointer to an address structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1622 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1623 |
* Returns 0 on success, negative on failure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1624 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1625 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1626 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1627 |
e1000_set_mac(struct net_device *netdev, void *p) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1628 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1629 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1630 |
struct sockaddr *addr = p; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1631 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1632 |
if(!is_valid_ether_addr(addr->sa_data)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1633 |
return -EADDRNOTAVAIL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1634 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1635 |
/* 82542 2.0 needs to be in reset to write receive address registers */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1636 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1637 |
if(adapter->hw.mac_type == e1000_82542_rev2_0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1638 |
e1000_enter_82542_rst(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1639 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1640 |
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1641 |
memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1642 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1643 |
e1000_rar_set(&adapter->hw, adapter->hw.mac_addr, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1644 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1645 |
if(adapter->hw.mac_type == e1000_82542_rev2_0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1646 |
e1000_leave_82542_rst(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1647 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1648 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1649 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1650 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1651 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1652 |
* e1000_set_multi - Multicast and Promiscuous mode set |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1653 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1654 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1655 |
* The set_multi entry point is called whenever the multicast address |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1656 |
* list or the network interface flags are updated. This routine is |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1657 |
* responsible for configuring the hardware for proper multicast, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1658 |
* promiscuous mode, and all-multi behavior. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1659 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1660 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1661 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1662 |
e1000_set_multi(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1663 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1664 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1665 |
struct e1000_hw *hw = &adapter->hw; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1666 |
struct dev_mc_list *mc_ptr; |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1667 |
unsigned long flags = 0; |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1668 |
uint32_t rctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1669 |
uint32_t hash_value; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1670 |
int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1671 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1672 |
if (!adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1673 |
spin_lock_irqsave(&adapter->tx_lock, flags); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1674 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1675 |
/* Check for Promiscuous and All Multicast modes */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1676 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1677 |
rctl = E1000_READ_REG(hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1678 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1679 |
if(netdev->flags & IFF_PROMISC) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1680 |
rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1681 |
} else if(netdev->flags & IFF_ALLMULTI) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1682 |
rctl |= E1000_RCTL_MPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1683 |
rctl &= ~E1000_RCTL_UPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1684 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1685 |
rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1686 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1687 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1688 |
E1000_WRITE_REG(hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1689 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1690 |
/* 82542 2.0 needs to be in reset to write receive address registers */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1691 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1692 |
if(hw->mac_type == e1000_82542_rev2_0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1693 |
e1000_enter_82542_rst(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1694 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1695 |
/* load the first 14 multicast address into the exact filters 1-14 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1696 |
* RAR 0 is used for the station MAC adddress |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1697 |
* if there are not 14 addresses, go ahead and clear the filters |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1698 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1699 |
mc_ptr = netdev->mc_list; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1700 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1701 |
for(i = 1; i < E1000_RAR_ENTRIES; i++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1702 |
if(mc_ptr) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1703 |
e1000_rar_set(hw, mc_ptr->dmi_addr, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1704 |
mc_ptr = mc_ptr->next; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1705 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1706 |
E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1707 |
E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1708 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1709 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1710 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1711 |
/* clear the old settings from the multicast hash table */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1712 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1713 |
for(i = 0; i < E1000_NUM_MTA_REGISTERS; i++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1714 |
E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1715 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1716 |
/* load any remaining addresses into the hash table */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1717 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1718 |
for(; mc_ptr; mc_ptr = mc_ptr->next) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1719 |
hash_value = e1000_hash_mc_addr(hw, mc_ptr->dmi_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1720 |
e1000_mta_set(hw, hash_value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1721 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1722 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1723 |
if(hw->mac_type == e1000_82542_rev2_0) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1724 |
e1000_leave_82542_rst(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1725 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1726 |
if (!adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1727 |
spin_unlock_irqrestore(&adapter->tx_lock, flags); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1728 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1729 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1730 |
/* Need to wait a few seconds after link up to get diagnostic information from |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1731 |
* the phy */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1732 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1733 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1734 |
e1000_update_phy_info(unsigned long data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1735 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1736 |
struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1737 |
e1000_phy_get_info(&adapter->hw, &adapter->phy_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1738 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1739 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1740 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1741 |
* e1000_82547_tx_fifo_stall - Timer Call-back |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1742 |
* @data: pointer to adapter cast into an unsigned long |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1743 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1744 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1745 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1746 |
e1000_82547_tx_fifo_stall(unsigned long data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1747 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1748 |
struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1749 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1750 |
uint32_t tctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1751 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1752 |
if(atomic_read(&adapter->tx_fifo_stall)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1753 |
if((E1000_READ_REG(&adapter->hw, TDT) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1754 |
E1000_READ_REG(&adapter->hw, TDH)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1755 |
(E1000_READ_REG(&adapter->hw, TDFT) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1756 |
E1000_READ_REG(&adapter->hw, TDFH)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1757 |
(E1000_READ_REG(&adapter->hw, TDFTS) == |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1758 |
E1000_READ_REG(&adapter->hw, TDFHS))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1759 |
tctl = E1000_READ_REG(&adapter->hw, TCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1760 |
E1000_WRITE_REG(&adapter->hw, TCTL, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1761 |
tctl & ~E1000_TCTL_EN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1762 |
E1000_WRITE_REG(&adapter->hw, TDFT, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1763 |
adapter->tx_head_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1764 |
E1000_WRITE_REG(&adapter->hw, TDFH, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1765 |
adapter->tx_head_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1766 |
E1000_WRITE_REG(&adapter->hw, TDFTS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1767 |
adapter->tx_head_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1768 |
E1000_WRITE_REG(&adapter->hw, TDFHS, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1769 |
adapter->tx_head_addr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1770 |
E1000_WRITE_REG(&adapter->hw, TCTL, tctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1771 |
E1000_WRITE_FLUSH(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1772 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1773 |
adapter->tx_fifo_head = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1774 |
atomic_set(&adapter->tx_fifo_stall, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1775 |
if (!adapter->ecdev) netif_wake_queue(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1776 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1777 |
mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1778 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1779 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1780 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1781 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1782 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1783 |
* e1000_watchdog - Timer Call-back |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1784 |
* @data: pointer to adapter cast into an unsigned long |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1785 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1786 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1787 |
e1000_watchdog(unsigned long data) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1788 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1789 |
struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1790 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1791 |
/* Do the rest outside of interrupt context */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1792 |
schedule_work(&adapter->watchdog_task); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1793 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1794 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1795 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1796 |
e1000_watchdog_task(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1797 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1798 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1799 |
struct e1000_desc_ring *txdr = &adapter->tx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1800 |
uint32_t link; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1801 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1802 |
e1000_check_for_link(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1803 |
if (adapter->hw.mac_type == e1000_82573) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1804 |
e1000_enable_tx_pkt_filtering(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1805 |
if(adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1806 |
e1000_update_mng_vlan(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1807 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1808 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1809 |
if((adapter->hw.media_type == e1000_media_type_internal_serdes) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1810 |
!(E1000_READ_REG(&adapter->hw, TXCW) & E1000_TXCW_ANE)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1811 |
link = !adapter->hw.serdes_link_down; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1812 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1813 |
link = E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1814 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1815 |
if (link) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1816 |
if ((adapter->ecdev && !ecdev_get_link(adapter->ecdev)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1817 |
|| (!adapter->ecdev && !netif_carrier_ok(netdev))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1818 |
e1000_get_speed_and_duplex(&adapter->hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1819 |
&adapter->link_speed, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1820 |
&adapter->link_duplex); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1821 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1822 |
DPRINTK(LINK, INFO, "NIC Link is Up %d Mbps %s\n", |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1823 |
adapter->link_speed, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1824 |
adapter->link_duplex == FULL_DUPLEX ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1825 |
"Full Duplex" : "Half Duplex"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1826 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1827 |
if (adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1828 |
ecdev_set_link(adapter->ecdev, 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1829 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1830 |
netif_carrier_on(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1831 |
netif_wake_queue(netdev); |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1832 |
mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1833 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1834 |
adapter->smartspeed = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1835 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1836 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1837 |
if ((adapter->ecdev && ecdev_get_link(adapter->ecdev)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1838 |
|| (!adapter->ecdev && netif_carrier_ok(netdev))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1839 |
adapter->link_speed = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1840 |
adapter->link_duplex = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1841 |
DPRINTK(LINK, INFO, "NIC Link is Down\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1842 |
if (adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1843 |
ecdev_set_link(adapter->ecdev, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1844 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1845 |
netif_carrier_off(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1846 |
netif_stop_queue(netdev); |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1847 |
mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1848 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1849 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1850 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1851 |
e1000_smartspeed(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1852 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1853 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1854 |
e1000_update_stats(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1855 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1856 |
adapter->hw.tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1857 |
adapter->tpt_old = adapter->stats.tpt; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1858 |
adapter->hw.collision_delta = adapter->stats.colc - adapter->colc_old; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1859 |
adapter->colc_old = adapter->stats.colc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1860 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1861 |
adapter->gorcl = adapter->stats.gorcl - adapter->gorcl_old; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1862 |
adapter->gorcl_old = adapter->stats.gorcl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1863 |
adapter->gotcl = adapter->stats.gotcl - adapter->gotcl_old; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1864 |
adapter->gotcl_old = adapter->stats.gotcl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1865 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1866 |
e1000_update_adaptive(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1867 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1868 |
if (!adapter->ecdev && !netif_carrier_ok(netdev)) { |
677 | 1869 |
if(E1000_DESC_UNUSED(txdr) + 1 < txdr->count) { |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1870 |
/* We've lost link, so the controller stops DMA, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1871 |
* but we've got queued Tx work that's never going |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1872 |
* to get done, so reset controller to flush Tx. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1873 |
* (Do the reset outside of interrupt context). */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1874 |
schedule_work(&adapter->tx_timeout_task); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1875 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1876 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1877 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1878 |
/* Dynamic mode for Interrupt Throttle Rate (ITR) */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1879 |
if(adapter->hw.mac_type >= e1000_82540 && adapter->itr == 1) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1880 |
/* Symmetric Tx/Rx gets a reduced ITR=2000; Total |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1881 |
* asymmetrical Tx or Rx gets ITR=8000; everyone |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1882 |
* else is between 2000-8000. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1883 |
uint32_t goc = (adapter->gotcl + adapter->gorcl) / 10000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1884 |
uint32_t dif = (adapter->gotcl > adapter->gorcl ? |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1885 |
adapter->gotcl - adapter->gorcl : |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1886 |
adapter->gorcl - adapter->gotcl) / 10000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1887 |
uint32_t itr = goc > 0 ? (dif * 6000 / goc + 2000) : 8000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1888 |
E1000_WRITE_REG(&adapter->hw, ITR, 1000000000 / (itr * 256)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1889 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1890 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1891 |
/* Cause software interrupt to ensure rx ring is cleaned */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1892 |
E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_RXDMT0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1893 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1894 |
/* Force detection of hung controller every watchdog period */ |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1895 |
if (!adapter->ecdev) adapter->detect_tx_hung = TRUE; |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1896 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1897 |
/* Reset the timer */ |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1898 |
if (!adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
1899 |
mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1900 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1901 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1902 |
#define E1000_TX_FLAGS_CSUM 0x00000001 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1903 |
#define E1000_TX_FLAGS_VLAN 0x00000002 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1904 |
#define E1000_TX_FLAGS_TSO 0x00000004 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1905 |
#define E1000_TX_FLAGS_IPV4 0x00000008 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1906 |
#define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1907 |
#define E1000_TX_FLAGS_VLAN_SHIFT 16 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1908 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1909 |
static inline int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1910 |
e1000_tso(struct e1000_adapter *adapter, struct sk_buff *skb) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1911 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1912 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1913 |
struct e1000_context_desc *context_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1914 |
unsigned int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1915 |
uint32_t cmd_length = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1916 |
uint16_t ipcse = 0, tucse, mss; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1917 |
uint8_t ipcss, ipcso, tucss, tucso, hdr_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1918 |
int err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1919 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1920 |
if(skb_shinfo(skb)->tso_size) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1921 |
if (skb_header_cloned(skb)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1922 |
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1923 |
if (err) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1924 |
return err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1925 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1926 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1927 |
hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1928 |
mss = skb_shinfo(skb)->tso_size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1929 |
if(skb->protocol == ntohs(ETH_P_IP)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1930 |
skb->nh.iph->tot_len = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1931 |
skb->nh.iph->check = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1932 |
skb->h.th->check = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1933 |
~csum_tcpudp_magic(skb->nh.iph->saddr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1934 |
skb->nh.iph->daddr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1935 |
0, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1936 |
IPPROTO_TCP, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1937 |
0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1938 |
cmd_length = E1000_TXD_CMD_IP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1939 |
ipcse = skb->h.raw - skb->data - 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1940 |
#ifdef NETIF_F_TSO_IPV6 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1941 |
} else if(skb->protocol == ntohs(ETH_P_IPV6)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1942 |
skb->nh.ipv6h->payload_len = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1943 |
skb->h.th->check = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1944 |
~csum_ipv6_magic(&skb->nh.ipv6h->saddr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1945 |
&skb->nh.ipv6h->daddr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1946 |
0, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1947 |
IPPROTO_TCP, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1948 |
0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1949 |
ipcse = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1950 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1951 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1952 |
ipcss = skb->nh.raw - skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1953 |
ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1954 |
tucss = skb->h.raw - skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1955 |
tucso = (void *)&(skb->h.th->check) - (void *)skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1956 |
tucse = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1957 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1958 |
cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1959 |
E1000_TXD_CMD_TCP | (skb->len - (hdr_len))); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1960 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1961 |
i = adapter->tx_ring.next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1962 |
context_desc = E1000_CONTEXT_DESC(adapter->tx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1963 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1964 |
context_desc->lower_setup.ip_fields.ipcss = ipcss; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1965 |
context_desc->lower_setup.ip_fields.ipcso = ipcso; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1966 |
context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1967 |
context_desc->upper_setup.tcp_fields.tucss = tucss; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1968 |
context_desc->upper_setup.tcp_fields.tucso = tucso; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1969 |
context_desc->upper_setup.tcp_fields.tucse = cpu_to_le16(tucse); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1970 |
context_desc->tcp_seg_setup.fields.mss = cpu_to_le16(mss); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1971 |
context_desc->tcp_seg_setup.fields.hdr_len = hdr_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1972 |
context_desc->cmd_and_length = cpu_to_le32(cmd_length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1973 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1974 |
if(++i == adapter->tx_ring.count) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1975 |
adapter->tx_ring.next_to_use = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1976 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1977 |
return 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1978 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1979 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1980 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1981 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1982 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1983 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1984 |
static inline boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1985 |
e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1986 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1987 |
struct e1000_context_desc *context_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1988 |
unsigned int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1989 |
uint8_t css; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1990 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1991 |
if(likely(skb->ip_summed == CHECKSUM_HW)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1992 |
css = skb->h.raw - skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1993 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1994 |
i = adapter->tx_ring.next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1995 |
context_desc = E1000_CONTEXT_DESC(adapter->tx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1996 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1997 |
context_desc->upper_setup.tcp_fields.tucss = css; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1998 |
context_desc->upper_setup.tcp_fields.tucso = css + skb->csum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1999 |
context_desc->upper_setup.tcp_fields.tucse = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2000 |
context_desc->tcp_seg_setup.data = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2001 |
context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2002 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2003 |
if(unlikely(++i == adapter->tx_ring.count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2004 |
adapter->tx_ring.next_to_use = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2005 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2006 |
return TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2007 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2008 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2009 |
return FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2010 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2011 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2012 |
#define E1000_MAX_TXD_PWR 12 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2013 |
#define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2014 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2015 |
static inline int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2016 |
e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2017 |
unsigned int first, unsigned int max_per_txd, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2018 |
unsigned int nr_frags, unsigned int mss) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2019 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2020 |
struct e1000_desc_ring *tx_ring = &adapter->tx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2021 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2022 |
unsigned int len = skb->len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2023 |
unsigned int offset = 0, size, count = 0, i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2024 |
unsigned int f; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2025 |
len -= skb->data_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2026 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2027 |
i = tx_ring->next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2028 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2029 |
while(len) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2030 |
buffer_info = &tx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2031 |
size = min(len, max_per_txd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2032 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2033 |
/* Workaround for premature desc write-backs |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2034 |
* in TSO mode. Append 4-byte sentinel desc */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2035 |
if(unlikely(mss && !nr_frags && size == len && size > 8)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2036 |
size -= 4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2037 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2038 |
/* work-around for errata 10 and it applies |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2039 |
* to all controllers in PCI-X mode |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2040 |
* The fix is to make sure that the first descriptor of a |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2041 |
* packet is smaller than 2048 - 16 - 16 (or 2016) bytes |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2042 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2043 |
if(unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2044 |
(size > 2015) && count == 0)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2045 |
size = 2015; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2046 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2047 |
/* Workaround for potential 82544 hang in PCI-X. Avoid |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2048 |
* terminating buffers within evenly-aligned dwords. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2049 |
if(unlikely(adapter->pcix_82544 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2050 |
!((unsigned long)(skb->data + offset + size - 1) & 4) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2051 |
size > 4)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2052 |
size -= 4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2053 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2054 |
buffer_info->length = size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2055 |
buffer_info->dma = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2056 |
pci_map_single(adapter->pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2057 |
skb->data + offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2058 |
size, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2059 |
PCI_DMA_TODEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2060 |
buffer_info->time_stamp = jiffies; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2061 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2062 |
len -= size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2063 |
offset += size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2064 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2065 |
if(unlikely(++i == tx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2066 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2067 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2068 |
for(f = 0; f < nr_frags; f++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2069 |
struct skb_frag_struct *frag; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2070 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2071 |
frag = &skb_shinfo(skb)->frags[f]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2072 |
len = frag->size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2073 |
offset = frag->page_offset; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2074 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2075 |
while(len) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2076 |
buffer_info = &tx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2077 |
size = min(len, max_per_txd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2078 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2079 |
/* Workaround for premature desc write-backs |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2080 |
* in TSO mode. Append 4-byte sentinel desc */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2081 |
if(unlikely(mss && f == (nr_frags-1) && size == len && size > 8)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2082 |
size -= 4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2083 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2084 |
/* Workaround for potential 82544 hang in PCI-X. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2085 |
* Avoid terminating buffers within evenly-aligned |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2086 |
* dwords. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2087 |
if(unlikely(adapter->pcix_82544 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2088 |
!((unsigned long)(frag->page+offset+size-1) & 4) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2089 |
size > 4)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2090 |
size -= 4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2091 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2092 |
buffer_info->length = size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2093 |
buffer_info->dma = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2094 |
pci_map_page(adapter->pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2095 |
frag->page, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2096 |
offset, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2097 |
size, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2098 |
PCI_DMA_TODEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2099 |
buffer_info->time_stamp = jiffies; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2100 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2101 |
len -= size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2102 |
offset += size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2103 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2104 |
if(unlikely(++i == tx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2105 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2106 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2107 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2108 |
i = (i == 0) ? tx_ring->count - 1 : i - 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2109 |
tx_ring->buffer_info[i].skb = skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2110 |
tx_ring->buffer_info[first].next_to_watch = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2111 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2112 |
return count; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2113 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2114 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2115 |
static inline void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2116 |
e1000_tx_queue(struct e1000_adapter *adapter, int count, int tx_flags) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2117 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2118 |
struct e1000_desc_ring *tx_ring = &adapter->tx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2119 |
struct e1000_tx_desc *tx_desc = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2120 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2121 |
uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2122 |
unsigned int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2123 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2124 |
if(likely(tx_flags & E1000_TX_FLAGS_TSO)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2125 |
txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2126 |
E1000_TXD_CMD_TSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2127 |
txd_upper |= E1000_TXD_POPTS_TXSM << 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2128 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2129 |
if(likely(tx_flags & E1000_TX_FLAGS_IPV4)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2130 |
txd_upper |= E1000_TXD_POPTS_IXSM << 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2131 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2132 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2133 |
if(likely(tx_flags & E1000_TX_FLAGS_CSUM)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2134 |
txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2135 |
txd_upper |= E1000_TXD_POPTS_TXSM << 8; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2136 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2137 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2138 |
if(unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2139 |
txd_lower |= E1000_TXD_CMD_VLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2140 |
txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2141 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2142 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2143 |
i = tx_ring->next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2144 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2145 |
while(count--) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2146 |
buffer_info = &tx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2147 |
tx_desc = E1000_TX_DESC(*tx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2148 |
tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2149 |
tx_desc->lower.data = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2150 |
cpu_to_le32(txd_lower | buffer_info->length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2151 |
tx_desc->upper.data = cpu_to_le32(txd_upper); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2152 |
if(unlikely(++i == tx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2153 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2154 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2155 |
tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2156 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2157 |
/* Force memory writes to complete before letting h/w |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2158 |
* know there are new descriptors to fetch. (Only |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2159 |
* applicable for weak-ordered memory model archs, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2160 |
* such as IA-64). */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2161 |
wmb(); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2162 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2163 |
tx_ring->next_to_use = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2164 |
E1000_WRITE_REG(&adapter->hw, TDT, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2165 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2166 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2167 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2168 |
* 82547 workaround to avoid controller hang in half-duplex environment. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2169 |
* The workaround is to avoid queuing a large packet that would span |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2170 |
* the internal Tx FIFO ring boundary by notifying the stack to resend |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2171 |
* the packet at a later time. This gives the Tx FIFO an opportunity to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2172 |
* flush all packets. When that occurs, we reset the Tx FIFO pointers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2173 |
* to the beginning of the Tx FIFO. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2174 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2175 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2176 |
#define E1000_FIFO_HDR 0x10 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2177 |
#define E1000_82547_PAD_LEN 0x3E0 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2178 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2179 |
static inline int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2180 |
e1000_82547_fifo_workaround(struct e1000_adapter *adapter, struct sk_buff *skb) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2181 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2182 |
uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2183 |
uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2184 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2185 |
E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2186 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2187 |
if(adapter->link_duplex != HALF_DUPLEX) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2188 |
goto no_fifo_stall_required; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2189 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2190 |
if(atomic_read(&adapter->tx_fifo_stall)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2191 |
return 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2192 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2193 |
if(skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2194 |
atomic_set(&adapter->tx_fifo_stall, 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2195 |
return 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2196 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2197 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2198 |
no_fifo_stall_required: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2199 |
adapter->tx_fifo_head += skb_fifo_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2200 |
if(adapter->tx_fifo_head >= adapter->tx_fifo_size) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2201 |
adapter->tx_fifo_head -= adapter->tx_fifo_size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2202 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2203 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2204 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2205 |
#define MINIMUM_DHCP_PACKET_SIZE 282 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2206 |
static inline int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2207 |
e1000_transfer_dhcp_info(struct e1000_adapter *adapter, struct sk_buff *skb) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2208 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2209 |
struct e1000_hw *hw = &adapter->hw; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2210 |
uint16_t length, offset; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2211 |
if(vlan_tx_tag_present(skb)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2212 |
if(!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2213 |
( adapter->hw.mng_cookie.status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2214 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) ) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2215 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2216 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2217 |
if(htons(ETH_P_IP) == skb->protocol) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2218 |
const struct iphdr *ip = skb->nh.iph; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2219 |
if(IPPROTO_UDP == ip->protocol) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2220 |
struct udphdr *udp = (struct udphdr *)(skb->h.uh); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2221 |
if(ntohs(udp->dest) == 67) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2222 |
offset = (uint8_t *)udp + 8 - skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2223 |
length = skb->len - offset; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2224 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2225 |
return e1000_mng_write_dhcp_info(hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2226 |
(uint8_t *)udp + 8, length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2227 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2228 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2229 |
} else if((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2230 |
struct ethhdr *eth = (struct ethhdr *) skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2231 |
if((htons(ETH_P_IP) == eth->h_proto)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2232 |
const struct iphdr *ip = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2233 |
(struct iphdr *)((uint8_t *)skb->data+14); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2234 |
if(IPPROTO_UDP == ip->protocol) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2235 |
struct udphdr *udp = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2236 |
(struct udphdr *)((uint8_t *)ip + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2237 |
(ip->ihl << 2)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2238 |
if(ntohs(udp->dest) == 67) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2239 |
offset = (uint8_t *)udp + 8 - skb->data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2240 |
length = skb->len - offset; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2241 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2242 |
return e1000_mng_write_dhcp_info(hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2243 |
(uint8_t *)udp + 8, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2244 |
length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2245 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2246 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2247 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2248 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2249 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2250 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2251 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2252 |
#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 ) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2253 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2254 |
e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2255 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2256 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2257 |
unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2258 |
unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2259 |
unsigned int tx_flags = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2260 |
unsigned int len = skb->len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2261 |
unsigned long flags = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2262 |
unsigned int nr_frags = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2263 |
unsigned int mss = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2264 |
int count = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2265 |
int tso; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2266 |
unsigned int f; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2267 |
len -= skb->data_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2268 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2269 |
if(unlikely(skb->len <= 0)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2270 |
if (!adapter->ecdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2271 |
dev_kfree_skb_any(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2272 |
return NETDEV_TX_OK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2273 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2274 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2275 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2276 |
mss = skb_shinfo(skb)->tso_size; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2277 |
/* The controller does a simple calculation to |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2278 |
* make sure there is enough room in the FIFO before |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2279 |
* initiating the DMA for each buffer. The calc is: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2280 |
* 4 = ceil(buffer len/mss). To make sure we don't |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2281 |
* overrun the FIFO, adjust the max buffer len if mss |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2282 |
* drops. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2283 |
if(mss) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2284 |
max_per_txd = min(mss << 2, max_per_txd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2285 |
max_txd_pwr = fls(max_per_txd) - 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2286 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2287 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2288 |
if((mss) || (skb->ip_summed == CHECKSUM_HW)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2289 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2290 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2291 |
#else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2292 |
if(skb->ip_summed == CHECKSUM_HW) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2293 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2294 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2295 |
count += TXD_USE_COUNT(len, max_txd_pwr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2296 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2297 |
if(adapter->pcix_82544) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2298 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2299 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2300 |
/* work-around for errata 10 and it applies to all controllers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2301 |
* in PCI-X mode, so add one more descriptor to the count |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2302 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2303 |
if(unlikely((adapter->hw.bus_type == e1000_bus_type_pcix) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2304 |
(len > 2015))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2305 |
count++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2306 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2307 |
nr_frags = skb_shinfo(skb)->nr_frags; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2308 |
for(f = 0; f < nr_frags; f++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2309 |
count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2310 |
max_txd_pwr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2311 |
if(adapter->pcix_82544) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2312 |
count += nr_frags; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2313 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2314 |
if (!adapter->ecdev) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2315 |
local_irq_save(flags); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2316 |
if (!spin_trylock(&adapter->tx_lock)) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2317 |
/* Collision - tell upper layer to requeue */ |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2318 |
local_irq_restore(flags); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2319 |
return NETDEV_TX_LOCKED; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2320 |
} |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2321 |
if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) ) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2322 |
e1000_transfer_dhcp_info(adapter, skb); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2323 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2324 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2325 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2326 |
/* need: count + 2 desc gap to keep tail from touching |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2327 |
* head, otherwise try next time */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2328 |
if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2329 |
if (!adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2330 |
netif_stop_queue(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2331 |
spin_unlock_irqrestore(&adapter->tx_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2332 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2333 |
return NETDEV_TX_BUSY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2334 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2335 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2336 |
if(unlikely(adapter->hw.mac_type == e1000_82547)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2337 |
if(unlikely(e1000_82547_fifo_workaround(adapter, skb))) { |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2338 |
if (!adapter->ecdev) { |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2339 |
netif_stop_queue(netdev); |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2340 |
mod_timer(&adapter->tx_fifo_stall_timer, jiffies); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2341 |
spin_unlock_irqrestore(&adapter->tx_lock, flags); |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2342 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2343 |
return NETDEV_TX_BUSY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2344 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2345 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2346 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2347 |
if(unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2348 |
tx_flags |= E1000_TX_FLAGS_VLAN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2349 |
tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2350 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2351 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2352 |
first = adapter->tx_ring.next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2353 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2354 |
tso = e1000_tso(adapter, skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2355 |
if (tso < 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2356 |
if (!adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2357 |
dev_kfree_skb_any(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2358 |
spin_unlock_irqrestore(&adapter->tx_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2359 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2360 |
return NETDEV_TX_OK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2361 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2362 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2363 |
if (likely(tso)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2364 |
tx_flags |= E1000_TX_FLAGS_TSO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2365 |
else if(likely(e1000_tx_csum(adapter, skb))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2366 |
tx_flags |= E1000_TX_FLAGS_CSUM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2367 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2368 |
/* Old method was to assume IPv4 packet by default if TSO was enabled. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2369 |
* 82573 hardware supports TSO capabilities for IPv6 as well... |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2370 |
* no longer assume, we must. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2371 |
if(likely(skb->protocol == ntohs(ETH_P_IP))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2372 |
tx_flags |= E1000_TX_FLAGS_IPV4; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2373 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2374 |
e1000_tx_queue(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2375 |
e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2376 |
tx_flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2377 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2378 |
netdev->trans_start = jiffies; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2379 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2380 |
/* Make sure there is space in the ring for the next send. */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2381 |
if (!adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2382 |
if(unlikely(E1000_DESC_UNUSED(&adapter->tx_ring) < MAX_SKB_FRAGS + 2)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2383 |
netif_stop_queue(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2384 |
spin_unlock_irqrestore(&adapter->tx_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2385 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2386 |
return NETDEV_TX_OK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2387 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2388 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2389 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2390 |
* e1000_tx_timeout - Respond to a Tx Hang |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2391 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2392 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2393 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2394 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2395 |
e1000_tx_timeout(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2396 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2397 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2398 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2399 |
/* Do the reset outside of interrupt context */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2400 |
schedule_work(&adapter->tx_timeout_task); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2401 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2402 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2403 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2404 |
e1000_tx_timeout_task(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2405 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2406 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2407 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2408 |
e1000_down(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2409 |
e1000_up(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2410 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2411 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2412 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2413 |
* e1000_get_stats - Get System Network Statistics |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2414 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2415 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2416 |
* Returns the address of the device statistics structure. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2417 |
* The statistics are actually updated from the timer callback. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2418 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2419 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2420 |
static struct net_device_stats * |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2421 |
e1000_get_stats(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2422 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2423 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2424 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2425 |
e1000_update_stats(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2426 |
return &adapter->net_stats; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2427 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2428 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2429 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2430 |
* e1000_change_mtu - Change the Maximum Transfer Unit |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2431 |
* @netdev: network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2432 |
* @new_mtu: new value for maximum frame size |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2433 |
* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2434 |
* Returns 0 on success, negative on failure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2435 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2436 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2437 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2438 |
e1000_change_mtu(struct net_device *netdev, int new_mtu) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2439 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2440 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2441 |
int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2442 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2443 |
if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2444 |
(max_frame > MAX_JUMBO_FRAME_SIZE)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2445 |
DPRINTK(PROBE, ERR, "Invalid MTU setting\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2446 |
return -EINVAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2447 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2448 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2449 |
#define MAX_STD_JUMBO_FRAME_SIZE 9216 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2450 |
/* might want this to be bigger enum check... */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2451 |
if (adapter->hw.mac_type == e1000_82573 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2452 |
max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2453 |
DPRINTK(PROBE, ERR, "Jumbo Frames not supported " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2454 |
"on 82573\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2455 |
return -EINVAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2456 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2457 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2458 |
if(adapter->hw.mac_type > e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2459 |
adapter->rx_buffer_len = max_frame; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2460 |
E1000_ROUNDUP(adapter->rx_buffer_len, 1024); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2461 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2462 |
if(unlikely((adapter->hw.mac_type < e1000_82543) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2463 |
(max_frame > MAXIMUM_ETHERNET_FRAME_SIZE))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2464 |
DPRINTK(PROBE, ERR, "Jumbo Frames not supported " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2465 |
"on 82542\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2466 |
return -EINVAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2467 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2468 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2469 |
if(max_frame <= E1000_RXBUFFER_2048) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2470 |
adapter->rx_buffer_len = E1000_RXBUFFER_2048; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2471 |
} else if(max_frame <= E1000_RXBUFFER_4096) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2472 |
adapter->rx_buffer_len = E1000_RXBUFFER_4096; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2473 |
} else if(max_frame <= E1000_RXBUFFER_8192) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2474 |
adapter->rx_buffer_len = E1000_RXBUFFER_8192; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2475 |
} else if(max_frame <= E1000_RXBUFFER_16384) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2476 |
adapter->rx_buffer_len = E1000_RXBUFFER_16384; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2477 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2478 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2479 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2480 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2481 |
netdev->mtu = new_mtu; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2482 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2483 |
if (adapter->ecdev || netif_running(netdev)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2484 |
e1000_down(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2485 |
e1000_up(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2486 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2487 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2488 |
adapter->hw.max_frame_size = max_frame; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2489 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2490 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2491 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2492 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2493 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2494 |
* e1000_update_stats - Update the board statistics counters |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2495 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2496 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2497 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2498 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2499 |
e1000_update_stats(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2500 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2501 |
struct e1000_hw *hw = &adapter->hw; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2502 |
unsigned long flags = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2503 |
uint16_t phy_tmp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2504 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2505 |
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2506 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2507 |
if (!adapter->ecdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2508 |
spin_lock_irqsave(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2509 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2510 |
/* these counters are modified from e1000_adjust_tbi_stats, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2511 |
* called from the interrupt context, so they must only |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2512 |
* be written while holding adapter->stats_lock |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2513 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2514 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2515 |
adapter->stats.crcerrs += E1000_READ_REG(hw, CRCERRS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2516 |
adapter->stats.gprc += E1000_READ_REG(hw, GPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2517 |
adapter->stats.gorcl += E1000_READ_REG(hw, GORCL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2518 |
adapter->stats.gorch += E1000_READ_REG(hw, GORCH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2519 |
adapter->stats.bprc += E1000_READ_REG(hw, BPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2520 |
adapter->stats.mprc += E1000_READ_REG(hw, MPRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2521 |
adapter->stats.roc += E1000_READ_REG(hw, ROC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2522 |
adapter->stats.prc64 += E1000_READ_REG(hw, PRC64); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2523 |
adapter->stats.prc127 += E1000_READ_REG(hw, PRC127); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2524 |
adapter->stats.prc255 += E1000_READ_REG(hw, PRC255); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2525 |
adapter->stats.prc511 += E1000_READ_REG(hw, PRC511); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2526 |
adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2527 |
adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2528 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2529 |
adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2530 |
adapter->stats.mpc += E1000_READ_REG(hw, MPC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2531 |
adapter->stats.scc += E1000_READ_REG(hw, SCC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2532 |
adapter->stats.ecol += E1000_READ_REG(hw, ECOL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2533 |
adapter->stats.mcc += E1000_READ_REG(hw, MCC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2534 |
adapter->stats.latecol += E1000_READ_REG(hw, LATECOL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2535 |
adapter->stats.dc += E1000_READ_REG(hw, DC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2536 |
adapter->stats.sec += E1000_READ_REG(hw, SEC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2537 |
adapter->stats.rlec += E1000_READ_REG(hw, RLEC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2538 |
adapter->stats.xonrxc += E1000_READ_REG(hw, XONRXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2539 |
adapter->stats.xontxc += E1000_READ_REG(hw, XONTXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2540 |
adapter->stats.xoffrxc += E1000_READ_REG(hw, XOFFRXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2541 |
adapter->stats.xofftxc += E1000_READ_REG(hw, XOFFTXC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2542 |
adapter->stats.fcruc += E1000_READ_REG(hw, FCRUC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2543 |
adapter->stats.gptc += E1000_READ_REG(hw, GPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2544 |
adapter->stats.gotcl += E1000_READ_REG(hw, GOTCL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2545 |
adapter->stats.gotch += E1000_READ_REG(hw, GOTCH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2546 |
adapter->stats.rnbc += E1000_READ_REG(hw, RNBC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2547 |
adapter->stats.ruc += E1000_READ_REG(hw, RUC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2548 |
adapter->stats.rfc += E1000_READ_REG(hw, RFC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2549 |
adapter->stats.rjc += E1000_READ_REG(hw, RJC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2550 |
adapter->stats.torl += E1000_READ_REG(hw, TORL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2551 |
adapter->stats.torh += E1000_READ_REG(hw, TORH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2552 |
adapter->stats.totl += E1000_READ_REG(hw, TOTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2553 |
adapter->stats.toth += E1000_READ_REG(hw, TOTH); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2554 |
adapter->stats.tpr += E1000_READ_REG(hw, TPR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2555 |
adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2556 |
adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2557 |
adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2558 |
adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2559 |
adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2560 |
adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2561 |
adapter->stats.mptc += E1000_READ_REG(hw, MPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2562 |
adapter->stats.bptc += E1000_READ_REG(hw, BPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2563 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2564 |
/* used for adaptive IFS */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2565 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2566 |
hw->tx_packet_delta = E1000_READ_REG(hw, TPT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2567 |
adapter->stats.tpt += hw->tx_packet_delta; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2568 |
hw->collision_delta = E1000_READ_REG(hw, COLC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2569 |
adapter->stats.colc += hw->collision_delta; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2570 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2571 |
if(hw->mac_type >= e1000_82543) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2572 |
adapter->stats.algnerrc += E1000_READ_REG(hw, ALGNERRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2573 |
adapter->stats.rxerrc += E1000_READ_REG(hw, RXERRC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2574 |
adapter->stats.tncrs += E1000_READ_REG(hw, TNCRS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2575 |
adapter->stats.cexterr += E1000_READ_REG(hw, CEXTERR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2576 |
adapter->stats.tsctc += E1000_READ_REG(hw, TSCTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2577 |
adapter->stats.tsctfc += E1000_READ_REG(hw, TSCTFC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2578 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2579 |
if(hw->mac_type > e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2580 |
adapter->stats.iac += E1000_READ_REG(hw, IAC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2581 |
adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2582 |
adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2583 |
adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2584 |
adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2585 |
adapter->stats.ictxatc += E1000_READ_REG(hw, ICTXATC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2586 |
adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2587 |
adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2588 |
adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2589 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2590 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2591 |
/* Fill out the OS statistics structure */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2592 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2593 |
adapter->net_stats.rx_packets = adapter->stats.gprc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2594 |
adapter->net_stats.tx_packets = adapter->stats.gptc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2595 |
adapter->net_stats.rx_bytes = adapter->stats.gorcl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2596 |
adapter->net_stats.tx_bytes = adapter->stats.gotcl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2597 |
adapter->net_stats.multicast = adapter->stats.mprc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2598 |
adapter->net_stats.collisions = adapter->stats.colc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2599 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2600 |
/* Rx Errors */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2601 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2602 |
adapter->net_stats.rx_errors = adapter->stats.rxerrc + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2603 |
adapter->stats.crcerrs + adapter->stats.algnerrc + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2604 |
adapter->stats.rlec + adapter->stats.mpc + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2605 |
adapter->stats.cexterr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2606 |
adapter->net_stats.rx_dropped = adapter->stats.mpc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2607 |
adapter->net_stats.rx_length_errors = adapter->stats.rlec; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2608 |
adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2609 |
adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2610 |
adapter->net_stats.rx_fifo_errors = adapter->stats.mpc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2611 |
adapter->net_stats.rx_missed_errors = adapter->stats.mpc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2612 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2613 |
/* Tx Errors */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2614 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2615 |
adapter->net_stats.tx_errors = adapter->stats.ecol + |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2616 |
adapter->stats.latecol; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2617 |
adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2618 |
adapter->net_stats.tx_window_errors = adapter->stats.latecol; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2619 |
adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2620 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2621 |
/* Tx Dropped needs to be maintained elsewhere */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2622 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2623 |
/* Phy Stats */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2624 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2625 |
if(hw->media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2626 |
if((adapter->link_speed == SPEED_1000) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2627 |
(!e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2628 |
phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2629 |
adapter->phy_stats.idle_errors += phy_tmp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2630 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2631 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2632 |
if((hw->mac_type <= e1000_82546) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2633 |
(hw->phy_type == e1000_phy_m88) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2634 |
!e1000_read_phy_reg(hw, M88E1000_RX_ERR_CNTR, &phy_tmp)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2635 |
adapter->phy_stats.receive_errors += phy_tmp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2636 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2637 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2638 |
if (!adapter->ecdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2639 |
spin_unlock_irqrestore(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2640 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2641 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2642 |
void ec_poll(struct net_device *netdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2643 |
{ |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2644 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2645 |
|
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2646 |
if (jiffies - adapter->ec_watchdog_jiffies >= 2 * HZ) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2647 |
e1000_watchdog_task(adapter); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2648 |
adapter->ec_watchdog_jiffies = jiffies; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2649 |
} |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2650 |
|
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2651 |
e1000_intr(0, netdev, NULL); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2652 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2653 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2654 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2655 |
* e1000_intr - Interrupt Handler |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2656 |
* @irq: interrupt number |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2657 |
* @data: pointer to a network interface device structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2658 |
* @pt_regs: CPU registers structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2659 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2660 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2661 |
static irqreturn_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2662 |
e1000_intr(int irq, void *data, struct pt_regs *regs) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2663 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2664 |
struct net_device *netdev = data; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2665 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2666 |
struct e1000_hw *hw = &adapter->hw; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2667 |
uint32_t icr = E1000_READ_REG(hw, ICR); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2668 |
unsigned int i; |
727
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2669 |
#ifdef CONFIG_E1000_NAPI |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2670 |
int work_done = 0; |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2671 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2672 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2673 |
if(unlikely(!icr)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2674 |
return IRQ_NONE; /* Not our interrupt */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2675 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2676 |
if(unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2677 |
hw->get_link_status = 1; |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2678 |
if (!adapter->ecdev) |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2679 |
mod_timer(&adapter->watchdog_timer, jiffies); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2680 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2681 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2682 |
#ifdef CONFIG_E1000_NAPI |
727
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2683 |
if (adapter->ecdev) { |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2684 |
for(i = 0; i < E1000_MAX_INTR; i++) |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2685 |
if(unlikely(!adapter->clean_rx(adapter, &work_done, 100) & |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2686 |
!e1000_clean_tx_irq(adapter))) |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2687 |
break; |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2688 |
} else { |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2689 |
if(likely(netif_rx_schedule_prep(netdev))) { |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2690 |
|
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2691 |
/* Disable interrupts and register for poll. The flush |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2692 |
of the posted write is intentionally left out. |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2693 |
*/ |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2694 |
|
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2695 |
atomic_inc(&adapter->irq_sem); |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2696 |
E1000_WRITE_REG(hw, IMC, ~0); |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2697 |
__netif_rx_schedule(netdev); |
fc533d28c6f8
Fixed e1000 driver when NAPI is enabled.
Florian Pose <fp@igh-essen.com>
parents:
724
diff
changeset
|
2698 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2699 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2700 |
#else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2701 |
/* Writing IMC and IMS is needed for 82547. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2702 |
Due to Hub Link bus being occupied, an interrupt |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2703 |
de-assertion message is not able to be sent. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2704 |
When an interrupt assertion message is generated later, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2705 |
two messages are re-ordered and sent out. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2706 |
That causes APIC to think 82547 is in de-assertion |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2707 |
state, while 82547 is in assertion state, resulting |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2708 |
in dead lock. Writing IMC forces 82547 into |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2709 |
de-assertion state. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2710 |
*/ |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2711 |
if(!adapter->ecdev && |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2712 |
(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2)){ |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2713 |
atomic_inc(&adapter->irq_sem); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2714 |
E1000_WRITE_REG(hw, IMC, ~0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2715 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2716 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2717 |
for(i = 0; i < E1000_MAX_INTR; i++) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2718 |
if(unlikely(!adapter->clean_rx(adapter) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2719 |
!e1000_clean_tx_irq(adapter))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2720 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2721 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2722 |
if(hw->mac_type == e1000_82547 || hw->mac_type == e1000_82547_rev_2) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2723 |
e1000_irq_enable(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2724 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2725 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2726 |
return IRQ_HANDLED; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2727 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2728 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2729 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2730 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2731 |
* e1000_clean - NAPI Rx polling callback |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2732 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2733 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2734 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2735 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2736 |
e1000_clean(struct net_device *netdev, int *budget) // never called for EtherCAT |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2737 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2738 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2739 |
int work_to_do = min(*budget, netdev->quota); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2740 |
int tx_cleaned; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2741 |
int work_done = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2742 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2743 |
tx_cleaned = e1000_clean_tx_irq(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2744 |
adapter->clean_rx(adapter, &work_done, work_to_do); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2745 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2746 |
*budget -= work_done; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2747 |
netdev->quota -= work_done; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2748 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2749 |
if ((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2750 |
/* If no Tx and not enough Rx work done, exit the polling mode */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2751 |
netif_rx_complete(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2752 |
e1000_irq_enable(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2753 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2754 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2755 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2756 |
return 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2757 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2758 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2759 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2760 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2761 |
* e1000_clean_tx_irq - Reclaim resources after transmit completes |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2762 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2763 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2764 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2765 |
static boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2766 |
e1000_clean_tx_irq(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2767 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2768 |
struct e1000_desc_ring *tx_ring = &adapter->tx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2769 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2770 |
struct e1000_tx_desc *tx_desc, *eop_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2771 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2772 |
unsigned int i, eop; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2773 |
boolean_t cleaned = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2774 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2775 |
i = tx_ring->next_to_clean; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2776 |
eop = tx_ring->buffer_info[i].next_to_watch; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2777 |
eop_desc = E1000_TX_DESC(*tx_ring, eop); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2778 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2779 |
while(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2780 |
/* Premature writeback of Tx descriptors clear (free buffers |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2781 |
* and unmap pci_mapping) previous_buffer_info */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2782 |
if (likely(adapter->previous_buffer_info.skb != NULL)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2783 |
e1000_unmap_and_free_tx_resource(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2784 |
&adapter->previous_buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2785 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2786 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2787 |
for(cleaned = FALSE; !cleaned; ) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2788 |
tx_desc = E1000_TX_DESC(*tx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2789 |
buffer_info = &tx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2790 |
cleaned = (i == eop); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2791 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2792 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2793 |
if (!(netdev->features & NETIF_F_TSO)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2794 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2795 |
e1000_unmap_and_free_tx_resource(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2796 |
buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2797 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2798 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2799 |
if (cleaned) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2800 |
memcpy(&adapter->previous_buffer_info, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2801 |
buffer_info, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2802 |
sizeof(struct e1000_buffer)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2803 |
memset(buffer_info, 0, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2804 |
sizeof(struct e1000_buffer)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2805 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2806 |
e1000_unmap_and_free_tx_resource( |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2807 |
adapter, buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2808 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2809 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2810 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2811 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2812 |
tx_desc->buffer_addr = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2813 |
tx_desc->lower.data = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2814 |
tx_desc->upper.data = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2815 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2816 |
if(unlikely(++i == tx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2817 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2818 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2819 |
eop = tx_ring->buffer_info[i].next_to_watch; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2820 |
eop_desc = E1000_TX_DESC(*tx_ring, eop); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2821 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2822 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2823 |
tx_ring->next_to_clean = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2824 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2825 |
if (!adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2826 |
spin_lock(&adapter->tx_lock); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2827 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2828 |
if(unlikely(cleaned && netif_queue_stopped(netdev) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2829 |
netif_carrier_ok(netdev))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2830 |
netif_wake_queue(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2831 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2832 |
spin_unlock(&adapter->tx_lock); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2833 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2834 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2835 |
if(!adapter->ecdev && adapter->detect_tx_hung) { |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2836 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2837 |
/* Detect a transmit hang in hardware, this serializes the |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2838 |
* check with the clearing of time_stamp and movement of i */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2839 |
adapter->detect_tx_hung = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2840 |
if (tx_ring->buffer_info[i].dma && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2841 |
time_after(jiffies, tx_ring->buffer_info[i].time_stamp + HZ) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2842 |
&& !(E1000_READ_REG(&adapter->hw, STATUS) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2843 |
E1000_STATUS_TXOFF)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2844 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2845 |
/* detected Tx unit hang */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2846 |
i = tx_ring->next_to_clean; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2847 |
eop = tx_ring->buffer_info[i].next_to_watch; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2848 |
eop_desc = E1000_TX_DESC(*tx_ring, eop); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2849 |
DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2850 |
" TDH <%x>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2851 |
" TDT <%x>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2852 |
" next_to_use <%x>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2853 |
" next_to_clean <%x>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2854 |
"buffer_info[next_to_clean]\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2855 |
" dma <%zx>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2856 |
" time_stamp <%lx>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2857 |
" next_to_watch <%x>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2858 |
" jiffies <%lx>\n" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2859 |
" next_to_watch.status <%x>\n", |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2860 |
E1000_READ_REG(&adapter->hw, TDH), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2861 |
E1000_READ_REG(&adapter->hw, TDT), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2862 |
tx_ring->next_to_use, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2863 |
i, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2864 |
tx_ring->buffer_info[i].dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2865 |
tx_ring->buffer_info[i].time_stamp, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2866 |
eop, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2867 |
jiffies, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2868 |
eop_desc->upper.fields.status); |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
2869 |
netif_stop_queue(netdev); |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2870 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2871 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2872 |
#ifdef NETIF_F_TSO |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2873 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2874 |
if( unlikely(!(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2875 |
time_after(jiffies, adapter->previous_buffer_info.time_stamp + HZ))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2876 |
e1000_unmap_and_free_tx_resource( |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2877 |
adapter, &adapter->previous_buffer_info); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2878 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2879 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2880 |
return cleaned; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2881 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2882 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2883 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2884 |
* e1000_rx_checksum - Receive Checksum Offload for 82543 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2885 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2886 |
* @status_err: receive descriptor status and error fields |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2887 |
* @csum: receive descriptor csum field |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2888 |
* @sk_buff: socket buffer with received data |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2889 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2890 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2891 |
static inline void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2892 |
e1000_rx_checksum(struct e1000_adapter *adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2893 |
uint32_t status_err, uint32_t csum, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2894 |
struct sk_buff *skb) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2895 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2896 |
uint16_t status = (uint16_t)status_err; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2897 |
uint8_t errors = (uint8_t)(status_err >> 24); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2898 |
skb->ip_summed = CHECKSUM_NONE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2899 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2900 |
/* 82543 or newer only */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2901 |
if(unlikely(adapter->hw.mac_type < e1000_82543)) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2902 |
/* Ignore Checksum bit is set */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2903 |
if(unlikely(status & E1000_RXD_STAT_IXSM)) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2904 |
/* TCP/UDP checksum error bit is set */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2905 |
if(unlikely(errors & E1000_RXD_ERR_TCPE)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2906 |
/* let the stack verify checksum errors */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2907 |
adapter->hw_csum_err++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2908 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2909 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2910 |
/* TCP/UDP Checksum has not been calculated */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2911 |
if(adapter->hw.mac_type <= e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2912 |
if(!(status & E1000_RXD_STAT_TCPCS)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2913 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2914 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2915 |
if(!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2916 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2917 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2918 |
/* It must be a TCP or UDP packet with a valid checksum */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2919 |
if (likely(status & E1000_RXD_STAT_TCPCS)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2920 |
/* TCP checksum is good */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2921 |
skb->ip_summed = CHECKSUM_UNNECESSARY; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2922 |
} else if (adapter->hw.mac_type > e1000_82547_rev_2) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2923 |
/* IP fragment with UDP payload */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2924 |
/* Hardware complements the payload checksum, so we undo it |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2925 |
* and then put the value in host order for further stack use. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2926 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2927 |
csum = ntohl(csum ^ 0xFFFF); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2928 |
skb->csum = csum; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2929 |
skb->ip_summed = CHECKSUM_HW; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2930 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2931 |
adapter->hw_csum_good++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2932 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2933 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2934 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2935 |
* e1000_clean_rx_irq - Send received data up the network stack; legacy |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2936 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2937 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2938 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2939 |
static boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2940 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2941 |
e1000_clean_rx_irq(struct e1000_adapter *adapter, int *work_done, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2942 |
int work_to_do) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2943 |
#else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2944 |
e1000_clean_rx_irq(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2945 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2946 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2947 |
struct e1000_desc_ring *rx_ring = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2948 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2949 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2950 |
struct e1000_rx_desc *rx_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2951 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2952 |
struct sk_buff *skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2953 |
unsigned long flags; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2954 |
uint32_t length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2955 |
uint8_t last_byte; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2956 |
unsigned int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2957 |
boolean_t cleaned = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2958 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2959 |
i = rx_ring->next_to_clean; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2960 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2961 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2962 |
while(rx_desc->status & E1000_RXD_STAT_DD) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2963 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2964 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2965 |
if(*work_done >= work_to_do) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2966 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2967 |
(*work_done)++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2968 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2969 |
cleaned = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2970 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2971 |
pci_unmap_single(pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2972 |
buffer_info->dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2973 |
buffer_info->length, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2974 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2975 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2976 |
skb = buffer_info->skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2977 |
length = le16_to_cpu(rx_desc->length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2978 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2979 |
if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2980 |
/* All receives must fit into a single buffer */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2981 |
E1000_DBG("%s: Receive packet consumed multiple" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2982 |
" buffers\n", netdev->name); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2983 |
if (!adapter->ecdev) dev_kfree_skb_irq(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2984 |
goto next_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2985 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2986 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2987 |
if(!adapter->ecdev && unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2988 |
last_byte = *(skb->data + length - 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2989 |
if(TBI_ACCEPT(&adapter->hw, rx_desc->status, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2990 |
rx_desc->errors, length, last_byte)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2991 |
spin_lock_irqsave(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2992 |
e1000_tbi_adjust_stats(&adapter->hw, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2993 |
&adapter->stats, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2994 |
length, skb->data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2995 |
spin_unlock_irqrestore(&adapter->stats_lock, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2996 |
flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2997 |
length--; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2998 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2999 |
dev_kfree_skb_irq(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3000 |
goto next_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3001 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3002 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3003 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3004 |
/* Good Receive */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3005 |
skb_put(skb, length - ETHERNET_FCS_SIZE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3006 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3007 |
/* Receive Checksum Offload */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3008 |
e1000_rx_checksum(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3009 |
(uint32_t)(rx_desc->status) | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3010 |
((uint32_t)(rx_desc->errors) << 24), |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3011 |
rx_desc->csum, skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3012 |
if (adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3013 |
ecdev_receive(adapter->ecdev, skb->data, length); |
1152
30f168c7f74f
No need to call e1000 watchdog when frames are received (thanks to O. Zarges).
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
3014 |
|
30f168c7f74f
No need to call e1000 watchdog when frames are received (thanks to O. Zarges).
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
3015 |
// No need to detect link status as |
30f168c7f74f
No need to call e1000 watchdog when frames are received (thanks to O. Zarges).
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
3016 |
// long as frames are received: Reset watchdog. |
30f168c7f74f
No need to call e1000 watchdog when frames are received (thanks to O. Zarges).
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
3017 |
adapter->ec_watchdog_jiffies = jiffies; |
30f168c7f74f
No need to call e1000 watchdog when frames are received (thanks to O. Zarges).
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
3018 |
|
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3019 |
skb_trim(skb, 0); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3020 |
|
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3021 |
if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3022 |
/* Force memory writes to complete before letting h/w |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3023 |
* know there are new descriptors to fetch. (Only |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3024 |
* applicable for weak-ordered memory model archs, |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3025 |
* such as IA-64). */ |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3026 |
wmb(); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3027 |
E1000_WRITE_REG(&adapter->hw, RDT, i); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3028 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3029 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3030 |
skb->protocol = eth_type_trans(skb, netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3031 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3032 |
if(unlikely(adapter->vlgrp && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3033 |
(rx_desc->status & E1000_RXD_STAT_VP))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3034 |
vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3035 |
le16_to_cpu(rx_desc->special) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3036 |
E1000_RXD_SPC_VLAN_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3037 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3038 |
netif_receive_skb(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3039 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3040 |
#else /* CONFIG_E1000_NAPI */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3041 |
if(unlikely(adapter->vlgrp && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3042 |
(rx_desc->status & E1000_RXD_STAT_VP))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3043 |
vlan_hwaccel_rx(skb, adapter->vlgrp, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3044 |
le16_to_cpu(rx_desc->special) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3045 |
E1000_RXD_SPC_VLAN_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3046 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3047 |
netif_rx(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3048 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3049 |
#endif /* CONFIG_E1000_NAPI */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3050 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3051 |
netdev->last_rx = jiffies; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3052 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3053 |
next_desc: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3054 |
rx_desc->status = 0; |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3055 |
if (!adapter->ecdev) buffer_info->skb = NULL; |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3056 |
if(unlikely(++i == rx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3057 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3058 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3059 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3060 |
rx_ring->next_to_clean = i; |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3061 |
if (adapter->ecdev) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3062 |
rx_ring->next_to_use = i; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3063 |
} else { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3064 |
adapter->alloc_rx_buf(adapter); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3065 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3066 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3067 |
return cleaned; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3068 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3069 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3070 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3071 |
* e1000_clean_rx_irq_ps - Send received data up the network stack; packet split |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3072 |
* @adapter: board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3073 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3074 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3075 |
static boolean_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3076 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3077 |
e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, int *work_done, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3078 |
int work_to_do) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3079 |
#else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3080 |
e1000_clean_rx_irq_ps(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3081 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3082 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3083 |
struct e1000_desc_ring *rx_ring = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3084 |
union e1000_rx_desc_packet_split *rx_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3085 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3086 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3087 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3088 |
struct e1000_ps_page *ps_page; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3089 |
struct e1000_ps_page_dma *ps_page_dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3090 |
struct sk_buff *skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3091 |
unsigned int i, j; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3092 |
uint32_t length, staterr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3093 |
boolean_t cleaned = FALSE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3094 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3095 |
i = rx_ring->next_to_clean; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3096 |
rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3097 |
staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3098 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3099 |
while(staterr & E1000_RXD_STAT_DD) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3100 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3101 |
ps_page = &rx_ring->ps_page[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3102 |
ps_page_dma = &rx_ring->ps_page_dma[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3103 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3104 |
if(unlikely(*work_done >= work_to_do)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3105 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3106 |
(*work_done)++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3107 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3108 |
cleaned = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3109 |
pci_unmap_single(pdev, buffer_info->dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3110 |
buffer_info->length, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3111 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3112 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3113 |
skb = buffer_info->skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3114 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3115 |
if(unlikely(!(staterr & E1000_RXD_STAT_EOP))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3116 |
E1000_DBG("%s: Packet Split buffers didn't pick up" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3117 |
" the full packet\n", netdev->name); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3118 |
if (!adapter->ecdev) dev_kfree_skb_irq(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3119 |
goto next_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3120 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3121 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3122 |
if(unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3123 |
if (!adapter->ecdev) dev_kfree_skb_irq(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3124 |
goto next_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3125 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3126 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3127 |
length = le16_to_cpu(rx_desc->wb.middle.length0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3128 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3129 |
if(unlikely(!length)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3130 |
E1000_DBG("%s: Last part of the packet spanning" |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3131 |
" multiple descriptors\n", netdev->name); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3132 |
if (!adapter->ecdev) dev_kfree_skb_irq(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3133 |
goto next_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3134 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3135 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3136 |
/* Good Receive */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3137 |
skb_put(skb, length); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3138 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3139 |
for(j = 0; j < PS_PAGE_BUFFERS; j++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3140 |
if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3141 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3142 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3143 |
pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3144 |
PAGE_SIZE, PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3145 |
ps_page_dma->ps_page_dma[j] = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3146 |
skb_shinfo(skb)->frags[j].page = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3147 |
ps_page->ps_page[j]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3148 |
ps_page->ps_page[j] = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3149 |
skb_shinfo(skb)->frags[j].page_offset = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3150 |
skb_shinfo(skb)->frags[j].size = length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3151 |
skb_shinfo(skb)->nr_frags++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3152 |
skb->len += length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3153 |
skb->data_len += length; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3154 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3155 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3156 |
e1000_rx_checksum(adapter, staterr, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3157 |
rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3158 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3159 |
#ifdef HAVE_RX_ZERO_COPY |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3160 |
if(likely(rx_desc->wb.upper.header_status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3161 |
E1000_RXDPS_HDRSTAT_HDRSP)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3162 |
skb_shinfo(skb)->zero_copy = TRUE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3163 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3164 |
if (adapter->ecdev) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3165 |
ecdev_receive(adapter->ecdev, skb->data, length); |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3166 |
skb_trim(skb, 0); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3167 |
|
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3168 |
if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3169 |
/* Force memory writes to complete before letting h/w |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3170 |
* know there are new descriptors to fetch. (Only |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3171 |
* applicable for weak-ordered memory model archs, |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3172 |
* such as IA-64). */ |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3173 |
wmb(); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3174 |
/* Hardware increments by 16 bytes, but packet split |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3175 |
* descriptors are 32 bytes...so we increment tail |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3176 |
* twice as much. |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3177 |
*/ |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3178 |
E1000_WRITE_REG(&adapter->hw, RDT, i<<1); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3179 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3180 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3181 |
skb->protocol = eth_type_trans(skb, netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3182 |
#ifdef CONFIG_E1000_NAPI |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3183 |
if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3184 |
vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3185 |
le16_to_cpu(rx_desc->wb.middle.vlan) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3186 |
E1000_RXD_SPC_VLAN_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3187 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3188 |
netif_receive_skb(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3189 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3190 |
#else /* CONFIG_E1000_NAPI */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3191 |
if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3192 |
vlan_hwaccel_rx(skb, adapter->vlgrp, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3193 |
le16_to_cpu(rx_desc->wb.middle.vlan) & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3194 |
E1000_RXD_SPC_VLAN_MASK); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3195 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3196 |
netif_rx(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3197 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3198 |
#endif /* CONFIG_E1000_NAPI */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3199 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3200 |
netdev->last_rx = jiffies; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3201 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3202 |
next_desc: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3203 |
rx_desc->wb.middle.status_error &= ~0xFF; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3204 |
if (!adapter->ecdev) buffer_info->skb = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3205 |
if(unlikely(++i == rx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3206 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3207 |
rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3208 |
staterr = le32_to_cpu(rx_desc->wb.middle.status_error); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3209 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3210 |
rx_ring->next_to_clean = i; |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3211 |
if (adapter->ecdev) { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3212 |
rx_ring->next_to_use = i; |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3213 |
} else { |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3214 |
adapter->alloc_rx_buf(adapter); |
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3215 |
} |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3216 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3217 |
return cleaned; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3218 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3219 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3220 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3221 |
* e1000_alloc_rx_buffers - Replace used receive buffers; legacy & extended |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3222 |
* @adapter: address of board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3223 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3224 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3225 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3226 |
e1000_alloc_rx_buffers(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3227 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3228 |
struct e1000_desc_ring *rx_ring = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3229 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3230 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3231 |
struct e1000_rx_desc *rx_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3232 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3233 |
struct sk_buff *skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3234 |
unsigned int i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3235 |
unsigned int bufsz = adapter->rx_buffer_len + NET_IP_ALIGN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3236 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3237 |
i = rx_ring->next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3238 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3239 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3240 |
while(!buffer_info->skb) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3241 |
skb = dev_alloc_skb(bufsz); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3242 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3243 |
if(unlikely(!skb)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3244 |
/* Better luck next round */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3245 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3246 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3247 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3248 |
/* Fix for errata 23, can't cross 64kB boundary */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3249 |
if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3250 |
struct sk_buff *oldskb = skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3251 |
DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3252 |
"at %p\n", bufsz, skb->data); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3253 |
/* Try again, without freeing the previous */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3254 |
skb = dev_alloc_skb(bufsz); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3255 |
/* Failed allocation, critical failure */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3256 |
if (!skb) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3257 |
dev_kfree_skb(oldskb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3258 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3259 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3260 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3261 |
if (!e1000_check_64k_bound(adapter, skb->data, bufsz)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3262 |
/* give up */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3263 |
dev_kfree_skb(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3264 |
dev_kfree_skb(oldskb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3265 |
break; /* while !buffer_info->skb */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3266 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3267 |
/* Use new allocation */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3268 |
dev_kfree_skb(oldskb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3269 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3270 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3271 |
/* Make buffer alignment 2 beyond a 16 byte boundary |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3272 |
* this will result in a 16 byte aligned IP header after |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3273 |
* the 14 byte MAC header is removed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3274 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3275 |
skb_reserve(skb, NET_IP_ALIGN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3276 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3277 |
skb->dev = netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3278 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3279 |
buffer_info->skb = skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3280 |
buffer_info->length = adapter->rx_buffer_len; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3281 |
buffer_info->dma = pci_map_single(pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3282 |
skb->data, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3283 |
adapter->rx_buffer_len, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3284 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3285 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3286 |
/* Fix for errata 23, can't cross 64kB boundary */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3287 |
if (!e1000_check_64k_bound(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3288 |
(void *)(unsigned long)buffer_info->dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3289 |
adapter->rx_buffer_len)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3290 |
DPRINTK(RX_ERR, ERR, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3291 |
"dma align check failed: %u bytes at %p\n", |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3292 |
adapter->rx_buffer_len, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3293 |
(void *)(unsigned long)buffer_info->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3294 |
dev_kfree_skb(skb); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3295 |
buffer_info->skb = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3296 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3297 |
pci_unmap_single(pdev, buffer_info->dma, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3298 |
adapter->rx_buffer_len, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3299 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3300 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3301 |
break; /* while !buffer_info->skb */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3302 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3303 |
rx_desc = E1000_RX_DESC(*rx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3304 |
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3305 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3306 |
if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3307 |
/* Force memory writes to complete before letting h/w |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3308 |
* know there are new descriptors to fetch. (Only |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3309 |
* applicable for weak-ordered memory model archs, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3310 |
* such as IA-64). */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3311 |
wmb(); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3312 |
E1000_WRITE_REG(&adapter->hw, RDT, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3313 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3314 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3315 |
if(unlikely(++i == rx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3316 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3317 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3318 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3319 |
rx_ring->next_to_use = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3320 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3321 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3322 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3323 |
* e1000_alloc_rx_buffers_ps - Replace used receive buffers; packet split |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3324 |
* @adapter: address of board private structure |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3325 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3326 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3327 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3328 |
e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3329 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3330 |
struct e1000_desc_ring *rx_ring = &adapter->rx_ring; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3331 |
struct net_device *netdev = adapter->netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3332 |
struct pci_dev *pdev = adapter->pdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3333 |
union e1000_rx_desc_packet_split *rx_desc; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3334 |
struct e1000_buffer *buffer_info; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3335 |
struct e1000_ps_page *ps_page; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3336 |
struct e1000_ps_page_dma *ps_page_dma; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3337 |
struct sk_buff *skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3338 |
unsigned int i, j; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3339 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3340 |
i = rx_ring->next_to_use; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3341 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3342 |
ps_page = &rx_ring->ps_page[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3343 |
ps_page_dma = &rx_ring->ps_page_dma[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3344 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3345 |
while(!buffer_info->skb) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3346 |
rx_desc = E1000_RX_DESC_PS(*rx_ring, i); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3347 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3348 |
for(j = 0; j < PS_PAGE_BUFFERS; j++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3349 |
if(unlikely(!ps_page->ps_page[j])) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3350 |
ps_page->ps_page[j] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3351 |
alloc_page(GFP_ATOMIC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3352 |
if(unlikely(!ps_page->ps_page[j])) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3353 |
goto no_buffers; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3354 |
ps_page_dma->ps_page_dma[j] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3355 |
pci_map_page(pdev, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3356 |
ps_page->ps_page[j], |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3357 |
0, PAGE_SIZE, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3358 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3359 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3360 |
/* Refresh the desc even if buffer_addrs didn't |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3361 |
* change because each write-back erases this info. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3362 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3363 |
rx_desc->read.buffer_addr[j+1] = |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3364 |
cpu_to_le64(ps_page_dma->ps_page_dma[j]); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3365 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3366 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3367 |
skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3368 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3369 |
if(unlikely(!skb)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3370 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3371 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3372 |
/* Make buffer alignment 2 beyond a 16 byte boundary |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3373 |
* this will result in a 16 byte aligned IP header after |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3374 |
* the 14 byte MAC header is removed |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3375 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3376 |
skb_reserve(skb, NET_IP_ALIGN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3377 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3378 |
skb->dev = netdev; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3379 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3380 |
buffer_info->skb = skb; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3381 |
buffer_info->length = adapter->rx_ps_bsize0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3382 |
buffer_info->dma = pci_map_single(pdev, skb->data, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3383 |
adapter->rx_ps_bsize0, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3384 |
PCI_DMA_FROMDEVICE); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3385 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3386 |
rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3387 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3388 |
if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 1)) == i)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3389 |
/* Force memory writes to complete before letting h/w |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3390 |
* know there are new descriptors to fetch. (Only |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3391 |
* applicable for weak-ordered memory model archs, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3392 |
* such as IA-64). */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3393 |
wmb(); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3394 |
/* Hardware increments by 16 bytes, but packet split |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3395 |
* descriptors are 32 bytes...so we increment tail |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3396 |
* twice as much. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3397 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3398 |
E1000_WRITE_REG(&adapter->hw, RDT, i<<1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3399 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3400 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3401 |
if(unlikely(++i == rx_ring->count)) i = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3402 |
buffer_info = &rx_ring->buffer_info[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3403 |
ps_page = &rx_ring->ps_page[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3404 |
ps_page_dma = &rx_ring->ps_page_dma[i]; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3405 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3406 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3407 |
no_buffers: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3408 |
rx_ring->next_to_use = i; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3409 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3410 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3411 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3412 |
* e1000_smartspeed - Workaround for SmartSpeed on 82541 and 82547 controllers. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3413 |
* @adapter: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3414 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3415 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3416 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3417 |
e1000_smartspeed(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3418 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3419 |
uint16_t phy_status; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3420 |
uint16_t phy_ctrl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3421 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3422 |
if((adapter->hw.phy_type != e1000_phy_igp) || !adapter->hw.autoneg || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3423 |
!(adapter->hw.autoneg_advertised & ADVERTISE_1000_FULL)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3424 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3425 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3426 |
if(adapter->smartspeed == 0) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3427 |
/* If Master/Slave config fault is asserted twice, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3428 |
* we assume back-to-back */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3429 |
e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3430 |
if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3431 |
e1000_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3432 |
if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3433 |
e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3434 |
if(phy_ctrl & CR_1000T_MS_ENABLE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3435 |
phy_ctrl &= ~CR_1000T_MS_ENABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3436 |
e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3437 |
phy_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3438 |
adapter->smartspeed++; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3439 |
if(!e1000_phy_setup_autoneg(&adapter->hw) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3440 |
!e1000_read_phy_reg(&adapter->hw, PHY_CTRL, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3441 |
&phy_ctrl)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3442 |
phy_ctrl |= (MII_CR_AUTO_NEG_EN | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3443 |
MII_CR_RESTART_AUTO_NEG); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3444 |
e1000_write_phy_reg(&adapter->hw, PHY_CTRL, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3445 |
phy_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3446 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3447 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3448 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3449 |
} else if(adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3450 |
/* If still no link, perhaps using 2/3 pair cable */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3451 |
e1000_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3452 |
phy_ctrl |= CR_1000T_MS_ENABLE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3453 |
e1000_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3454 |
if(!e1000_phy_setup_autoneg(&adapter->hw) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3455 |
!e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3456 |
phy_ctrl |= (MII_CR_AUTO_NEG_EN | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3457 |
MII_CR_RESTART_AUTO_NEG); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3458 |
e1000_write_phy_reg(&adapter->hw, PHY_CTRL, phy_ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3459 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3460 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3461 |
/* Restart process after E1000_SMARTSPEED_MAX iterations */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3462 |
if(adapter->smartspeed++ == E1000_SMARTSPEED_MAX) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3463 |
adapter->smartspeed = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3464 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3465 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3466 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3467 |
* e1000_ioctl - |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3468 |
* @netdev: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3469 |
* @ifreq: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3470 |
* @cmd: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3471 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3472 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3473 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3474 |
e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3475 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3476 |
switch (cmd) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3477 |
case SIOCGMIIPHY: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3478 |
case SIOCGMIIREG: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3479 |
case SIOCSMIIREG: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3480 |
return e1000_mii_ioctl(netdev, ifr, cmd); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3481 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3482 |
return -EOPNOTSUPP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3483 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3484 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3485 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3486 |
/** |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3487 |
* e1000_mii_ioctl - |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3488 |
* @netdev: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3489 |
* @ifreq: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3490 |
* @cmd: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3491 |
**/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3492 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3493 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3494 |
e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3495 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3496 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3497 |
struct mii_ioctl_data *data = if_mii(ifr); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3498 |
int retval; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3499 |
uint16_t mii_reg; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3500 |
uint16_t spddplx; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3501 |
unsigned long flags; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3502 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3503 |
if(adapter->hw.media_type != e1000_media_type_copper) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3504 |
return -EOPNOTSUPP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3505 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3506 |
switch (cmd) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3507 |
case SIOCGMIIPHY: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3508 |
data->phy_id = adapter->hw.phy_addr; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3509 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3510 |
case SIOCGMIIREG: |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3511 |
if(adapter->ecdev || !capable(CAP_NET_ADMIN)) |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3512 |
return -EPERM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3513 |
spin_lock_irqsave(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3514 |
if(e1000_read_phy_reg(&adapter->hw, data->reg_num & 0x1F, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3515 |
&data->val_out)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3516 |
spin_unlock_irqrestore(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3517 |
return -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3518 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3519 |
spin_unlock_irqrestore(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3520 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3521 |
case SIOCSMIIREG: |
676
aa394dc1943a
First working version of e1000 driver under 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
673
diff
changeset
|
3522 |
if(adapter->ecdev || !capable(CAP_NET_ADMIN)) |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3523 |
return -EPERM; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3524 |
if(data->reg_num & ~(0x1F)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3525 |
return -EFAULT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3526 |
mii_reg = data->val_in; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3527 |
spin_lock_irqsave(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3528 |
if(e1000_write_phy_reg(&adapter->hw, data->reg_num, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3529 |
mii_reg)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3530 |
spin_unlock_irqrestore(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3531 |
return -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3532 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3533 |
if(adapter->hw.phy_type == e1000_phy_m88) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3534 |
switch (data->reg_num) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3535 |
case PHY_CTRL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3536 |
if(mii_reg & MII_CR_POWER_DOWN) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3537 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3538 |
if(mii_reg & MII_CR_AUTO_NEG_EN) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3539 |
adapter->hw.autoneg = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3540 |
adapter->hw.autoneg_advertised = 0x2F; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3541 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3542 |
if (mii_reg & 0x40) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3543 |
spddplx = SPEED_1000; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3544 |
else if (mii_reg & 0x2000) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3545 |
spddplx = SPEED_100; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3546 |
else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3547 |
spddplx = SPEED_10; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3548 |
spddplx += (mii_reg & 0x100) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3549 |
? FULL_DUPLEX : |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3550 |
HALF_DUPLEX; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3551 |
retval = e1000_set_spd_dplx(adapter, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3552 |
spddplx); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3553 |
if(retval) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3554 |
spin_unlock_irqrestore( |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3555 |
&adapter->stats_lock, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3556 |
flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3557 |
return retval; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3558 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3559 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3560 |
if(adapter->ecdev || netif_running(adapter->netdev)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3561 |
e1000_down(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3562 |
e1000_up(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3563 |
} else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3564 |
e1000_reset(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3565 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3566 |
case M88E1000_PHY_SPEC_CTRL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3567 |
case M88E1000_EXT_PHY_SPEC_CTRL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3568 |
if(e1000_phy_reset(&adapter->hw)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3569 |
spin_unlock_irqrestore( |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3570 |
&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3571 |
return -EIO; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3572 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3573 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3574 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3575 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3576 |
switch (data->reg_num) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3577 |
case PHY_CTRL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3578 |
if(mii_reg & MII_CR_POWER_DOWN) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3579 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3580 |
if(adapter->ecdev || netif_running(adapter->netdev)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3581 |
e1000_down(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3582 |
e1000_up(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3583 |
} else |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3584 |
e1000_reset(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3585 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3586 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3587 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3588 |
spin_unlock_irqrestore(&adapter->stats_lock, flags); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3589 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3590 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3591 |
return -EOPNOTSUPP; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3592 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3593 |
return E1000_SUCCESS; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3594 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3595 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3596 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3597 |
e1000_pci_set_mwi(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3598 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3599 |
struct e1000_adapter *adapter = hw->back; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3600 |
int ret_val = pci_set_mwi(adapter->pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3601 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3602 |
if(ret_val) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3603 |
DPRINTK(PROBE, ERR, "Error in setting MWI\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3604 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3605 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3606 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3607 |
e1000_pci_clear_mwi(struct e1000_hw *hw) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3608 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3609 |
struct e1000_adapter *adapter = hw->back; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3610 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3611 |
pci_clear_mwi(adapter->pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3612 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3613 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3614 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3615 |
e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3616 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3617 |
struct e1000_adapter *adapter = hw->back; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3618 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3619 |
pci_read_config_word(adapter->pdev, reg, value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3620 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3621 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3622 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3623 |
e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3624 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3625 |
struct e1000_adapter *adapter = hw->back; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3626 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3627 |
pci_write_config_word(adapter->pdev, reg, *value); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3628 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3629 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3630 |
uint32_t |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3631 |
e1000_io_read(struct e1000_hw *hw, unsigned long port) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3632 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3633 |
return inl(port); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3634 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3635 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3636 |
void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3637 |
e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3638 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3639 |
outl(value, port); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3640 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3641 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3642 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3643 |
e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3644 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3645 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3646 |
uint32_t ctrl, rctl; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3647 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3648 |
e1000_irq_disable(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3649 |
adapter->vlgrp = grp; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3650 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3651 |
if(grp) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3652 |
/* enable VLAN tag insert/strip */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3653 |
ctrl = E1000_READ_REG(&adapter->hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3654 |
ctrl |= E1000_CTRL_VME; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3655 |
E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3656 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3657 |
/* enable VLAN receive filtering */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3658 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3659 |
rctl |= E1000_RCTL_VFE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3660 |
rctl &= ~E1000_RCTL_CFIEN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3661 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3662 |
e1000_update_mng_vlan(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3663 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3664 |
/* disable VLAN tag insert/strip */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3665 |
ctrl = E1000_READ_REG(&adapter->hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3666 |
ctrl &= ~E1000_CTRL_VME; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3667 |
E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3668 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3669 |
/* disable VLAN filtering */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3670 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3671 |
rctl &= ~E1000_RCTL_VFE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3672 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3673 |
if(adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3674 |
e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3675 |
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3676 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3677 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3678 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3679 |
e1000_irq_enable(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3680 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3681 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3682 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3683 |
e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3684 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3685 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3686 |
uint32_t vfta, index; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3687 |
if((adapter->hw.mng_cookie.status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3688 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3689 |
(vid == adapter->mng_vlan_id)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3690 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3691 |
/* add VID to filter table */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3692 |
index = (vid >> 5) & 0x7F; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3693 |
vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3694 |
vfta |= (1 << (vid & 0x1F)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3695 |
e1000_write_vfta(&adapter->hw, index, vfta); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3696 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3697 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3698 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3699 |
e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3700 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3701 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3702 |
uint32_t vfta, index; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3703 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3704 |
e1000_irq_disable(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3705 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3706 |
if(adapter->vlgrp) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3707 |
adapter->vlgrp->vlan_devices[vid] = NULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3708 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3709 |
e1000_irq_enable(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3710 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3711 |
if((adapter->hw.mng_cookie.status & |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3712 |
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3713 |
(vid == adapter->mng_vlan_id)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3714 |
return; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3715 |
/* remove VID from filter table */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3716 |
index = (vid >> 5) & 0x7F; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3717 |
vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3718 |
vfta &= ~(1 << (vid & 0x1F)); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3719 |
e1000_write_vfta(&adapter->hw, index, vfta); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3720 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3721 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3722 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3723 |
e1000_restore_vlan(struct e1000_adapter *adapter) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3724 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3725 |
e1000_vlan_rx_register(adapter->netdev, adapter->vlgrp); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3726 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3727 |
if(adapter->vlgrp) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3728 |
uint16_t vid; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3729 |
for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3730 |
if(!adapter->vlgrp->vlan_devices[vid]) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3731 |
continue; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3732 |
e1000_vlan_rx_add_vid(adapter->netdev, vid); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3733 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3734 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3735 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3736 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3737 |
int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3738 |
e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3739 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3740 |
adapter->hw.autoneg = 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3741 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3742 |
/* Fiber NICs only allow 1000 gbps Full duplex */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3743 |
if((adapter->hw.media_type == e1000_media_type_fiber) && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3744 |
spddplx != (SPEED_1000 + DUPLEX_FULL)) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3745 |
DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3746 |
return -EINVAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3747 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3748 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3749 |
switch(spddplx) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3750 |
case SPEED_10 + DUPLEX_HALF: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3751 |
adapter->hw.forced_speed_duplex = e1000_10_half; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3752 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3753 |
case SPEED_10 + DUPLEX_FULL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3754 |
adapter->hw.forced_speed_duplex = e1000_10_full; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3755 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3756 |
case SPEED_100 + DUPLEX_HALF: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3757 |
adapter->hw.forced_speed_duplex = e1000_100_half; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3758 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3759 |
case SPEED_100 + DUPLEX_FULL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3760 |
adapter->hw.forced_speed_duplex = e1000_100_full; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3761 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3762 |
case SPEED_1000 + DUPLEX_FULL: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3763 |
adapter->hw.autoneg = 1; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3764 |
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3765 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3766 |
case SPEED_1000 + DUPLEX_HALF: /* not supported */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3767 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3768 |
DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n"); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3769 |
return -EINVAL; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3770 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3771 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3772 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3773 |
|
724
f188f8a0cafd
Include e1000_suspend() in #ifdef CONFIG_PM.
Florian Pose <fp@igh-essen.com>
parents:
677
diff
changeset
|
3774 |
#ifdef CONFIG_PM |
673
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3775 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3776 |
e1000_suspend(struct pci_dev *pdev, uint32_t state) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3777 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3778 |
struct net_device *netdev = pci_get_drvdata(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3779 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3780 |
uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3781 |
uint32_t wufc = adapter->wol; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3782 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3783 |
if (!adapter->ecdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3784 |
netif_device_detach(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3785 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3786 |
if (adapter->ecdev || netif_running(netdev)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3787 |
e1000_down(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3788 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3789 |
status = E1000_READ_REG(&adapter->hw, STATUS); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3790 |
if(status & E1000_STATUS_LU) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3791 |
wufc &= ~E1000_WUFC_LNKC; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3792 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3793 |
if(wufc) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3794 |
e1000_setup_rctl(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3795 |
e1000_set_multi(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3796 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3797 |
/* turn on all-multi mode if wake on multicast is enabled */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3798 |
if(adapter->wol & E1000_WUFC_MC) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3799 |
rctl = E1000_READ_REG(&adapter->hw, RCTL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3800 |
rctl |= E1000_RCTL_MPE; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3801 |
E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3802 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3803 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3804 |
if(adapter->hw.mac_type >= e1000_82540) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3805 |
ctrl = E1000_READ_REG(&adapter->hw, CTRL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3806 |
/* advertise wake from D3Cold */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3807 |
#define E1000_CTRL_ADVD3WUC 0x00100000 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3808 |
/* phy power management enable */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3809 |
#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3810 |
ctrl |= E1000_CTRL_ADVD3WUC | |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3811 |
E1000_CTRL_EN_PHY_PWR_MGMT; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3812 |
E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3813 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3814 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3815 |
if(adapter->hw.media_type == e1000_media_type_fiber || |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3816 |
adapter->hw.media_type == e1000_media_type_internal_serdes) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3817 |
/* keep the laser running in D3 */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3818 |
ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3819 |
ctrl_ext |= E1000_CTRL_EXT_SDP7_DATA; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3820 |
E1000_WRITE_REG(&adapter->hw, CTRL_EXT, ctrl_ext); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3821 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3822 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3823 |
/* Allow time for pending master requests to run */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3824 |
e1000_disable_pciex_master(&adapter->hw); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3825 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3826 |
E1000_WRITE_REG(&adapter->hw, WUC, E1000_WUC_PME_EN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3827 |
E1000_WRITE_REG(&adapter->hw, WUFC, wufc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3828 |
pci_enable_wake(pdev, 3, 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3829 |
pci_enable_wake(pdev, 4, 1); /* 4 == D3 cold */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3830 |
} else { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3831 |
E1000_WRITE_REG(&adapter->hw, WUC, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3832 |
E1000_WRITE_REG(&adapter->hw, WUFC, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3833 |
pci_enable_wake(pdev, 3, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3834 |
pci_enable_wake(pdev, 4, 0); /* 4 == D3 cold */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3835 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3836 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3837 |
pci_save_state(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3838 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3839 |
if(adapter->hw.mac_type >= e1000_82540 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3840 |
adapter->hw.media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3841 |
manc = E1000_READ_REG(&adapter->hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3842 |
if(manc & E1000_MANC_SMBUS_EN) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3843 |
manc |= E1000_MANC_ARP_EN; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3844 |
E1000_WRITE_REG(&adapter->hw, MANC, manc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3845 |
pci_enable_wake(pdev, 3, 1); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3846 |
pci_enable_wake(pdev, 4, 1); /* 4 == D3 cold */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3847 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3848 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3849 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3850 |
switch(adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3851 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3852 |
swsm = E1000_READ_REG(&adapter->hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3853 |
E1000_WRITE_REG(&adapter->hw, SWSM, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3854 |
swsm & ~E1000_SWSM_DRV_LOAD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3855 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3856 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3857 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3858 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3859 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3860 |
pci_disable_device(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3861 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3862 |
state = (state > 0) ? 3 : 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3863 |
pci_set_power_state(pdev, state); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3864 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3865 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3866 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3867 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3868 |
static int |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3869 |
e1000_resume(struct pci_dev *pdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3870 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3871 |
struct net_device *netdev = pci_get_drvdata(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3872 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3873 |
uint32_t manc, ret_val, swsm; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3874 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3875 |
pci_set_power_state(pdev, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3876 |
pci_restore_state(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3877 |
ret_val = pci_enable_device(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3878 |
pci_set_master(pdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3879 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3880 |
pci_enable_wake(pdev, 3, 0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3881 |
pci_enable_wake(pdev, 4, 0); /* 4 == D3 cold */ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3882 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3883 |
e1000_reset(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3884 |
E1000_WRITE_REG(&adapter->hw, WUS, ~0); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3885 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3886 |
if(adapter->ecdev || netif_running(netdev)) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3887 |
e1000_up(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3888 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3889 |
if (!adapter->ecdev) netif_device_attach(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3890 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3891 |
if(adapter->hw.mac_type >= e1000_82540 && |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3892 |
adapter->hw.media_type == e1000_media_type_copper) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3893 |
manc = E1000_READ_REG(&adapter->hw, MANC); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3894 |
manc &= ~(E1000_MANC_ARP_EN); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3895 |
E1000_WRITE_REG(&adapter->hw, MANC, manc); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3896 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3897 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3898 |
switch(adapter->hw.mac_type) { |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3899 |
case e1000_82573: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3900 |
swsm = E1000_READ_REG(&adapter->hw, SWSM); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3901 |
E1000_WRITE_REG(&adapter->hw, SWSM, |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3902 |
swsm | E1000_SWSM_DRV_LOAD); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3903 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3904 |
default: |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3905 |
break; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3906 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3907 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3908 |
return 0; |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3909 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3910 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3911 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3912 |
/* |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3913 |
* Polling 'interrupt' - used by things like netconsole to send skbs |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3914 |
* without having to re-enable interrupts. It's not called while |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3915 |
* the interrupt routine is executing. |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3916 |
*/ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3917 |
static void |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3918 |
e1000_netpoll(struct net_device *netdev) |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3919 |
{ |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3920 |
struct e1000_adapter *adapter = netdev_priv(netdev); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3921 |
disable_irq(adapter->pdev->irq); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3922 |
e1000_intr(adapter->pdev->irq, netdev, NULL); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3923 |
e1000_clean_tx_irq(adapter); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3924 |
enable_irq(adapter->pdev->irq); |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3925 |
} |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3926 |
#endif |
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3927 |
|
21c266c3f463
Added e1000 driver for kernel 2.6.13.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3928 |
/* e1000_main.c */ |